]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socketengine_kqueue.h
WHEEEEE!!!!!
[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 KQueueEngine : public SocketEngine
32 {
33 private:
34         struct kevent ke_list[MAX_DESCRIPTORS]; /* Up to 64k sockets for kqueue */
35         struct timespec ts;                     /* kqueue delay value */
36 public:
37         KQueueEngine();
38         virtual ~KQueueEngine();
39         virtual bool AddFd(int fd, bool readable, char type);
40         virtual int GetMaxFds();
41         virtual int GetRemainingFds();
42         virtual bool DelFd(int fd);
43         virtual int Wait(int* fdlist);
44         virtual std::string GetName();
45 };
46
47 class SocketEngineFactory
48 {
49  public:
50         SocketEngine* Create() { return new KQueueEngine(); }
51 };
52
53 #endif