diff options
Diffstat (limited to 'include/socketengine_iocp.h')
-rw-r--r-- | include/socketengine_iocp.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/include/socketengine_iocp.h b/include/socketengine_iocp.h index 5de7af03f..01c764088 100644 --- a/include/socketengine_iocp.h +++ b/include/socketengine_iocp.h @@ -23,32 +23,48 @@ #include "inspircd.h" #include "socketengine.h" +/** Socket overlapped event types + */ enum SocketIOEvent { + /** Read ready */ SOCKET_IO_EVENT_READ_READY = 0, + /** Write ready */ SOCKET_IO_EVENT_WRITE_READY = 1, + /** Accept ready */ SOCKET_IO_EVENT_ACCEPT = 2, + /** Error occured */ SOCKET_IO_EVENT_ERROR = 3, + /** Number of events */ NUM_SOCKET_IO_EVENTS = 4, }; +/** Represents a windows overlapped IO event + */ class Overlapped { public: + /** Overlap event */ OVERLAPPED m_overlap; + /** Type of event */ SocketIOEvent m_event; #ifdef WIN64 + /** Parameters */ unsigned __int64 m_params; #else + /** Parameters */ unsigned long m_params; #endif - + /** Create an overlapped event + */ Overlapped(SocketIOEvent ev, int params) : m_event(ev), m_params(params) { memset(&m_overlap, 0, sizeof(OVERLAPPED)); } }; +/** Specific to UDP sockets with overlapped IO + */ struct udp_overlap { unsigned char udp_buffer[600]; @@ -57,12 +73,16 @@ struct udp_overlap unsigned long udp_sockaddr_len; }; +/** Specific to accepting sockets with overlapped IO + */ struct accept_overlap { int socket; char buf[1024]; }; +/** Implementation of SocketEngine that implements windows IO Completion Ports + */ class IOCPEngine : public SocketEngine { /** Creates a "fake" file descriptor for use with an IOCP socket. @@ -192,10 +212,6 @@ public: udp_overlap * udp_ov;
}; -//typedef void(*OpHandler)(EventHandler) -/** Event Handler Array - */ - /** Creates a SocketEngine */ class SocketEngineFactory |