eve.sys.windows.iocp

Supplemental Windows IOCP bindings not present in druntime.

Most IOCP and Winsock functionality is available via druntime's core.sys.windows.winbase and core.sys.windows.winsock2 modules. This module provides only the missing pieces needed by EVE's Layer 0.

Types 7

structWSABUF

Buffer descriptor for Winsock overlapped I/O.

Used with WSARecv, WSASend, and related functions to describe data buffers for scatter/gather I/O operations.

Fields
ULONG lenLength of the buffer in bytes.
ubyte * bufPointer to the buffer data.

Extended OVERLAPPED structure returned by GetQueuedCompletionStatusEx.

This structure is not present in druntime's winbase bindings.

Fields
ULONG_PTR lpCompletionKey
OVERLAPPED * lpOverlapped
ULONG_PTR Internal
DWORD dwNumberOfBytesTransferred
structGUID

GUID structure for Winsock extension function lookups.

Fields
uint Data1
ushort Data2
ushort Data3
ubyte[8] Data4
aliasAcceptExFunc = BOOL function( SOCKET sListenSocket, SOCKET sAcceptSocket, void * lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, DWORD * lpdwBytesReceived, OVERLAPPED * lpOverlapped ) nothrow @nogc

Function pointer type for AcceptEx.

AcceptEx accepts a new connection, returns the local and remote addresses, and optionally receives the first block of data sent by the client.

aliasGetAcceptExSockaddrsFunc = void function( void * lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, sockaddr * * LocalSockaddr, int * LocalSockaddrLength, sockaddr * * RemoteSockaddr, int * RemoteSockaddrLength ) nothrow @nogc

Function pointer type for GetAcceptExSockaddrs.

Parses the output buffer from AcceptEx to extract local and remote addresses.

aliasConnectExFunc = BOOL function( SOCKET s, const(sockaddr) * name, int namelen, void * lpSendBuffer, DWORD dwSendDataLength, DWORD * lpdwBytesSent, OVERLAPPED * lpOverlapped ) nothrow @nogc

Function pointer type for ConnectEx.

ConnectEx establishes a connection asynchronously.

structWSADATA

Winsock startup data structure.

Fields
ushort wVersion
ushort wHighVersion
ushort iMaxSockets
ushort iMaxUdpDg
char * lpVendorInfo
char[257] szDescription
char[129] szSystemStatus

Functions 15

fnBOOL GetQueuedCompletionStatusEx( HANDLE CompletionPort, OVERLAPPED_ENTRY * lpCompletionPortEntries, ULONG ulCount, ULONG * ulNumEntriesRemoved, DWORD dwMilliseconds, BOOL fAlertable, )Dequeue multiple completion packets from an I/O completion port.
fnBOOL CancelIoEx(HANDLE hFile, OVERLAPPED * lpOverlapped)Cancel pending I/O operations on a handle.
fnint WSARecv( SOCKET s, WSABUF * lpBuffers, DWORD dwBufferCount, DWORD * lpNumberOfBytesRecvd, DWORD * lpFlags, OVERLAPPED * lpOverlapped, void * lpCompletionRoutine )Receive data on a socket using overlapped I/O.
fnint WSASend( SOCKET s, WSABUF * lpBuffers, DWORD dwBufferCount, DWORD * lpNumberOfBytesSent, DWORD dwFlags, OVERLAPPED * lpOverlapped, void * lpCompletionRoutine )Send data on a socket using overlapped I/O.
fnint WSARecvFrom( SOCKET s, WSABUF * lpBuffers, DWORD dwBufferCount, DWORD * lpNumberOfBytesRecvd, DWORD * lpFlags, sockaddr * lpFrom, int * lpFromlen, OVERLAPPED * lpOverlapped, void * lpCompletionRoutine )Receive a datagram and store the source address using overlapped I/O.
fnint WSASendTo( SOCKET s, WSABUF * lpBuffers, DWORD dwBufferCount, DWORD * lpNumberOfBytesSent, DWORD dwFlags, const(sockaddr) * lpTo, int iTolen, OVERLAPPED * lpOverlapped, void * lpCompletionRoutine )Send a datagram to a specific destination using overlapped I/O.
fnSOCKET WSASocketW( int af, int type, int protocol, void * lpProtocolInfo, uint g, DWORD dwFlags )Create a socket with extended options.
fnint WSAIoctl( SOCKET s, DWORD dwIoControlCode, void * lpvInBuffer, DWORD cbInBuffer, void * lpvOutBuffer, DWORD cbOutBuffer, DWORD * lpcbBytesReturned, OVERLAPPED * lpOverlapped, void * lpCompletionRoutine )Retrieve extension function pointer from Winsock.
fnAcceptExFunc loadAcceptEx(SOCKET s) @trusted nothrow @nogcLoad AcceptEx function pointer from a socket.
fnGetAcceptExSockaddrsFunc loadGetAcceptExSockaddrs(SOCKET s) @trusted nothrow @nogcLoad GetAcceptExSockaddrs function pointer from a socket.
fnConnectExFunc loadConnectEx(SOCKET s) @trusted nothrow @nogcLoad ConnectEx function pointer from a socket.
fnint WSAStartup(ushort wVersionRequested, WSADATA * lpWSAData)Initialize Winsock.
fnint WSACleanup()Clean up Winsock.
fnushort MAKEWORD(ubyte major, ubyte minor) pure @safe nothrow @nogcCreate a Winsock version request value.
fnbool ensureWinsockInitialized() @trusted nothrow @nogcInitialize Winsock if not already initialized.

Variables 20

enumvarINVALID_SOCKET = cast(SOCKET) ~ cast(size_t) 0

Invalid socket sentinel value.

enumvarINFINITE = 0xFFFFFFFF

Infinite timeout value.

enumvarERROR_SUCCESS = 0

Common error codes.

enumvarERROR_IO_PENDING = 997
enumvarERROR_INVALID_HANDLE = 6
enumvarERROR_INVALID_PARAMETER = 87
enumvarERROR_NOT_FOUND = 1168
enumvarERROR_ALREADY_EXISTS = 183
enumvarERROR_IO_INCOMPLETE = 996
enumvarWSA_IO_PENDING = 997

Winsock error codes.

enumvarWSAECONNRESET = 10054
enumvarWSAEDISCON = 10101
enumvarWSA_FLAG_OVERLAPPED = 0x01

Winsock socket creation flags.

enumvarSIO_GET_EXTENSION_FUNCTION_POINTER = 0xC8000006

IOCTL code to retrieve extension function pointers.

varGUID WSAID_ACCEPTEX

GUID for AcceptEx function.

varGUID WSAID_CONNECTEX

GUID for ConnectEx function.

varGUID WSAID_GETACCEPTEXSOCKADDRS

GUID for GetAcceptExSockaddrs function.

enumvarSO_UPDATE_ACCEPT_CONTEXT = 0x700B

Socket option to update accept context after AcceptEx.

enumvarSO_UPDATE_CONNECT_CONTEXT = 0x7010

Socket option to update connect context after ConnectEx.

enumvarWINSOCK_VERSION_2_2 = 0x0202

Winsock version 2.2 encoded.