document use of null status pointer, distinguish between ptr and value
[unix-history] / usr / src / include / netdb.h
CommitLineData
e775ec98 1/*-
f4f66d2c 2 * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
8ff78169 3 * All rights reserved.
5efaa119 4 *
e775ec98 5 * %sccs.include.redist.c%
8ff78169 6 *
313bdacf 7 * @(#)netdb.h 5.13 (Berkeley) %G%
5efaa119
KM
8 */
9
e775ec98
KB
10#define _PATH_HEQUIV "/etc/hosts.equiv"
11#define _PATH_HOSTS "/etc/hosts"
12#define _PATH_NETWORKS "/etc/networks"
13#define _PATH_PROTOCOLS "/etc/protocols"
14#define _PATH_SERVICES "/etc/services"
15
f3ac96de 16/*
e775ec98
KB
17 * Structures returned by network data base library. All addresses are
18 * supplied in host order, and returned in network order (suitable for
19 * use in system calls).
f3ac96de
SL
20 */
21struct hostent {
22 char *h_name; /* official name of host */
23 char **h_aliases; /* alias list */
24 int h_addrtype; /* host address type */
25 int h_length; /* length of address */
56630706 26 char *h_addr; /* address */
f3ac96de
SL
27};
28
29/*
30 * Assumption here is that a network number
31 * fits in 32 bits -- probably a poor one.
32 */
33struct netent {
37164239
JL
34 char *n_name; /* official name of net */
35 char **n_aliases; /* alias list */
36 int n_addrtype; /* net address type */
37 unsigned long n_net; /* network # */
f3ac96de
SL
38};
39
40struct servent {
41 char *s_name; /* official service name */
42 char **s_aliases; /* alias list */
43 int s_port; /* port # */
44 char *s_proto; /* protocol to use */
45};
46
47struct protoent {
48 char *p_name; /* official protocol name */
49 char **p_aliases; /* alias list */
50 int p_proto; /* protocol # */
51};
52
c0bcfdb1
KD
53/*
54 * Error return codes from gethostbyname() and gethostbyaddr()
8ff78169 55 * (left in extern int h_errno).
c0bcfdb1
KD
56 */
57
8ff78169 58#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
c0bcfdb1
KD
59#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
60#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
8ff78169
MK
61#define NO_DATA 4 /* Valid name, no data record of requested type */
62#define NO_ADDRESS NO_DATA /* no address, look for MX record */
993000f1
DS
63
64#include <sys/cdefs.h>
65
66__BEGIN_DECLS
67void endhostent __P((void));
68void endnetent __P((void));
69void endprotoent __P((void));
70void endservent __P((void));
313bdacf
KB
71struct hostent *gethostbyaddr __P((const char *, int, int));
72struct hostent *gethostbyname __P((char *));
993000f1
DS
73/* struct hostent *gethostent __P((void)); */
74struct netent *getnetbyaddr __P((long, int)); /* u_long? */
75struct netent *getnetbyname __P((const char *));
76struct netent *getnetent __P((void));
77struct protoent *getprotobyname __P((const char *));
78struct protoent *getprotobynumber __P((int));
79struct protoent *getprotoent __P((void));
80struct servent *getservbyname __P((const char *, const char *));
81struct servent *getservbyport __P((int, const char *));
82struct servent *getservent __P((void));
83void herror __P((const char *));
84void sethostent __P((int));
85/* void sethostfile __P((const char *)); */
86void setnetent __P((int));
87void setprotoent __P((int));
88void setservent __P((int));
89__END_DECLS