$search
00001 // 00002 // socket_base.hpp 00003 // ~~~~~~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 // 00010 00011 #ifndef ASIO_SOCKET_BASE_HPP 00012 #define ASIO_SOCKET_BASE_HPP 00013 00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00015 # pragma once 00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 00017 00018 #include "asio/detail/push_options.hpp" 00019 00020 #include "asio/detail/push_options.hpp" 00021 #include <boost/config.hpp> 00022 #include <boost/detail/workaround.hpp> 00023 #include "asio/detail/pop_options.hpp" 00024 00025 #include "asio/detail/io_control.hpp" 00026 #include "asio/detail/socket_option.hpp" 00027 #include "asio/detail/socket_types.hpp" 00028 00029 namespace asio { 00030 00034 class socket_base 00035 { 00036 public: 00038 enum shutdown_type 00039 { 00040 #if defined(GENERATING_DOCUMENTATION) 00041 00042 shutdown_receive = implementation_defined, 00043 00045 shutdown_send = implementation_defined, 00046 00048 shutdown_both = implementation_defined 00049 #else 00050 shutdown_receive = asio::detail::shutdown_receive, 00051 shutdown_send = asio::detail::shutdown_send, 00052 shutdown_both = asio::detail::shutdown_both 00053 #endif 00054 }; 00055 00057 typedef int message_flags; 00058 00059 #if defined(GENERATING_DOCUMENTATION) 00060 00061 static const int message_peek = implementation_defined; 00062 00064 static const int message_out_of_band = implementation_defined; 00065 00067 static const int message_do_not_route = implementation_defined; 00068 #else 00069 BOOST_STATIC_CONSTANT(int, 00070 message_peek = asio::detail::message_peek); 00071 BOOST_STATIC_CONSTANT(int, 00072 message_out_of_band = asio::detail::message_out_of_band); 00073 BOOST_STATIC_CONSTANT(int, 00074 message_do_not_route = asio::detail::message_do_not_route); 00075 #endif 00076 00078 00103 #if defined(GENERATING_DOCUMENTATION) 00104 typedef implementation_defined broadcast; 00105 #else 00106 typedef asio::detail::socket_option::boolean< 00107 SOL_SOCKET, SO_BROADCAST> broadcast; 00108 #endif 00109 00111 00136 #if defined(GENERATING_DOCUMENTATION) 00137 typedef implementation_defined debug; 00138 #else 00139 typedef asio::detail::socket_option::boolean< 00140 SOL_SOCKET, SO_DEBUG> debug; 00141 #endif 00142 00144 00169 #if defined(GENERATING_DOCUMENTATION) 00170 typedef implementation_defined do_not_route; 00171 #else 00172 typedef asio::detail::socket_option::boolean< 00173 SOL_SOCKET, SO_DONTROUTE> do_not_route; 00174 #endif 00175 00177 00202 #if defined(GENERATING_DOCUMENTATION) 00203 typedef implementation_defined keep_alive; 00204 #else 00205 typedef asio::detail::socket_option::boolean< 00206 SOL_SOCKET, SO_KEEPALIVE> keep_alive; 00207 #endif 00208 00210 00235 #if defined(GENERATING_DOCUMENTATION) 00236 typedef implementation_defined send_buffer_size; 00237 #else 00238 typedef asio::detail::socket_option::integer< 00239 SOL_SOCKET, SO_SNDBUF> send_buffer_size; 00240 #endif 00241 00243 00268 #if defined(GENERATING_DOCUMENTATION) 00269 typedef implementation_defined send_low_watermark; 00270 #else 00271 typedef asio::detail::socket_option::integer< 00272 SOL_SOCKET, SO_SNDLOWAT> send_low_watermark; 00273 #endif 00274 00276 00301 #if defined(GENERATING_DOCUMENTATION) 00302 typedef implementation_defined receive_buffer_size; 00303 #else 00304 typedef asio::detail::socket_option::integer< 00305 SOL_SOCKET, SO_RCVBUF> receive_buffer_size; 00306 #endif 00307 00309 00334 #if defined(GENERATING_DOCUMENTATION) 00335 typedef implementation_defined receive_low_watermark; 00336 #else 00337 typedef asio::detail::socket_option::integer< 00338 SOL_SOCKET, SO_RCVLOWAT> receive_low_watermark; 00339 #endif 00340 00343 00368 #if defined(GENERATING_DOCUMENTATION) 00369 typedef implementation_defined reuse_address; 00370 #else 00371 typedef asio::detail::socket_option::boolean< 00372 SOL_SOCKET, SO_REUSEADDR> reuse_address; 00373 #endif 00374 00377 00403 #if defined(GENERATING_DOCUMENTATION) 00404 typedef implementation_defined linger; 00405 #else 00406 typedef asio::detail::socket_option::linger< 00407 SOL_SOCKET, SO_LINGER> linger; 00408 #endif 00409 00411 00438 #if defined(GENERATING_DOCUMENTATION) 00439 typedef implementation_defined enable_connection_aborted; 00440 #else 00441 typedef asio::detail::socket_option::boolean< 00442 asio::detail::custom_socket_option_level, 00443 asio::detail::enable_connection_aborted_option> 00444 enable_connection_aborted; 00445 #endif 00446 00448 00462 #if defined(GENERATING_DOCUMENTATION) 00463 typedef implementation_defined non_blocking_io; 00464 #else 00465 typedef asio::detail::io_control::non_blocking_io non_blocking_io; 00466 #endif 00467 00470 00485 #if defined(GENERATING_DOCUMENTATION) 00486 typedef implementation_defined bytes_readable; 00487 #else 00488 typedef asio::detail::io_control::bytes_readable bytes_readable; 00489 #endif 00490 00492 #if defined(GENERATING_DOCUMENTATION) 00493 static const int max_connections = implementation_defined; 00494 #else 00495 BOOST_STATIC_CONSTANT(int, max_connections = SOMAXCONN); 00496 #endif 00497 00498 protected: 00500 ~socket_base() 00501 { 00502 } 00503 00504 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 00505 private: 00506 // Workaround to enable the empty base optimisation with Borland C++. 00507 char dummy_; 00508 #endif 00509 }; 00510 00511 } // namespace asio 00512 00513 #include "asio/detail/pop_options.hpp" 00514 00515 #endif // ASIO_SOCKET_BASE_HPP