authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-11-13 17:30:26+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-11-14 17:09:19+11:00
logf4c6cc3270db8f3557b3e7191eccc02098b4b2da
tree05984c071af9423a0af1fcf249b7236460e548a6
parenta832b35c19801b02f97103bce9e86afd389a01dd
signaturelock-open Commit is signed but in an unrecognized format.

std: add winsock some definitions


2 files changed, 187 insertions(+), 0 deletions(-)

lib/std/os/windows.zig+1
......@@ -16,6 +16,7 @@ pub const kernel32 = @import("windows/kernel32.zig");
1616pub const ntdll = @import("windows/ntdll.zig");
1717pub const ole32 = @import("windows/ole32.zig");
1818pub const shell32 = @import("windows/shell32.zig");
19pub const ws2_32 = @import("windows/ws2_32.zig");
1920
2021pub usingnamespace @import("windows/bits.zig");
2122
lib/std/os/windows/ws2_32.zig created+186
......@@ -0,0 +1,186 @@
1usingnamespace @import("bits.zig");
2
3pub const SOCKET = *@OpaqueType();
4pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0));
5
6pub const MAX_PROTOCOL_CHAIN = 7;
7
8pub const WSAPROTOCOLCHAIN = extern struct {
9 ChainLen: c_int,
10 ChainEntries: [MAX_PROTOCOL_CHAIN]DWORD,
11};
12
13pub const WSAPROTOCOL_LEN = 255;
14
15pub const WSAPROTOCOL_INFOA = extern struct {
16 dwServiceFlags1: DWORD,
17 dwServiceFlags2: DWORD,
18 dwServiceFlags3: DWORD,
19 dwServiceFlags4: DWORD,
20 dwProviderFlags: DWORD,
21 ProviderId: GUID,
22 dwCatalogEntryId: DWORD,
23 ProtocolChain: WSAPROTOCOLCHAIN,
24 iVersion: c_int,
25 iAddressFamily: c_int,
26 iMaxSockAddr: c_int,
27 iMinSockAddr: c_int,
28 iSocketType: c_int,
29 iProtocol: c_int,
30 iProtocolMaxOffset: c_int,
31 iNetworkByteOrder: c_int,
32 iSecurityScheme: c_int,
33 dwMessageSize: DWORD,
34 dwProviderReserved: DWORD,
35 szProtocol: [WSAPROTOCOL_LEN + 1]CHAR,
36};
37
38pub const WSAPROTOCOL_INFOW = extern struct {
39 dwServiceFlags1: DWORD,
40 dwServiceFlags2: DWORD,
41 dwServiceFlags3: DWORD,
42 dwServiceFlags4: DWORD,
43 dwProviderFlags: DWORD,
44 ProviderId: GUID,
45 dwCatalogEntryId: DWORD,
46 ProtocolChain: WSAPROTOCOLCHAIN,
47 iVersion: c_int,
48 iAddressFamily: c_int,
49 iMaxSockAddr: c_int,
50 iMinSockAddr: c_int,
51 iSocketType: c_int,
52 iProtocol: c_int,
53 iProtocolMaxOffset: c_int,
54 iNetworkByteOrder: c_int,
55 iSecurityScheme: c_int,
56 dwMessageSize: DWORD,
57 dwProviderReserved: DWORD,
58 szProtocol: [WSAPROTOCOL_LEN + 1]WCHAR,
59};
60
61pub const GROUP = u32;
62
63pub const SG_UNCONSTRAINED_GROUP = 0x1;
64pub const SG_CONSTRAINED_GROUP = 0x2;
65
66pub const WSA_FLAG_OVERLAPPED = 0x01;
67pub const WSA_FLAG_MULTIPOINT_C_ROOT = 0x02;
68pub const WSA_FLAG_MULTIPOINT_C_LEAF = 0x04;
69pub const WSA_FLAG_MULTIPOINT_D_ROOT = 0x08;
70pub const WSA_FLAG_MULTIPOINT_D_LEAF = 0x10;
71pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40;
72pub const WSA_FLAG_NO_HANDLE_INHERIT = 0x80;
73
74pub const WSA_INVALID_HANDLE = 6;
75pub const WSA_NOT_ENOUGH_MEMORY = 8;
76pub const WSA_INVALID_PARAMETER = 87;
77pub const WSA_OPERATION_ABORTED = 995;
78pub const WSA_IO_INCOMPLETE = 996;
79pub const WSA_IO_PENDING = 997;
80pub const WSAEINTR = 10004;
81pub const WSAEBADF = 10009;
82pub const WSAEACCES = 10013;
83pub const WSAEFAULT = 10014;
84pub const WSAEINVAL = 10022;
85pub const WSAEMFILE = 10024;
86pub const WSAEWOULDBLOCK = 10035;
87pub const WSAEINPROGRESS = 10036;
88pub const WSAEALREADY = 10037;
89pub const WSAENOTSOCK = 10038;
90pub const WSAEDESTADDRREQ = 10039;
91pub const WSAEMSGSIZE = 10040;
92pub const WSAEPROTOTYPE = 10041;
93pub const WSAENOPROTOOPT = 10042;
94pub const WSAEPROTONOSUPPORT = 10043;
95pub const WSAESOCKTNOSUPPORT = 10044;
96pub const WSAEOPNOTSUPP = 10045;
97pub const WSAEPFNOSUPPORT = 10046;
98pub const WSAEAFNOSUPPORT = 10047;
99pub const WSAEADDRINUSE = 10048;
100pub const WSAEADDRNOTAVAIL = 10049;
101pub const WSAENETDOWN = 10050;
102pub const WSAENETUNREACH = 10051;
103pub const WSAENETRESET = 10052;
104pub const WSAECONNABORTED = 10053;
105pub const WSAECONNRESET = 10054;
106pub const WSAENOBUFS = 10055;
107pub const WSAEISCONN = 10056;
108pub const WSAENOTCONN = 10057;
109pub const WSAESHUTDOWN = 10058;
110pub const WSAETOOMANYREFS = 10059;
111pub const WSAETIMEDOUT = 10060;
112pub const WSAECONNREFUSED = 10061;
113pub const WSAELOOP = 10062;
114pub const WSAENAMETOOLONG = 10063;
115pub const WSAEHOSTDOWN = 10064;
116pub const WSAEHOSTUNREACH = 10065;
117pub const WSAENOTEMPTY = 10066;
118pub const WSAEPROCLIM = 10067;
119pub const WSAEUSERS = 10068;
120pub const WSAEDQUOT = 10069;
121pub const WSAESTALE = 10070;
122pub const WSAEREMOTE = 10071;
123pub const WSASYSNOTREADY = 10091;
124pub const WSAVERNOTSUPPORTED = 10092;
125pub const WSANOTINITIALISED = 10093;
126pub const WSAEDISCON = 10101;
127pub const WSAENOMORE = 10102;
128pub const WSAECANCELLED = 10103;
129pub const WSAEINVALIDPROCTABLE = 10104;
130pub const WSAEINVALIDPROVIDER = 10105;
131pub const WSAEPROVIDERFAILEDINIT = 10106;
132pub const WSASYSCALLFAILURE = 10107;
133pub const WSASERVICE_NOT_FOUND = 10108;
134pub const WSATYPE_NOT_FOUND = 10109;
135pub const WSA_E_NO_MORE = 10110;
136pub const WSA_E_CANCELLED = 10111;
137pub const WSAEREFUSED = 10112;
138pub const WSAHOST_NOT_FOUND = 11001;
139pub const WSATRY_AGAIN = 11002;
140pub const WSANO_RECOVERY = 11003;
141pub const WSANO_DATA = 11004;
142pub const WSA_QOS_RECEIVERS = 11005;
143pub const WSA_QOS_SENDERS = 11006;
144pub const WSA_QOS_NO_SENDERS = 11007;
145pub const WSA_QOS_NO_RECEIVERS = 11008;
146pub const WSA_QOS_REQUEST_CONFIRMED = 11009;
147pub const WSA_QOS_ADMISSION_FAILURE = 11010;
148pub const WSA_QOS_POLICY_FAILURE = 11011;
149pub const WSA_QOS_BAD_STYLE = 11012;
150pub const WSA_QOS_BAD_OBJECT = 11013;
151pub const WSA_QOS_TRAFFIC_CTRL_ERROR = 11014;
152pub const WSA_QOS_GENERIC_ERROR = 11015;
153pub const WSA_QOS_ESERVICETYPE = 11016;
154pub const WSA_QOS_EFLOWSPEC = 11017;
155pub const WSA_QOS_EPROVSPECBUF = 11018;
156pub const WSA_QOS_EFILTERSTYLE = 11019;
157pub const WSA_QOS_EFILTERTYPE = 11020;
158pub const WSA_QOS_EFILTERCOUNT = 11021;
159pub const WSA_QOS_EOBJLENGTH = 11022;
160pub const WSA_QOS_EFLOWCOUNT = 11023;
161pub const WSA_QOS_EUNKOWNPSOBJ = 11024;
162pub const WSA_QOS_EPOLICYOBJ = 11025;
163pub const WSA_QOS_EFLOWDESC = 11026;
164pub const WSA_QOS_EPSFLOWSPEC = 11027;
165pub const WSA_QOS_EPSFILTERSPEC = 11028;
166pub const WSA_QOS_ESDMODEOBJ = 11029;
167pub const WSA_QOS_ESHAPERATEOBJ = 11030;
168pub const WSA_QOS_RESERVED_PETYPE = 11031;
169
170pub extern "ws2_32" stdcallcc fn WSAGetLastError() c_int;
171pub extern "ws2_32" stdcallcc fn WSASocketA(
172 af: c_int,
173 type: c_int,
174 protocol: c_int,
175 lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
176 g: GROUP,
177 dwFlags: DWORD,
178) SOCKET;
179pub extern "ws2_32" stdcallcc fn WSASocketW(
180 af: c_int,
181 type: c_int,
182 protocol: c_int,
183 lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
184 g: GROUP,
185 dwFlags: DWORD,
186) SOCKET;