Remove dynamic exceptions
[anna.git] / include / anna / diameter / helpers / dcca / functions.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_helpers_dcca_functions_hpp
10 #define anna_diameter_helpers_dcca_functions_hpp
11
12
13 #include <anna/core/RuntimeException.hpp>
14
15 #include <anna/diameter/helpers/dcca/defines.hpp>
16
17 // STL
18 #include <string>
19
20 //------------------------------------------------------------------------------
21 //---------------------------------------------------------------------- #define
22 //------------------------------------------------------------------------------
23
24 namespace anna {
25 class DataBlock;
26 }
27
28
29
30 namespace anna {
31
32 namespace diameter {
33
34 namespace helpers {
35
36 namespace dcca {
37
38 /**
39 * Type of charging context
40 */
41 struct ChargingContext { enum _v { Unknown = -1, Data, Voice, Content, SMS, MMS }; };
42
43
44 struct ChargingContextAndDomainSuffix {
45
46   /** Charging context and domain suffic for data traffic */
47   static const char Data[];
48
49   /** Charging context and domain suffic for voice traffic */
50   static const char Voice[];
51
52   /** Charging context and domain suffic for content traffic */
53   static const char Content[];
54
55   /** Charging context and domain suffic for SMS traffic */
56   static const char SMS[];
57
58   /** Charging context and domain suffic for MMS traffic */
59   static const char MMS[];
60 };
61
62
63 struct functions {
64
65   // getters & helpers
66
67   /**
68   * Subscription-Id-Data for provided Subscription-Id-Type within a command.
69   *
70   * @param db Provided Message DataBlock
71   * @param Subscription-Id-Type value to filter the search. END_USER_E164 by default.
72   *
73   * @return Subscription-Id-Data for type provided. Empty string when not found.
74   */
75   static std::string getSubscriptionIdData(const anna::DataBlock &db,
76       int subscriptionIdType = AVPVALUES__Subscription_Id_Type::END_USER_E164) noexcept(false);
77
78
79   /**
80   * Service-Context-Id from datablock provided.
81   *
82   * @param db Provided Message DataBlock
83   * @param chargingContext Detected charging context
84   *
85   * @return Service-Context-Id
86   */
87   static std::string getServiceContextId(const anna::DataBlock &db, ChargingContext::_v &chargingContext) noexcept(false);
88
89   /**
90   * Service-Context-Id from datablock provided.
91   *
92   * @param db Provided Message DataBlock
93   *
94   * @return Service-Context-Id
95   */
96   static std::string getServiceContextId(const anna::DataBlock &db) noexcept(false) {
97     ChargingContext::_v dummy;
98     return getServiceContextId(db, dummy);
99   }
100 };
101
102
103 }
104 }
105 }
106 }
107
108
109 #endif
110