]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/h/netdb.h
Always check that mktemp()/mktemp2() succeeds before trying to
[nmh] / docs / historical / mh-6.8.5 / h / netdb.h
1 /* @(#)$Id: netdb.h,v 2.1 90/04/05 15:06:01 sources Exp $ */
2 /*
3 * Copyright (c) 1980,1983,1988 Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms are permitted
7 * provided that this notice is preserved and that due credit is given
8 * to the University of California at Berkeley. The name of the University
9 * may not be used to endorse or promote products derived from this
10 * software without specific prior written permission. This software
11 * is provided ``as is'' without express or implied warranty.
12 *
13 * @(#)netdb.h 5.9 (Berkeley) 4/5/88
14 */
15
16 /*
17 * Structures returned by network
18 * data base library. All addresses
19 * are supplied in host order, and
20 * returned in network order (suitable
21 * for use in system calls).
22 */
23 struct hostent {
24 char *h_name; /* official name of host */
25 char **h_aliases; /* alias list */
26 int h_addrtype; /* host address type */
27 int h_length; /* length of address */
28 char **h_addr_list; /* list of addresses from name server */
29 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
30 };
31
32 /*
33 * Assumption here is that a network number
34 * fits in 32 bits -- probably a poor one.
35 */
36 struct netent {
37 char *n_name; /* official name of net */
38 char **n_aliases; /* alias list */
39 int n_addrtype; /* net address type */
40 unsigned long n_net; /* network # */
41 };
42
43 struct servent {
44 char *s_name; /* official service name */
45 char **s_aliases; /* alias list */
46 int s_port; /* port # */
47 char *s_proto; /* protocol to use */
48 };
49
50 struct protoent {
51 char *p_name; /* official protocol name */
52 char **p_aliases; /* alias list */
53 int p_proto; /* protocol # */
54 };
55
56 struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent();
57 struct netent *getnetbyname(), *getnetbyaddr(), *getnetent();
58 struct servent *getservbyname(), *getservbyport(), *getservent();
59 struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent();
60
61 /*
62 * Error return codes from gethostbyname() and gethostbyaddr()
63 * (left in extern int h_errno).
64 */
65
66 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
67 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
68 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
69 #define NO_DATA 4 /* Valid name, no data record of requested type */
70 #define NO_ADDRESS NO_DATA /* no address, look for MX record */