Add "device uether" to various manual pages' synopses.
[dragonfly.git] / contrib / ldns / compat / fake-rfc2553.h
blob4c277ee902db47267d72e90c258d5b764ac6c68b
1 /* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */
2 /*
3 * Copyright (C) 2000-2003 Damien Miller. All rights reserved.
4 * Copyright (C) 1999 WIDE Project. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the project nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
32 * Pseudo-implementation of RFC2553 name / address resolution functions
34 * But these functions are not implemented correctly. The minimum subset
35 * is implemented for ssh use only. For example, this routine assumes
36 * that ai_family is AF_INET. Don't use it for another purpose.
39 #ifndef _FAKE_RFC2553_H
40 #define _FAKE_RFC2553_H
42 #include <sys/types.h>
43 #include <sys/socket.h>
44 #include <netdb.h>
45 #include <limits.h>
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
52 * First, socket and INET6 related definitions
54 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
55 #ifndef _SS_MAXSIZE
56 # define _SS_MAXSIZE 128 /* Implementation specific max size */
57 # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
58 struct sockaddr_storage {
59 struct sockaddr ss_sa;
60 char __ss_pad2[_SS_PADSIZE];
62 # define ss_family ss_sa.sa_family
63 #endif /* _SS_MAXSIZE */
64 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
66 #ifndef IN6_IS_ADDR_LOOPBACK
67 # define IN6_IS_ADDR_LOOPBACK(a) \
68 (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \
69 ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1))
70 #endif /* !IN6_IS_ADDR_LOOPBACK */
72 #ifndef HAVE_STRUCT_IN6_ADDR
73 struct in6_addr {
74 uint8_t s6_addr[16];
76 #endif /* !HAVE_STRUCT_IN6_ADDR */
78 #ifndef HAVE_STRUCT_SOCKADDR_IN6
79 struct sockaddr_in6 {
80 unsigned short sin6_family;
81 uint16_t sin6_port;
82 uint32_t sin6_flowinfo;
83 struct in6_addr sin6_addr;
85 #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
87 #ifndef AF_INET6
88 /* Define it to something that should never appear */
89 #define AF_INET6 AF_MAX
90 #endif
93 * Next, RFC2553 name / address resolution API
96 #ifndef NI_NUMERICHOST
97 # define NI_NUMERICHOST (1)
98 #endif
99 #ifndef NI_NAMEREQD
100 # define NI_NAMEREQD (1<<1)
101 #endif
102 #ifndef NI_NUMERICSERV
103 # define NI_NUMERICSERV (1<<2)
104 #endif
106 #ifndef AI_PASSIVE
107 # define AI_PASSIVE (1)
108 #endif
109 #ifndef AI_CANONNAME
110 # define AI_CANONNAME (1<<1)
111 #endif
112 #ifndef AI_NUMERICHOST
113 # define AI_NUMERICHOST (1<<2)
114 #endif
116 #ifndef NI_MAXSERV
117 # define NI_MAXSERV 32
118 #endif /* !NI_MAXSERV */
119 #ifndef NI_MAXHOST
120 # define NI_MAXHOST 1025
121 #endif /* !NI_MAXHOST */
123 #ifndef INT_MAX
124 #define INT_MAX 0xffffffff
125 #endif
127 #ifndef EAI_NODATA
128 # define EAI_NODATA (INT_MAX - 1)
129 #endif
130 #ifndef EAI_MEMORY
131 # define EAI_MEMORY (INT_MAX - 2)
132 #endif
133 #ifndef EAI_NONAME
134 # define EAI_NONAME (INT_MAX - 3)
135 #endif
136 #ifndef EAI_SYSTEM
137 # define EAI_SYSTEM (INT_MAX - 4)
138 #endif
140 #ifndef HAVE_STRUCT_ADDRINFO
141 struct addrinfo {
142 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
143 int ai_family; /* PF_xxx */
144 int ai_socktype; /* SOCK_xxx */
145 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
146 size_t ai_addrlen; /* length of ai_addr */
147 char *ai_canonname; /* canonical name for hostname */
148 struct sockaddr *ai_addr; /* binary address */
149 struct addrinfo *ai_next; /* next structure in linked list */
151 #endif /* !HAVE_STRUCT_ADDRINFO */
153 #ifndef HAVE_GETADDRINFO
154 #ifdef getaddrinfo
155 # undef getaddrinfo
156 #endif
157 #define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d))
158 int getaddrinfo(const char *, const char *,
159 const struct addrinfo *, struct addrinfo **);
160 #endif /* !HAVE_GETADDRINFO */
162 #if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO)
163 #define gai_strerror(a) (ssh_gai_strerror(a))
164 char *gai_strerror(int);
165 #endif /* !HAVE_GAI_STRERROR */
167 #ifndef HAVE_FREEADDRINFO
168 #define freeaddrinfo(a) (ssh_freeaddrinfo(a))
169 void freeaddrinfo(struct addrinfo *);
170 #endif /* !HAVE_FREEADDRINFO */
172 #ifndef HAVE_GETNAMEINFO
173 #define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g))
174 int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
175 char *, size_t, int);
176 #endif /* !HAVE_GETNAMEINFO */
178 #ifdef __cplusplus
180 #endif
182 #endif /* !_FAKE_RFC2553_H */