Clementine
socket_base.hpp
1 //
2 // socket_base.hpp
3 // ~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 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_SOCKET_BASE_HPP
12 #define ASIO_SOCKET_BASE_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/config.hpp"
19 #include "asio/detail/io_control.hpp"
20 #include "asio/detail/socket_option.hpp"
21 #include "asio/detail/socket_types.hpp"
22 
23 #include "asio/detail/push_options.hpp"
24 
25 namespace asio {
26 
31 {
32 public:
35  {
36 #if defined(GENERATING_DOCUMENTATION)
37  shutdown_receive = implementation_defined,
39 
41  shutdown_send = implementation_defined,
42 
44  shutdown_both = implementation_defined
45 #else
46  shutdown_receive = ASIO_OS_DEF(SHUT_RD),
47  shutdown_send = ASIO_OS_DEF(SHUT_WR),
48  shutdown_both = ASIO_OS_DEF(SHUT_RDWR)
49 #endif
50  };
51 
53  typedef int message_flags;
54 
55 #if defined(GENERATING_DOCUMENTATION)
56  static const int message_peek = implementation_defined;
58 
60  static const int message_out_of_band = implementation_defined;
61 
63  static const int message_do_not_route = implementation_defined;
64 
66  static const int message_end_of_record = implementation_defined;
67 #else
68  ASIO_STATIC_CONSTANT(int,
69  message_peek = ASIO_OS_DEF(MSG_PEEK));
70  ASIO_STATIC_CONSTANT(int,
71  message_out_of_band = ASIO_OS_DEF(MSG_OOB));
72  ASIO_STATIC_CONSTANT(int,
73  message_do_not_route = ASIO_OS_DEF(MSG_DONTROUTE));
74  ASIO_STATIC_CONSTANT(int,
75  message_end_of_record = ASIO_OS_DEF(MSG_EOR));
76 #endif
77 
79 
82  enum wait_type
83  {
86 
89 
92  };
93 
95 
120 #if defined(GENERATING_DOCUMENTATION)
121  typedef implementation_defined broadcast;
122 #else
124  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_BROADCAST)>
126 #endif
127 
129 
154 #if defined(GENERATING_DOCUMENTATION)
155  typedef implementation_defined debug;
156 #else
158  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DEBUG)> debug;
159 #endif
160 
162 
187 #if defined(GENERATING_DOCUMENTATION)
188  typedef implementation_defined do_not_route;
189 #else
191  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DONTROUTE)>
193 #endif
194 
196 
221 #if defined(GENERATING_DOCUMENTATION)
222  typedef implementation_defined keep_alive;
223 #else
225  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive;
226 #endif
227 
229 
254 #if defined(GENERATING_DOCUMENTATION)
255  typedef implementation_defined send_buffer_size;
256 #else
258  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDBUF)>
260 #endif
261 
263 
288 #if defined(GENERATING_DOCUMENTATION)
289  typedef implementation_defined send_low_watermark;
290 #else
292  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDLOWAT)>
294 #endif
295 
297 
322 #if defined(GENERATING_DOCUMENTATION)
323  typedef implementation_defined receive_buffer_size;
324 #else
326  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVBUF)>
328 #endif
329 
331 
356 #if defined(GENERATING_DOCUMENTATION)
357  typedef implementation_defined receive_low_watermark;
358 #else
360  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVLOWAT)>
362 #endif
363 
366 
391 #if defined(GENERATING_DOCUMENTATION)
392  typedef implementation_defined reuse_address;
393 #else
395  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_REUSEADDR)>
397 #endif
398 
401 
427 #if defined(GENERATING_DOCUMENTATION)
428  typedef implementation_defined linger;
429 #else
431  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_LINGER)>
433 #endif
434 
436 
461 #if defined(GENERATING_DOCUMENTATION)
462  typedef implementation_defined out_of_band_inline;
463 #else
465  ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_OOBINLINE)>
467 #endif
468 
470 
497 #if defined(GENERATING_DOCUMENTATION)
498  typedef implementation_defined enable_connection_aborted;
499 #else
501  asio::detail::custom_socket_option_level,
502  asio::detail::enable_connection_aborted_option>
504 #endif
505 
508 
523 #if defined(GENERATING_DOCUMENTATION)
524  typedef implementation_defined bytes_readable;
525 #else
527 #endif
528 
530 #if defined(GENERATING_DOCUMENTATION)
531  static const int max_listen_connections = implementation_defined;
532 #else
533  ASIO_STATIC_CONSTANT(int, max_listen_connections
534  = ASIO_OS_DEF(SOMAXCONN));
535 #endif
536 
537 #if !defined(ASIO_NO_DEPRECATED)
538 #if defined(GENERATING_DOCUMENTATION)
541  static const int max_connections = implementation_defined;
542 #else
543  ASIO_STATIC_CONSTANT(int, max_connections
544  = ASIO_OS_DEF(SOMAXCONN));
545 #endif
546 #endif // !defined(ASIO_NO_DEPRECATED)
547 
548 protected:
551  {
552  }
553 };
554 
555 } // namespace asio
556 
557 #include "asio/detail/pop_options.hpp"
558 
559 #endif // ASIO_SOCKET_BASE_HPP
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_REUSEADDR)> reuse_address
Socket option to allow the socket to be bound to an address that is already in use.
Definition: socket_base.hpp:396
int message_flags
Bitmask type for flags that can be passed to send and receive operations.
Definition: socket_base.hpp:53
Definition: socket_option.hpp:215
The socket_base class is used as a base for the basic_stream_socket and basic_datagram_socket class t...
Definition: socket_base.hpp:30
asio::detail::socket_option::linger< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_LINGER)> linger
Socket option to specify whether the socket lingers on close if unsent data is present.
Definition: socket_base.hpp:432
wait_type
Wait types.
Definition: socket_base.hpp:82
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_BROADCAST)> broadcast
Socket option to permit sending of broadcast messages.
Definition: socket_base.hpp:125
Definition: socket_option.hpp:135
Definition: socket_option.hpp:32
asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVBUF)> receive_buffer_size
Socket option for the receive buffer size of a socket.
Definition: socket_base.hpp:327
Wait for a socket to have error conditions pending.
Definition: socket_base.hpp:91
asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDBUF)> send_buffer_size
Socket option for the send buffer size of a socket.
Definition: socket_base.hpp:259
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DONTROUTE)> do_not_route
Socket option to prevent routing, use local interfaces only.
Definition: socket_base.hpp:192
asio::detail::io_control::bytes_readable bytes_readable
IO control command to get the amount of data that can be read without blocking.
Definition: socket_base.hpp:526
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_OOBINLINE)> out_of_band_inline
Socket option for putting received out-of-band data inline.
Definition: socket_base.hpp:466
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive
Socket option to send keep-alives.
Definition: socket_base.hpp:225
Definition: io_control.hpp:29
shutdown_type
Different ways a socket may be shutdown.
Definition: socket_base.hpp:34
asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDLOWAT)> send_low_watermark
Socket option for the send low watermark.
Definition: socket_base.hpp:293
~socket_base()
Protected destructor to prevent deletion through this type.
Definition: socket_base.hpp:550
Wait for a socket to become ready to write.
Definition: socket_base.hpp:88
Wait for a socket to become ready to read.
Definition: socket_base.hpp:85
asio::detail::socket_option::boolean< asio::detail::custom_socket_option_level, asio::detail::enable_connection_aborted_option > enable_connection_aborted
Socket option to report aborted connections on accept.
Definition: socket_base.hpp:503
asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVLOWAT)> receive_low_watermark
Socket option for the receive low watermark.
Definition: socket_base.hpp:361
asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DEBUG)> debug
Socket option to enable socket-level debugging.
Definition: socket_base.hpp:158
Definition: any_io_executor.hpp:28