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"
26 #define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/
32 #define struct pollfd WSAPOLLFD
38 /** A specialisation of the SocketEngine class, designed to use poll().
40 class PollEngine : public SocketEngine
43 /** These are used by poll() to hold socket events
45 struct pollfd *events;
47 /** Create a new PollEngine
48 * @param Instance The creator of this object
50 PollEngine(InspIRCd* Instance);
51 /** Delete a PollEngine
53 virtual ~PollEngine();
54 virtual bool AddFd(EventHandler* eh);
55 virtual int GetMaxFds();
56 virtual int GetRemainingFds();
57 virtual bool DelFd(EventHandler* eh, bool force = false);
58 virtual int DispatchEvents();
59 virtual std::string GetName();
60 virtual void WantWrite(EventHandler* eh);
63 /** Creates a SocketEngine
65 class SocketEngineFactory
68 /** Create a new instance of SocketEngine based on PollEngine
70 SocketEngine* Create(InspIRCd* Instance) { return new PollEngine(Instance); }