Electroneum
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
net::i2p_address Class Reference

b32 i2p address; internal format not condensed/decoded. More...

#include <i2p_address.h>

Public Member Functions

 i2p_address () noexcept
 An object with port() == 0 and host_str() == unknown_str(). More...
 
bool _load (epee::serialization::portable_storage &src, epee::serialization::section *hparent)
 Load from epee p2p format, and. More...
 
bool store (epee::serialization::portable_storage &dest, epee::serialization::section *hparent) const
 Store in epee p2p format. More...
 
 i2p_address (const i2p_address &rhs) noexcept
 
 ~i2p_address ()=default
 
i2p_addressoperator= (const i2p_address &rhs) noexcept
 
bool is_unknown () const noexcept
 
bool equal (const i2p_address &rhs) const noexcept
 
bool less (const i2p_address &rhs) const noexcept
 
bool is_same_host (const i2p_address &rhs) const noexcept
 
std::string str () const
 
const char * host_str () const noexcept
 
std::uint16_t port () const noexcept
 
bool is_blockable () const noexcept
 

Static Public Member Functions

static constexpr std::size_t buffer_size () noexcept
 
static const char * unknown_str () noexcept
 
static i2p_address unknown () noexcept
 
static expect< i2p_addressmake (boost::string_ref address, std::uint16_t default_port=0)
 
static constexpr bool is_loopback () noexcept
 
static constexpr bool is_local () noexcept
 
static constexpr epee::net_utils::address_type get_type_id () noexcept
 
static constexpr epee::net_utils::zone get_zone () noexcept
 

Private Member Functions

 i2p_address (boost::string_ref host, std::uint16_t port) noexcept
 Keep in private, host.size() has no runtime check. More...
 

Private Attributes

std::uint16_t port_
 
char host_ [61]
 

Detailed Description

b32 i2p address; internal format not condensed/decoded.

Constructor & Destructor Documentation

◆ i2p_address() [1/3]

net::i2p_address::i2p_address ( boost::string_ref  host,
std::uint16_t  port 
)
privatenoexcept

Keep in private, host.size() has no runtime check.

◆ i2p_address() [2/3]

net::i2p_address::i2p_address ( )
noexcept

An object with port() == 0 and host_str() == unknown_str().

◆ i2p_address() [3/3]

net::i2p_address::i2p_address ( const i2p_address rhs)
noexcept

◆ ~i2p_address()

net::i2p_address::~i2p_address ( )
default

Member Function Documentation

◆ _load()

bool net::i2p_address::_load ( epee::serialization::portable_storage &  src,
epee::serialization::section *  hparent 
)

Load from epee p2p format, and.

Returns
false if not valid tor address

◆ buffer_size()

static constexpr std::size_t net::i2p_address::buffer_size ( )
inlinestaticconstexprnoexcept
Returns
Size of internal buffer for host.

◆ equal()

bool net::i2p_address::equal ( const i2p_address rhs) const
noexcept

◆ get_type_id()

static constexpr epee::net_utils::address_type net::i2p_address::get_type_id ( )
inlinestaticconstexprnoexcept

◆ get_zone()

static constexpr epee::net_utils::zone net::i2p_address::get_zone ( )
inlinestaticconstexprnoexcept

◆ host_str()

const char* net::i2p_address::host_str ( ) const
inlinenoexcept
Returns
Null-terminated x.b32.i2p value or unknown_str().

◆ is_blockable()

bool net::i2p_address::is_blockable ( ) const
inlinenoexcept
Returns
!is_unknown().

◆ is_local()

static constexpr bool net::i2p_address::is_local ( )
inlinestaticconstexprnoexcept

◆ is_loopback()

static constexpr bool net::i2p_address::is_loopback ( )
inlinestaticconstexprnoexcept

◆ is_same_host()

bool net::i2p_address::is_same_host ( const i2p_address rhs) const
noexcept
Returns
True if i2p addresses are identical.

◆ is_unknown()

bool net::i2p_address::is_unknown ( ) const
noexcept
Returns
True if default constructed or via unknown().

◆ less()

bool net::i2p_address::less ( const i2p_address rhs) const
noexcept

◆ make()

expect< i2p_address > net::i2p_address::make ( boost::string_ref  address,
std::uint16_t  default_port = 0 
)
static

Parse address in b32 i2p format (i.e. x.b32.i2p:80) with default_port being used if port is not specified in address.

◆ operator=()

i2p_address & net::i2p_address::operator= ( const i2p_address rhs)
noexcept

◆ port()

std::uint16_t net::i2p_address::port ( ) const
inlinenoexcept
Returns
Port value or 0 if unspecified.

◆ store()

bool net::i2p_address::store ( epee::serialization::portable_storage &  dest,
epee::serialization::section *  hparent 
) const

Store in epee p2p format.

◆ str()

std::string net::i2p_address::str ( ) const
Returns
x.b32.i2p or x.b32.i2p:z if port() != 0.

◆ unknown()

static i2p_address net::i2p_address::unknown ( )
inlinestaticnoexcept
Returns
A default constructed i2p_address object.

◆ unknown_str()

const char * net::i2p_address::unknown_str ( )
staticnoexcept
Returns
<unknown tor host>.

Member Data Documentation

◆ host_

char net::i2p_address::host_[61]
private

◆ port_

std::uint16_t net::i2p_address::port_
private

The documentation for this class was generated from the following files: