1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_codec_tme_Avp_hpp
10 #define anna_diameter_codec_tme_Avp_hpp
13 #include <anna/diameter/codec/Avp.hpp>
14 #include <anna/diameter/helpers/tme/codectypes/codectypes.hpp>
16 //------------------------------------------------------------------------------
17 //---------------------------------------------------------------------- #define
18 //------------------------------------------------------------------------------
34 namespace codectypes {
53 using namespace helpers::tme::codectypes;
56 * Diameter TME avp generic container
57 * Manages tme-specific formats (Unsigned16, ISDNAddress, ISDNNumber)
59 class Avp : public anna::diameter::codec::Avp {
62 ISDNNumber *a_ISDNNumber;
63 ISDNAddress *a_ISDNAddress;
64 Unsigned16 *a_Unsigned16;
66 virtual void initializeByFormat() throw();
67 virtual U24 getLengthByFormat(const anna::diameter::stack::Format *stackFormat) const throw();
68 virtual std::string getXMLdataByFormat(bool & isHex, const anna::diameter::stack::Format *stackFormat) const throw();
69 virtual void fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException);
70 virtual void codeByFormat(char* dataPart, const anna::diameter::stack::Format *stackFormat) const throw(anna::RuntimeException);
71 virtual void decodeDataPartByFormat(const char * buffer, int size, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException);
72 virtual void allocationByFormat(const anna::diameter::stack::Format *stackFormat) throw();
73 virtual void clearByFormat() throw();
77 // /** Codec Engine getter: avoids have to create base engine when using its child */
78 // virtual anna::diameter::codec::Engine * getEngine() const throw(anna::RuntimeException);
85 * @param engine Codec engine used
87 Avp(Engine *engine = NULL) : anna::diameter::codec::Avp(engine) {;}
90 * Identified constructor
91 * @param id Avp identifier as pair (code,vendor-id).
92 * @param engine Codec engine used
94 Avp(AvpId id, Engine *engine = NULL) : anna::diameter::codec::Avp(id, engine) {;}
103 /** Access content for ISDNNumber Avp in order to set data part */
104 ISDNNumber * getISDNNumber() throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; }
105 /** Access content for ISDNAddress Avp in order to set data part */
106 ISDNAddress * getISDNAddress() throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; }
107 /** Access content for Unsigned16 Avp in order to set data part */
108 Unsigned16 * getUnsigned16() throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; }
111 /** Access content for ISDNNumber Avp */
112 const ISDNNumber * getISDNNumber() const throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; }
113 /** Access content for ISDNAddress Avp */
114 const ISDNAddress * getISDNAddress() const throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; }
115 /** Access content for Unsigned16 Avp */
116 const Unsigned16 * getUnsigned16() const throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; }
121 friend class Message;
122 friend class anna::diameter::codec::Engine;