Commit | Line | Data |
---|---|---|
e775ec98 | 1 | /*- |
f4f66d2c | 2 | * Copyright (c) 1980, 1983, 1988 Regents of the University of California. |
8ff78169 | 3 | * All rights reserved. |
5efaa119 | 4 | * |
e775ec98 | 5 | * %sccs.include.redist.c% |
8ff78169 | 6 | * |
d2b7358e | 7 | * @(#)netdb.h 5.15 (Berkeley) %G% |
5efaa119 KM |
8 | */ |
9 | ||
d2b7358e KB |
10 | #ifndef _NETDB_H_ |
11 | #define _NETDB_H_ | |
12 | ||
e775ec98 KB |
13 | #define _PATH_HEQUIV "/etc/hosts.equiv" |
14 | #define _PATH_HOSTS "/etc/hosts" | |
15 | #define _PATH_NETWORKS "/etc/networks" | |
16 | #define _PATH_PROTOCOLS "/etc/protocols" | |
17 | #define _PATH_SERVICES "/etc/services" | |
18 | ||
f3ac96de | 19 | /* |
e775ec98 KB |
20 | * Structures returned by network data base library. All addresses are |
21 | * supplied in host order, and returned in network order (suitable for | |
22 | * use in system calls). | |
f3ac96de SL |
23 | */ |
24 | struct hostent { | |
25 | char *h_name; /* official name of host */ | |
26 | char **h_aliases; /* alias list */ | |
27 | int h_addrtype; /* host address type */ | |
28 | int h_length; /* length of address */ | |
56630706 | 29 | char *h_addr; /* address */ |
f3ac96de SL |
30 | }; |
31 | ||
32 | /* | |
33 | * Assumption here is that a network number | |
34 | * fits in 32 bits -- probably a poor one. | |
35 | */ | |
36 | struct netent { | |
37164239 JL |
37 | char *n_name; /* official name of net */ |
38 | char **n_aliases; /* alias list */ | |
39 | int n_addrtype; /* net address type */ | |
40 | unsigned long n_net; /* network # */ | |
f3ac96de SL |
41 | }; |
42 | ||
43 | struct servent { | |
44 | char *s_name; /* official service name */ | |
45 | char **s_aliases; /* alias list */ | |
46 | int s_port; /* port # */ | |
47 | char *s_proto; /* protocol to use */ | |
48 | }; | |
49 | ||
50 | struct protoent { | |
51 | char *p_name; /* official protocol name */ | |
52 | char **p_aliases; /* alias list */ | |
53 | int p_proto; /* protocol # */ | |
54 | }; | |
55 | ||
c0bcfdb1 KD |
56 | /* |
57 | * Error return codes from gethostbyname() and gethostbyaddr() | |
8ff78169 | 58 | * (left in extern int h_errno). |
c0bcfdb1 KD |
59 | */ |
60 | ||
8ff78169 | 61 | #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ |
c0bcfdb1 KD |
62 | #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ |
63 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ | |
8ff78169 MK |
64 | #define NO_DATA 4 /* Valid name, no data record of requested type */ |
65 | #define NO_ADDRESS NO_DATA /* no address, look for MX record */ | |
993000f1 DS |
66 | |
67 | #include <sys/cdefs.h> | |
68 | ||
69 | __BEGIN_DECLS | |
70 | void endhostent __P((void)); | |
71 | void endnetent __P((void)); | |
72 | void endprotoent __P((void)); | |
73 | void endservent __P((void)); | |
313bdacf KB |
74 | struct hostent *gethostbyaddr __P((const char *, int, int)); |
75 | struct hostent *gethostbyname __P((char *)); | |
17deb6e7 | 76 | struct hostent *gethostent __P((void)); |
993000f1 DS |
77 | struct netent *getnetbyaddr __P((long, int)); /* u_long? */ |
78 | struct netent *getnetbyname __P((const char *)); | |
79 | struct netent *getnetent __P((void)); | |
80 | struct protoent *getprotobyname __P((const char *)); | |
81 | struct protoent *getprotobynumber __P((int)); | |
82 | struct protoent *getprotoent __P((void)); | |
83 | struct servent *getservbyname __P((const char *, const char *)); | |
84 | struct servent *getservbyport __P((int, const char *)); | |
85 | struct servent *getservent __P((void)); | |
86 | void herror __P((const char *)); | |
87 | void sethostent __P((int)); | |
88 | /* void sethostfile __P((const char *)); */ | |
89 | void setnetent __P((int)); | |
90 | void setprotoent __P((int)); | |
91 | void setservent __P((int)); | |
92 | __END_DECLS | |
d2b7358e KB |
93 | |
94 | #endif /* !_NETDB_H_ */ |