X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;ds=sidebyside;f=include%2Fanna%2Fdiameter%2Fcodec%2FAvp.hpp;h=164234e2d82db55af0e0a9f03c9b7c17ba199ae7;hb=e7dbacff41163bf8cefb267daae84d96056ebc86;hp=c9917038988474f41afdf9f5772d1c2b88fc00d3;hpb=0ce74f51388826845727411a7d37d841111ede84;p=anna.git diff --git a/include/anna/diameter/codec/Avp.hpp b/include/anna/diameter/codec/Avp.hpp index c991703..164234e 100644 --- a/include/anna/diameter/codec/Avp.hpp +++ b/include/anna/diameter/codec/Avp.hpp @@ -385,22 +385,6 @@ protected: */ std::string getXMLdata(bool & isHex, const anna::diameter::stack::Format *stackFormat) const throw(); - /** - Interpret xml data in order to dump over the class content. - - \param avpNode Avp root node - */ - void fromXML(const anna::xml::Node* avpNode) throw(anna::RuntimeException); - - - /** - Encodes buffer with the class content. - - * @param buffer Raw data to be encoded - * @param size Size of raw data to be encoded - */ - void code(char* buffer, int &size) const throw(anna::RuntimeException); - /** Decodes Avp data part. @@ -690,6 +674,37 @@ public: const Unknown * getUnknown() const throw(anna::RuntimeException) { assertFormat("Unknown"); return a_Unknown; } + /** + Decodes buffer provided over class content. If an error ocurred, decoding will stop launching exception (fatal error) or a warning trace (perhaps the achieved + avp is valid against all odds then validation will go on). In case that validation is enabled (codec::Engine::ValidationMode) an exception will be launched + depending on validation depth (codec::Engine::ValidationDepth). + + Useful as serialization procedure with #code + + @param db Buffer data block processed + */ + void decode(const anna::DataBlock &db) throw(anna::RuntimeException); + + + /** + Interpret xml data in order to dump over the class content. + + \param avpNode Avp root node + */ + void fromXML(const anna::xml::Node* avpNode) throw(anna::RuntimeException); + + + /** + Encodes buffer with the class content. This method is internally used to encode diameter messages, but is declared as public, to allow + its use as serialization procedure. Then, it's assumed that this Avp is valid (validation shall be applied as part of a whole diameter + message but nothing will be verified now). + + * @param buffer Raw data to be encoded (shall be externally allocated) + * @param size Size of raw data to be encoded + */ + void code(char* buffer, int &size) const throw(anna::RuntimeException); + + // Helpers /** @@ -705,6 +720,26 @@ public: */ std::string asXMLString() const throw(); + /** + Comparison operator by mean serialization + + @param a1 Instance 1 for Avp class + @param a2 Instance 2 for Avp class + + @return Comparison result + */ + friend bool operator == (const Avp & a1, const Avp & a2) throw() { return (a1.asXMLString() == a2.asXMLString()); } + + /** + Match a regular expression (string pattern) regarding xml string serialization for this avp. + This works same as #Message::isLike + + @param pattern Pattern to match + + \return Returns the match result + */ + bool isLike(const std::string &pattern) const throw(); + /** Counts the number of ocurrences of Avps (first level) with the identifier provided