Remove dynamic exceptions
[anna.git] / include / anna / diameter / app / base / 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_base_Message_hpp
10 #define anna_diameter_app_base_Message_hpp
11
12
13 // Local
14 #include <anna/diameter/codec/Message.hpp>
15 #include <anna/diameter/app/defines.hpp>
16
17 // AVPID's
18 #include <anna/diameter/helpers/base/defines.hpp>
19 #include <anna/diameter/helpers/radius/defines.hpp>
20
21 #include <anna/core/RuntimeException.hpp>
22
23
24
25 //------------------------------------------------------------------------------
26 //---------------------------------------------------------------------- #define
27 //------------------------------------------------------------------------------
28
29
30
31 namespace anna {
32
33 namespace diameter {
34
35 namespace codec {
36 using namespace basetypes;
37 }
38
39 namespace app {
40
41 namespace base {
42
43
44 /**
45 * Diameter base message
46 */
47 class Message : public anna::diameter::codec::Message {
48
49 public:
50
51   /**
52      Avp Session-Id 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 UTF8String * getSessionId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
56     ASSERT_APP_GETAVP(return getAvp(helpers::base::AVPID__Session_Id)->getUTF8String());
57   }
58
59   /**
60      Avp Destination-Host data-part pointer reference
61      @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).
62   */
63   const DiameterIdentity * getDestinationHost(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
64     ASSERT_APP_GETAVP(return getAvp(helpers::base::AVPID__Destination_Host)->getDiameterIdentity());
65   }
66
67   /**
68      Avp Destination-Realm data-part pointer reference
69      @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).
70   */
71   const DiameterIdentity * getDestinationRealm(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
72     ASSERT_APP_GETAVP(return getAvp(helpers::base::AVPID__Destination_Realm)->getDiameterIdentity());
73   }
74
75   /**
76      Avp User-Name data-part pointer reference
77      @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).
78   */
79   const UTF8String * getUserName(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
80     ASSERT_APP_GETAVP(return getAvp(helpers::radius::AVPID__User_Name)->getUTF8String());
81   }
82
83   /**
84      Avp Termination-Cause data-part pointer reference
85      @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).
86   */
87   const Enumerated * getTerminationCause(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
88     ASSERT_APP_GETAVP(return getAvp(helpers::base::AVPID__Termination_Cause)->getEnumerated());
89   }
90
91   /**
92      Avp Auth-Application-Id data-part pointer reference
93      @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).
94   */
95   const Unsigned32 * getAuthApplicationId(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
96     ASSERT_APP_GETAVP(return getAvp(helpers::base::AVPID__Auth_Application_Id)->getUnsigned32());
97   }
98
99   /**
100      Avp Event-Timestamp data-part pointer reference
101      @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).
102   */
103   const Time * getEventTimestamp(anna::Exception::Mode::_v emode = anna::Exception::Mode::Throw) noexcept(false) {
104     ASSERT_APP_GETAVP(return getAvp(helpers::radius::AVPID__Event_Timestamp)->getTime());
105   }
106 };
107
108 }
109 }
110 }
111 }
112
113 #endif