]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socketengine_kqueue.h
More docs. Tons more docs. I need coffee and we're out of coffee :<
[user/henk/code/inspircd.git] / include / socketengine_kqueue.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15 */
16
17 #ifndef __SOCKETENGINE_KQUEUE__
18 #define __SOCKETENGINE_KQUEUE__
19
20 #include <vector>
21 #include <string>
22 #include <map>
23 #include "inspircd_config.h"
24 #include "globals.h"
25 #include "inspircd.h"
26 #include <sys/types.h>
27 #include <sys/event.h>
28 #include <sys/time.h>
29 #include "socketengine.h"
30
31 class InspIRCd;
32
33 class KQueueEngine : public SocketEngine
34 {
35 private:
36         struct kevent ke_list[MAX_DESCRIPTORS]; /* Up to 64k sockets for kqueue */
37         struct timespec ts;                     /* kqueue delay value */
38 public:
39         KQueueEngine(InspIRCd* Instance);
40         virtual ~KQueueEngine();
41         virtual bool AddFd(int fd, bool readable, char type);
42         virtual int GetMaxFds();
43         virtual int GetRemainingFds();
44         virtual bool DelFd(int fd);
45         virtual int Wait(int* fdlist);
46         virtual std::string GetName();
47 };
48
49 class SocketEngineFactory
50 {
51  public:
52         SocketEngine* Create(InspIRCd* Instance) { return new KQueueEngine(InspIRCd* Instance); }
53 };
54
55 #endif