1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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"
23 #include <sys/types.h>
24 #include <sys/event.h>
26 #include "socketengine.h"
30 /** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue().
32 class KQueueEngine : public SocketEngine
35 /** These are used by kqueue() to hold socket events
37 struct kevent ke_list[MAX_DESCRIPTORS];
38 /** This is a specialised time value used by kqueue()
42 /** Create a new KQueueEngine
43 * @param Instance The creator of this object
45 KQueueEngine(InspIRCd* Instance);
46 /** Delete a KQueueEngine
48 virtual ~KQueueEngine();
49 virtual bool AddFd(EventHandler* eh);
50 virtual int GetMaxFds();
51 virtual int GetRemainingFds();
52 virtual bool DelFd(EventHandler* eh, bool force = false);
53 virtual int DispatchEvents();
54 virtual std::string GetName();
55 virtual void WantWrite(EventHandler* eh);
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); }