1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #ifndef anna_diameter_comm_ApplicationMessageOamModule_hpp
10 #define anna_diameter_comm_ApplicationMessageOamModule_hpp
14 #include <anna/core/mt/Mutex.hpp>
15 #include <anna/core/Singleton.hpp>
16 #include <anna/core/define.autoenum.hpp>
17 #include <anna/core/oam/Module.hpp>
31 Special OAM module which tracks a replica for a set of counter types for each different application message managed by the
32 communication layer in a specific stack id. For example, if one process is managing CCR/A, RAR/A for Gx and AAR/A, RAR/A for Rx,
33 then two counter scopes should be registered (one for Gx, another for Rx). Each scope will store counters sets for each diameter
34 message. Having N counters within each scope (for example N=14), the total capacity is N/(number of counter types) different
40 Credit-Control-Request_SentOK_AsClient
41 Credit-Control-Request_SentNOK_AsClient
42 Credit-Control-Answer_SentOK_AsClient
43 Credit-Control-Answer_SentNOK_AsClient
44 Credit-Control-Request_Received_AsClient
45 Credit-Control-Answer_Received_AsClient
46 Credit-Control-Answer_UnknownReceived_AsClient
47 Credit-Control-Request_SentOK_AsServer
48 Credit-Control-Request_SentNOK_AsServer
49 Credit-Control-Answer_SentOK_AsServer
50 Credit-Control-Answer_SentNOK_AsServer
51 Credit-Control-Request_Received_AsServer
52 Credit-Control-Answer_Received_AsServer
53 Credit-Control-Answer_UnknownReceived_AsServer
54 Re-Auth-Request_SentOK_AsClient
55 Re-Auth-Request_SentNOK_AsClient
56 Re-Auth-Answer_SentOK_AsClient
57 Re-Auth-Answer_SentNOK_AsClient
58 Re-Auth-Request_Received_AsClient
59 Re-Auth-Answer_Received_AsClient
60 Re-Auth-Answer_UnknownReceived_AsClient
61 Re-Auth-Request_SentOK_AsServer
62 Re-Auth-Request_SentNOK_AsServer
63 Re-Auth-Answer_SentOK_AsServer
64 Re-Auth-Answer_SentNOK_AsServer
65 Re-Auth-Request_Received_AsServer
66 Re-Auth-Answer_Received_AsServer
67 Re-Auth-Answer_UnknownReceived_AsServer
71 AA-Request_SentOK_AsClient
72 AA-Request_SentNOK_AsClient
73 AA-Answer_SentOK_AsClient
74 AA-Answer_SentNOK_AsClient
75 AA-Request_Received_AsClient
76 AA-Answer_Received_AsClient
77 AA-Answer_UnknownReceived_AsClient
78 AA-Request_SentOK_AsServer
79 AA-Request_SentNOK_AsServer
80 AA-Answer_SentOK_AsServer
81 AA-Answer_SentNOK_AsServer
82 AA-Request_Received_AsServer
83 AA-Answer_Received_AsServer
84 AA-Answer_UnknownReceived_AsServer
85 Re-Auth-Request_SentOK_AsClient
86 Re-Auth-Request_SentNOK_AsClient
87 Re-Auth-Answer_SentOK_AsClient
88 Re-Auth-Answer_SentNOK_AsClient
89 Re-Auth-Request_Received_AsClient
90 Re-Auth-Answer_Received_AsClient
91 Re-Auth-Answer_UnknownReceived_AsClient
92 Re-Auth-Request_SentOK_AsServer
93 Re-Auth-Request_SentNOK_AsServer
94 Re-Auth-Answer_SentOK_AsServer
95 Re-Auth-Answer_SentNOK_AsServer
96 Re-Auth-Request_Received_AsServer
97 Re-Auth-Answer_Received_AsServer
98 Re-Auth-Answer_UnknownReceived_AsServer
101 class ApplicationMessageOamModule : public anna::oam::Module, public anna::Singleton <ApplicationMessageOamModule> {
103 std::map<int /* message code */, int /* base offset */> a_messageMap;
104 std::map<unsigned int /* stack id */, int /* scope id */> a_stackMap;
108 anna::Mutex a_mutex; // counter scope switch
117 Request_SentOK_AsClient,
118 Request_SentNOK_AsClient,
119 Answer_SentOK_AsClient,
120 Answer_SentNOK_AsClient,
121 Request_Received_AsClient,
122 Answer_Received_AsClient,
123 Answer_UnknownReceived_AsClient,
125 Request_SentOK_AsServer,
126 Request_SentNOK_AsServer,
127 Answer_SentOK_AsServer,
128 Answer_SentNOK_AsServer,
129 Request_Received_AsServer,
130 Answer_Received_AsServer,
131 Answer_UnknownReceived_AsServer
134 anna_declare_enum(Counter);
137 /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const throw() { return Counter::asCString((Counter::_v)counterType); }
139 // map stack id with a scope id
140 void createStackCounterScope(int /* scope id */, unsigned int /* stack id */) throw(anna::RuntimeException);
142 // translate message code into offset and invoke parent class count method. The message applicationId will be used as stack id
143 void count (int messageCode, unsigned int stackId, const int & type, const int & amount = 1) throw(anna::RuntimeException);
145 // Number of different counter types for each message
146 int getCounterTypes() const throw() { return a_counter_types; }
150 // private constructor
151 ApplicationMessageOamModule() : anna::oam::Module("Application Message Comm OAM Events") { a_counter_types = Counter::calculateSize(); }
154 friend class anna::Singleton <ApplicationMessageOamModule>;