Chris@16: // Chris@16: // ip/resolver_query_base.hpp Chris@16: // ~~~~~~~~~~~~~~~~~~~~~~~~~~ Chris@16: // Chris@101: // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: Chris@16: #ifndef BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP Chris@16: #define BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace asio { Chris@16: namespace ip { Chris@16: Chris@16: /// The resolver_query_base class is used as a base for the Chris@16: /// basic_resolver_query class templates to provide a common place to define Chris@16: /// the flag constants. Chris@16: class resolver_query_base Chris@16: { Chris@16: public: Chris@16: #if defined(GENERATING_DOCUMENTATION) Chris@16: /// A bitmask type (C++ Std [lib.bitmask.types]). Chris@16: typedef unspecified flags; Chris@16: Chris@16: /// Determine the canonical name of the host specified in the query. Chris@16: static const flags canonical_name = implementation_defined; Chris@16: Chris@16: /// Indicate that returned endpoint is intended for use as a locally bound Chris@16: /// socket endpoint. Chris@16: static const flags passive = implementation_defined; Chris@16: Chris@16: /// Host name should be treated as a numeric string defining an IPv4 or IPv6 Chris@16: /// address and no name resolution should be attempted. Chris@16: static const flags numeric_host = implementation_defined; Chris@16: Chris@16: /// Service name should be treated as a numeric string defining a port number Chris@16: /// and no name resolution should be attempted. Chris@16: static const flags numeric_service = implementation_defined; Chris@16: Chris@16: /// If the query protocol family is specified as IPv6, return IPv4-mapped Chris@16: /// IPv6 addresses on finding no IPv6 addresses. Chris@16: static const flags v4_mapped = implementation_defined; Chris@16: Chris@16: /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses. Chris@16: static const flags all_matching = implementation_defined; Chris@16: Chris@16: /// Only return IPv4 addresses if a non-loopback IPv4 address is configured Chris@16: /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address Chris@16: /// is configured for the system. Chris@16: static const flags address_configured = implementation_defined; Chris@16: #else Chris@16: enum flags Chris@16: { Chris@16: canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME), Chris@16: passive = BOOST_ASIO_OS_DEF(AI_PASSIVE), Chris@16: numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST), Chris@16: numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV), Chris@16: v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED), Chris@16: all_matching = BOOST_ASIO_OS_DEF(AI_ALL), Chris@16: address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG) Chris@16: }; Chris@16: Chris@16: // Implement bitmask operations as shown in C++ Std [lib.bitmask.types]. Chris@16: Chris@16: friend flags operator&(flags x, flags y) Chris@16: { Chris@16: return static_cast( Chris@16: static_cast(x) & static_cast(y)); Chris@16: } Chris@16: Chris@16: friend flags operator|(flags x, flags y) Chris@16: { Chris@16: return static_cast( Chris@16: static_cast(x) | static_cast(y)); Chris@16: } Chris@16: Chris@16: friend flags operator^(flags x, flags y) Chris@16: { Chris@16: return static_cast( Chris@16: static_cast(x) ^ static_cast(y)); Chris@16: } Chris@16: Chris@16: friend flags operator~(flags x) Chris@16: { Chris@101: return static_cast(~static_cast(x)); Chris@16: } Chris@16: Chris@16: friend flags& operator&=(flags& x, flags y) Chris@16: { Chris@16: x = x & y; Chris@16: return x; Chris@16: } Chris@16: Chris@16: friend flags& operator|=(flags& x, flags y) Chris@16: { Chris@16: x = x | y; Chris@16: return x; Chris@16: } Chris@16: Chris@16: friend flags& operator^=(flags& x, flags y) Chris@16: { Chris@16: x = x ^ y; Chris@16: return x; Chris@16: } Chris@16: #endif Chris@16: Chris@16: protected: Chris@16: /// Protected destructor to prevent deletion through this type. Chris@16: ~resolver_query_base() Chris@16: { Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace ip Chris@16: } // namespace asio Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP