ANNA Suite  2020b
Multipurpose development suite for Telco applications
Message.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_app_dcca_Message_hpp
10 #define anna_diameter_app_dcca_Message_hpp
11 
12 
13 // Local
15 
16 // AVPID's
20 
22 
23 // STL
24 #include <string>
25 
26 
27 //------------------------------------------------------------------------------
28 //---------------------------------------------------------------------- #define
29 //------------------------------------------------------------------------------
30 
31 
32 
33 namespace anna {
34 
35 namespace diameter {
36 
37 namespace codec {
38 using namespace basetypes;
39 }
40 
41 namespace app {
42 
43 namespace dcca {
44 
45 
46 
47 typedef struct {
48 
49  std::string qosProfile;
50  int Release;
55 
56 
57  void reset() {
58  qosProfile = "";
59  Release = TrafficClass = HandlingPriority = MaximumBitrateForUplink = MaximumBitrateForDownlink = 0;
60  }
61 
62 } qosProfile_t;
63 
64 
65 
66 
71 
72  qosProfile_t a_qosProfile;
73 
74 public:
75 
82  const UTF8String * getSubscriptionIdData(int subscriptionIdType = helpers::dcca::AVPVALUES__Subscription_Id_Type::END_USER_E164, anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
84  const anna::diameter::codec::Avp * sid;
85  int pos = 1;
86 
87  while((sid = getAvp(helpers::dcca::AVPID__Subscription_Id, pos++)))
88  if(subscriptionIdType == sid->getAvp(helpers::dcca::AVPID__Subscription_Id_Type)->getEnumerated()->getValue())
89  return sid->getAvp(helpers::dcca::AVPID__Subscription_Id_Data)->getUTF8String();
90  return NULL;
91  );
92  }
93 
99  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control));
100  }
101 
107  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::dcca::AVPID__Service_Identifier)->getUnsigned32());
108  }
109 
115  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::dcca::AVPID__Rating_Group)->getUnsigned32());
116  }
117 
124  return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
125  getAvp(helpers::dcca::AVPID__Used_Service_Unit)->
126  getAvp(helpers::dcca::AVPID__Tariff_Change_Usage)->getEnumerated();
127  );
128  }
129 
135  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::dcca::AVPID__Validity_Time)->getUnsigned32());
136  }
137 
143  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->getAvp(helpers::dcca::AVPID__Requested_Service_Unit));
144  }
145 
153  return getAvp(helpers::dcca::AVPID__Multiple_Services_Credit_Control)->
154  getAvp(helpers::dcca::AVPID__Used_Service_Unit, ocurrence);
155  );
156  }
157 
163  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__CC_Request_Type)->getEnumerated());
164  }
165 
171  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__CC_Request_Number)->getUnsigned32());
172  }
173 
179  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Multiple_Services_Indicator)->getEnumerated());
180  }
181 
187  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__Service_Context_Id)->getUTF8String());
188  }
189 
195  ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_NSAPI)->getUTF8String());
196  }
197 
203  ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_Selection_Mode)->getUTF8String());
204  }
205 
211  ASSERT_APP_GETAVP(return getAvp(helpers::tgpp::AVPID__3GPP_Session_Stop_Indicator)->getOctetString());
212  }
213 
219  ASSERT_APP_GETAVP(return getAvp(helpers::dcca::AVPID__User_Equipment_Info));
220  }
221 
228  const OctetString * getUserEquipmentInfoValue(int userEquipmentInfoType = helpers::dcca::AVPVALUES__User_Equipment_Info_Type::IMEISV, anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
230  const anna::diameter::codec::Avp * uei;
231  int pos = 1;
232 
233  while((uei = getAvp(helpers::dcca::AVPID__User_Equipment_Info, pos++)))
234  if(userEquipmentInfoType == uei->getAvp(helpers::dcca::AVPID__User_Equipment_Info_Type)->getEnumerated()->getValue())
235  return uei->getAvp(helpers::dcca::AVPID__User_Equipment_Info_Value)->getOctetString();
236  return NULL;
237  );
238  }
239 
240  // there has to be at least one out-of-line definition of a non-pure-virtual function (http://www.daniweb.com/software-development/cpp/threads/114299/undefined-reference-to-vtable-for-)
241  // Lo que dice es que las virtuales no puras de una clase deben tener al menos una definicion en el .cc (lo contrario de in-line). Parece una limitación del compilador.
242  // Podemos hacer una definicion por defecto (return NULL), o mejor, hacerla virtual pura (porque se necesitara por parte del decodificador de QoS):
243  virtual const UTF8String * get3GPPGPRSNegQoSProfile(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) = 0;
244 
245 
251  const qosProfile_t & decode3GPPGPRSNegQoSProfile() noexcept(false);
252 
253 
254 
255 // static bool dameTiempoConsumido(const InfoDIAMETER & mensaje,long &tiempoConsumidoAntesConmutacion,long &tiempoConsumidoDespuesConmutacion,long &tiempoConsumidoSinConmutacion);
256 // static bool dameTiempoConsumido(const InfoDIAMETER & mensaje,long &tiempoConsumidoAntesConmutacion,long &tiempoConsumidoDespuesConmutacion,long &tiempoConsumidoSinConmutacion,bool &hayUSUantes, bool &hayUSUdespues);
257 //
258 // // nos devuelve el volumen que viene en el mensaje diameter (antes, despues de la conmutacion y el valor cuando no ha habido conmutacion)
259 // // Le pasamos el tipo volumen que queremos ( ambos,downlink,uplink)
260 // // en tipoVol, se indica de que AVP leemos las unidades ( Input_Octets, Output-Octets o TotalOctets )
261 // //static void dameVolumConsumido(const InfoDIAMETER & mensaje,int tipoVol,long &volAntesConmutacion,long &volDespuesConmutacion,long &volConsumidoSinConmutacion);
262 // // Devuelve FALSE si ha habido algun error
263 // static bool dameVolumConsumido(const InfoDIAMETER & mensaje,int tipoVol,long &volUpAntesConmutacion,long &volUpDespuesConmutacion,
264 // long &volDownAntesConmutacion,long &volDownDespuesConmutacion,long &volUp,long &volDown,bool &errorTariffChange);
265 // static bool dameVolumConsumido(const InfoDIAMETER & mensaje,int tipoVol,long &volUpAntesConmutacion,long &volUpDespuesConmutacion,
266 // long &volDownAntesConmutacion,long &volDownDespuesConmutacion,long &volUp,long &volDown,bool &errorTariffChange,
267 // bool &hayUSUantes, bool &hayUSUdespues);
268 //
269 //
270 // bool getConsumedTime(int &beforeSwitch, int &afterSwitch, int &withoutSwitch) const ;
271 // bool getConsumedVolume(int volumeType, int &upBeforeSwitch, int &upAfterSwitch, int &downBeforeSwitch, int &downAfterSwitch, int &upWithoutSwitch, int &downWithoutSwitch, bool &tariffChangeError) const ;
272 //
273 
274 
275 
276 
277 
278 };
279 
280 }
281 }
282 }
283 }
284 
285 #endif
const Unsigned32 * getCCRequestNumber(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:170
const Enumerated * getMultipleServicesIndicator(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:178
Definition: Exception.hpp:26
std::string qosProfile
Definition: Message.hpp:49
const anna::diameter::codec::Avp * getRequestedServiceUnit(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:142
const UTF8String * get3GPPSelectionMode(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:202
OctetString * getOctetString() noexcept(false)
Definition: Avp.hpp:510
_v
Definition: Exception.hpp:26
const anna::diameter::codec::Avp * getUsedServiceUnit(int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:151
int Release
Definition: Message.hpp:50
const Unsigned32 * getServiceIdentifier(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:106
const Enumerated * getCCRequestType(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:162
const OctetString * get3GPPSessionStopIndicator(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:210
const Unsigned32 * getRatingGroup(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:114
const Enumerated * getTariffChangeUsage(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:122
const UTF8String * get3GPPNSAPI(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:194
Definition: Avp.hpp:125
Definition: OctetString.hpp:30
Definition: Message.hpp:70
const anna::diameter::codec::Avp * getUserEquipmentInfo(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:218
const anna::diameter::codec::Avp * getMultipleServicesCreditControl(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:98
const UTF8String * getSubscriptionIdData(int subscriptionIdType=helpers::dcca::AVPVALUES__Subscription_Id_Type::END_USER_E164, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:82
#define ASSERT_APP_GETAVP(source)
Definition: defines.hpp:15
int TrafficClass
Definition: Message.hpp:51
const OctetString * getUserEquipmentInfoValue(int userEquipmentInfoType=helpers::dcca::AVPVALUES__User_Equipment_Info_Type::IMEISV, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:228
Definition: Message.hpp:47
Definition: app.hpp:12
Definition: Message.hpp:47
int HandlingPriority
Definition: Message.hpp:52
int MaximumBitrateForDownlink
Definition: Message.hpp:54
void reset()
Definition: Message.hpp:57
const Unsigned32 * getValidityTime(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:134
int MaximumBitrateForUplink
Definition: Message.hpp:53
UTF8String * getUTF8String() noexcept(false)
Definition: Avp.hpp:528
const UTF8String * getServiceContextId(anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:186