Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::com::helper::Ipv4Address Struct Reference

IPv4 address wrapper helper. More...

#include <ipv4_address.h>

Public Member Functions

 Ipv4Address (uint8_t octet0, uint8_t octet1, uint8_t octet2, uint8_t octet3) noexcept
 Constructor. More...
 
 Ipv4Address (std::string ipAddress)
 Constructor. More...
 
std::string ToString () const
 Convert the IP address to string. More...
 

Static Public Member Functions

static void Inject (std::vector< uint8_t > &vector, Ipv4Address ipAddress)
 Inject an IP address into a byte vector. More...
 
static Ipv4Address Extract (const std::vector< uint8_t > &vector, std::size_t &offset)
 Extract an IPv4 address from a byte vector. More...
 

Public Attributes

std::array< uint8_t, 4 > Octets
 IPv4 address octets.
 

Detailed Description

IPv4 address wrapper helper.

Constructor & Destructor Documentation

◆ Ipv4Address() [1/2]

ara::com::helper::Ipv4Address::Ipv4Address ( uint8_t  octet0,
uint8_t  octet1,
uint8_t  octet2,
uint8_t  octet3 
)
noexcept

Constructor.

Parameters
octet0IPv4 first octet
octet1IPv4 second octet
octet2IPv4 third octet
octet3IPv4 forth octet

◆ Ipv4Address() [2/2]

ara::com::helper::Ipv4Address::Ipv4Address ( std::string  ipAddress)

Constructor.

Parameters
ipAddressIPv4 address string

Member Function Documentation

◆ Extract()

Ipv4Address ara::com::helper::Ipv4Address::Extract ( const std::vector< uint8_t > &  vector,
std::size_t &  offset 
)
static

Extract an IPv4 address from a byte vector.

Parameters
vectorByte vector
offsetExtract offset at the vector
Returns
Extracted IPv4 address

◆ Inject()

void ara::com::helper::Ipv4Address::Inject ( std::vector< uint8_t > &  vector,
Ipv4Address  ipAddress 
)
static

Inject an IP address into a byte vector.

Parameters
vectorByte vector
ipAddressIP address to be injected

◆ ToString()

std::string ara::com::helper::Ipv4Address::ToString ( ) const

Convert the IP address to string.

Returns
IP address in string format