X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter%2Fcodec%2FAvp.hpp;h=6677b340904f18c3ba59b356812cc2b26d1f8df3;hb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;hp=cd6c1008c97f676f403632575cd8c89cd2b4f183;hpb=4e12ac57e93c052f716a6305ad8fc099c45899d1;p=anna.git diff --git a/include/anna/diameter/codec/Avp.hpp b/include/anna/diameter/codec/Avp.hpp index cd6c100..6677b34 100644 --- a/include/anna/diameter/codec/Avp.hpp +++ b/include/anna/diameter/codec/Avp.hpp @@ -1,4 +1,4 @@ -// ANNA - Anna is Not 'N' Anymore +// ANNA - Anna is Not Nothingness Anymore // // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo // @@ -43,7 +43,6 @@ #include #include #include -#include #include @@ -70,17 +69,6 @@ namespace anna { namespace diameter { -namespace helpers { -namespace tme { -namespace codectypes { -class Unsigned16; -class ISDNNumber; -class ISDNAddress; -} -} -} - - namespace stack { class Dictionary; class Format; @@ -124,7 +112,6 @@ typedef std::map::iterator find_iterator; using namespace basetypes; -using namespace helpers::tme::codectypes; /** * Diameter avp generic container @@ -201,14 +188,6 @@ class Avp { QoSFilterRule *a_QoSFilterRule; Unknown *a_Unknown; - // Derived formats //////////////////////////////////////////// - /* TME */ - ISDNNumber *a_ISDNNumber; - ISDNAddress *a_ISDNAddress; - Unsigned16 *a_Unsigned16; - - - // Grouped helpers find_container a_finds; // fast access for grouped and message first-level avps @@ -250,7 +229,6 @@ class Avp { static const Avp* avp(const_avp_iterator ii) throw() { return ii->second; } // Internal - void assertFormat(const std::string &name) const throw(anna::RuntimeException); bool flagsOK() const throw(); // flags coherence regarding dictionary. Only must be called when AVP is identified at the dictionary. int addChild(Avp *avp) throw(anna::RuntimeException) { assertFormat("Grouped"); return addChild(a_avps, a_insertionPositionForChilds, avp); } bool hasChildren() throw() { return a_avps.size() != 0; } @@ -293,80 +271,80 @@ class Avp { /** * Initializes Avp class information. - * Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + * Default implementation supports all anna::diameter formats (including derived ones). * Diameter basic formats are managed at #initialize, which will invoke this method at the end. */ - virtual void initializeByFormat() throw(); + virtual void initializeByFormat() throw() {}; /** * Gets avp data-part length. - * Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + * Default implementation supports all anna::diameter formats (including derived ones). * Diameter basic formats are managed at #initialize, which will invoke this method at the end. * * @param stackFormat Stack avp format in which data extraction is based. * * @return Avp data-part size. */ - virtual U24 getLengthByFormat(const anna::diameter::stack::Format *stackFormat) const throw(); + virtual U24 getLengthByFormat(const anna::diameter::stack::Format *stackFormat) const throw() { return 0; }; /** Gets data or hexadecimal data depending on avp format, for xml creating - Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + Default implementation supports all anna::diameter formats (including derived ones). Diameter basic formats are managed at #initialize, which will invoke this method at the end. \param isHex Hexadecimal/Natural data when apply. \param stackFormat Stack avp format in which data extraction is based. \return xml data representation */ - virtual std::string getXMLdataByFormat(bool & isHex, const anna::diameter::stack::Format *stackFormat) const throw(); + virtual std::string getXMLdataByFormat(bool & isHex, const anna::diameter::stack::Format *stackFormat) const throw() { return ""; }; /** Interpret xml data in order to dump over the class content. - Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + Default implementation supports all anna::diameter formats (including derived ones). Diameter basic formats are managed at #initialize, which will invoke this method at the end. \param data Avp data attribute \param hexData Avp hex-data attribute \param stackFormat Stack avp format in which data extraction is based. */ - virtual void fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException); + virtual void fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException) {}; /** Encodes buffer with the class content. - Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + Default implementation supports all anna::diameter formats (including derived ones). Diameter basic formats are managed at #initialize, which will invoke this method at the end. @param dataPart Data-part begin pointer @param stackFormat Stack avp format in which data extraction is based. */ - virtual void codeByFormat(char* dataPart, const anna::diameter::stack::Format *stackFormat) const throw(anna::RuntimeException); + virtual void codeByFormat(char* dataPart, const anna::diameter::stack::Format *stackFormat) const throw(anna::RuntimeException) {}; /** Decodes Avp data part. - Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + Default implementation supports all anna::diameter formats (including derived ones). Diameter basic formats are managed at #initialize, which will invoke this method at the end. @param buffer Avp data part start pointer @param size Avp data part size @param stackFormat Stack avp format in which data extraction is based. */ - virtual void decodeDataPartByFormat(const char * buffer, int size, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException); + virtual void decodeDataPartByFormat(const char * buffer, int size, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException) {}; /** Reserves memory for data part depending on avp format for the identifier provided. - Default implementation supports all anna::diameter formats (including i.e. tme.db ones). + Default implementation supports all anna::diameter formats (including derived ones). Diameter basic formats are managed at #initialize, which will invoke this method at the end. @param stackFormat Stack avp format in which data extraction is based. */ - virtual void allocationByFormat(const anna::diameter::stack::Format *stackFormat) throw(); + virtual void allocationByFormat(const anna::diameter::stack::Format *stackFormat) throw() {}; /** * Clears Avp data-part format containers. */ - virtual void clearByFormat() throw(); + virtual void clearByFormat() throw() {}; @@ -383,6 +361,10 @@ protected: */ void initialize() throw(); + /** + * Assert format regarding dictionary + */ + void assertFormat(const std::string &name) const throw(anna::RuntimeException); /** * Gets avp total length based on internal data part and header configuration. @@ -574,15 +556,6 @@ public: /** Access content for Unknown Avp in order to set data part */ Unknown * getUnknown() throw(anna::RuntimeException) { assertFormat("Unknown"); return a_Unknown; } - // Derived formats //////////////////////////////////////////// - /* TME */ - /** Access content for ISDNNumber Avp in order to set data part */ - ISDNNumber * getISDNNumber() throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; } - /** Access content for ISDNAddress Avp in order to set data part */ - ISDNAddress * getISDNAddress() throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; } - /** Access content for Unsigned16 Avp in order to set data part */ - Unsigned16 * getUnsigned16() throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; } - /** Removes an Avp within grouped type (first level) and free resources. @@ -714,16 +687,6 @@ public: const Unknown * getUnknown() const throw(anna::RuntimeException) { assertFormat("Unknown"); return a_Unknown; } - // Derived formats //////////////////////////////////////////// - /* TME */ - /** Access content for ISDNNumber Avp */ - const ISDNNumber * getISDNNumber() const throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; } - /** Access content for ISDNAddress Avp */ - const ISDNAddress * getISDNAddress() const throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; } - /** Access content for Unsigned16 Avp */ - const Unsigned16 * getUnsigned16() const throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; } - - // Helpers /**