ANNA Suite  2020b
Multipurpose development suite for Telco applications
Static Public Member Functions | List of all members
anna::diameter::codec::functions Struct Reference

#include <functions.hpp>

Static Public Member Functions

static CommandId getCommandId (const anna::DataBlock &) noexcept(false)
 
static ApplicationId getApplicationId (const anna::DataBlock &) noexcept(false)
 
static HopByHop getHopByHop (const anna::DataBlock &) noexcept(false)
 
static EndToEnd getEndToEnd (const anna::DataBlock &) noexcept(false)
 
static bool requestBit (const anna::DataBlock &) noexcept(false)
 
static bool proxiableBit (const anna::DataBlock &) noexcept(false)
 
static bool errorBit (const anna::DataBlock &) noexcept(false)
 
static bool potentiallyReTransmittedMessageBit (const anna::DataBlock &) noexcept(false)
 
static bool isRequest (const CommandId &cid)
 
static bool isRequest (const anna::DataBlock &db) noexcept(false)
 
static bool isAnswer (const CommandId &cid)
 
static bool isAnswer (const anna::DataBlock &db) noexcept(false)
 
static void decodeCommandHeader (const char *start, char &version, U24 &length, char &flags, CommandId &id, int &appId, int &hbh, int &ete) noexcept(false)
 
static void decodeAVP (const char *start, AvpId &id, char &flags, int &length, std::string &data) noexcept(false)
 
static const char * nextAVP (const char *avpsDB, int avpsLen, const char *start) noexcept(false)
 
static const char * findAVP (const char *avpsDB, int avpsLen, const diameter::AvpId &id, int n=1) noexcept(false)
 
static void setHopByHop (anna::DataBlock &, HopByHop) noexcept(false)
 
static void setEndToEnd (anna::DataBlock &, EndToEnd) noexcept(false)
 
static void setPotentiallyReTransmittedMessageBit (const anna::DataBlock &db, bool activate=true) noexcept(false)
 
static void messageXmlDocumentFromXmlFile (anna::xml::DocumentFile &xmlDocument, const std::string &xmlPathFile) noexcept(false)
 
static void messageXmlDocumentFromXmlString (anna::xml::DocumentMemory &xmlDocument, const std::string &xmlString) noexcept(false)
 

Member Function Documentation

◆ decodeAVP()

static void anna::diameter::codec::functions::decodeAVP ( const char *  start,
AvpId id,
char &  flags,
int &  length,
std::string &  data 
)
staticnoexcept

Decodes an AVP. This helper cannot check boundaries. start pointer must be a valid avp context.

Parameters
startMust be a valid avp start (point to the 32-bits avp code word).
idAvp identification (code, vendorId).
flagsAvp flags byte.
lengthAvp length (includes code, flags, length itself, vendorId if exists and data length).
dataAvp data part.

◆ decodeCommandHeader()

static void anna::diameter::codec::functions::decodeCommandHeader ( const char *  start,
char &  version,
U24 length,
char &  flags,
CommandId id,
int &  appId,
int &  hbh,
int &  ete 
)
staticnoexcept

Decodes a Command Header. This helper cannot check boundaries. start pointer must be a valid command context.

Parameters
startMust be a valid command start (point to the command version byte).
versionDiameter version.
lengthMessage length.
flagsCommand flags.
idCommand identification (code, request<true,false>).
appIdApplication-ID.
hbhHop-by-Hop Identifier.
eteEnd-to-End Identifier.

◆ errorBit()

static bool anna::diameter::codec::functions::errorBit ( const anna::DataBlock )
staticnoexcept

◆ findAVP()

static const char* anna::diameter::codec::functions::findAVP ( const char *  avpsDB,
int  avpsLen,
const diameter::AvpId id,
int  n = 1 
)
staticnoexcept

Gets the next AVP pointer reference starting from a first-avp datablock. It could be the first avp within a command, or within an grouped avp.

Parameters
avpsDBAVPs set as datablock
startPoint to start the search. Must be a valid avp start (point to the 32-bits avp code word).
Returns
Pointer to the next AVP found. NULL if no more. Gets the next AVP pointer reference within an AVPs set data block with a certain AVP identification.
Parameters
avpsDBAVP data block buffer pointer
avpsLenAVP data block buffer length
idAvp identification (code, vendorId).
nOcurrence number (first avp, second avp, etc.). 1 by default.
Returns
Pointer to first AVP found with identification provided. NULL if not found.

◆ getApplicationId()

static ApplicationId anna::diameter::codec::functions::getApplicationId ( const anna::DataBlock )
staticnoexcept

◆ getCommandId()

static CommandId anna::diameter::codec::functions::getCommandId ( const anna::DataBlock )
staticnoexcept

◆ getEndToEnd()

static EndToEnd anna::diameter::codec::functions::getEndToEnd ( const anna::DataBlock )
staticnoexcept

◆ getHopByHop()

static HopByHop anna::diameter::codec::functions::getHopByHop ( const anna::DataBlock )
staticnoexcept

◆ isAnswer() [1/2]

static bool anna::diameter::codec::functions::isAnswer ( const CommandId cid)
inlinestatic
152 { return (!isRequest(cid)); }
static bool isRequest(const CommandId &cid)
Definition: functions.hpp:149

◆ isAnswer() [2/2]

static bool anna::diameter::codec::functions::isAnswer ( const anna::DataBlock db)
inlinestaticnoexcept
153 { return (!isRequest(db)); }
static bool isRequest(const CommandId &cid)
Definition: functions.hpp:149

◆ isRequest() [1/2]

static bool anna::diameter::codec::functions::isRequest ( const CommandId cid)
inlinestatic
149 { return (cid.second); }

◆ isRequest() [2/2]

static bool anna::diameter::codec::functions::isRequest ( const anna::DataBlock db)
inlinestaticnoexcept
150 { return requestBit(db); }
static bool requestBit(const anna::DataBlock &) noexcept(false)

◆ messageXmlDocumentFromXmlFile()

static void anna::diameter::codec::functions::messageXmlDocumentFromXmlFile ( anna::xml::DocumentFile xmlDocument,
const std::string &  xmlPathFile 
)
staticnoexcept

Interpret a xml file in order to create a memory xml document. The xml file is based on this message DTD:

<!ELEMENT message (avp*)>
<!ELEMENT avp (avp*)>
<!ATTLIST message version CDATA #IMPLIED name CDATA #IMPLIED code CDATA #IMPLIED flags CDATA #IMPLIED application-id CDATA #REQUIRED hop-by-hop-id CDATA #IMPLIED end-to-end-id CDATA #IMPLIED>
<!ATTLIST avp name CDATA #IMPLIED code CDATA #IMPLIED vendor-code CDATA #IMPLIED flags CDATA #IMPLIED data CDATA #IMPLIED hex-data CDATA #IMPLIED>
Parameters
xmlDocumentXML document allocated by the user of the function (anna::xml::DocumentMemory xmlDocument)
xmlPathFileComplete path file to the xml document which represents the diameter message
See also
messageXmlDocumentFromXmlString
Warning
Whatever you will do with the xml document, will be only valid inside the scope of such xml document. For example, you could load the document to be decoded over a codec Message by mean #Message::fromXML (using the xml document #getRootNode) during document lifetime. After that, it could be destroyed.

◆ messageXmlDocumentFromXmlString()

static void anna::diameter::codec::functions::messageXmlDocumentFromXmlString ( anna::xml::DocumentMemory xmlDocument,
const std::string &  xmlString 
)
staticnoexcept

Interpret xml string representation in order to create a memory xml document. DTD validation is used in the same way that messageXmlDocumentFromXmlFile does.

Parameters
xmlDocumentXML document allocated by the user of the function (anna::xml::DocumentMemory xmlDocument)
xmlStringXML string representation of the diameter message
See also
messageXmlDocumentFromXmlFile
Warning
Whatever you will do with the xml document, will be only valid inside the scope of such xml document. For example, you could load the document to be decoded over a codec Message by mean #Message::fromXML (using the xml document #getRootNode) during document lifetime. After that, it could be destroyed.

◆ nextAVP()

static const char* anna::diameter::codec::functions::nextAVP ( const char *  avpsDB,
int  avpsLen,
const char *  start 
)
staticnoexcept

Gets the next AVP pointer reference starting from a first-avp data block. It could be the first avp within a command, or within an grouped avp.

Parameters
avpsDBAVP data block buffer pointer
avpsLenAVP data block buffer length
startPoint to start the search. Must be a valid avp start (point to the 32-bits avp code word).
Returns
Pointer to the next AVP found. NULL if no more.

◆ potentiallyReTransmittedMessageBit()

static bool anna::diameter::codec::functions::potentiallyReTransmittedMessageBit ( const anna::DataBlock )
staticnoexcept

◆ proxiableBit()

static bool anna::diameter::codec::functions::proxiableBit ( const anna::DataBlock )
staticnoexcept

◆ requestBit()

static bool anna::diameter::codec::functions::requestBit ( const anna::DataBlock )
staticnoexcept

◆ setEndToEnd()

static void anna::diameter::codec::functions::setEndToEnd ( anna::DataBlock ,
EndToEnd   
)
staticnoexcept

◆ setHopByHop()

static void anna::diameter::codec::functions::setHopByHop ( anna::DataBlock ,
HopByHop   
)
staticnoexcept

Gets the next AVP pointer reference within an AVPs set datablock with a certain AVP identification.

Parameters
avpsDBAVPs set as datablock
idAvp identification (code, vendorId).
nOcurrence number (first avp, second avp, etc.). 1 by default.
Returns
Pointer to first AVP found with identification provided. NULL if not found.

◆ setPotentiallyReTransmittedMessageBit()

static void anna::diameter::codec::functions::setPotentiallyReTransmittedMessageBit ( const anna::DataBlock db,
bool  activate = true 
)
staticnoexcept

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