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

#include <mn_basic_ip4_address.hpp>

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

Public Member Functions

 basic_ip4_address ()
 Construct a none IPv4 basic_ip4_address. More...
 
 basic_ip4_address (uint32_t newAddress) noexcept
 Construct a ip4 address from uint32_t. More...
 
 basic_ip4_address (uint8_t adress[MNNET_IPV4_ADDRESS_BYTES]) noexcept
 Construct a ip4 address from array. More...
 
 basic_ip4_address (uint8_t a, uint8_t b, uint8_t c, uint8_t d) noexcept
 Construct a ip4 address from bytes. More...
 
 basic_ip4_address (const char *str_ip) noexcept
 Construct an basic_ip4_address from the string containing. More...
 
 basic_ip4_address (const basic_ip4_address &other) noexcept
 Construct an basic_ip4_address by copying another one. More...
 
uint8_t * get_bytes ()
 Get the ip4 address as array. More...
 
int length () const
 Returns the length in bytes of the ip address. More...
 
void set_zero ()
 Get the ip4 address as array. More...
 
void set_any ()
 Set the ip as ANY Address. More...
 
void set_broadcast ()
 Set the ip as BROADCAST Address. More...
 
void set_loop ()
 Set the ip as LOOPBACK Address. More...
 
virtual bool is_equel (const basic_ip4_address &ipOther)
 
bool is_loopback ()
 
bool is_broadcast ()
 
bool is_multicast ()
 
bool is_linklocal ()
 
virtual const char * to_string ()
 Returns a string containing a representation of the address in presentation format. More...
 
basic_ip4_address calc_broadcast (const basic_ip4_address &subnet)
 
basic_ip4_address calc_network_id (const basic_ip4_address &subnet)
 
uint8_t operator[] (int index) const
 array get opertor on the uint8_t array[4] More...
 
uint8_t & operator[] (int index)
 array get opertor on the uint8_t array[4] More...
 
bool operator== (const basic_ip4_address &ipOther)
 equel operator More...
 
bool operator!= (const basic_ip4_address &ipOther)
 unequel operator More...
 
bool operator== (const uint8_t *addr)
 equel operator More...
 
basic_ip4_addressoperator= (const uint32_t &address)
 Assigns an basic_ip4_address. More...
 
basic_ip4_addressoperator= (const basic_ip4_address &address)
 Assigns an basic_ip4_address. More...
 
basic_ip4_address operator& (const basic_ip4_address &other) const
 arametic AND operator More...
 
basic_ip4_address operator| (const basic_ip4_address &other) const
 arametic OR operator More...
 
basic_ip4_address operator^ (const basic_ip4_address &other) const
 arametic XOR operator More...
 
basic_ip4_address operator~ () const
 arametic NICHT operator More...
 
 operator uint32_t () const
 cast operator More...
 
virtual void swap (basic_ip4_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 uint8_t get_subnet_cidr (const basic_ip4_address &subnet)
 Get the subnet_cidr from the given netmask. More...
 

Protected Attributes

union {
uint8_t as_array [MNNET_IPV4_ADDRESS_BYTES]
 
uint32_t as_int32
 
}; 
 
- 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_ip4_address() [1/6]

mn::net::basic_ip4_address::basic_ip4_address ( )

Construct a none IPv4 basic_ip4_address.

◆ basic_ip4_address() [2/6]

mn::net::basic_ip4_address::basic_ip4_address ( uint32_t  newAddress)
explicitnoexcept

Construct a ip4 address from uint32_t.

Parameters
newAddressThe ip4 address as uint32_t

◆ basic_ip4_address() [3/6]

mn::net::basic_ip4_address::basic_ip4_address ( uint8_t  adress[MNNET_IPV4_ADDRESS_BYTES])
noexcept

Construct a ip4 address from array.

Parameters
adressThe ip4 address as array

◆ basic_ip4_address() [4/6]

mn::net::basic_ip4_address::basic_ip4_address ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d 
)
noexcept

Construct a ip4 address from bytes.

Parameters
aThe first octan
bThe second octan
cThe third octan
dThe 4. octan

◆ basic_ip4_address() [5/6]

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

Construct an basic_ip4_address from the string containing.

◆ basic_ip4_address() [6/6]

mn::net::basic_ip4_address::basic_ip4_address ( const basic_ip4_address other)
noexcept

Construct an basic_ip4_address by copying another one.

Parameters
otherThe soucre of this copying address

Member Function Documentation

◆ calc_broadcast()

basic_ip4_address mn::net::basic_ip4_address::calc_broadcast ( const basic_ip4_address subnet)

calculate a broadcast address from this address and the given subnet address

Returns
The calculated broadcast address

◆ calc_network_id()

basic_ip4_address mn::net::basic_ip4_address::calc_network_id ( const basic_ip4_address subnet)

calculate a network id address from this address and the given subnet address

Returns
The calculated network id address

◆ get_bytes()

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

Get the ip4 address as array.

Returns
the ip4 address as array

Implements mn::net::basic_ip_address.

◆ get_subnet_cidr()

uint8_t mn::net::basic_ip4_address::get_subnet_cidr ( const basic_ip4_address subnet)
static

Get the subnet_cidr from the given netmask.

Returns
The calculate subnet_cidr

◆ is_broadcast()

bool mn::net::basic_ip4_address::is_broadcast ( )
inlinevirtual

is the ip4 address a broadcast address?

Returns
If true then yes and false when not

Implements mn::net::basic_ip_address.

◆ is_equel()

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

is the given ip4address equel with this

Returns
If true then equel and if false then not

◆ is_linklocal()

bool mn::net::basic_ip4_address::is_linklocal ( )
inline

is the ip4 address link local?

Returns
If true then yes and false when not

◆ is_loopback()

bool mn::net::basic_ip4_address::is_loopback ( )
inlinevirtual

is the ip4 address a loopback address?

Returns
If true then yes and false when not

Implements mn::net::basic_ip_address.

◆ is_multicast()

bool mn::net::basic_ip4_address::is_multicast ( )
inline

is the ip4 address a multicast address?

Returns
If true then yes and false when not

◆ length()

int mn::net::basic_ip4_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.

◆ operator uint32_t()

mn::net::basic_ip4_address::operator uint32_t ( ) const
inline

cast operator

◆ operator!=()

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

unequel operator

◆ operator&()

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

arametic AND operator

Returns
this-ip AND other

◆ operator=() [1/2]

basic_ip4_address & mn::net::basic_ip4_address::operator= ( const basic_ip4_address address)

Assigns an basic_ip4_address.

◆ operator=() [2/2]

basic_ip4_address & mn::net::basic_ip4_address::operator= ( const uint32_t &  address)

Assigns an basic_ip4_address.

◆ operator==() [1/2]

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

equel operator

◆ operator==() [2/2]

bool mn::net::basic_ip4_address::operator== ( const uint8_t *  addr)

equel operator

◆ operator[]() [1/2]

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

array get opertor on the uint8_t array[4]

◆ operator[]() [2/2]

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

array get opertor on the uint8_t array[4]

◆ operator^()

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

arametic XOR operator

Returns
this-ip XOR other

◆ operator|()

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

arametic OR operator

Returns
this-ip OR other

◆ operator~()

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

arametic NICHT operator

Returns
this-ip NICHT other

◆ set_any()

void mn::net::basic_ip4_address::set_any ( )
inline

Set the ip as ANY Address.

◆ set_broadcast()

void mn::net::basic_ip4_address::set_broadcast ( )
inline

Set the ip as BROADCAST Address.

◆ set_loop()

void mn::net::basic_ip4_address::set_loop ( )
inline

Set the ip as LOOPBACK Address.

◆ set_zero()

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

Get the ip4 address as array.

◆ swap()

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

◆ to_string()

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

Returns a string containing a representation of the address in presentation format.

Returns
The ip4 address as string

Implements mn::net::basic_ip_address.

Member Data Documentation

◆ 

union { ... }

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


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