* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
};
class InspIRCd;
+class Module;
/** This class is a basic I/O handler class.
* Any object which wishes to receive basic I/O events
* other forms of IPC.
*/
int fd;
+
+ /** Pointer to the module which has hooked the given EventHandler for IO events.
+ */
+ Module *IOHook;
public:
+ /** Return the current hooker of IO events for this socket, or NULL.
+ * @return Hooker module, if set, or NULL.
+ */
+ Module *GetIOHook();
+
+ /** Set a module as hooking IO events on this socket.
+ * @param IOHooker The module hooking IO
+ * @return True if the hook could be added, false otherwise.
+ */
+ bool AddIOHook(Module *IOHooker);
+
+ /** Remove IO hooking from a module
+ * @return True if hooking was successfully removed, false otherwise.
+ */
+ bool DelIOHook();
+
/** Get the current file descriptor
* @return The file descriptor of this handler
*/
/** Constructor
*/
- EventHandler() {}
+ EventHandler();
/** Destructor
*/
EventHandler** ref;
int MAX_DESCRIPTORS;
+
+ size_t indata;
+ size_t outdata;
+ time_t lastempty;
+
+ void UpdateStats(size_t len_in, size_t len_out);
public:
double TotalEvents;
* the shell or operating system on fatal error.
*/
virtual void RecoverFromFork();
+
+ /** Get data transfer statistics, kilobits per second in and out and total.
+ */
+ void GetStats(float &kbitpersec_in, float &kbitpersec_out, float &kbitpersec_total);
};
#endif