]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socketengine_iocp.h
Remove asserts and convert to unix line endings
[user/henk/code/inspircd.git] / include / socketengine_iocp.h
index 1b4db096b5e535b9a4f2b3d1936a6bc3d37a40a5..70c342c77b5a4da7f644da218259c5b573650056 100644 (file)
@@ -9,83 +9,83 @@
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
- */\r
-\r
-#ifndef __SOCKETENGINE_IOCP__\r
-#define __SOCKETENGINE_IOCP__\r
-\r
-#define READ_BUFFER_SIZE 500\r
-#define USING_IOCP 1\r
-\r
-#include "inspircd_config.h"\r
-#include "inspircd_win32wrapper.h"\r
+ */
+
+#ifndef __SOCKETENGINE_IOCP__
+#define __SOCKETENGINE_IOCP__
+
+#define READ_BUFFER_SIZE 500
+#define USING_IOCP 1
+
+#include "inspircd_config.h"
+#include "inspircd_win32wrapper.h"
 #include "globals.h"
 #include "inspircd.h"
-#include "socketengine.h"\r
-\r
-enum SocketIOEvent\r
-{\r
-       SOCKET_IO_EVENT_READ_READY                      = 0,\r
-       SOCKET_IO_EVENT_WRITE_READY                     = 1,\r
-       SOCKET_IO_EVENT_ACCEPT                          = 2,\r
-       SOCKET_IO_EVENT_ERROR                           = 3,\r
-       NUM_SOCKET_IO_EVENTS                            = 4,\r
-};\r
-\r
-class Overlapped\r
-{\r
-public:\r
-       OVERLAPPED m_overlap;\r
-       SocketIOEvent m_event;\r
-       int m_params;\r
-       Overlapped(SocketIOEvent ev, int params) : m_event(ev), m_params(params)\r
-       {\r
-               memset(&m_overlap, 0, sizeof(OVERLAPPED));\r
-       }\r
-};\r
-\r
-struct accept_overlap\r
-{\r
-       int socket;\r
-       char buf[1024];\r
-};\r
-\r
-class IOCPEngine : public SocketEngine\r
-{\r
-       /** Creates a "fake" file descriptor for use with an IOCP socket.\r
-        * @return -1 if there are no free slots, and an integer if it finds one.\r
-        */\r
-       __inline int GenerateFd()\r
-       {\r
-               register int i = 0;\r
-               for(; i < MAX_DESCRIPTORS; ++i)\r
-                       if(ref[i] == 0)\r
-                               return i;\r
-               return -1;\r
-       }\r
-       \r
-       /** Global I/O completion port that sockets attach to.\r
-        */\r
-       HANDLE m_completionPort;\r
-\r
-       /** This is kinda shitty... :/ for getting an address from a real fd. \r
-        */\r
-       map<int, EventHandler*> m_binding;\r
-\r
-public:\r
-       /** Creates an IOCP Socket Engine\r
-        * @param Instance The creator of this object\r
-        */\r
-       IOCPEngine(InspIRCd * Instance);\r
-\r
-       /** Deletes an IOCP socket engine and all the attached sockets\r
-        */\r
-       ~IOCPEngine();\r
-\r
-       /** Adds an event handler to the completion port, and sets up initial events.\r
-        * @param eh EventHandler to add\r
-        * @return True if success, false if no room\r
-        */\r
+#include "socketengine.h"
+
+enum SocketIOEvent
+{
+       SOCKET_IO_EVENT_READ_READY                      = 0,
+       SOCKET_IO_EVENT_WRITE_READY                     = 1,
+       SOCKET_IO_EVENT_ACCEPT                          = 2,
+       SOCKET_IO_EVENT_ERROR                           = 3,
+       NUM_SOCKET_IO_EVENTS                            = 4,
+};
+
+class Overlapped
+{
+public:
+       OVERLAPPED m_overlap;
+       SocketIOEvent m_event;
+       int m_params;
+       Overlapped(SocketIOEvent ev, int params) : m_event(ev), m_params(params)
+       {
+               memset(&m_overlap, 0, sizeof(OVERLAPPED));
+       }
+};
+
+struct accept_overlap
+{
+       int socket;
+       char buf[1024];
+};
+
+class IOCPEngine : public SocketEngine
+{
+       /** Creates a "fake" file descriptor for use with an IOCP socket.
+        * @return -1 if there are no free slots, and an integer if it finds one.
+        */
+       __inline int GenerateFd()
+       {
+               register int i = 0;
+               for(; i < MAX_DESCRIPTORS; ++i)
+                       if(ref[i] == 0)
+                               return i;
+               return -1;
+       }
+       
+       /** Global I/O completion port that sockets attach to.
+        */
+       HANDLE m_completionPort;
+
+       /** This is kinda shitty... :/ for getting an address from a real fd. 
+        */
+       map<int, EventHandler*> m_binding;
+
+public:
+       /** Creates an IOCP Socket Engine
+        * @param Instance The creator of this object
+        */
+       IOCPEngine(InspIRCd * Instance);
+
+       /** Deletes an IOCP socket engine and all the attached sockets
+        */
+       ~IOCPEngine();
+
+       /** Adds an event handler to the completion port, and sets up initial events.
+        * @param eh EventHandler to add
+        * @return True if success, false if no room
+        */
        bool AddFd(EventHandler* eh);
 
        /** Gets the maximum number of file descriptors that this engine can handle.
@@ -124,52 +124,52 @@ public:
        /** Queues a Write event on the specified event handler.
         * @param eh EventHandler that needs data sent on
         */
-       void WantWrite(EventHandler* eh);\r
-\r
-       /** Posts a completion event on the specified socket.\r
-        * @param eh EventHandler for message\r
-        * @param type Event Type\r
-        * @param param Event Parameter\r
-        * @return True if added, false if not\r
-        */\r
-       bool PostCompletionEvent(EventHandler * eh, SocketIOEvent type, int param);\r
-\r
-       /** Posts a read event on the specified socket\r
-        * @param eh EventHandler (socket)\r
-        */\r
-       void PostReadEvent(EventHandler * eh);\r
-\r
-       /** Posts an accept event on the specified socket\r
-        * @param eh EventHandler (socket)\r
-        */\r
-       void PostAcceptEvent(EventHandler * eh);\r
-\r
+       void WantWrite(EventHandler* eh);
+
+       /** Posts a completion event on the specified socket.
+        * @param eh EventHandler for message
+        * @param type Event Type
+        * @param param Event Parameter
+        * @return True if added, false if not
+        */
+       bool PostCompletionEvent(EventHandler * eh, SocketIOEvent type, int param);
+
+       /** Posts a read event on the specified socket
+        * @param eh EventHandler (socket)
+        */
+       void PostReadEvent(EventHandler * eh);
+
+       /** Posts an accept event on the specified socket
+        * @param eh EventHandler (socket)
+        */
+       void PostAcceptEvent(EventHandler * eh);
+
        /** Returns the EventHandler attached to a specific fd.
         * If the fd isnt in the socketengine, returns NULL.
         * @param fd The event handler to look for
         * @return A pointer to the event handler, or NULL
         */
-       EventHandler* GetRef(int fd);\r
-\r
+       EventHandler* GetRef(int fd);
+
        /** Returns true if a file descriptor exists in
         * the socket engine's list.
         * @param fd The event handler to look for
         * @return True if this fd has an event handler
         */
-       bool HasFd(int fd);\r
-\r
+       bool HasFd(int fd);
+
        /** Returns the EventHandler attached to a specific fd.
         * If the fd isnt in the socketengine, returns NULL.
         * @param fd The event handler to look for
         * @return A pointer to the event handler, or NULL
         */
-       EventHandler* GetIntRef(int fd);\r
-};\r
-\r
-//typedef void(*OpHandler)(EventHandler)\r
-/** Event Handler Array\r
- */\r
-\r
+       EventHandler* GetIntRef(int fd);
+};
+
+//typedef void(*OpHandler)(EventHandler)
+/** Event Handler Array
+ */
+
 /** Creates a SocketEngine
  */
 class SocketEngineFactory
@@ -178,6 +178,6 @@ public:
        /** Create a new instance of SocketEngine based on IOCPEngine
         */
        SocketEngine* Create(InspIRCd* Instance) { return new IOCPEngine(Instance); }
-};\r
-\r
-#endif\r
+};
+
+#endif