blob: b51caa030ccbeea9c3eccf66dfbe765462d8823c [file] [log] [blame]
Damien Miller34132e52000-01-14 15:45:46 +11001#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 Miller2f6a0ad2000-05-31 11:20:11 +10008# define _SS_MAXSIZE 128 /* Implementation specific max size */
Damien Miller52cbcbf2000-09-16 16:21:28 +11009# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
Damien Miller34132e52000-01-14 15:45:46 +110010
11struct sockaddr_storage {
Damien Miller52cbcbf2000-09-16 16:21:28 +110012 struct sockaddr ss_sa;
13 char __ss_pad2[_SS_PADSIZE];
Damien Miller34132e52000-01-14 15:45:46 +110014};
Damien Miller52cbcbf2000-09-16 16:21:28 +110015# define ss_family ss_sa.sa_family
Damien Miller34132e52000-01-14 15:45:46 +110016#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
17
18#ifndef IN6_IS_ADDR_LOOPBACK
Damien Miller2f6a0ad2000-05-31 11:20:11 +100019# define IN6_IS_ADDR_LOOPBACK(a) \
Damien Miller34132e52000-01-14 15:45:46 +110020 (((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
25struct in6_addr {
26 u_int8_t s6_addr[16];
27};
28#endif /* !HAVE_STRUCT_IN6_ADDR */
29
30#ifndef HAVE_STRUCT_SOCKADDR_IN6
31struct 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