| 364 | } |
| 365 | |
| 366 | static const char *wstrerror(int err) { |
| 367 | switch (err) { |
| 368 | case WSAEINTR: return "Interrupted function call"; |
| 369 | case WSAEACCES: return PIE_ACCESS; /* "Permission denied"; */ |
| 370 | case WSAEFAULT: return "Bad address"; |
| 371 | case WSAEINVAL: return "Invalid argument"; |
| 372 | case WSAEMFILE: return "Too many open files"; |
| 373 | case WSAEWOULDBLOCK: return "Resource temporarily unavailable"; |
| 374 | case WSAEINPROGRESS: return "Operation now in progress"; |
| 375 | case WSAEALREADY: return "Operation already in progress"; |
| 376 | case WSAENOTSOCK: return "Socket operation on nonsocket"; |
| 377 | case WSAEDESTADDRREQ: return "Destination address required"; |
| 378 | case WSAEMSGSIZE: return "Message too long"; |
| 379 | case WSAEPROTOTYPE: return "Protocol wrong type for socket"; |
| 380 | case WSAENOPROTOOPT: return "Bad protocol option"; |
| 381 | case WSAEPROTONOSUPPORT: return "Protocol not supported"; |
| 382 | case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; /* "Socket type not supported"; */ |
| 383 | case WSAEOPNOTSUPP: return "Operation not supported"; |
| 384 | case WSAEPFNOSUPPORT: return "Protocol family not supported"; |
| 385 | case WSAEAFNOSUPPORT: return PIE_FAMILY; /* "Address family not supported by protocol family"; */ |
| 386 | case WSAEADDRINUSE: return PIE_ADDRINUSE; /* "Address already in use"; */ |
| 387 | case WSAEADDRNOTAVAIL: return "Cannot assign requested address"; |
| 388 | case WSAENETDOWN: return "Network is down"; |
| 389 | case WSAENETUNREACH: return "Network is unreachable"; |
| 390 | case WSAENETRESET: return "Network dropped connection on reset"; |
| 391 | case WSAECONNABORTED: return "Software caused connection abort"; |
| 392 | case WSAECONNRESET: return PIE_CONNRESET; /* "Connection reset by peer"; */ |
| 393 | case WSAENOBUFS: return "No buffer space available"; |
| 394 | case WSAEISCONN: return PIE_ISCONN; /* "Socket is already connected"; */ |
| 395 | case WSAENOTCONN: return "Socket is not connected"; |
| 396 | case WSAESHUTDOWN: return "Cannot send after socket shutdown"; |
| 397 | case WSAETIMEDOUT: return PIE_TIMEDOUT; /* "Connection timed out"; */ |
| 398 | case WSAECONNREFUSED: return PIE_CONNREFUSED; /* "Connection refused"; */ |
| 399 | case WSAEHOSTDOWN: return "Host is down"; |
| 400 | case WSAEHOSTUNREACH: return "No route to host"; |
| 401 | case WSAEPROCLIM: return "Too many processes"; |
| 402 | case WSASYSNOTREADY: return "Network subsystem is unavailable"; |
| 403 | case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range"; |
| 404 | case WSANOTINITIALISED: |
| 405 | return "Successful WSAStartup not yet performed"; |
| 406 | case WSAEDISCON: return "Graceful shutdown in progress"; |
| 407 | case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; /* "Host not found"; */ |
| 408 | case WSATRY_AGAIN: return "Nonauthoritative host not found"; |
| 409 | case WSANO_RECOVERY: return PIE_FAIL; /* "Nonrecoverable name lookup error"; */ |
| 410 | case WSANO_DATA: return "Valid name, no data record of requested type"; |
| 411 | default: return "Unknown error"; |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | const char *socket_gaistrerror(int err) { |
| 416 | if (err == 0) return NULL; |
no outgoing calls
no test coverage detected