ANNA Suite  2020b
Multipurpose development suite for Telco applications
Address.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
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 //
7 
8 
9 #ifndef anna_diameter_codec_basetypes_Address_hpp
10 #define anna_diameter_codec_basetypes_Address_hpp
11 
12 
13 // Local
15 
16 #include <anna/config/defines.hpp>
17 
18 
19 namespace anna {
20 
21 namespace diameter {
22 
23 namespace codec {
24 
25 class Avp;
26 
27 namespace basetypes {
28 
68 
69  iana_address_t a_address;
70  bool a_abbreviatePresentation; // specially for IPv6 address type
71 
72 
73  // Only for derived diameter type:
74  void updateBasic() noexcept(false);
75 
76  void setPrintableString(const char * printableString) noexcept(false);
77 
78 
79 public:
80 
84  Address() : a_abbreviatePresentation(true) {};
85 
89  virtual ~Address() {;}
90 
96  void setAbbreviatePresentation(bool abb) { a_abbreviatePresentation = abb; };
97 
98 
99 
100  // Class-specific ////////////////////////////////////////////////////////////////////////////////////
101  //
107  const iana_address_t& getIANAAddress() const { return a_address; }
108 
114  void setIANAAddress(const iana_address_t& address) noexcept(false) { a_address = address; updateBasic(); }
115  //
117 
118 
119  // gets
120 
121  std::string getFormatName() const { return "Address"; }
122 
123 
124  // helpers
125 
132  std::string asPrintableString() noexcept(false);
133 
134 
135  std::string asString() noexcept(false) { return a_address.asString(); }
136 
137 
138  // sets
139 
140  void decode(const char* buffer, const int size) noexcept(false);
141 
142 
143  // exports /////////////////////////////
144  using AvpData::getSize;
145  using AvpData::code;
146  //using OctetString::asPrintableString;
148  using OctetString::asString;
149  using AvpData::asHexString;
150  //using OctetString::decode;
153 };
154 
155 }
156 }
157 }
158 }
159 
160 #endif
std::string asString() const
Definition: defines.hpp:480
const iana_address_t & getIANAAddress() const
Definition: Address.hpp:107
Address()
Definition: Address.hpp:84
void setIANAAddress(const iana_address_t &address) noexcept(false)
Definition: Address.hpp:114
void fromPrintableString(const char *printableString) noexcept(false)
Definition: AvpData.hpp:224
std::string getFormatName() const
Definition: Address.hpp:121
Definition: OctetString.hpp:30
virtual ~Address()
Definition: Address.hpp:89
std::string asDataBlockString() noexcept(false)
Definition: AvpData.hpp:171
void setAbbreviatePresentation(bool abb)
Definition: Address.hpp:96
std::string asHexString() noexcept(false)
Definition: AvpData.hpp:196
Definition: app.hpp:12
virtual std::string asString() noexcept(false)
Definition: AvpData.hpp:186
std::string asString() noexcept(false)
Definition: Address.hpp:135
void code(char *buffer, int &size) noexcept(false)
Definition: AvpData.hpp:147
std::string asPrintableString() noexcept(false)
Definition: defines.hpp:440
void decode(const char *buffer, const int size) noexcept(false)
void fromHexString(const std::string &hexString) noexcept(false)
Definition: AvpData.hpp:240