1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __SOCKETENGINE_POLL__
15 #define __SOCKETENGINE_POLL__
20 #include "inspircd_config.h"
22 #include "socketengine.h"
24 #define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/
31 /** A specialisation of the SocketEngine class, designed to use poll().
33 class PollEngine : public SocketEngine
36 /** These are used by poll() to hold socket events
38 struct pollfd *events;
40 /** Create a new PollEngine
41 * @param Instance The creator of this object
43 PollEngine(InspIRCd* Instance);
44 /** Delete a PollEngine
46 virtual ~PollEngine();
47 virtual bool AddFd(EventHandler* eh);
48 virtual int GetMaxFds();
49 virtual int GetRemainingFds();
50 virtual bool DelFd(EventHandler* eh, bool force = false);
51 virtual int DispatchEvents();
52 virtual std::string GetName();
53 virtual void WantWrite(EventHandler* eh);
56 /** Creates a SocketEngine
58 class SocketEngineFactory
61 /** Create a new instance of SocketEngine based on PollEngine
63 SocketEngine* Create(InspIRCd* Instance) { return new PollEngine(Instance); }