]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socketengines/socketengine_select.h
Remove an unused member.
[user/henk/code/inspircd.git] / include / socketengines / socketengine_select.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_SELECT__
15 #define __SOCKETENGINE_SELECT__
16
17 #include <vector>
18 #include <string>
19 #include <map>
20 #ifndef WINDOWS
21 #include <sys/select.h>
22 #endif // WINDOWS
23 #include "inspircd_config.h"
24 #include "inspircd.h"
25 #include "socketengine.h"
26
27 class InspIRCd;
28
29 /** A specialisation of the SocketEngine class, designed to use traditional select().
30  */
31 class SelectEngine : public SocketEngine
32 {
33 private:
34         /** Because select() does not track an fd list for us between calls, we have one of our own
35          */
36         std::map<int,int> fds;
37         /** List of writeable ones (WantWrite())
38          */
39         bool* writeable;
40         /** The read set and write set, populated before each call to select().
41          */
42         fd_set wfdset, rfdset, errfdset;
43
44 public:
45         /** Create a new SelectEngine
46          * @param Instance The creator of this object
47          */
48         SelectEngine(InspIRCd* Instance);
49         /** Delete a SelectEngine
50          */
51         virtual ~SelectEngine();
52         virtual bool AddFd(EventHandler* eh);
53         virtual int GetMaxFds();
54         virtual int GetRemainingFds();
55         virtual bool DelFd(EventHandler* eh, bool force = false);
56         virtual int DispatchEvents();
57         virtual std::string GetName();
58         virtual void WantWrite(EventHandler* eh);
59 };
60
61 /** Creates a SocketEngine
62  */
63 class SocketEngineFactory
64 {
65 public:
66         /** Create a new instance of SocketEngine based on SelectEngine
67          */
68         SocketEngine* Create(InspIRCd* Instance) { return new SelectEngine(Instance); }
69 };
70
71 #endif