1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #ifndef __SOCKETENGINE_SELECT__
18 #define __SOCKETENGINE_SELECT__
23 #include <sys/select.h>
24 #include "inspircd_config.h"
27 #include "socketengine.h"
31 /** A specialisation of the SocketEngine class, designed to use traditional select().
33 class SelectEngine : public SocketEngine
36 /** Because select() does not track an fd list for us between calls, we have one of our own
38 std::map<int,int> fds;
39 /** The read set and write set, populated before each call to select().
41 fd_set wfdset, rfdset;
43 /** Create a new SelectEngine
44 * @param Instance The creator of this object
46 SelectEngine(InspIRCd* Instance);
47 /** Delete a SelectEngine
49 virtual ~SelectEngine();
50 virtual bool AddFd(EventHandler* eh);
51 virtual int GetMaxFds();
52 virtual int GetRemainingFds();
53 virtual bool DelFd(EventHandler* eh);
54 virtual int DispatchEvents();
55 virtual std::string GetName();
58 /** Creates a SocketEngine
60 class SocketEngineFactory
63 /** Create a new instance of SocketEngine based on SelectEngine
65 SocketEngine* Create(InspIRCd* Instance) { return new SelectEngine(InspIRCd* Instance); }