First commit
[anna.git] / include / anna / diameter / app / dcca / huawei / Message.hpp
1 // ANNA - Anna is Not 'N' Anymore
2 //
3 // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
4 //
5 // https://bitbucket.org/testillano/anna
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
9 // are met:
10 //
11 //     * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 //     * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 //     * Neither the name of Google Inc. nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
33 // Authors: eduardo.ramos.testillano@gmail.com
34 //          cisco.tierra@gmail.com
35
36
37 #ifndef anna_diameter_app_dcca_huawei_Message_hpp
38 #define anna_diameter_app_dcca_huawei_Message_hpp
39
40
41 // Local
42 #include <anna/diameter/app/dcca/Message.hpp>
43
44 // AVPID's
45 #include <anna/diameter/helpers/huawei/defines.hpp>
46
47 #include <anna/core/RuntimeException.hpp>
48
49
50 //------------------------------------------------------------------------------
51 //---------------------------------------------------------------------- #define
52 //------------------------------------------------------------------------------
53
54
55
56 namespace anna {
57
58 namespace diameter {
59
60 namespace codec {
61 using namespace basetypes;
62 }
63
64 namespace app {
65
66 namespace dcca {
67
68 namespace huawei {
69
70
71 /**
72 * Diameter message for Nokia DCCA (diameter credit control application)
73 */
74 class Message : public anna::diameter::app::dcca::Message {
75
76 public:
77
78   /**
79      Avp PS-Information pointer reference
80      @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).
81   */
82   const anna::diameter::codec::Avp * getPSInformation(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
83     ASSERT_APP_GETAVP(
84       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
85                getAvp(helpers::tgpp::AVPID__PS_Information);
86     );
87   }
88
89   /**
90      Avp Called-Station-Id data-part pointer reference
91      @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).
92   */
93   const UTF8String * getCalledStationId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
94     ASSERT_APP_GETAVP(
95       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
96                getAvp(helpers::tgpp::AVPID__PS_Information)->
97                getAvp(helpers::radius::AVPID__Called_Station_Id)->getUTF8String();
98     );
99   }
100
101   /**
102      Avp 3GPP-PDP-Type data-part pointer reference
103      @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).
104   */
105   const Unsigned32 * get3GPPPDPType(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
106     ASSERT_APP_GETAVP(
107       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
108                getAvp(helpers::tgpp::AVPID__PS_Information)->
109                getAvp(helpers::tgpp::AVPID__3GPP_PDP_Type)->getUnsigned32();
110     );
111   }
112
113   /**
114      Avp 3GPP-SGSN-MCC-MNC data-part pointer reference
115      @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).
116   */
117   const UTF8String * get3GPPSGSNMCCMNC(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
118     ASSERT_APP_GETAVP(
119       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
120                getAvp(helpers::tgpp::AVPID__PS_Information)->
121                getAvp(helpers::tgpp::AVPID__3GPP_SGSN_MCC_MNC)->getUTF8String();
122     );
123   }
124
125   /**
126      Avp 3GPP-Charging-Characteristics data-part pointer reference
127      @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).
128   */
129   const UTF8String * get3GPPChargingCharacteristics(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
130     ASSERT_APP_GETAVP(
131       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
132                getAvp(helpers::tgpp::AVPID__PS_Information)->
133                getAvp(helpers::tgpp::AVPID__3GPP_Charging_Characteristics)->getUTF8String();
134     );
135   }
136
137   /**
138      Avp 3GPP-GPRS-Neg-QoS-Profile data-part pointer reference
139      @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).
140   */
141   const UTF8String * get3GPPGPRSNegQoSProfile(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
142     ASSERT_APP_GETAVP(
143       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
144                getAvp(helpers::tgpp::AVPID__PS_Information)->
145                getAvp(helpers::tgpp::AVPID__3GPP_GPRS_Neg_QoS_Profile)->getUTF8String();
146     );
147   }
148
149   /**
150      Avp CG-Address data-part pointer reference
151      @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).
152   */
153   const Address * getCGAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
154     ASSERT_APP_GETAVP(
155       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
156                getAvp(helpers::tgpp::AVPID__PS_Information)->
157                getAvp(helpers::tgpp::AVPID__CG_Address)->getAddress();
158     );
159   }
160
161   /**
162      Avp 3GPP-Rat-Type data-part pointer reference
163      @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).
164   */
165   const OctetString * get3GPPRatType(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
166     ASSERT_APP_GETAVP(
167       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
168                getAvp(helpers::tgpp::AVPID__PS_Information)->
169                getAvp(helpers::tgpp::AVPID__3GPP_Rat_Type)->getOctetString();
170     );
171   }
172
173   /**
174      Avp SGSN-Address data-part pointer reference
175      @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).
176   */
177   const Address * getSGSNAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
178     ASSERT_APP_GETAVP(
179       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
180                getAvp(helpers::tgpp::AVPID__PS_Information)->
181                getAvp(helpers::tgpp::AVPID__SGSN_Address)->getAddress();
182     );
183   }
184
185   /**
186      Avp GGSN-Address data-part pointer reference
187      @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).
188   */
189   const Address * getGGSNAddress(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
190     ASSERT_APP_GETAVP(
191       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
192                getAvp(helpers::tgpp::AVPID__PS_Information)->
193                getAvp(helpers::tgpp::AVPID__GGSN_Address)->getAddress();
194     );
195   }
196
197   /**
198      Avp 3GPP-Charging-Id data-part pointer reference
199      @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).
200   */
201   const Unsigned32 * get3GPPChargingId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
202     ASSERT_APP_GETAVP(
203       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
204                getAvp(helpers::tgpp::AVPID__PS_Information)->
205                getAvp(helpers::tgpp::AVPID__3GPP_Charging_Id)->getUnsigned32();
206     );
207   }
208
209   /**
210      Avp Reporting-Reason data-part pointer reference
211      @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).
212   */
213   const Enumerated * getReportingReason(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
214     ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::tgpp::AVPID__Reporting_Reason)->getEnumerated());
215   }
216
217   /**
218      Avp Trigger-Type data-part pointer reference
219      @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).
220   */
221   const Enumerated * getTriggerType(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
222     ASSERT_APP_GETAVP(
223       return   getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
224                getAvp(helpers::tgpp::AVPID__Trigger)->
225                getAvp(helpers::tgpp::AVPID__Trigger_Type)->getEnumerated();
226     );
227   }
228
229   /**
230      Avp PS-Furnish-Charging-Information pointer reference
231      @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).
232   */
233   const anna::diameter::codec::Avp * getPSFurnishChargingInformation(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
234     ASSERT_APP_GETAVP(
235       return   getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
236                getAvp(helpers::tgpp::AVPID__PS_Furnish_Charging_Information);
237     );
238   }
239
240   /**
241      Avp PS-Free-Format-Data data-part pointer reference
242      @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).
243   */
244   const OctetString * getPSFreeFormatData(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
245     ASSERT_APP_GETAVP(
246       return   getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
247                getAvp(helpers::tgpp::AVPID__PS_Furnish_Charging_Information)->
248                getAvp(helpers::tgpp::AVPID__PS_Free_Format_Data)->getOctetString();
249     );
250   }
251
252   /**
253      Avp PS-Append-Free-Format-Data data-part pointer reference
254      @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).
255   */
256   const Enumerated * getPSAppendFreeFormatData(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
257     ASSERT_APP_GETAVP(
258       return   getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
259                getAvp(helpers::tgpp::AVPID__PS_Furnish_Charging_Information)->
260                getAvp(helpers::tgpp::AVPID__PS_Append_Free_Format_Data)->getEnumerated();
261     );
262   }
263
264   /**
265      Avp n-th PDP-Address pointer reference
266      @param ocurrence Select the n-th PDP-Address within the PS-Information. First by default.
267      @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).
268   */
269   const Address * getPDPAddress(int ocurrence = 1, anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) throw(anna::RuntimeException) {
270     ASSERT_APP_GETAVP(
271       return   getAvp(helpers::tgpp::AVPID__Service_Information)->
272                getAvp(helpers::tgpp::AVPID__PS_Information)->
273                getAvp(helpers::tgpp::AVPID__PDP_Address)->getAddress();
274     );
275   }
276 };
277
278 }
279 }
280 }
281 }
282 }
283
284 #endif