authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-01-31 23:04:24+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-01 14:29:16-05:00
log4f2652d504c796bbba6d7ccf6a699dc01055e3e7
tree732f73a0e5f07a06de4e5a7d9afcb4703d757a92
parent0bf91cce5855b72e0bddfb94912dcfaa9d77417f

Winsock errors can be an enum


2 files changed, 456 insertions(+), 103 deletions(-)

lib/std/os/windows.zig+7-7
......@@ -662,7 +662,7 @@ pub fn WSAStartup(majorVersion: u8, minorVersion: u8) !ws2_32.WSADATA {
662662 var wsadata: ws2_32.WSADATA = undefined;
663663 return switch (ws2_32.WSAStartup((@as(WORD, minorVersion) << 8) | majorVersion, &wsadata)) {
664664 0 => wsadata,
665 else => |err| unexpectedWSAError(err),
665 else => |err| unexpectedWSAError(@intToEnum(WinsockError, err)),
666666 };
667667}
668668
......@@ -687,10 +687,10 @@ pub fn WSASocketW(
687687 const rc = ws2_32.WSASocketW(af, socket_type, protocol, protocolInfo, g, dwFlags);
688688 if (rc == ws2_32.INVALID_SOCKET) {
689689 switch (ws2_32.WSAGetLastError()) {
690 ws2_32.WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported,
691 ws2_32.WSAEMFILE => return error.ProcessFdQuotaExceeded,
692 ws2_32.WSAENOBUFS => return error.SystemResources,
693 ws2_32.WSAEPROTONOSUPPORT => return error.ProtocolNotSupported,
690 .WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported,
691 .WSAEMFILE => return error.ProcessFdQuotaExceeded,
692 .WSAENOBUFS => return error.SystemResources,
693 .WSAEPROTONOSUPPORT => return error.ProtocolNotSupported,
694694 else => |err| return unexpectedWSAError(err),
695695 }
696696 }
......@@ -1050,8 +1050,8 @@ pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError {
10501050 return error.Unexpected;
10511051}
10521052
1053pub fn unexpectedWSAError(err: c_int) std.os.UnexpectedError {
1054 return unexpectedError(@intToEnum(Win32Error, @intCast(u16, err)));
1053pub fn unexpectedWSAError(err: WinsockError) std.os.UnexpectedError {
1054 return unexpectedError(@intToEnum(Win32Error, @enumToInt(err)));
10551055}
10561056
10571057/// Call this when you made a windows NtDll call
lib/std/os/windows/ws2_32.zig+449-96
......@@ -205,101 +205,454 @@ pub const WSAMSG = extern struct {
205205 dwFlags: DWORD,
206206};
207207
208pub const WSA_INVALID_HANDLE = 6;
209pub const WSA_NOT_ENOUGH_MEMORY = 8;
210pub const WSA_INVALID_PARAMETER = 87;
211pub const WSA_OPERATION_ABORTED = 995;
212pub const WSA_IO_INCOMPLETE = 996;
213pub const WSA_IO_PENDING = 997;
214pub const WSAEINTR = 10004;
215pub const WSAEBADF = 10009;
216pub const WSAEACCES = 10013;
217pub const WSAEFAULT = 10014;
218pub const WSAEINVAL = 10022;
219pub const WSAEMFILE = 10024;
220pub const WSAEWOULDBLOCK = 10035;
221pub const WSAEINPROGRESS = 10036;
222pub const WSAEALREADY = 10037;
223pub const WSAENOTSOCK = 10038;
224pub const WSAEDESTADDRREQ = 10039;
225pub const WSAEMSGSIZE = 10040;
226pub const WSAEPROTOTYPE = 10041;
227pub const WSAENOPROTOOPT = 10042;
228pub const WSAEPROTONOSUPPORT = 10043;
229pub const WSAESOCKTNOSUPPORT = 10044;
230pub const WSAEOPNOTSUPP = 10045;
231pub const WSAEPFNOSUPPORT = 10046;
232pub const WSAEAFNOSUPPORT = 10047;
233pub const WSAEADDRINUSE = 10048;
234pub const WSAEADDRNOTAVAIL = 10049;
235pub const WSAENETDOWN = 10050;
236pub const WSAENETUNREACH = 10051;
237pub const WSAENETRESET = 10052;
238pub const WSAECONNABORTED = 10053;
239pub const WSAECONNRESET = 10054;
240pub const WSAENOBUFS = 10055;
241pub const WSAEISCONN = 10056;
242pub const WSAENOTCONN = 10057;
243pub const WSAESHUTDOWN = 10058;
244pub const WSAETOOMANYREFS = 10059;
245pub const WSAETIMEDOUT = 10060;
246pub const WSAECONNREFUSED = 10061;
247pub const WSAELOOP = 10062;
248pub const WSAENAMETOOLONG = 10063;
249pub const WSAEHOSTDOWN = 10064;
250pub const WSAEHOSTUNREACH = 10065;
251pub const WSAENOTEMPTY = 10066;
252pub const WSAEPROCLIM = 10067;
253pub const WSAEUSERS = 10068;
254pub const WSAEDQUOT = 10069;
255pub const WSAESTALE = 10070;
256pub const WSAEREMOTE = 10071;
257pub const WSASYSNOTREADY = 10091;
258pub const WSAVERNOTSUPPORTED = 10092;
259pub const WSANOTINITIALISED = 10093;
260pub const WSAEDISCON = 10101;
261pub const WSAENOMORE = 10102;
262pub const WSAECANCELLED = 10103;
263pub const WSAEINVALIDPROCTABLE = 10104;
264pub const WSAEINVALIDPROVIDER = 10105;
265pub const WSAEPROVIDERFAILEDINIT = 10106;
266pub const WSASYSCALLFAILURE = 10107;
267pub const WSASERVICE_NOT_FOUND = 10108;
268pub const WSATYPE_NOT_FOUND = 10109;
269pub const WSA_E_NO_MORE = 10110;
270pub const WSA_E_CANCELLED = 10111;
271pub const WSAEREFUSED = 10112;
272pub const WSAHOST_NOT_FOUND = 11001;
273pub const WSATRY_AGAIN = 11002;
274pub const WSANO_RECOVERY = 11003;
275pub const WSANO_DATA = 11004;
276pub const WSA_QOS_RECEIVERS = 11005;
277pub const WSA_QOS_SENDERS = 11006;
278pub const WSA_QOS_NO_SENDERS = 11007;
279pub const WSA_QOS_NO_RECEIVERS = 11008;
280pub const WSA_QOS_REQUEST_CONFIRMED = 11009;
281pub const WSA_QOS_ADMISSION_FAILURE = 11010;
282pub const WSA_QOS_POLICY_FAILURE = 11011;
283pub const WSA_QOS_BAD_STYLE = 11012;
284pub const WSA_QOS_BAD_OBJECT = 11013;
285pub const WSA_QOS_TRAFFIC_CTRL_ERROR = 11014;
286pub const WSA_QOS_GENERIC_ERROR = 11015;
287pub const WSA_QOS_ESERVICETYPE = 11016;
288pub const WSA_QOS_EFLOWSPEC = 11017;
289pub const WSA_QOS_EPROVSPECBUF = 11018;
290pub const WSA_QOS_EFILTERSTYLE = 11019;
291pub const WSA_QOS_EFILTERTYPE = 11020;
292pub const WSA_QOS_EFILTERCOUNT = 11021;
293pub const WSA_QOS_EOBJLENGTH = 11022;
294pub const WSA_QOS_EFLOWCOUNT = 11023;
295pub const WSA_QOS_EUNKOWNPSOBJ = 11024;
296pub const WSA_QOS_EPOLICYOBJ = 11025;
297pub const WSA_QOS_EFLOWDESC = 11026;
298pub const WSA_QOS_EPSFLOWSPEC = 11027;
299pub const WSA_QOS_EPSFILTERSPEC = 11028;
300pub const WSA_QOS_ESDMODEOBJ = 11029;
301pub const WSA_QOS_ESHAPERATEOBJ = 11030;
302pub const WSA_QOS_RESERVED_PETYPE = 11031;
208// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2
209pub const WinsockError = extern enum(u16) {
210 /// Specified event object handle is invalid.
211 /// An application attempts to use an event object, but the specified handle is not valid.
212 WSA_INVALID_HANDLE = 6,
213
214 /// Insufficient memory available.
215 /// An application used a Windows Sockets function that directly maps to a Windows function.
216 /// The Windows function is indicating a lack of required memory resources.
217 WSA_NOT_ENOUGH_MEMORY = 8,
218
219 /// One or more parameters are invalid.
220 /// An application used a Windows Sockets function which directly maps to a Windows function.
221 /// The Windows function is indicating a problem with one or more parameters.
222 WSA_INVALID_PARAMETER = 87,
223
224 /// Overlapped operation aborted.
225 /// An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl.
226 WSA_OPERATION_ABORTED = 995,
227
228 /// Overlapped I/O event object not in signaled state.
229 /// The application has tried to determine the status of an overlapped operation which is not yet completed.
230 /// Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed, get this error code until the operation is complete.
231 WSA_IO_INCOMPLETE = 996,
232
233 /// The application has initiated an overlapped operation that cannot be completed immediately.
234 /// A completion indication will be given later when the operation has been completed.
235 WSA_IO_PENDING = 997,
236
237 /// Interrupted function call.
238 /// A blocking operation was interrupted by a call to WSACancelBlockingCall.
239 WSAEINTR = 10004,
240
241 /// File handle is not valid.
242 /// The file handle supplied is not valid.
243 WSAEBADF = 10009,
244
245 /// Permission denied.
246 /// An attempt was made to access a socket in a way forbidden by its access permissions.
247 /// An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST).
248 /// Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access.
249 /// Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option.
250 WSAEACCES = 10013,
251
252 /// Bad address.
253 /// The system detected an invalid pointer address in attempting to use a pointer argument of a call.
254 /// This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small.
255 /// For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
256 WSAEFAULT = 10014,
257
258 /// Invalid argument.
259 /// Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function).
260 /// In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening.
261 WSAEINVAL = 10022,
262
263 /// Too many open files.
264 /// Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process, or per thread.
265 WSAEMFILE = 10024,
266
267 /// Resource temporarily unavailable.
268 /// This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket.
269 /// It is a nonfatal error, and the operation should be retried later.
270 /// It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.
271 WSAEWOULDBLOCK = 10035,
272
273 /// Operation now in progress.
274 /// A blocking operation is currently executing.
275 /// Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error.
276 WSAEINPROGRESS = 10036,
277
278 /// Operation already in progress.
279 /// An operation was attempted on a nonblocking socket with an operation already in progress—that is, calling connect a second time on a nonblocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed.
280 WSAEALREADY = 10037,
281
282 /// Socket operation on nonsocket.
283 /// An operation was attempted on something that is not a socket.
284 /// Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.
285 WSAENOTSOCK = 10038,
286
287 /// Destination address required.
288 /// A required address was omitted from an operation on a socket.
289 /// For example, this error is returned if sendto is called with the remote address of ADDR_ANY.
290 WSAEDESTADDRREQ = 10039,
291
292 /// Message too long.
293 /// A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.
294 WSAEMSGSIZE = 10040,
295
296 /// Protocol wrong type for socket.
297 /// A protocol was specified in the socket function call that does not support the semantics of the socket type requested.
298 /// For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK_STREAM.
299 WSAEPROTOTYPE = 10041,
300
301 /// Bad protocol option.
302 /// An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call.
303 WSAENOPROTOOPT = 10042,
304
305 /// Protocol not supported.
306 /// The requested protocol has not been configured into the system, or no implementation for it exists.
307 /// For example, a socket call requests a SOCK_DGRAM socket, but specifies a stream protocol.
308 WSAEPROTONOSUPPORT = 10043,
309
310 /// Socket type not supported.
311 /// The support for the specified socket type does not exist in this address family.
312 /// For example, the optional type SOCK_RAW might be selected in a socket call, and the implementation does not support SOCK_RAW sockets at all.
313 WSAESOCKTNOSUPPORT = 10044,
314
315 /// Operation not supported.
316 /// The attempted operation is not supported for the type of object referenced.
317 /// Usually this occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket.
318 WSAEOPNOTSUPP = 10045,
319
320 /// Protocol family not supported.
321 /// The protocol family has not been configured into the system or no implementation for it exists.
322 /// This message has a slightly different meaning from WSAEAFNOSUPPORT.
323 /// However, it is interchangeable in most cases, and all Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT.
324 WSAEPFNOSUPPORT = 10046,
325
326 /// Address family not supported by protocol family.
327 /// An address incompatible with the requested protocol was used.
328 /// All sockets are created with an associated address family (that is, AF_INET for Internet Protocols) and a generic protocol type (that is, SOCK_STREAM).
329 /// This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto.
330 WSAEAFNOSUPPORT = 10047,
331
332 /// Address already in use.
333 /// Typically, only one usage of each socket address (protocol/IP address/port) is permitted.
334 /// This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing.
335 /// For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO_REUSEADDR).
336 /// Client applications usually need not call bind at all—connect chooses an unused port automatically.
337 /// When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed.
338 /// This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.
339 WSAEADDRINUSE = 10048,
340
341 /// Cannot assign requested address.
342 /// The requested address is not valid in its context.
343 /// This normally results from an attempt to bind to an address that is not valid for the local computer.
344 /// This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote computer (for example, address or port 0).
345 WSAEADDRNOTAVAIL = 10049,
346
347 /// Network is down.
348 /// A socket operation encountered a dead network.
349 /// This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself.
350 WSAENETDOWN = 10050,
351
352 /// Network is unreachable.
353 /// A socket operation was attempted to an unreachable network.
354 /// This usually means the local software knows no route to reach the remote host.
355 WSAENETUNREACH = 10051,
356
357 /// Network dropped connection on reset.
358 /// The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress.
359 /// It can also be returned by setsockopt if an attempt is made to set SO_KEEPALIVE on a connection that has already failed.
360 WSAENETRESET = 10052,
361
362 /// Software caused connection abort.
363 /// An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error.
364 WSAECONNABORTED = 10053,
365
366 /// Connection reset by peer.
367 /// An existing connection was forcibly closed by the remote host.
368 /// This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket).
369 /// This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress.
370 /// Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
371 WSAECONNRESET = 10054,
372
373 /// No buffer space available.
374 /// An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
375 WSAENOBUFS = 10055,
376
377 /// Socket is already connected.
378 /// A connect request was made on an already-connected socket.
379 /// Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence.
380 WSAEISCONN = 10056,
381
382 /// Socket is not connected.
383 /// A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied.
384 /// Any other type of operation might also return this error—for example, setsockopt setting SO_KEEPALIVE if the connection has been reset.
385 WSAENOTCONN = 10057,
386
387 /// Cannot send after socket shutdown.
388 /// A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call.
389 /// By calling shutdown a partial close of a socket is requested, which is a signal that sending or receiving, or both have been discontinued.
390 WSAESHUTDOWN = 10058,
391
392 /// Too many references.
393 /// Too many references to some kernel object.
394 WSAETOOMANYREFS = 10059,
395
396 /// Connection timed out.
397 /// A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.
398 WSAETIMEDOUT = 10060,
399
400 /// Connection refused.
401 /// No connection could be made because the target computer actively refused it.
402 /// This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running.
403 WSAECONNREFUSED = 10061,
404
405 /// Cannot translate name.
406 /// Cannot translate a name.
407 WSAELOOP = 10062,
408
409 /// Name too long.
410 /// A name component or a name was too long.
411 WSAENAMETOOLONG = 10063,
412
413 /// Host is down.
414 /// A socket operation failed because the destination host is down. A socket operation encountered a dead host.
415 /// Networking activity on the local host has not been initiated.
416 /// These conditions are more likely to be indicated by the error WSAETIMEDOUT.
417 WSAEHOSTDOWN = 10064,
418
419 /// No route to host.
420 /// A socket operation was attempted to an unreachable host. See WSAENETUNREACH.
421 WSAEHOSTUNREACH = 10065,
422
423 /// Directory not empty.
424 /// Cannot remove a directory that is not empty.
425 WSAENOTEMPTY = 10066,
426
427 /// Too many processes.
428 /// A Windows Sockets implementation may have a limit on the number of applications that can use it simultaneously.
429 /// WSAStartup may fail with this error if the limit has been reached.
430 WSAEPROCLIM = 10067,
431
432 /// User quota exceeded.
433 /// Ran out of user quota.
434 WSAEUSERS = 10068,
435
436 /// Disk quota exceeded.
437 /// Ran out of disk quota.
438 WSAEDQUOT = 10069,
439
440 /// Stale file handle reference.
441 /// The file handle reference is no longer available.
442 WSAESTALE = 10070,
443
444 /// Item is remote.
445 /// The item is not available locally.
446 WSAEREMOTE = 10071,
447
448 /// Network subsystem is unavailable.
449 /// This error is returned by WSAStartup if the Windows Sockets implementation cannot function at this time because the underlying system it uses to provide network services is currently unavailable.
450 /// Users should check:
451 /// - That the appropriate Windows Sockets DLL file is in the current path.
452 /// - That they are not trying to use more than one Windows Sockets implementation simultaneously.
453 /// - If there is more than one Winsock DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded.
454 /// - The Windows Sockets implementation documentation to be sure all necessary components are currently installed and configured correctly.
455 WSASYSNOTREADY = 10091,
456
457 /// Winsock.dll version out of range.
458 /// The current Windows Sockets implementation does not support the Windows Sockets specification version requested by the application.
459 /// Check that no old Windows Sockets DLL files are being accessed.
460 WSAVERNOTSUPPORTED = 10092,
461
462 /// Successful WSAStartup not yet performed.
463 /// Either the application has not called WSAStartup or WSAStartup failed.
464 /// The application may be accessing a socket that the current active task does not own (that is, trying to share a socket between tasks), or WSACleanup has been called too many times.
465 WSANOTINITIALISED = 10093,
466
467 /// Graceful shutdown in progress.
468 /// Returned by WSARecv and WSARecvFrom to indicate that the remote party has initiated a graceful shutdown sequence.
469 WSAEDISCON = 10101,
470
471 /// No more results.
472 /// No more results can be returned by the WSALookupServiceNext function.
473 WSAENOMORE = 10102,
474
475 /// Call has been canceled.
476 /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
477 WSAECANCELLED = 10103,
478
479 /// Procedure call table is invalid.
480 /// The service provider procedure call table is invalid.
481 /// A service provider returned a bogus procedure table to Ws2_32.dll.
482 /// This is usually caused by one or more of the function pointers being NULL.
483 WSAEINVALIDPROCTABLE = 10104,
484
485 /// Service provider is invalid.
486 /// The requested service provider is invalid.
487 /// This error is returned by the WSCGetProviderInfo and WSCGetProviderInfo32 functions if the protocol entry specified could not be found.
488 /// This error is also returned if the service provider returned a version number other than 2.0.
489 WSAEINVALIDPROVIDER = 10105,
490
491 /// Service provider failed to initialize.
492 /// The requested service provider could not be loaded or initialized.
493 /// This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.
494 WSAEPROVIDERFAILEDINIT = 10106,
495
496 /// System call failure.
497 /// A system call that should never fail has failed.
498 /// This is a generic error code, returned under various conditions.
499 /// Returned when a system call that should never fail does fail.
500 /// For example, if a call to WaitForMultipleEvents fails or one of the registry functions fails trying to manipulate the protocol/namespace catalogs.
501 /// Returned when a provider does not return SUCCESS and does not provide an extended error code.
502 /// Can indicate a service provider implementation error.
503 WSASYSCALLFAILURE = 10107,
504
505 /// Service not found.
506 /// No such service is known. The service cannot be found in the specified name space.
507 WSASERVICE_NOT_FOUND = 10108,
508
509 /// Class type not found.
510 /// The specified class was not found.
511 WSATYPE_NOT_FOUND = 10109,
512
513 /// No more results.
514 /// No more results can be returned by the WSALookupServiceNext function.
515 WSA_E_NO_MORE = 10110,
516
517 /// Call was canceled.
518 /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
519 WSA_E_CANCELLED = 10111,
520
521 /// Database query was refused.
522 /// A database query failed because it was actively refused.
523 WSAEREFUSED = 10112,
524
525 /// Host not found.
526 /// No such host is known. The name is not an official host name or alias, or it cannot be found in the database(s) being queried.
527 /// This error may also be returned for protocol and service queries, and means that the specified name could not be found in the relevant database.
528 WSAHOST_NOT_FOUND = 11001,
529
530 /// Nonauthoritative host not found.
531 /// This is usually a temporary error during host name resolution and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful.
532 WSATRY_AGAIN = 11002,
533
534 /// This is a nonrecoverable error.
535 /// This indicates that some sort of nonrecoverable error occurred during a database lookup.
536 /// This may be because the database files (for example, BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found, or a DNS request was returned by the server with a severe error.
537 WSANO_RECOVERY = 11003,
538
539 /// Valid name, no data record of requested type.
540 /// The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for.
541 /// The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server).
542 /// An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.
543 WSANO_DATA = 11004,
544
545 /// QoS receivers.
546 /// At least one QoS reserve has arrived.
547 WSA_QOS_RECEIVERS = 11005,
548
549 /// QoS senders.
550 /// At least one QoS send path has arrived.
551 WSA_QOS_SENDERS = 11006,
552
553 /// No QoS senders.
554 /// There are no QoS senders.
555 WSA_QOS_NO_SENDERS = 11007,
556
557 /// QoS no receivers.
558 /// There are no QoS receivers.
559 WSA_QOS_NO_RECEIVERS = 11008,
560
561 /// QoS request confirmed.
562 /// The QoS reserve request has been confirmed.
563 WSA_QOS_REQUEST_CONFIRMED = 11009,
564
565 /// QoS admission error.
566 /// A QoS error occurred due to lack of resources.
567 WSA_QOS_ADMISSION_FAILURE = 11010,
568
569 /// QoS policy failure.
570 /// The QoS request was rejected because the policy system couldn't allocate the requested resource within the existing policy.
571 WSA_QOS_POLICY_FAILURE = 11011,
572
573 /// QoS bad style.
574 /// An unknown or conflicting QoS style was encountered.
575 WSA_QOS_BAD_STYLE = 11012,
576
577 /// QoS bad object.
578 /// A problem was encountered with some part of the filterspec or the provider-specific buffer in general.
579 WSA_QOS_BAD_OBJECT = 11013,
580
581 /// QoS traffic control error.
582 /// An error with the underlying traffic control (TC) API as the generic QoS request was converted for local enforcement by the TC API.
583 /// This could be due to an out of memory error or to an internal QoS provider error.
584 WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
585
586 /// QoS generic error.
587 /// A general QoS error.
588 WSA_QOS_GENERIC_ERROR = 11015,
589
590 /// QoS service type error.
591 /// An invalid or unrecognized service type was found in the QoS flowspec.
592 WSA_QOS_ESERVICETYPE = 11016,
593
594 /// QoS flowspec error.
595 /// An invalid or inconsistent flowspec was found in the QOS structure.
596 WSA_QOS_EFLOWSPEC = 11017,
597
598 /// Invalid QoS provider buffer.
599 /// An invalid QoS provider-specific buffer.
600 WSA_QOS_EPROVSPECBUF = 11018,
601
602 /// Invalid QoS filter style.
603 /// An invalid QoS filter style was used.
604 WSA_QOS_EFILTERSTYLE = 11019,
605
606 /// Invalid QoS filter type.
607 /// An invalid QoS filter type was used.
608 WSA_QOS_EFILTERTYPE = 11020,
609
610 /// Incorrect QoS filter count.
611 /// An incorrect number of QoS FILTERSPECs were specified in the FLOWDESCRIPTOR.
612 WSA_QOS_EFILTERCOUNT = 11021,
613
614 /// Invalid QoS object length.
615 /// An object with an invalid ObjectLength field was specified in the QoS provider-specific buffer.
616 WSA_QOS_EOBJLENGTH = 11022,
617
618 /// Incorrect QoS flow count.
619 /// An incorrect number of flow descriptors was specified in the QoS structure.
620 WSA_QOS_EFLOWCOUNT = 11023,
621
622 /// Unrecognized QoS object.
623 /// An unrecognized object was found in the QoS provider-specific buffer.
624 WSA_QOS_EUNKOWNPSOBJ = 11024,
625
626 /// Invalid QoS policy object.
627 /// An invalid policy object was found in the QoS provider-specific buffer.
628 WSA_QOS_EPOLICYOBJ = 11025,
629
630 /// Invalid QoS flow descriptor.
631 /// An invalid QoS flow descriptor was found in the flow descriptor list.
632 WSA_QOS_EFLOWDESC = 11026,
633
634 /// Invalid QoS provider-specific flowspec.
635 /// An invalid or inconsistent flowspec was found in the QoS provider-specific buffer.
636 WSA_QOS_EPSFLOWSPEC = 11027,
637
638 /// Invalid QoS provider-specific filterspec.
639 /// An invalid FILTERSPEC was found in the QoS provider-specific buffer.
640 WSA_QOS_EPSFILTERSPEC = 11028,
641
642 /// Invalid QoS shape discard mode object.
643 /// An invalid shape discard mode object was found in the QoS provider-specific buffer.
644 WSA_QOS_ESDMODEOBJ = 11029,
645
646 /// Invalid QoS shaping rate object.
647 /// An invalid shaping rate object was found in the QoS provider-specific buffer.
648 WSA_QOS_ESHAPERATEOBJ = 11030,
649
650 /// Reserved policy QoS element type.
651 /// A reserved policy element was found in the QoS provider-specific buffer.
652 WSA_QOS_RESERVED_PETYPE = 11031,
653
654 _,
655};
303656
304657/// no parameters
305658const IOC_VOID = 0x80000000;
......@@ -320,7 +673,7 @@ pub extern "ws2_32" fn WSAStartup(
320673 lpWSAData: *WSADATA,
321674) callconv(.Stdcall) c_int;
322675pub extern "ws2_32" fn WSACleanup() callconv(.Stdcall) c_int;
323pub extern "ws2_32" fn WSAGetLastError() callconv(.Stdcall) c_int;
676pub extern "ws2_32" fn WSAGetLastError() callconv(.Stdcall) WinsockError;
324677pub extern "ws2_32" fn WSASocketA(
325678 af: c_int,
326679 type: c_int,