Commit | Line | Data |
---|---|---|
1c15e888 | 1 | /*- |
f4f66d2c | 2 | * Copyright (c) 1980, 1983, 1988 Regents of the University of California. |
8ff78169 | 3 | * All rights reserved. |
5efaa119 | 4 | * |
8ff78169 | 5 | * Redistribution and use in source and binary forms are permitted |
1c15e888 C |
6 | * provided that: (1) source distributions retain this entire copyright |
7 | * notice and comment, and (2) distributions including binaries display | |
8 | * the following acknowledgement: ``This product includes software | |
9 | * developed by the University of California, Berkeley and its contributors'' | |
10 | * in the documentation or other materials provided with the distribution | |
11 | * and in all advertising materials mentioning features or use of this | |
12 | * software. Neither the name of the University nor the names of its | |
13 | * contributors may be used to endorse or promote products derived | |
f4f66d2c KB |
14 | * from this software without specific prior written permission. |
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
1c15e888 | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
8ff78169 | 18 | * |
1c15e888 | 19 | * @(#)netdb.h 5.11 (Berkeley) 5/21/90 |
5efaa119 KM |
20 | */ |
21 | ||
1c15e888 C |
22 | #define _PATH_HEQUIV "/etc/hosts.equiv" |
23 | #define _PATH_HOSTS "/etc/hosts" | |
24 | #define _PATH_NETWORKS "/etc/networks" | |
25 | #define _PATH_PROTOCOLS "/etc/protocols" | |
26 | #define _PATH_SERVICES "/etc/services" | |
27 | ||
f3ac96de | 28 | /* |
1c15e888 C |
29 | * Structures returned by network data base library. All addresses are |
30 | * supplied in host order, and returned in network order (suitable for | |
31 | * use in system calls). | |
f3ac96de SL |
32 | */ |
33 | struct hostent { | |
34 | char *h_name; /* official name of host */ | |
35 | char **h_aliases; /* alias list */ | |
36 | int h_addrtype; /* host address type */ | |
37 | int h_length; /* length of address */ | |
be3764b5 | 38 | char **h_addr_list; /* list of addresses from name server */ |
84156e4e | 39 | #define h_addr h_addr_list[0] /* address, for backward compatiblity */ |
f3ac96de SL |
40 | }; |
41 | ||
42 | /* | |
43 | * Assumption here is that a network number | |
44 | * fits in 32 bits -- probably a poor one. | |
45 | */ | |
46 | struct netent { | |
37164239 JL |
47 | char *n_name; /* official name of net */ |
48 | char **n_aliases; /* alias list */ | |
49 | int n_addrtype; /* net address type */ | |
50 | unsigned long n_net; /* network # */ | |
f3ac96de SL |
51 | }; |
52 | ||
53 | struct servent { | |
54 | char *s_name; /* official service name */ | |
55 | char **s_aliases; /* alias list */ | |
56 | int s_port; /* port # */ | |
57 | char *s_proto; /* protocol to use */ | |
58 | }; | |
59 | ||
60 | struct protoent { | |
61 | char *p_name; /* official protocol name */ | |
62 | char **p_aliases; /* alias list */ | |
63 | int p_proto; /* protocol # */ | |
64 | }; | |
65 | ||
66 | struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); | |
67 | struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); | |
68 | struct servent *getservbyname(), *getservbyport(), *getservent(); | |
69 | struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); | |
c0bcfdb1 KD |
70 | |
71 | /* | |
72 | * Error return codes from gethostbyname() and gethostbyaddr() | |
8ff78169 | 73 | * (left in extern int h_errno). |
c0bcfdb1 KD |
74 | */ |
75 | ||
8ff78169 | 76 | #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ |
c0bcfdb1 KD |
77 | #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ |
78 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ | |
8ff78169 MK |
79 | #define NO_DATA 4 /* Valid name, no data record of requested type */ |
80 | #define NO_ADDRESS NO_DATA /* no address, look for MX record */ |