Suuports clang compiler
[anna.git] / source / diameter / codec / Avp.cpp
index 59cc6d7..19a0780 100644 (file)
@@ -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.
 //
@@ -927,7 +927,7 @@ bool Avp::validLevel(const avp_container &avps, anna::diameter::stack::const_avp
         }
 
         avp_it++;
-        // (*) for (register int k = 0; k < (*rule_it).second.getQualMax(); k++) avp_it++
+        // (*) for (int k = 0; k < (*rule_it).second.getQualMax(); k++) avp_it++
       } else
         okFixed = false;
 
@@ -1579,109 +1579,3 @@ std::string Avp::asXMLString() const throw() {
   return anna::xml::Compiler().apply(asXML(&root));
 }
 
-
-/////////////////////
-// FORMAT-SPECIFIC //
-/////////////////////
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------- Avp::initializeByFormat()
-//------------------------------------------------------------------------------
-void Avp::initializeByFormat() throw() {
-  a_ISDNNumber = NULL;
-  a_ISDNAddress = NULL;
-  a_Unsigned16 = NULL;
-}
-
-
-//------------------------------------------------------------------------------
-//--------------------------------------------------------- Avp::clearByFormat()
-//------------------------------------------------------------------------------
-void Avp::clearByFormat() throw() {
-  delete a_ISDNNumber;
-  delete a_ISDNAddress;
-  delete a_Unsigned16;
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------- Avp::allocationByFormat()
-//------------------------------------------------------------------------------
-void Avp::allocationByFormat(const stack::Format *stackFormat) throw() {
-  if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber = new ISDNNumber();
-  else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress = new ISDNAddress();
-  else if(stackFormat->getName() == "Unsigned16") a_Unsigned16 = new Unsigned16();
-}
-
-
-//------------------------------------------------------------------------------
-//----------------------------------------------------- Avp::getLengthByFormat()
-//------------------------------------------------------------------------------
-U24 Avp::getLengthByFormat(const stack::Format *stackFormat) const throw() {
-  U24 result = 0;
-
-  if(stackFormat->getName() == "ISDNNumber") result += a_ISDNNumber->getSize();
-  else if(stackFormat->getName() == "ISDNAddress") result += a_ISDNAddress->getSize();
-  else if(stackFormat->getName() == "Unsigned16") result += a_Unsigned16->getSize();
-
-  return result;
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------ Avp::decodeDataPartByFormat()
-//------------------------------------------------------------------------------
-void Avp::decodeDataPartByFormat(const char * buffer, int size, const stack::Format *stackFormat) throw(anna::RuntimeException) {
-  if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber->decode(buffer, size);
-  else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress->decode(buffer, size);
-  else if(stackFormat->getName() == "Unsigned16") a_Unsigned16->decode(buffer, size);
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------------- Avp::codeByFormat()
-//------------------------------------------------------------------------------
-void Avp::codeByFormat(char* dataPart, const stack::Format *stackFormat) const throw(anna::RuntimeException) {
-  int dataBytes;
-
-  if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber->code(dataPart, dataBytes);
-  else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress->code(dataPart, dataBytes);
-  else if(stackFormat->getName() == "Unsigned16") a_Unsigned16->code(dataPart, dataBytes);
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------- Avp::getXMLdataByFormat()
-//------------------------------------------------------------------------------
-std::string Avp::getXMLdataByFormat(bool & isHex, const stack::Format *stackFormat) const throw() {
-  std::string result;
-
-  if(stackFormat->getName() == "ISDNNumber") {
-    isHex = true;
-    return a_ISDNNumber->asHexString();
-  } else if(stackFormat->getName() == "ISDNAddress") {
-    isHex = true;
-    return a_ISDNAddress->asHexString();
-  } else if(stackFormat->getName() == "Unsigned16") return a_Unsigned16->asPrintableString();
-
-  return result;
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------- Avp::fromXMLByFormat()
-//------------------------------------------------------------------------------
-void Avp::fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const stack::Format *stackFormat) throw(anna::RuntimeException) {
-  if(stackFormat->getName() == "ISDNNumber") {
-    if(data) a_ISDNNumber->fromPrintableString(data->getValue().c_str());
-    else if(hexData) a_ISDNNumber->fromHexString(hexData->getValue());
-  } else if(stackFormat->getName() == "ISDNAddress") {
-    if(data) a_ISDNAddress->fromPrintableString(data->getValue().c_str());
-    else if(hexData) a_ISDNAddress->fromHexString(hexData->getValue());
-  } else if(stackFormat->getName() == "Unsigned16") {
-    if(data) a_Unsigned16->fromPrintableString(data->getValue().c_str());
-    else if(hexData) a_Unsigned16->fromHexString(hexData->getValue());
-  }
-}
-