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 10
Buffer descriptor for Winsock overlapped I/O.
Used with WSARecv, WSASend, and related functions to describe data buffers for scatter/gather I/O operations.
Extended OVERLAPPED structure returned by GetQueuedCompletionStatusEx.
This structure is not present in druntime's winbase bindings.
ULONG_PTR lpCompletionKeyOVERLAPPED * lpOverlappedULONG_PTR InternalDWORD dwNumberOfBytesTransferredGUID structure for Winsock extension function lookups.
uint Data1ushort Data2ushort Data3ubyte[8] Data4Function 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.
Function pointer type for GetAcceptExSockaddrs.
Parses the output buffer from AcceptEx to extract local and remote addresses.
Function pointer type for ConnectEx.
ConnectEx establishes a connection asynchronously.
Function pointer type for TransmitFile.
TransmitFile transfers file data over a connected socket, optionally prepending and appending data buffers. Supports both synchronous and overlapped (IOCP) operation.
Buffers for TransmitFile head and tail data.
Allows sending header and trailer data alongside file content in a single TransmitFile call, avoiding extra send operations.
TCP keepalive parameters structure for SIO_KEEPALIVE_VALS.
Used with WSAIoctl to configure keepalive behavior with finer granularity than the generic SO_KEEPALIVE socket option.
Winsock startup data structure.
ushort wVersionushort wHighVersionushort iMaxSocketsushort iMaxUdpDgchar * lpVendorInfochar[257] szDescriptionchar[129] szSystemStatusFunctions 16
BOOL GetQueuedCompletionStatusEx(
HANDLE CompletionPort,
OVERLAPPED_ENTRY * lpCompletionPortEntries,
ULONG ulCount,
ULONG * ulNumEntriesRemoved,
DWORD dwMilliseconds,
BOOL fAlertable,
) extern(Windows) nothrow @nogcDequeue multiple completion packets from an I/O completion port.BOOL CancelIoEx(HANDLE hFile, OVERLAPPED * lpOverlapped) extern(Windows) nothrow @nogcCancel pending I/O operations on a handle.int WSARecv(
SOCKET s,
WSABUF * lpBuffers,
DWORD dwBufferCount,
DWORD * lpNumberOfBytesRecvd,
DWORD * lpFlags,
OVERLAPPED * lpOverlapped,
void * lpCompletionRoutine
) extern(Windows) nothrow @nogcReceive data on a socket using overlapped I/O.int WSASend(
SOCKET s,
WSABUF * lpBuffers,
DWORD dwBufferCount,
DWORD * lpNumberOfBytesSent,
DWORD dwFlags,
OVERLAPPED * lpOverlapped,
void * lpCompletionRoutine
) extern(Windows) nothrow @nogcSend data on a socket using overlapped I/O.int WSARecvFrom(
SOCKET s,
WSABUF * lpBuffers,
DWORD dwBufferCount,
DWORD * lpNumberOfBytesRecvd,
DWORD * lpFlags,
sockaddr * lpFrom,
int * lpFromlen,
OVERLAPPED * lpOverlapped,
void * lpCompletionRoutine
) extern(Windows) nothrow @nogcReceive a datagram and store the source address using overlapped I/O.int WSASendTo(
SOCKET s,
WSABUF * lpBuffers,
DWORD dwBufferCount,
DWORD * lpNumberOfBytesSent,
DWORD dwFlags,
const(sockaddr) * lpTo,
int iTolen,
OVERLAPPED * lpOverlapped,
void * lpCompletionRoutine
) extern(Windows) nothrow @nogcSend a datagram to a specific destination using overlapped I/O.SOCKET WSASocketW(
int af,
int type,
int protocol,
void * lpProtocolInfo,
uint g,
DWORD dwFlags
) extern(Windows) nothrow @nogcCreate a socket with extended options.int WSAIoctl(
SOCKET s,
DWORD dwIoControlCode,
void * lpvInBuffer,
DWORD cbInBuffer,
void * lpvOutBuffer,
DWORD cbOutBuffer,
DWORD * lpcbBytesReturned,
OVERLAPPED * lpOverlapped,
void * lpCompletionRoutine
) extern(Windows) nothrow @nogcRetrieve extension function pointer from Winsock.AcceptExFunc loadAcceptEx(SOCKET s) @trusted nothrow @nogcLoad AcceptEx function pointer from a socket.GetAcceptExSockaddrsFunc loadGetAcceptExSockaddrs(SOCKET s) @trusted nothrow @nogcLoad GetAcceptExSockaddrs function pointer from a socket.ConnectExFunc loadConnectEx(SOCKET s) @trusted nothrow @nogcLoad ConnectEx function pointer from a socket.TransmitFileFunc loadTransmitFile(SOCKET s) @trusted nothrow @nogcLoad TransmitFile function pointer from a socket.int WSAStartup(ushort wVersionRequested, WSADATA * lpWSAData) extern(Windows) nothrow @nogcInitialize Winsock.ushort MAKEWORD(ubyte major, ubyte minor) pure @safe nothrow @nogcCreate a Winsock version request value.bool ensureWinsockInitialized() @trusted nothrow @nogcInitialize Winsock if not already initialized.Variables 30
INVALID_SOCKET = cast(SOCKET) ~ cast(size_t) 0Invalid socket sentinel value.
INFINITE = 0xFFFFFFFFInfinite timeout value.
ERROR_SUCCESS = 0Common error codes.
ERROR_IO_PENDING = 997ERROR_INVALID_HANDLE = 6ERROR_INVALID_PARAMETER = 87ERROR_NOT_FOUND = 1168ERROR_ALREADY_EXISTS = 183ERROR_IO_INCOMPLETE = 996WSA_IO_PENDING = 997Winsock error codes.
WSAECONNRESET = 10054WSAEDISCON = 10101WSA_FLAG_OVERLAPPED = 0x01Winsock socket creation flags.
SIO_GET_EXTENSION_FUNCTION_POINTER = 0xC8000006IOCTL code to retrieve extension function pointers.
GUID WSAID_ACCEPTEX = GUID(
0xb5367df1, 0xcbac, 0x11cf,
[0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92]
)GUID for AcceptEx function.
GUID WSAID_CONNECTEX = GUID(
0x25a207b9, 0xddf3, 0x4660,
[0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e]
)GUID for ConnectEx function.
GUID WSAID_GETACCEPTEXSOCKADDRS = GUID(
0xb5367df2, 0xcbac, 0x11cf,
[0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92]
)GUID for GetAcceptExSockaddrs function.
GUID WSAID_TRANSMITFILE = GUID(
0xb5367df0, 0xcbac, 0x11cf,
[0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92]
)GUID for TransmitFile function.
TF_DISCONNECT = 0x01TransmitFile flags.
TF_REUSE_SOCKET = 0x02TF_WRITE_BEHIND = 0x04TF_USE_DEFAULT_WORKER = 0x00TF_USE_SYSTEM_THREAD = 0x10TF_USE_KERNEL_APC = 0x20SO_UPDATE_ACCEPT_CONTEXT = 0x700BSocket option to update accept context after AcceptEx.
SO_UPDATE_CONNECT_CONTEXT = 0x7010Socket option to update connect context after ConnectEx.
SO_RCVBUF = 0x1002Socket option for receive buffer size.
SO_SNDBUF = 0x1001Socket option for send buffer size.
SIO_KEEPALIVE_VALS = 0x98000004IOCTL code for setting TCP keepalive parameters.
WINSOCK_VERSION_2_2 = 0x0202Winsock version 2.2 encoded.