ANSIfication; bug report 4.3BSD/bin/223
[unix-history] / usr / src / include / netdb.h
CommitLineData
5efaa119 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
f4f66d2c
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
8ff78169 16 *
f4f66d2c 17 * @(#)netdb.h 5.10 (Berkeley) %G%
5efaa119
KM
18 */
19
f3ac96de
SL
20/*
21 * Structures returned by network
22 * data base library. All addresses
23 * are supplied in host order, and
24 * returned in network order (suitable
25 * for use in system calls).
26 */
27struct hostent {
28 char *h_name; /* official name of host */
29 char **h_aliases; /* alias list */
30 int h_addrtype; /* host address type */
31 int h_length; /* length of address */
be3764b5 32 char **h_addr_list; /* list of addresses from name server */
84156e4e 33#define h_addr h_addr_list[0] /* address, for backward compatiblity */
f3ac96de
SL
34};
35
36/*
37 * Assumption here is that a network number
38 * fits in 32 bits -- probably a poor one.
39 */
40struct netent {
37164239
JL
41 char *n_name; /* official name of net */
42 char **n_aliases; /* alias list */
43 int n_addrtype; /* net address type */
44 unsigned long n_net; /* network # */
f3ac96de
SL
45};
46
47struct servent {
48 char *s_name; /* official service name */
49 char **s_aliases; /* alias list */
50 int s_port; /* port # */
51 char *s_proto; /* protocol to use */
52};
53
54struct protoent {
55 char *p_name; /* official protocol name */
56 char **p_aliases; /* alias list */
57 int p_proto; /* protocol # */
58};
59
60struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent();
61struct netent *getnetbyname(), *getnetbyaddr(), *getnetent();
62struct servent *getservbyname(), *getservbyport(), *getservent();
63struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent();
c0bcfdb1
KD
64
65/*
66 * Error return codes from gethostbyname() and gethostbyaddr()
8ff78169 67 * (left in extern int h_errno).
c0bcfdb1
KD
68 */
69
8ff78169 70#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
c0bcfdb1
KD
71#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
72#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
8ff78169
MK
73#define NO_DATA 4 /* Valid name, no data record of requested type */
74#define NO_ADDRESS NO_DATA /* no address, look for MX record */