Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ola::io::ConnectedDescriptor Class Reference
Inheritance diagram for ola::io::ConnectedDescriptor:
ola::io::BidirectionalFileDescriptor ola::io::ReadFileDescriptor ola::io::WriteFileDescriptor ola::io::DeviceDescriptor ola::io::LoopbackDescriptor ola::io::PipeDescriptor ola::io::UnixSocket ola::network::TCPSocket

Public Types

typedef
ola::SingleUseCallback0< void > 
OnCloseCallback

Public Member Functions

virtual ssize_t Send (const uint8_t *buffer, unsigned int size)
virtual ssize_t Send (IOQueue *data)
virtual int Receive (uint8_t *buffer, unsigned int size, unsigned int &data_read)
virtual bool SetReadNonBlocking ()
virtual bool Close ()=0
int DataRemaining () const
bool IsClosed () const
void SetOnClose (OnCloseCallback *on_close)
OnCloseCallbackTransferOnClose ()
- Public Member Functions inherited from ola::io::BidirectionalFileDescriptor
void SetOnData (ola::Callback0< void > *on_read)
void SetOnWritable (ola::Callback0< void > *on_write)
void PerformRead ()
void PerformWrite ()
- Public Member Functions inherited from ola::io::ReadFileDescriptor
virtual int ReadDescriptor () const =0
bool ValidReadDescriptor () const
- Public Member Functions inherited from ola::io::WriteFileDescriptor
virtual int WriteDescriptor () const =0
bool ValidWriteDescriptor () const

Static Public Member Functions

static bool SetNonBlocking (int fd)

Protected Member Functions

virtual bool IsSocket () const =0
bool SetNoSigPipe (int fd)
 ConnectedDescriptor (const ConnectedDescriptor &other)
ConnectedDescriptoroperator= (const ConnectedDescriptor &other)

Member Function Documentation

ssize_t ola::io::ConnectedDescriptor::Send ( IOQueue ioqueue)
virtual

Send an IOQueue. This attempts to send as much of the IOQueue data as possible. The IOQueue may be non-empty when this completes if the descriptor buffer is full.

Returns
the number of bytes sent.
OnCloseCallback* ola::io::ConnectedDescriptor::TransferOnClose ( )
inline

This is a special method which transfers ownership of the on close handler away from the socket. Often when an on_close callback runs we want to delete the socket that it's bound to. This causes problems because we can't tell the difference between a normal deletion and a deletion triggered by a close, and the latter causes the callback to be deleted while it's running. To avoid this we we want to call the on close handler we transfer ownership away from the socket so doesn't need to delete the running handler.


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