Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:00

0001 //
0002 // ip/resolver_base.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_IP_RESOLVER_BASE_HPP
0012 #define BOOST_ASIO_IP_RESOLVER_BASE_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/socket_types.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace ip {
0026 
0027 /// The resolver_base class is used as a base for the basic_resolver class
0028 /// templates to provide a common place to define the flag constants.
0029 class resolver_base
0030 {
0031 public:
0032 #if defined(GENERATING_DOCUMENTATION)
0033   /// A bitmask type (C++ Std [lib.bitmask.types]).
0034   typedef unspecified flags;
0035 
0036   /// Determine the canonical name of the host specified in the query.
0037   static const flags canonical_name = implementation_defined;
0038 
0039   /// Indicate that returned endpoint is intended for use as a locally bound
0040   /// socket endpoint.
0041   static const flags passive = implementation_defined;
0042 
0043   /// Host name should be treated as a numeric string defining an IPv4 or IPv6
0044   /// address and no name resolution should be attempted.
0045   static const flags numeric_host = implementation_defined;
0046 
0047   /// Service name should be treated as a numeric string defining a port number
0048   /// and no name resolution should be attempted.
0049   static const flags numeric_service = implementation_defined;
0050 
0051   /// If the query protocol family is specified as IPv6, return IPv4-mapped
0052   /// IPv6 addresses on finding no IPv6 addresses.
0053   static const flags v4_mapped = implementation_defined;
0054 
0055   /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
0056   static const flags all_matching = implementation_defined;
0057 
0058   /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
0059   /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
0060   /// is configured for the system.
0061   static const flags address_configured = implementation_defined;
0062 #else
0063   enum flags
0064   {
0065     canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME),
0066     passive = BOOST_ASIO_OS_DEF(AI_PASSIVE),
0067     numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST),
0068     numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV),
0069     v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED),
0070     all_matching = BOOST_ASIO_OS_DEF(AI_ALL),
0071     address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG)
0072   };
0073 
0074   // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
0075 
0076   friend flags operator&(flags x, flags y)
0077   {
0078     return static_cast<flags>(
0079         static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
0080   }
0081 
0082   friend flags operator|(flags x, flags y)
0083   {
0084     return static_cast<flags>(
0085         static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
0086   }
0087 
0088   friend flags operator^(flags x, flags y)
0089   {
0090     return static_cast<flags>(
0091         static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
0092   }
0093 
0094   friend flags operator~(flags x)
0095   {
0096     return static_cast<flags>(~static_cast<unsigned int>(x));
0097   }
0098 
0099   friend flags& operator&=(flags& x, flags y)
0100   {
0101     x = x & y;
0102     return x;
0103   }
0104 
0105   friend flags& operator|=(flags& x, flags y)
0106   {
0107     x = x | y;
0108     return x;
0109   }
0110 
0111   friend flags& operator^=(flags& x, flags y)
0112   {
0113     x = x ^ y;
0114     return x;
0115   }
0116 #endif
0117 
0118 protected:
0119   /// Protected destructor to prevent deletion through this type.
0120   ~resolver_base()
0121   {
0122   }
0123 };
0124 
0125 } // namespace ip
0126 } // namespace asio
0127 } // namespace boost
0128 
0129 #include <boost/asio/detail/pop_options.hpp>
0130 
0131 #endif // BOOST_ASIO_IP_RESOLVER_BASE_HPP