xorp

FinderTcpBase Class Reference

Inheritance diagram for FinderTcpBase:
NONCOPYABLE DummyFinderTcp FinderTcpMessenger

List of all members.

Public Member Functions

 FinderTcpBase (EventLoop &e, XorpFd fd)
virtual bool read_event (int errval, const uint8_t *data, uint32_t data_bytes)=0
 Method to be implemented by derived classes that is called when data arrives or an error occurs when processing when data arrives.
void set_read_enabled (bool en)
 Control whether read events can occur.
bool read_enabled () const
 Determine whether read events can occur.
bool write_data (const uint8_t *data, uint32_t data_bytes)
 Write data on TCP connection.
bool write_data (const iovec *iov, uint32_t iovcnt)
virtual void write_event (int errval, const uint8_t *data, uint32_t data_bytes)=0
 Method to be implemented by derived classes that is called when data writing completes or an error occurs when processing when write.
virtual void close_event ()
 Method that may be implemented by derived classes for detecting when the underlying socket is closed.
virtual void error_event ()
void close ()
bool closed () const

Protected Member Functions

void read_callback (AsyncFileOperator::Event, const uint8_t *, size_t, size_t)
void write_callback (AsyncFileOperator::Event, const uint8_t *, size_t, size_t)

Protected Attributes

XorpFd _sock
vector< uint8_t > _input_buffer
AsyncFileReader _reader
AsyncFileWriter _writer
uint32_t _isize
uint32_t _osize

Member Function Documentation

bool FinderTcpBase::read_enabled ( ) const

Determine whether read events can occur.

Returns:
true if read events are enabled.
virtual bool FinderTcpBase::read_event ( int  errval,
const uint8_t *  data,
uint32_t  data_bytes 
) [pure virtual]

Method to be implemented by derived classes that is called when data arrives or an error occurs when processing when data arrives.

Parameters:
errvalerror code, values are equivalent to errno.
datapointer to data
data_bytessize of data.
Returns:
true if the data was processed without an error and the connection was kept, otherwise false.

Implemented in FinderTcpMessenger, and DummyFinderTcp.

void FinderTcpBase::set_read_enabled ( bool  en)

Control whether read events can occur.

Parameters:
enboolean value with true corresponding to read enabled.
bool FinderTcpBase::write_data ( const uint8_t *  data,
uint32_t  data_bytes 
)

Write data on TCP connection.

To avoid an unnecessary data copy, the client is expected to ensure the data is valid until departure_event is called with the corresponding data pointer.

Parameters:
datapointer to data.
data_bytessize data pointed to in bytes.
Returns:
true if data accepted for writing, false if no buffer space is available at this time.
virtual void FinderTcpBase::write_event ( int  errval,
const uint8_t *  data,
uint32_t  data_bytes 
) [pure virtual]

Method to be implemented by derived classes that is called when data writing completes or an error occurs when processing when write.

Parameters:
errvalerror code, values are equivalent to errno.

Implemented in FinderTcpMessenger, and DummyFinderTcp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations