Commit | Line | Data |
---|---|---|
e775ec98 | 1 | /*- |
56559b70 KB |
2 | * Copyright (c) 1980, 1983, 1988, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
5efaa119 | 4 | * |
e775ec98 | 5 | * %sccs.include.redist.c% |
8ff78169 | 6 | * |
56559b70 | 7 | * @(#)netdb.h 8.1 (Berkeley) %G% |
a3d53603 MK |
8 | * $Id: netdb.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $ |
9 | * - | |
10 | * Portions Copyright (c) 1993 by Digital Equipment Corporation. | |
11 | * | |
12 | * Permission to use, copy, modify, and distribute this software for any | |
13 | * purpose with or without fee is hereby granted, provided that the above | |
14 | * copyright notice and this permission notice appear in all copies, and that | |
15 | * the name of Digital Equipment Corporation not be used in advertising or | |
16 | * publicity pertaining to distribution of the document or software without | |
17 | * specific, written prior permission. | |
18 | * | |
19 | * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL | |
20 | * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES | |
21 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT | |
22 | * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
23 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
24 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
25 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
26 | * SOFTWARE. | |
27 | * - | |
28 | * --Copyright-- | |
5efaa119 KM |
29 | */ |
30 | ||
d2b7358e KB |
31 | #ifndef _NETDB_H_ |
32 | #define _NETDB_H_ | |
33 | ||
e775ec98 KB |
34 | #define _PATH_HEQUIV "/etc/hosts.equiv" |
35 | #define _PATH_HOSTS "/etc/hosts" | |
36 | #define _PATH_NETWORKS "/etc/networks" | |
37 | #define _PATH_PROTOCOLS "/etc/protocols" | |
38 | #define _PATH_SERVICES "/etc/services" | |
39 | ||
f3ac96de | 40 | /* |
e775ec98 KB |
41 | * Structures returned by network data base library. All addresses are |
42 | * supplied in host order, and returned in network order (suitable for | |
43 | * use in system calls). | |
f3ac96de SL |
44 | */ |
45 | struct hostent { | |
46 | char *h_name; /* official name of host */ | |
47 | char **h_aliases; /* alias list */ | |
48 | int h_addrtype; /* host address type */ | |
49 | int h_length; /* length of address */ | |
56630706 | 50 | char *h_addr; /* address */ |
f3ac96de SL |
51 | }; |
52 | ||
53 | /* | |
54 | * Assumption here is that a network number | |
a3d53603 | 55 | * fits in an unsigned long -- probably a poor one. |
f3ac96de SL |
56 | */ |
57 | struct netent { | |
37164239 JL |
58 | char *n_name; /* official name of net */ |
59 | char **n_aliases; /* alias list */ | |
60 | int n_addrtype; /* net address type */ | |
61 | unsigned long n_net; /* network # */ | |
f3ac96de SL |
62 | }; |
63 | ||
64 | struct servent { | |
65 | char *s_name; /* official service name */ | |
66 | char **s_aliases; /* alias list */ | |
67 | int s_port; /* port # */ | |
68 | char *s_proto; /* protocol to use */ | |
69 | }; | |
70 | ||
71 | struct protoent { | |
72 | char *p_name; /* official protocol name */ | |
73 | char **p_aliases; /* alias list */ | |
74 | int p_proto; /* protocol # */ | |
75 | }; | |
76 | ||
c0bcfdb1 KD |
77 | /* |
78 | * Error return codes from gethostbyname() and gethostbyaddr() | |
8ff78169 | 79 | * (left in extern int h_errno). |
c0bcfdb1 KD |
80 | */ |
81 | ||
8ff78169 | 82 | #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ |
c0bcfdb1 KD |
83 | #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ |
84 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ | |
8ff78169 MK |
85 | #define NO_DATA 4 /* Valid name, no data record of requested type */ |
86 | #define NO_ADDRESS NO_DATA /* no address, look for MX record */ | |
993000f1 DS |
87 | |
88 | #include <sys/cdefs.h> | |
89 | ||
90 | __BEGIN_DECLS | |
91 | void endhostent __P((void)); | |
92 | void endnetent __P((void)); | |
93 | void endprotoent __P((void)); | |
94 | void endservent __P((void)); | |
313bdacf | 95 | struct hostent *gethostbyaddr __P((const char *, int, int)); |
cb92eb7e | 96 | struct hostent *gethostbyname __P((const char *)); |
a3d53603 | 97 | struct hostent *gethostent __P((void)); |
993000f1 DS |
98 | struct netent *getnetbyaddr __P((long, int)); /* u_long? */ |
99 | struct netent *getnetbyname __P((const char *)); | |
100 | struct netent *getnetent __P((void)); | |
101 | struct protoent *getprotobyname __P((const char *)); | |
102 | struct protoent *getprotobynumber __P((int)); | |
103 | struct protoent *getprotoent __P((void)); | |
104 | struct servent *getservbyname __P((const char *, const char *)); | |
105 | struct servent *getservbyport __P((int, const char *)); | |
106 | struct servent *getservent __P((void)); | |
107 | void herror __P((const char *)); | |
a3d53603 | 108 | char *hstrerror __P((int)); |
993000f1 DS |
109 | void sethostent __P((int)); |
110 | /* void sethostfile __P((const char *)); */ | |
111 | void setnetent __P((int)); | |
112 | void setprotoent __P((int)); | |
113 | void setservent __P((int)); | |
114 | __END_DECLS | |
d2b7358e KB |
115 | |
116 | #endif /* !_NETDB_H_ */ |