Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# ext/socket/sockport.h

Go to the documentation of this file.

    00001 /************************************************
    00002
    00003   sockport.h -
    00004
    00005   $Author: akr $
    00006   created at: Fri Apr 30 23:19:34 JST 1999
    00007
    00008 ************************************************/
    00009
    00010 #ifndef SOCKPORT_H
    00011 #define SOCKPORT_H
    00012
    00013 #ifdef SA_LEN
    00014 #  define SS_LEN(ss) (ss)->ss_len
    00015 #else
    00016 # ifdef HAVE_SA_LEN
    00017 #  define SA_LEN(sa) (sa)->sa_len
    00018 #  define SS_LEN(ss) (ss)->ss_len
    00019 # else
    00020 #  ifdef AF_INET6
    00021 #   define SA_LEN(sa) \
    00022         (((sa)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
    00023                                        : sizeof(struct sockaddr))
    00024 #   define SS_LEN(ss) \
    00025         (((ss)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
    00026                                        : sizeof(struct sockaddr))
    00027 #  else
    00028     /* by tradition, sizeof(struct sockaddr) covers most of the sockaddrs */
    00029 #   define SA_LEN(sa)   (sizeof(struct sockaddr))
    00030 #   define SS_LEN(ss)   (sizeof(struct sockaddr))
    00031 #  endif
    00032 # endif
    00033 #endif
    00034
    00035 #ifdef HAVE_SA_LEN
    00036 # define SET_SA_LEN(sa, len) (void)((sa)->sa_len = (len))
    00037 # define SET_SS_LEN(ss, len) (void)((ss)->ss_len = (len))
    00038 #else
    00039 # define SET_SA_LEN(sa, len) (void)(len)
    00040 # define SET_SS_LEN(ss, len) (void)(len)
    00041 #endif
    00042
    00043 #ifdef HAVE_SIN_LEN
    00044 # define SIN_LEN(si) (si)->sin_len
    00045 # define SET_SIN_LEN(si,len) (si)->sin_len = (len)
    00046 #else
    00047 # define SIN_LEN(si) sizeof(struct sockaddr_in)
    00048 # define SET_SIN_LEN(si,len)
    00049 #endif
    00050
    00051 #ifndef IN_MULTICAST
    00052 # define IN_CLASSD(i)   (((long)(i) & 0xf0000000) == 0xe0000000)
    00053 # define IN_MULTICAST(i)        IN_CLASSD(i)
    00054 #endif
    00055
    00056 #ifndef IN_EXPERIMENTAL
    00057 # define IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
    00058 #endif
    00059
    00060 #ifndef IN_CLASSA_NSHIFT
    00061 # define IN_CLASSA_NSHIFT 24
    00062 #endif
    00063
    00064 #ifndef IN_LOOPBACKNET
    00065 # define IN_LOOPBACKNET 127
    00066 #endif
    00067
    00068 #ifndef AF_UNSPEC
    00069 # define AF_UNSPEC 0
    00070 #endif
    00071
    00072 #ifndef PF_UNSPEC
    00073 # define PF_UNSPEC AF_UNSPEC
    00074 #endif
    00075
    00076 #ifndef PF_INET
    00077 # define PF_INET AF_INET
    00078 #endif
    00079
    00080 #if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
    00081 extern int h_errno;
    00082 #endif
    00083
    00084 #endif
    00085