InspIRCd  2.0
Public Member Functions | List of all members
EPollEngine Class Reference
Inheritance diagram for EPollEngine:

Public Member Functions

 EPollEngine ()
virtual ~EPollEngine ()
virtual bool AddFd (EventHandler *eh, int event_mask)
virtual void OnSetEvent (EventHandler *eh, int old_mask, int new_mask)
virtual void DelFd (EventHandler *eh)
virtual int DispatchEvents ()
virtual std::string GetName ()
- Public Member Functions inherited from SocketEngine
 SocketEngine ()
virtual ~SocketEngine ()
void ChangeEventMask (EventHandler *eh, int event_mask)
int GetMaxFds () const
int GetUsedFds () const
virtual bool HasFd (int fd)
virtual EventHandlerGetRef (int fd)
virtual void DispatchTrialWrites ()
virtual bool BoundsCheckFd (EventHandler *eh)
int Accept (EventHandler *fd, sockaddr *addr, socklen_t *addrlen)
int Close (EventHandler *fd)
int Close (int fd)
int Send (EventHandler *fd, const void *buf, size_t len, int flags)
int Recv (EventHandler *fd, void *buf, size_t len, int flags)
int RecvFrom (EventHandler *fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen)
int SendTo (EventHandler *fd, const void *buf, size_t len, int flags, const sockaddr *to, socklen_t tolen)
int Connect (EventHandler *fd, const sockaddr *serv_addr, socklen_t addrlen)
int Blocking (int fd)
int NonBlocking (int fd)
int Shutdown (EventHandler *fd, int how)
int Shutdown (int fd, int how)
int Bind (int fd, const irc::sockets::sockaddrs &addr)
int Listen (int sockfd, int backlog)
void SetReuse (int sockfd)
virtual void RecoverFromFork ()
void GetStats (float &kbitpersec_in, float &kbitpersec_out, float &kbitpersec_total)

Additional Inherited Members

- Static Public Member Functions inherited from SocketEngine
static bool IgnoreError ()
static std::string LastError ()
static std::string GetError (int errnum)
- Public Attributes inherited from SocketEngine
unsigned long TotalEvents
unsigned long ReadEvents
unsigned long WriteEvents
unsigned long ErrorEvents
- Protected Member Functions inherited from SocketEngine
void UpdateStats (size_t len_in, size_t len_out)
void SetEventMask (EventHandler *eh, int value)
- Protected Attributes inherited from SocketEngine
int CurrentSetSize
EventHandler ** ref
std::set< int > trials
size_t indata
size_t outdata
time_t lastempty

Detailed Description

A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().

Constructor & Destructor Documentation

◆ EPollEngine()

EPollEngine::EPollEngine ( )

Create a new EPollEngine

◆ ~EPollEngine()

EPollEngine::~EPollEngine ( )

Delete an EPollEngine

Member Function Documentation

◆ AddFd()

bool EPollEngine::AddFd ( EventHandler eh,
int  event_mask 

Add an EventHandler object to the engine. Use AddFd to add a file descriptor to the engine and have the socket engine monitor it. You must provide an object derived from EventHandler which implements HandleEvent().

ehAn event handling object to add
event_maskThe initial event mask for the object

Implements SocketEngine.

◆ DelFd()

void EPollEngine::DelFd ( EventHandler eh)

Delete an event handler from the engine. This function call deletes an EventHandler from the engine, returning true if it succeeded and false if it failed. This does not free the EventHandler pointer using delete, if this is required you must do this yourself.

ehThe event handler object to remove

Implements SocketEngine.

◆ DispatchEvents()

int EPollEngine::DispatchEvents ( )

Waits for events and dispatches them to handlers. Please note that this doesn't wait long, only a couple of milliseconds. It returns the number of events which occurred during this call. This method will dispatch events to their handlers by calling their EventHandler::HandleEvent() methods with the necessary EventType value.

The number of events which have occured.

Implements SocketEngine.

◆ GetName()

std::string EPollEngine::GetName ( )

Returns the socket engines name. This returns the name of the engine for use in /VERSION responses.

The socket engine name

Implements SocketEngine.

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