]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socketengine_kqueue.h
Fixes for tokenization oddness with metadata, and weird behaviour of std::istringstre...
[user/henk/code/inspircd.git] / include / socketengine_kqueue.h
index 822b4740a4641850289860f9efea7e6522db56c0..e7413d4bb597dac53e18dfb1379e4c268a1d7036 100644 (file)
@@ -2,17 +2,14 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *                <Craig@chatspike.net>
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
  *
- * Written by Craig Edwards, Craig McLure, and others.
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
-*/
+ */
 
 #ifndef __SOCKETENGINE_KQUEUE__
 #define __SOCKETENGINE_KQUEUE__
 #include <sys/time.h>
 #include "socketengine.h"
 
+class InspIRCd;
+
+/** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue().
+ */
 class KQueueEngine : public SocketEngine
 {
 private:
-       struct kevent ke_list[MAX_DESCRIPTORS]; /* Up to 64k sockets for kqueue */
-       struct timespec ts;                     /* kqueue delay value */
+       /** These are used by kqueue() to hold socket events
+        */
+       struct kevent ke_list[MAX_DESCRIPTORS];
+       /** This is a specialised time value used by kqueue()
+        */
+       struct timespec ts;
 public:
-       KQueueEngine();
+       /** Create a new KQueueEngine
+        * @param Instance The creator of this object
+        */
+       KQueueEngine(InspIRCd* Instance);
+       /** Delete a KQueueEngine
+        */
        virtual ~KQueueEngine();
-       virtual bool AddFd(int fd, bool readable, char type);
+       virtual bool AddFd(EventHandler* eh);
        virtual int GetMaxFds();
        virtual int GetRemainingFds();
-       virtual bool DelFd(int fd);
-       virtual int Wait(int* fdlist);
+       virtual bool DelFd(EventHandler* eh, bool force = false);
+       virtual int DispatchEvents();
        virtual std::string GetName();
+       virtual void WantWrite(EventHandler* eh);
 };
 
+/** Creates a SocketEngine
+ */
 class SocketEngineFactory
 {
  public:
-       SocketEngine* Create() { return new KQueueEngine(); }
+       /** Create a new instance of SocketEngine based on KQueueEngine
+        */
+       SocketEngine* Create(InspIRCd* Instance) { return new KQueueEngine(Instance); }
 };
 
 #endif