]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socketengine_kqueue.h
Multi-prefix FJOIN, and allowing module-defined prefixes across the network
[user/henk/code/inspircd.git] / include / socketengine_kqueue.h
index 822b4740a4641850289860f9efea7e6522db56c0..29b85ed6a82f21c861ab48233a316f667a471082 100644 (file)
 #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);
+       virtual int DispatchEvents();
        virtual std::string GetName();
 };
 
+/** 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