Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 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 |
Damien Miller | 2f6a0ad | 2000-05-31 11:20:11 +1000 | [diff] [blame] | 8 | # define _SS_MAXSIZE 128 /* Implementation specific max size */ |
Damien Miller | 52cbcbf | 2000-09-16 16:21:28 +1100 | [diff] [blame] | 9 | # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 10 | |
| 11 | struct sockaddr_storage { |
Damien Miller | 52cbcbf | 2000-09-16 16:21:28 +1100 | [diff] [blame] | 12 | struct sockaddr ss_sa; |
| 13 | char __ss_pad2[_SS_PADSIZE]; |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 14 | }; |
Damien Miller | 52cbcbf | 2000-09-16 16:21:28 +1100 | [diff] [blame] | 15 | # define ss_family ss_sa.sa_family |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 16 | #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ |
| 17 | |
| 18 | #ifndef IN6_IS_ADDR_LOOPBACK |
Damien Miller | 2f6a0ad | 2000-05-31 11:20:11 +1000 | [diff] [blame] | 19 | # define IN6_IS_ADDR_LOOPBACK(a) \ |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 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 | |