add GLOB_ALTDIRFUNC to have glob use alternate directory access functions
[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 *
cb92eb7e 7 * @(#)netdb.h 5.16 (Berkeley) %G%
5efaa119
KM
8 */
9
d2b7358e
KB
10#ifndef _NETDB_H_
11#define _NETDB_H_
12
e775ec98
KB
13#define _PATH_HEQUIV "/etc/hosts.equiv"
14#define _PATH_HOSTS "/etc/hosts"
15#define _PATH_NETWORKS "/etc/networks"
16#define _PATH_PROTOCOLS "/etc/protocols"
17#define _PATH_SERVICES "/etc/services"
18
f3ac96de 19/*
e775ec98
KB
20 * Structures returned by network data base library. All addresses are
21 * supplied in host order, and returned in network order (suitable for
22 * use in system calls).
f3ac96de
SL
23 */
24struct hostent {
25 char *h_name; /* official name of host */
26 char **h_aliases; /* alias list */
27 int h_addrtype; /* host address type */
28 int h_length; /* length of address */
56630706 29 char *h_addr; /* address */
f3ac96de
SL
30};
31
32/*
33 * Assumption here is that a network number
34 * fits in 32 bits -- probably a poor one.
35 */
36struct netent {
37164239
JL
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 # */
f3ac96de
SL
41};
42
43struct 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
50struct protoent {
51 char *p_name; /* official protocol name */
52 char **p_aliases; /* alias list */
53 int p_proto; /* protocol # */
54};
55
c0bcfdb1
KD
56/*
57 * Error return codes from gethostbyname() and gethostbyaddr()
8ff78169 58 * (left in extern int h_errno).
c0bcfdb1
KD
59 */
60
8ff78169 61#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
c0bcfdb1
KD
62#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
63#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
8ff78169
MK
64#define NO_DATA 4 /* Valid name, no data record of requested type */
65#define NO_ADDRESS NO_DATA /* no address, look for MX record */
993000f1
DS
66
67#include <sys/cdefs.h>
68
69__BEGIN_DECLS
70void endhostent __P((void));
71void endnetent __P((void));
72void endprotoent __P((void));
73void endservent __P((void));
313bdacf 74struct hostent *gethostbyaddr __P((const char *, int, int));
cb92eb7e 75struct hostent *gethostbyname __P((const char *));
17deb6e7 76struct hostent *gethostent __P((void));
993000f1
DS
77struct netent *getnetbyaddr __P((long, int)); /* u_long? */
78struct netent *getnetbyname __P((const char *));
79struct netent *getnetent __P((void));
80struct protoent *getprotobyname __P((const char *));
81struct protoent *getprotobynumber __P((int));
82struct protoent *getprotoent __P((void));
83struct servent *getservbyname __P((const char *, const char *));
84struct servent *getservbyport __P((int, const char *));
85struct servent *getservent __P((void));
86void herror __P((const char *));
87void sethostent __P((int));
88/* void sethostfile __P((const char *)); */
89void setnetent __P((int));
90void setprotoent __P((int));
91void setservent __P((int));
92__END_DECLS
d2b7358e
KB
93
94#endif /* !_NETDB_H_ */