Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:33:34

0001 //
0002 // ip/v6_only.hpp
0003 // ~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_IP_V6_ONLY_HPP
0012 #define BOOST_ASIO_IP_V6_ONLY_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/socket_option.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace ip {
0026 
0027 /// Socket option for determining whether an IPv6 socket supports IPv6
0028 /// communication only.
0029 /**
0030  * Implements the IPPROTO_IPV6/IPV6_V6ONLY socket option.
0031  *
0032  * @par Examples
0033  * Setting the option:
0034  * @code
0035  * boost::asio::ip::tcp::socket socket(my_context);
0036  * ...
0037  * boost::asio::ip::v6_only option(true);
0038  * socket.set_option(option);
0039  * @endcode
0040  *
0041  * @par
0042  * Getting the current option value:
0043  * @code
0044  * boost::asio::ip::tcp::socket socket(my_context);
0045  * ...
0046  * boost::asio::ip::v6_only option;
0047  * socket.get_option(option);
0048  * bool v6_only = option.value();
0049  * @endcode
0050  *
0051  * @par Concepts:
0052  * GettableSocketOption, SettableSocketOption.
0053  */
0054 #if defined(GENERATING_DOCUMENTATION)
0055 typedef implementation_defined v6_only;
0056 #elif defined(IPV6_V6ONLY)
0057 typedef boost::asio::detail::socket_option::boolean<
0058     IPPROTO_IPV6, IPV6_V6ONLY> v6_only;
0059 #else
0060 typedef boost::asio::detail::socket_option::boolean<
0061     boost::asio::detail::custom_socket_option_level,
0062     boost::asio::detail::always_fail_option> v6_only;
0063 #endif
0064 
0065 } // namespace ip
0066 } // namespace asio
0067 } // namespace boost
0068 
0069 #include <boost/asio/detail/pop_options.hpp>
0070 
0071 #endif // BOOST_ASIO_IP_V6_ONLY_HPP