Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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