]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socketengines/socketengine_ports.h
Add call to protocol interface to get useful info on the server map. Return a std...
[user/henk/code/inspircd.git] / include / socketengines / socketengine_ports.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef __SOCKETENGINE_PORTS__
15 #define __SOCKETENGINE_PORTS__
16
17 #ifndef __sun
18 # error You need Solaris 10 or later to make use of this code.
19 #endif
20
21 #include <vector>
22 #include <string>
23 #include <map>
24 #include "inspircd_config.h"
25 #include "globals.h"
26 #include "inspircd.h"
27 #include "socketengine.h"
28 #include <port.h>
29
30 class InspIRCd;
31
32 /** A specialisation of the SocketEngine class, designed to use solaris 10 I/O completion ports
33  */
34 class PortsEngine : public SocketEngine
35 {
36 private:
37         /** These are used by epoll() to hold socket events
38          */
39         port_event_t* events;
40 public:
41         /** Create a new PortsEngine
42          * @param Instance The creator of this object
43          */
44         PortsEngine(InspIRCd* Instance);
45         /** Delete a PortsEngine
46          */
47         virtual ~PortsEngine();
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 };
56
57 /** Creates a SocketEngine
58  */
59 class SocketEngineFactory
60 {
61 public:
62         /** Create a new instance of SocketEngine based on PortsEngine
63          */
64         SocketEngine* Create(InspIRCd* Instance) { return new PortsEngine(Instance); }
65 };
66
67 #endif
68