opensolaris_10_netdb.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/*
10 * Copied from OpenSolaris 10 public sources
11 * http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/head/netdb.h
12 */
13/*
14 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
15 * Use is subject to license terms.
16 */
17
18/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
19/* All Rights Reserved */
20
21/*
22 * BIND 4.9.3:
23 *
24 * Copyright (c) 1980, 1983, 1988, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 * -
55 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
56 *
57 * Permission to use, copy, modify, and distribute this software for any
58 * purpose with or without fee is hereby granted, provided that the above
59 * copyright notice and this permission notice appear in all copies, and that
60 * the name of Digital Equipment Corporation not be used in advertising or
61 * publicity pertaining to distribution of the document or software without
62 * specific, written prior permission.
63 *
64 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
65 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
66 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
67 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
68 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
69 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
70 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
71 * SOFTWARE.
72 * --Copyright--
73 *
74 * End BIND 4.9.3
75 */
76
77/*
78 * Structures returned by network data base library.
79 * All addresses are supplied in host order, and
80 * returned in network order (suitable for use in system calls).
81 */
82
83#ifndef _NETDB_H
84#define _NETDB_H
85
86#include <sys/types.h>
87#include <netinet/in.h>
88#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
89#include <sys/socket.h>
90#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
91#include <sys/feature_tests.h>
92
93#ifdef __cplusplus
94extern "C" {
95#endif
96
97#define _PATH_HEQUIV "/etc/hosts.equiv"
98#define _PATH_HOSTS "/etc/hosts"
99#define _PATH_IPNODES "/etc/inet/ipnodes"
100#define _PATH_IPSECALGS "/etc/inet/ipsecalgs"
101#define _PATH_NETMASKS "/etc/netmasks"
102#define _PATH_NETWORKS "/etc/networks"
103#define _PATH_PROTOCOLS "/etc/protocols"
104#define _PATH_SERVICES "/etc/services"
105
106struct hostent {
107 char *h_name; /* official name of host */
108 char **h_aliases; /* alias list */
109 int h_addrtype; /* host address type */
110 int h_length; /* length of address */
111 char **h_addr_list; /* list of addresses from name server */
112#define h_addr h_addr_list[0] /* address, for backward compatibility */
113};
114
115/*
116 * addrinfo introduced with IPv6 for Protocol-Independent Hostname
117 * and Service Name Translation.
118 */
119
120#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
121struct addrinfo {
122 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, ... */
123 int ai_family; /* PF_xxx */
124 int ai_socktype; /* SOCK_xxx */
125 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
126#ifdef __sparcv9
127 int _ai_pad; /* for backwards compat with old size_t */
128#endif /* __sparcv9 */
130 char *ai_canonname; /* canonical name for hostname */
131 struct sockaddr *ai_addr; /* binary address */
132 struct addrinfo *ai_next; /* next structure in linked list */
133};
134
135/* addrinfo flags */
136#define AI_PASSIVE 0x0008 /* intended for bind() + listen() */
137#define AI_CANONNAME 0x0010 /* return canonical version of host */
138#define AI_NUMERICHOST 0x0020 /* use numeric node address string */
139#define AI_NUMERICSERV 0x0040 /* servname is assumed numeric */
140
141/* getipnodebyname() flags */
142#define AI_V4MAPPED 0x0001 /* IPv4 mapped addresses if no IPv6 */
143#define AI_ALL 0x0002 /* IPv6 and IPv4 mapped addresses */
144#define AI_ADDRCONFIG 0x0004 /* AAAA or A records only if IPv6/IPv4 cnfg'd */
145
146/*
147 * These were defined in RFC 2553 but not SUSv3
148 * or RFC 3493 which obsoleted 2553.
149 */
150#if !defined(_XPG6) || defined(__EXTENSIONS__)
151#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
152
153/* addrinfo errors */
154#define EAI_ADDRFAMILY 1 /* address family not supported */
155#define EAI_NODATA 7 /* no address */
156#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
157#define EAI_AGAIN 2 /* DNS temporary failure */
158#define EAI_BADFLAGS 3 /* invalid ai_flags */
159#define EAI_FAIL 4 /* DNS non-recoverable failure */
160#define EAI_FAMILY 5 /* ai_family not supported */
161#define EAI_MEMORY 6 /* memory allocation failure */
162#define EAI_NONAME 8 /* host/servname not known */
163#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
164#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
165#define EAI_SYSTEM 11 /* system error in errno */
166#define EAI_OVERFLOW 12 /* argument buffer overflow */
167#define EAI_PROTOCOL 13
168#define EAI_MAX 14
169
170/* getnameinfo flags */
171#define NI_NOFQDN 0x0001
172#define NI_NUMERICHOST 0x0002 /* return numeric form of address */
173#define NI_NAMEREQD 0x0004 /* request DNS name */
174#define NI_NUMERICSERV 0x0008
175#define NI_DGRAM 0x0010
176
177#if !defined(_XPG6) || defined(__EXTENSIONS__)
178/* Not listed in any standards document */
179#define NI_WITHSCOPEID 0x0020
180#define NI_NUMERICSCOPE 0x0040
181
182/* getnameinfo max sizes as defined in RFC 2553 obsoleted in RFC 3493 */
183#define NI_MAXHOST 1025
184#define NI_MAXSERV 32
185#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
186#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
187
188/*
189 * Scope delimit character
190 */
191#define SCOPE_DELIMITER '%'
192
193/*
194 * Algorithm entry for /etc/inet/ipsecalgs which defines IPsec protocols
195 * and algorithms.
196 */
197#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
198typedef struct ipsecalgent {
199 char **a_names; /* algorithm names */
200 int a_proto_num; /* protocol number */
201 int a_alg_num; /* algorithm number */
202 char *a_mech_name; /* encryption framework mechanism name */
203 int *a_block_sizes; /* supported block sizes */
204 int *a_key_sizes; /* supported key sizes */
205 int a_key_increment; /* key size increment */
206 int *a_mech_params; /* mechanism specific parameters */
207 int a_alg_flags; /* algorithm flags */
209
210/* well-known IPsec protocol numbers */
211
212#define IPSEC_PROTO_AH 2
213#define IPSEC_PROTO_ESP 3
214#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
215
216/*
217 * Assumption here is that a network number
218 * fits in 32 bits -- probably a poor one.
219 */
220struct netent {
221 char *n_name; /* official name of net */
222 char **n_aliases; /* alias list */
223 int n_addrtype; /* net address type */
224 in_addr_t n_net; /* network # */
225};
226
227struct protoent {
228 char *p_name; /* official protocol name */
229 char **p_aliases; /* alias list */
230 int p_proto; /* protocol # */
231};
232
233struct servent {
234 char *s_name; /* official service name */
235 char **s_aliases; /* alias list */
236 int s_port; /* port # */
237 char *s_proto; /* protocol to use */
238};
239
240#ifdef __STDC__
241#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
243(const char *, struct hostent *, char *, int, int *h_errnop);
245(const char *, int, int, struct hostent *, char *, int, int *h_errnop);
246struct hostent *getipnodebyname(const char *, int, int, int *);
247struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
248void freehostent(struct hostent *);
249struct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop);
250
252(const char *name, const char *, struct servent *, char *, int);
254(int port, const char *, struct servent *, char *, int);
255struct servent *getservent_r(struct servent *, char *, int);
256
258(const char *, struct netent *, char *, int);
259struct netent *getnetbyaddr_r(long, int, struct netent *, char *, int);
260struct netent *getnetent_r(struct netent *, char *, int);
261
263(const char *, struct protoent *, char *, int);
265(int, struct protoent *, char *, int);
266struct protoent *getprotoent_r(struct protoent *, char *, int);
267
268int getnetgrent_r(char **, char **, char **, char *, int);
269int innetgr(const char *, const char *, const char *, const char *);
270#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
271
272/* Old interfaces that return a pointer to a static area; MT-unsafe */
273struct hostent *gethostbyname(const char *);
274struct hostent *gethostent(void);
275struct netent *getnetbyaddr(in_addr_t, int);
276struct netent *getnetbyname(const char *);
277struct netent *getnetent(void);
278struct protoent *getprotobyname(const char *);
279struct protoent *getprotobynumber(int);
280struct protoent *getprotoent(void);
281struct servent *getservbyname(const char *, const char *);
282struct servent *getservbyport(int, const char *);
283struct servent *getservent(void);
284
285/* gethostbyaddr() second argument is a size_t only in unix95/unix98 */
286#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
287struct hostent *gethostbyaddr(const void *, socklen_t, int);
288#else
289struct hostent *gethostbyaddr(const void *, size_t, int);
290#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
291
292#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
293int endhostent(void);
294int endnetent(void);
295int endprotoent(void);
296int endservent(void);
297int sethostent(int);
298int setnetent(int);
299int setprotoent(int);
300int setservent(int);
301#else
302void endhostent(void);
303void endnetent(void);
304void endprotoent(void);
305void endservent(void);
306void sethostent(int);
307void setnetent(int);
308void setprotoent(int);
309void setservent(int);
310#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
311
312#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
313
314#ifdef _XPG6
315#ifdef __PRAGMA_REDEFINE_EXTNAME
316#pragma redefine_extname getaddrinfo __xnet_getaddrinfo
317#else /* __PRAGMA_REDEFINE_EXTNAME */
318#define getaddrinfo __xnet_getaddrinfo
319#endif /* __PRAGMA_REDEFINE_EXTNAME */
320#endif /* _XPG6 */
321
322int getaddrinfo(const char *_RESTRICT_KYWD1,
323 const char *_RESTRICT_KYWD2,
324 const struct addrinfo *_RESTRICT_KYWD3,
325 struct addrinfo **_RESTRICT_KYWD4);
326void freeaddrinfo(struct addrinfo *);
327const char *gai_strerror(int);
328int getnameinfo(const struct sockaddr *_RESTRICT_KYWD1,
329 socklen_t, char *_RESTRICT_KYWD2, socklen_t,
330 char *_RESTRICT_KYWD3, socklen_t, int);
331#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
332
333#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
334int getnetgrent(char **, char **, char **);
335int setnetgrent(const char *);
336int endnetgrent(void);
337int rcmd(char **, unsigned short,
338 const char *, const char *, const char *, int *);
339int rcmd_af(char **, unsigned short,
340 const char *, const char *, const char *, int *, int);
341int rresvport_af(int *, int);
342int rresvport_addr(int *, struct sockaddr_storage *);
343int rexec(char **, unsigned short,
344 const char *, const char *, const char *, int *);
345int rexec_af(char **, unsigned short,
346 const char *, const char *, const char *, int *, int);
347int rresvport(int *);
348int ruserok(const char *, int, const char *, const char *);
349/* BIND */
350struct hostent *gethostbyname2(const char *, int);
351void herror(const char *);
352const char *hstrerror(int);
353/* End BIND */
354
355/* IPsec algorithm prototype definitions */
356struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
357struct ipsecalgent *getipsecalgbynum(int, int, int *);
358int getipsecprotobyname(const char *doi_name);
359char *getipsecprotobynum(int doi_domain);
360void freeipsecalgent(struct ipsecalgent *ptr);
361/* END IPsec algorithm prototype definitions */
362
363#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
364#else /* __STDC__ */
382
383/* Old interfaces that return a pointer to a static area; MT-unsafe */
397
408int rcmd();
410int rexec();
416/* BIND */
418void herror();
419char *hstrerror();
420/* IPv6 prototype definitions */
423const char *gai_strerror();
425/* END IPv6 prototype definitions */
426/* End BIND */
427
428#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
429/* IPsec algorithm prototype definitions */
433const char *getdoidomainbynum();
435/* END IPsec algorithm prototype definitions */
436#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
437
438#endif /* __STDC__ */
439
440/*
441 * Error return codes from gethostbyname() and gethostbyaddr()
442 * (when using the resolver)
443 */
444
445extern int h_errno;
446
447#ifdef _REENTRANT
448#ifdef __STDC__
449extern int *__h_errno(void);
450#else
451extern int *__h_errno();
452#endif /* __STDC__ */
453
454/* Only #define h_errno if there is no conflict with other use */
455#ifdef H_ERRNO_IS_FUNCTION
456#define h_errno (*__h_errno())
457#endif /* NO_H_ERRNO_DEFINE */
458#endif /* _REENTRANT */
459
460/*
461 * Error return codes from gethostbyname() and gethostbyaddr()
462 * (left in extern int h_errno).
463 */
464#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
465#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
466#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
467#define NO_DATA 4 /* Valid name, no data record of requested type */
468
469#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
470#define NO_ADDRESS NO_DATA /* no address, look for MX record */
471
472/* BIND */
473#define NETDB_INTERNAL -1 /* see errno */
474#define NETDB_SUCCESS 0 /* no problem */
475/* End BIND */
476
477#define MAXHOSTNAMELEN 256
478
479#define MAXALIASES 35
480#define MAXADDRS 35
481#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
482
483#ifdef __cplusplus
484}
485#endif
486
487#endif /* _NETDB_H */
488
static int port
Definition: ldap_backend.cc:70
int endnetgrent()
struct netent * getnetbyaddr()
struct servent * getservbyport_r()
struct protoent * getprotobynumber()
struct hostent * getipnodebyaddr()
void freeaddrinfo()
int h_errno
struct protoent * getprotoent()
struct netent * getnetent()
void herror()
struct netent * getnetbyaddr_r()
int rresvport_addr()
struct netent * getnetent_r()
const char * gai_strerror()
int setnetgrent()
int getaddrinfo()
int rresvport()
struct ipsecalgent ipsecalgent_t
int endprotoent()
int getnameinfo()
int setnetent()
struct protoent * getprotobynumber_r()
const char * getdoidomainbynum()
int rcmd_af()
struct hostent * gethostbyname2()
int innetgr()
struct hostent * getipnodebyname()
struct hostent * gethostbyaddr()
int getdoidomainbyname()
int getnetgrent_r()
struct ipsecalgent * getalgbyname()
int setprotoent()
int rcmd()
struct servent * getservbyname()
int ruserok()
struct protoent * getprotoent_r()
int rexec_af()
int rexec()
void freehostent()
struct hostent * gethostbyaddr_r()
int setservent()
struct hostent * gethostent_r()
struct servent * getservent_r()
struct servent * getservbyname_r()
int rresvport_af()
int endservent()
struct netent * getnetbyname()
struct hostent * gethostent()
struct netent * getnetbyname_r()
struct ipsecalgent * getalgbydoi()
int sethostent()
int getnetgrent()
int endhostent()
struct protoent * getprotobyname()
struct hostent * gethostbyname()
struct hostent * gethostbyname_r()
struct protoent * getprotobyname_r()
void freealgent()
int endnetent()
struct servent * getservbyport()
char * hstrerror()
struct servent * getservent()
struct sockaddr * ai_addr
socklen_t ai_addrlen
struct addrinfo * ai_next
char ** h_addr_list
char ** n_aliases
in_addr_t n_net
int socklen_t
Definition: types.h:158

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors