~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to include/libtorrent/asio/detail/socket_types.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//
2
 
// socket_types.hpp
3
 
// ~~~~~~~~~~~~~~~~
4
 
//
5
 
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6
 
//
7
 
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8
 
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
 
//
10
 
 
11
 
#ifndef ASIO_DETAIL_SOCKET_TYPES_HPP
12
 
#define ASIO_DETAIL_SOCKET_TYPES_HPP
13
 
 
14
 
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15
 
# pragma once
16
 
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
 
 
18
 
#include "asio/detail/push_options.hpp"
19
 
 
20
 
#include "asio/detail/push_options.hpp"
21
 
#include <boost/config.hpp>
22
 
#include "asio/detail/pop_options.hpp"
23
 
 
24
 
#include "asio/detail/push_options.hpp"
25
 
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
26
 
# if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
27
 
#  error WinSock.h has already been included
28
 
# endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
29
 
# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
30
 
#  if defined(_MSC_VER) || defined(__BORLANDC__)
31
 
#   pragma message("Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately")
32
 
#   pragma message("Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)")
33
 
#  else // defined(_MSC_VER) || defined(__BORLANDC__)
34
 
#   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately
35
 
#   warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)
36
 
#  endif // defined(_MSC_VER) || defined(__BORLANDC__)
37
 
#  define _WIN32_WINNT 0x0501
38
 
# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
39
 
# if defined(_MSC_VER)
40
 
#  if defined(_WIN32) && !defined(WIN32)
41
 
#   if !defined(_WINSOCK2API_)
42
 
#    define WIN32 // Needed for correct types in winsock2.h
43
 
#   else // !defined(_WINSOCK2API_)
44
 
#    error Please define the macro WIN32 in your compiler options
45
 
#   endif // !defined(_WINSOCK2API_)
46
 
#  endif // defined(_WIN32) && !defined(WIN32)
47
 
# endif // defined(_MSC_VER)
48
 
# if defined(__BORLANDC__)
49
 
#  include <stdlib.h> // Needed for __errno
50
 
#  if defined(__WIN32__) && !defined(WIN32)
51
 
#   if !defined(_WINSOCK2API_)
52
 
#    define WIN32 // Needed for correct types in winsock2.h
53
 
#   else // !defined(_WINSOCK2API_)
54
 
#    error Please define the macro WIN32 in your compiler options
55
 
#   endif // !defined(_WINSOCK2API_)
56
 
#  endif // defined(__WIN32__) && !defined(WIN32)
57
 
#  if !defined(_WSPIAPI_H_)
58
 
#   define _WSPIAPI_H_
59
 
#   define ASIO_WSPIAPI_H_DEFINED
60
 
#  endif // !defined(_WSPIAPI_H_)
61
 
# endif // defined(__BORLANDC__)
62
 
# if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
63
 
#  if !defined(WIN32_LEAN_AND_MEAN)
64
 
#   define WIN32_LEAN_AND_MEAN
65
 
#  endif // !defined(WIN32_LEAN_AND_MEAN)
66
 
# endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
67
 
# if defined(__CYGWIN__)
68
 
#  if !defined(__USE_W32_SOCKETS)
69
 
#   error You must add -D__USE_W32_SOCKETS to your compiler options.
70
 
#  endif // !defined(__USE_W32_SOCKETS)
71
 
#  if !defined(NOMINMAX)
72
 
#   define NOMINMAX 1
73
 
#  endif // !defined(NOMINMAX)
74
 
# endif // defined(__CYGWIN__)
75
 
# include <winsock2.h>
76
 
# include <ws2tcpip.h>
77
 
# include <mswsock.h>
78
 
# if defined(ASIO_WSPIAPI_H_DEFINED)
79
 
#  undef _WSPIAPI_H_
80
 
#  undef ASIO_WSPIAPI_H_DEFINED
81
 
# endif // defined(ASIO_WSPIAPI_H_DEFINED)
82
 
# if !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
83
 
#  if defined(UNDER_CE)
84
 
#   pragma comment(lib, "ws2.lib")
85
 
#  elif defined(_MSC_VER) || defined(__BORLANDC__)
86
 
#   pragma comment(lib, "ws2_32.lib")
87
 
#   pragma comment(lib, "mswsock.lib")
88
 
#  endif // defined(_MSC_VER) || defined(__BORLANDC__)
89
 
# endif // !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
90
 
# include "asio/detail/old_win_sdk_compat.hpp"
91
 
#else
92
 
# include <sys/ioctl.h>
93
 
# include <sys/poll.h>
94
 
# include <sys/types.h>
95
 
# if defined(__hpux) && !defined(__HP_aCC)
96
 
#  include <sys/time.h>
97
 
# else
98
 
#  include <sys/select.h>
99
 
# endif
100
 
# include <sys/socket.h>
101
 
# include <sys/uio.h>
102
 
# include <sys/un.h>
103
 
# include <netinet/in.h>
104
 
# include <netinet/tcp.h>
105
 
# include <arpa/inet.h>
106
 
# include <netdb.h>
107
 
# include <net/if.h>
108
 
# include <limits.h>
109
 
# if defined(__sun)
110
 
#  include <sys/filio.h>
111
 
#  include <sys/sockio.h>
112
 
# endif
113
 
#endif
114
 
#include "asio/detail/pop_options.hpp"
115
 
 
116
 
namespace asio {
117
 
namespace detail {
118
 
 
119
 
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
120
 
typedef SOCKET socket_type;
121
 
const SOCKET invalid_socket = INVALID_SOCKET;
122
 
const int socket_error_retval = SOCKET_ERROR;
123
 
const int max_addr_v4_str_len = 256;
124
 
const int max_addr_v6_str_len = 256;
125
 
typedef sockaddr socket_addr_type;
126
 
typedef in_addr in4_addr_type;
127
 
typedef ip_mreq in4_mreq_type;
128
 
typedef sockaddr_in sockaddr_in4_type;
129
 
# if defined(ASIO_HAS_OLD_WIN_SDK)
130
 
typedef in6_addr_emulation in6_addr_type;
131
 
typedef ipv6_mreq_emulation in6_mreq_type;
132
 
typedef sockaddr_in6_emulation sockaddr_in6_type;
133
 
typedef sockaddr_storage_emulation sockaddr_storage_type;
134
 
typedef addrinfo_emulation addrinfo_type;
135
 
# else
136
 
typedef in6_addr in6_addr_type;
137
 
typedef ipv6_mreq in6_mreq_type;
138
 
typedef sockaddr_in6 sockaddr_in6_type;
139
 
typedef sockaddr_storage sockaddr_storage_type;
140
 
typedef addrinfo addrinfo_type;
141
 
# endif
142
 
typedef unsigned long ioctl_arg_type;
143
 
typedef u_long u_long_type;
144
 
typedef u_short u_short_type;
145
 
const int shutdown_receive = SD_RECEIVE;
146
 
const int shutdown_send = SD_SEND;
147
 
const int shutdown_both = SD_BOTH;
148
 
const int message_peek = MSG_PEEK;
149
 
const int message_out_of_band = MSG_OOB;
150
 
const int message_do_not_route = MSG_DONTROUTE;
151
 
# if defined (_WIN32_WINNT)
152
 
const int max_iov_len = 64;
153
 
# else
154
 
const int max_iov_len = 16;
155
 
# endif
156
 
#else
157
 
typedef int socket_type;
158
 
const int invalid_socket = -1;
159
 
const int socket_error_retval = -1;
160
 
const int max_addr_v4_str_len = INET_ADDRSTRLEN;
161
 
const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE;
162
 
typedef sockaddr socket_addr_type;
163
 
typedef in_addr in4_addr_type;
164
 
# if defined(__hpux)
165
 
// HP-UX doesn't provide ip_mreq when _XOPEN_SOURCE_EXTENDED is defined.
166
 
struct in4_mreq_type
167
 
{
168
 
  struct in_addr imr_multiaddr;
169
 
  struct in_addr imr_interface;
170
 
};
171
 
# else
172
 
typedef ip_mreq in4_mreq_type;
173
 
# endif
174
 
typedef sockaddr_in sockaddr_in4_type;
175
 
typedef in6_addr in6_addr_type;
176
 
typedef ipv6_mreq in6_mreq_type;
177
 
typedef sockaddr_in6 sockaddr_in6_type;
178
 
typedef sockaddr_storage sockaddr_storage_type;
179
 
typedef sockaddr_un sockaddr_un_type;
180
 
typedef addrinfo addrinfo_type;
181
 
typedef int ioctl_arg_type;
182
 
typedef uint32_t u_long_type;
183
 
typedef uint16_t u_short_type;
184
 
const int shutdown_receive = SHUT_RD;
185
 
const int shutdown_send = SHUT_WR;
186
 
const int shutdown_both = SHUT_RDWR;
187
 
const int message_peek = MSG_PEEK;
188
 
const int message_out_of_band = MSG_OOB;
189
 
const int message_do_not_route = MSG_DONTROUTE;
190
 
# if defined(IOV_MAX)
191
 
const int max_iov_len = IOV_MAX;
192
 
# else
193
 
// POSIX platforms are not required to define IOV_MAX.
194
 
const int max_iov_len = 16;
195
 
# endif
196
 
#endif
197
 
const int custom_socket_option_level = 0xA5100000;
198
 
const int enable_connection_aborted_option = 1;
199
 
const int always_fail_option = 2;
200
 
 
201
 
} // namespace detail
202
 
} // namespace asio
203
 
 
204
 
#include "asio/detail/pop_options.hpp"
205
 
 
206
 
#endif // ASIO_DETAIL_SOCKET_TYPES_HPP