blob: bfc9d1523c77ff6f3da3494b284195b59d37d15b [file] [log] [blame]
Damien Millere9cf3572001-02-09 12:55:35 +11001/* $Id: fake-socket.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */
2
Damien Miller34132e52000-01-14 15:45:46 +11003#ifndef _FAKE_SOCKET_H
4#define _FAKE_SOCKET_H
5
6#include "config.h"
7#include "sys/types.h"
8
9#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
Damien Miller2f6a0ad2000-05-31 11:20:11 +100010# define _SS_MAXSIZE 128 /* Implementation specific max size */
Damien Miller52cbcbf2000-09-16 16:21:28 +110011# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
Damien Miller34132e52000-01-14 15:45:46 +110012
13struct sockaddr_storage {
Damien Miller52cbcbf2000-09-16 16:21:28 +110014 struct sockaddr ss_sa;
15 char __ss_pad2[_SS_PADSIZE];
Damien Miller34132e52000-01-14 15:45:46 +110016};
Damien Miller52cbcbf2000-09-16 16:21:28 +110017# define ss_family ss_sa.sa_family
Damien Miller34132e52000-01-14 15:45:46 +110018#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
19
20#ifndef IN6_IS_ADDR_LOOPBACK
Damien Miller2f6a0ad2000-05-31 11:20:11 +100021# define IN6_IS_ADDR_LOOPBACK(a) \
Damien Miller34132e52000-01-14 15:45:46 +110022 (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
23 ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
24#endif /* !IN6_IS_ADDR_LOOPBACK */
25
26#ifndef HAVE_STRUCT_IN6_ADDR
27struct in6_addr {
28 u_int8_t s6_addr[16];
29};
30#endif /* !HAVE_STRUCT_IN6_ADDR */
31
32#ifndef HAVE_STRUCT_SOCKADDR_IN6
33struct sockaddr_in6 {
34 unsigned short sin6_family;
35 u_int16_t sin6_port;
36 u_int32_t sin6_flowinfo;
37 struct in6_addr sin6_addr;
38};
39#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
40
41#ifndef AF_INET6
42/* Define it to something that should never appear */
43#define AF_INET6 AF_MAX
44#endif
45
46#endif /* !_FAKE_SOCKET_H */
47