LCOV - code coverage report
Current view: directory - src/trusted/port - transport.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 2 1 50.0 %
Date: 2012-02-16 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright 2010 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can
       4                 :  * be found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : 
       8                 : // This module provides interfaces for an IO stream.  The stream is
       9                 : // expected to throw a std::exception if the stream is terminated on
      10                 : // either side.
      11                 : #ifndef NATIVE_CLIENT_PORT_TRANSPORT_H_
      12                 : #define NATIVE_CLIENT_PORT_TRANSPORT_H_
      13                 : 
      14                 : #include "native_client/src/trusted/port/std_types.h"
      15                 : 
      16                 : namespace port {
      17                 : 
      18               6 : class ITransport {
      19                 :  public:
      20                 :   // Read from this transport, return a negative value if there is an error
      21                 :   // otherwise return the number of bytes actually read.
      22                 :   virtual int32_t Read(void *ptr, int32_t len) = 0;
      23                 : 
      24                 :   // Write to this transport, return a negative value if there is an error
      25                 :   // otherwise return the number of bytes actually written.
      26                 :   virtual int32_t Write(const void *ptr, int32_t len)  = 0;
      27                 : 
      28                 :   // Return true once read will not block or false after ms milliseconds.
      29                 :   virtual bool ReadWaitWithTimeout(uint32_t ms) = 0;
      30                 : 
      31                 :   // Disconnect the transport, R/W and Select will now throw an exception
      32                 :   virtual void Disconnect() = 0;
      33                 : 
      34                 :   // Attempt to connect to, or accept connection at the specified address
      35                 :   static ITransport *Connect(const char *addr);
      36                 :   static ITransport *Accept(const char *addr);
      37                 :   static void Free(ITransport *transport);
      38                 : 
      39                 :  protected:
      40               0 :   virtual ~ITransport() {}  // Prevent delete of base pointer
      41                 : };
      42                 : 
      43                 : 
      44                 : }  // namespace port
      45                 : 
      46                 : #endif  // NATIVE_CLIENT_PORT_TRANSPORT_H_
      47                 : 

Generated by: LCOV version 1.7