|
|||
|
|||
|
#include <socketengine.h>
Inheritance diagram for EventHandler:


Public Member Functions | |
| Module * | GetIOHook () |
| Return the current hooker of IO events for this socket, or NULL. | |
| bool | AddIOHook (Module *IOHooker) |
| Set a module as hooking IO events on this socket. | |
| bool | DelIOHook () |
| Remove IO hooking from a module. | |
| int | GetFd () |
| Get the current file descriptor. | |
| void | SetFd (int FD) |
| Set a new file desciptor. | |
| EventHandler () | |
| Constructor. | |
| virtual | ~EventHandler () |
| Destructor. | |
| virtual bool | Readable () |
| Override this function to indicate readability. | |
| virtual bool | Writeable () |
| Override this function to indicate writeability. | |
| virtual void | HandleEvent (EventType et, int errornum=0)=0 |
| Process an I/O event. | |
Protected Attributes | |
| int | fd |
| File descriptor. | |
| Module * | IOHook |
| Pointer to the module which has hooked the given EventHandler for IO events. | |
Any object which wishes to receive basic I/O events from the socketengine must derive from this class and implement the HandleEvent() method. The derived class must then be added to SocketEngine using the method SocketEngine::AddFd(), after which point the derived class will receive events to its HandleEvent() method. The derived class should also implement one of Readable() and Writeable(). In the current implementation, only Readable() is used. If this returns true, the socketengine inserts a readable socket. If it is false, the socketengine inserts a writeable socket. The derived class should never change the value this function returns without first deleting the socket from the socket engine. The only requirement beyond this for an event handler is that it must have a file descriptor. What this file descriptor is actually attached to is completely up to you.
Definition at line 61 of file socketengine.h.
|
|
Constructor.
Definition at line 44 of file socketengine.cpp. References IOHook. |
|
|
Destructor.
Definition at line 113 of file socketengine.h. |
|
|
Set a module as hooking IO events on this socket.
Definition at line 49 of file socketengine.cpp. References IOHook. Referenced by CommandStartTLS::Handle(), ModuleSSLOpenSSL::OnHookUserIO(), ModuleSSLGnuTLS::OnHookUserIO(), ModuleZLib::OnRequest(), ModuleSSLOpenSSL::OnRequest(), ModuleSSLGnuTLS::OnRequest(), and SpanningTreeUtilities::ReadConfiguration(). |
|
|
Remove IO hooking from a module.
Definition at line 58 of file socketengine.cpp. References IOHook. Referenced by ModuleSSLOpenSSL::OnCleanup(), ModuleSSLGnuTLS::OnCleanup(), ModuleZLib::OnRequest(), ModuleSSLOpenSSL::OnRequest(), and ModuleSSLGnuTLS::OnRequest(). |
|
|
|
Return the current hooker of IO events for this socket, or NULL.
Definition at line 67 of file socketengine.cpp. References IOHook. Referenced by UserManager::AddUser(), CullList::Apply(), BufferedSocket::Close(), BufferedSocket::FlushWriteBuffer(), CommandStartTLS::Handle(), BufferedSocket::InternalMarkConnected(), ServerSocketListener::OnAcceptReady(), ModuleSSLOpenSSL::OnCleanup(), ModuleSSLGnuTLS::OnCleanup(), ModuleSSLOpenSSL::OnHookUserIO(), ModuleSSLGnuTLS::OnHookUserIO(), BufferedSocket::Read(), and User::Write(). |
|
||||||||||||
|
Process an I/O event. You MUST implement this function in your derived class, and it will be called whenever read or write events are received, depending on what your functions Readable() and Writeable() returns and wether you previously made a call to SocketEngine::WantWrite().
Implemented in IdentRequestSocket, SQLConn, DNS, BufferedSocket, FileWriter, ListenSocketBase, and User. |
|
|
Override this function to indicate readability.
Reimplemented in BufferedSocket. Definition at line 82 of file socketengine.cpp. |
|
|
Set a new file desciptor.
Definition at line 77 of file socketengine.cpp. References fd. Referenced by UserManager::AddUser(), IdentRequestSocket::Close(), DNS::DNS(), IdentRequestSocket::IdentRequestSocket(), InspIRCd::InspIRCd(), ListenSocketBase::ListenSocketBase(), TreeSocket::ParseUID(), and DNS::Rehash(). |
|
|
Override this function to indicate writeability.
Definition at line 87 of file socketengine.cpp. |
|
|
File descriptor. All events which can be handled must have a file descriptor. This allows you to add events for sockets, fifo's, pipes, and various other forms of IPC. Definition at line 71 of file socketengine.h. Referenced by BufferedSocket::BindAddr(), BufferedSocket::BufferedSocket(), SQLConn::DoConnect(), BufferedSocket::DoConnect(), User::FlushWriteBuf(), BufferedSocket::FlushWriteBuffer(), GetFd(), ListenSocketBase::ListenSocketBase(), SetFd(), User::User(), and ListenSocketBase::~ListenSocketBase(). |
|
|
Pointer to the module which has hooked the given EventHandler for IO events.
Definition at line 75 of file socketengine.h. Referenced by AddIOHook(), DelIOHook(), EventHandler(), and GetIOHook(). |