update boost on linux
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// ip/detail/endpoint.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 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)
|
||||
@@ -34,42 +34,43 @@ class endpoint
|
||||
{
|
||||
public:
|
||||
// Default constructor.
|
||||
BOOST_ASIO_DECL endpoint();
|
||||
BOOST_ASIO_DECL endpoint() BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Construct an endpoint using a family and port number.
|
||||
BOOST_ASIO_DECL endpoint(int family, unsigned short port_num);
|
||||
BOOST_ASIO_DECL endpoint(int family,
|
||||
unsigned short port_num) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Construct an endpoint using an address and port number.
|
||||
BOOST_ASIO_DECL endpoint(const boost::asio::ip::address& addr,
|
||||
unsigned short port_num);
|
||||
unsigned short port_num) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Copy constructor.
|
||||
endpoint(const endpoint& other)
|
||||
endpoint(const endpoint& other) BOOST_ASIO_NOEXCEPT
|
||||
: data_(other.data_)
|
||||
{
|
||||
}
|
||||
|
||||
// Assign from another endpoint.
|
||||
endpoint& operator=(const endpoint& other)
|
||||
endpoint& operator=(const endpoint& other) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
data_ = other.data_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Get the underlying endpoint in the native type.
|
||||
boost::asio::detail::socket_addr_type* data()
|
||||
boost::asio::detail::socket_addr_type* data() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return &data_.base;
|
||||
}
|
||||
|
||||
// Get the underlying endpoint in the native type.
|
||||
const boost::asio::detail::socket_addr_type* data() const
|
||||
const boost::asio::detail::socket_addr_type* data() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return &data_.base;
|
||||
}
|
||||
|
||||
// Get the underlying size of the endpoint in the native type.
|
||||
std::size_t size() const
|
||||
std::size_t size() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
if (is_v4())
|
||||
return sizeof(boost::asio::detail::sockaddr_in4_type);
|
||||
@@ -81,40 +82,41 @@ public:
|
||||
BOOST_ASIO_DECL void resize(std::size_t new_size);
|
||||
|
||||
// Get the capacity of the endpoint in the native type.
|
||||
std::size_t capacity() const
|
||||
std::size_t capacity() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return sizeof(data_);
|
||||
}
|
||||
|
||||
// Get the port associated with the endpoint.
|
||||
BOOST_ASIO_DECL unsigned short port() const;
|
||||
BOOST_ASIO_DECL unsigned short port() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Set the port associated with the endpoint.
|
||||
BOOST_ASIO_DECL void port(unsigned short port_num);
|
||||
BOOST_ASIO_DECL void port(unsigned short port_num) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Get the IP address associated with the endpoint.
|
||||
BOOST_ASIO_DECL boost::asio::ip::address address() const;
|
||||
BOOST_ASIO_DECL boost::asio::ip::address address() const BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Set the IP address associated with the endpoint.
|
||||
BOOST_ASIO_DECL void address(const boost::asio::ip::address& addr);
|
||||
BOOST_ASIO_DECL void address(
|
||||
const boost::asio::ip::address& addr) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Compare two endpoints for equality.
|
||||
BOOST_ASIO_DECL friend bool operator==(
|
||||
const endpoint& e1, const endpoint& e2);
|
||||
BOOST_ASIO_DECL friend bool operator==(const endpoint& e1,
|
||||
const endpoint& e2) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Compare endpoints for ordering.
|
||||
BOOST_ASIO_DECL friend bool operator<(
|
||||
const endpoint& e1, const endpoint& e2);
|
||||
BOOST_ASIO_DECL friend bool operator<(const endpoint& e1,
|
||||
const endpoint& e2) BOOST_ASIO_NOEXCEPT;
|
||||
|
||||
// Determine whether the endpoint is IPv4.
|
||||
bool is_v4() const
|
||||
bool is_v4() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return data_.base.sa_family == BOOST_ASIO_OS_DEF(AF_INET);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
// Convert to a string.
|
||||
BOOST_ASIO_DECL std::string to_string(boost::system::error_code& ec) const;
|
||||
BOOST_ASIO_DECL std::string to_string() const;
|
||||
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
|
||||
private:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ip/detail/impl/endpoint.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 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)
|
||||
@@ -32,7 +32,7 @@ namespace asio {
|
||||
namespace ip {
|
||||
namespace detail {
|
||||
|
||||
endpoint::endpoint()
|
||||
endpoint::endpoint() BOOST_ASIO_NOEXCEPT
|
||||
: data_()
|
||||
{
|
||||
data_.v4.sin_family = BOOST_ASIO_OS_DEF(AF_INET);
|
||||
@@ -40,7 +40,7 @@ endpoint::endpoint()
|
||||
data_.v4.sin_addr.s_addr = BOOST_ASIO_OS_DEF(INADDR_ANY);
|
||||
}
|
||||
|
||||
endpoint::endpoint(int family, unsigned short port_num)
|
||||
endpoint::endpoint(int family, unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
: data_()
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
@@ -70,7 +70,7 @@ endpoint::endpoint(int family, unsigned short port_num)
|
||||
}
|
||||
|
||||
endpoint::endpoint(const boost::asio::ip::address& addr,
|
||||
unsigned short port_num)
|
||||
unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
: data_()
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
@@ -81,8 +81,7 @@ endpoint::endpoint(const boost::asio::ip::address& addr,
|
||||
boost::asio::detail::socket_ops::host_to_network_short(port_num);
|
||||
data_.v4.sin_addr.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
static_cast<boost::asio::detail::u_long_type>(
|
||||
addr.to_v4().to_ulong()));
|
||||
addr.to_v4().to_uint());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,7 +107,7 @@ void endpoint::resize(std::size_t new_size)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short endpoint::port() const
|
||||
unsigned short endpoint::port() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
if (is_v4())
|
||||
{
|
||||
@@ -122,7 +121,7 @@ unsigned short endpoint::port() const
|
||||
}
|
||||
}
|
||||
|
||||
void endpoint::port(unsigned short port_num)
|
||||
void endpoint::port(unsigned short port_num) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
if (is_v4())
|
||||
{
|
||||
@@ -136,7 +135,7 @@ void endpoint::port(unsigned short port_num)
|
||||
}
|
||||
}
|
||||
|
||||
boost::asio::ip::address endpoint::address() const
|
||||
boost::asio::ip::address endpoint::address() const BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
if (is_v4())
|
||||
@@ -157,18 +156,18 @@ boost::asio::ip::address endpoint::address() const
|
||||
}
|
||||
}
|
||||
|
||||
void endpoint::address(const boost::asio::ip::address& addr)
|
||||
void endpoint::address(const boost::asio::ip::address& addr) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
endpoint tmp_endpoint(addr, port());
|
||||
data_ = tmp_endpoint.data_;
|
||||
}
|
||||
|
||||
bool operator==(const endpoint& e1, const endpoint& e2)
|
||||
bool operator==(const endpoint& e1, const endpoint& e2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return e1.address() == e2.address() && e1.port() == e2.port();
|
||||
}
|
||||
|
||||
bool operator<(const endpoint& e1, const endpoint& e2)
|
||||
bool operator<(const endpoint& e1, const endpoint& e2) BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
if (e1.address() < e2.address())
|
||||
return true;
|
||||
@@ -178,18 +177,14 @@ bool operator<(const endpoint& e1, const endpoint& e2)
|
||||
}
|
||||
|
||||
#if !defined(BOOST_ASIO_NO_IOSTREAM)
|
||||
std::string endpoint::to_string(boost::system::error_code& ec) const
|
||||
std::string endpoint::to_string() const
|
||||
{
|
||||
std::string a = address().to_string(ec);
|
||||
if (ec)
|
||||
return std::string();
|
||||
|
||||
std::ostringstream tmp_os;
|
||||
tmp_os.imbue(std::locale::classic());
|
||||
if (is_v4())
|
||||
tmp_os << a;
|
||||
tmp_os << address();
|
||||
else
|
||||
tmp_os << '[' << a << ']';
|
||||
tmp_os << '[' << address() << ']';
|
||||
tmp_os << ':' << port();
|
||||
|
||||
return tmp_os.str();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// detail/socket_option.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 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)
|
||||
@@ -392,15 +392,15 @@ public:
|
||||
}
|
||||
|
||||
// Construct with multicast address only.
|
||||
explicit multicast_request(const boost::asio::ip::address& multicast_address)
|
||||
explicit multicast_request(const address& multicast_address)
|
||||
: ipv4_value_(), // Zero-initialisation gives the "any" address.
|
||||
ipv6_value_() // Zero-initialisation gives the "any" address.
|
||||
{
|
||||
if (multicast_address.is_v6())
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
boost::asio::ip::address_v6 ipv6_address = multicast_address.to_v6();
|
||||
boost::asio::ip::address_v6::bytes_type bytes = ipv6_address.to_bytes();
|
||||
address_v6 ipv6_address = multicast_address.to_v6();
|
||||
address_v6::bytes_type bytes = ipv6_address.to_bytes();
|
||||
memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16);
|
||||
ipv6_value_.ipv6mr_interface = ipv6_address.scope_id();
|
||||
}
|
||||
@@ -408,37 +408,34 @@ public:
|
||||
{
|
||||
ipv4_value_.imr_multiaddr.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
multicast_address.to_v4().to_ulong());
|
||||
multicast_address.to_v4().to_uint());
|
||||
ipv4_value_.imr_interface.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
boost::asio::ip::address_v4::any().to_ulong());
|
||||
address_v4::any().to_uint());
|
||||
}
|
||||
}
|
||||
|
||||
// Construct with multicast address and IPv4 address specifying an interface.
|
||||
explicit multicast_request(
|
||||
const boost::asio::ip::address_v4& multicast_address,
|
||||
const boost::asio::ip::address_v4& network_interface
|
||||
= boost::asio::ip::address_v4::any())
|
||||
explicit multicast_request(const address_v4& multicast_address,
|
||||
const address_v4& network_interface = address_v4::any())
|
||||
: ipv6_value_() // Zero-initialisation gives the "any" address.
|
||||
{
|
||||
ipv4_value_.imr_multiaddr.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
multicast_address.to_ulong());
|
||||
multicast_address.to_uint());
|
||||
ipv4_value_.imr_interface.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
network_interface.to_ulong());
|
||||
network_interface.to_uint());
|
||||
}
|
||||
|
||||
// Construct with multicast address and IPv6 network interface index.
|
||||
explicit multicast_request(
|
||||
const boost::asio::ip::address_v6& multicast_address,
|
||||
const address_v6& multicast_address,
|
||||
unsigned long network_interface = 0)
|
||||
: ipv4_value_() // Zero-initialisation gives the "any" address.
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
boost::asio::ip::address_v6::bytes_type bytes =
|
||||
multicast_address.to_bytes();
|
||||
address_v6::bytes_type bytes = multicast_address.to_bytes();
|
||||
memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16);
|
||||
if (network_interface)
|
||||
ipv6_value_.ipv6mr_interface = network_interface;
|
||||
@@ -497,16 +494,16 @@ public:
|
||||
{
|
||||
ipv4_value_.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
boost::asio::ip::address_v4::any().to_ulong());
|
||||
address_v4::any().to_uint());
|
||||
ipv6_value_ = 0;
|
||||
}
|
||||
|
||||
// Construct with IPv4 interface.
|
||||
explicit network_interface(const boost::asio::ip::address_v4& ipv4_interface)
|
||||
explicit network_interface(const address_v4& ipv4_interface)
|
||||
{
|
||||
ipv4_value_.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
ipv4_interface.to_ulong());
|
||||
ipv4_interface.to_uint());
|
||||
ipv6_value_ = 0;
|
||||
}
|
||||
|
||||
@@ -515,7 +512,7 @@ public:
|
||||
{
|
||||
ipv4_value_.s_addr =
|
||||
boost::asio::detail::socket_ops::host_to_network_long(
|
||||
boost::asio::ip::address_v4::any().to_ulong());
|
||||
address_v4::any().to_uint());
|
||||
ipv6_value_ = ipv6_interface;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user