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