X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter%2Fcodec%2Ffunctions.cpp;h=7c5516c3dab686b5954bd3bb574d4d9562ddbf6e;hb=8808902f3d5e768a02f3936c4a1a8732da682895;hp=a8a6348d1b816ec4ec1f2664bf20fb1712506cc1;hpb=4e12ac57e93c052f716a6305ad8fc099c45899d1;p=anna.git diff --git a/source/diameter/codec/functions.cpp b/source/diameter/codec/functions.cpp index a8a6348..7c5516c 100644 --- a/source/diameter/codec/functions.cpp +++ b/source/diameter/codec/functions.cpp @@ -1,8 +1,8 @@ -// ANNA - Anna is Not 'N' Anymore +// ANNA - Anna is Not Nothingness Anymore // // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo // -// https://bitbucket.org/testillano/anna +// http://redmine.teslayout.com/projects/anna-suite // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -14,7 +14,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -53,6 +53,47 @@ using namespace anna::diameter::codec; + + +// Parent struct helper ///////////////////////////////////////////////////////////////////////////// +void parent::setMessage(const anna::diameter::CommandId & mid, const char *mname) throw() { + MessageId = mid; + if (mname) { + MessageName = mname; + } + else { + MessageName = "Message"; + MessageName += anna::diameter::functions::commandIdAsPairString(mid); + } +} + +void parent::addAvp(const anna::diameter::AvpId & aid, const char *aname) throw() { + AvpsId.push_back(aid); + std::string name; + if (aname) { + name = aname; + } + else { + name = "Avp"; + name += anna::diameter::functions::avpIdAsPairString(aid); + } + AvpsName.push_back(name); +} + +std::string parent::asString() const throw() { // "->->...->" + std::string result = MessageName; + for (std::vector::const_iterator it = AvpsName.begin(); it != AvpsName.end(); it++) { + result += "->"; + result += (*it); + } + + return result; +} +///////////////////////////////////////////////////////////////////////////////////////////////////// + + + + // getters anna::diameter::CommandId functions::getCommandId(const anna::DataBlock & db) throw(anna::RuntimeException) { if(db.getSize() < Message::HeaderLength)