| 1 | /* |
| 2 | * Copyright (C) 1999 Ross Combs ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #include "common/setup_before.h" |
| 19 | |
| 20 | #ifdef WIN32 |
| 21 | #include <cstring> |
| 22 | #include <winsock2.h> |
| 23 | |
| 24 | namespace pvpgn |
| 25 | { |
| 26 | |
| 27 | extern char const * pstrerror(int errornum) |
| 28 | { |
| 29 | switch (errornum) |
| 30 | { |
| 31 | case WSAEINTR: return "Interrupted function call"; |
| 32 | case WSAEACCES: return "Permission denied"; |
| 33 | case WSAEFAULT: return "Bad address"; |
| 34 | case WSAEINVAL: return "Inavlid argument"; |
| 35 | case WSAEMFILE: return "Too many open files"; |
| 36 | case WSAEWOULDBLOCK: return "Resource temorarily unavailable"; |
| 37 | case WSAEINPROGRESS: return "Operation now in progress"; |
| 38 | case WSAEALREADY: return "Operation already in progress"; |
| 39 | case WSAENOTSOCK: return "Socket operation on nonsocket"; |
| 40 | case WSAEDESTADDRREQ: return "Destination address required"; |
| 41 | case WSAEMSGSIZE: return "Message too long"; |
| 42 | case WSAEPROTOTYPE: return "Protocol wrong type fpr socket"; |
| 43 | case WSAENOPROTOOPT: return "Bad protocol option"; |
| 44 | case WSAEPROTONOSUPPORT: return "Protocol not supported"; |
| 45 | case WSAESOCKTNOSUPPORT: return "Socket type not supported"; |
| 46 | case WSAEOPNOTSUPP: return "Operation not supported"; |
| 47 | case WSAEPFNOSUPPORT: return "Protocol family not supported"; |
| 48 | case WSAEAFNOSUPPORT: return "Address family not supported by protocol family"; |
| 49 | case WSAEADDRINUSE: return "Address already in use"; |
| 50 | case WSAEADDRNOTAVAIL: return "Cannot assign requested address"; |
| 51 | case WSAENETDOWN: return "Network is down"; |
| 52 | case WSAENETUNREACH: return "Network is unreachable"; |
| 53 | case WSAENETRESET: return "Network dropped connection on reset"; |
| 54 | case WSAECONNABORTED: return "Software caused connection abort"; |
| 55 | case WSAECONNRESET: return "Connection reset by peer"; |
| 56 | case WSAENOBUFS: return "No buffer space available"; |
| 57 | case WSAEISCONN: return "Socket is already connected"; |
| 58 | case WSAENOTCONN: return "Socket is not connected"; |
| 59 | case WSAESHUTDOWN: return "Cannot send after socket shutdown"; |
| 60 | case WSAETIMEDOUT: return "Connection timed out"; |
| 61 | case WSAECONNREFUSED: return "Connection refused"; |
| 62 | case WSAEHOSTDOWN: return "Host is down"; |
| 63 | case WSAEHOSTUNREACH: return "No route to host"; |
| 64 | case WSAEPROCLIM: return "Too many processes"; |
| 65 | case WSASYSNOTREADY: return "Network subsystem is unavailable"; |
| 66 | case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range"; |
| 67 | case WSANOTINITIALISED: return "Successful WSAStartup not yet performed"; |
| 68 | case WSAEDISCON: return "Graceful shutdown in progress"; |
| 69 | case WSATYPE_NOT_FOUND: return "Class type not found"; |
| 70 | case WSAHOST_NOT_FOUND: return "Host not found"; |
| 71 | case WSATRY_AGAIN: return "Nonauthoriative host not found"; |
| 72 | case WSANO_RECOVERY: return "This is a nonrecoverable error"; |
| 73 | case WSANO_DATA: return "Valid name, no data record of requested type"; |
| 74 | case WSA_INVALID_HANDLE: return "Specified event object handle is invalid"; |
| 75 | case WSA_INVALID_PARAMETER: return "One or more parameters are invalid"; |
| 76 | case WSA_IO_INCOMPLETE: return "Overlapped I/O event object not in signaled state"; |
| 77 | case WSA_IO_PENDING: return "Overlapped operation will complete later"; |
| 78 | case WSA_NOT_ENOUGH_MEMORY: return "Insufficient memory available"; |
| 79 | case WSA_OPERATION_ABORTED: return "Overlapped operation aborted"; |
| 80 | case WSASYSCALLFAILURE: return "System call failure"; |
| 81 | default: return std::strerror(errornum); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | } |
| 86 | |
| 87 | #endif |