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_KQUEUE__
15 #define __SOCKETENGINE_KQUEUE__
20 #include "inspircd_config.h"
22 #include <sys/types.h>
23 #include <sys/event.h>
25 #include "socketengine.h"
27 /** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue().
29 class KQueueEngine : public SocketEngine
33 /** These are used by kqueue() to hold socket events
35 struct kevent* ke_list;
36 /** This is a specialised time value used by kqueue()
40 /** Create a new KQueueEngine
43 /** Delete a KQueueEngine
45 virtual ~KQueueEngine();
46 bool AddFd(EventHandler* eh, int event_mask);
47 void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
48 virtual bool DelFd(EventHandler* eh, bool force = false);
49 virtual int DispatchEvents();
50 virtual std::string GetName();
51 virtual void WantWrite(EventHandler* eh);
52 virtual void RecoverFromFork();
55 /** Creates a SocketEngine
57 class SocketEngineFactory
60 /** Create a new instance of SocketEngine based on KQueueEngine
62 SocketEngine* Create() { return new KQueueEngine; }