summaryrefslogtreecommitdiff
path: root/include/socketengine_iocp.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-20 13:58:30 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-20 13:58:30 +0000
commit30a17a7034a5afce1094479628408a0903c62e17 (patch)
treeca7a8f3adec1429afb5ee901d2185a9d221432c9 /include/socketengine_iocp.h
parent6ab38d48cad06633bfe5a118c1c5a6877fba6d5a (diff)
Remove asserts and convert to unix line endings
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7064 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/socketengine_iocp.h')
-rw-r--r--include/socketengine_iocp.h218
1 files changed, 109 insertions, 109 deletions
diff --git a/include/socketengine_iocp.h b/include/socketengine_iocp.h
index 1b4db096b..70c342c77 100644
--- a/include/socketengine_iocp.h
+++ b/include/socketengine_iocp.h
@@ -9,83 +9,83 @@
* the file COPYING for details.
*
* ---------------------------------------------------
- */
-
-#ifndef __SOCKETENGINE_IOCP__
-#define __SOCKETENGINE_IOCP__
-
-#define READ_BUFFER_SIZE 500
-#define USING_IOCP 1
-
-#include "inspircd_config.h"
-#include "inspircd_win32wrapper.h"
+ */
+
+#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"
-
-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
- */
+#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);
-
- /** 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);
-
+ 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);
-
+ 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);
-
+ 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);
-};
-
-//typedef void(*OpHandler)(EventHandler)
-/** Event Handler Array
- */
-
+ 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); }
-};
-
-#endif
+};
+
+#endif