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_SOCKLEN_T)
00217 # if defined (__hpux)
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 # if defined (_XOPEN_SOURCE_EXTENDED)
00229 typedef socklen_t ACE_SOCKET_LEN;
00230 # else
00231 typedef int ACE_SOCKET_LEN;
00232 # endif
00233 # else
00234 typedef socklen_t ACE_SOCKET_LEN;
00235 # endif
00236 #elif defined (ACE_HAS_SIZET_SOCKET_LEN)
00237 typedef size_t ACE_SOCKET_LEN;
00238 #else
00239 typedef int ACE_SOCKET_LEN;
00240 #endif
00241
00242 #if defined (ACE_HAS_NETLINK)
00243 # include <asm/types.h>
00244 # include <linux/netlink.h>
00245 # define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK
00246 #endif
00247
00248 #if defined (ACE_HAS_LKSCTP)
00249 extern "C"
00250 {
00251 #include <netinet/in.h>
00252 #include <netinet/sctp.h>
00253 }
00254 #endif
00255
00256 # if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
00257
00258 ssize_t recv_timedwait (ACE_HANDLE handle,
00259 char *buf,
00260 int len,
00261 int flags,
00262 struct timespec *timeout);
00263
00264 ssize_t recvmsg_timedwait (ACE_HANDLE handle,
00265 struct msghdr *msg,
00266 int flags,
00267 struct timespec *timeout);
00268
00269 ssize_t recvfrom_timedwait (ACE_HANDLE handle,
00270 char *buf,
00271 int len,
00272 int flags,
00273 struct sockaddr *addr,
00274 int *addrlen,
00275 struct timespec *timeout);
00276
00277 ssize_t send_timedwait (ACE_HANDLE handle,
00278 const char *buf,
00279 int len,
00280 int flags,
00281 struct timespec *timeout);
00282
00283 ssize_t sendmsg_timedwait (ACE_HANDLE handle,
00284 const struct msghdr *msg,
00285 int flags,
00286 struct timespec *timeout);
00287
00288 ssize_t sendto_timedwait (ACE_HANDLE handle,
00289 const char *buf,
00290 int len,
00291 int flags,
00292 const struct sockaddr *addr,
00293 int addrlen,
00294 struct timespec *timeout);
00295
00296 # endif
00297
00298 #ifdef __cplusplus
00299 }
00300 #endif
00301
00302 #include "ace/post.h"
00303 #endif