Format astyle
[anna.git] / include / anna / diameter / codec / Avp.hpp
index 77ae9fb..c991703 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
 //
 //
 // (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
 //
 // 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.
 // 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.
 //
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
@@ -42,6 +42,7 @@
 #include <anna/config/defines.hpp>
 #include <anna/diameter/defines.hpp>
 #include <anna/diameter/codec/basetypes/basetypes.hpp>
 #include <anna/config/defines.hpp>
 #include <anna/diameter/defines.hpp>
 #include <anna/diameter/codec/basetypes/basetypes.hpp>
+#include <anna/diameter/codec/functions.hpp>
 #include <anna/diameter/stack/Avp.hpp>
 
 #include <anna/core/RuntimeException.hpp>
 #include <anna/diameter/stack/Avp.hpp>
 
 #include <anna/core/RuntimeException.hpp>
@@ -205,7 +206,7 @@ class Avp {
   static Avp * addAvp(avp_container &avps, int &insertionPositionForChilds, AvpId id, Engine *engine) throw();
   static bool removeAvp(avp_container &avps, find_container &finds, AvpId id, int ocurrence, Engine *engine) throw();
   static void fix(avp_container &avps, find_container &finds, int &insertionPositionForChilds, anna::diameter::stack::const_avprule_iterator ruleBegin, anna::diameter::stack::const_avprule_iterator ruleEnd) throw();
   static Avp * addAvp(avp_container &avps, int &insertionPositionForChilds, AvpId id, Engine *engine) throw();
   static bool removeAvp(avp_container &avps, find_container &finds, AvpId id, int ocurrence, Engine *engine) throw();
   static void fix(avp_container &avps, find_container &finds, int &insertionPositionForChilds, anna::diameter::stack::const_avprule_iterator ruleBegin, anna::diameter::stack::const_avprule_iterator ruleEnd) throw();
-  static bool validLevel(const avp_container &avps, anna::diameter::stack::const_avprule_iterator ruleBegin, anna::diameter::stack::const_avprule_iterator ruleEnd, Engine * engine, const std::string & parentDescription, Message *answer) throw(anna::RuntimeException); // validates mandatory/fixed and cardinality
+  static bool validLevel(const avp_container &avps, anna::diameter::stack::const_avprule_iterator ruleBegin, anna::diameter::stack::const_avprule_iterator ruleEnd, Engine * engine, const anna::diameter::codec::parent_t & parent, Message *answer) throw(anna::RuntimeException); // validates mandatory/fixed and cardinality
   static const Avp* getAvp(const avp_container &avps, find_container &finds, AvpId id, int ocurrence, Engine *engine, anna::Exception::Mode::_v emode) throw(anna::RuntimeException);
   static int countAvp(const avp_container &avps, AvpId id) throw();
   static const Avp* firstAvp(const avp_container &avps, AvpId id) throw();
   static const Avp* getAvp(const avp_container &avps, find_container &finds, AvpId id, int ocurrence, Engine *engine, anna::Exception::Mode::_v emode) throw(anna::RuntimeException);
   static int countAvp(const avp_container &avps, AvpId id) throw();
   static const Avp* firstAvp(const avp_container &avps, AvpId id) throw();
@@ -247,12 +248,12 @@ class Avp {
   /**
      Validates an Avp regarding dictionary rules like enumerated range, flags coherence, mandatory and fixed types, cardinality qualifiers, etc.
 
   /**
      Validates an Avp regarding dictionary rules like enumerated range, flags coherence, mandatory and fixed types, cardinality qualifiers, etc.
 
-     @param parentDescription Parent description. Internally used for alarms and tracing
+     @param parent Parent description. Internally used for alarms, tracing and Failed-AVP construction
      @param answer Answer could be modified with any validation problem during requests validation
 
      @return Boolean indicating validation result
   */
      @param answer Answer could be modified with any validation problem during requests validation
 
      @return Boolean indicating validation result
   */
-  bool valid(const std::string & parentDescription, Message *answer) const throw(anna::RuntimeException);
+  bool valid(const anna::diameter::codec::parent_t & parent, Message *answer) const throw(anna::RuntimeException);
 
   /**
      Decodes buffer provided over class content. If an error ocurred, decoding will stop launching exception (fatal error) or a warning trace (perhaps the achieved
 
   /**
      Decodes buffer provided over class content. If an error ocurred, decoding will stop launching exception (fatal error) or a warning trace (perhaps the achieved
@@ -260,9 +261,10 @@ class Avp {
      depending on validation depth (codec::Engine::ValidationDepth).
 
      @param db Buffer data block processed
      depending on validation depth (codec::Engine::ValidationDepth).
 
      @param db Buffer data block processed
+     @param parent Parent description. Internally used for alarms, tracing and Failed-AVP construction
      @param answer Answer built for request decoding/validation
   */
      @param answer Answer built for request decoding/validation
   */
-  void decode(const anna::DataBlock &db, Message *answer) throw(anna::RuntimeException);
+  void decode(const anna::DataBlock &db, const anna::diameter::codec::parent_t & parent, Message *answer) throw(anna::RuntimeException);
 
 
   /////////////////////////////////////////////
 
 
   /////////////////////////////////////////////
@@ -405,9 +407,10 @@ protected:
 
      @param buffer Avp data part start pointer
      @param size Avp data part size
 
      @param buffer Avp data part start pointer
      @param size Avp data part size
+     @param parent Parent description. Internally used for alarms, tracing and Failed-AVP construction
      @param answer Answer built for request decoding/validation
   */
      @param answer Answer built for request decoding/validation
   */
-  void decodeDataPart(const char * buffer, int size, Message *answer) throw(anna::RuntimeException);
+  void decodeDataPart(const char * buffer, int size, const anna::diameter::codec::parent_t & parent, Message *answer) throw(anna::RuntimeException);
 
 
 public:
 
 
 public:
@@ -727,12 +730,10 @@ public:
      Diameter Relay and redirect agents MUST NOT reject messages with unrecognized AVPs.
 
      Default implementation launch alarm and counter indicating the anomaly but don't launch exception (traces at warning level).
      Diameter Relay and redirect agents MUST NOT reject messages with unrecognized AVPs.
 
      Default implementation launch alarm and counter indicating the anomaly but don't launch exception (traces at warning level).
-     Realy and Redirect agents could reimplement this method to avoid oam management (another way is avoid alarm/counter registration on
+     Relay and Redirect agents could reimplement this method to avoid oam management (another way is avoid alarm/counter registration on
      these applications). Result-Code DIAMETER_AVP_UNSUPPORTED will be stored for possible answer message.
      these applications). Result-Code DIAMETER_AVP_UNSUPPORTED will be stored for possible answer message.
-
-     @param answer Answer built for request decoding/validation
   */
   */
-  virtual void unknownAvpWithMandatoryBit(Message *answer) const throw(anna::RuntimeException);
+  virtual void unknownAvpWithMandatoryBit() const throw(anna::RuntimeException);
 
 
   friend class Message;
 
 
   friend class Message;