Remove dynamic exceptions
[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       // retransmissions
110       RequestRetransmitted,
111       RequestRetransmittedOnClientSession,
112       RequestRetransmittedOnServerSession,
113
114       // unknown received answers
115       AnswerReceivedUnknown,
116       AnswerReceivedOnClientSessionUnknown,
117       AnswerReceivedOnServerSessionUnknown,
118
119       /* Capabilities Exchange */
120       // clients
121       CERSentOK,
122       CERSentNOK,
123       CEAReceived,
124       // servers
125       CERReceived,
126       CEASentOK,
127       CEASentNOK,
128
129       /* Diameter Keepalive */
130       // clients
131       DWRSentOK,
132       DWRSentNOK,
133       DWAReceived,
134       // servers
135       DWRReceived,
136       DWASentOK,
137       DWASentNOK,
138
139       /* Peer disconnection */
140       // clients
141       DPRSentOK,
142       DPRSentNOK,
143       DPAReceived,
144       // servers
145       DPRReceived,
146       DPASentOK,
147       DPASentNOK,
148
149       /* server socket operations (enable/disable listening port for any local server) */
150       ServerSocketsOpened,
151       ServerSocketsClosed,
152
153       /* Connectivity */
154       // clients
155       UnableToDeliverOverEntity,
156       LostAvailabilityOverClientSession,
157       RecoveredAvailabilityOverClientSession,
158       LostAvailabilityOverServer,
159       RecoveredAvailabilityOverServer,
160       LostAvailabilityOverEntity,
161       RecoveredAvailabilityOverEntity,
162       LostAvailabilityOverEngineForEntities,
163       RecoveredAvailabilityOverEngineForEntities,
164       // servers
165       UnableToDeliverToClient,
166       LostConnectionForServerSession,
167       UnbindConnectionForServerSessionDueToInactivityTimeAnomaly,
168       CreatedConnectionForServerSession,
169       LostAvailabilityOverLocalServer,
170       RecoveredAvailabilityOverLocalServer,
171       LostAvailabilityOverEngineForLocalServers,
172       RecoveredAvailabilityOverEngineForLocalServers
173     };
174
175     anna_declare_enum(Counter);
176   };
177
178   /* virtual */std::string getDefaultInternalAlarmDescription(const int & alarmType) const { return Alarm::asCString((Alarm::_v)alarmType); }
179   /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const { return Counter::asCString((Counter::_v)counterType); }
180
181
182 private:
183
184   // private constructor
185   OamModule() : anna::oam::Module("diameter::comm oam module") {};
186
187
188   friend class anna::Singleton <OamModule>;
189 };
190
191 }
192 }
193 }
194
195 #endif
196