/* +------------------------------------+
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
* InspIRCd: (C) 2002-2007 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/#ifndef __SOCKETENGINE_SELECT__#define __SOCKETENGINE_SELECT__#include<vector>#include<string>#include<map>#include<sys/select.h>#include"inspircd_config.h"#include"globals.h"#include"inspircd.h"#include"socketengine.h"classInspIRCd;/** A specialisation of the SocketEngine class, designed to use traditional select().
*/classSelectEngine:publicSocketEngine{private:/** Because select() does not track an fd list for us between calls, we have one of our own
*/std::map<int,int>fds;/** List of writeable ones (WantWrite())
*/boolwriteable[MAX_DESCRIPTORS];/** The read set and write set, populated before each call to select().
*/fd_setwfdset,rfdset,errfdset;public:/** Create a new SelectEngine
* @param Instance The creator of this object
*/SelectEngine(InspIRCd*Instance);/** Delete a SelectEngine
*/virtual~SelectEngine();virtualboolAddFd(EventHandler*eh);virtualintGetMaxFds();virtualintGetRemainingFds();virtualboolDelFd(EventHandler*eh,boolforce=false);virtualintDispatchEvents();virtualstd::stringGetName();virtualvoidWantWrite(EventHandler*eh);};/** Creates a SocketEngine
*/classSocketEngineFactory{public:/** Create a new instance of SocketEngine based on SelectEngine
*/SocketEngine*Create(InspIRCd*Instance){returnnewSelectEngine(Instance);}};#endif