OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
contrail::sandesh::transport::TFDTransport Class Reference

#include <TFDTransport.h>

Inheritance diagram for contrail::sandesh::transport::TFDTransport:
Collaboration diagram for contrail::sandesh::transport::TFDTransport:

Public Types

enum  ClosePolicy { NO_CLOSE_ON_DESTROY = 0, CLOSE_ON_DESTROY = 1 }
 

Public Member Functions

 TFDTransport (int fd, ClosePolicy close_policy=NO_CLOSE_ON_DESTROY)
 
 ~TFDTransport ()
 
bool isOpen ()
 
void open ()
 
void close ()
 
int32_t read (uint8_t *buf, uint32_t len)
 
int32_t write (const uint8_t *buf, uint32_t len)
 
void setFD (int fd)
 
int getFD ()
 
- Public Member Functions inherited from contrail::sandesh::transport::TVirtualTransport< TFDTransport >
virtual int32_t read_virt (uint8_t *buf, uint32_t len)
 
virtual int32_t readAll_virt (uint8_t *buf, uint32_t len)
 
virtual int write_virt (const uint8_t *buf, uint32_t len)
 
virtual const uint8_t * borrow_virt (uint8_t *buf, uint32_t *len)
 
virtual void consume_virt (uint32_t len)
 
uint32_t readAll (uint8_t *buf, uint32_t len)
 
- Public Member Functions inherited from contrail::sandesh::transport::TTransportDefaults
uint32_t read (uint8_t *buf, uint32_t len)
 
uint32_t readAll (uint8_t *buf, uint32_t len)
 
int write (const uint8_t *buf, uint32_t len)
 
const uint8_t * borrow (uint8_t *buf, uint32_t *len)
 
void consume (uint32_t len)
 
- Public Member Functions inherited from contrail::sandesh::transport::TTransport
virtual ~TTransport ()
 
virtual bool peek ()
 
int32_t read (uint8_t *buf, uint32_t len)
 
int32_t readAll (uint8_t *buf, uint32_t len)
 
virtual uint32_t readEnd ()
 
int write (const uint8_t *buf, uint32_t len)
 
virtual uint32_t writeEnd ()
 
virtual void flush ()
 
const uint8_t * borrow (uint8_t *buf, uint32_t *len)
 
void consume (uint32_t len)
 

Protected Attributes

int fd_
 
ClosePolicy close_policy_
 

Additional Inherited Members

- Protected Member Functions inherited from contrail::sandesh::transport::TVirtualTransport< TFDTransport >
 TVirtualTransport ()
 
 TVirtualTransport (Arg_ const &arg)
 
 TVirtualTransport (Arg1_ const &a1, Arg2_ const &a2)
 
- Protected Member Functions inherited from contrail::sandesh::transport::TTransportDefaults
 TTransportDefaults ()
 
- Protected Member Functions inherited from contrail::sandesh::transport::TTransport
 TTransport ()
 

Detailed Description

Dead-simple wrapper around a file descriptor.

Definition at line 37 of file TFDTransport.h.

Member Enumeration Documentation

Enumerator
NO_CLOSE_ON_DESTROY 
CLOSE_ON_DESTROY 

Definition at line 39 of file TFDTransport.h.

Constructor & Destructor Documentation

contrail::sandesh::transport::TFDTransport::TFDTransport ( int  fd,
ClosePolicy  close_policy = NO_CLOSE_ON_DESTROY 
)
inline

Definition at line 44 of file TFDTransport.h.

contrail::sandesh::transport::TFDTransport::~TFDTransport ( )
inline

Definition at line 49 of file TFDTransport.h.

Here is the call graph for this function:

Member Function Documentation

void contrail::sandesh::transport::TFDTransport::close ( )
virtual

Closes the transport.

Reimplemented from contrail::sandesh::transport::TTransport.

int contrail::sandesh::transport::TFDTransport::getFD ( )
inline

Definition at line 66 of file TFDTransport.h.

bool contrail::sandesh::transport::TFDTransport::isOpen ( )
inlinevirtual

Whether this transport is open.

Reimplemented from contrail::sandesh::transport::TTransport.

Definition at line 55 of file TFDTransport.h.

void contrail::sandesh::transport::TFDTransport::open ( )
inlinevirtual

Opens the transport for communications.

Returns
bool Whether the transport was successfully opened

Reimplemented from contrail::sandesh::transport::TTransport.

Definition at line 57 of file TFDTransport.h.

int32_t contrail::sandesh::transport::TFDTransport::read ( uint8_t *  buf,
uint32_t  len 
)
void contrail::sandesh::transport::TFDTransport::setFD ( int  fd)
inline

Definition at line 65 of file TFDTransport.h.

int32_t contrail::sandesh::transport::TFDTransport::write ( const uint8_t *  buf,
uint32_t  len 
)

Member Data Documentation

ClosePolicy contrail::sandesh::transport::TFDTransport::close_policy_
protected

Definition at line 70 of file TFDTransport.h.

int contrail::sandesh::transport::TFDTransport::fd_
protected

Definition at line 69 of file TFDTransport.h.


The documentation for this class was generated from the following file: