X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter%2Fcodec%2FMessage.hpp;h=41ebe0a80acdec66bd48a9a0929b1631df33ddbb;hb=ea1b80f8fd0c1b806460f98f4e4cf433698857d9;hp=376fa3948bfa833e34c589dafa68da4824e59bbf;hpb=c9a91acd707f39fb11d9d513d904cb1f6db52386;p=anna.git diff --git a/include/anna/diameter/codec/Message.hpp b/include/anna/diameter/codec/Message.hpp index 376fa39..41ebe0a 100644 --- a/include/anna/diameter/codec/Message.hpp +++ b/include/anna/diameter/codec/Message.hpp @@ -223,7 +223,8 @@ public: /** * Destructor */ - ~Message(); + virtual ~Message(); + // Virtual destructors are useful when you can delete an instance of a derived class through a pointer to base class: // This destructor is not virtual, then a pointer to base class (even pointing to a children one) will invoke this destructor, not the derived one. // My current solution: virtualizing method 'clear' @@ -553,7 +554,18 @@ public: * * @param xmlPathFile Complete path file to the xml document which represents the diameter message */ - void loadXML(const std::string &xmlPathFile) throw(anna::RuntimeException); + void loadXMLFile(const std::string &xmlPathFile) throw(anna::RuntimeException); + + /** + * Interpret a xml string in order to create a diameter message + * You could apply this multiple times over the same object. A basic cleanup is done respecting the codec engine. + * + * @see functions::messageXmlDocumentFromXmlString + * @see fromXML + * + * @param xmlString xml representation of the diameter message + */ + void loadXMLString(const std::string &xmlString) throw(anna::RuntimeException); // getters @@ -747,7 +759,7 @@ public: for example, the pattern '' matchs IP addresses for '10.x.10.10' where x = [0..255]. - Note that string pattern could also be generated via #loadXML and then #asXML, that is to say, you + Note that string pattern could also be generated via #loadXMLFile/#loadXMLString and then #asXML, thus, you could get patterns through xml files which act as conditional triggers over message. In that case, it is not possible to specify regular expressions within xml 'hex-data' fields because parser will fail during hexadecimal read. Normally only printable 'data' fields are used for matching issues. @@ -763,7 +775,7 @@ public: Then you could do: anna::diameter::codec::Message patternMessage; - patternMessage.loadXML("pattern.xml"); + patternMessage.loadXMLFile("pattern.xml"); std::string pattern = patternMessage.getAvp("Subscription-Id")->getAvp("Subscription-Id-Type")->asXMLString(); // Former is '' bool match = incomingMessage.isLike(pattern);