diff options
Diffstat (limited to 'openbsd-compat/fake-socket.h')
-rw-r--r-- | openbsd-compat/fake-socket.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/openbsd-compat/fake-socket.h b/openbsd-compat/fake-socket.h new file mode 100644 index 000000000..b51caa030 --- /dev/null +++ b/openbsd-compat/fake-socket.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _FAKE_SOCKET_H | ||
2 | #define _FAKE_SOCKET_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #include "sys/types.h" | ||
6 | |||
7 | #ifndef HAVE_STRUCT_SOCKADDR_STORAGE | ||
8 | # define _SS_MAXSIZE 128 /* Implementation specific max size */ | ||
9 | # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) | ||
10 | |||
11 | struct sockaddr_storage { | ||
12 | struct sockaddr ss_sa; | ||
13 | char __ss_pad2[_SS_PADSIZE]; | ||
14 | }; | ||
15 | # define ss_family ss_sa.sa_family | ||
16 | #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ | ||
17 | |||
18 | #ifndef IN6_IS_ADDR_LOOPBACK | ||
19 | # define IN6_IS_ADDR_LOOPBACK(a) \ | ||
20 | (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ | ||
21 | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) | ||
22 | #endif /* !IN6_IS_ADDR_LOOPBACK */ | ||
23 | |||
24 | #ifndef HAVE_STRUCT_IN6_ADDR | ||
25 | struct in6_addr { | ||
26 | u_int8_t s6_addr[16]; | ||
27 | }; | ||
28 | #endif /* !HAVE_STRUCT_IN6_ADDR */ | ||
29 | |||
30 | #ifndef HAVE_STRUCT_SOCKADDR_IN6 | ||
31 | struct sockaddr_in6 { | ||
32 | unsigned short sin6_family; | ||
33 | u_int16_t sin6_port; | ||
34 | u_int32_t sin6_flowinfo; | ||
35 | struct in6_addr sin6_addr; | ||
36 | }; | ||
37 | #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ | ||
38 | |||
39 | #ifndef AF_INET6 | ||
40 | /* Define it to something that should never appear */ | ||
41 | #define AF_INET6 AF_MAX | ||
42 | #endif | ||
43 | |||
44 | #endif /* !_FAKE_SOCKET_H */ | ||
45 | |||