]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socketengine.h
Decide that it wasn't quite appropriate :(
[user/henk/code/inspircd.git] / include / socketengine.h
index d02ec671a5103ff1d36508015d343661600fa35d..d7a0f1c59f6003bf8a8865709a050a948ba76e9b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
  *                       E-mail:
  *                <brain@chatspike.net>
  *                <Craig@chatspike.net>
@@ -67,16 +67,17 @@ const char X_READBIT            = 0x80;
 class SocketEngine {
 
        int EngineHandle;                       /* Handle to the socket engine if needed */
+       int CurrentSetSize;                     /* Current number of descriptors in the engine */
 #ifdef USE_SELECT
        std::map<int,int> fds;                  /* List of file descriptors being monitored */
        fd_set wfdset, rfdset;                  /* Readable and writeable sets for select() */
 #endif
 #ifdef USE_KQUEUE
-       struct kevent ke_list[65535];           /* Up to 64k sockets for kqueue */
+       struct kevent ke_list[MAX_DESCRIPTORS]; /* Up to 64k sockets for kqueue */
        struct timespec ts;                     /* kqueue delay value */
 #endif
 #ifdef USE_EPOLL
-       struct epoll_event events[65535];       /* Up to 64k sockets for epoll */
+       struct epoll_event events[MAX_DESCRIPTORS];     /* Up to 64k sockets for epoll */
 #endif
 
 public:
@@ -120,6 +121,16 @@ public:
         */
        char GetType(int fd);
 
+       /** Returns the maximum number of file descriptors
+        * you may store in the socket engine at any one time.
+        */
+       int GetMaxFds();
+
+       /** Returns the number of file descriptor slots
+        * which are available for storing fds.
+        */
+       int GetRemainingFds();
+
        /** Delete a file descriptor f rom the engine
         * This function call deletes a file descriptor
         * from the engine, returning true if it succeeded