2 // ip/resolver_base.hpp
3 // ~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_IP_RESOLVER_BASE_HPP
12 #define BOOST_ASIO_IP_RESOLVER_BASE_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/socket_types.hpp>
21 #include <boost/asio/detail/push_options.hpp>
27 /// The resolver_base class is used as a base for the basic_resolver class
28 /// templates to provide a common place to define the flag constants.
32 #if defined(GENERATING_DOCUMENTATION)
33 /// A bitmask type (C++ Std [lib.bitmask.types]).
34 typedef unspecified flags;
36 /// Determine the canonical name of the host specified in the query.
37 static const flags canonical_name = implementation_defined;
39 /// Indicate that returned endpoint is intended for use as a locally bound
41 static const flags passive = implementation_defined;
43 /// Host name should be treated as a numeric string defining an IPv4 or IPv6
44 /// address and no name resolution should be attempted.
45 static const flags numeric_host = implementation_defined;
47 /// Service name should be treated as a numeric string defining a port number
48 /// and no name resolution should be attempted.
49 static const flags numeric_service = implementation_defined;
51 /// If the query protocol family is specified as IPv6, return IPv4-mapped
52 /// IPv6 addresses on finding no IPv6 addresses.
53 static const flags v4_mapped = implementation_defined;
55 /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
56 static const flags all_matching = implementation_defined;
58 /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
59 /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
60 /// is configured for the system.
61 static const flags address_configured = implementation_defined;
65 canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME),
66 passive = BOOST_ASIO_OS_DEF(AI_PASSIVE),
67 numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST),
68 numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV),
69 v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED),
70 all_matching = BOOST_ASIO_OS_DEF(AI_ALL),
71 address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG)
74 // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
76 friend flags operator&(flags x, flags y)
78 return static_cast<flags>(
79 static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
82 friend flags operator|(flags x, flags y)
84 return static_cast<flags>(
85 static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
88 friend flags operator^(flags x, flags y)
90 return static_cast<flags>(
91 static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
94 friend flags operator~(flags x)
96 return static_cast<flags>(~static_cast<unsigned int>(x));
99 friend flags& operator&=(flags& x, flags y)
105 friend flags& operator|=(flags& x, flags y)
111 friend flags& operator^=(flags& x, flags y)
119 /// Protected destructor to prevent deletion through this type.
129 #include <boost/asio/detail/pop_options.hpp>
131 #endif // BOOST_ASIO_IP_RESOLVER_BASE_HPP