1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #ifndef __SOCKETENGINE_EPOLL__
18 #define __SOCKETENGINE_EPOLL__
23 #include "inspircd_config.h"
26 #include "socketengine.h"
27 #include <sys/epoll.h>
32 /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
34 class EPollEngine : public SocketEngine
37 /** These are used by epoll() to hold socket events
39 struct epoll_event events[MAX_DESCRIPTORS];
41 /** Create a new EPollEngine
42 * @param Instance The creator of this object
44 EPollEngine(InspIRCd* Instance);
45 /** Delete an EPollEngine
47 virtual ~EPollEngine();
48 virtual bool AddFd(int fd, bool readable, char type);
49 virtual int GetMaxFds();
50 virtual int GetRemainingFds();
51 virtual bool DelFd(int fd);
52 virtual int Wait(int* fdlist);
53 virtual std::string GetName();
56 /** Creates a SocketEngine
58 class SocketEngineFactory
61 /** Create a new instance of SocketEngine based on EpollEngine
63 SocketEngine* Create(InspIRCd* Instance) { return new EPollEngine(Instance); }