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 {
51 using namespace helpers::tme::codectypes;
54 * Diameter TME avp generic container
55 * Manages tme-specific formats (Unsigned16, ISDNAddress, ISDNNumber)
57 class Avp : public anna::diameter::codec::Avp {
60 ISDNNumber *a_ISDNNumber;
61 ISDNAddress *a_ISDNAddress;
62 Unsigned16 *a_Unsigned16;
64 virtual void initializeByFormat() throw();
65 virtual U24 getLengthByFormat(const anna::diameter::stack::Format *stackFormat) const throw();
66 virtual std::string getXMLdataByFormat(bool & isHex, const anna::diameter::stack::Format *stackFormat) const throw();
67 virtual void fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException);
68 virtual void codeByFormat(char* dataPart, const anna::diameter::stack::Format *stackFormat) const throw(anna::RuntimeException);
69 virtual void decodeDataPartByFormat(const char * buffer, int size, const anna::diameter::stack::Format *stackFormat) throw(anna::RuntimeException);
70 virtual void allocationByFormat(const anna::diameter::stack::Format *stackFormat) throw();
71 virtual void clearByFormat() throw();
75 /** Codec Engine getter: avoids have to create base engine when using its child */
76 virtual anna::diameter::codec::Engine * getEngine() const throw(anna::RuntimeException);
87 * Identified constructor
88 * @param id Avp identifier as pair (code,vendorID).
98 /** Access content for ISDNNumber Avp in order to set data part */
99 ISDNNumber * getISDNNumber() throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; }
100 /** Access content for ISDNAddress Avp in order to set data part */
101 ISDNAddress * getISDNAddress() throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; }
102 /** Access content for Unsigned16 Avp in order to set data part */
103 Unsigned16 * getUnsigned16() throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; }
106 /** Access content for ISDNNumber Avp */
107 const ISDNNumber * getISDNNumber() const throw(anna::RuntimeException) { assertFormat("ISDNNumber"); return a_ISDNNumber; }
108 /** Access content for ISDNAddress Avp */
109 const ISDNAddress * getISDNAddress() const throw(anna::RuntimeException) { assertFormat("ISDNAddress"); return a_ISDNAddress; }
110 /** Access content for Unsigned16 Avp */
111 const Unsigned16 * getUnsigned16() const throw(anna::RuntimeException) { assertFormat("Unsigned16"); return a_Unsigned16; }
116 friend class Message;