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: *
6: * @(#)netdb.h 5.7 (Berkeley) 5/12/86
7: */
8:
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 */
21: char **h_addr_list; /* list of addresses from name server */
22: #define h_addr h_addr_list[0] /* address, for backward compatiblity */
23: };
24:
25: /*
26: * Assumption here is that a network number
27: * fits in 32 bits -- probably a poor one.
28: */
29: struct netent {
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 # */
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();
53:
54: /*
55: * Error return codes from gethostbyname() and gethostbyaddr()
56: */
57:
58: extern int h_errno;
59:
60: #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
61: #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
62: #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
63: #define NO_ADDRESS 4 /* Valid host name, no address, look for MX record */
Defined struct's
Defined macros