4 //=============================================================================
8 * Internet address family
10 * @author Don Hinton <dhinton@dresystems.com>
11 * @author This code was originally in various places including ace/OS.h.
13 //=============================================================================
15 #ifndef ACE_OS_INCLUDE_NETINET_OS_IN_H
16 #define ACE_OS_INCLUDE_NETINET_OS_IN_H
18 #include /**/ "ace/pre.h"
20 #include /**/ "ace/config-lite.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "ace/os_include/os_inttypes.h"
27 #include "ace/os_include/sys/os_socket.h"
29 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
30 # include /**/ <ws2tcpip.h>
31 #endif /* ACE_HAS_WINSOCK2 */
33 // Place all additions (especially function declarations) within extern "C" {}
37 #endif /* __cplusplus */
39 #if !defined (ACE_LACKS_NETINET_IN_H)
40 # include /**/ <netinet/in.h>
41 #endif /* !ACE_LACKS_NETINET_IN_H */
44 # if !defined (ACE_IPPROTO_TCP)
45 # define ACE_IPPROTO_TCP IPPROTO_TCP
46 # endif /* !ACE_IPPROTO_TCP */
48 # if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP)
49 // Even if ACE_HAS_IP_MULTICAST is not defined, if IP_ADD_MEMBERSHIP
50 // is defined, assume that the ip_mreq struct is also defined
51 // (presumably in netinet/in.h).
54 /// IP multicast address of group
55 struct in_addr imr_multiaddr
;
56 /// Local IP address of interface
57 struct in_addr imr_interface
;
59 # endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */
61 # if defined (ACE_LACKS_IN_ADDR)
66 # endif /* ACE_LACKS_IN_ADDR */
68 # if defined (ACE_LACKS_SOCKADDR_IN)
71 short sin_family
; // e.g. AF_INET
72 unsigned short sin_port
; // e.g. htons(3490)
73 struct in_addr sin_addr
; // see struct in_addr, below
74 char sin_zero
[8]; // zero this if you want to
76 # endif /* ACE_LACKS_SOCKADDR_IN */
78 # if defined (ACE_LACKS_SOCKADDR_UN)
80 u_char sun_len
; /* sockaddr len including null */
81 u_char sun_family
; /* AF_UNIX */
82 char sun_path
[104]; /* path name (gag) */
84 #endif /* ACE_LACKS_SOCKADDR_UN */
86 # if defined (ACE_LACKS_IP_MREQ)
89 struct in_addr imr_multiaddr
; /* IP multicast address of group */
90 struct in_addr imr_interface
; /* local IP address of interface */
92 # endif /* ACE_LACKS_IP_MREQ */
94 #if !defined (ACE_HAS_IPPORT_RESERVED) && !defined (IPPORT_RESERVED)
95 # define IPPORT_RESERVED 1024
96 #endif /* !IPPORT_RESERVED */
98 #if !defined (IPPORT_USERRESERVED)
99 # define IPPORT_USERRESERVED 5000
100 #endif /* !IPPORT_USERRESERVED */
102 // Define INET loopback address constant if it hasn't been defined
103 // Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001
104 #if !defined (INADDR_LOOPBACK)
105 # define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001)
106 #endif /* INADDR_LOOPBACK */
108 // The INADDR_NONE address is generally 255.255.255.255.
109 #if !defined (INADDR_NONE)
110 # define INADDR_NONE ((ACE_UINT32) 0xffffffff)
111 #endif /* INADDR_NONE */
113 // Define INET string length constants if they haven't been defined
115 // for IPv4 dotted-decimal
116 #if !defined (INET_ADDRSTRLEN)
117 # define INET_ADDRSTRLEN 16
118 #endif /* INET_ADDRSTRLEN */
120 // for IPv6 hex string
121 #if !defined (INET6_ADDRSTRLEN)
122 # define INET6_ADDRSTRLEN 46
123 #endif /* INET6_ADDRSTRLEN */
125 # if !defined (IP_DROP_MEMBERSHIP)
126 # define IP_DROP_MEMBERSHIP 0
127 # endif /* IP_DROP_MEMBERSHIP */
129 # if !defined (IP_ADD_MEMBERSHIP)
130 # define IP_ADD_MEMBERSHIP 0
131 # define ACE_LACKS_IP_ADD_MEMBERSHIP
132 # endif /* IP_ADD_MEMBERSHIP */
134 # if !defined (IP_DEFAULT_MULTICAST_TTL)
135 # define IP_DEFAULT_MULTICAST_TTL 0
136 # endif /* IP_DEFAULT_MULTICAST_TTL */
138 # if !defined (IP_DEFAULT_MULTICAST_LOOP)
139 # define IP_DEFAULT_MULTICAST_LOOP 0
140 # endif /* IP_DEFAULT_MULTICAST_LOOP */
142 # if !defined (IP_MULTICAST_IF)
143 # define IP_MULTICAST_IF 0
144 # endif /* IP_MULTICAST_IF */
146 # if !defined (IP_MULTICAST_TTL)
147 # define IP_MULTICAST_TTL 1
148 # endif /* IP_MULTICAST_TTL */
150 # if !defined (IP_MULTICAST_LOOP)
151 # define IP_MULTICAST_LOOP 2
152 # endif /* IP_MULTICAST_LOOP */
154 # if !defined (IP_MAX_MEMBERSHIPS)
155 # define IP_MAX_MEMBERSHIPS 0
156 # endif /* IP_MAX_MEMBERSHIP */
158 # if !defined (IPPROTO_IP)
159 # define IPPROTO_IP 0
160 # endif /* IPPROTO_IP */
162 # if !defined (IPPROTO_TCP)
163 # define IPPROTO_TCP 6
164 # endif /* IPPROTO_TCP */
166 # if !defined (INADDR_ANY)
167 # define INADDR_ANY (u_long)0x00000000
168 # endif /* INADDR_ANY */
172 #endif /* __cplusplus */
174 #include /**/ "ace/post.h"
175 #endif /* ACE_OS_INCLUDE_NETINET_OS_IN_H */