dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libresolv / netdb.h
blob9f9c9cab81ed93d5b81531c851d426310ec8dcb7
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * Portions of this source code were derived from Berkeley 4.3 BSD
32 * under license from the Regents of the University of California.
36 * Structures returned by network data base library.
37 * All addresses are supplied in host order, and
38 * returned in network order (suitable for use in system calls).
41 #ifndef _NETDB_H
42 #define _NETDB_H
44 #pragma ident "%Z%%M% %I% %E% SMI"
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
50 #define _PATH_HEQUIV "/etc/hosts.equiv"
51 #define _PATH_HOSTS "/etc/hosts"
52 #define _PATH_NETWORKS "/etc/networks"
53 #define _PATH_PROTOCOLS "/etc/protocols"
54 #define _PATH_SERVICES "/etc/services"
56 struct hostent {
57 char *h_name; /* official name of host */
58 char **h_aliases; /* alias list */
59 int h_addrtype; /* host address type */
60 int h_length; /* length of address */
61 char **h_addr_list; /* list of addresses from name server */
62 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
66 * Assumption here is that a network number
67 * fits in 32 bits -- probably a poor one.
69 struct netent {
70 char *n_name; /* official name of net */
71 char **n_aliases; /* alias list */
72 int n_addrtype; /* net address type */
73 unsigned long n_net; /* network # */
76 struct servent {
77 char *s_name; /* official service name */
78 char **s_aliases; /* alias list */
79 int s_port; /* port # */
80 char *s_proto; /* protocol to use */
83 struct protoent {
84 char *p_name; /* official protocol name */
85 char **p_aliases; /* alias list */
86 int p_proto; /* protocol # */
89 #ifdef __STDC__
90 struct hostent *gethostbyname_r
91 (const char *, struct hostent *, char *, int, int *h_errnop);
92 struct hostent *gethostbyaddr_r
93 (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
94 struct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop);
96 struct servent *getservbyname_r
97 (const char *name, const char *, struct servent *, char *, int);
98 struct servent *getservbyport_r
99 (int port, const char *, struct servent *, char *, int);
100 struct servent *getservent_r(struct servent *, char *, int);
102 struct netent *getnetbyname_r
103 (const char *, struct netent *, char *, int);
104 struct netent *getnetbyaddr_r(long, int, struct netent *, char *, int);
105 struct netent *getnetent_r(struct netent *, char *, int);
107 struct protoent *getprotobyname_r
108 (const char *, struct protoent *, char *, int);
109 struct protoent *getprotobynumber_r
110 (int, struct protoent *, char *, int);
111 struct protoent *getprotoent_r(struct protoent *, char *, int);
113 int getnetgrent_r(char **, char **, char **, char *, int);
114 int innetgr(const char *, const char *, const char *, const char *);
116 /* Old interfaces that return a pointer to a static area; MT-unsafe */
117 struct hostent *gethostbyname(const char *);
118 struct hostent *gethostbyaddr(const char *, int, int);
119 struct hostent *gethostent(void);
120 struct netent *getnetbyname(const char *);
121 struct netent *getnetbyaddr(long, int);
122 struct netent *getnetent(void);
123 struct servent *getservbyname(const char *, const char *);
124 struct servent *getservbyport(int, const char *);
125 struct servent *getservent(void);
126 struct protoent *getprotobyname(const char *);
127 struct protoent *getprotobynumber(int);
128 struct protoent *getprotoent(void);
129 int getnetgrent(char **, char **, char **);
131 int sethostent(int);
132 int endhostent(void);
133 int setnetent(int);
134 int endnetent(void);
135 int setservent(int);
136 int endservent(void);
137 int setprotoent(int);
138 int endprotoent(void);
139 int setnetgrent(const char *);
140 int endnetgrent(void);
141 #else
142 struct hostent *gethostbyname_r();
143 struct hostent *gethostbyaddr_r();
144 struct hostent *gethostent_r();
145 struct servent *getservbyname_r();
146 struct servent *getservbyport_r();
147 struct servent *getservent_r();
148 struct netent *getnetbyname_r();
149 struct netent *getnetbyaddr_r();
150 struct netent *getnetent_r();
151 struct protoent *getprotobyname_r();
152 struct protoent *getprotobynumber_r();
153 struct protoent *getprotoent_r();
154 int getnetgrent_r();
155 int innetgr();
157 /* Old interfaces that return a pointer to a static area; MT-unsafe */
158 struct hostent *gethostbyname();
159 struct hostent *gethostbyaddr();
160 struct hostent *gethostent();
161 struct netent *getnetbyname();
162 struct netent *getnetbyaddr();
163 struct netent *getnetent();
164 struct servent *getservbyname();
165 struct servent *getservbyport();
166 struct servent *getservent();
167 struct protoent *getprotobyname();
168 struct protoent *getprotobynumber();
169 struct protoent *getprotoent();
170 int getnetgrent();
172 int sethostent();
173 int endhostent();
174 int setnetent();
175 int endnetent();
176 int setservent();
177 int endservent();
178 int setprotoent();
179 int endprotoent();
180 int setnetgrent();
181 int endnetgrent();
182 #endif
185 * Error return codes from gethostbyname() and gethostbyaddr()
186 * (when using the resolver)
189 extern int h_errno;
191 #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
192 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
193 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
194 #define NO_DATA 4 /* Valid name, no data record of requested type */
195 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
197 #define MAXHOSTNAMELEN 256
199 #define MAXALIASES 35
200 #define MAXADDRS 35
202 #ifdef __cplusplus
204 #endif
206 #endif /* _NETDB_H */