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 Types

enum  { SIZE = 128 }
 

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)
 

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 Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SIZE 

Definition at line 43 of file ipv6.hpp.

Member Function Documentation

◆ add()

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

Definition at line 864 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 497 of file ipv6.hpp.

◆ all_zeros()

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

Definition at line 492 of file ipv6.hpp.

Here is the caller graph for this function:

◆ arpa()

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

Definition at line 239 of file ipv6.hpp.

◆ bit()

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

Definition at line 517 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 286 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 884 of file ipv6.hpp.

Here is the caller graph for this function:

◆ defined()

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

Definition at line 53 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 702 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 564 of file ipv6.hpp.

◆ from_addr()

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

Definition at line 58 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 244 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 254 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 142 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 63 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 207 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 314 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 82 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 113 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 104 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 190 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 307 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 321 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 512 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 585 of file ipv6.hpp.

◆ host_len()

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

Definition at line 558 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 781 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 48 of file ipv6.hpp.

◆ is_loopback()

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

Definition at line 502 of file ipv6.hpp.

◆ is_mapped_address()

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

Definition at line 507 of file ipv6.hpp.

◆ negate()

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

Definition at line 603 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 328 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 335 of file ipv6.hpp.

◆ network_addr()

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

Definition at line 449 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 789 of file ipv6.hpp.

Here is the caller graph for this function:

◆ one()

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

Definition at line 621 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 459 of file ipv6.hpp.

◆ operator%()

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

Definition at line 414 of file ipv6.hpp.

◆ operator&()

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

Definition at line 347 of file ipv6.hpp.

◆ operator*()

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

Definition at line 394 of file ipv6.hpp.

◆ operator+() [1/2]

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

Definition at line 375 of file ipv6.hpp.

◆ operator+() [2/2]

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

Definition at line 365 of file ipv6.hpp.

Here is the caller graph for this function:

◆ operator++()

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

Definition at line 627 of file ipv6.hpp.

◆ operator+=() [1/2]

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

Definition at line 645 of file ipv6.hpp.

◆ operator+=() [2/2]

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

Definition at line 634 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 387 of file ipv6.hpp.

◆ operator-() [2/2]

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

Definition at line 382 of file ipv6.hpp.

◆ operator-=() [1/2]

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

Definition at line 651 of file ipv6.hpp.

◆ operator-=() [2/2]

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

Definition at line 640 of file ipv6.hpp.

◆ operator/()

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

Definition at line 407 of file ipv6.hpp.

◆ operator<()

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

Definition at line 465 of file ipv6.hpp.

◆ operator<<()

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

Definition at line 421 of file ipv6.hpp.

◆ operator<<=()

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

Definition at line 657 of file ipv6.hpp.

◆ operator<=()

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

Definition at line 473 of file ipv6.hpp.

◆ operator==()

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

Definition at line 454 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 469 of file ipv6.hpp.

◆ operator>=()

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

Definition at line 477 of file ipv6.hpp.

◆ operator>>()

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

Definition at line 430 of file ipv6.hpp.

◆ operator>>=()

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

Definition at line 665 of file ipv6.hpp.

◆ operator|()

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

Definition at line 356 of file ipv6.hpp.

◆ operator~()

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

Definition at line 439 of file ipv6.hpp.

◆ prefix_len()

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

Definition at line 526 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 774 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 736 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 723 of file ipv6.hpp.

◆ set_bit()

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

Definition at line 691 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 673 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 798 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 835 of file ipv6.hpp.

Here is the caller graph for this function:

◆ size()

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

Definition at line 579 of file ipv6.hpp.

◆ specified()

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

Definition at line 487 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 874 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 300 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 266 of file ipv6.hpp.

◆ to_hex()

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

Definition at line 170 of file ipv6.hpp.

◆ to_in6_addr()

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

Definition at line 75 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 223 of file ipv6.hpp.

◆ to_sockaddr()

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

Definition at line 87 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 131 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 198 of file ipv6.hpp.

◆ unspecified()

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

Definition at line 482 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 293 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 276 of file ipv6.hpp.

Here is the caller graph for this function:

◆ zero()

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

Definition at line 609 of file ipv6.hpp.

Here is the caller graph for this function:

◆ zero_complement()

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

Definition at line 615 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 897 of file ipv6.hpp.

◆ u

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

Definition at line 896 of file ipv6.hpp.


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