update boost
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// ip/address.hpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
#include <boost/asio/ip/bad_address_cast.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
# include <functional>
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
# include <iosfwd>
|
||||
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
@@ -260,6 +264,24 @@ std::basic_ostream<Elem, Traits>& operator<<(
|
||||
} // namespace asio
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address>
|
||||
{
|
||||
std::size_t operator()(const boost::asio::ip::address& addr)
|
||||
const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return addr.is_v4()
|
||||
? std::hash<boost::asio::ip::address_v4>()(addr.to_v4())
|
||||
: std::hash<boost::asio::ip::address_v6>()(addr.to_v6());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#include <boost/asio/detail/pop_options.hpp>
|
||||
|
||||
#include <boost/asio/ip/impl/address.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v4.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -24,6 +24,10 @@
|
||||
#include <boost/asio/detail/winsock_init.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
# include <functional>
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
# include <iosfwd>
|
||||
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
@@ -61,15 +65,31 @@ public:
|
||||
#endif
|
||||
|
||||
/// Default constructor.
|
||||
/**
|
||||
* Initialises the @c address_v4 object such that:
|
||||
* @li <tt>to_bytes()</tt> yields <tt>{0, 0, 0, 0}</tt>; and
|
||||
* @li <tt>to_uint() == 0</tt>.
|
||||
*/
|
||||
address_v4() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
addr_.s_addr = 0;
|
||||
}
|
||||
|
||||
/// Construct an address from raw bytes.
|
||||
/**
|
||||
* Initialises the @c address_v4 object such that <tt>to_bytes() ==
|
||||
* bytes</tt>.
|
||||
*
|
||||
* @throws out_of_range Thrown if any element in @c bytes is not in the range
|
||||
* <tt>0 - 0xFF</tt>. Note that no range checking is required for platforms
|
||||
* where <tt>std::numeric_limits<unsigned char>::max()</tt> is <tt>0xFF</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL explicit address_v4(const bytes_type& bytes);
|
||||
|
||||
/// Construct an address from an unsigned integer in host byte order.
|
||||
/**
|
||||
* Initialises the @c address_v4 object such that <tt>to_uint() == addr</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL explicit address_v4(uint_type addr);
|
||||
|
||||
/// Copy constructor.
|
||||
@@ -105,11 +125,12 @@ public:
|
||||
/// Get the address in bytes, in network byte order.
|
||||
BOOST_ASIO_DECL bytes_type to_bytes() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Get the address as an unsigned integer in host byte order
|
||||
/// Get the address as an unsigned integer in host byte order.
|
||||
BOOST_ASIO_DECL uint_type to_uint() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
/// Get the address as an unsigned long in host byte order
|
||||
/// (Deprecated: Use to_uint().) Get the address as an unsigned long in host
|
||||
/// byte order.
|
||||
BOOST_ASIO_DECL unsigned long to_ulong() const;
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
@@ -141,9 +162,22 @@ public:
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Determine whether the address is a loopback address.
|
||||
/**
|
||||
* This function tests whether the address is in the address block
|
||||
* <tt>127.0.0.0/8</tt>, which corresponds to the address range
|
||||
* <tt>127.0.0.0 - 127.255.255.255</tt>.
|
||||
*
|
||||
* @returns <tt>(to_uint() & 0xFF000000) == 0x7F000000</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL bool is_loopback() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Determine whether the address is unspecified.
|
||||
/**
|
||||
* This function tests whether the address is the unspecified address
|
||||
* <tt>0.0.0.0</tt>.
|
||||
*
|
||||
* @returns <tt>to_uint() == 0</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL bool is_unspecified() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
@@ -161,6 +195,13 @@ public:
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Determine whether the address is a multicast address.
|
||||
/**
|
||||
* This function tests whether the address is in the multicast address block
|
||||
* <tt>224.0.0.0/4</tt>, which corresponds to the address range
|
||||
* <tt>224.0.0.0 - 239.255.255.255</tt>.
|
||||
*
|
||||
* @returns <tt>(to_uint() & 0xF0000000) == 0xE0000000</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL bool is_multicast() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Compare two addresses for equality.
|
||||
@@ -178,6 +219,11 @@ public:
|
||||
}
|
||||
|
||||
/// Compare addresses for ordering.
|
||||
/**
|
||||
* Compares two addresses in host byte order.
|
||||
*
|
||||
* @returns <tt>a1.to_uint() < a2.to_uint()</tt>.
|
||||
*/
|
||||
friend bool operator<(const address_v4& a1,
|
||||
const address_v4& a2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
@@ -185,6 +231,11 @@ public:
|
||||
}
|
||||
|
||||
/// Compare addresses for ordering.
|
||||
/**
|
||||
* Compares two addresses in host byte order.
|
||||
*
|
||||
* @returns <tt>a1.to_uint() > a2.to_uint()</tt>.
|
||||
*/
|
||||
friend bool operator>(const address_v4& a1,
|
||||
const address_v4& a2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
@@ -192,6 +243,11 @@ public:
|
||||
}
|
||||
|
||||
/// Compare addresses for ordering.
|
||||
/**
|
||||
* Compares two addresses in host byte order.
|
||||
*
|
||||
* @returns <tt>a1.to_uint() <= a2.to_uint()</tt>.
|
||||
*/
|
||||
friend bool operator<=(const address_v4& a1,
|
||||
const address_v4& a2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
@@ -199,6 +255,11 @@ public:
|
||||
}
|
||||
|
||||
/// Compare addresses for ordering.
|
||||
/**
|
||||
* Compares two addresses in host byte order.
|
||||
*
|
||||
* @returns <tt>a1.to_uint() >= a2.to_uint()</tt>.
|
||||
*/
|
||||
friend bool operator>=(const address_v4& a1,
|
||||
const address_v4& a2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
@@ -206,18 +267,36 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an address object that represents any address.
|
||||
/**
|
||||
* This functions returns an address that represents the "any" address
|
||||
* <tt>0.0.0.0</tt>.
|
||||
*
|
||||
* @returns A default-constructed @c address_v4 object.
|
||||
*/
|
||||
static address_v4 any() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return address_v4();
|
||||
}
|
||||
|
||||
/// Obtain an address object that represents the loopback address.
|
||||
/**
|
||||
* This function returns an address that represents the well-known loopback
|
||||
* address <tt>127.0.0.1</tt>.
|
||||
*
|
||||
* @returns <tt>address_v4(0x7F000001)</tt>.
|
||||
*/
|
||||
static address_v4 loopback() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return address_v4(0x7F000001);
|
||||
}
|
||||
|
||||
/// Obtain an address object that represents the broadcast address.
|
||||
/**
|
||||
* This function returns an address that represents the broadcast address
|
||||
* <tt>255.255.255.255</tt>.
|
||||
*
|
||||
* @returns <tt>address_v4(0xFFFFFFFF)</tt>.
|
||||
*/
|
||||
static address_v4 broadcast() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return address_v4(0xFFFFFFFF);
|
||||
@@ -327,6 +406,22 @@ std::basic_ostream<Elem, Traits>& operator<<(
|
||||
} // namespace asio
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address_v4>
|
||||
{
|
||||
std::size_t operator()(const boost::asio::ip::address_v4& addr)
|
||||
const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return std::hash<unsigned int>()(addr.to_uint());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#include <boost/asio/detail/pop_options.hpp>
|
||||
|
||||
#include <boost/asio/ip/impl/address_v4.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v4_iterator.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v4_range.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v6.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -18,12 +18,17 @@
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
#include <string>
|
||||
#include <boost/asio/detail/array.hpp>
|
||||
#include <boost/asio/detail/cstdint.hpp>
|
||||
#include <boost/asio/detail/socket_types.hpp>
|
||||
#include <boost/asio/detail/string_view.hpp>
|
||||
#include <boost/asio/detail/winsock_init.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/asio/ip/address_v4.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
# include <functional>
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
# include <iosfwd>
|
||||
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
@@ -36,6 +41,9 @@ namespace ip {
|
||||
|
||||
template <typename> class basic_address_iterator;
|
||||
|
||||
/// Type used for storing IPv6 scope IDs.
|
||||
typedef uint_least32_t scope_id_type;
|
||||
|
||||
/// Implements IP version 6 style addresses.
|
||||
/**
|
||||
* The boost::asio::ip::address_v6 class provides the ability to use and
|
||||
@@ -60,11 +68,25 @@ public:
|
||||
#endif
|
||||
|
||||
/// Default constructor.
|
||||
/**
|
||||
* Initialises the @c address_v6 object such that:
|
||||
* @li <tt>to_bytes()</tt> yields <tt>{0, 0, ..., 0}</tt>; and
|
||||
* @li <tt>scope_id() == 0</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL address_v6() BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Construct an address from raw bytes and scope ID.
|
||||
/**
|
||||
* Initialises the @c address_v6 object such that:
|
||||
* @li <tt>to_bytes() == bytes</tt>; and
|
||||
* @li <tt>this->scope_id() == scope_id</tt>.
|
||||
*
|
||||
* @throws out_of_range Thrown if any element in @c bytes is not in the range
|
||||
* <tt>0 - 0xFF</tt>. Note that no range checking is required for platforms
|
||||
* where <tt>std::numeric_limits<unsigned char>::max()</tt> is <tt>0xFF</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL explicit address_v6(const bytes_type& bytes,
|
||||
unsigned long scope_id = 0);
|
||||
scope_id_type scope_id = 0);
|
||||
|
||||
/// Copy constructor.
|
||||
BOOST_ASIO_DECL address_v6(const address_v6& other) BOOST_ASIO_NOEXCEPT;
|
||||
@@ -87,7 +109,7 @@ public:
|
||||
/**
|
||||
* Returns the scope ID associated with the IPv6 address.
|
||||
*/
|
||||
unsigned long scope_id() const BOOST_ASIO_NOEXCEPT
|
||||
scope_id_type scope_id() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return scope_id_;
|
||||
}
|
||||
@@ -95,8 +117,10 @@ public:
|
||||
/// The scope ID of the address.
|
||||
/**
|
||||
* Modifies the scope ID associated with the IPv6 address.
|
||||
*
|
||||
* @param id The new scope ID.
|
||||
*/
|
||||
void scope_id(unsigned long id) BOOST_ASIO_NOEXCEPT
|
||||
void scope_id(scope_id_type id) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
scope_id_ = id;
|
||||
}
|
||||
@@ -135,9 +159,17 @@ public:
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Determine whether the address is a loopback address.
|
||||
/**
|
||||
* This function tests whether the address is the loopback address
|
||||
* <tt>::1</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL bool is_loopback() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Determine whether the address is unspecified.
|
||||
/**
|
||||
* This function tests whether the address is the loopback address
|
||||
* <tt>::</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL bool is_unspecified() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
/// Determine whether the address is link local.
|
||||
@@ -210,12 +242,22 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an address object that represents any address.
|
||||
/**
|
||||
* This functions returns an address that represents the "any" address
|
||||
* <tt>::</tt>.
|
||||
*
|
||||
* @returns A default-constructed @c address_v6 object.
|
||||
*/
|
||||
static address_v6 any() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return address_v6();
|
||||
}
|
||||
|
||||
/// Obtain an address object that represents the loopback address.
|
||||
/**
|
||||
* This function returns an address that represents the well-known loopback
|
||||
* address <tt>::1</tt>.
|
||||
*/
|
||||
BOOST_ASIO_DECL static address_v6 loopback() BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
@@ -233,7 +275,7 @@ private:
|
||||
boost::asio::detail::in6_addr_type addr_;
|
||||
|
||||
// The scope ID associated with the address.
|
||||
unsigned long scope_id_;
|
||||
scope_id_type scope_id_;
|
||||
};
|
||||
|
||||
/// Create an IPv6 address from raw bytes and scope ID.
|
||||
@@ -241,7 +283,7 @@ private:
|
||||
* @relates address_v6
|
||||
*/
|
||||
inline address_v6 make_address_v6(const address_v6::bytes_type& bytes,
|
||||
unsigned long scope_id = 0)
|
||||
scope_id_type scope_id = 0)
|
||||
{
|
||||
return address_v6(bytes, scope_id);
|
||||
}
|
||||
@@ -333,6 +375,39 @@ std::basic_ostream<Elem, Traits>& operator<<(
|
||||
} // namespace asio
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<boost::asio::ip::address_v6>
|
||||
{
|
||||
std::size_t operator()(const boost::asio::ip::address_v6& addr)
|
||||
const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
const boost::asio::ip::address_v6::bytes_type bytes = addr.to_bytes();
|
||||
std::size_t result = static_cast<std::size_t>(addr.scope_id());
|
||||
combine_4_bytes(result, &bytes[0]);
|
||||
combine_4_bytes(result, &bytes[4]);
|
||||
combine_4_bytes(result, &bytes[8]);
|
||||
combine_4_bytes(result, &bytes[12]);
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
static void combine_4_bytes(std::size_t& seed, const unsigned char* bytes)
|
||||
{
|
||||
const std::size_t bytes_hash =
|
||||
(static_cast<std::size_t>(bytes[0]) << 24) |
|
||||
(static_cast<std::size_t>(bytes[1]) << 16) |
|
||||
(static_cast<std::size_t>(bytes[2]) << 8) |
|
||||
(static_cast<std::size_t>(bytes[3]));
|
||||
seed ^= bytes_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#include <boost/asio/detail/pop_options.hpp>
|
||||
|
||||
#include <boost/asio/ip/impl/address_v6.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v6_iterator.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/address_v6_range.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/bad_address_cast.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -36,6 +36,16 @@ public:
|
||||
/// Default constructor.
|
||||
bad_address_cast() {}
|
||||
|
||||
/// Copy constructor.
|
||||
bad_address_cast(const bad_address_cast& other) BOOST_ASIO_NOEXCEPT_OR_NOTHROW
|
||||
#if defined(BOOST_ASIO_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
|
||||
: std::exception(static_cast<const std::exception&>(other))
|
||||
#else
|
||||
: std::bad_cast(static_cast<const std::bad_cast&>(other))
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
virtual ~bad_address_cast() BOOST_ASIO_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_endpoint.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -16,9 +16,14 @@
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
#include <boost/asio/detail/cstdint.hpp>
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/asio/ip/detail/endpoint.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
# include <functional>
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
# include <iosfwd>
|
||||
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
@@ -29,6 +34,9 @@ namespace boost {
|
||||
namespace asio {
|
||||
namespace ip {
|
||||
|
||||
/// Type used for storing port numbers.
|
||||
typedef uint_least16_t port_type;
|
||||
|
||||
/// Describes an endpoint for a version-independent IP socket.
|
||||
/**
|
||||
* The boost::asio::ip::basic_endpoint class template describes an endpoint that
|
||||
@@ -79,7 +87,7 @@ public:
|
||||
* @endcode
|
||||
*/
|
||||
basic_endpoint(const InternetProtocol& internet_protocol,
|
||||
unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
port_type port_num) BOOST_ASIO_NOEXCEPT
|
||||
: impl_(internet_protocol.family(), port_num)
|
||||
{
|
||||
}
|
||||
@@ -88,7 +96,7 @@ public:
|
||||
/// constructor may be used for accepting connections on a specific interface
|
||||
/// or for making a connection to a remote endpoint.
|
||||
basic_endpoint(const boost::asio::ip::address& addr,
|
||||
unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
port_type port_num) BOOST_ASIO_NOEXCEPT
|
||||
: impl_(addr, port_num)
|
||||
{
|
||||
}
|
||||
@@ -163,14 +171,14 @@ public:
|
||||
|
||||
/// Get the port associated with the endpoint. The port number is always in
|
||||
/// the host's byte order.
|
||||
unsigned short port() const BOOST_ASIO_NOEXCEPT
|
||||
port_type port() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return impl_.port();
|
||||
}
|
||||
|
||||
/// Set the port associated with the endpoint. The port number is always in
|
||||
/// the host's byte order.
|
||||
void port(unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
void port(port_type port_num) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
impl_.port(port_num);
|
||||
}
|
||||
@@ -259,6 +267,25 @@ std::basic_ostream<Elem, Traits>& operator<<(
|
||||
} // namespace asio
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
namespace std {
|
||||
|
||||
template <typename InternetProtocol>
|
||||
struct hash<boost::asio::ip::basic_endpoint<InternetProtocol> >
|
||||
{
|
||||
std::size_t operator()(
|
||||
const boost::asio::ip::basic_endpoint<InternetProtocol>& ep)
|
||||
const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
std::size_t hash1 = std::hash<boost::asio::ip::address>()(ep.address());
|
||||
std::size_t hash2 = std::hash<unsigned short>()(ep.port());
|
||||
return hash1 ^ (hash2 + 0x9e3779b9 + (hash1 << 6) + (hash1 >> 2));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_HASH)
|
||||
|
||||
#include <boost/asio/detail/pop_options.hpp>
|
||||
|
||||
#include <boost/asio/ip/impl/basic_endpoint.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_resolver.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
#include <string>
|
||||
#include <boost/asio/any_io_executor.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <boost/asio/detail/handler_type_requirements.hpp>
|
||||
#include <boost/asio/detail/io_object_impl.hpp>
|
||||
@@ -25,7 +26,6 @@
|
||||
#include <boost/asio/detail/throw_error.hpp>
|
||||
#include <boost/asio/error.hpp>
|
||||
#include <boost/asio/execution_context.hpp>
|
||||
#include <boost/asio/executor.hpp>
|
||||
#include <boost/asio/ip/basic_resolver_iterator.hpp>
|
||||
#include <boost/asio/ip/basic_resolver_query.hpp>
|
||||
#include <boost/asio/ip/basic_resolver_results.hpp>
|
||||
@@ -50,7 +50,7 @@ namespace ip {
|
||||
#define BOOST_ASIO_IP_BASIC_RESOLVER_FWD_DECL
|
||||
|
||||
// Forward declaration with defaulted arguments.
|
||||
template <typename InternetProtocol, typename Executor = executor>
|
||||
template <typename InternetProtocol, typename Executor = any_io_executor>
|
||||
class basic_resolver;
|
||||
|
||||
#endif // !defined(BOOST_ASIO_IP_BASIC_RESOLVER_FWD_DECL)
|
||||
@@ -68,10 +68,21 @@ template <typename InternetProtocol, typename Executor>
|
||||
class basic_resolver
|
||||
: public resolver_base
|
||||
{
|
||||
private:
|
||||
class initiate_async_resolve;
|
||||
|
||||
public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the resolver type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The resolver type when rebound to the specified executor.
|
||||
typedef basic_resolver<InternetProtocol, Executor1> other;
|
||||
};
|
||||
|
||||
/// The protocol type.
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
@@ -98,7 +109,7 @@ public:
|
||||
* resolver.
|
||||
*/
|
||||
explicit basic_resolver(const executor_type& ex)
|
||||
: impl_(ex)
|
||||
: impl_(0, ex)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,10 +123,10 @@ public:
|
||||
*/
|
||||
template <typename ExecutionContext>
|
||||
explicit basic_resolver(ExecutionContext& context,
|
||||
typename enable_if<
|
||||
typename constraint<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
: impl_(context)
|
||||
>::type = 0)
|
||||
: impl_(0, 0, context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -135,6 +146,29 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
// All resolvers have access to each other's implementations.
|
||||
template <typename InternetProtocol1, typename Executor1>
|
||||
friend class basic_resolver;
|
||||
|
||||
/// Move-construct a basic_resolver from another.
|
||||
/**
|
||||
* This constructor moves a resolver from one object to another.
|
||||
*
|
||||
* @param other The other basic_resolver object from which the move will
|
||||
* occur.
|
||||
*
|
||||
* @note Following the move, the moved-from object is in the same state as if
|
||||
* constructed using the @c basic_resolver(const executor_type&) constructor.
|
||||
*/
|
||||
template <typename Executor1>
|
||||
basic_resolver(basic_resolver<InternetProtocol, Executor1>&& other,
|
||||
typename constraint<
|
||||
is_convertible<Executor1, Executor>::value
|
||||
>::type = 0)
|
||||
: impl_(std::move(other.impl_))
|
||||
{
|
||||
}
|
||||
|
||||
/// Move-assign a basic_resolver from another.
|
||||
/**
|
||||
* This assignment operator moves a resolver from one object to another.
|
||||
@@ -152,6 +186,29 @@ public:
|
||||
impl_ = std::move(other.impl_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Move-assign a basic_resolver from another.
|
||||
/**
|
||||
* This assignment operator moves a resolver from one object to another.
|
||||
* Cancels any outstanding asynchronous operations associated with the target
|
||||
* object.
|
||||
*
|
||||
* @param other The other basic_resolver object from which the move will
|
||||
* occur.
|
||||
*
|
||||
* @note Following the move, the moved-from object is in the same state as if
|
||||
* constructed using the @c basic_resolver(const executor_type&) constructor.
|
||||
*/
|
||||
template <typename Executor1>
|
||||
typename constraint<
|
||||
is_convertible<Executor1, Executor>::value,
|
||||
basic_resolver&
|
||||
>::type operator=(basic_resolver<InternetProtocol, Executor1>&& other)
|
||||
{
|
||||
basic_resolver tmp(std::move(other));
|
||||
impl_ = std::move(tmp.impl_);
|
||||
return *this;
|
||||
}
|
||||
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Destroys the resolver.
|
||||
@@ -594,34 +651,48 @@ public:
|
||||
/// Asynchronously perform forward resolution of a query to a list of entries.
|
||||
/**
|
||||
* This function is used to asynchronously resolve a query into a list of
|
||||
* endpoint entries.
|
||||
* endpoint entries. It is an initiating function for an @ref
|
||||
* asynchronous_operation, and always returns immediately.
|
||||
*
|
||||
* @param q A query object that determines what endpoints will be returned.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(const query& q,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token, q)))
|
||||
{
|
||||
return boost::asio::async_initiate<ResolveHandler,
|
||||
return boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), token, q);
|
||||
}
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
@@ -641,21 +712,26 @@ public:
|
||||
* be an empty string, in which case all resolved endpoints will have a port
|
||||
* number of 0.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*
|
||||
* @note On POSIX systems, host names may be locally defined in the file
|
||||
* <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name
|
||||
@@ -667,21 +743,31 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(BOOST_ASIO_STRING_VIEW_PARAM host,
|
||||
BOOST_ASIO_STRING_VIEW_PARAM service,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token,
|
||||
declval<basic_resolver_query<protocol_type>&>())))
|
||||
{
|
||||
return async_resolve(host, service, resolver_base::flags(),
|
||||
BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
|
||||
BOOST_ASIO_MOVE_CAST(ResolveToken)(token));
|
||||
}
|
||||
|
||||
/// Asynchronously perform forward resolution of a query to a list of entries.
|
||||
/**
|
||||
* This function is used to resolve host and service names into a list of
|
||||
* endpoint entries.
|
||||
* endpoint entries. It is an initiating function for an @ref
|
||||
* asynchronous_operation, and always returns immediately.
|
||||
*
|
||||
* @param host A string identifying a location. May be a descriptive name or
|
||||
* a numeric address string. If an empty string and the passive flag has been
|
||||
@@ -699,21 +785,26 @@ public:
|
||||
* remote hosts. See the @ref resolver_base documentation for the set of
|
||||
* available flags.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*
|
||||
* @note On POSIX systems, host names may be locally defined in the file
|
||||
* <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name
|
||||
@@ -725,26 +816,36 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(BOOST_ASIO_STRING_VIEW_PARAM host,
|
||||
BOOST_ASIO_STRING_VIEW_PARAM service,
|
||||
resolver_base::flags resolve_flags,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token,
|
||||
declval<basic_resolver_query<protocol_type>&>())))
|
||||
{
|
||||
basic_resolver_query<protocol_type> q(static_cast<std::string>(host),
|
||||
static_cast<std::string>(service), resolve_flags);
|
||||
|
||||
return boost::asio::async_initiate<ResolveHandler,
|
||||
return boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), token, q);
|
||||
}
|
||||
|
||||
/// Asynchronously perform forward resolution of a query to a list of entries.
|
||||
/**
|
||||
* This function is used to resolve host and service names into a list of
|
||||
* endpoint entries.
|
||||
* endpoint entries. It is an initiating function for an @ref
|
||||
* asynchronous_operation, and always returns immediately.
|
||||
*
|
||||
* @param protocol A protocol object, normally representing either the IPv4 or
|
||||
* IPv6 version of an internet protocol.
|
||||
@@ -760,21 +861,26 @@ public:
|
||||
* be an empty string, in which case all resolved endpoints will have a port
|
||||
* number of 0.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*
|
||||
* @note On POSIX systems, host names may be locally defined in the file
|
||||
* <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name
|
||||
@@ -786,21 +892,31 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(const protocol_type& protocol,
|
||||
BOOST_ASIO_STRING_VIEW_PARAM host, BOOST_ASIO_STRING_VIEW_PARAM service,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token,
|
||||
declval<basic_resolver_query<protocol_type>&>())))
|
||||
{
|
||||
return async_resolve(protocol, host, service, resolver_base::flags(),
|
||||
BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
|
||||
BOOST_ASIO_MOVE_CAST(ResolveToken)(token));
|
||||
}
|
||||
|
||||
/// Asynchronously perform forward resolution of a query to a list of entries.
|
||||
/**
|
||||
* This function is used to resolve host and service names into a list of
|
||||
* endpoint entries.
|
||||
* endpoint entries. It is an initiating function for an @ref
|
||||
* asynchronous_operation, and always returns immediately.
|
||||
*
|
||||
* @param protocol A protocol object, normally representing either the IPv4 or
|
||||
* IPv6 version of an internet protocol.
|
||||
@@ -821,21 +937,26 @@ public:
|
||||
* remote hosts. See the @ref resolver_base documentation for the set of
|
||||
* available flags.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*
|
||||
* @note On POSIX systems, host names may be locally defined in the file
|
||||
* <tt>/etc/hosts</tt>. On Windows, host names may be defined in the file
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\hosts</tt>. Remote host name
|
||||
@@ -847,21 +968,30 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(const protocol_type& protocol,
|
||||
BOOST_ASIO_STRING_VIEW_PARAM host, BOOST_ASIO_STRING_VIEW_PARAM service,
|
||||
resolver_base::flags resolve_flags,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token,
|
||||
declval<basic_resolver_query<protocol_type>&>())))
|
||||
{
|
||||
basic_resolver_query<protocol_type> q(
|
||||
protocol, static_cast<std::string>(host),
|
||||
static_cast<std::string>(service), resolve_flags);
|
||||
|
||||
return boost::asio::async_initiate<ResolveHandler,
|
||||
return boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), token, q);
|
||||
}
|
||||
|
||||
/// Perform reverse resolution of an endpoint to a list of entries.
|
||||
@@ -910,35 +1040,49 @@ public:
|
||||
/// entries.
|
||||
/**
|
||||
* This function is used to asynchronously resolve an endpoint into a list of
|
||||
* endpoint entries.
|
||||
* endpoint entries. It is an initiating function for an @ref
|
||||
* asynchronous_operation, and always returns immediately.
|
||||
*
|
||||
* @param e An endpoint object that determines what endpoints will be
|
||||
* returned.
|
||||
*
|
||||
* @param handler The handler to be called when the resolve operation
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @param token The @ref completion_token that will be used to produce a
|
||||
* completion handler, which will be called when the resolve completes.
|
||||
* Potential completion tokens include @ref use_future, @ref use_awaitable,
|
||||
* @ref yield_context, or a function object with the correct completion
|
||||
* signature. The function signature of the completion handler must be:
|
||||
* @code void handler(
|
||||
* const boost::system::error_code& error, // Result of operation.
|
||||
* resolver::results_type results // Resolved endpoints as a range.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* not, the completion handler will not be invoked from within this function.
|
||||
* On immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*
|
||||
* @par Completion Signature
|
||||
* @code void(boost::system::error_code, results_type) @endcode
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
|
||||
results_type)) ResolveToken
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ResolveToken,
|
||||
void (boost::system::error_code, results_type))
|
||||
async_resolve(const endpoint_type& e,
|
||||
BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
BOOST_ASIO_MOVE_ARG(ResolveToken) token
|
||||
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
|
||||
boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
declval<initiate_async_resolve>(), token, e)))
|
||||
{
|
||||
return boost::asio::async_initiate<ResolveHandler,
|
||||
return boost::asio::async_initiate<ResolveToken,
|
||||
void (boost::system::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, e);
|
||||
initiate_async_resolve(this), token, e);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -946,11 +1090,24 @@ private:
|
||||
basic_resolver(const basic_resolver&) BOOST_ASIO_DELETED;
|
||||
basic_resolver& operator=(const basic_resolver&) BOOST_ASIO_DELETED;
|
||||
|
||||
struct initiate_async_resolve
|
||||
class initiate_async_resolve
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_resolve(basic_resolver* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ResolveHandler, typename Query>
|
||||
void operator()(BOOST_ASIO_MOVE_ARG(ResolveHandler) handler,
|
||||
basic_resolver* self, const Query& q) const
|
||||
const Query& q) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ResolveHandler.
|
||||
@@ -958,10 +1115,13 @@ private:
|
||||
ResolveHandler, handler, results_type) type_check;
|
||||
|
||||
boost::asio::detail::non_const_lvalue<ResolveHandler> handler2(handler);
|
||||
self->impl_.get_service().async_resolve(
|
||||
self->impl_.get_implementation(), q, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_resolve(
|
||||
self_->impl_.get_implementation(), q,
|
||||
handler2.value, self_->impl_.get_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_resolver* self_;
|
||||
};
|
||||
|
||||
# if defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_resolver_entry.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_resolver_iterator.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_resolver_query.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/basic_resolver_results.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/detail/endpoint.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/detail/impl/endpoint.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// detail/socket_option.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/host_name.hpp
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/icmp.hpp
|
||||
// ~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -47,33 +47,33 @@ public:
|
||||
typedef basic_endpoint<icmp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 ICMP protocol.
|
||||
static icmp v4()
|
||||
static icmp v4() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMP),
|
||||
BOOST_ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 ICMP protocol.
|
||||
static icmp v6()
|
||||
static icmp v6() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMPV6),
|
||||
BOOST_ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return BOOST_ASIO_OS_DEF(SOCK_RAW);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit icmp(int protocol_id, int protocol_family)
|
||||
explicit icmp(int protocol_id, int protocol_family) BOOST_ASIO_NOEXCEPT
|
||||
: protocol_(protocol_id),
|
||||
family_(protocol_family)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address_v4.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address_v4.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address_v6.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/address_v6.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -39,7 +39,7 @@ address_v6::address_v6() BOOST_ASIO_NOEXCEPT
|
||||
}
|
||||
|
||||
address_v6::address_v6(const address_v6::bytes_type& bytes,
|
||||
unsigned long scope)
|
||||
scope_id_type scope)
|
||||
: scope_id_(scope)
|
||||
{
|
||||
#if UCHAR_MAX > 0xFF
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/basic_endpoint.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/host_name.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/network_v4.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/network_v4.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@@ -130,7 +130,9 @@ std::string network_v4::to_string(boost::system::error_code& ec) const
|
||||
using namespace std; // For sprintf.
|
||||
ec = boost::system::error_code();
|
||||
char prefix_len[16];
|
||||
#if defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
#if defined(BOOST_ASIO_HAS_SNPRINTF)
|
||||
snprintf(prefix_len, sizeof(prefix_len), "/%u", prefix_length_);
|
||||
#elif defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
sprintf_s(prefix_len, sizeof(prefix_len), "/%u", prefix_length_);
|
||||
#else // defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
sprintf(prefix_len, "/%u", prefix_length_);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/network_v6.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/impl/network_v6.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@@ -99,7 +99,9 @@ std::string network_v6::to_string(boost::system::error_code& ec) const
|
||||
using namespace std; // For sprintf.
|
||||
ec = boost::system::error_code();
|
||||
char prefix_len[16];
|
||||
#if defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
#if defined(BOOST_ASIO_HAS_SNPRINTF)
|
||||
snprintf(prefix_len, sizeof(prefix_len), "/%u", prefix_length_);
|
||||
#elif defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
sprintf_s(prefix_len, sizeof(prefix_len), "/%u", prefix_length_);
|
||||
#else // defined(BOOST_ASIO_HAS_SECURE_RTL)
|
||||
sprintf(prefix_len, "/%u", prefix_length_);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/multicast.hpp
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/network_v4.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
/// Obtain the true network address, omitting any host bits.
|
||||
network_v4 canonical() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return network_v4(network(), netmask());
|
||||
return network_v4(network(), prefix_length());
|
||||
}
|
||||
|
||||
/// Test if network is a valid host address.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/network_v6.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/resolver_base.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/resolver_query_base.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/tcp.hpp
|
||||
// ~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -50,31 +50,31 @@ public:
|
||||
typedef basic_endpoint<tcp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 TCP protocol.
|
||||
static tcp v4()
|
||||
static tcp v4() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return tcp(BOOST_ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 TCP protocol.
|
||||
static tcp v6()
|
||||
static tcp v6() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return tcp(BOOST_ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return BOOST_ASIO_OS_DEF(SOCK_STREAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return BOOST_ASIO_OS_DEF(IPPROTO_TCP);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit tcp(int protocol_family)
|
||||
explicit tcp(int protocol_family) BOOST_ASIO_NOEXCEPT
|
||||
: family_(protocol_family)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/udp.hpp
|
||||
// ~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -47,31 +47,31 @@ public:
|
||||
typedef basic_endpoint<udp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 UDP protocol.
|
||||
static udp v4()
|
||||
static udp v4() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return udp(BOOST_ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 UDP protocol.
|
||||
static udp v6()
|
||||
static udp v6() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return udp(BOOST_ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return BOOST_ASIO_OS_DEF(SOCK_DGRAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return BOOST_ASIO_OS_DEF(IPPROTO_UDP);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit udp(int protocol_family)
|
||||
explicit udp(int protocol_family) BOOST_ASIO_NOEXCEPT
|
||||
: family_(protocol_family)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/unicast.hpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/v6_only.hpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -27,7 +27,7 @@ namespace ip {
|
||||
/// Socket option for determining whether an IPv6 socket supports IPv6
|
||||
/// communication only.
|
||||
/**
|
||||
* Implements the IPPROTO_IPV6/IP_V6ONLY socket option.
|
||||
* Implements the IPPROTO_IPV6/IPV6_V6ONLY socket option.
|
||||
*
|
||||
* @par Examples
|
||||
* Setting the option:
|
||||
|
||||
Reference in New Issue
Block a user