1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #ifndef __SOCKETENGINE_KQUEUE__
18 #define __SOCKETENGINE_KQUEUE__
23 #include "inspircd_config.h"
26 #include <sys/types.h>
27 #include <sys/event.h>
29 #include "socketengine.h"
33 /** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue().
35 class KQueueEngine : public SocketEngine
38 /** These are used by kqueue() to hold socket events
40 struct kevent ke_list[MAX_DESCRIPTORS];
41 /** This is a specialised time value used by kqueue()
45 /** Create a new KQueueEngine
46 * @param Instance The creator of this object
48 KQueueEngine(InspIRCd* Instance);
49 /** Delete a KQueueEngine
51 virtual ~KQueueEngine();
52 virtual bool AddFd(EventHandler* eh);
53 virtual int GetMaxFds();
54 virtual int GetRemainingFds();
55 virtual bool DelFd(EventHandler* eh);
56 virtual int DispatchEvents();
57 virtual std::string GetName();
60 /** Creates a SocketEngine
62 class SocketEngineFactory
65 /** Create a new instance of SocketEngine based on KQueueEngine
67 SocketEngine* Create(InspIRCd* Instance) { return new KQueueEngine(Instance); }