Remove dynamic exceptions
[anna.git] / include / anna / diameter / app / dcca / nokia / Message.hpp
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_app_dcca_nokia_Message_hpp
10 #define anna_diameter_app_dcca_nokia_Message_hpp
11
12
13 // Local
14 #include <anna/diameter/app/dcca/Message.hpp>
15
16 // AVPID's
17 #include <anna/diameter/helpers/nokia/defines.hpp>
18
19 #include <anna/core/RuntimeException.hpp>
20
21
22 //------------------------------------------------------------------------------
23 //---------------------------------------------------------------------- #define
24 //------------------------------------------------------------------------------
25
26
27
28 namespace anna {
29
30 namespace diameter {
31
32 namespace codec {
33 using namespace basetypes;
34 }
35
36 namespace app {
37
38 namespace dcca {
39
40 namespace nokia {
41
42
43 /**
44 * Diameter message for Nokia DCCA (diameter credit control application)
45 */
46 class Message : public anna::diameter::app::dcca::Message {
47
48 public:
49
50
51   /**
52      Avp 3GPP-PDP-Type data-part pointer reference
53      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
54   */
55   const Unsigned32 * get3GPPPDPType(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
56     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_PDP_Type)->getUnsigned32());
57   }
58
59
60   /**
61      Avp Framed-IP-Address or Framed-IPv6-Prefix data-part pointer reference, depending on 3GPP-PDP-Type value
62      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
63   */
64   const OctetString * getFramedIP(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
65     ASSERT_APP_GETAVP(
66       int pdpType = get3GPPPDPType()->getValue();
67
68       if(pdpType == helpers::tgpp::AVPVALUES__3GPP_PDP_Type::IPV4)
69       return getAvp(helpers::radius::AVPID__Framed_IP_Address)->getOctetString();
70       if(pdpType == helpers::tgpp::AVPVALUES__3GPP_PDP_Type::IPV6)
71         return getAvp(helpers::radius::AVPID__Framed_IPv6_Prefix)->getOctetString();
72         return NULL;
73       );
74   }
75
76   /**
77      Avp Called-Station-Id data-part pointer reference
78      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
79   */
80   const UTF8String * getCalledStationId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
81     ASSERT_APP_GETAVP(return getAvp(helpers::radius::AVPID__Called_Station_Id)->getUTF8String());
82   }
83
84   /**
85      Avp 3GPP-SGSN-MCC-MNC data-part pointer reference
86      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
87   */
88   const UTF8String * get3GPPSGSNMCCMNC(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
89     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_SGSN_MCC_MNC)->getUTF8String());
90   }
91
92   /**
93      Avp 3GPP-SGSN-Address data-part pointer reference
94      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
95   */
96   const OctetString * get3GPPSGSNAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
97     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_SGSN_Address)->getOctetString());
98   }
99
100   /**
101      Avp 3GPP-Charging-Characteristics data-part pointer reference
102      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
103   */
104   const UTF8String * get3GPPChargingCharacteristics(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
105     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_Charging_Characteristics)->getUTF8String());
106   }
107
108   /**
109      Avp 3GPP-CG-Address data-part pointer reference
110      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
111   */
112   const OctetString * get3GPPCGAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
113     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_CG_Address)->getOctetString());
114   }
115
116   /**
117      Avp 3GPP-Rat-Type data-part pointer reference
118      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
119   */
120   const OctetString * get3GPPRatType(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
121     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_Rat_Type)->getOctetString());
122   }
123
124   /**
125      Avp Nokia-IMS-Media-Component-Id data-part pointer reference
126      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
127   */
128   const Unsigned32 * getNokiaIMSMediaComponentId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
129     ASSERT_APP_GETAVP(return getAvp(helpers::nokia::AVPID__Nokia_IMS_Media_Component_Id)->getUnsigned32());
130   }
131
132   /**
133      Avp Time-Of-Last-Usage data-part pointer reference
134      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
135   */
136   const Time * getTimeOfLastUsage(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
137     ASSERT_APP_GETAVP(return getAvp(helpers::nokia::AVPID__Time_Of_Last_Usage)->getTime());
138   }
139
140   /**
141      Avp Time-Of-First-Usage data-part pointer reference
142      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
143   */
144   const Time * getTimeOfFirstUsage(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
145     ASSERT_APP_GETAVP(return getAvp(helpers::nokia::AVPID__Time_Of_First_Usage)->getTime());
146   }
147
148   /**
149      Avp Session-Start-Indicator data-part pointer reference
150      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
151   */
152   const OctetString * getSessionStartIndicator(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
153     ASSERT_APP_GETAVP(return getAvp(helpers::nokia::AVPID__Session_Start_Indicator)->getOctetString());
154   }
155
156   /**
157      Avp Rule-Base-Id data-part pointer reference
158      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
159   */
160   const UTF8String * getRuleBaseId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
161     ASSERT_APP_GETAVP(return getAvp(helpers::nokia::AVPID__Rule_Base_Id)->getUTF8String());
162   }
163
164   /**
165      Avp 3GPP-GGSN-Address data-part pointer reference
166      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
167   */
168   const OctetString * get3GPPGGSNAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
169     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_GGSN_Address)->getOctetString());
170   }
171
172   /**
173      Avp Nokia-Reporting-Reason data-part pointer reference
174      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
175   */
176   const Enumerated * getNOKIAReportingReason(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
177     ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::nokia::AVPID__Nokia_Reporting_Reason)->getEnumerated());
178   }
179
180   /**
181      Avp 3GPP-Charging-Id data-part pointer reference
182      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
183   */
184   const Unsigned32 * get3GPPChargingId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
185     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_Charging_Id)->getUnsigned32());
186   }
187
188   /**
189      Avp 3GPP_GPRS_Neg_QoS_Profile data-part pointer reference
190      @param emode Excepcion mode handling when avp is not found: Ignore (no action is taken but debug trace), Throw (exception launched, by default), Trace (trace warning).
191   */
192
193   const UTF8String * get3GPPGPRSNegQoSProfile(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
194     ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_GPRS_Neg_QoS_Profile)->getUTF8String());
195   }
196 };
197
198 }
199 }
200 }
201 }
202 }
203
204 #endif