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