Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / os_include / sys / os_socket.h
blobf70fee9dfd65144760f20c66f65f4aa4c15770e8
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file os_socket.h
7 * main sockets header
9 * $Id: os_socket.h 80826 2008-03-04 14:51:23Z wotte $
11 * @author Don Hinton <dhinton@dresystems.com>
12 * @author This code was originally in various places including ace/OS.h.
14 //=============================================================================
16 #ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H
17 #define ACE_OS_INCLUDE_SYS_OS_SOCKET_H
19 #include /**/ "ace/pre.h"
21 #include "ace/config-lite.h"
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # pragma once
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #include "ace/os_include/sys/os_uio.h"
29 #if !defined (ACE_LACKS_SYS_SOCKET_H)
30 # include /**/ <sys/socket.h>
31 #endif /* !ACE_LACKS_SYS_SOCKET_H */
33 #if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
34 # include /**/ <sockLib.h>
35 #endif /* ACE_VXWORKS */
37 // Place all additions (especially function declarations) within extern "C" {}
38 #ifdef __cplusplus
39 extern "C"
41 #endif /* __cplusplus */
43 #if !defined (ACE_HAS_MSG) && !defined (SCO)
44 struct msghdr {};
45 #endif /* ACE_HAS_MSG */
47 #if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS)
48 # if !defined (msg_accrights)
49 # undef msg_control
50 # define msg_accrights msg_control
51 # endif /* ! msg_accrights */
53 # if !defined (msg_accrightslen)
54 # undef msg_controllen
55 # define msg_accrightslen msg_controllen
56 # endif /* ! msg_accrightslen */
57 #endif /* ACE_HAS_MSG && ACE_LACKS_MSG_ACCRIGHTS */
59 # if defined (ACE_LACKS_SOCKADDR)
60 struct sockaddr {
61 u_char sa_len; /* total length */
62 u_char sa_family; /* address family */
63 char sa_data[14]; /* actually longer; address value */
65 # endif /* ACE_LACKS_SOCKADDR */
67 # if defined (ACE_LACKS_LINGER)
68 struct linger {
69 int l_onoff; /* option on/off */
70 int l_linger; /* linger time */
72 # endif /* ACE_LACKS_LINGER */
74 #if defined (ACE_WIN32)
75 struct msghdr
77 /// Optional address
78 sockaddr * msg_name;
80 /// Size of address
81 int msg_namelen;
83 /// Scatter/gather array
84 iovec *msg_iov;
86 /// # elements in msg_iov
87 int msg_iovlen;
89 /// Access rights sent/received
90 caddr_t msg_accrights;
92 int msg_accrightslen;
94 #endif /* ACE_WIN32 */
96 #if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
97 // Control message size to pass a file descriptor.
98 # define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE)
99 #endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
101 // Increase the range of "address families". Please note that this
102 // must appear _after_ the include of sys/socket.h, for the AF_FILE
103 // definition on Linux/glibc2.
104 #if !defined (AF_ANY)
105 # define AF_ANY (-1)
106 #endif /* AF_ANY */
108 #if !defined (AF_UNSPEC)
109 # define AF_UNSPEC 0
110 #endif /* AF_UNSPEC */
112 #if !defined (AF_LOCAL)
113 # define AF_LOCAL 1
114 #endif /* AF_LOCAL */
116 #if !defined (AF_UNIX)
117 # define AF_UNIX AF_LOCAL
118 #endif /* AF_UNIX */
120 #if !defined (AF_INET)
121 # define AF_INET 2
122 #endif /* AF_INET */
124 #if !defined (PF_INET)
125 # define PF_INET AF_INET
126 #endif /* PF_INET */
128 #if !defined (PF_LOCAL)
129 # define PF_LOCAL AF_LOCAL
130 #endif /* PF_LOCAL */
132 #if !defined (PF_UNIX)
133 # define PF_UNIX PF_LOCAL
134 #endif /* PF_UNIX */
136 #if !defined (AF_MAX)
137 # define AF_MAX 29
138 #endif /* AF_MAX */
140 #if !defined (PF_UNSPEC)
141 # define PF_UNSPEC 0
142 #endif /* PF_UNSPEC */
144 #define AF_SPIPE (AF_MAX + 1)
145 #if !defined (AF_FILE)
146 # define AF_FILE (AF_MAX + 2)
147 #endif /* ! AF_FILE */
148 #define AF_DEV (AF_MAX + 3)
149 #define AF_UPIPE (AF_SPIPE)
151 #if !defined (MSG_OOB)
152 # define MSG_OOB 0x1
153 #endif /* MSG_OOB */
155 #if !defined (MSG_PEEK)
156 # define MSG_PEEK 0x2
157 #endif /* MSG_PEEK */
159 #if !defined (SOCK_STREAM)
160 # define SOCK_STREAM 1
161 #endif /* SOCK_STREAM */
163 #if !defined (SOCK_DGRAM)
164 # define SOCK_DGRAM 2
165 #endif /* SOCK_DGRAM */
167 #if !defined (SOCK_SEQPACKET)
168 # define SOCK_SEQPACKET 5
169 #endif /* SOCK_SEQPACKET */
171 #if !defined (SOL_SOCKET)
172 # define SOL_SOCKET 0xffff
173 #endif /* SOL_SOCKET */
175 #if !defined (SO_REUSEADDR)
176 # define SO_REUSEADDR 0x0004
177 #endif /* SO_REUSEADDR */
179 #if !defined (SO_LINGER)
180 # define SO_LINGER 0x0080
181 #endif /* SO_LINGER */
183 #if !defined (SO_SNDBUF)
184 # define SO_SNDBUF 0x1001
185 #endif /* SO_SNDBUF */
187 #if !defined (SO_RCVBUF)
188 # define SO_RCVBUF 0x1002
189 #endif /* SO_RCVBUF */
191 #if !defined (SO_BROADCAST)
192 # define SO_BROADCAST 0x0020
193 #endif /* SO_BROADCAST */
195 #if !defined (SO_ERROR)
196 # define SO_ERROR 0x1007
197 #endif /* SO_ERROR */
199 #if !defined (SCM_RIGHTS)
200 # define SCM_RIGHTS 0x01
201 #endif /* SCM_RIGHTS */
203 #if defined (ACE_HAS_IPV6)
204 # if defined (ACE_USES_IPV4_IPV6_MIGRATION)
205 # define ACE_ADDRESS_FAMILY_INET AF_UNSPEC
206 # define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC
207 # else
208 # define ACE_ADDRESS_FAMILY_INET AF_INET6
209 # define ACE_PROTOCOL_FAMILY_INET PF_INET6
210 # endif /* ACE_USES_IPV4_IPV6_MIGRATION */
211 #else /* !ACE_HAS_IPV6 */
212 # define ACE_ADDRESS_FAMILY_INET AF_INET
213 # define ACE_PROTOCOL_FAMILY_INET PF_INET
214 #endif /* ACE_HAS_IPV6 */
216 #if !defined (ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE)
217 #define ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE SSIZE_MAX
218 #endif /* ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE */
220 #if defined (ACE_HAS_SOCKLEN_T)
221 # if defined (__hpux)
223 ** HP-UX supplies the socklen_t type unless some feature set less than
224 ** _XOPEN_SOURCE_EXTENDED is specifically requested. However, it only
225 ** actually uses the socklen_t type in supplied socket functions if
226 ** _XOPEN_SOURCE_EXTENDED is specifically requested. So, for example,
227 ** the compile options ACE usually uses (includes -mt) cause _HPUX_SOURCE
228 ** to be set, which sets _INCLUDE_XOPEN_SOURCE_EXTENDED (causing socklen_t
229 ** to be defined) but _not_ _XOPEN_SOURCE_EXTENDED (causing socket functions
230 ** to use int, not socklen_t). React to this situation here...
232 # if defined (_XOPEN_SOURCE_EXTENDED)
233 typedef socklen_t ACE_SOCKET_LEN;
234 # else
235 typedef int ACE_SOCKET_LEN;
236 # endif /* _XOPEN_SOURCE_EXTENDED */
237 # else
238 typedef socklen_t ACE_SOCKET_LEN;
239 # endif /* __hpux */
240 #elif defined (ACE_HAS_SIZET_SOCKET_LEN)
241 typedef size_t ACE_SOCKET_LEN;
242 #else
243 typedef int ACE_SOCKET_LEN;
244 #endif /* ACE_HAS_SIZET_SOCKET_LEN */
246 #if defined (ACE_HAS_NETLINK)
247 # include /**/ <asm/types.h>
248 # include /**/ <linux/netlink.h>
249 # define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK
250 #endif
252 #if defined (ACE_HAS_LKSCTP)
253 extern "C"
255 #include /**/ <netinet/in.h>
256 #include /**/ <netinet/sctp.h>
258 #endif /* ACE_HAS_LKSCTP */
260 # if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
262 ssize_t recv_timedwait (ACE_HANDLE handle,
263 char *buf,
264 int len,
265 int flags,
266 struct timespec *timeout);
268 ssize_t recvmsg_timedwait (ACE_HANDLE handle,
269 struct msghdr *msg,
270 int flags,
271 struct timespec *timeout);
273 ssize_t recvfrom_timedwait (ACE_HANDLE handle,
274 char *buf,
275 int len,
276 int flags,
277 struct sockaddr *addr,
278 int *addrlen,
279 struct timespec *timeout);
281 ssize_t send_timedwait (ACE_HANDLE handle,
282 const char *buf,
283 int len,
284 int flags,
285 struct timespec *timeout);
287 ssize_t sendmsg_timedwait (ACE_HANDLE handle,
288 const struct msghdr *msg,
289 int flags,
290 struct timespec *timeout);
292 ssize_t sendto_timedwait (ACE_HANDLE handle,
293 const char *buf,
294 int len,
295 int flags,
296 const struct sockaddr *addr,
297 int addrlen,
298 struct timespec *timeout);
300 # endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */
302 #ifdef __cplusplus
304 #endif /* __cplusplus */
306 #include /**/ "ace/post.h"
307 #endif /* ACE_OS_INCLUDE_SYS_OS_SOCKET_H */