rippled
Classes | Typedefs | Functions
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

Endpoint from_asio (boost::asio::ip::address const &address)
 Convert to Endpoint. More...
 
Endpoint from_asio (boost::asio::ip::tcp::endpoint const &endpoint)
 Convert to Endpoint. More...
 
boost::asio::ip::address to_asio_address (Endpoint const &endpoint)
 Convert to asio::ip::address. More...
 
boost::asio::ip::tcp::endpoint to_asio_endpoint (Endpoint const &endpoint)
 Convert to asio::ip::tcp::endpoint. More...
 
bool is_private (AddressV4 const &addr)
 Returns true if the address is a private unroutable address. More...
 
bool is_public (AddressV4 const &addr)
 Returns true if the address is a public routable address. More...
 
char get_class (AddressV4 const &address)
 Returns the address class for the given address. More...
 
bool is_private (AddressV6 const &addr)
 Returns true if the address is a private unroutable address. More...
 
bool is_public (AddressV6 const &addr)
 Returns true if the address is a public routable address. More...
 
bool operator== (Endpoint const &lhs, Endpoint const &rhs)
 
bool operator< (Endpoint const &lhs, Endpoint const &rhs)
 
std::istreamoperator>> (std::istream &is, Endpoint &endpoint)
 Input stream conversion. More...
 
std::string to_string (Address const &addr)
 Returns the address represented as a string. More...
 
bool is_loopback (Address const &addr)
 Returns true if this is a loopback address. More...
 
bool is_unspecified (Address const &addr)
 Returns true if the address is unspecified. More...
 
bool is_multicast (Address const &addr)
 Returns true if the address is a multicast address. More...
 
bool is_private (Address const &addr)
 Returns true if the address is a private unroutable address. More...
 
bool is_public (Address const &addr)
 Returns true if the address is a public routable address. More...
 
bool is_loopback (Endpoint const &endpoint)
 Returns true if the endpoint is a loopback address. More...
 
bool is_unspecified (Endpoint const &endpoint)
 Returns true if the endpoint is unspecified. More...
 
bool is_multicast (Endpoint const &endpoint)
 Returns true if the endpoint is a multicast address. More...
 
bool is_private (Endpoint const &endpoint)
 Returns true if the endpoint is a private unroutable address. More...
 
bool is_public (Endpoint const &endpoint)
 Returns true if the endpoint is a public routable address. More...
 
std::string to_string (Endpoint const &endpoint)
 Returns the endpoint represented as a string. More...
 
template<typename OutputStream >
OutputStream & operator<< (OutputStream &os, Endpoint const &endpoint)
 Output stream conversion. More...
 
 BEAST_DEFINE_TESTSUITE (IPEndpoint, net, beast)
 
Endpoint randomEP (bool v4=true)
 

Typedef Documentation

◆ Address

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

Definition at line 41 of file IPAddress.h.

◆ AddressV4

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

Definition at line 34 of file IPAddressV4.h.

◆ AddressV6

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

Definition at line 34 of file IPAddressV6.h.

◆ Port

using beast::IP::Port = typedef std::uint16_t

Definition at line 35 of file IPEndpoint.h.

Function Documentation

◆ from_asio() [1/2]

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

Convert to Endpoint.

The port is set to zero.

Definition at line 26 of file IPAddressConversion.cpp.

◆ from_asio() [2/2]

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

Convert to Endpoint.

Definition at line 32 of file IPAddressConversion.cpp.

◆ to_asio_address()

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

Convert to asio::ip::address.

The port is ignored.

Definition at line 38 of file IPAddressConversion.cpp.

◆ to_asio_endpoint()

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

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

Definition at line 44 of file IPAddressConversion.cpp.

◆ is_private() [1/4]

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

Returns true if the address is a private unroutable address.

Definition at line 29 of file IPAddressV4.cpp.

◆ is_public() [1/4]

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

Returns true if the address is a public routable address.

Definition at line 41 of file IPAddressV4.cpp.

◆ get_class()

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

Returns the address class for the given address.

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

Definition at line 47 of file IPAddressV4.cpp.

◆ is_private() [2/4]

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

Returns true if the address is a private unroutable address.

Definition at line 27 of file IPAddressV6.cpp.

◆ is_public() [2/4]

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

Returns true if the address is a public routable address.

Definition at line 35 of file IPAddressV6.cpp.

◆ operator==()

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

Definition at line 78 of file IPEndpoint.cpp.

◆ operator<()

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

Definition at line 84 of file IPEndpoint.cpp.

◆ operator>>()

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

Input stream conversion.

Definition at line 96 of file IPEndpoint.cpp.

◆ to_string() [1/2]

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

Returns the address represented as a string.

Definition at line 45 of file IPAddress.h.

◆ is_loopback() [1/2]

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

Returns true if this is a loopback address.

Definition at line 52 of file IPAddress.h.

◆ is_unspecified() [1/2]

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

Returns true if the address is unspecified.

Definition at line 59 of file IPAddress.h.

◆ is_multicast() [1/2]

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

Returns true if the address is a multicast address.

Definition at line 66 of file IPAddress.h.

◆ is_private() [3/4]

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

Returns true if the address is a private unroutable address.

Definition at line 73 of file IPAddress.h.

◆ is_public() [3/4]

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

Returns true if the address is a public routable address.

Definition at line 80 of file IPAddress.h.

◆ is_loopback() [2/2]

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

Returns true if the endpoint is a loopback address.

Definition at line 153 of file IPEndpoint.h.

◆ is_unspecified() [2/2]

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

Returns true if the endpoint is unspecified.

Definition at line 160 of file IPEndpoint.h.

◆ is_multicast() [2/2]

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

Returns true if the endpoint is a multicast address.

Definition at line 167 of file IPEndpoint.h.

◆ is_private() [4/4]

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

Returns true if the endpoint is a private unroutable address.

Definition at line 174 of file IPEndpoint.h.

◆ is_public() [4/4]

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

Returns true if the endpoint is a public routable address.

Definition at line 181 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 190 of file IPEndpoint.h.

◆ operator<<()

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

Output stream conversion.

Definition at line 198 of file IPEndpoint.h.

◆ BEAST_DEFINE_TESTSUITE()

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

◆ randomEP()

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

Definition at line 27 of file IPEndpointCommon.h.