]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socketengines/socketengine_ports.h
Move destruction logic for User and Spanningtree into cull()
[user/henk/code/inspircd.git] / include / socketengines / socketengine_ports.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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 "inspircd.h"
26 #include "socketengine.h"
27 #include <port.h>
28
29 /** A specialisation of the SocketEngine class, designed to use solaris 10 I/O completion ports
30  */
31 class PortsEngine : public SocketEngine
32 {
33 private:
34         /** These are used by epoll() to hold socket events
35          */
36         port_event_t* events;
37 public:
38         /** Create a new PortsEngine
39          * @param Instance The creator of this object
40          */
41         PortsEngine();
42         /** Delete a PortsEngine
43          */
44         virtual ~PortsEngine();
45         virtual bool AddFd(EventHandler* eh, int event_mask);
46         void OnSetEvent(EventHandler* eh, int old_event, int new_event);
47         virtual bool DelFd(EventHandler* eh, bool force = false);
48         virtual int DispatchEvents();
49         virtual std::string GetName();
50         virtual void WantWrite(EventHandler* eh);
51 };
52
53 /** Creates a SocketEngine
54  */
55 class SocketEngineFactory
56 {
57 public:
58         /** Create a new instance of SocketEngine based on PortsEngine
59          */
60         SocketEngine* Create() { return new PortsEngine; }
61 };
62
63 #endif
64