1 /* $NetBSD: nt_err.c,v 1.1.1.2 2010/03/08 02:14:20 lukem Exp $ */ 2 3 /* OpenLDAP: pkg/ldap/libraries/liblber/nt_err.c,v 1.15.2.4 2009/01/22 00:00:54 kurt Exp */ 4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 5 * 6 * Copyright 1998-2009 The OpenLDAP Foundation. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted only as authorized by the OpenLDAP 11 * Public License. 12 * 13 * A copy of this license is available in the file LICENSE in the 14 * top-level directory of the distribution or, alternatively, at 15 * <http://www.OpenLDAP.org/license.html>. 16 */ 17 18 #include "portable.h" 19 20 #ifdef HAVE_WINSOCK2 21 #include <winsock2.h> 22 #elif HAVE_WINSOCK 23 #include <winsock.h> 24 #endif /* HAVE_WINSOCK(2) */ 25 26 #define LBER_RETSTR( x ) case x: return #x; 27 28 char *ber_pvt_wsa_err2string( int err ) 29 { 30 switch( err ) { 31 LBER_RETSTR( WSAEINTR ) 32 LBER_RETSTR( WSAEBADF ) 33 LBER_RETSTR( WSAEACCES ) 34 LBER_RETSTR( WSAEFAULT ) 35 LBER_RETSTR( WSAEINVAL ) 36 LBER_RETSTR( WSAEMFILE ) 37 LBER_RETSTR( WSAEWOULDBLOCK ) 38 LBER_RETSTR( WSAEINPROGRESS ) 39 LBER_RETSTR( WSAEALREADY ) 40 LBER_RETSTR( WSAENOTSOCK ) 41 LBER_RETSTR( WSAEDESTADDRREQ ) 42 LBER_RETSTR( WSAEMSGSIZE ) 43 LBER_RETSTR( WSAEPROTOTYPE ) 44 LBER_RETSTR( WSAENOPROTOOPT ) 45 LBER_RETSTR( WSAEPROTONOSUPPORT ) 46 LBER_RETSTR( WSAESOCKTNOSUPPORT ) 47 LBER_RETSTR( WSAEOPNOTSUPP ) 48 LBER_RETSTR( WSAEPFNOSUPPORT ) 49 LBER_RETSTR( WSAEAFNOSUPPORT ) 50 LBER_RETSTR( WSAEADDRINUSE ) 51 LBER_RETSTR( WSAEADDRNOTAVAIL ) 52 LBER_RETSTR( WSAENETDOWN ) 53 LBER_RETSTR( WSAENETUNREACH ) 54 LBER_RETSTR( WSAENETRESET ) 55 LBER_RETSTR( WSAECONNABORTED ) 56 LBER_RETSTR( WSAECONNRESET ) 57 LBER_RETSTR( WSAENOBUFS ) 58 LBER_RETSTR( WSAEISCONN ) 59 LBER_RETSTR( WSAENOTCONN ) 60 LBER_RETSTR( WSAESHUTDOWN ) 61 LBER_RETSTR( WSAETOOMANYREFS ) 62 LBER_RETSTR( WSAETIMEDOUT ) 63 LBER_RETSTR( WSAECONNREFUSED ) 64 LBER_RETSTR( WSAELOOP ) 65 LBER_RETSTR( WSAENAMETOOLONG ) 66 LBER_RETSTR( WSAEHOSTDOWN ) 67 LBER_RETSTR( WSAEHOSTUNREACH ) 68 LBER_RETSTR( WSAENOTEMPTY ) 69 LBER_RETSTR( WSAEPROCLIM ) 70 LBER_RETSTR( WSAEUSERS ) 71 LBER_RETSTR( WSAEDQUOT ) 72 LBER_RETSTR( WSAESTALE ) 73 LBER_RETSTR( WSAEREMOTE ) 74 LBER_RETSTR( WSASYSNOTREADY ) 75 LBER_RETSTR( WSAVERNOTSUPPORTED ) 76 LBER_RETSTR( WSANOTINITIALISED ) 77 LBER_RETSTR( WSAEDISCON ) 78 79 #ifdef HAVE_WINSOCK2 80 LBER_RETSTR( WSAENOMORE ) 81 LBER_RETSTR( WSAECANCELLED ) 82 LBER_RETSTR( WSAEINVALIDPROCTABLE ) 83 LBER_RETSTR( WSAEINVALIDPROVIDER ) 84 LBER_RETSTR( WSASYSCALLFAILURE ) 85 LBER_RETSTR( WSASERVICE_NOT_FOUND ) 86 LBER_RETSTR( WSATYPE_NOT_FOUND ) 87 LBER_RETSTR( WSA_E_NO_MORE ) 88 LBER_RETSTR( WSA_E_CANCELLED ) 89 LBER_RETSTR( WSAEREFUSED ) 90 #endif /* HAVE_WINSOCK2 */ 91 92 LBER_RETSTR( WSAHOST_NOT_FOUND ) 93 LBER_RETSTR( WSATRY_AGAIN ) 94 LBER_RETSTR( WSANO_RECOVERY ) 95 LBER_RETSTR( WSANO_DATA ) 96 } 97 return "unknown WSA error"; 98 } 99