1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_helpers_base_functions_hpp
10 #define anna_diameter_helpers_base_functions_hpp
14 #include <anna/diameter/defines.hpp>
15 #include <anna/config/defines.hpp>
17 #include <anna/core/RuntimeException.hpp>
22 //------------------------------------------------------------------------------
23 //---------------------------------------------------------------------- #define
24 //------------------------------------------------------------------------------
45 * Gets the first level command Result-Code from datablock provided
47 * @param db Provided Message DataBlock
49 * @return Result-Code value
51 static U32 getResultCode(const anna::DataBlock &) throw(anna::RuntimeException);
54 * Gets the tokenized by ';' Session-Id contents defined as '<DiameterIdentity>;<high 32 bits>;<low 32 bits>[;<optional value>]':
56 * @param sessionId Provided UTF8String Session-Id content
57 * @param diameterIdentity Sender Diameter Identity
58 * @param high High 64-bit-sequence part
59 * @param low Low 64-bit-sequence part
60 * @param optional Empty string when missing
62 static void decodeSessionId(const std::string &sessionId, std::string &diameterIdentity, U32 &high, U32 &low, std::string &optional) throw(anna::RuntimeException);
65 * Gets the fixed Session-Id AVP (UTF8String) from datablock provided.
66 * Also gets the tokenized by ';' Session-Id contents defined as '<DiameterIdentity>;<high 32 bits>;<low 32 bits>[;<optional value>]':
68 * @param db Provided Message DataBlock
69 * @param diameterIdentity Sender Diameter Identity
70 * @param high High 64-bit-sequence part
71 * @param low Low 64-bit-sequence part
72 * @param optional Empty string when missing
76 static std::string getSessionId(const anna::DataBlock &db, std::string &diameterIdentity, U32 &high, U32 &low, std::string &optional) throw(anna::RuntimeException);
80 * Gets the fixed Session-Id AVP (UTF8String) from datablock provided.
82 * @param db Provided Message DataBlock
86 static std::string getSessionId(const anna::DataBlock &db) throw(anna::RuntimeException) {
87 std::string dummy1, dummy4;
89 return (getSessionId(db, dummy1, dummy2, dummy3, dummy4));