Commit | Line | Data |
---|---|---|
5efaa119 KM |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
7a68f7c5 | 6 | * @(#)netdb.h 5.8 (Berkeley) %G% |
5efaa119 KM |
7 | */ |
8 | ||
f3ac96de SL |
9 | /* |
10 | * Structures returned by network | |
11 | * data base library. All addresses | |
12 | * are supplied in host order, and | |
13 | * returned in network order (suitable | |
14 | * for use in system calls). | |
15 | */ | |
16 | struct hostent { | |
17 | char *h_name; /* official name of host */ | |
18 | char **h_aliases; /* alias list */ | |
19 | int h_addrtype; /* host address type */ | |
20 | int h_length; /* length of address */ | |
be3764b5 | 21 | char **h_addr_list; /* list of addresses from name server */ |
84156e4e | 22 | #define h_addr h_addr_list[0] /* address, for backward compatiblity */ |
f3ac96de SL |
23 | }; |
24 | ||
25 | /* | |
26 | * Assumption here is that a network number | |
27 | * fits in 32 bits -- probably a poor one. | |
28 | */ | |
29 | struct netent { | |
37164239 JL |
30 | char *n_name; /* official name of net */ |
31 | char **n_aliases; /* alias list */ | |
32 | int n_addrtype; /* net address type */ | |
33 | unsigned long n_net; /* network # */ | |
f3ac96de SL |
34 | }; |
35 | ||
36 | struct servent { | |
37 | char *s_name; /* official service name */ | |
38 | char **s_aliases; /* alias list */ | |
39 | int s_port; /* port # */ | |
40 | char *s_proto; /* protocol to use */ | |
41 | }; | |
42 | ||
43 | struct protoent { | |
44 | char *p_name; /* official protocol name */ | |
45 | char **p_aliases; /* alias list */ | |
46 | int p_proto; /* protocol # */ | |
47 | }; | |
48 | ||
49 | struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); | |
50 | struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); | |
51 | struct servent *getservbyname(), *getservbyport(), *getservent(); | |
52 | struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); | |
c0bcfdb1 KD |
53 | |
54 | /* | |
55 | * Error return codes from gethostbyname() and gethostbyaddr() | |
56 | */ | |
57 | ||
c0bcfdb1 KD |
58 | #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ |
59 | #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ | |
60 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ | |
7a68f7c5 | 61 | #define NO_ADDRESS 4 /* Valid host name, no address, look for MX record */ |