ANNA Suite
2020b
Multipurpose development suite for Telco applications
|
#include <AvpData.hpp>
Public Member Functions | |
AvpData () | |
virtual std::string | getFormatName () const =0 |
virtual int | getSize () const =0 |
void | code (char *buffer, int &size) noexcept(false) |
virtual std::string | asPrintableString () noexcept(false) |
std::string | asDataBlockString () noexcept(false) |
virtual std::string | asString () noexcept(false) |
std::string | asHexString () noexcept(false) |
virtual void | decode (const char *buffer, const int size) noexcept(false)=0 |
void | fromPrintableString (const char *printableString) noexcept(false) |
void | fromHexString (const std::string &hexString) noexcept(false) |
Protected Member Functions | |
std::string | assertPrintable (const char *buffer, const int size) const noexcept(false) |
Diameter avp abstract data container
All diameter types inherit from this class. Basic types with one level, derived ones with two levels. Three or more inheritance levels have no sense. Each level has own private members and updateBasic() will be implemented at derived types to keep coherence towards parent ones. This coherence implies to call updateBasic when private members are updated.
Basic diameter types are: OctetString, Integer32, Integer64, Unsigned32, Unsigned64, Float32, Float64 Derived diameter types are: Address, Time, UTF8String, DiameterIdentity, DiameterURI, IPFilterRule, QoSFilterRule (derived from OctetString) Enumerated (derived from Integer32) Printable derived types are: UTF8String, DiameterIdentity, DiameterURI, IPFilterRule, QoSFilterRule
User application could create new diameter types derived for any basic one, and reimplement the methods to adjust its behaviour.
*
There are setters/getters at any level, and a lot of helpers to decode/interpret the stored data. Then, this class could be used as container and/or helper tool. Parent setters won't modify child members and vice versa, but helpers syncronizes both levels through parent 'code()' and child 'decode()' methods.
Derived types with own members, must use protected or private inheritance, and export base class methods desired (using declaration). This mechanism guarantees private members coherence between different levels: a derived type instance couldn't directly manipulate base class own members.
|
inline |
|
inlinenoexcept |
Gets DataBlock binary block and ascii representation
|
inlinenoexcept |
Gets the hexadecimal string representation for avp data Used in diameter message 'hex-data' field
|
inlinevirtualnoexcept |
Gets the natural/smart string representation for avp data (format-dependent content) Used in diameter message 'data' field Default implementation launch exception when data is not printable
Reimplemented in anna::diameter::codec::basetypes::Address, anna::diameter::codec::basetypes::Time, anna::diameter::helpers::tme::codectypes::Unsigned16, anna::diameter::codec::basetypes::Float32, anna::diameter::codec::basetypes::Float64, anna::diameter::codec::basetypes::Integer32, anna::diameter::codec::basetypes::Integer64, anna::diameter::codec::basetypes::Unsigned32, and anna::diameter::codec::basetypes::Unsigned64.
|
inlineprotectednoexcept |
Asserts printable nature for buffer provided and launch exception if not. Must be invoked from 'updateBasic() and decode()' at derived diameter types, when buffer should be printable
buffer | Raw avp data |
size | Raw avp data length |
|
inlinevirtualnoexcept |
Class string representation Default implementation invokes raw DataBlock 'asString' method, but it should be different specially with complex application data types.
Reimplemented in anna::diameter::codec::basetypes::Address, anna::diameter::codec::basetypes::Time, anna::diameter::helpers::tme::codectypes::Unsigned16, anna::diameter::codec::basetypes::Float32, anna::diameter::codec::basetypes::Float64, anna::diameter::codec::basetypes::Integer32, anna::diameter::codec::basetypes::Integer64, anna::diameter::codec::basetypes::Unsigned32, anna::diameter::codec::basetypes::Unsigned64, anna::diameter::helpers::tme::codectypes::ISDNNumber, and anna::diameter::helpers::tme::codectypes::ISDNAddress.
|
inlinenoexcept |
|
pure 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.
buffer | Raw avp data |
size | Raw avp data length |
Implemented in anna::diameter::codec::basetypes::Address, anna::diameter::codec::basetypes::Time, anna::diameter::helpers::tme::codectypes::Unsigned16, anna::diameter::codec::basetypes::Float32, anna::diameter::codec::basetypes::Float64, anna::diameter::codec::basetypes::Integer32, anna::diameter::codec::basetypes::Integer64, anna::diameter::codec::basetypes::Unsigned32, anna::diameter::codec::basetypes::Unsigned64, anna::diameter::helpers::tme::codectypes::ISDNNumber, anna::diameter::codec::basetypes::OctetString, anna::diameter::helpers::tme::codectypes::ISDNAddress, anna::diameter::codec::basetypes::DiameterIdentity, anna::diameter::codec::basetypes::DiameterURI, anna::diameter::codec::basetypes::IPFilterRule, anna::diameter::codec::basetypes::QoSFilterRule, and anna::diameter::codec::basetypes::UTF8String.
|
inlinenoexcept |
Initializes members from hexadecimal string representation. I.e.: af1233fb01 (even number of digits).
hexString | Raw avp data in hexadecimal string representation |
|
inlinenoexcept |
Initializes members from natural/smart string representation
printableString | avp data in natural/smart string representation (human-readable) |
|
pure virtual |
Gets the avp data format name
Implemented in anna::diameter::codec::basetypes::Address, anna::diameter::codec::basetypes::Time, anna::diameter::helpers::tme::codectypes::Unsigned16, anna::diameter::codec::basetypes::OctetString, anna::diameter::codec::basetypes::Float32, anna::diameter::codec::basetypes::Float64, anna::diameter::codec::basetypes::Integer32, anna::diameter::codec::basetypes::Integer64, anna::diameter::codec::basetypes::Unsigned32, anna::diameter::codec::basetypes::Unsigned64, anna::diameter::helpers::tme::codectypes::ISDNNumber, anna::diameter::helpers::tme::codectypes::ISDNAddress, anna::diameter::codec::basetypes::DiameterIdentity, anna::diameter::codec::basetypes::DiameterURI, anna::diameter::codec::basetypes::IPFilterRule, anna::diameter::codec::basetypes::QoSFilterRule, anna::diameter::codec::basetypes::UTF8String, anna::diameter::helpers::tid::codectypes::Date, anna::diameter::codec::basetypes::Enumerated, and anna::diameter::codec::basetypes::Unknown.
|
pure virtual |
Gets the avp data size based on basic container. The AVP Data field is zero or more octets.
Implemented in anna::diameter::codec::basetypes::OctetString, anna::diameter::codec::basetypes::Float32, anna::diameter::codec::basetypes::Float64, anna::diameter::codec::basetypes::Integer32, anna::diameter::codec::basetypes::Integer64, anna::diameter::codec::basetypes::Unsigned32, and anna::diameter::codec::basetypes::Unsigned64.