diff options
Diffstat (limited to 'openbsd-compat/fake-rfc2553.h')
-rw-r--r-- | openbsd-compat/fake-rfc2553.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/openbsd-compat/fake-rfc2553.h b/openbsd-compat/fake-rfc2553.h new file mode 100644 index 000000000..d9952bec8 --- /dev/null +++ b/openbsd-compat/fake-rfc2553.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Pseudo-implementation of RFC2553 name / address resolution functions | ||
3 | * | ||
4 | * But these functions are not implemented correctly. The minimum subset | ||
5 | * is implemented for ssh use only. For exapmle, this routine assumes | ||
6 | * that ai_family is AF_INET. Don't use it for another purpose. | ||
7 | */ | ||
8 | |||
9 | /* $Id: fake-rfc2553.h,v 1.1 2003/06/05 08:52:48 djm Exp $ */ | ||
10 | |||
11 | #ifndef _FAKE_RFC2553_H | ||
12 | #define _FAKE_RFC2553_H | ||
13 | |||
14 | #include "includes.h" | ||
15 | #include "sys/types.h" | ||
16 | |||
17 | /* | ||
18 | * First, socket and INET6 related definitions | ||
19 | */ | ||
20 | #ifndef HAVE_STRUCT_SOCKADDR_STORAGE | ||
21 | # define _SS_MAXSIZE 128 /* Implementation specific max size */ | ||
22 | # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) | ||
23 | struct sockaddr_storage { | ||
24 | struct sockaddr ss_sa; | ||
25 | char __ss_pad2[_SS_PADSIZE]; | ||
26 | }; | ||
27 | # define ss_family ss_sa.sa_family | ||
28 | #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ | ||
29 | |||
30 | #ifndef IN6_IS_ADDR_LOOPBACK | ||
31 | # define IN6_IS_ADDR_LOOPBACK(a) \ | ||
32 | (((u_int32_t *)(a))[0] == 0 && ((u_int32_t *)(a))[1] == 0 && \ | ||
33 | ((u_int32_t *)(a))[2] == 0 && ((u_int32_t *)(a))[3] == htonl(1)) | ||
34 | #endif /* !IN6_IS_ADDR_LOOPBACK */ | ||
35 | |||
36 | #ifndef HAVE_STRUCT_IN6_ADDR | ||
37 | struct in6_addr { | ||
38 | u_int8_t s6_addr[16]; | ||
39 | }; | ||
40 | #endif /* !HAVE_STRUCT_IN6_ADDR */ | ||
41 | |||
42 | #ifndef HAVE_STRUCT_SOCKADDR_IN6 | ||
43 | struct sockaddr_in6 { | ||
44 | unsigned short sin6_family; | ||
45 | u_int16_t sin6_port; | ||
46 | u_int32_t sin6_flowinfo; | ||
47 | struct in6_addr sin6_addr; | ||
48 | }; | ||
49 | #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ | ||
50 | |||
51 | #ifndef AF_INET6 | ||
52 | /* Define it to something that should never appear */ | ||
53 | #define AF_INET6 AF_MAX | ||
54 | #endif | ||
55 | |||
56 | /* | ||
57 | * Next, RFC2553 name / address resolution API | ||
58 | */ | ||
59 | |||
60 | #ifndef NI_NUMERICHOST | ||
61 | # define NI_NUMERICHOST (1) | ||
62 | # define NI_NAMEREQD (1<<1) | ||
63 | # define NI_NUMERICSERV (1<<2) | ||
64 | #endif | ||
65 | #ifndef AI_PASSIVE | ||
66 | # define AI_PASSIVE (1) | ||
67 | # define AI_CANONNAME (1<<1) | ||
68 | # define AI_NUMERICHOST (1<<2) | ||
69 | #endif | ||
70 | |||
71 | #ifndef NI_MAXSERV | ||
72 | # define NI_MAXSERV 32 | ||
73 | #endif /* !NI_MAXSERV */ | ||
74 | #ifndef NI_MAXHOST | ||
75 | # define NI_MAXHOST 1025 | ||
76 | #endif /* !NI_MAXHOST */ | ||
77 | |||
78 | #ifndef EAI_NODATA | ||
79 | # define EAI_NODATA 1 | ||
80 | # define EAI_MEMORY 2 | ||
81 | #endif | ||
82 | |||
83 | #ifndef HAVE_STRUCT_ADDRINFO | ||
84 | struct addrinfo { | ||
85 | int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ | ||
86 | int ai_family; /* PF_xxx */ | ||
87 | int ai_socktype; /* SOCK_xxx */ | ||
88 | int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ | ||
89 | size_t ai_addrlen; /* length of ai_addr */ | ||
90 | char *ai_canonname; /* canonical name for hostname */ | ||
91 | struct sockaddr *ai_addr; /* binary address */ | ||
92 | struct addrinfo *ai_next; /* next structure in linked list */ | ||
93 | }; | ||
94 | #endif /* !HAVE_STRUCT_ADDRINFO */ | ||
95 | |||
96 | #ifndef HAVE_GETADDRINFO | ||
97 | int getaddrinfo(const char *, const char *, | ||
98 | const struct addrinfo *, struct addrinfo **); | ||
99 | #endif /* !HAVE_GETADDRINFO */ | ||
100 | |||
101 | #ifndef HAVE_GAI_STRERROR | ||
102 | char *gai_strerror(int); | ||
103 | #endif /* !HAVE_GAI_STRERROR */ | ||
104 | |||
105 | #ifndef HAVE_FREEADDRINFO | ||
106 | void freeaddrinfo(struct addrinfo *); | ||
107 | #endif /* !HAVE_FREEADDRINFO */ | ||
108 | |||
109 | #ifndef HAVE_GETNAMEINFO | ||
110 | int getnameinfo(const struct sockaddr *, size_t, char *, size_t, | ||
111 | char *, size_t, int); | ||
112 | #endif /* !HAVE_GETNAMEINFO */ | ||
113 | |||
114 | #endif /* !_FAKE_RFC2553_H */ | ||
115 | |||