#include <EventHandler.h>
Inheritance diagram for ASSA::EventHandler:
Public Member Functions | |
EventHandler () | |
Constructor. | |
virtual | ~EventHandler () |
Virtual destructor. | |
virtual int | handle_read (int fd) |
Read event callback. | |
virtual int | handle_write (int fd) |
Write handler callback. | |
virtual int | handle_except (int fd) |
Exception handler callback. | |
virtual int | handle_timeout (TimerId tid) |
Timeout handler callback. | |
virtual int | handle_signal (int signum_) |
Signal handler callback. | |
virtual int | handle_close (int fd) |
EOF on peer socket handler callback. | |
virtual void | resetState (void) |
A hook for derived class to reset internal state as needed. | |
void | set_id (const std::string &id_) |
Set EventHandler ID. | |
std::string | get_id () const |
Retrieve EventHandler ID. | |
Protected Attributes | |
std::string | m_id |
EventHandler is a pure virtual class. It is an interface class to the Event Handlers. These events are processed by Reactor. The supported events are signals, timers, and I/O pipes such as file descriptors, sockets and such.
Definition at line 102 of file EventHandler.h.
|
Constructor.
Definition at line 165 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. 00165 : m_id ("EventHandler") 00166 { 00167 trace_with_mask("EventHandler::EventHandler",REACTTRACE); 00168 }
|
|
Virtual destructor.
Definition at line 109 of file EventHandler.h.
|
|
Retrieve EventHandler ID.
Definition at line 157 of file EventHandler.h. References m_id. Referenced by ASSA::Reactor::dispatchHandler(), ASSA::Timer::dump(), and ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_close(). 00157 { return m_id; }
|
|
EOF on peer socket handler callback. There is no corresponding EventType. One is not needed because detecting EOF is a part of handle_read () data processing.
Reimplemented in ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >, and ASSA::RemoteLogger. Definition at line 212 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. 00213 { 00214 trace_with_mask("EventHandler::handle_close",REACTTRACE); 00215 return -1; 00216 }
|
|
Exception handler callback.
Definition at line 188 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. Referenced by ASSA::Reactor::dispatch(). 00189 { 00190 trace_with_mask("EventHandler::handle_except",REACTTRACE); 00191 return -1; 00192 }
|
|
Read event callback. If reader detects EOF, it must return error to the Reactor. (See Reactor for details).
Reimplemented in ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >. Definition at line 172 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. Referenced by ASSA::Reactor::dispatch(). 00173 { 00174 trace_with_mask("EventHandler::handle_read",REACTTRACE); 00175 return -1; 00176 }
|
|
Signal handler callback.
Reimplemented in ASSA::ChildStatusHandler, ASSA::GenServer, ASSA::SIGINTHandler, ASSA::SIGUSR1Handler, ASSA::SIGUSR2Handler, ASSA::SIGCHLDHandler, ASSA::SIGALRMHandler, ASSA::SIGPOLLHandler, and ASSA::CFUNC_Handler. Definition at line 204 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. Referenced by ASSA::SigHandlers::dispatch(), and ASSA::SigHandler::dispatch(). 00205 { 00206 trace_with_mask("EventHandler::handle_signal",REACTTRACE); 00207 return -1; 00208 }
|
|
Timeout handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >. Definition at line 196 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. 00197 { 00198 trace_with_mask("EventHandler::handle_timeout",REACTTRACE); 00199 return -1; 00200 }
|
|
Write handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >. Definition at line 180 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. Referenced by ASSA::Reactor::dispatch(). 00181 { 00182 trace_with_mask("EventHandler::handle_write",REACTTRACE); 00183 return -1; 00184 }
|
|
A hook for derived class to reset internal state as needed.
Reimplemented in ASSA::SIGINTHandler, ASSA::SIGUSR1Handler, ASSA::SIGUSR2Handler, ASSA::SIGCHLDHandler, and ASSA::SIGALRMHandler. Definition at line 220 of file EventHandler.h. References ASSA::REACTTRACE, and trace_with_mask. 00221 { 00222 trace_with_mask("EventHandler::reset",REACTTRACE); 00223 }
|
|
Set EventHandler ID. ID allows Reactor and application-level code describe intelligently the kind of the EventHandler. Definition at line 153 of file EventHandler.h. References m_id. Referenced by ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::Connector(). 00153 { m_id = id_; }
|
|
Definition at line 160 of file EventHandler.h. |