New ApplicationMessageOamModule in diameter::comm, to dynamically manage application...
[anna.git] / include / anna / diameter.comm / OamModule.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_comm_OamModule_hpp
10 #define anna_diameter_comm_OamModule_hpp
11
12
13 // Project
14 #include <anna/core/Singleton.hpp>
15 #include <anna/core/define.autoenum.hpp>
16 #include <anna/core/oam/Module.hpp>
17
18 // Standard
19 #include <string>
20
21
22 namespace anna {
23
24 namespace diameter {
25
26 namespace comm {
27
28
29 class OamModule : public anna::oam::Module, public anna::Singleton <OamModule> {
30
31 public:
32
33   struct Alarm {
34
35     //////////////////////////////////////////////////////////////////////////////////////////////////////////////
36     // Transferable Alarms:    preffix = c_                                                                     //
37     // Grouped Alarms:         preffix = g_                                                                     //
38     //                         Be careful: this alarms take more than one place (better define them at the end) //
39     //////////////////////////////////////////////////////////////////////////////////////////////////////////////
40
41     enum _v {
42       // Enumerated labels represent english text and formats. Final order is not restricted to this in any language, but, is useful to
43       //  remember the names at CSL. For example, we should have CSL="primary_address,secondary_address", and then the database text
44       //  could have any composition: "Fail to deliver on secondary address '${secondary_address:%s}' after failing over primary '${primary_address:%s}'"
45
46       None = -1,
47
48       /* Connectivity */
49       // clients
50       UnableToDeliverDiameterMessageToEntityDefinedAs__s__, // 'address1:port1 address2:port2 ...'
51       UnableToDeliverDiameterMessageToEntityDefinedAsPrimary__s__AndSecondary__s__, // 'Primary Server address1:port1 and Secondary Server address2:port2'
52       RequestSentOnClientSessionExpired,
53       RequestSentOnServerSessionExpired,
54       AnswerReceivedOnClientSessionUnknown,
55       AnswerReceivedOnServerSessionUnknown,
56       c_LostAvailabilityOverClientSessionWithServer__s__,
57       c_LostAvailabilityOverClientSessionWithServer__s__ClientSessionId__d__,
58       c_LostAvailabilityOverServerDefinedAs__s__, // 'address:port'
59       c_LostAvailabilityOverEntityDefinedAs__s__, // 'address1:port1 address2:port2 ...'
60       c_LostAvailabilityOverEntityDefinedAsPrimary__s__AndSecondary__s__, // 'Primary Server address1:port1 and Secondary Server address2:port2'
61       c_LostAvailabilityOverEntitiesForEngineWithClassName__s__,
62       // servers
63       UnableToDeliverDiameterMessageToClientFromLocalServer__s__, // 'address:port'
64       LostConnectionForServerSessionAtLocalServer__s__,
65       LostConnectionForServerSessionAtLocalServer__s__ServerSessionId__d__,
66       UnbindConnectionForServerSessionAtLocalServer__s__DueToInactivityTimeAnomaly,
67       UnbindConnectionForServerSessionAtLocalServer__s__ServerSessionId__d__DueToInactivityTimeAnomaly,
68       c_LostAvailabilityOverLocalServerDefinedAs__s__, // 'address:port'
69       c_LostAvailabilityOverLocalServersForEngineWithClassName__s__
70     };
71
72     anna_declare_enum(Alarm);
73   };
74
75   struct Counter {
76     enum _v
77     // In order to simplify, the literals assigned to
78     //  enum-type counters are equivalent to spanich specification ones
79     {
80       None = -1,
81
82       /* Main */
83       // receptions
84       RequestReceived,
85       AnswerReceived,
86       RequestReceivedOnClientSession,
87       AnswerReceivedOnClientSession,
88       RequestReceivedOnServerSession,
89       AnswerReceivedOnServerSession,
90       // sendings
91       RequestSentOK,
92       RequestSentNOK,
93       AnswerSentOK,
94       AnswerSentNOK,
95       RequestSentOnClientSessionOK,
96       RequestSentOnClientSessionNOK,
97       AnswerSentOnClientSessionOK,
98       AnswerSentOnClientSessionNOK,
99       RequestSentOnServerSessionOK,
100       RequestSentOnServerSessionNOK,
101       AnswerSentOnServerSessionOK,
102       AnswerSentOnServerSessionNOK,
103
104       // expirations
105       RequestSentExpired,
106       RequestSentOnClientSessionExpired,
107       RequestSentOnServerSessionExpired,
108
109       // unknown received answers
110       AnswerReceivedUnknown,
111       AnswerReceivedOnClientSessionUnknown,
112       AnswerReceivedOnServerSessionUnknown,
113
114       /* Capabilities Exchange */
115       // clients
116       CERSentOK,
117       CERSentNOK,
118       CEAReceived,
119       // servers
120       CERReceived,
121       CEASentOK,
122       CEASentNOK,
123
124       /* Diameter Keepalive */
125       // clients
126       DWRSentOK,
127       DWRSentNOK,
128       DWAReceived,
129       // servers
130       DWRReceived,
131       DWASentOK,
132       DWASentNOK,
133
134       /* Peer disconnection */
135       // clients
136       DPRSentOK,
137       DPRSentNOK,
138       DPAReceived,
139       // servers
140       DPRReceived,
141       DPASentOK,
142       DPASentNOK,
143
144       /* server socket operations (enable/disable listening port for any local server) */
145       ServerSocketsOpened,
146       ServerSocketsClosed,
147
148       /* Connectivity */
149       // clients
150       UnableToDeliverOverEntity,
151       LostAvailabilityOverClientSession,
152       RecoveredAvailabilityOverClientSession,
153       LostAvailabilityOverServer,
154       RecoveredAvailabilityOverServer,
155       LostAvailabilityOverEntity,
156       RecoveredAvailabilityOverEntity,
157       LostAvailabilityOverEngineForEntities,
158       RecoveredAvailabilityOverEngineForEntities,
159       // servers
160       UnableToDeliverToClient,
161       LostConnectionForServerSession,
162       UnbindConnectionForServerSessionDueToInactivityTimeAnomaly,
163       CreatedConnectionForServerSession,
164       LostAvailabilityOverLocalServer,
165       RecoveredAvailabilityOverLocalServer,
166       LostAvailabilityOverEngineForLocalServers,
167       RecoveredAvailabilityOverEngineForLocalServers
168     };
169
170     anna_declare_enum(Counter);
171   };
172
173   /* virtual */std::string getDefaultInternalAlarmDescription(const int & alarmType) const throw() { return Alarm::asCString((Alarm::_v)alarmType); }
174   /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const throw() { return Counter::asCString((Counter::_v)counterType); }
175
176
177 private:
178
179   // private constructor
180   OamModule() : anna::oam::Module("diameter::comm oam module") {};
181
182
183   friend class anna::Singleton <OamModule>;
184 };
185
186 }
187 }
188 }
189
190 #endif
191