Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / socket_base.hpp @ 2486

History | View | Annotate | Download (14.5 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// socket_base.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
//
7 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 2486 sjacqu01
//
10 2486 sjacqu01
11 2486 sjacqu01
#ifndef BOOST_ASIO_SOCKET_BASE_HPP
12 2486 sjacqu01
#define BOOST_ASIO_SOCKET_BASE_HPP
13 2486 sjacqu01
14 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 2486 sjacqu01
# pragma once
16 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 2486 sjacqu01
18 2486 sjacqu01
#include <boost/asio/detail/config.hpp>
19 2486 sjacqu01
#include <boost/asio/detail/io_control.hpp>
20 2486 sjacqu01
#include <boost/asio/detail/socket_option.hpp>
21 2486 sjacqu01
#include <boost/asio/detail/socket_types.hpp>
22 2486 sjacqu01
23 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
24 2486 sjacqu01
25 2486 sjacqu01
namespace boost {
26 2486 sjacqu01
namespace asio {
27 2486 sjacqu01
28 2486 sjacqu01
/// The socket_base class is used as a base for the basic_stream_socket and
29 2486 sjacqu01
/// basic_datagram_socket class templates so that we have a common place to
30 2486 sjacqu01
/// define the shutdown_type and enum.
31 2486 sjacqu01
class socket_base
32 2486 sjacqu01
{
33 2486 sjacqu01
public:
34 2486 sjacqu01
  /// Different ways a socket may be shutdown.
35 2486 sjacqu01
  enum shutdown_type
36 2486 sjacqu01
  {
37 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
38 2486 sjacqu01
    /// Shutdown the receive side of the socket.
39 2486 sjacqu01
    shutdown_receive = implementation_defined,
40 2486 sjacqu01
41 2486 sjacqu01
    /// Shutdown the send side of the socket.
42 2486 sjacqu01
    shutdown_send = implementation_defined,
43 2486 sjacqu01
44 2486 sjacqu01
    /// Shutdown both send and receive on the socket.
45 2486 sjacqu01
    shutdown_both = implementation_defined
46 2486 sjacqu01
#else
47 2486 sjacqu01
    shutdown_receive = BOOST_ASIO_OS_DEF(SHUT_RD),
48 2486 sjacqu01
    shutdown_send = BOOST_ASIO_OS_DEF(SHUT_WR),
49 2486 sjacqu01
    shutdown_both = BOOST_ASIO_OS_DEF(SHUT_RDWR)
50 2486 sjacqu01
#endif
51 2486 sjacqu01
  };
52 2486 sjacqu01
53 2486 sjacqu01
  /// Bitmask type for flags that can be passed to send and receive operations.
54 2486 sjacqu01
  typedef int message_flags;
55 2486 sjacqu01
56 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
57 2486 sjacqu01
  /// Peek at incoming data without removing it from the input queue.
58 2486 sjacqu01
  static const int message_peek = implementation_defined;
59 2486 sjacqu01
60 2486 sjacqu01
  /// Process out-of-band data.
61 2486 sjacqu01
  static const int message_out_of_band = implementation_defined;
62 2486 sjacqu01
63 2486 sjacqu01
  /// Specify that the data should not be subject to routing.
64 2486 sjacqu01
  static const int message_do_not_route = implementation_defined;
65 2486 sjacqu01
66 2486 sjacqu01
  /// Specifies that the data marks the end of a record.
67 2486 sjacqu01
  static const int message_end_of_record = implementation_defined;
68 2486 sjacqu01
#else
69 2486 sjacqu01
  BOOST_ASIO_STATIC_CONSTANT(int,
70 2486 sjacqu01
      message_peek = BOOST_ASIO_OS_DEF(MSG_PEEK));
71 2486 sjacqu01
  BOOST_ASIO_STATIC_CONSTANT(int,
72 2486 sjacqu01
      message_out_of_band = BOOST_ASIO_OS_DEF(MSG_OOB));
73 2486 sjacqu01
  BOOST_ASIO_STATIC_CONSTANT(int,
74 2486 sjacqu01
      message_do_not_route = BOOST_ASIO_OS_DEF(MSG_DONTROUTE));
75 2486 sjacqu01
  BOOST_ASIO_STATIC_CONSTANT(int,
76 2486 sjacqu01
      message_end_of_record = BOOST_ASIO_OS_DEF(MSG_EOR));
77 2486 sjacqu01
#endif
78 2486 sjacqu01
79 2486 sjacqu01
  /// Socket option to permit sending of broadcast messages.
80 2486 sjacqu01
  /**
81 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_BROADCAST socket option.
82 2486 sjacqu01
   *
83 2486 sjacqu01
   * @par Examples
84 2486 sjacqu01
   * Setting the option:
85 2486 sjacqu01
   * @code
86 2486 sjacqu01
   * boost::asio::ip::udp::socket socket(io_service);
87 2486 sjacqu01
   * ...
88 2486 sjacqu01
   * boost::asio::socket_base::broadcast option(true);
89 2486 sjacqu01
   * socket.set_option(option);
90 2486 sjacqu01
   * @endcode
91 2486 sjacqu01
   *
92 2486 sjacqu01
   * @par
93 2486 sjacqu01
   * Getting the current option value:
94 2486 sjacqu01
   * @code
95 2486 sjacqu01
   * boost::asio::ip::udp::socket socket(io_service);
96 2486 sjacqu01
   * ...
97 2486 sjacqu01
   * boost::asio::socket_base::broadcast option;
98 2486 sjacqu01
   * socket.get_option(option);
99 2486 sjacqu01
   * bool is_set = option.value();
100 2486 sjacqu01
   * @endcode
101 2486 sjacqu01
   *
102 2486 sjacqu01
   * @par Concepts:
103 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
104 2486 sjacqu01
   */
105 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
106 2486 sjacqu01
  typedef implementation_defined broadcast;
107 2486 sjacqu01
#else
108 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
109 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_BROADCAST)>
110 2486 sjacqu01
      broadcast;
111 2486 sjacqu01
#endif
112 2486 sjacqu01
113 2486 sjacqu01
  /// Socket option to enable socket-level debugging.
114 2486 sjacqu01
  /**
115 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_DEBUG socket option.
116 2486 sjacqu01
   *
117 2486 sjacqu01
   * @par Examples
118 2486 sjacqu01
   * Setting the option:
119 2486 sjacqu01
   * @code
120 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
121 2486 sjacqu01
   * ...
122 2486 sjacqu01
   * boost::asio::socket_base::debug option(true);
123 2486 sjacqu01
   * socket.set_option(option);
124 2486 sjacqu01
   * @endcode
125 2486 sjacqu01
   *
126 2486 sjacqu01
   * @par
127 2486 sjacqu01
   * Getting the current option value:
128 2486 sjacqu01
   * @code
129 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
130 2486 sjacqu01
   * ...
131 2486 sjacqu01
   * boost::asio::socket_base::debug option;
132 2486 sjacqu01
   * socket.get_option(option);
133 2486 sjacqu01
   * bool is_set = option.value();
134 2486 sjacqu01
   * @endcode
135 2486 sjacqu01
   *
136 2486 sjacqu01
   * @par Concepts:
137 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
138 2486 sjacqu01
   */
139 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
140 2486 sjacqu01
  typedef implementation_defined debug;
141 2486 sjacqu01
#else
142 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
143 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DEBUG)> debug;
144 2486 sjacqu01
#endif
145 2486 sjacqu01
146 2486 sjacqu01
  /// Socket option to prevent routing, use local interfaces only.
147 2486 sjacqu01
  /**
148 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_DONTROUTE socket option.
149 2486 sjacqu01
   *
150 2486 sjacqu01
   * @par Examples
151 2486 sjacqu01
   * Setting the option:
152 2486 sjacqu01
   * @code
153 2486 sjacqu01
   * boost::asio::ip::udp::socket socket(io_service);
154 2486 sjacqu01
   * ...
155 2486 sjacqu01
   * boost::asio::socket_base::do_not_route option(true);
156 2486 sjacqu01
   * socket.set_option(option);
157 2486 sjacqu01
   * @endcode
158 2486 sjacqu01
   *
159 2486 sjacqu01
   * @par
160 2486 sjacqu01
   * Getting the current option value:
161 2486 sjacqu01
   * @code
162 2486 sjacqu01
   * boost::asio::ip::udp::socket socket(io_service);
163 2486 sjacqu01
   * ...
164 2486 sjacqu01
   * boost::asio::socket_base::do_not_route option;
165 2486 sjacqu01
   * socket.get_option(option);
166 2486 sjacqu01
   * bool is_set = option.value();
167 2486 sjacqu01
   * @endcode
168 2486 sjacqu01
   *
169 2486 sjacqu01
   * @par Concepts:
170 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
171 2486 sjacqu01
   */
172 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
173 2486 sjacqu01
  typedef implementation_defined do_not_route;
174 2486 sjacqu01
#else
175 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
176 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DONTROUTE)>
177 2486 sjacqu01
      do_not_route;
178 2486 sjacqu01
#endif
179 2486 sjacqu01
180 2486 sjacqu01
  /// Socket option to send keep-alives.
181 2486 sjacqu01
  /**
182 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_KEEPALIVE socket option.
183 2486 sjacqu01
   *
184 2486 sjacqu01
   * @par Examples
185 2486 sjacqu01
   * Setting the option:
186 2486 sjacqu01
   * @code
187 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
188 2486 sjacqu01
   * ...
189 2486 sjacqu01
   * boost::asio::socket_base::keep_alive option(true);
190 2486 sjacqu01
   * socket.set_option(option);
191 2486 sjacqu01
   * @endcode
192 2486 sjacqu01
   *
193 2486 sjacqu01
   * @par
194 2486 sjacqu01
   * Getting the current option value:
195 2486 sjacqu01
   * @code
196 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
197 2486 sjacqu01
   * ...
198 2486 sjacqu01
   * boost::asio::socket_base::keep_alive option;
199 2486 sjacqu01
   * socket.get_option(option);
200 2486 sjacqu01
   * bool is_set = option.value();
201 2486 sjacqu01
   * @endcode
202 2486 sjacqu01
   *
203 2486 sjacqu01
   * @par Concepts:
204 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
205 2486 sjacqu01
   */
206 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
207 2486 sjacqu01
  typedef implementation_defined keep_alive;
208 2486 sjacqu01
#else
209 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
210 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive;
211 2486 sjacqu01
#endif
212 2486 sjacqu01
213 2486 sjacqu01
  /// Socket option for the send buffer size of a socket.
214 2486 sjacqu01
  /**
215 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_SNDBUF socket option.
216 2486 sjacqu01
   *
217 2486 sjacqu01
   * @par Examples
218 2486 sjacqu01
   * Setting the option:
219 2486 sjacqu01
   * @code
220 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
221 2486 sjacqu01
   * ...
222 2486 sjacqu01
   * boost::asio::socket_base::send_buffer_size option(8192);
223 2486 sjacqu01
   * socket.set_option(option);
224 2486 sjacqu01
   * @endcode
225 2486 sjacqu01
   *
226 2486 sjacqu01
   * @par
227 2486 sjacqu01
   * Getting the current option value:
228 2486 sjacqu01
   * @code
229 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
230 2486 sjacqu01
   * ...
231 2486 sjacqu01
   * boost::asio::socket_base::send_buffer_size option;
232 2486 sjacqu01
   * socket.get_option(option);
233 2486 sjacqu01
   * int size = option.value();
234 2486 sjacqu01
   * @endcode
235 2486 sjacqu01
   *
236 2486 sjacqu01
   * @par Concepts:
237 2486 sjacqu01
   * Socket_Option, Integer_Socket_Option.
238 2486 sjacqu01
   */
239 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
240 2486 sjacqu01
  typedef implementation_defined send_buffer_size;
241 2486 sjacqu01
#else
242 2486 sjacqu01
  typedef boost::asio::detail::socket_option::integer<
243 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDBUF)>
244 2486 sjacqu01
      send_buffer_size;
245 2486 sjacqu01
#endif
246 2486 sjacqu01
247 2486 sjacqu01
  /// Socket option for the send low watermark.
248 2486 sjacqu01
  /**
249 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_SNDLOWAT socket option.
250 2486 sjacqu01
   *
251 2486 sjacqu01
   * @par Examples
252 2486 sjacqu01
   * Setting the option:
253 2486 sjacqu01
   * @code
254 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
255 2486 sjacqu01
   * ...
256 2486 sjacqu01
   * boost::asio::socket_base::send_low_watermark option(1024);
257 2486 sjacqu01
   * socket.set_option(option);
258 2486 sjacqu01
   * @endcode
259 2486 sjacqu01
   *
260 2486 sjacqu01
   * @par
261 2486 sjacqu01
   * Getting the current option value:
262 2486 sjacqu01
   * @code
263 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
264 2486 sjacqu01
   * ...
265 2486 sjacqu01
   * boost::asio::socket_base::send_low_watermark option;
266 2486 sjacqu01
   * socket.get_option(option);
267 2486 sjacqu01
   * int size = option.value();
268 2486 sjacqu01
   * @endcode
269 2486 sjacqu01
   *
270 2486 sjacqu01
   * @par Concepts:
271 2486 sjacqu01
   * Socket_Option, Integer_Socket_Option.
272 2486 sjacqu01
   */
273 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
274 2486 sjacqu01
  typedef implementation_defined send_low_watermark;
275 2486 sjacqu01
#else
276 2486 sjacqu01
  typedef boost::asio::detail::socket_option::integer<
277 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDLOWAT)>
278 2486 sjacqu01
      send_low_watermark;
279 2486 sjacqu01
#endif
280 2486 sjacqu01
281 2486 sjacqu01
  /// Socket option for the receive buffer size of a socket.
282 2486 sjacqu01
  /**
283 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_RCVBUF socket option.
284 2486 sjacqu01
   *
285 2486 sjacqu01
   * @par Examples
286 2486 sjacqu01
   * Setting the option:
287 2486 sjacqu01
   * @code
288 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
289 2486 sjacqu01
   * ...
290 2486 sjacqu01
   * boost::asio::socket_base::receive_buffer_size option(8192);
291 2486 sjacqu01
   * socket.set_option(option);
292 2486 sjacqu01
   * @endcode
293 2486 sjacqu01
   *
294 2486 sjacqu01
   * @par
295 2486 sjacqu01
   * Getting the current option value:
296 2486 sjacqu01
   * @code
297 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
298 2486 sjacqu01
   * ...
299 2486 sjacqu01
   * boost::asio::socket_base::receive_buffer_size option;
300 2486 sjacqu01
   * socket.get_option(option);
301 2486 sjacqu01
   * int size = option.value();
302 2486 sjacqu01
   * @endcode
303 2486 sjacqu01
   *
304 2486 sjacqu01
   * @par Concepts:
305 2486 sjacqu01
   * Socket_Option, Integer_Socket_Option.
306 2486 sjacqu01
   */
307 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
308 2486 sjacqu01
  typedef implementation_defined receive_buffer_size;
309 2486 sjacqu01
#else
310 2486 sjacqu01
  typedef boost::asio::detail::socket_option::integer<
311 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVBUF)>
312 2486 sjacqu01
      receive_buffer_size;
313 2486 sjacqu01
#endif
314 2486 sjacqu01
315 2486 sjacqu01
  /// Socket option for the receive low watermark.
316 2486 sjacqu01
  /**
317 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_RCVLOWAT socket option.
318 2486 sjacqu01
   *
319 2486 sjacqu01
   * @par Examples
320 2486 sjacqu01
   * Setting the option:
321 2486 sjacqu01
   * @code
322 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
323 2486 sjacqu01
   * ...
324 2486 sjacqu01
   * boost::asio::socket_base::receive_low_watermark option(1024);
325 2486 sjacqu01
   * socket.set_option(option);
326 2486 sjacqu01
   * @endcode
327 2486 sjacqu01
   *
328 2486 sjacqu01
   * @par
329 2486 sjacqu01
   * Getting the current option value:
330 2486 sjacqu01
   * @code
331 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
332 2486 sjacqu01
   * ...
333 2486 sjacqu01
   * boost::asio::socket_base::receive_low_watermark option;
334 2486 sjacqu01
   * socket.get_option(option);
335 2486 sjacqu01
   * int size = option.value();
336 2486 sjacqu01
   * @endcode
337 2486 sjacqu01
   *
338 2486 sjacqu01
   * @par Concepts:
339 2486 sjacqu01
   * Socket_Option, Integer_Socket_Option.
340 2486 sjacqu01
   */
341 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
342 2486 sjacqu01
  typedef implementation_defined receive_low_watermark;
343 2486 sjacqu01
#else
344 2486 sjacqu01
  typedef boost::asio::detail::socket_option::integer<
345 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVLOWAT)>
346 2486 sjacqu01
      receive_low_watermark;
347 2486 sjacqu01
#endif
348 2486 sjacqu01
349 2486 sjacqu01
  /// Socket option to allow the socket to be bound to an address that is
350 2486 sjacqu01
  /// already in use.
351 2486 sjacqu01
  /**
352 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_REUSEADDR socket option.
353 2486 sjacqu01
   *
354 2486 sjacqu01
   * @par Examples
355 2486 sjacqu01
   * Setting the option:
356 2486 sjacqu01
   * @code
357 2486 sjacqu01
   * boost::asio::ip::tcp::acceptor acceptor(io_service);
358 2486 sjacqu01
   * ...
359 2486 sjacqu01
   * boost::asio::socket_base::reuse_address option(true);
360 2486 sjacqu01
   * acceptor.set_option(option);
361 2486 sjacqu01
   * @endcode
362 2486 sjacqu01
   *
363 2486 sjacqu01
   * @par
364 2486 sjacqu01
   * Getting the current option value:
365 2486 sjacqu01
   * @code
366 2486 sjacqu01
   * boost::asio::ip::tcp::acceptor acceptor(io_service);
367 2486 sjacqu01
   * ...
368 2486 sjacqu01
   * boost::asio::socket_base::reuse_address option;
369 2486 sjacqu01
   * acceptor.get_option(option);
370 2486 sjacqu01
   * bool is_set = option.value();
371 2486 sjacqu01
   * @endcode
372 2486 sjacqu01
   *
373 2486 sjacqu01
   * @par Concepts:
374 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
375 2486 sjacqu01
   */
376 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
377 2486 sjacqu01
  typedef implementation_defined reuse_address;
378 2486 sjacqu01
#else
379 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
380 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_REUSEADDR)>
381 2486 sjacqu01
      reuse_address;
382 2486 sjacqu01
#endif
383 2486 sjacqu01
384 2486 sjacqu01
  /// Socket option to specify whether the socket lingers on close if unsent
385 2486 sjacqu01
  /// data is present.
386 2486 sjacqu01
  /**
387 2486 sjacqu01
   * Implements the SOL_SOCKET/SO_LINGER socket option.
388 2486 sjacqu01
   *
389 2486 sjacqu01
   * @par Examples
390 2486 sjacqu01
   * Setting the option:
391 2486 sjacqu01
   * @code
392 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
393 2486 sjacqu01
   * ...
394 2486 sjacqu01
   * boost::asio::socket_base::linger option(true, 30);
395 2486 sjacqu01
   * socket.set_option(option);
396 2486 sjacqu01
   * @endcode
397 2486 sjacqu01
   *
398 2486 sjacqu01
   * @par
399 2486 sjacqu01
   * Getting the current option value:
400 2486 sjacqu01
   * @code
401 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
402 2486 sjacqu01
   * ...
403 2486 sjacqu01
   * boost::asio::socket_base::linger option;
404 2486 sjacqu01
   * socket.get_option(option);
405 2486 sjacqu01
   * bool is_set = option.enabled();
406 2486 sjacqu01
   * unsigned short timeout = option.timeout();
407 2486 sjacqu01
   * @endcode
408 2486 sjacqu01
   *
409 2486 sjacqu01
   * @par Concepts:
410 2486 sjacqu01
   * Socket_Option, Linger_Socket_Option.
411 2486 sjacqu01
   */
412 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
413 2486 sjacqu01
  typedef implementation_defined linger;
414 2486 sjacqu01
#else
415 2486 sjacqu01
  typedef boost::asio::detail::socket_option::linger<
416 2486 sjacqu01
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_LINGER)>
417 2486 sjacqu01
      linger;
418 2486 sjacqu01
#endif
419 2486 sjacqu01
420 2486 sjacqu01
  /// Socket option to report aborted connections on accept.
421 2486 sjacqu01
  /**
422 2486 sjacqu01
   * Implements a custom socket option that determines whether or not an accept
423 2486 sjacqu01
   * operation is permitted to fail with boost::asio::error::connection_aborted.
424 2486 sjacqu01
   * By default the option is false.
425 2486 sjacqu01
   *
426 2486 sjacqu01
   * @par Examples
427 2486 sjacqu01
   * Setting the option:
428 2486 sjacqu01
   * @code
429 2486 sjacqu01
   * boost::asio::ip::tcp::acceptor acceptor(io_service);
430 2486 sjacqu01
   * ...
431 2486 sjacqu01
   * boost::asio::socket_base::enable_connection_aborted option(true);
432 2486 sjacqu01
   * acceptor.set_option(option);
433 2486 sjacqu01
   * @endcode
434 2486 sjacqu01
   *
435 2486 sjacqu01
   * @par
436 2486 sjacqu01
   * Getting the current option value:
437 2486 sjacqu01
   * @code
438 2486 sjacqu01
   * boost::asio::ip::tcp::acceptor acceptor(io_service);
439 2486 sjacqu01
   * ...
440 2486 sjacqu01
   * boost::asio::socket_base::enable_connection_aborted option;
441 2486 sjacqu01
   * acceptor.get_option(option);
442 2486 sjacqu01
   * bool is_set = option.value();
443 2486 sjacqu01
   * @endcode
444 2486 sjacqu01
   *
445 2486 sjacqu01
   * @par Concepts:
446 2486 sjacqu01
   * Socket_Option, Boolean_Socket_Option.
447 2486 sjacqu01
   */
448 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
449 2486 sjacqu01
  typedef implementation_defined enable_connection_aborted;
450 2486 sjacqu01
#else
451 2486 sjacqu01
  typedef boost::asio::detail::socket_option::boolean<
452 2486 sjacqu01
    boost::asio::detail::custom_socket_option_level,
453 2486 sjacqu01
    boost::asio::detail::enable_connection_aborted_option>
454 2486 sjacqu01
    enable_connection_aborted;
455 2486 sjacqu01
#endif
456 2486 sjacqu01
457 2486 sjacqu01
  /// (Deprecated: Use non_blocking().) IO control command to
458 2486 sjacqu01
  /// set the blocking mode of the socket.
459 2486 sjacqu01
  /**
460 2486 sjacqu01
   * Implements the FIONBIO IO control command.
461 2486 sjacqu01
   *
462 2486 sjacqu01
   * @par Example
463 2486 sjacqu01
   * @code
464 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
465 2486 sjacqu01
   * ...
466 2486 sjacqu01
   * boost::asio::socket_base::non_blocking_io command(true);
467 2486 sjacqu01
   * socket.io_control(command);
468 2486 sjacqu01
   * @endcode
469 2486 sjacqu01
   *
470 2486 sjacqu01
   * @par Concepts:
471 2486 sjacqu01
   * IO_Control_Command, Boolean_IO_Control_Command.
472 2486 sjacqu01
   */
473 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
474 2486 sjacqu01
  typedef implementation_defined non_blocking_io;
475 2486 sjacqu01
#else
476 2486 sjacqu01
  typedef boost::asio::detail::io_control::non_blocking_io non_blocking_io;
477 2486 sjacqu01
#endif
478 2486 sjacqu01
479 2486 sjacqu01
  /// IO control command to get the amount of data that can be read without
480 2486 sjacqu01
  /// blocking.
481 2486 sjacqu01
  /**
482 2486 sjacqu01
   * Implements the FIONREAD IO control command.
483 2486 sjacqu01
   *
484 2486 sjacqu01
   * @par Example
485 2486 sjacqu01
   * @code
486 2486 sjacqu01
   * boost::asio::ip::tcp::socket socket(io_service);
487 2486 sjacqu01
   * ...
488 2486 sjacqu01
   * boost::asio::socket_base::bytes_readable command(true);
489 2486 sjacqu01
   * socket.io_control(command);
490 2486 sjacqu01
   * std::size_t bytes_readable = command.get();
491 2486 sjacqu01
   * @endcode
492 2486 sjacqu01
   *
493 2486 sjacqu01
   * @par Concepts:
494 2486 sjacqu01
   * IO_Control_Command, Size_IO_Control_Command.
495 2486 sjacqu01
   */
496 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
497 2486 sjacqu01
  typedef implementation_defined bytes_readable;
498 2486 sjacqu01
#else
499 2486 sjacqu01
  typedef boost::asio::detail::io_control::bytes_readable bytes_readable;
500 2486 sjacqu01
#endif
501 2486 sjacqu01
502 2486 sjacqu01
  /// The maximum length of the queue of pending incoming connections.
503 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
504 2486 sjacqu01
  static const int max_connections = implementation_defined;
505 2486 sjacqu01
#else
506 2486 sjacqu01
  BOOST_ASIO_STATIC_CONSTANT(int, max_connections
507 2486 sjacqu01
      = BOOST_ASIO_OS_DEF(SOMAXCONN));
508 2486 sjacqu01
#endif
509 2486 sjacqu01
510 2486 sjacqu01
protected:
511 2486 sjacqu01
  /// Protected destructor to prevent deletion through this type.
512 2486 sjacqu01
  ~socket_base()
513 2486 sjacqu01
  {
514 2486 sjacqu01
  }
515 2486 sjacqu01
};
516 2486 sjacqu01
517 2486 sjacqu01
} // namespace asio
518 2486 sjacqu01
} // namespace boost
519 2486 sjacqu01
520 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
521 2486 sjacqu01
522 2486 sjacqu01
#endif // BOOST_ASIO_SOCKET_BASE_HPP