]> The Tcpdump Group git mirrors - libpcap/blob - Win32/Include/net/netdb.h
Give N. Leiten credit for the poll() exceptional condition checks in
[libpcap] / Win32 / Include / net / netdb.h
1 /*-
2 * Copyright (c) 1980, 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)netdb.h 8.1 (Berkeley) 6/2/93
34 * netdb.h,v 1.4 1995/08/14 04:05:04 hjl Exp
35 * -
36 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
37 *
38 * Permission to use, copy, modify and distribute this software for any
39 * purpose with or without fee is hereby granted, provided that the above
40 * copyright notice and this permission notice appear in all copies, and that
41 * the name of Digital Equipment Corporation not be used in advertising or
42 * publicity pertaining to distribution of the document or software without
43 * specific, written prior permission.
44 *
45 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
46 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
47 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
48 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
49 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
50 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
51 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
52 * SOFTWARE.
53 * -
54 * --Copyright--
55 */
56
57 #ifndef _NETDB_H_
58 #define _NETDB_H_
59
60 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
61 #include <stdio.h>
62 #include <netinet/in.h>
63 #endif
64
65 #include <winsock2.h>
66 #include <net/paths.h>
67
68 #define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv"
69 #define _PATH_HOSTS __PATH_ETC_INET"/hosts"
70 #define _PATH_NETWORKS __PATH_ETC_INET"/networks"
71 #define _PATH_PROTOCOLS __PATH_ETC_INET"/protocols"
72 #define _PATH_SERVICES __PATH_ETC_INET"/services"
73 #define _PATH_RESCONF __PATH_ETC_INET"/resolv.conf"
74 #define _PATH_RPC __PATH_ETC_INET"/rpc"
75
76 struct rpcent {
77 char *r_name; /* name of server for this rpc program */
78 char **r_aliases; /* alias list */
79 int r_number; /* rpc program number */
80 };
81
82 #ifndef WIN32
83 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
84
85 #define __NETDB_MAXALIASES 35
86 #define __NETDB_MAXADDRS 35
87
88 /*
89 * Error return codes from gethostbyname() and gethostbyaddr()
90 * (left in extern int h_errno).
91 */
92 #define h_errno (*__h_errno_location ())
93 #else
94 extern int h_errno;
95 #endif
96 #endif
97
98 #define NETDB_INTERNAL -1 /* see errno */
99 #define NETDB_SUCCESS 0 /* no problem */
100
101 //#include <features.h>
102
103 void endhostent (void);
104 void endnetent (void);
105 void endprotoent (void);
106 void endservent (void);
107 void endrpcent (void);
108 struct hostent *gethostent (void);
109 struct netent *getnetbyaddr (long, int); /* u_long? */
110 struct netent *getnetbyname (const char *);
111 struct netent *getnetent (void);
112 struct protoent *getprotoent (void);
113 struct servent *getservent (void);
114 struct rpcent *getrpcent (void);
115 struct rpcent *getrpcbyname (const char *);
116 struct rpcent *getrpcbynumber (int);
117 void herror (const char *);
118 void sethostent (int);
119 /* void sethostfile (const char *); */
120 void setnetent (int);
121 void setprotoent (int);
122 void setservent (int);
123 void setrpcent (int);
124
125 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
126 struct hostent *gethostbyaddr_r (const char *__addr,
127 int __length, int __type,
128 struct hostent *__result,
129 char *__buffer, int __buflen, int *__h_errnop);
130 struct hostent *gethostbyname_r (const char * __name,
131 struct hostent *__result, char *__buffer,
132 int __buflen, int *__h_errnop);
133 struct hostent *gethostent_r (struct hostent *__result,
134 char *__buffer, int __buflen, int *__h_errnop);
135 struct netent *getnetbyaddr_r (long __net, int __type,
136 struct netent *__result, char *__buffer,
137 int __buflen);
138 struct netent *getnetbyname_r (const char * __name,
139 struct netent *__result, char *__buffer,
140 int __buflen);
141 struct netent *getnetent_r (struct netent *__result,
142 char *__buffer, int __buflen);
143 struct protoent *getprotobyname_r (const char * __name,
144 struct protoent *__result, char *__buffer,
145 int __buflen);
146 struct protoent *getprotobynumber_r (int __proto,
147 struct protoent *__result, char *__buffer,
148 int __buflen);
149 struct protoent *getprotoent_r (struct protoent *__result,
150 char *__buffer, int __buflen);
151 struct servent *getservbyname_r (const char * __name,
152 const char *__proto, struct servent *__result,
153 char *__buffer, int __buflen);
154 struct servent *getservbyport_r (int __port,
155 const char *__proto, struct servent *__result,
156 char *__buffer, int __buflen);
157 struct servent *getservent_r (struct servent *__result,
158 char *__buffer, int __buflen);
159
160 int *__h_errno_location (void);
161
162 #endif
163
164 #endif /* !_NETDB_H_ */