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_KQUEUE__
15 #define __SOCKETENGINE_KQUEUE__
20 #include "inspircd_config.h"
22 #include <sys/types.h>
23 #include <sys/event.h>
25 #include "socketengine.h"
29 /** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue().
31 class KQueueEngine : public SocketEngine
34 /** These are used by kqueue() to hold socket events
36 struct kevent* ke_list;
37 /** This is a specialised time value used by kqueue()
41 /** Create a new KQueueEngine
42 * @param Instance The creator of this object
44 KQueueEngine(InspIRCd* Instance);
45 /** Delete a KQueueEngine
47 virtual ~KQueueEngine();
48 virtual bool AddFd(EventHandler* eh);
49 virtual int GetMaxFds();
50 virtual int GetRemainingFds();
51 virtual bool DelFd(EventHandler* eh, bool force = false);
52 virtual int DispatchEvents();
53 virtual std::string GetName();
54 virtual void WantWrite(EventHandler* eh);
55 virtual void RecoverFromFork();
58 /** Creates a SocketEngine
60 class SocketEngineFactory
63 /** Create a new instance of SocketEngine based on KQueueEngine
65 SocketEngine* Create(InspIRCd* Instance) { return new KQueueEngine(Instance); }