28 #ifndef AsyncComm_IOHandlerData_h
29 #define AsyncComm_IOHandlerData_h
163 #if defined(__APPLE__) || defined(__FreeBSD__)
188 #elif defined(__linux__)
215 #elif defined(__sun__)
334 #endif // AsyncComm_IOHandlerData_h
std::list< CommBufPtr > m_send_queue
Send queue.
void disconnect() override
Disconnects handler by delivering Event::DISCONNECT via default dispatch handler. ...
size_t m_message_header_remaining
Amount of header remaining to be read.
chrono::time_point< fast_clock > time_point
Abstract base class for application dispatch handlers registered with AsyncComm.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
int send_message(CommBufPtr &cbp, uint32_t timeout_ms=0, DispatchHandler *disp_handler=nullptr)
Sends message pointed to by cbp over socket associated with this I/O handler.
bool handle_event(struct pollfd *event, ClockT::time_point arrival_time) override
Handle poll() interface events.
bool m_connected
Flag indicating if socket connection has been completed.
void handle_message_body()
Processes a message body.
Encapsulate an internet address.
std::shared_ptr< CommBuf > CommBufPtr
Smart pointer to CommBuf.
void reset_incoming_message_state()
Resets incoming message buffer state in preparation for next message.
Base class for socket descriptor I/O handlers.
virtual ~IOHandlerData()
Destructor.
I/O handler for TCP sockets.
Connection disconnected event.
IOHandlerData(int sd, const InetAddr &addr, const DispatchHandlerPtr &dhp, bool connected=false)
Constructor.
bool m_got_header
Flag indicating if message header has been completely received.
uint8_t * m_message_header_ptr
Pointer to next write position in m_message_header.
bool handle_write_readiness()
Handles write readiness by completing connection and flushing send queue.
size_t m_message_remaining
Amount of message payload remaining to be read.
Declarations for CommBuf.
EventPtr m_event
Pointer to Event object holding message to deliver to application.
String m_proxy
Proxy name for this connection.
int32_t m_error
Error code.
std::shared_ptr< DispatchHandler > DispatchHandlerPtr
Smart pointer to DispatchHandler.
void deliver_event(EventPtr &event, DispatchHandler *dh=0)
Convenience method for delivering event to application.
int flush_send_queue()
Flushes send queue.
void free_message_buffer()
Frees the message buffer (m_message).
uint8_t * m_message
Poiner to message payload buffer.
void handle_disconnect()
Decomissions the handler.
InetAddr m_addr
Handler socket address.
Error codes, Exception handling, error logging.
uint8_t * m_message_ptr
Pointer to next write position in m_message.
uint8_t m_message_header[64]
Message header buffer.
Declarations for IOHandler.
bool m_message_aligned
Flag indicating if message buffer was allocated with posix_memalign()
void handle_message_header(ClockT::time_point arrival_time)
Processes a message header.