2 // ip/resolver_query_base.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2016 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_QUERY_BASE_HPP
12 #define BOOST_ASIO_IP_RESOLVER_QUERY_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_query_base class is used as a base for the
28 /// basic_resolver_query class templates to provide a common place to define
29 /// the flag constants.
30 class resolver_query_base
33 #if defined(GENERATING_DOCUMENTATION)
34 /// A bitmask type (C++ Std [lib.bitmask.types]).
35 typedef unspecified flags;
37 /// Determine the canonical name of the host specified in the query.
38 static const flags canonical_name = implementation_defined;
40 /// Indicate that returned endpoint is intended for use as a locally bound
42 static const flags passive = implementation_defined;
44 /// Host name should be treated as a numeric string defining an IPv4 or IPv6
45 /// address and no name resolution should be attempted.
46 static const flags numeric_host = implementation_defined;
48 /// Service name should be treated as a numeric string defining a port number
49 /// and no name resolution should be attempted.
50 static const flags numeric_service = implementation_defined;
52 /// If the query protocol family is specified as IPv6, return IPv4-mapped
53 /// IPv6 addresses on finding no IPv6 addresses.
54 static const flags v4_mapped = implementation_defined;
56 /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
57 static const flags all_matching = implementation_defined;
59 /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
60 /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
61 /// is configured for the system.
62 static const flags address_configured = implementation_defined;
66 canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME),
67 passive = BOOST_ASIO_OS_DEF(AI_PASSIVE),
68 numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST),
69 numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV),
70 v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED),
71 all_matching = BOOST_ASIO_OS_DEF(AI_ALL),
72 address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG)
75 // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
77 friend flags operator&(flags x, flags y)
79 return static_cast<flags>(
80 static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
83 friend flags operator|(flags x, flags y)
85 return static_cast<flags>(
86 static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
89 friend flags operator^(flags x, flags y)
91 return static_cast<flags>(
92 static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
95 friend flags operator~(flags x)
97 return static_cast<flags>(~static_cast<unsigned int>(x));
100 friend flags& operator&=(flags& x, flags y)
106 friend flags& operator|=(flags& x, flags y)
112 friend flags& operator^=(flags& x, flags y)
120 /// Protected destructor to prevent deletion through this type.
121 ~resolver_query_base()
130 #include <boost/asio/detail/pop_options.hpp>
132 #endif // BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP