1//
2// ip/v6_only.hpp
3// ~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2015 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 BOOST_ASIO_IP_V6_ONLY_HPP
12#define BOOST_ASIO_IP_V6_ONLY_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19#include <boost/asio/detail/socket_option.hpp>
20
21#include <boost/asio/detail/push_options.hpp>
22
23namespace boost {
24namespace asio {
25namespace ip {
26
27/// Socket option for determining whether an IPv6 socket supports IPv6
28/// communication only.
29/**
30 * Implements the IPPROTO_IPV6/IP_V6ONLY socket option.
31 *
32 * @par Examples
33 * Setting the option:
34 * @code
35 * boost::asio::ip::tcp::socket socket(io_service);
36 * ...
37 * boost::asio::ip::v6_only option(true);
38 * socket.set_option(option);
39 * @endcode
40 *
41 * @par
42 * Getting the current option value:
43 * @code
44 * boost::asio::ip::tcp::socket socket(io_service);
45 * ...
46 * boost::asio::ip::v6_only option;
47 * socket.get_option(option);
48 * bool v6_only = option.value();
49 * @endcode
50 *
51 * @par Concepts:
52 * GettableSocketOption, SettableSocketOption.
53 */
54#if defined(GENERATING_DOCUMENTATION)
55typedef implementation_defined v6_only;
56#elif defined(IPV6_V6ONLY)
57typedef boost::asio::detail::socket_option::boolean<
58 IPPROTO_IPV6, IPV6_V6ONLY> v6_only;
59#else
60typedef boost::asio::detail::socket_option::boolean<
61 boost::asio::detail::custom_socket_option_level,
62 boost::asio::detail::always_fail_option> v6_only;
63#endif
64
65} // namespace ip
66} // namespace asio
67} // namespace boost
68
69#include <boost/asio/detail/pop_options.hpp>
70
71#endif // BOOST_ASIO_IP_V6_ONLY_HPP
72