unicast.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // ip/unicast.hpp
  3. // ~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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. #ifndef BOOST_ASIO_IP_UNICAST_HPP
  11. #define BOOST_ASIO_IP_UNICAST_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <cstddef>
  17. #include <boost/asio/ip/detail/socket_option.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace ip {
  22. namespace unicast {
  23. /// Socket option for time-to-live associated with outgoing unicast packets.
  24. /**
  25. * Implements the IPPROTO_IP/IP_UNICAST_TTL socket option.
  26. *
  27. * @par Examples
  28. * Setting the option:
  29. * @code
  30. * boost::asio::ip::udp::socket socket(my_context);
  31. * ...
  32. * boost::asio::ip::unicast::hops option(4);
  33. * socket.set_option(option);
  34. * @endcode
  35. *
  36. * @par
  37. * Getting the current option value:
  38. * @code
  39. * boost::asio::ip::udp::socket socket(my_context);
  40. * ...
  41. * boost::asio::ip::unicast::hops option;
  42. * socket.get_option(option);
  43. * int ttl = option.value();
  44. * @endcode
  45. *
  46. * @par Concepts:
  47. * GettableSocketOption, SettableSocketOption.
  48. */
  49. #if defined(GENERATING_DOCUMENTATION)
  50. typedef implementation_defined hops;
  51. #else
  52. typedef boost::asio::ip::detail::socket_option::unicast_hops<
  53. BOOST_ASIO_OS_DEF(IPPROTO_IP),
  54. BOOST_ASIO_OS_DEF(IP_TTL),
  55. BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
  56. BOOST_ASIO_OS_DEF(IPV6_UNICAST_HOPS)> hops;
  57. #endif
  58. } // namespace unicast
  59. } // namespace ip
  60. } // namespace asio
  61. } // namespace boost
  62. #include <boost/asio/detail/pop_options.hpp>
  63. #endif // BOOST_ASIO_IP_UNICAST_HPP