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