ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
anna::diameter::codec::Avp Class Reference

#include <Avp.hpp>

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

Public Member Functions

 Avp (Engine *engine=NULL)
 
 Avp (AvpId id, Engine *engine=NULL)
 
void setEngine (Engine *engine)
 
virtual ~Avp ()
 
void clear () noexcept(false)
 
void setId (AvpId id) noexcept(false)
 
void setId (const char *name) noexcept(false)
 
void setMandatoryBit (bool activate=true)
 
void setEncryptionBit (bool activate=true)
 
AvpaddAvp (AvpId id) noexcept(false)
 
AvpaddAvp (const char *name) noexcept(false)
 
AvpaddAvp (Avp *avp) noexcept(false)
 
OctetStringgetOctetString () noexcept(false)
 
Integer32getInteger32 () noexcept(false)
 
Integer64getInteger64 () noexcept(false)
 
Unsigned32getUnsigned32 () noexcept(false)
 
Unsigned64getUnsigned64 () noexcept(false)
 
Float32getFloat32 () noexcept(false)
 
Float64getFloat64 () noexcept(false)
 
AddressgetAddress () noexcept(false)
 
TimegetTime () noexcept(false)
 
UTF8StringgetUTF8String () noexcept(false)
 
DiameterIdentitygetDiameterIdentity () noexcept(false)
 
DiameterURIgetDiameterURI () noexcept(false)
 
EnumeratedgetEnumerated () noexcept(false)
 
IPFilterRulegetIPFilterRule () noexcept(false)
 
QoSFilterRulegetQoSFilterRule () noexcept(false)
 
UnknowngetUnknown () noexcept(false)
 
bool removeAvp (AvpId id, int ocurrence=1) noexcept(false)
 
bool removeAvp (const char *name, int ocurrence=1) noexcept(false)
 
const AvpIdgetId () const
 
int getVendorId () const
 
const anna::diameter::stack::AvpgetStackAvp () const noexcept(false)
 
bool vendorBit () const
 
bool mandatoryBit () const
 
bool encryptionBit () const
 
const OctetStringgetOctetString () const noexcept(false)
 
const Integer32getInteger32 () const noexcept(false)
 
const Integer64getInteger64 () const noexcept(false)
 
const Unsigned32getUnsigned32 () const noexcept(false)
 
const Unsigned64getUnsigned64 () const noexcept(false)
 
const Float32getFloat32 () const noexcept(false)
 
const Float64getFloat64 () const noexcept(false)
 
const AvpgetAvp (AvpId id, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) const noexcept(false)
 
AvpgetAvp (AvpId id, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
const AvpgetAvp (const char *name, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) const noexcept(false)
 
AvpgetAvp (const char *name, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
const AddressgetAddress () const noexcept(false)
 
const TimegetTime () const noexcept(false)
 
const UTF8StringgetUTF8String () const noexcept(false)
 
const DiameterIdentitygetDiameterIdentity () const noexcept(false)
 
const DiameterURIgetDiameterURI () const noexcept(false)
 
const EnumeratedgetEnumerated () const noexcept(false)
 
const IPFilterRulegetIPFilterRule () const noexcept(false)
 
const QoSFilterRulegetQoSFilterRule () const noexcept(false)
 
const UnknowngetUnknown () const noexcept(false)
 
void decode (const anna::DataBlock &db) noexcept(false)
 
void fromXML (const anna::xml::Node *avpNode) noexcept(false)
 
void code (char *buffer, int &size) const noexcept(false)
 
anna::xml::NodeasXML (anna::xml::Node *parent) const
 
std::string asXMLString (bool normalize=false) const
 
bool isLike (const std::string &pattern) const
 
int countAvp (AvpId id) const noexcept(false)
 
int countAvp (const char *name) const noexcept(false)
 
int countChilds () const noexcept(false)
 
virtual void unknownAvpWithMandatoryBit () const noexcept(false)
 

Static Public Attributes

static const int HeaderLengthVactive
 
static const int HeaderLengthVinactive
 
static const U8 VBitMask
 
static const U8 MBitMask
 
static const U8 PBitMask
 

Protected Member Functions

virtual EnginegetEngine () const noexcept(false)
 
void initialize ()
 
void assertFormat (const std::string &name) const noexcept(false)
 
U24 getLength () const
 
std::string getXMLdata (bool &isHex, const anna::diameter::stack::Format *stackFormat) const
 
void decodeDataPart (const char *buffer, int size, const anna::diameter::codec::parent_t &parent, Message *answer) noexcept(false)
 

Protected Attributes

Enginea_engine
 

Friends

class Message
 
class Engine
 
bool operator== (const Avp &a1, const Avp &a2)
 

Detailed Description

Diameter avp generic container

   RFC 3588                Diameter Based Protocol           September 2003
   4.1.  AVP Header
      The fields in the AVP header MUST be sent in network byte order.  The
      format of the header is:
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                           AVP Code                            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   AVP Flags   |                  AVP Length                   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Vendor-ID (opt)                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |    Data ...
      +-+-+-+-+-+-+-+-+
   AVP Flags: V (vendor-specific), M (mandatory), P (end to end encryption)
   +-+-+-+-+-+-+-+-+
   |V M P r r r r r|
   +-+-+-+-+-+-+-+-+

   AVP Length
   The AVP Length field is three octets, and indicates the number of
   octets in this AVP including the AVP Code, AVP Length, AVP Flags,
   Vendor-ID field (if present) and the AVP data.

   Vendor-ID: IANA "SMI Network Management Private Enterprise Codes" [ASSIGNNO]
              http://www.iana.org/assignments/enterprise-numbers

Constructor & Destructor Documentation

◆ Avp() [1/2]

anna::diameter::codec::Avp::Avp ( Engine engine = NULL)

Default constructor

Parameters
engineCodec engine used

◆ Avp() [2/2]

anna::diameter::codec::Avp::Avp ( AvpId  id,
Engine engine = NULL 
)

Identified constructor

Parameters
idAvp identifier as pair (code,vendor-id).
engineCodec engine used

◆ ~Avp()

virtual anna::diameter::codec::Avp::~Avp ( )
virtual

Destructor

Reimplemented in anna::diameter::codec::tme::Avp.

Member Function Documentation

◆ addAvp() [1/3]

Avp* anna::diameter::codec::Avp::addAvp ( AvpId  id)
inlinenoexcept

Adds an avp child providing its identifier and reserve internal memory it. An exception is launched is the Avp over which we add the new avp, is not a grouped avp.

Parameters
idAvp identifier as pair (code,vendor-id).
Returns
Pointer to the new created avp.
486 { assertFormat("Grouped"); return addAvp(a_avps, a_insertionPositionForChilds, id, getEngine()); }
virtual Engine * getEngine() const noexcept(false)
void assertFormat(const std::string &name) const noexcept(false)
Here is the call graph for this function:

◆ addAvp() [2/3]

Avp* anna::diameter::codec::Avp::addAvp ( const char *  name)
noexcept

Same as #addAvp but providing dictionary logical name for Avp searched

◆ addAvp() [3/3]

Avp* anna::diameter::codec::Avp::addAvp ( Avp avp)
noexcept

Adds an avp child providing a persistent pointer (must be maintained by application). An exception is launched is the Avp over which we add the new avp, is not a grouped avp. It is not allowed to add an avp with no codec engine configured, neither if the engine is not the same.

Parameters
avpAvp external pointer. If NULL provided, nothing is done and NULL returned. Also NULL returned for bad engine configuration.
Returns
Pointer to the added avp (again).

◆ assertFormat()

void anna::diameter::codec::Avp::assertFormat ( const std::string &  name) const
protectednoexcept

Assert format regarding dictionary

◆ asXML()

anna::xml::Node* anna::diameter::codec::Avp::asXML ( anna::xml::Node parent) const

Class xml representation

Parameters
parentParent XML node on which hold this instance information.
Returns
XML document with relevant information for this instance.

◆ asXMLString()

std::string anna::diameter::codec::Avp::asXMLString ( bool  normalize = false) const

Class xml string representation

Parameters
normalizeOptional normalization which sorts attribute names and removes newlines in the xml representation in order to ease regexp matching.
Returns
XML string representation with relevant information for this instance.

◆ clear()

void anna::diameter::codec::Avp::clear ( )
noexcept

Clears and initializes Avp class information. Application should clear auxiliary avp objects before setting data in a new context.

◆ code()

void anna::diameter::codec::Avp::code ( char *  buffer,
int &  size 
) const
noexcept

Encodes buffer with the class content. This method is internally used to encode diameter messages, but is declared as public, to allow its use as serialization procedure. Then, it's assumed that this Avp is valid (validation shall be applied as part of a whole diameter message but nothing will be verified now).

Parameters
bufferRaw data to be encoded (shall be externally allocated)
sizeSize of raw data to be encoded

◆ countAvp() [1/2]

int anna::diameter::codec::Avp::countAvp ( AvpId  id) const
inlinenoexcept

Counts the number of ocurrences of Avps (first level) with the identifier provided

Parameters
idAvp identifier (pair code + vendor-id).
747 { assertFormat("Grouped"); return countAvp(a_avps, id); }
void assertFormat(const std::string &name) const noexcept(false)
Here is the call graph for this function:

◆ countAvp() [2/2]

int anna::diameter::codec::Avp::countAvp ( const char *  name) const
noexcept

Same as #countAvp but providing dictionary logical name for Avp searched

◆ countChilds()

int anna::diameter::codec::Avp::countChilds ( ) const
inlinenoexcept

Counts the number of children within a grouped avp

Parameters
idAvp identifier (pair code + vendor-id).
759 { assertFormat("Grouped"); return countChilds(a_avps); }
void assertFormat(const std::string &name) const noexcept(false)
int countChilds() const noexcept(false)
Definition: Avp.hpp:759
Here is the call graph for this function:

◆ decode()

void anna::diameter::codec::Avp::decode ( const anna::DataBlock db)
noexcept

Decodes buffer provided over class content. If an error ocurred, decoding will stop launching exception (fatal error) or a warning trace (perhaps the achieved avp is valid against all odds then validation will go on). In case that validation is enabled (codec::Engine::ValidationMode) an exception will be launched depending on validation depth (codec::Engine::ValidationDepth).

Useful as serialization procedure with code

Parameters
dbBuffer data block processed

◆ decodeDataPart()

void anna::diameter::codec::Avp::decodeDataPart ( const char *  buffer,
int  size,
const anna::diameter::codec::parent_t parent,
Message answer 
)
protectednoexcept

Decodes Avp data part.

Parameters
bufferAvp data part start pointer
sizeAvp data part size
parentParent description. Internally used for alarms, tracing and Failed-AVP construction
answerAnswer built for request decoding/validation

◆ encryptionBit()

bool anna::diameter::codec::Avp::encryptionBit ( ) const
inline

Returns P bit activation state

584 { return ((a_flags & PBitMask) != 0x00); }
static const U8 PBitMask
Definition: Avp.hpp:423

◆ fromXML()

void anna::diameter::codec::Avp::fromXML ( const anna::xml::Node avpNode)
noexcept

Interpret xml data in order to dump over the class content.

Parameters
avpNodeAvp root node

◆ getAddress() [1/2]

Address* anna::diameter::codec::Avp::getAddress ( )
inlinenoexcept

Access content for Address Avp in order to set data part

524 { assertFormat("Address"); return a_Address; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getAddress() [2/2]

const Address* anna::diameter::codec::Avp::getAddress ( ) const
inlinenoexcept

Access content for Address Avp

654 { assertFormat("Address"); return a_Address; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getAvp() [1/4]

const Avp* anna::diameter::codec::Avp::getAvp ( AvpId  id,
int  ocurrence = 1,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
) const
inlinenoexcept

Access content for Grouped Avp. Exception mode allows different combinations like cascade access:

   try {
      message->getAvp(anna::diameter::helpers::base::AVP__Multiple_Services_Credit_Control, anna::Exception::Mode::Throw)
             ->getAvp(anna::diameter::helpers::base::AVP__Rating_Group, anna::Exception::Mode::Throw);
   }
   catch(anna::RuntimeException) {;}

Or step access:

   const Avp *mscc = message->getAvp(anna::diameter::helpers::base::AVP__Multiple_Services_Credit_Control);
   const Avp *rg;
   if (mscc) rg = mscc->getAvp(anna::diameter::helpers::base::AVP__Rating_Group);

Replacing procedures becomes easy because an Avp can be searched and its pointer reconfigured by mean setId and data part setters. Deleting procedures must use #removeAvp. Access is internally cached to speed up the search operations. This cache is reset after calling #fix or #removeAvp methods.

Parameters
idAvp identifier (pair code + vendor-id).
ocurrenceOrder of appearance for the searched avp. Zero position is rejected, but negative values could be used to reverse access positions: i.e. -1 is the last ocurrence, -2 is the second to last (penultimate), etc.
emodeExcepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (excepcion launched, by default), Trace (trace warning). If avp format is not grouped, always exception will be launched and no matter what mode is provided. It would be a development error and must be solved.
632  {
633  return _getAvp(id, ocurrence, emode);
634  }

◆ getAvp() [2/4]

Avp* anna::diameter::codec::Avp::getAvp ( AvpId  id,
int  ocurrence = 1,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
inlinenoexcept
636  {
637  return const_cast<Avp*>(_getAvp(id, ocurrence, emode));
638  }
Avp(Engine *engine=NULL)

◆ getAvp() [3/4]

const Avp* anna::diameter::codec::Avp::getAvp ( const char *  name,
int  ocurrence = 1,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
) const
inlinenoexcept

Same as #getAvp but providing dictionary logical name for Avp searched

643  {
644  return _getAvp(name, ocurrence, emode);
645  }

◆ getAvp() [4/4]

Avp* anna::diameter::codec::Avp::getAvp ( const char *  name,
int  ocurrence = 1,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
inlinenoexcept
647  {
648  return const_cast<Avp*>(_getAvp(name, ocurrence, emode));
649  }
Avp(Engine *engine=NULL)

◆ getDiameterIdentity() [1/2]

DiameterIdentity* anna::diameter::codec::Avp::getDiameterIdentity ( )
inlinenoexcept

Access content for DiameterIdentity Avp in order to set data part

530 { assertFormat("DiameterIdentity"); return a_DiameterIdentity; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getDiameterIdentity() [2/2]

const DiameterIdentity* anna::diameter::codec::Avp::getDiameterIdentity ( ) const
inlinenoexcept

Access content for DiameterIdentity Avp

660 { assertFormat("DiameterIdentity"); return a_DiameterIdentity; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getDiameterURI() [1/2]

DiameterURI* anna::diameter::codec::Avp::getDiameterURI ( )
inlinenoexcept

Access content for DiameterURI Avp in order to set data part

532 { assertFormat("DiameterURI"); return a_DiameterURI; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getDiameterURI() [2/2]

const DiameterURI* anna::diameter::codec::Avp::getDiameterURI ( ) const
inlinenoexcept

Access content for DiameterURI Avp

662 { assertFormat("DiameterURI"); return a_DiameterURI; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getEngine()

virtual Engine* anna::diameter::codec::Avp::getEngine ( ) const
protectedvirtualnoexcept

Codec Engine getter: avoids have to create base engine when using its child

◆ getEnumerated() [1/2]

Enumerated* anna::diameter::codec::Avp::getEnumerated ( )
inlinenoexcept

Access content for Enumerated Avp in order to set data part

534 { assertFormat("Enumerated"); return a_Enumerated; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getEnumerated() [2/2]

const Enumerated* anna::diameter::codec::Avp::getEnumerated ( ) const
inlinenoexcept

Access content for Enumerated Avp

664 { assertFormat("Enumerated"); return a_Enumerated; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getFloat32() [1/2]

Float32* anna::diameter::codec::Avp::getFloat32 ( )
inlinenoexcept

Access content for Float32 Avp in order to set data part

520 { assertFormat("Float32"); return a_Float32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getFloat32() [2/2]

const Float32* anna::diameter::codec::Avp::getFloat32 ( ) const
inlinenoexcept

Access content for Float32 Avp

598 { assertFormat("Float32"); return a_Float32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getFloat64() [1/2]

Float64* anna::diameter::codec::Avp::getFloat64 ( )
inlinenoexcept

Access content for Float64 Avp in order to set data part

522 { assertFormat("Float64"); return a_Float64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getFloat64() [2/2]

const Float64* anna::diameter::codec::Avp::getFloat64 ( ) const
inlinenoexcept

Access content for Float64 Avp

600 { assertFormat("Float64"); return a_Float64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getId()

const AvpId& anna::diameter::codec::Avp::getId ( ) const
inline

Gets Avp identifier as pair (code, vendor-id).

565 { return a_id; }

◆ getInteger32() [1/2]

Integer32* anna::diameter::codec::Avp::getInteger32 ( )
inlinenoexcept

Access content for Integer32 Avp in order to set data part

512 { assertFormat("Integer32"); return a_Integer32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getInteger32() [2/2]

const Integer32* anna::diameter::codec::Avp::getInteger32 ( ) const
inlinenoexcept

Access content for Integer32 Avp

590 { assertFormat("Integer32"); return a_Integer32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getInteger64() [1/2]

Integer64* anna::diameter::codec::Avp::getInteger64 ( )
inlinenoexcept

Access content for Integer64 Avp in order to set data part

514 { assertFormat("Integer64"); return a_Integer64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getInteger64() [2/2]

const Integer64* anna::diameter::codec::Avp::getInteger64 ( ) const
inlinenoexcept

Access content for Integer64 Avp

592 { assertFormat("Integer64"); return a_Integer64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getIPFilterRule() [1/2]

IPFilterRule* anna::diameter::codec::Avp::getIPFilterRule ( )
inlinenoexcept

Access content for IPFilterRule Avp in order to set data part

536 { assertFormat("IPFilterRule"); return a_IPFilterRule; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getIPFilterRule() [2/2]

const IPFilterRule* anna::diameter::codec::Avp::getIPFilterRule ( ) const
inlinenoexcept

Access content for IPFilterRule Avp

666 { assertFormat("IPFilterRule"); return a_IPFilterRule; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getLength()

U24 anna::diameter::codec::Avp::getLength ( ) const
protected

Gets avp total length based on internal data part and header configuration. Padding octets are not included, only header and data part length. The only format which always have total length equal to sum of all its parts is Grouped, because of the 4-multiple nature of its data part length.

◆ getOctetString() [1/2]

OctetString* anna::diameter::codec::Avp::getOctetString ( )
inlinenoexcept

Access content for OctetString Avp in order to set data part

510 { assertFormat("OctetString"); return a_OctetString; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getOctetString() [2/2]

const OctetString* anna::diameter::codec::Avp::getOctetString ( ) const
inlinenoexcept

Access content for OctetString Avp

588 { assertFormat("OctetString"); return a_OctetString; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getQoSFilterRule() [1/2]

QoSFilterRule* anna::diameter::codec::Avp::getQoSFilterRule ( )
inlinenoexcept

Access content for QoSFilterRule Avp in order to set data part

538 { assertFormat("QoSFilterRule"); return a_QoSFilterRule; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getQoSFilterRule() [2/2]

const QoSFilterRule* anna::diameter::codec::Avp::getQoSFilterRule ( ) const
inlinenoexcept

Access content for QoSFilterRule Avp

668 { assertFormat("QoSFilterRule"); return a_QoSFilterRule; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getStackAvp()

const anna::diameter::stack::Avp* anna::diameter::codec::Avp::getStackAvp ( ) const
inlinenoexcept

Gets stack avp (dictionary avp reference).

575 { return getStackAvp(a_id, getEngine()); }
virtual Engine * getEngine() const noexcept(false)
const anna::diameter::stack::Avp * getStackAvp() const noexcept(false)
Definition: Avp.hpp:575
Here is the call graph for this function:

◆ getTime() [1/2]

Time* anna::diameter::codec::Avp::getTime ( )
inlinenoexcept

Access content for Time Avp in order to set data part

526 { assertFormat("Time"); return a_Time; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getTime() [2/2]

const Time* anna::diameter::codec::Avp::getTime ( ) const
inlinenoexcept

Access content for Time Avp

656 { assertFormat("Time"); return a_Time; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnknown() [1/2]

Unknown* anna::diameter::codec::Avp::getUnknown ( )
inlinenoexcept

Access content for Unknown Avp in order to set data part

540 { assertFormat("Unknown"); return a_Unknown; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnknown() [2/2]

const Unknown* anna::diameter::codec::Avp::getUnknown ( ) const
inlinenoexcept

Access content for Unknown Avp

670 { assertFormat("Unknown"); return a_Unknown; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnsigned32() [1/2]

Unsigned32* anna::diameter::codec::Avp::getUnsigned32 ( )
inlinenoexcept

Access content for Unsigned32 Avp in order to set data part

516 { assertFormat("Unsigned32"); return a_Unsigned32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnsigned32() [2/2]

const Unsigned32* anna::diameter::codec::Avp::getUnsigned32 ( ) const
inlinenoexcept

Access content for Unsigned32 Avp

594 { assertFormat("Unsigned32"); return a_Unsigned32; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnsigned64() [1/2]

Unsigned64* anna::diameter::codec::Avp::getUnsigned64 ( )
inlinenoexcept

Access content for Unsigned64 Avp in order to set data part

518 { assertFormat("Unsigned64"); return a_Unsigned64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUnsigned64() [2/2]

const Unsigned64* anna::diameter::codec::Avp::getUnsigned64 ( ) const
inlinenoexcept

Access content for Unsigned64 Avp

596 { assertFormat("Unsigned64"); return a_Unsigned64; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUTF8String() [1/2]

UTF8String* anna::diameter::codec::Avp::getUTF8String ( )
inlinenoexcept

Access content for UTF8String Avp in order to set data part

528 { assertFormat("UTF8String"); return a_UTF8String; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getUTF8String() [2/2]

const UTF8String* anna::diameter::codec::Avp::getUTF8String ( ) const
inlinenoexcept

Access content for UTF8String Avp

658 { assertFormat("UTF8String"); return a_UTF8String; }
void assertFormat(const std::string &name) const noexcept(false)

◆ getVendorId()

int anna::diameter::codec::Avp::getVendorId ( ) const
inline

Gets Avp vendor-id.

570 { return a_id.second; }

◆ getXMLdata()

std::string anna::diameter::codec::Avp::getXMLdata ( bool &  isHex,
const anna::diameter::stack::Format stackFormat 
) const
protected

Gets data or hexadecimal data depending on avp format, for xml creating

Parameters
isHexHexadecimal/Natural data when apply.
stackFormatStack avp format in which data extraction is based.
Returns
xml data representation

◆ initialize()

void anna::diameter::codec::Avp::initialize ( )
protected

Initializes Avp class information.

◆ isLike()

bool anna::diameter::codec::Avp::isLike ( const std::string &  pattern) const

Match a regular expression (string pattern) regarding xml string serialization for this avp. This works same as #Message::isLike

Parameters
patternPattern to match
Returns
Returns the match result

◆ mandatoryBit()

bool anna::diameter::codec::Avp::mandatoryBit ( ) const
inline

Returns M bit activation state

581 { return ((a_flags & MBitMask) != 0x00); }
static const U8 MBitMask
Definition: Avp.hpp:422

◆ removeAvp() [1/2]

bool anna::diameter::codec::Avp::removeAvp ( AvpId  id,
int  ocurrence = 1 
)
inlinenoexcept

Removes an Avp within grouped type (first level) and free resources.

Parameters
idAvp identifier (pair code + vendor-id).
ocurrenceOrder of appearance for the searched avp. Zero value means remove all avps with provided identifier at first level (no recursiveness would be allowed in the API in order to avoid unexpected behaviour). Negative values could be used to reverse access positions: i.e. -1 is the last ocurrence, -2 is the second to last (penultimate), etc.
Returns
Returns true if something was removed. False in other cases (including i.e. when this Avp is empty or is not a grouped avp).
552 { assertFormat("Grouped"); return removeAvp(a_avps, (find_container&)a_finds, id, ocurrence, getEngine()); }
virtual Engine * getEngine() const noexcept(false)
void assertFormat(const std::string &name) const noexcept(false)
std::map< find_key, Avp * > find_container
Definition: Avp.hpp:83
Here is the call graph for this function:

◆ removeAvp() [2/2]

bool anna::diameter::codec::Avp::removeAvp ( const char *  name,
int  ocurrence = 1 
)
noexcept

Same as #removeAvp but providing dictionary logical name for Avp searched

◆ setEncryptionBit()

void anna::diameter::codec::Avp::setEncryptionBit ( bool  activate = true)
inline

Sets/unsets P bit activation. Application should not have to use this because dictionary information is used in order to configure flags when Avp identifier is stored. Anyway, could be useful when build unknown-type avps.

Parameters
activateActivates/deactivates the bit. True by default.
475 { if(activate) a_flags |= PBitMask; else a_flags &= (~PBitMask); }
static const U8 PBitMask
Definition: Avp.hpp:423

◆ setEngine()

void anna::diameter::codec::Avp::setEngine ( Engine engine)

Sets the codec engine

Once assigned (here or at constructor), this method SHALL NOT be used anymore. Also, the associated dictionary SHOULD NOT BE CHANGED through the engine, unless you know what are you doing. If you want to reconfigure the engine, first clear the avp and then you could reuse the same object with different configurations (execution contexts).

Setting a new different engine with different stack, even same engine where the stack has been dynamically changed, could cause a bad behaviour depending on the changes: in general, if the dictionary grows, nothing bad will happen, but if you remove or modified some elements which were processed with a certain format, will be interpreted as 'unknown' with the new dictionary, and then some problems may occur. If you add elements (vendors, avps, messages) is not a problem.

◆ setId() [1/2]

void anna::diameter::codec::Avp::setId ( AvpId  id)
noexcept

Sets the avp identifier and clear the former content. Internally reserves memory for data part depending on avp format for the identifier provided. This must be called at first place because Avp class content is cleared when identifier is configured. Generic AVP assignment have no sense and will be ignored.

Parameters
idAvp identifier as pair (code,vendor-id).

◆ setId() [2/2]

void anna::diameter::codec::Avp::setId ( const char *  name)
noexcept

Same as setId but providing dictionary logical name for Avp searched

◆ setMandatoryBit()

void anna::diameter::codec::Avp::setMandatoryBit ( bool  activate = true)
inline

Sets/unsets M bit activation. Application should not have to use this because dictionary information is used in order to configure flags when Avp identifier is stored. Anyway, could be useful when build unknown-type avps.

The 'M' Bit, known as the Mandatory bit, indicates whether support of the AVP is required. If an AVP with the 'M' bit set is received by a Diameter client, server, proxy, or translation agent and either the AVP or its value is unrecognized, the message MUST be rejected. Diameter Relay and redirect agents MUST NOT reject messages with unrecognized AVPs.

Parameters
activateActivates/deactivates the bit. True by default.
466 { if(activate) a_flags |= MBitMask; else a_flags &= (~MBitMask); }
static const U8 MBitMask
Definition: Avp.hpp:422

◆ unknownAvpWithMandatoryBit()

virtual void anna::diameter::codec::Avp::unknownAvpWithMandatoryBit ( ) const
virtualnoexcept

The 'M' Bit, known as the Mandatory bit, indicates whether support of the AVP is required. If an AVP with the 'M' bit set is received by a Diameter client, server, proxy, or translation agent and either the AVP or its value is unrecognized, the message MUST be rejected. Diameter Relay and redirect agents MUST NOT reject messages with unrecognized AVPs.

Default implementation launch alarm and counter indicating the anomaly but don't launch exception (traces at warning level). Relay and Redirect agents could reimplement this method to avoid oam management (another way is avoid alarm/counter registration on these applications). Result-Code DIAMETER_AVP_UNSUPPORTED will be stored for possible answer message.

◆ vendorBit()

bool anna::diameter::codec::Avp::vendorBit ( ) const
inline

Returns V bit activation state

578 { return ((a_flags & VBitMask) != 0x00); }
static const U8 VBitMask
Definition: Avp.hpp:421

Friends And Related Function Documentation

◆ Engine

friend class Engine
friend

◆ Message

friend class Message
friend

◆ operator==

bool operator== ( const Avp a1,
const Avp a2 
)
friend

Comparison operator by mean serialization

Parameters
a1Instance 1 for Avp class
a2Instance 2 for Avp class
Returns
Comparison result
730 { return (a1.asXMLString() == a2.asXMLString()); }

Member Data Documentation

◆ a_engine

Engine* anna::diameter::codec::Avp::a_engine
mutableprotected

Codec Engine

◆ HeaderLengthVactive

const int anna::diameter::codec::Avp::HeaderLengthVactive
static

◆ HeaderLengthVinactive

const int anna::diameter::codec::Avp::HeaderLengthVinactive
static

◆ MBitMask

const U8 anna::diameter::codec::Avp::MBitMask
static

◆ PBitMask

const U8 anna::diameter::codec::Avp::PBitMask
static

◆ VBitMask

const U8 anna::diameter::codec::Avp::VBitMask
static

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