-// 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
// 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.
//
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() { // "<command><avp 1>-><avp 2>->...-><avp N>"
+ std::string result = MessageName;
+ for (std::vector<std::string>::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)