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