3 * Portions copyright (c) 1993-1999 Symbian Ltd. All rights reserved.
7 * Copyright (c) 1980, 1983, 1988, 1993
8 * The Regents of the University of California. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
40 * Permission to use, copy, modify, and distribute this software for any
41 * purpose with or without fee is hereby granted, provided that the above
42 * copyright notice and this permission notice appear in all copies, and that
43 * the name of Digital Equipment Corporation not be used in advertising or
44 * publicity pertaining to distribution of the document or software without
45 * specific, written prior permission.
47 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
48 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
49 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
50 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
51 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
52 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
53 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
72 #include <sys/errno.h>
74 #define _PATH_HEQUIV "/etc/hosts.equiv"
75 #define _PATH_HOSTS "/etc/hosts"
76 #define _PATH_NETWORKS "/etc/networks"
77 #define _PATH_PROTOCOLS "/etc/protocols"
78 #define _PATH_SERVICES "/etc/services"
83 Structures returned by network data base library. All addresses are
84 supplied in host order, and returned in network order (suitable for
88 char *h_name; /* official name of host */
89 char **h_aliases; /* alias list */
90 int h_addrtype; /* host address type */
91 int h_length; /* length of address */
92 char **h_addr_list; /* list of addresses from name server */
93 #define h_addr h_addr_list[0] /* address, for backward compatibility */
97 Assumption here is that a network number
98 fits in an unsigned long -- probably a poor one.
101 char *n_name; /* official name of net */
102 char **n_aliases; /* alias list */
103 int n_addrtype; /* net address type */
104 unsigned long n_net; /* network # */
108 char *s_name; /* official service name */
109 char **s_aliases; /* alias list */
110 int s_port; /* port # */
111 char *s_proto; /* protocol to use */
115 char *p_name; /* official protocol name */
116 char **p_aliases; /* alias list */
117 int p_proto; /* protocol # */
121 Error return codes from gethostbyname() and gethostbyaddr()
123 #define NETDB_INTERNAL -1 /* see errno */
124 #define NETDB_SUCCESS 0 /* no problem */
125 #define HOST_NOT_FOUND ENOENT /* Authoritative Answer Host not found */
126 #define TRY_AGAIN ETIMEDOUT /* Non-Authoritative Host not found, or SERVERFAIL */
127 #define NO_RECOVERY ECOMM /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
128 #define NO_DATA 4 /* Valid name, no data record of requested type */
129 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
132 /* not supported on EPOC32 */
136 void sethostent (int);
140 struct hostent *gethostent (void);
144 void endhostent (void);
148 void setnetent (int);
152 struct netent *getnetent (void);
156 void endnetent (void);
160 void setprotoent (int);
164 struct protoent *getprotoent (void);
168 void endprotoent (void);
172 void setservent (int);
176 struct servent *getservent (void);
180 void endservent (void);
183 IMPORT_C struct hostent *gethostbyaddr (const char *, int, int);
184 IMPORT_C struct hostent *gethostbyname (const char *);
185 struct servent *getservbyname (const char *, const char *);
186 struct servent *getservbyport (int, const char *);
187 struct netent *getnetbyaddr (unsigned long, int);
188 struct netent *getnetbyname (const char *);
189 struct protoent *getprotobyname (const char *);
190 struct protoent *getprotobynumber (int);
196 #endif /* !_NETDB_H_ */