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.*/
30 /** A specialisation of the SocketEngine class, designed to use poll().
32 class PollEngine : public SocketEngine
35 /** These are used by poll() to hold socket events
37 struct pollfd *events;
39 /** Create a new PollEngine
40 * @param Instance The creator of this object
42 PollEngine(InspIRCd* Instance);
43 /** Delete a PollEngine
45 virtual ~PollEngine();
46 virtual bool AddFd(EventHandler* eh);
47 virtual int GetMaxFds();
48 virtual int GetRemainingFds();
49 virtual bool DelFd(EventHandler* eh, bool force = false);
50 virtual int DispatchEvents();
51 virtual std::string GetName();
52 virtual void WantWrite(EventHandler* eh);
55 /** Creates a SocketEngine
57 class SocketEngineFactory
60 /** Create a new instance of SocketEngine based on PollEngine
62 SocketEngine* Create(InspIRCd* Instance) { return new PollEngine(Instance); }