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