ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | List of all members
anna::diameter::codec::basetypes::Address Class Reference

#include <Address.hpp>

Inheritance diagram for anna::diameter::codec::basetypes::Address:
Inheritance graph
[legend]
Collaboration diagram for anna::diameter::codec::basetypes::Address:
Collaboration graph
[legend]

Public Member Functions

 Address ()
 
virtual ~Address ()
 
void setAbbreviatePresentation (bool abb)
 
const iana_address_tgetIANAAddress () const
 
void setIANAAddress (const iana_address_t &address) noexcept(false)
 
std::string getFormatName () const
 
std::string asPrintableString () noexcept(false)
 
std::string asString () noexcept(false)
 
void decode (const char *buffer, const int size) noexcept(false)
 

Detailed Description

Diameter Address container

Diameter address includes 2 bytes with ip version and 4/16 more for IPv4 and IPv6 respectively

   IPv6 ADDRESS FORMAT CONSIDERATIONS
     IPv6 addresses have two logical parts: a 64-bit network prefix, and a 64-bit host address part.
     The host address is often automatically generated from the interface MAC address.
     An IPv6 address is represented by 8 groups of 16-bit hexadecimal values separated by colons (:) shown as follows:
     A typical example of an IPv6 address is
2001:0db8:85a3:0000:0000:8a2e:0370:7334.
     The hexadecimal digits are case-insensitive.
     The 128-bit IPv6 address can be abbreviated with the following rules:
* Rule one: Leading zeroes within a 16-bit value may be omitted. For example, the address fe80:0000:0000:0000:0202:b3ff:fe1e:8329
            may be written as fe80:0:0:0:202:b3ff:fe1e:8329

* Rule two: A single occurrence of consecutive groups of zeroes within an address may be replaced by a double colon.
            For example, fe80:0:0:0:202:b3ff:fe1e:8329 becomes fe80::202:b3ff:fe1e:8329
   RULE ONE IS AUTOMATICALLY APPLIED BY sscanf and X parsing
   RULE TWO IS NOT APPLIED OVER THIS CLASS METHODS
 In environments of dual-stack hosts that support both IPv4 and IPv6, an IPv4 address is expressed as an IPv6 address in an IPv6-mapped address.
 For example, the IPv4-mapped IPv6 address ::ffff:c000:280 is usually written as ::ffff:192.0.2.128, thus expressing clearly the original IPv4
 address that was mapped to IPv6.

 The address ::ffff:1.2.3.4 is IPv4-mapped, different than address ::1.2.3.4 which is IPV4-compatible.

Constructor & Destructor Documentation

◆ Address()

anna::diameter::codec::basetypes::Address::Address ( )
inline

Default constructor

84 : a_abbreviatePresentation(true) {};

◆ ~Address()

virtual anna::diameter::codec::basetypes::Address::~Address ( )
inlinevirtual

Destructor

89 {;}

Member Function Documentation

◆ asPrintableString()

std::string anna::diameter::codec::basetypes::Address::asPrintableString ( )
virtualnoexcept

Gets the natural/smart string representation for IANA address Launch exception when data is not printable: only IPv4 and IPv6 are printable-supported

Returns
Natural/smart string representation for IANA address (only IPv4 and IPv6 are printable-supported)

Reimplemented from anna::diameter::codec::basetypes::AvpData.

◆ asString()

std::string anna::diameter::codec::basetypes::Address::asString ( void  )
inlinevirtualnoexcept

Class string representation Default implementation invokes raw DataBlock 'asString' method, but it should be different specially with complex application data types.

Returns
String with class content

Reimplemented from anna::diameter::codec::basetypes::AvpData.

135 { return a_address.asString(); }
std::string asString() const
Definition: defines.hpp:480
Here is the call graph for this function:

◆ decode()

void anna::diameter::codec::basetypes::Address::decode ( const char *  buffer,
const int  size 
)
virtualnoexcept

Decodes provided buffer/size

Derived types must invoke base class 'decode()' at the end in order to keep coherence with parent members. This base class decodification actually sets the base class members with the same buffer provided, being more comfortable than using base class setters.

Parameters
bufferRaw avp data
sizeRaw avp data length

Implements anna::diameter::codec::basetypes::AvpData.

◆ getFormatName()

std::string anna::diameter::codec::basetypes::Address::getFormatName ( ) const
inlinevirtual

Gets the avp data format name

Returns
avp data format name

Reimplemented from anna::diameter::codec::basetypes::OctetString.

121 { return "Address"; }
Here is the call graph for this function:

◆ getIANAAddress()

const iana_address_t& anna::diameter::codec::basetypes::Address::getIANAAddress ( ) const
inline

Gets the IANA address

Returns
IANA address
107 { return a_address; }

◆ setAbbreviatePresentation()

void anna::diameter::codec::basetypes::Address::setAbbreviatePresentation ( bool  abb)
inline

Presentation mode: abbreviate (i.e. two standard rules applied for IPv6) or expanded (i.e. groups of zeroes on IP address)

Parameters
abbAbbreviate mode boolean indicator
96 { a_abbreviatePresentation = abb; };

◆ setIANAAddress()

void anna::diameter::codec::basetypes::Address::setIANAAddress ( const iana_address_t address)
inlinenoexcept

Sets the IANA address

Parameters
addressIANA address
114 { a_address = address; updateBasic(); }

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