Update to RDoc 2.1.0 r112
[rbx.git] / stdlib / ext / socket / sockport.h
blob2cd95b80ac0bddb28f787f25b1daf19dc1ff922a
1 /************************************************
3 sockport.h -
5 $Author: shyouhei $
6 $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
7 created at: Fri Apr 30 23:19:34 JST 1999
9 ************************************************/
11 #ifndef SOCKPORT_H
12 #define SOCKPORT_H
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
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
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
43 #ifndef IN_MULTICAST
44 # define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
45 # define IN_MULTICAST(i) IN_CLASSD(i)
46 #endif
48 #ifndef IN_EXPERIMENTAL
49 # define IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
50 #endif
52 #ifndef IN_CLASSA_NSHIFT
53 # define IN_CLASSA_NSHIFT 24
54 #endif
56 #ifndef IN_LOOPBACKNET
57 # define IN_LOOPBACKNET 127
58 #endif
60 #ifndef AF_UNSPEC
61 # define AF_UNSPEC 0
62 #endif
64 #ifndef PF_UNSPEC
65 # define PF_UNSPEC AF_UNSPEC
66 #endif
68 #ifndef PF_INET
69 # define PF_INET AF_INET
70 #endif
72 #if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
73 extern int h_errno;
74 #endif
76 #endif