unicast.hpp 1.6 KB

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