1 /* $Id: fake-socket.h,v 1.3 2002/04/12 03:35:40 tim Exp $ */
   2 
   3 #ifndef _FAKE_SOCKET_H
   4 #define _FAKE_SOCKET_H
   5 
   6 #pragma ident   "%Z%%M% %I%     %E% SMI"
   7 
   8 #ifdef __cplusplus
   9 extern "C" {
  10 #endif
  11 
  12 #include "includes.h"
  13 #include "sys/types.h"
  14 
  15 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
  16 # define        _SS_MAXSIZE     128     /* Implementation specific max size */
  17 # define       _SS_PADSIZE     (_SS_MAXSIZE - sizeof (struct sockaddr))
  18 
  19 struct sockaddr_storage {
  20         struct  sockaddr ss_sa;
  21         char            __ss_pad2[_SS_PADSIZE];
  22 };
  23 # define ss_family ss_sa.sa_family
  24 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
  25 
  26 #ifndef IN6_IS_ADDR_LOOPBACK
  27 # define IN6_IS_ADDR_LOOPBACK(a) \
  28         (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
  29          ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
  30 #endif /* !IN6_IS_ADDR_LOOPBACK */
  31 
  32 #ifndef HAVE_STRUCT_IN6_ADDR
  33 struct in6_addr {
  34         u_int8_t                s6_addr[16];
  35 };
  36 #endif /* !HAVE_STRUCT_IN6_ADDR */
  37 
  38 #ifndef HAVE_STRUCT_SOCKADDR_IN6
  39 struct sockaddr_in6 {
  40    unsigned short sin6_family;
  41         u_int16_t sin6_port;
  42         u_int32_t sin6_flowinfo;
  43         struct in6_addr sin6_addr;
  44 };
  45 #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
  46 
  47 #ifndef AF_INET6
  48 /* Define it to something that should never appear */
  49 #define AF_INET6 AF_MAX
  50 #endif
  51 
  52 #ifdef __cplusplus
  53 }
  54 #endif
  55 
  56 #endif /* _FAKE_SOCKET_H */