//
// (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.
//
bool flagsOK(int &rc) const throw(); // flags coherence regarding dictionary. Only must be called when Message is identified at the dictionary.
int addChild(Avp *avp) throw() { return Avp::addChild(a_avps, a_insertionPositionForChilds, avp); }
const anna::diameter::stack::Command *getStackCommand(CommandId id) const throw(anna::RuntimeException);
- Avp * addFailedAVP() throw(); // returns Failed-AVP if exists, creates it when missing
+ Avp * addTheFailedAVP() throw(); // returns the Failed-AVP if exists, creates it when missing. The method could be named 'addFailedAVP'
+ // but we consider this better because only one instance (as RFC 6733 says in section 7.5) will be
+ // added by internal procedures (although, the application could obviously add more).
protected:
/**
- Adds a new AVP within a Failed-AVP over an answer message (for requests, do nothing).
+ Adds the wrong AVP within the Failed-AVP over an answer message (for requests, do nothing).
If Failed-AVP AVP doesn't exists, is added and then filled (added within) with the value provided (empty AVP id representantion).
- If Failed-AVP AVP already exists, is filled (added within) with the value provided (empty AVP id representantion).
+ If Failed-AVP AVP already exists, is probably filled by a previous found error, but anyway this is verified and if empty then is
+ filled (added within) with the value provided (empty AVP id representantion).
- This method is internally used during #decode and/or #valid procedures in order to build automatic answers.
+ This method is internally used during #decode and/or #valid procedures in order to build automatic answers, but application
+ could call this for set another Failed-AVP content no detected by these methods, for example: DIAMETER_CONTRADICTING_AVPS or
+ DIAMETER_INVALID_AVP_BIT_COMBO). Also, application could add more Failed-AVP avps with other wrong avps, or accumulate wrong
+ avps inside the one and only Failed-AVP managed by the stack (see section 7.5 of RFC 6733).
@param id Avp identifier as pair (code,vendor-id).
- @return Pointer to the new AVP added within Failed-AVP, to make easy data-part accessif needed.
+ @return Pointer to the new AVP added within Failed-AVP, to make easy data-part access if needed.
*/
- Avp * setNewFailedAvp(AvpId id) throw(anna::RuntimeException) { if(isRequest()) return NULL; return (addFailedAVP()->addAvp(id)); }
+ Avp * setFailedAvp(AvpId id) throw(anna::RuntimeException);
/**
- Adds a new AVP within a Failed-AVP over an answer message (for requests, do nothing).
- If Failed-AVP AVP doesn't exists, is added and then filled (added within) with the value provided (empty AVP id representantion).
- If Failed-AVP AVP already exists, is filled (added within) with the value provided (empty AVP id representantion).
-
- This method is internally used during #decode and/or #valid procedures in order to build automatic answers, but application
- could call this for set another Failed-AVP content no detected by these methods, for example: DIAMETER_CONTRADICTING_AVPS or
- DIAMETER_INVALID_AVP_BIT_COMBO).
+ Same as #setFailedAvp(AvpId id) but providing an avp pointer with the needed information
- @param id Avp identifier as pair (code,vendor-id).
+ @param avp Pointer to the added wrong avp
- @return Pointer to the new AVP added within Failed-AVP, to make easy data-part accessif needed.
+ @return Pointer to the new AVP added within Failed-AVP, to make easy data-part access if needed.
*/
- Avp * setNewFailedAvp(Avp *avp) throw() { if(!avp || isRequest()) return NULL; return (addFailedAVP()->addAvp(avp)); }
+ Avp * setFailedAvp(Avp *avp) throw(anna::RuntimeException);
+
/**