Changed LICENSE. Now referenced to web site and file on project root directory
[anna.git] / include / anna / diameter / codec / 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_codec_OamModule_hpp
10 #define anna_diameter_codec_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 codec {
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
44       None = -1,
45
46       /////////////////////////////////////////////
47       // All defined alarms are not transferable //
48       /////////////////////////////////////////////
49
50       /* Avp decoding */
51
52       AvpDecode__NotEnoughBytesToCoverAvpHeaderLength,
53       // El buffer pasado no es suficiente para construir un AVP
54       // Not enough buffer to build AVP
55
56       AvpDecode__IncoherenceBetweenActivatedVBitAndZeroedVendorIDValueReceived,
57       // Los Flags indican que el AVP es vendor-specific (bit V) y sin embargo el campo vendor-ID tiene un valor 0 (IETF)
58       // AVP Flags are vendor-specific (V bit) but vendor-ID octets value is 0 (IETF)
59
60       AvpDecode__IncorrectLength,
61       // Existe un error de formato en el AVP, la longitud es incorrecta
62       // There is an error inside the AVP, the length is not correct
63
64       AvpDecode__DataPartInconsistence,
65       // Existe un error de inconsistencia en la parte de datos
66       // There is an inconsistence error inside the AVP data part
67
68       AvpDecode__UnknownAvp__s__WithMandatoryBit,
69       // Formato desconocido del AVP %s con bit M activo
70       // Unknown format for AVP %s with activated M bit
71
72       /* Message decoding */
73
74       MessageDecode__NotEnoughBytesToCoverMessageHeaderLength,
75       // El buffer pasado no es suficiente para construir la cabecera de un mensaje DIAMETER
76       // Not enough buffer to build the DIAMETER message header
77
78       MessageDecode__NotEnoughBytesToCoverMessageLength,
79       // No se han proporcionado octetos suficientes para cubrir la longitud del mensaje DIAMETER
80       // Not enough bytes to fit DIAMETER message length
81
82
83       /* Avp validation */
84
85       AvpValidation__EnumeratedAvp__s__WithValue__d__DoesNotComplyRestriction__s__,
86       // El AVP enumerado %s con valor %d, no cumple la restriccion: %s
87       // Enumerated AVP %s with value %d does not comply to restriction: %s
88
89       AvpValidation__Avp__s__Flags__d__DoesNotFulfillTheDefinedFlagRules__s__,
90       // El AVP %s tiene flags (%d) incoherentes con las reglas de flags definidas: %s
91       // AVP %s flags (%d) does not fulfill the defined flag rules: %s
92
93
94       /* Message validation */
95
96       MessageValidation__UnknownOperation__s__UnableToValidate,
97       // Operacion %s desconocida, imposible validar
98       // Unknown operation %s, unable to validate
99
100       MessageValidation__Operation__s__HaveIncoherentFlags__d__,
101       // La operacion %s tiene flags (%d) incoherentes
102       // Operation %s have incoherent flags (%d)
103
104
105       /* Level validation */
106
107       LevelValidation__MissingFixedRule__s__Inside__s__,
108       // Falta un AVP fijo %s dentro de %s
109       // Missing fixed rule %s inside %s
110
111       LevelValidation__FailedRule__s__ForCardinality_Found__d__ItemsInside__s__,
112       // Ha fallado la regla %s de cardinalidad (encontrados %s items dentro de %s)
113       // Failed rule %s for cardinality (found %d items inside %s)
114
115       LevelValidation__FailedGenericAvpRule__s__ForCardinality_Found__d__DisregardedItemsInside__s__,
116       // Ha fallado la regla del AVP Generico %s para la cardinalidad (encontrados %d items no contemplados dentro de %s)
117       // Failed Generic AVP rule %s for cardinality (found %d disregarded items inside %s)
118
119       LevelValidation__FoundDisregardedItemsInside__s__AndGenericAVPWasNotSpecified__s__
120       // Encontrados items no contemplados dentro de %s y el AVP Generico no se especifico: %s
121       // Found disregarded items inside %s and Generic AVP was not specified: %s
122     };
123
124     anna_declare_enum(Alarm);
125   };
126
127   struct Counter {
128     enum _v
129     // In order to simplify, the literals assigned to
130     //  enum-type counters are equal to specification ones (in spanish)
131     {
132       None = -1,
133
134       /* Avp decoding */
135       AvpDecode__NotEnoughBytesToCoverAvpHeaderLength,
136       AvpDecode__IncoherenceBetweenActivatedVBitAndZeroedVendorIDValueReceived,
137       AvpDecode__IncorrectLength,
138       AvpDecode__DataPartInconsistence,
139       AvpDecode__UnknownAvpWithMandatoryBit,
140
141       /* Message decoding */
142       MessageDecode__NotEnoughBytesToCoverMessageHeaderLength,
143       MessageDecode__NotEnoughBytesToCoverMessageLength,
144
145       /* Avp validation */
146       AvpValidation__EnumeratedAvpWithValueDoesNotComplyRestriction,
147       AvpValidation__AvpFlagsDoesNotFulfillTheDefinedFlagRules,
148
149       /* Message validation */
150       MessageValidation__UnknownOperationUnableToValidate,
151       MessageValidation__OperationHaveIncoherentFlags,
152
153       /* Level validation */
154       LevelValidation__MissingFixedRule,
155       LevelValidation__FailedRuleForCardinality,
156       LevelValidation__FailedRuleForCardinalityLessThanNeeded,
157       LevelValidation__FailedRuleForCardinalityMoreThanNeeded,
158       LevelValidation__FailedGenericAvpRuleForCardinalityFoundDisregardedItem,
159       LevelValidation__FoundDisregardedItemsAndGenericAVPWasNotSpecified
160     };
161
162     anna_declare_enum(Counter);
163   };
164
165   /* virtual */std::string getDefaultInternalAlarmDescription(const int & alarmType) const throw() { return Alarm::asCString((Alarm::_v)alarmType); }
166   /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const throw() { return Counter::asCString((Counter::_v)counterType); }
167
168
169 private:
170
171   // private constructor
172   OamModule() : anna::oam::Module("diameter::codec oam module") {};
173
174
175   friend class anna::Singleton <OamModule>;
176 };
177
178 }
179 }
180 }
181
182 #endif
183