unicast.hpp 1.7 KB

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