Identify Avp Rule by AvpId to avoid name collision for avps renamed. Fix 3GPP-Rat...
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Wed, 29 Apr 2015 01:26:32 +0000 (03:26 +0200)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Wed, 29 Apr 2015 01:26:32 +0000 (03:26 +0200)
include/anna/diameter/stack/AvpRule.hpp
source/diameter/stack/AvpRule.cpp
source/diameter/stack/Dictionary.cpp
source/diameter/stack/setups/avps_nokia.xml
source/diameter/stack/setups/avps_tgpp.xml
source/diameter/stack/setups/commands_dccaPS_HuaweiGGSN.xml
source/diameter/stack/setups/commands_dccaPS_HuaweiGGSN_de.xml
source/diameter/stack/setups/commands_dccaPS_NSNGGSN_es.xml

index e31817f..ead1dc6 100644 (file)
@@ -75,13 +75,12 @@ public:
 private:
 
   const Dictionary *a_dictionary;
-  std::string a_avpName; // reference
+  AvpId a_avpId; // reference
   Presence::_v a_presence;
   std::string a_qual;
 
   void _initialize(const Dictionary *d) throw() {
     a_dictionary = d;
-    a_avpName = "";
     a_presence = Presence::None;
     a_qual = "";
   }
@@ -94,12 +93,12 @@ public:
 
 
   // get
-  const std::string & getAvpName(void) const throw() { return a_avpName; }
+  std::string getAvpName(void) const throw();
   const Presence::_v & getPresence(void) const throw() { return a_presence; }
   const std::string & getQual(void) const throw() { return a_qual; }
 
   // helpers
-  AvpId getId(void) const throw();
+  AvpId getId(void) const throw() { return a_avpId; }
   bool isAny(void) const throw(); // generic Avp
   bool isFixed(void) const throw() { return (a_presence == Presence::Fixed); }
   bool isMandatory(void) const throw() { return (a_presence == Presence::Mandatory); }
@@ -114,7 +113,7 @@ public:
 
   // set
   void initialize(const Dictionary *d = NULL) throw() { _initialize(d); }
-  void setAvpName(const std::string & an) throw() { a_avpName = an; }
+  void setAvpId(const AvpId & ai) throw() { a_avpId = ai; }
   void setPresence(const Presence::_v & p) throw() { a_presence = p; }
   void setQual(const std::string & q) throw(anna::RuntimeException);
 };
index 68ba88b..bec3ec9 100644 (file)
@@ -41,18 +41,18 @@ void anna::diameter::stack::AvpRule::setQual(const std::string & q) throw(anna::
 
 
 //------------------------------------------------------------------------------
-//------------------------------------------------------------- AvpRule::getId()
+//-------------------------------------------------------- AvpRule::getAvpName()
 //------------------------------------------------------------------------------
-anna::diameter::AvpId anna::diameter::stack::AvpRule::getId(void) const throw() {
-  const Avp * avp = a_dictionary->getAvp(a_avpName);
-  return avp->getId();
+std::string anna::diameter::stack::AvpRule::getAvpName(void) const throw() {
+  const Avp * avp = a_dictionary->getAvp(a_avpId);
+  return avp->getName();
 }
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------- AvpRule::isAny()
 //------------------------------------------------------------------------------
 bool anna::diameter::stack::AvpRule::isAny(void) const throw() {
-  const Avp * avp = a_dictionary->getAvp(a_avpName);
+  const Avp * avp = a_dictionary->getAvp(a_avpId);
   const Format * format = a_dictionary->getFormat(avp->getFormatName());
   return format->isAny();
 }
@@ -106,7 +106,7 @@ int anna::diameter::stack::AvpRule::getQualMax(void) const throw() {
 //------------------------------------------------------------------------------
 std::string anna::diameter::stack::AvpRule::asString(bool showPair) const throw() {
   std::string trace = "No Avp rule defined";
-  const Avp * avp = a_dictionary->getAvp(a_avpName);
+  const Avp * avp = a_dictionary->getAvp(a_avpId);
 
   if(avp) {
     trace = a_qual;
@@ -119,7 +119,7 @@ std::string anna::diameter::stack::AvpRule::asString(bool showPair) const throw(
     if(isOptional()) { s_open = "["; s_close = "]"; }
 
     trace += s_open;
-    trace += a_avpName;
+    trace += getAvpName(); // anna::diameter::functions::avpIdAsPairString(a_avpId);;
     trace += s_close;
 
     if(!showPair) return trace;
@@ -147,7 +147,7 @@ anna::xml::Node* anna::diameter::stack::AvpRule::asXML(anna::xml::Node* parent)
 //   <!ELEMENT avprule EMPTY>
 //   <!ATTLIST avprule id CDATA #REQUIRED type (Fixed | Mandatory | Optional) #REQUIRED qual CDATA #IMPLIED>
   anna::xml::Node* result = parent->createChild("avprule");
-  result->createAttribute("id", a_avpName);
+  result->createAttribute("id", getAvpName());
   std::string type;
 
   if(isFixed()) type = "Fixed";
index d5676a8..b94d46d 100644 (file)
@@ -693,7 +693,7 @@ void Dictionary::extractAvps(const anna::xml::Node *rootNode) throw(anna::Runtim
             throw anna::RuntimeException(s_ex, ANNA_FILE_LOCATION);
           }
 
-          auxAvpRule.setAvpName(id);
+          auxAvpRule.setAvpId(avp->getId());
           auxAvpRule.setPresence(AvpRule::Presence::asEnum(type));
           auxAvpRule.setQual(qual ? (qual->getValue()) : "");
           gavp->addAvpRule(auxAvpRule);
@@ -795,7 +795,7 @@ void Dictionary::extractCommands(const anna::xml::Node *rootNode) throw(anna::Ru
           throw anna::RuntimeException(s_ex, ANNA_FILE_LOCATION);
         }
 
-        auxAvpRule.setAvpName(id);
+        auxAvpRule.setAvpId(avp->getId());
         auxAvpRule.setPresence(AvpRule::Presence::asEnum(type));
         auxAvpRule.setQual(qual ? (qual->getValue()) : "");
         auxCommand.addAvpRule(auxAvpRule);
index 6368584..090a0ed 100644 (file)
@@ -14,7 +14,7 @@
    <!-- NOKIA VENDOR SPECIFIC CODES -->
    <avp name="Nokia-Access-Method" code="5100" vendor-name="NOKIA" v-bit="must">
       <single format-name="Enumerated" enum="0-3">
-<!-- No especification found for possible values. Usually we will use 3GPP-Rat-Type instead of 'Nokia-Access-Method'
+<!-- No especification found for possible values. Usually we will use 3GPP-RAT-Type instead of 'Nokia-Access-Method'
          <label data="0" alias="??"/>
          <label data="1" alias="??"/>
          <label data="2" alias="??"/>
index 2c6ee2e..c7cd3be 100644 (file)
    <avp name="3GPP-GGSN-IPv6-Address" code="16" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
    <avp name="3GPP-SGSN-MCC-MNC" code="18" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="UTF8String"/></avp>
    <avp name="3GGP-IMEISV" code="20" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
-   <avp name="3GPP-Rat-Type" code="21" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
+   <avp name="3GPP-RAT-Type" code="21" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
    <avp name="3GPP-User-Location-Info" code="22" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
    <avp name="3GPP-MS-TimeZone" code="23" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
    <avp name="3GPP-CAMEL-Charging-Info" code="24" vendor-name="3GPP" may-encrypt="no" v-bit="must" m-bit="must" p-bit="may"><single format-name="OctetString"/></avp>
          <avprule id="3GPP-Selection-Mode" type="Optional"/>
          <avprule id="3GPP-Charging-Characteristics" type="Optional"/>
          <avprule id="3GPP-SGSN-MCC-MNC" type="Optional"/>
-         <avprule id="3GPP-Rat-Type" type="Optional"/>
+         <avprule id="3GPP-RAT-Type" type="Optional"/>
          <avprule id="3GPP-User-Location-Info" type="Optional"/>
          <avprule id="3GPP-MS-TimeZone" type="Optional"/>
          <avprule id="3GPP-CAMEL-Charging-Info" type="Optional"/>
index cbd8de4..733a218 100644 (file)
@@ -30,7 +30,7 @@
       <avprule id="User-Equipment-Info" type="Optional"/>
       <avprule id="3GPP-GGSN-MCC-MNC" type="Optional"/>
       <avprule id="Filter-Id" type="Optional"/>
-      <avprule id="3GPP-Rat-Type" type="Optional"/>
+      <avprule id="3GPP-RAT-Type" type="Optional"/>
    </command>
    <command name="Credit-Control-Answer" code="272" type="Answer">
       <avprule id="Session-Id" type="Fixed"/>
index 7b4585f..5f537ac 100644 (file)
@@ -58,7 +58,7 @@ Hot patch: SPH301 (and SPH302 will be deployed in CW41)
       <avprule id="3GPP-GPRS-Neg-QoS-Profile" type="Optional"/>
       <avprule id="3GPP-GGSN-Address" type="Optional"/>
       <avprule id="3GPP-SGSN-Address" type="Optional"/>
-      <avprule id="3GPP-Rat-Type" type="Optional"/>
+      <avprule id="3GPP-RAT-Type" type="Optional"/>
       <avprule id="3GPP-User-Location-Info" type="Optional"/>
       <avprule id="3GPP-MS-TimeZone" type="Optional"/>
       <avprule id="3GPP-NSAPI" type="Optional"/>
index d8d9f26..5440568 100644 (file)
@@ -51,7 +51,7 @@
       <avprule id="3GPP-NSAPI" type="Optional"/>
       <avprule id="3GPP-Session-Stop-Indicator" type="Optional"/>
       <avprule id="3GPP-Selection-Mode" type="Optional"/>
-      <avprule id="3GPP-Rat-Type" type="Optional"/>
+      <avprule id="3GPP-RAT-Type" type="Optional"/>
       <avprule id="3GPP-SGSN-MCC-MNC" type="Optional"/>
       <avprule id="3GPP-User-Location-Info" type="Optional"/>
       <avprule id="3GPP-MS-TimeZone" type="Optional"/>