This class represents an internet (IP) version 6 host address. More...

#include <mn_basic_ip6_address.hpp>

+ Inheritance diagram for mn::net::basic_ip6_address:
+ Collaboration diagram for mn::net::basic_ip6_address:

Public Member Functions

 basic_ip6_address ()
 construct a ip6 address (any) More...
 
 basic_ip6_address (uint32_t ax, uint32_t bx, uint32_t cx, uint32_t dx) noexcept
 construct a ip6 address from uint32_t's More...
 
 basic_ip6_address (uint32_t iarray[4]) noexcept
 construct a ip6 address from uint32_t's More...
 
 basic_ip6_address (uint8_t address[16]) noexcept
 construct a ip6 address from array More...
 
 basic_ip6_address (const char *str_ip) noexcept
 construct a ip6 address from string More...
 
 basic_ip6_address (const basic_ip6_address &ipOther) noexcept
 construct a ip6 address from a other ip6 address More...
 
const char * to_string ()
 
uint8_t * get_bytes ()
 
uint32_t * get_array ()
 
int length () const
 Returns the length in bytes of the ip address. More...
 
virtual uint32_t get_int (int index)
 Get the ip section on the given position as int. More...
 
virtual uint32_t get_int (int index) const
 Get the ip section on the given position as int. More...
 
void set_zero ()
 set the ip to zero More...
 
void set_loopback ()
 set the ip to loopback More...
 
virtual bool is_loopback ()
 
virtual bool is_broadcast ()
 
virtual bool is_multicast ()
 
virtual bool is_any ()
 
virtual bool is_linklocal ()
 
virtual bool is_sitelocal ()
 
virtual bool is_toredo ()
 
virtual bool is_ip4mapped ()
 
virtual bool is_equel (const basic_ip6_address &ipOther)
 
virtual bool is_equel (const basic_ip6_address &ipOther, const basic_ip6_address &mask)
 
basic_ip6_addressoperator= (const basic_ip6_address &ip)
 
uint8_t operator[] (int index) const
 
uint8_t & operator[] (int index)
 
bool operator== (const basic_ip6_address &ipOther)
 
bool operator!= (const basic_ip6_address &ipOther)
 
basic_ip6_address operator& (const basic_ip6_address &other) const
 
basic_ip6_address operator| (const basic_ip6_address &other) const
 
basic_ip6_address operator^ (const basic_ip6_address &other) const
 
basic_ip6_address operator~ () const
 
virtual void swap (basic_ip6_address &rhs) noexcept
 
- Public Member Functions inherited from mn::net::basic_ip_address
 basic_ip_address (address_family fam)
 Constructor. More...
 
virtual address_family get_family ()
 Get the address family (AF_INET or AF_INET6) of the address. More...
 
virtual void swap (basic_ip_address &rhs) noexcept
 

Static Public Member Functions

static basic_ip4_address to_ip4 (const basic_ip6_address &ip6)
 
static basic_ip6_address from_ip4 (const basic_ip4_address &ip4)
 Create a new basic_ip6_address from a given IPv4 address. More...
 
static basic_ip6_address netmask (int mask)
 

Protected Attributes

union {
uint8_t m_Numbers [MNNET_IPV6_ADDRESS_BYTES]
 
uint16_t as_short [8]
 
uint32_t as_int [4]
 
}; 
 
- Protected Attributes inherited from mn::net::basic_ip_address
address_family m_aFamily
 A saved / cached copy of the address family type of this socket. More...
 

Detailed Description

This class represents an internet (IP) version 6 host address.

Constructor & Destructor Documentation

◆ basic_ip6_address() [1/6]

mn::net::basic_ip6_address::basic_ip6_address ( )

construct a ip6 address (any)

Construtor

◆ basic_ip6_address() [2/6]

mn::net::basic_ip6_address::basic_ip6_address ( uint32_t  ax,
uint32_t  bx,
uint32_t  cx,
uint32_t  dx 
)
noexcept

construct a ip6 address from uint32_t's

Construtor

◆ basic_ip6_address() [3/6]

mn::net::basic_ip6_address::basic_ip6_address ( uint32_t  iarray[4])
noexcept

construct a ip6 address from uint32_t's

Construtor

◆ basic_ip6_address() [4/6]

mn::net::basic_ip6_address::basic_ip6_address ( uint8_t  address[16])
noexcept

construct a ip6 address from array

Construtor

◆ basic_ip6_address() [5/6]

mn::net::basic_ip6_address::basic_ip6_address ( const char *  str_ip)
noexcept

construct a ip6 address from string

Construtor

Parameters
newAddressThe ip6 address as string

◆ basic_ip6_address() [6/6]

mn::net::basic_ip6_address::basic_ip6_address ( const basic_ip6_address ipOther)
noexcept

construct a ip6 address from a other ip6 address

Construtor

Parameters
ipOtherThe other object

Member Function Documentation

◆ from_ip4()

static basic_ip6_address mn::net::basic_ip6_address::from_ip4 ( const basic_ip4_address ip4)
inlinestatic

Create a new basic_ip6_address from a given IPv4 address.

Parameters
ip4The IPv4 address to convert
Returns
The new basic_ip6_address from a given IPv4 address

◆ get_array()

uint32_t* mn::net::basic_ip6_address::get_array ( )
inline

Get this ip6 address as int array

Returns
the ip6 address as array

◆ get_bytes()

uint8_t * mn::net::basic_ip6_address::get_bytes ( )
virtual

Get this ip6 address as char array

Returns
the ip6 address as array

Implements mn::net::basic_ip_address.

◆ get_int() [1/2]

virtual uint32_t mn::net::basic_ip6_address::get_int ( int  index)
inlinevirtual

Get the ip section on the given position as int.

Parameters
indexThe index of the position (0-3)
Returns
The ip section on the given position as int

◆ get_int() [2/2]

virtual uint32_t mn::net::basic_ip6_address::get_int ( int  index) const
inlinevirtual

Get the ip section on the given position as int.

Parameters
indexThe index of the position (0-3)
Returns
The ip section on the given position as int

◆ is_any()

virtual bool mn::net::basic_ip6_address::is_any ( )
inlinevirtual

◆ is_broadcast()

virtual bool mn::net::basic_ip6_address::is_broadcast ( )
inlinevirtual

is this ip6 address a broadcast address? - return always false

Implements mn::net::basic_ip_address.

◆ is_equel() [1/2]

bool mn::net::basic_ip6_address::is_equel ( const basic_ip6_address ipOther)
virtual

is this ip6 address equel with the given address

Returns
If true then equel and if false then not

◆ is_equel() [2/2]

bool mn::net::basic_ip6_address::is_equel ( const basic_ip6_address ipOther,
const basic_ip6_address mask 
)
virtual

Compare this ip6 address with (ipOther & netmask)

Returns
true if they match, integer different than zero otherwise

◆ is_ip4mapped()

bool mn::net::basic_ip6_address::is_ip4mapped ( )
virtual

is this ip6 address ip4 mapped?

Returns
If true then yes and false when not

◆ is_linklocal()

virtual bool mn::net::basic_ip6_address::is_linklocal ( )
inlinevirtual

is the ip6 address linklocal?

Returns
If true then yes and false when not

◆ is_loopback()

virtual bool mn::net::basic_ip6_address::is_loopback ( )
inlinevirtual

is this ip6 address a loopback address?

Returns
If true then yes and false when not

Implements mn::net::basic_ip_address.

◆ is_multicast()

virtual bool mn::net::basic_ip6_address::is_multicast ( )
inlinevirtual

is this ip6 address a multicast address?

Returns
If true then yes and false when not

◆ is_sitelocal()

virtual bool mn::net::basic_ip6_address::is_sitelocal ( )
inlinevirtual

is this ip6 address sitelocal?

Returns
If true then yes and false when not

◆ is_toredo()

virtual bool mn::net::basic_ip6_address::is_toredo ( )
inlinevirtual

is this ip6 address toredo?

Returns
If true then yes and false when not

◆ length()

int mn::net::basic_ip6_address::length ( ) const
virtual

Returns the length in bytes of the ip address.

Returns
The length in bytes of the ip address

Implements mn::net::basic_ip_address.

◆ netmask()

basic_ip6_address mn::net::basic_ip6_address::netmask ( int  mask)
static

Create an IPv6 netmask

◆ operator!=()

bool mn::net::basic_ip6_address::operator!= ( const basic_ip6_address ipOther)
inline

◆ operator&()

basic_ip6_address mn::net::basic_ip6_address::operator& ( const basic_ip6_address other) const

◆ operator=()

basic_ip6_address & mn::net::basic_ip6_address::operator= ( const basic_ip6_address ip)

◆ operator==()

bool mn::net::basic_ip6_address::operator== ( const basic_ip6_address ipOther)
inline

◆ operator[]() [1/2]

uint8_t& mn::net::basic_ip6_address::operator[] ( int  index)
inline

◆ operator[]() [2/2]

uint8_t mn::net::basic_ip6_address::operator[] ( int  index) const
inline

◆ operator^()

basic_ip6_address mn::net::basic_ip6_address::operator^ ( const basic_ip6_address other) const

◆ operator|()

basic_ip6_address mn::net::basic_ip6_address::operator| ( const basic_ip6_address other) const

◆ operator~()

basic_ip6_address mn::net::basic_ip6_address::operator~ ( ) const

◆ set_loopback()

void mn::net::basic_ip6_address::set_loopback ( )
inline

set the ip to loopback

◆ set_zero()

void mn::net::basic_ip6_address::set_zero ( )
inline

set the ip to zero

◆ swap()

virtual void mn::net::basic_ip6_address::swap ( basic_ip6_address rhs)
inlinevirtualnoexcept

◆ to_ip4()

static basic_ip4_address mn::net::basic_ip6_address::to_ip4 ( const basic_ip6_address ip6)
inlinestatic

Create a new basic_ip4_address from a given IPv6 address

Parameters
ip6The IPv6 address to convert
Returns
The new basic_ip4_address from a given IPv6 address

◆ to_string()

const char * mn::net::basic_ip6_address::to_string ( )
virtual

Get this ip6 address as readeble string

Returns
the ip6 address as readeble string

Implements mn::net::basic_ip_address.

Member Data Documentation

◆ 

union { ... }

The type for a basic_ip6_address, as union - for easer internal use


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