xrpld
Loading...
Searching...
No Matches
beast::IP Namespace Reference

Classes

class  Endpoint
 A version-independent IP address and port combination. More...
class  IPEndpoint_test

Typedefs

using Address = boost::asio::ip::address
using AddressV4 = boost::asio::ip::address_v4
using AddressV6 = boost::asio::ip::address_v6
using Port = std::uint16_t

Functions

std::string to_string (Address const &addr)
 Returns the address represented as a string.
bool isLoopback (Address const &addr)
 Returns true if this is a loopback address.
bool isUnspecified (Address const &addr)
 Returns true if the address is unspecified.
bool isMulticast (Address const &addr)
 Returns true if the address is a multicast address.
bool isPrivate (Address const &addr)
 Returns true if the address is a private unroutable address.
bool isPublic (Address const &addr)
 Returns true if the address is a public routable address.
Endpoint fromAsio (boost::asio::ip::address const &address)
 Convert to Endpoint.
Endpoint fromAsio (boost::asio::ip::tcp::endpoint const &endpoint)
 Convert to Endpoint.
boost::asio::ip::address toAsioAddress (Endpoint const &endpoint)
 Convert to asio::ip::address.
boost::asio::ip::tcp::endpoint toAsioEndpoint (Endpoint const &endpoint)
 Convert to asio::ip::tcp::endpoint.
bool isPrivate (AddressV4 const &addr)
 Returns true if the address is a private unroutable address.
bool isPublic (AddressV4 const &addr)
 Returns true if the address is a public routable address.
char getClass (AddressV4 const &address)
 Returns the address class for the given address.
bool isPrivate (AddressV6 const &addr)
 Returns true if the address is a private unroutable address.
bool isPublic (AddressV6 const &addr)
 Returns true if the address is a public routable address.
bool isLoopback (Endpoint const &endpoint)
 Returns true if the endpoint is a loopback address.
bool isUnspecified (Endpoint const &endpoint)
 Returns true if the endpoint is unspecified.
bool isMulticast (Endpoint const &endpoint)
 Returns true if the endpoint is a multicast address.
bool isPrivate (Endpoint const &endpoint)
 Returns true if the endpoint is a private unroutable address.
bool isPublic (Endpoint const &endpoint)
 Returns true if the endpoint is a public routable address.
std::string to_string (Endpoint const &endpoint)
 Returns the endpoint represented as a string.
template<typename OutputStream>
OutputStream & operator<< (OutputStream &os, Endpoint const &endpoint)
 Output stream conversion.
std::istreamoperator>> (std::istream &is, Endpoint &endpoint)
 Input stream conversion.
bool operator== (Endpoint const &lhs, Endpoint const &rhs)
bool operator< (Endpoint const &lhs, Endpoint const &rhs)
 BEAST_DEFINE_TESTSUITE (IPEndpoint, beast, beast)
Endpoint randomEP (bool v4=true)

Typedef Documentation

◆ Address

using beast::IP::Address = boost::asio::ip::address

Definition at line 19 of file IPAddress.h.

◆ AddressV4

using beast::IP::AddressV4 = boost::asio::ip::address_v4

Definition at line 9 of file IPAddressV4.h.

◆ AddressV6

using beast::IP::AddressV6 = boost::asio::ip::address_v6

Definition at line 9 of file IPAddressV6.h.

◆ Port

Definition at line 13 of file IPEndpoint.h.

Function Documentation

◆ to_string() [1/2]

std::string beast::IP::to_string ( Address const & addr)

Returns the address represented as a string.

Definition at line 23 of file IPAddress.h.

◆ isLoopback() [1/2]

bool beast::IP::isLoopback ( Address const & addr)

Returns true if this is a loopback address.

Definition at line 30 of file IPAddress.h.

◆ isUnspecified() [1/2]

bool beast::IP::isUnspecified ( Address const & addr)

Returns true if the address is unspecified.

Definition at line 37 of file IPAddress.h.

◆ isMulticast() [1/2]

bool beast::IP::isMulticast ( Address const & addr)

Returns true if the address is a multicast address.

Definition at line 44 of file IPAddress.h.

◆ isPrivate() [1/4]

bool beast::IP::isPrivate ( Address const & addr)

Returns true if the address is a private unroutable address.

Definition at line 51 of file IPAddress.h.

◆ isPublic() [1/4]

bool beast::IP::isPublic ( Address const & addr)

Returns true if the address is a public routable address.

Definition at line 58 of file IPAddress.h.

◆ fromAsio() [1/2]

Endpoint beast::IP::fromAsio ( boost::asio::ip::address const & address)

Convert to Endpoint.

The port is set to zero.

Definition at line 11 of file IPAddressConversion.cpp.

◆ fromAsio() [2/2]

Endpoint beast::IP::fromAsio ( boost::asio::ip::tcp::endpoint const & endpoint)

Convert to Endpoint.

Definition at line 17 of file IPAddressConversion.cpp.

◆ toAsioAddress()

boost::asio::ip::address beast::IP::toAsioAddress ( Endpoint const & endpoint)

Convert to asio::ip::address.

The port is ignored.

Definition at line 23 of file IPAddressConversion.cpp.

◆ toAsioEndpoint()

boost::asio::ip::tcp::endpoint beast::IP::toAsioEndpoint ( Endpoint const & endpoint)

Convert to asio::ip::tcp::endpoint.

Definition at line 29 of file IPAddressConversion.cpp.

◆ isPrivate() [2/4]

bool beast::IP::isPrivate ( AddressV4 const & addr)

Returns true if the address is a private unroutable address.

Definition at line 6 of file IPAddressV4.cpp.

◆ isPublic() [2/4]

bool beast::IP::isPublic ( AddressV4 const & addr)

Returns true if the address is a public routable address.

Definition at line 15 of file IPAddressV4.cpp.

◆ getClass()

char beast::IP::getClass ( AddressV4 const & address)

Returns the address class for the given address.

Note
Class 'D' represents multicast addresses (224.*.*.*).

Definition at line 59 of file IPAddressV4.cpp.

◆ isPrivate() [3/4]

bool beast::IP::isPrivate ( AddressV6 const & addr)

Returns true if the address is a private unroutable address.

Definition at line 10 of file IPAddressV6.cpp.

◆ isPublic() [3/4]

bool beast::IP::isPublic ( AddressV6 const & addr)

Returns true if the address is a public routable address.

Definition at line 21 of file IPAddressV6.cpp.

◆ isLoopback() [2/2]

bool beast::IP::isLoopback ( Endpoint const & endpoint)

Returns true if the endpoint is a loopback address.

Definition at line 131 of file IPEndpoint.h.

◆ isUnspecified() [2/2]

bool beast::IP::isUnspecified ( Endpoint const & endpoint)

Returns true if the endpoint is unspecified.

Definition at line 138 of file IPEndpoint.h.

◆ isMulticast() [2/2]

bool beast::IP::isMulticast ( Endpoint const & endpoint)

Returns true if the endpoint is a multicast address.

Definition at line 145 of file IPEndpoint.h.

◆ isPrivate() [4/4]

bool beast::IP::isPrivate ( Endpoint const & endpoint)

Returns true if the endpoint is a private unroutable address.

Definition at line 152 of file IPEndpoint.h.

◆ isPublic() [4/4]

bool beast::IP::isPublic ( Endpoint const & endpoint)

Returns true if the endpoint is a public routable address.

Definition at line 159 of file IPEndpoint.h.

◆ to_string() [2/2]

std::string beast::IP::to_string ( Endpoint const & endpoint)

Returns the endpoint represented as a string.

Definition at line 168 of file IPEndpoint.h.

◆ operator<<()

template<typename OutputStream>
OutputStream & beast::IP::operator<< ( OutputStream & os,
Endpoint const & endpoint )

Output stream conversion.

Definition at line 175 of file IPEndpoint.h.

◆ operator>>()

std::istream & beast::IP::operator>> ( std::istream & is,
Endpoint & endpoint )

Input stream conversion.

Definition at line 89 of file IPEndpoint.cpp.

◆ operator==()

bool beast::IP::operator== ( Endpoint const & lhs,
Endpoint const & rhs )

Definition at line 71 of file IPEndpoint.cpp.

◆ operator<()

bool beast::IP::operator< ( Endpoint const & lhs,
Endpoint const & rhs )

Definition at line 76 of file IPEndpoint.cpp.

◆ BEAST_DEFINE_TESTSUITE()

beast::IP::BEAST_DEFINE_TESTSUITE ( IPEndpoint ,
beast ,
beast  )

◆ randomEP()

Endpoint beast::IP::randomEP ( bool v4 = true)

Definition at line 9 of file IPEndpointCommon.h.