|
|
1.1 root 1: /*-
2: * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
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
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
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)netdb.h 5.11 (Berkeley) 5/21/90
20: */
21:
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:
28: /*
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).
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 */
38: char **h_addr_list; /* list of addresses from name server */
39: #define h_addr h_addr_list[0] /* address, for backward compatiblity */
40: };
41:
42: /*
43: * Assumption here is that a network number
44: * fits in 32 bits -- probably a poor one.
45: */
46: struct netent {
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 # */
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();
70:
71: /*
72: * Error return codes from gethostbyname() and gethostbyaddr()
73: * (left in extern int h_errno).
74: */
75:
76: #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
77: #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
78: #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
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 */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.