Files
xahaud/include/xrpl/beast/net/IPAddressConversion.h
Alphonse Mousse 62ac6a562c Various fixes:
- Fix unlikely edge case in setCurrentThreadName
    setCurrentThreadName accepts a std::string_view parameter, which is
    not guaranteed to include a null terminator, which it then forwards
    to OS-specific APIs that expect null-terminated C strings.
- Fix several compilation warnings
- Fix header includes
- Fix unnecessarily verbose logging
- Simplify code using inline lambdas instead of std::bind
- Modernize the Beast "lexical cast" framework
- Use boost::asio types instead of legacy Beast type wrappers
- Clean up LogicError, custom exception throwing and termination handling
- Clean up and modernize PublicKey, SecretKey and Seed
    Simplify construction, buffer iteration and comparisons by leveraging
    modern C++ features.
- Clean up and modernize RFC1751 code
    Turn static-member-only class into namespace, thin out the public API
    and make code noexcept and constexpr. Verify internal data at compile
    time.
- Clean up CSPRNG engine
- Clean up rngfill function, eliminating GCC false-positive warning.
- Improve Slice comparison using C++ operator<=> and operator synthesis.
2026-09-23 13:03:28 +10:00

48 lines
1.7 KiB
C++

//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED
#define BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED
#include <xrpl/beast/net/IPEndpoint.h>
#include <boost/asio.hpp>
namespace beast {
namespace IP {
/** Convert to Endpoint. */
[[nodiscard]] inline Endpoint
from_asio(boost::asio::ip::tcp::endpoint const& endpoint)
{
return Endpoint{endpoint.address(), endpoint.port()};
}
/** Convert to asio::ip::tcp::endpoint. */
[[nodiscard]] inline boost::asio::ip::tcp::endpoint
to_asio_endpoint(Endpoint const& endpoint)
{
return boost::asio::ip::tcp::endpoint{endpoint.address(), endpoint.port()};
}
} // namespace IP
} // namespace beast
#endif