resolver_query_base.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // resolver_query_base.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_RESOLVER_QUERY_BASE_HPP
  11. #define BOOST_ASIO_IP_RESOLVER_QUERY_BASE_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 <boost/config.hpp>
  18. #include <boost/detail/workaround.hpp>
  19. #include <boost/asio/detail/pop_options.hpp>
  20. #include <boost/asio/detail/socket_types.hpp>
  21. namespace boost {
  22. namespace asio {
  23. namespace ip {
  24. /// The resolver_query_base class is used as a base for the
  25. /// basic_resolver_query class templates to provide a common place to define
  26. /// the flag constants.
  27. class resolver_query_base
  28. {
  29. public:
  30. #if defined(GENERATING_DOCUMENTATION)
  31. /// Determine the canonical name of the host specified in the query.
  32. static const int canonical_name = implementation_defined;
  33. /// Indicate that returned endpoint is intended for use as a locally bound
  34. /// socket endpoint.
  35. static const int passive = implementation_defined;
  36. /// Host name should be treated as a numeric string defining an IPv4 or IPv6
  37. /// address and no name resolution should be attempted.
  38. static const int numeric_host = implementation_defined;
  39. /// Service name should be treated as a numeric string defining a port number
  40. /// and no name resolution should be attempted.
  41. static const int numeric_service = implementation_defined;
  42. /// If the query protocol family is specified as IPv6, return IPv4-mapped
  43. /// IPv6 addresses on finding no IPv6 addresses.
  44. static const int v4_mapped = implementation_defined;
  45. /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
  46. static const int all_matching = implementation_defined;
  47. /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
  48. /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
  49. /// is configured for the system.
  50. static const int address_configured = implementation_defined;
  51. #else
  52. BOOST_STATIC_CONSTANT(int, canonical_name = AI_CANONNAME);
  53. BOOST_STATIC_CONSTANT(int, passive = AI_PASSIVE);
  54. BOOST_STATIC_CONSTANT(int, numeric_host = AI_NUMERICHOST);
  55. # if defined(AI_NUMERICSERV)
  56. BOOST_STATIC_CONSTANT(int, numeric_service = AI_NUMERICSERV);
  57. # else
  58. BOOST_STATIC_CONSTANT(int, numeric_service = 0);
  59. # endif
  60. // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but
  61. // does not implement them. Therefore they are specifically excluded here.
  62. # if defined(AI_V4MAPPED) && !defined(__QNXNTO__)
  63. BOOST_STATIC_CONSTANT(int, v4_mapped = AI_V4MAPPED);
  64. # else
  65. BOOST_STATIC_CONSTANT(int, v4_mapped = 0);
  66. # endif
  67. # if defined(AI_ALL) && !defined(__QNXNTO__)
  68. BOOST_STATIC_CONSTANT(int, all_matching = AI_ALL);
  69. # else
  70. BOOST_STATIC_CONSTANT(int, all_matching = 0);
  71. # endif
  72. # if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__)
  73. BOOST_STATIC_CONSTANT(int, address_configured = AI_ADDRCONFIG);
  74. # else
  75. BOOST_STATIC_CONSTANT(int, address_configured = 0);
  76. # endif
  77. #endif
  78. protected:
  79. /// Protected destructor to prevent deletion through this type.
  80. ~resolver_query_base()
  81. {
  82. }
  83. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  84. private:
  85. // Workaround to enable the empty base optimisation with Borland C++.
  86. char dummy_;
  87. #endif
  88. };
  89. } // namespace ip
  90. } // namespace asio
  91. } // namespace boost
  92. #include <boost/asio/detail/pop_options.hpp>
  93. #endif // BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP