00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H
00017 #define ACE_OS_INCLUDE_SYS_OS_SOCKET_H
00018
00019 #include "ace/pre.h"
00020
00021 #include "ace/config-lite.h"
00022
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif
00026
00027 #include "ace/os_include/sys/os_uio.h"
00028
00029 #if !defined (ACE_LACKS_SYS_SOCKET_H)
00030 # include <sys/socket.h>
00031 #endif
00032
00033 #if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
00034 # include <sockLib.h>
00035 #endif
00036
00037
00038 #ifdef __cplusplus
00039 extern "C"
00040 {
00041 #endif
00042
00043 #if !defined (ACE_HAS_MSG) && !defined (SCO)
00044 struct msghdr {};
00045 #endif
00046
00047 #if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS)
00048 # if !defined (msg_accrights)
00049 # undef msg_control
00050 # define msg_accrights msg_control
00051 # endif
00052
00053 # if !defined (msg_accrightslen)
00054 # undef msg_controllen
00055 # define msg_accrightslen msg_controllen
00056 # endif
00057 #endif
00058
00059 # if defined (ACE_LACKS_SOCKADDR)
00060 struct sockaddr {
00061 u_char sa_len;
00062 u_char sa_family;
00063 char sa_data[14];
00064 };
00065 # endif
00066
00067 # if defined (ACE_LACKS_LINGER)
00068 struct linger {
00069 int l_onoff;
00070 int l_linger;
00071 };
00072 # endif
00073
00074 #if defined (ACE_WIN32)
00075 struct msghdr
00076 {
00077
00078 sockaddr * msg_name;
00079
00080
00081 int msg_namelen;
00082
00083
00084 iovec *msg_iov;
00085
00086
00087 int msg_iovlen;
00088
00089
00090 caddr_t msg_accrights;
00091
00092 int msg_accrightslen;
00093 };
00094 #endif
00095
00096 #if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
00097
00098 # define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE)
00099 #endif
00100
00101
00102
00103
00104 #if !defined (AF_ANY)
00105 # define AF_ANY (-1)
00106 #endif
00107
00108 #if !defined (AF_UNSPEC)
00109 # define AF_UNSPEC 0
00110 #endif
00111
00112 #if !defined (AF_LOCAL)
00113 # define AF_LOCAL 1
00114 #endif
00115
00116 #if !defined (AF_UNIX)
00117 # define AF_UNIX AF_LOCAL
00118 #endif
00119
00120 #if !defined (AF_INET)
00121 # define AF_INET 2
00122 #endif
00123
00124 #if !defined (PF_INET)
00125 # define PF_INET AF_INET
00126 #endif
00127
00128 #if !defined (PF_LOCAL)
00129 # define PF_LOCAL AF_LOCAL
00130 #endif
00131
00132 #if !defined (PF_UNIX)
00133 # define PF_UNIX PF_LOCAL
00134 #endif
00135
00136 #if !defined (AF_MAX)
00137 # define AF_MAX 29
00138 #endif
00139
00140 #if !defined (PF_UNSPEC)
00141 # define PF_UNSPEC 0
00142 #endif
00143
00144 #define AF_SPIPE (AF_MAX + 1)
00145 #if !defined (AF_FILE)
00146 # define AF_FILE (AF_MAX + 2)
00147 #endif
00148 #define AF_DEV (AF_MAX + 3)
00149 #define AF_UPIPE (AF_SPIPE)
00150
00151 #if !defined (MSG_OOB)
00152 # define MSG_OOB 0x1
00153 #endif
00154
00155 #if !defined (MSG_PEEK)
00156 # define MSG_PEEK 0x2
00157 #endif
00158
00159 #if !defined (SOCK_STREAM)
00160 # define SOCK_STREAM 1
00161 #endif
00162
00163 #if !defined (SOCK_DGRAM)
00164 # define SOCK_DGRAM 2
00165 #endif
00166
00167 #if !defined (SOCK_SEQPACKET)
00168 # define SOCK_SEQPACKET 5
00169 #endif
00170
00171 #if !defined (SOL_SOCKET)
00172 # define SOL_SOCKET 0xffff
00173 #endif
00174
00175 #if !defined (SO_REUSEADDR)
00176 # define SO_REUSEADDR 0x0004
00177 #endif
00178
00179 #if !defined (SO_LINGER)
00180 # define SO_LINGER 0x0080
00181 #endif
00182
00183 #if !defined (SO_SNDBUF)
00184 # define SO_SNDBUF 0x1001
00185 #endif
00186
00187 #if !defined (SO_RCVBUF)
00188 # define SO_RCVBUF 0x1002
00189 #endif
00190
00191 #if !defined (SO_BROADCAST)
00192 # define SO_BROADCAST 0x0020
00193 #endif
00194
00195 #if !defined (SO_ERROR)
00196 # define SO_ERROR 0x1007
00197 #endif
00198
00199 #if !defined (SCM_RIGHTS)
00200 # define SCM_RIGHTS 0x01
00201 #endif
00202
00203 #if defined (ACE_HAS_IPV6)
00204 # if defined (ACE_USES_IPV4_IPV6_MIGRATION)
00205 # define ACE_ADDRESS_FAMILY_INET AF_UNSPEC
00206 # define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC
00207 # else
00208 # define ACE_ADDRESS_FAMILY_INET AF_INET6
00209 # define ACE_PROTOCOL_FAMILY_INET PF_INET6
00210 # endif
00211 #else
00212 # define ACE_ADDRESS_FAMILY_INET AF_INET
00213 # define ACE_PROTOCOL_FAMILY_INET PF_INET
00214 #endif
00215
00216 #if !defined (ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE)
00217 #define ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE SSIZE_MAX
00218 #endif
00219
00220 #if defined (ACE_HAS_SOCKLEN_T)
00221 # if defined (__hpux)
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 # if defined (_XOPEN_SOURCE_EXTENDED)
00233 typedef socklen_t ACE_SOCKET_LEN;
00234 # else
00235 typedef int ACE_SOCKET_LEN;
00236 # endif
00237 # else
00238 typedef socklen_t ACE_SOCKET_LEN;
00239 # endif
00240 #elif defined (ACE_HAS_SIZET_SOCKET_LEN)
00241 typedef size_t ACE_SOCKET_LEN;
00242 #else
00243 typedef int ACE_SOCKET_LEN;
00244 #endif
00245
00246 #if defined (ACE_HAS_NETLINK)
00247 # include <asm/types.h>
00248 # include <linux/netlink.h>
00249 # define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK
00250 #endif
00251
00252 #if defined (ACE_HAS_LKSCTP)
00253 extern "C"
00254 {
00255 #include <netinet/in.h>
00256 #include <netinet/sctp.h>
00257 }
00258 #endif
00259
00260 # if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
00261
00262 ssize_t recv_timedwait (ACE_HANDLE handle,
00263 char *buf,
00264 int len,
00265 int flags,
00266 struct timespec *timeout);
00267
00268 ssize_t recvmsg_timedwait (ACE_HANDLE handle,
00269 struct msghdr *msg,
00270 int flags,
00271 struct timespec *timeout);
00272
00273 ssize_t recvfrom_timedwait (ACE_HANDLE handle,
00274 char *buf,
00275 int len,
00276 int flags,
00277 struct sockaddr *addr,
00278 int *addrlen,
00279 struct timespec *timeout);
00280
00281 ssize_t send_timedwait (ACE_HANDLE handle,
00282 const char *buf,
00283 int len,
00284 int flags,
00285 struct timespec *timeout);
00286
00287 ssize_t sendmsg_timedwait (ACE_HANDLE handle,
00288 const struct msghdr *msg,
00289 int flags,
00290 struct timespec *timeout);
00291
00292 ssize_t sendto_timedwait (ACE_HANDLE handle,
00293 const char *buf,
00294 int len,
00295 int flags,
00296 const struct sockaddr *addr,
00297 int addrlen,
00298 struct timespec *timeout);
00299
00300 # endif
00301
00302 #ifdef __cplusplus
00303 }
00304 #endif
00305
00306 #include "ace/post.h"
00307 #endif