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