Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.6KB

  1. //
  2. // ip/resolver_base.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. #ifndef ASIO_IP_RESOLVER_BASE_HPP
  11. #define ASIO_IP_RESOLVER_BASE_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/socket_types.hpp"
  17. #include "asio/detail/push_options.hpp"
  18. namespace asio {
  19. namespace ip {
  20. /// The resolver_base class is used as a base for the basic_resolver class
  21. /// templates to provide a common place to define the flag constants.
  22. class resolver_base
  23. {
  24. public:
  25. #if defined(GENERATING_DOCUMENTATION)
  26. /// A bitmask type (C++ Std [lib.bitmask.types]).
  27. typedef unspecified flags;
  28. /// Determine the canonical name of the host specified in the query.
  29. static const flags canonical_name = implementation_defined;
  30. /// Indicate that returned endpoint is intended for use as a locally bound
  31. /// socket endpoint.
  32. static const flags passive = implementation_defined;
  33. /// Host name should be treated as a numeric string defining an IPv4 or IPv6
  34. /// address and no name resolution should be attempted.
  35. static const flags numeric_host = implementation_defined;
  36. /// Service name should be treated as a numeric string defining a port number
  37. /// and no name resolution should be attempted.
  38. static const flags numeric_service = implementation_defined;
  39. /// If the query protocol family is specified as IPv6, return IPv4-mapped
  40. /// IPv6 addresses on finding no IPv6 addresses.
  41. static const flags v4_mapped = implementation_defined;
  42. /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
  43. static const flags all_matching = implementation_defined;
  44. /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
  45. /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
  46. /// is configured for the system.
  47. static const flags address_configured = implementation_defined;
  48. #else
  49. enum flags
  50. {
  51. canonical_name = ASIO_OS_DEF(AI_CANONNAME),
  52. passive = ASIO_OS_DEF(AI_PASSIVE),
  53. numeric_host = ASIO_OS_DEF(AI_NUMERICHOST),
  54. numeric_service = ASIO_OS_DEF(AI_NUMERICSERV),
  55. v4_mapped = ASIO_OS_DEF(AI_V4MAPPED),
  56. all_matching = ASIO_OS_DEF(AI_ALL),
  57. address_configured = ASIO_OS_DEF(AI_ADDRCONFIG)
  58. };
  59. // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
  60. friend flags operator&(flags x, flags y)
  61. {
  62. return static_cast<flags>(
  63. static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
  64. }
  65. friend flags operator|(flags x, flags y)
  66. {
  67. return static_cast<flags>(
  68. static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
  69. }
  70. friend flags operator^(flags x, flags y)
  71. {
  72. return static_cast<flags>(
  73. static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
  74. }
  75. friend flags operator~(flags x)
  76. {
  77. return static_cast<flags>(~static_cast<unsigned int>(x));
  78. }
  79. friend flags& operator&=(flags& x, flags y)
  80. {
  81. x = x & y;
  82. return x;
  83. }
  84. friend flags& operator|=(flags& x, flags y)
  85. {
  86. x = x | y;
  87. return x;
  88. }
  89. friend flags& operator^=(flags& x, flags y)
  90. {
  91. x = x ^ y;
  92. return x;
  93. }
  94. #endif
  95. protected:
  96. /// Protected destructor to prevent deletion through this type.
  97. ~resolver_base()
  98. {
  99. }
  100. };
  101. } // namespace ip
  102. } // namespace asio
  103. #include "asio/detail/pop_options.hpp"
  104. #endif // ASIO_IP_RESOLVER_BASE_HPP