OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::IPv6::Addr Class Reference

#include <ipv6.hpp>

Collaboration diagram for openvpn::IPv6::Addr:
[legend]

Classes

union  ipv6addr
 

Public Member Functions

in6_addr to_in6_addr () const
 
sockaddr_in6 to_sockaddr (const unsigned short port=0) const
 
std::string to_string () const
 
std::string to_hex () const
 
unsigned long to_ulong () const
 
long to_long () const
 
void to_byte_string (unsigned char *bytestr) const
 
openvpn_io::ip::address_v6 to_asio () const
 
Addr netmask_from_this_as_extent () const
 
Addr operator& (const Addr &other) const
 
Addr operator| (const Addr &other) const
 
Addr operator+ (const long delta) const
 
Addr operator+ (const Addr &other) const
 
Addr operator- (const long delta) const
 
Addr operator- (const Addr &other) const
 
Addr operator* (const Addr &d) const
 
Addr operator/ (const Addr &d) const
 
Addr operator% (const Addr &d) const
 
Addr operator<< (const unsigned int shift) const
 
Addr operator>> (const unsigned int shift) const
 
Addr operator~ () const
 
Addr network_addr (const unsigned int prefix_len) const
 
bool operator== (const Addr &other) const
 
bool operator!= (const Addr &other) const
 
bool operator< (const Addr &other) const
 
bool operator> (const Addr &other) const
 
bool operator<= (const Addr &other) const
 
bool operator>= (const Addr &other) const
 
bool unspecified () const
 
bool specified () const
 
bool all_zeros () const
 
bool all_ones () const
 
bool is_loopback () const
 
bool is_mapped_address () const
 
std::uint32_t get_mapped_ipv4_address () const
 
bool bit (unsigned int pos) const
 
unsigned int prefix_len () const
 
unsigned int host_len () const
 
Addr extent_from_netmask () const
 
template<typename HASH >
void hash (HASH &h) const
 
void negate ()
 
void zero ()
 
void zero_complement ()
 
void one ()
 
Addroperator++ ()
 
Addroperator+= (const long delta)
 
Addroperator-= (const long delta)
 
Addroperator+= (const Addr &other)
 
Addroperator-= (const Addr &other)
 
Addroperator<<= (const unsigned int shift)
 
Addroperator>>= (const unsigned int shift)
 
void set_clear_bit (unsigned int pos, bool value)
 
void set_bit (unsigned int pos, bool value)
 
int scope_id () const
 

Static Public Member Functions

static constexpr int ip_version ()
 
static constexpr bool defined ()
 
static Addr from_addr (const Addr &addr)
 
static Addr from_in6_addr (const in6_addr *in6)
 
static Addr from_sockaddr (const sockaddr_in6 *sa)
 
template<typename TITLE >
static Addr from_string (const std::string &ipstr, const TITLE &title)
 
static Addr from_string (const std::string &ipstr)
 
static Addr from_hex (const std::string &s)
 
static Addr from_ulong (unsigned long ul)
 
static Addr from_long (long ul)
 
static std::string arpa ()
 
static Addr from_asio (const openvpn_io::ip::address_v6 &asio_addr)
 
static Addr from_byte_string (const unsigned char *bytestr)
 
static void v4_to_byte_string (unsigned char *bytestr, const std::uint32_t v4addr)
 
static bool byte_string_is_v4 (const unsigned char *bytestr)
 
static std::uint32_t v4_from_byte_string (const unsigned char *bytestr)
 
static Addr from_zero ()
 
static Addr from_one ()
 
static Addr from_zero_complement ()
 
static Addr netmask_from_prefix_len (const unsigned int prefix_len)
 
static unsigned int size ()
 
static void div (const Addr &numerator, const Addr &denominator, Addr &quotient, Addr &remainder)
 

Static Public Attributes

static constexpr unsigned int SIZE = 128
 

Private Member Functions

void prefix_len_to_netmask_unchecked (const unsigned int prefix_len)
 
void prefix_len_to_netmask (const unsigned int prefix_len)
 
template<typename Comparator >
bool compare (const Addr &other, Comparator comp) const
 

Static Private Member Functions

static void host_to_network_order (ipv6addr *dest, const ipv6addr *src)
 
static void network_to_host_order (ipv6addr *dest, const ipv6addr *src)
 
static void shiftl128 (std::uint64_t &low, std::uint64_t &high, unsigned int shift)
 
static void shiftr128 (std::uint64_t &low, std::uint64_t &high, unsigned int shift)
 
static void add (ipv6addr &dest, const ipv6addr &src)
 
static void sub (ipv6addr &dest, const ipv6addr &src)
 

Private Attributes

ipv6addr u
 
unsigned int scope_id_ = 0
 

Friends

class IP::Addr
 

Detailed Description

Definition at line 38 of file ipv6.hpp.

Member Function Documentation

◆ add()

static void openvpn::IPv6::Addr::add ( ipv6addr dest,
const ipv6addr src 
)
inlinestaticprivate

Definition at line 861 of file ipv6.hpp.

Here is the caller graph for this function:

◆ all_ones()

bool openvpn::IPv6::Addr::all_ones ( ) const
inline

Definition at line 494 of file ipv6.hpp.

◆ all_zeros()

bool openvpn::IPv6::Addr::all_zeros ( ) const
inline

Definition at line 489 of file ipv6.hpp.

Here is the caller graph for this function:

◆ arpa()

static std::string openvpn::IPv6::Addr::arpa ( )
inlinestatic

Definition at line 236 of file ipv6.hpp.

◆ bit()

bool openvpn::IPv6::Addr::bit ( unsigned int  pos) const
inline

Definition at line 514 of file ipv6.hpp.

Here is the caller graph for this function:

◆ byte_string_is_v4()

static bool openvpn::IPv6::Addr::byte_string_is_v4 ( const unsigned char *  bytestr)
inlinestatic

Definition at line 283 of file ipv6.hpp.

Here is the caller graph for this function:

◆ compare()

template<typename Comparator >
bool openvpn::IPv6::Addr::compare ( const Addr other,
Comparator  comp 
) const
inlineprivate

Definition at line 881 of file ipv6.hpp.

Here is the caller graph for this function:

◆ defined()

static constexpr bool openvpn::IPv6::Addr::defined ( )
inlinestaticconstexpr

Definition at line 50 of file ipv6.hpp.

◆ div()

static void openvpn::IPv6::Addr::div ( const Addr numerator,
const Addr denominator,
Addr quotient,
Addr remainder 
)
inlinestatic

Definition at line 699 of file ipv6.hpp.

Here is the caller graph for this function:

◆ extent_from_netmask()

Addr openvpn::IPv6::Addr::extent_from_netmask ( ) const
inline

Definition at line 561 of file ipv6.hpp.

◆ from_addr()

static Addr openvpn::IPv6::Addr::from_addr ( const Addr addr)
inlinestatic

Definition at line 55 of file ipv6.hpp.

◆ from_asio()

static Addr openvpn::IPv6::Addr::from_asio ( const openvpn_io::ip::address_v6 &  asio_addr)
inlinestatic

Definition at line 241 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_byte_string()

static Addr openvpn::IPv6::Addr::from_byte_string ( const unsigned char *  bytestr)
inlinestatic

Definition at line 251 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_hex()

static Addr openvpn::IPv6::Addr::from_hex ( const std::string &  s)
inlinestatic

Definition at line 139 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_in6_addr()

static Addr openvpn::IPv6::Addr::from_in6_addr ( const in6_addr *  in6)
inlinestatic

Definition at line 60 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_long()

static Addr openvpn::IPv6::Addr::from_long ( long  ul)
inlinestatic

Definition at line 204 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_one()

static Addr openvpn::IPv6::Addr::from_one ( )
inlinestatic

Definition at line 311 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_sockaddr()

static Addr openvpn::IPv6::Addr::from_sockaddr ( const sockaddr_in6 *  sa)
inlinestatic

Definition at line 79 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_string() [1/2]

static Addr openvpn::IPv6::Addr::from_string ( const std::string &  ipstr)
inlinestatic

Definition at line 110 of file ipv6.hpp.

◆ from_string() [2/2]

template<typename TITLE >
static Addr openvpn::IPv6::Addr::from_string ( const std::string &  ipstr,
const TITLE &  title 
)
inlinestatic

Definition at line 101 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_ulong()

static Addr openvpn::IPv6::Addr::from_ulong ( unsigned long  ul)
inlinestatic

Definition at line 187 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_zero()

static Addr openvpn::IPv6::Addr::from_zero ( )
inlinestatic

Definition at line 304 of file ipv6.hpp.

Here is the caller graph for this function:

◆ from_zero_complement()

static Addr openvpn::IPv6::Addr::from_zero_complement ( )
inlinestatic

Definition at line 318 of file ipv6.hpp.

Here is the caller graph for this function:

◆ get_mapped_ipv4_address()

std::uint32_t openvpn::IPv6::Addr::get_mapped_ipv4_address ( ) const
inline

Definition at line 509 of file ipv6.hpp.

Here is the caller graph for this function:

◆ hash()

template<typename HASH >
void openvpn::IPv6::Addr::hash ( HASH &  h) const
inline

Definition at line 582 of file ipv6.hpp.

◆ host_len()

unsigned int openvpn::IPv6::Addr::host_len ( ) const
inline

Definition at line 555 of file ipv6.hpp.

Here is the caller graph for this function:

◆ host_to_network_order()

static void openvpn::IPv6::Addr::host_to_network_order ( ipv6addr dest,
const ipv6addr src 
)
inlinestaticprivate

Definition at line 778 of file ipv6.hpp.

Here is the caller graph for this function:

◆ ip_version()

static constexpr int openvpn::IPv6::Addr::ip_version ( )
inlinestaticconstexpr

Definition at line 45 of file ipv6.hpp.

◆ is_loopback()

bool openvpn::IPv6::Addr::is_loopback ( ) const
inline

Definition at line 499 of file ipv6.hpp.

◆ is_mapped_address()

bool openvpn::IPv6::Addr::is_mapped_address ( ) const
inline

Definition at line 504 of file ipv6.hpp.

◆ negate()

void openvpn::IPv6::Addr::negate ( )
inline

Definition at line 600 of file ipv6.hpp.

Here is the caller graph for this function:

◆ netmask_from_prefix_len()

static Addr openvpn::IPv6::Addr::netmask_from_prefix_len ( const unsigned int  prefix_len)
inlinestatic

Definition at line 325 of file ipv6.hpp.

Here is the caller graph for this function:

◆ netmask_from_this_as_extent()

Addr openvpn::IPv6::Addr::netmask_from_this_as_extent ( ) const
inline

Definition at line 332 of file ipv6.hpp.

◆ network_addr()

Addr openvpn::IPv6::Addr::network_addr ( const unsigned int  prefix_len) const
inline

Definition at line 446 of file ipv6.hpp.

◆ network_to_host_order()

static void openvpn::IPv6::Addr::network_to_host_order ( ipv6addr dest,
const ipv6addr src 
)
inlinestaticprivate

Definition at line 786 of file ipv6.hpp.

Here is the caller graph for this function:

◆ one()

void openvpn::IPv6::Addr::one ( )
inline

Definition at line 618 of file ipv6.hpp.

Here is the caller graph for this function:

◆ operator!=()

bool openvpn::IPv6::Addr::operator!= ( const Addr other) const
inline

Definition at line 456 of file ipv6.hpp.

◆ operator%()

Addr openvpn::IPv6::Addr::operator% ( const Addr d) const
inline

Definition at line 411 of file ipv6.hpp.

◆ operator&()

Addr openvpn::IPv6::Addr::operator& ( const Addr other) const
inline

Definition at line 344 of file ipv6.hpp.

◆ operator*()

Addr openvpn::IPv6::Addr::operator* ( const Addr d) const
inline

Definition at line 391 of file ipv6.hpp.

◆ operator+() [1/2]

Addr openvpn::IPv6::Addr::operator+ ( const Addr other) const
inline

Definition at line 372 of file ipv6.hpp.

◆ operator+() [2/2]

Addr openvpn::IPv6::Addr::operator+ ( const long  delta) const
inline

Definition at line 362 of file ipv6.hpp.

Here is the caller graph for this function:

◆ operator++()

Addr & openvpn::IPv6::Addr::operator++ ( )
inline

Definition at line 624 of file ipv6.hpp.

◆ operator+=() [1/2]

Addr & openvpn::IPv6::Addr::operator+= ( const Addr other)
inline

Definition at line 642 of file ipv6.hpp.

◆ operator+=() [2/2]

Addr & openvpn::IPv6::Addr::operator+= ( const long  delta)
inline

Definition at line 631 of file ipv6.hpp.

Here is the caller graph for this function:

◆ operator-() [1/2]

Addr openvpn::IPv6::Addr::operator- ( const Addr other) const
inline

Definition at line 384 of file ipv6.hpp.

◆ operator-() [2/2]

Addr openvpn::IPv6::Addr::operator- ( const long  delta) const
inline

Definition at line 379 of file ipv6.hpp.

◆ operator-=() [1/2]

Addr & openvpn::IPv6::Addr::operator-= ( const Addr other)
inline

Definition at line 648 of file ipv6.hpp.

◆ operator-=() [2/2]

Addr & openvpn::IPv6::Addr::operator-= ( const long  delta)
inline

Definition at line 637 of file ipv6.hpp.

◆ operator/()

Addr openvpn::IPv6::Addr::operator/ ( const Addr d) const
inline

Definition at line 404 of file ipv6.hpp.

◆ operator<()

bool openvpn::IPv6::Addr::operator< ( const Addr other) const
inline

Definition at line 462 of file ipv6.hpp.

◆ operator<<()

Addr openvpn::IPv6::Addr::operator<< ( const unsigned int  shift) const
inline

Definition at line 418 of file ipv6.hpp.

◆ operator<<=()

Addr & openvpn::IPv6::Addr::operator<<= ( const unsigned int  shift)
inline

Definition at line 654 of file ipv6.hpp.

◆ operator<=()

bool openvpn::IPv6::Addr::operator<= ( const Addr other) const
inline

Definition at line 470 of file ipv6.hpp.

◆ operator==()

bool openvpn::IPv6::Addr::operator== ( const Addr other) const
inline

Definition at line 451 of file ipv6.hpp.

Here is the caller graph for this function:

◆ operator>()

bool openvpn::IPv6::Addr::operator> ( const Addr other) const
inline

Definition at line 466 of file ipv6.hpp.

◆ operator>=()

bool openvpn::IPv6::Addr::operator>= ( const Addr other) const
inline

Definition at line 474 of file ipv6.hpp.

◆ operator>>()

Addr openvpn::IPv6::Addr::operator>> ( const unsigned int  shift) const
inline

Definition at line 427 of file ipv6.hpp.

◆ operator>>=()

Addr & openvpn::IPv6::Addr::operator>>= ( const unsigned int  shift)
inline

Definition at line 662 of file ipv6.hpp.

◆ operator|()

Addr openvpn::IPv6::Addr::operator| ( const Addr other) const
inline

Definition at line 353 of file ipv6.hpp.

◆ operator~()

Addr openvpn::IPv6::Addr::operator~ ( ) const
inline

Definition at line 436 of file ipv6.hpp.

◆ prefix_len()

unsigned int openvpn::IPv6::Addr::prefix_len ( ) const
inline

Definition at line 523 of file ipv6.hpp.

Here is the caller graph for this function:

◆ prefix_len_to_netmask()

void openvpn::IPv6::Addr::prefix_len_to_netmask ( const unsigned int  prefix_len)
inlineprivate

Definition at line 771 of file ipv6.hpp.

Here is the caller graph for this function:

◆ prefix_len_to_netmask_unchecked()

void openvpn::IPv6::Addr::prefix_len_to_netmask_unchecked ( const unsigned int  prefix_len)
inlineprivate

Definition at line 733 of file ipv6.hpp.

Here is the caller graph for this function:

◆ scope_id()

int openvpn::IPv6::Addr::scope_id ( ) const
inline

Definition at line 720 of file ipv6.hpp.

◆ set_bit()

void openvpn::IPv6::Addr::set_bit ( unsigned int  pos,
bool  value 
)
inline

Definition at line 688 of file ipv6.hpp.

Here is the caller graph for this function:

◆ set_clear_bit()

void openvpn::IPv6::Addr::set_clear_bit ( unsigned int  pos,
bool  value 
)
inline

Definition at line 670 of file ipv6.hpp.

◆ shiftl128()

static void openvpn::IPv6::Addr::shiftl128 ( std::uint64_t &  low,
std::uint64_t &  high,
unsigned int  shift 
)
inlinestaticprivate

Definition at line 795 of file ipv6.hpp.

Here is the caller graph for this function:

◆ shiftr128()

static void openvpn::IPv6::Addr::shiftr128 ( std::uint64_t &  low,
std::uint64_t &  high,
unsigned int  shift 
)
inlinestaticprivate

Definition at line 832 of file ipv6.hpp.

Here is the caller graph for this function:

◆ size()

static unsigned int openvpn::IPv6::Addr::size ( )
inlinestatic

Definition at line 576 of file ipv6.hpp.

◆ specified()

bool openvpn::IPv6::Addr::specified ( ) const
inline

Definition at line 484 of file ipv6.hpp.

Here is the caller graph for this function:

◆ sub()

static void openvpn::IPv6::Addr::sub ( ipv6addr dest,
const ipv6addr src 
)
inlinestaticprivate

Definition at line 871 of file ipv6.hpp.

Here is the caller graph for this function:

◆ to_asio()

openvpn_io::ip::address_v6 openvpn::IPv6::Addr::to_asio ( ) const
inline

Definition at line 297 of file ipv6.hpp.

Here is the caller graph for this function:

◆ to_byte_string()

void openvpn::IPv6::Addr::to_byte_string ( unsigned char *  bytestr) const
inline

Definition at line 263 of file ipv6.hpp.

◆ to_hex()

std::string openvpn::IPv6::Addr::to_hex ( ) const
inline

Definition at line 167 of file ipv6.hpp.

◆ to_in6_addr()

in6_addr openvpn::IPv6::Addr::to_in6_addr ( ) const
inline

Definition at line 72 of file ipv6.hpp.

Here is the caller graph for this function:

◆ to_long()

long openvpn::IPv6::Addr::to_long ( ) const
inline

Definition at line 220 of file ipv6.hpp.

◆ to_sockaddr()

sockaddr_in6 openvpn::IPv6::Addr::to_sockaddr ( const unsigned short  port = 0) const
inline

Definition at line 84 of file ipv6.hpp.

Here is the caller graph for this function:

◆ to_string()

std::string openvpn::IPv6::Addr::to_string ( ) const
inline

Definition at line 128 of file ipv6.hpp.

Here is the caller graph for this function:

◆ to_ulong()

unsigned long openvpn::IPv6::Addr::to_ulong ( ) const
inline

Definition at line 195 of file ipv6.hpp.

◆ unspecified()

bool openvpn::IPv6::Addr::unspecified ( ) const
inline

Definition at line 479 of file ipv6.hpp.

Here is the caller graph for this function:

◆ v4_from_byte_string()

static std::uint32_t openvpn::IPv6::Addr::v4_from_byte_string ( const unsigned char *  bytestr)
inlinestatic

Definition at line 290 of file ipv6.hpp.

Here is the caller graph for this function:

◆ v4_to_byte_string()

static void openvpn::IPv6::Addr::v4_to_byte_string ( unsigned char *  bytestr,
const std::uint32_t  v4addr 
)
inlinestatic

Definition at line 273 of file ipv6.hpp.

Here is the caller graph for this function:

◆ zero()

void openvpn::IPv6::Addr::zero ( )
inline

Definition at line 606 of file ipv6.hpp.

Here is the caller graph for this function:

◆ zero_complement()

void openvpn::IPv6::Addr::zero_complement ( )
inline

Definition at line 612 of file ipv6.hpp.

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ IP::Addr

friend class IP::Addr
friend

Definition at line 40 of file ipv6.hpp.

Member Data Documentation

◆ scope_id_

unsigned int openvpn::IPv6::Addr::scope_id_ = 0
private

Definition at line 894 of file ipv6.hpp.

◆ SIZE

constexpr unsigned int openvpn::IPv6::Addr::SIZE = 128
staticconstexpr

Definition at line 43 of file ipv6.hpp.

◆ u

ipv6addr openvpn::IPv6::Addr::u
private

Definition at line 893 of file ipv6.hpp.


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