forked from Matway/mpl-sl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ws2_32.mpl
301 lines (246 loc) · 6.99 KB
/
ws2_32.mpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# Copyright (C) Matway Burkow
#
# This repository and all its contents belong to Matway Burkow (referred here and below as "the owner").
# The content is for demonstration purposes only.
# It is forbidden to use the content or any part of it for any purpose without explicit permission from the owner.
# By contributing to the repository, contributors acknowledge that ownership of their work transfers to the owner.
"control.AsRef" use
"control.Cref" use
"control.Int32" use
"control.Nat16" use
"control.Nat32" use
"control.Nat8" use
"control.Natx" use
"control.Ref" use
"conventions.stdcall" use
"kernel32.OVERLAPPED" use
FN_ACCEPTEXRef: [{
sListenSocket: Natx;
sAcceptSocket: Natx;
lpOutputBuffer: Natx;
dwReceiveDataLength: Nat32;
dwLocalAddressLength: Nat32;
dwRemoteAddressLength: Nat32;
lpdwBytesReceived: Nat32 Ref;
lpOverlapped: OVERLAPPED Ref;
} Int32 {convention: stdcall;} codeRef];
FN_CONNECTEXRef: [{
s: Natx;
name: Natx;
namelen: Int32;
lpSendBuffer: Natx;
dwSendDataLength: Nat32;
lpdwBytesSent: Nat32 Ref;
lpOverlapped: OVERLAPPED Ref;
} Int32 {convention: stdcall;} codeRef];
FN_GETACCEPTEXSOCKADDRSRef: [{
lpOutputBuffer: Natx;
dwReceiveDataLength: Nat32;
dwLocalAddressLength: Nat32;
dwRemoteAddressLength: Nat32;
LocalSockaddr: sockaddr AsRef Ref;
LocalSockaddrLength: Int32 Ref;
RemoteSockaddr: sockaddr AsRef Ref;
RemoteSockaddrLength: Int32 Ref;
} {} {convention: stdcall;} codeRef];
WSAOVERLAPPED_COMPLETION_ROUTINERef: [{
dwError: Nat32;
cbTransferred: Nat32;
lpOverlapped: OVERLAPPED Ref;
dwFlags: Nat32;
} {} {convention: stdcall;} codeRef];
AF_INET: [2];
FIONBIO: [-2147195266];
INADDR_ANY: [0x00000000n32];
INVALID_SOCKET: [0nx 1nx -];
IPPROTO_TCP: [6];
SD_RECEIVE: [0];
SD_SEND: [1];
SD_BOTH: [2];
SIO_GET_EXTENSION_FUNCTION_POINTER: [0x80000000n32 0x40000000n32 or 0x08000000n32 or 6n32 or];
SOCK_STREAM: [1];
SOL_SOCKET: [0xffff];
SOMAXCONN: [0x7fffffff];
SO_UPDATE_ACCEPT_CONTEXT: [0x700B];
SO_UPDATE_CONNECT_CONTEXT: [0x7010];
TCP_NODELAY: [1];
WSAEWOULDBLOCK: [10035];
WSAID_ACCEPTEX: [(0xB5367DF1n32 0xCBACn16 0x11CFn16 (0x95n8 0xCAn8 0x00n8 0x80n8 0x5Fn8 0x48n8 0xA1n8 0x92n8))];
WSAID_CONNECTEX: [(0x25A207B9n32 0xDDF3n16 0x4660n16 (0x8En8 0xE9n8 0x76n8 0xE5n8 0x8Cn8 0x74n8 0x06n8 0x3En8))];
WSAID_GETACCEPTEXSOCKADDRS: [(0xB5367DF2n32 0xCBACn16 0x11CFn16 (0x95n8 0xCAn8 0x00n8 0x80n8 0x5Fn8 0x48n8 0xA1n8 0x92n8))];
WSA_IO_PENDING: [997];
WSABUF: [{
len: Nat32;
buf: Natx;
}];
WSADESCRIPTION_LEN: [256];
WSASYS_STATUS_LEN: [128];
WSADATA: [{
wVersion: Nat16;
wHighVersion: Nat16;
Natx storageSize 8nx = [
iMaxSockets: Nat16;
iMaxUdpDg: Nat16;
lpVendorInfo: Nat8 Ref;
szDescription: Nat8 WSADESCRIPTION_LEN 1 + array;
szSystemStatus: Nat8 WSASYS_STATUS_LEN 1 + array;
] [
szDescription: Nat8 WSADESCRIPTION_LEN 1 + array;
szSystemStatus: Nat8 WSASYS_STATUS_LEN 1 + array;
iMaxSockets: Nat16;
iMaxUdpDg: Nat16;
lpVendorInfo: Nat8 Ref;
] uif
}];
addrinfo: [{
ai_flags: Int32;
ai_family: Int32;
ai_socktype: Int32;
ai_protocol: Int32;
ai_addrlen: Natx;
ai_canonname: Natx;
ai_addr: Natx;
ai_next: Natx;
}];
fd_set: [{
fd_count: Nat32;
fd_array: Natx 64 array;
}];
sockaddr: [{
sa_family: Nat16;
sa_data: Nat8 14 array;
}];
sockaddr_in: [{
sin_family: Nat16;
sin_port: Nat16;
sin_addr: Nat32;
sin_zero: Nat8 8 array;
}];
timeval: [{
tv_sec: Int32;
tv_usec: Int32;
}];
# WS2_32.Lib should be included for these functions
{} Int32 {convention: stdcall;} "WSACleanup" importFunction
{} Int32 {convention: stdcall;} "WSAGetLastError" importFunction
{
s: Natx;
lpOverlapped: OVERLAPPED Ref;
lpcbTransfer: Nat32 Ref;
fWait: Int32;
lpdwFlags: Nat32 Ref;
} Int32 {convention: stdcall;} "WSAGetOverlappedResult" importFunction
{
s: Natx;
dwIoControlCode: Nat32;
lpvInBuffer: Natx;
cbInBuffer: Nat32;
lpvOutBuffer: Natx;
cbOutBuffer: Nat32;
lpcbBytesReturned: Nat32 Ref;
lpOverlapped: OVERLAPPED Ref;
lpCompletionRoutine: WSAOVERLAPPED_COMPLETION_ROUTINERef;
} Int32 {convention: stdcall;} "WSAIoctl" importFunction
{
s: Natx;
lpBuffers: WSABUF Ref;
dwBufferCount: Nat32;
lpNumberOfBytesRecvd: Nat32 Ref;
lpFlags: Nat32 Ref;
lpOverlapped: OVERLAPPED Ref;
lpCompletionRoutine: WSAOVERLAPPED_COMPLETION_ROUTINERef;
} Int32 {convention: stdcall;} "WSARecv" importFunction
{
s: Natx;
lpBuffers: WSABUF Ref;
dwBufferCount: Nat32;
lpNumberOfBytesSent: Nat32 Ref;
dwFlags: Nat32;
lpOverlapped: OVERLAPPED Ref;
lpCompletionRoutine: WSAOVERLAPPED_COMPLETION_ROUTINERef;
} Int32 {convention: stdcall;} "WSASend" importFunction
{
iError: Int32;
} {} {convention: stdcall;} "WSASetLastError" importFunction
{
wVersionRequested: Nat16;
lpWSAData: WSADATA Ref;
} Int32 {convention: stdcall;} "WSAStartup" importFunction
{
s: Natx;
name: Natx;
namelen: Int32;
} Int32 {convention: stdcall;} "bind" importFunction
{
s: Natx;
} Int32 {convention: stdcall;} "closesocket" importFunction
{
s: Natx;
name: sockaddr Ref;
nameLen: Int32;
} Int32 {convention: stdcall;} "connect" importFunction
{
pAddrInfo: addrinfo Ref;
} {} {convention: stdcall;} "freeaddrinfo" importFunction
{
pNodeName: Natx;
pServiceName: Natx;
pHints: addrinfo Cref;
ppResult: Natx;
} Int32 {convention: stdcall;} "getaddrinfo" importFunction
{
hostlong: Nat32;
} Nat32 {convention: stdcall;} "htonl" importFunction
{
hostshort: Nat16;
} Nat16 {convention: stdcall;} "htons" importFunction
{
s: Natx;
cmd: Int32;
argp: Natx;
} Int32 {convention: stdcall;} "ioctlsocket" importFunction
{
s: Natx;
backlog: Int32;
} Int32 {convention: stdcall;} "listen" importFunction
{
netlong: Nat32;
} Nat32 {convention: stdcall;} "ntohl" importFunction
{
netshort: Nat16;
} Nat16 {convention: stdcall;} "ntohs" importFunction
{
s: Natx;
buf: Natx;
len: Int32;
flags: Int32;
} Int32 {convention: stdcall;} "recv" importFunction
{
ndfs: Int32;
readfds: fd_set Ref;
writefds: fd_set Ref;
exceptfds: fd_set Ref;
timeout: timeval Ref;
} Int32 {convention: stdcall;} "select" importFunction
{
s: Natx;
buf: Natx;
len: Int32;
flags: Int32;
} Int32 {convention: stdcall;} "send" importFunction
{
s: Natx;
level: Int32;
optname: Int32;
optval: Natx;
optlen: Int32;
} Int32 {convention: stdcall;} "setsockopt" importFunction
{
s: Natx;
how: Int32;
} Int32 {convention: stdcall;} "shutdown" importFunction
{
af: Int32;
type: Int32;
protocol: Int32;
} Natx {convention: stdcall;} "socket" importFunction