1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __SOCKETENGINE_EPOLL__
15 #define __SOCKETENGINE_EPOLL__
20 #include "inspircd_config.h"
22 #include "socketengine.h"
23 #include <sys/epoll.h>
28 /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
30 class EPollEngine : public SocketEngine
33 /** These are used by epoll() to hold socket events
35 struct epoll_event* events;
37 /** Create a new EPollEngine
38 * @param Instance The creator of this object
40 EPollEngine(InspIRCd* Instance);
41 /** Delete an EPollEngine
43 virtual ~EPollEngine();
44 virtual bool AddFd(EventHandler* eh);
45 virtual int GetMaxFds();
46 virtual int GetRemainingFds();
47 virtual bool DelFd(EventHandler* eh, bool force = false);
48 virtual int DispatchEvents();
49 virtual std::string GetName();
50 virtual void WantWrite(EventHandler* eh);
53 /** Creates a SocketEngine
55 class SocketEngineFactory
58 /** Create a new instance of SocketEngine based on EpollEngine
60 SocketEngine* Create(InspIRCd* Instance) { return new EPollEngine(Instance); }