ext/socket/sockport.h


DEFINITIONS

This source file includes following functions.
  1. SA_LEN
  2. SA_LEN
  3. SA_LEN
  4. SET_SA_LEN
  5. SET_SA_LEN
  6. SIN_LEN
  7. SET_SIN_LEN
  8. SIN_LEN
  9. SET_SIN_LEN
  10. IN_CLASSD
  11. IN_MULTICAST
  12. IN_EXPERIMENTAL


   1  /************************************************
   2  
   3    sockport.h -
   4  
   5    $Author: eban $
   6    $Date: 2000/08/24 06:29:30 $
   7    created at: Fri Apr 30 23:19:34 JST 1999
   8  
   9  ************************************************/
  10  
  11  #ifndef SOCKPORT_H
  12  #define SOCKPORT_H
  13  
  14  #ifndef SA_LEN
  15  # ifdef HAVE_SA_LEN
  16  #  define SA_LEN(sa) (sa)->sa_len
  17  # else
  18  #  ifdef INET6
  19  #   define SA_LEN(sa) \
  20          (((sa)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
  21                                         : sizeof(struct sockaddr))
  22  #  else
  23      /* by tradition, sizeof(struct sockaddr) covers most of the sockaddrs */
  24  #   define SA_LEN(sa)   (sizeof(struct sockaddr))
  25  #  endif
  26  # endif
  27  #endif
  28  
  29  #ifdef HAVE_SA_LEN
  30  # define SET_SA_LEN(sa, len) (sa)->sa_len = (len)
  31  #else
  32  # define SET_SA_LEN(sa, len) (len)
  33  #endif
  34  
  35  #ifdef HAVE_SIN_LEN
  36  # define SIN_LEN(si) (si)->sin_len
  37  # define SET_SIN_LEN(si,len) (si)->sin_len = (len)
  38  #else
  39  # define SIN_LEN(si) sizeof(struct sockaddr_in)
  40  # define SET_SIN_LEN(si,len)
  41  #endif
  42  
  43  #ifndef IN_MULTICAST
  44  # define IN_CLASSD(i)   (((long)(i) & 0xf0000000) == 0xe0000000)
  45  # define IN_MULTICAST(i)        IN_CLASSD(i)
  46  #endif
  47  
  48  #ifndef IN_EXPERIMENTAL
  49  # define IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
  50  #endif
  51  
  52  #ifndef IN_CLASSA_NSHIFT
  53  # define IN_CLASSA_NSHIFT 24
  54  #endif
  55  
  56  #ifndef IN_LOOPBACKNET
  57  # define IN_LOOPBACKNET 127
  58  #endif
  59  
  60  #ifndef AF_UNSPEC
  61  # define AF_UNSPEC 0
  62  #endif
  63  
  64  #ifndef PF_UNSPEC
  65  # define PF_UNSPEC AF_UNSPEC
  66  #endif
  67  
  68  #ifndef PF_INET
  69  # define PF_INET AF_INET
  70  #endif
  71  
  72  #if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
  73  extern int h_errno;
  74  #endif
  75  
  76  #endif