1 // ANNA - Anna is Not Nothingness Anymore
3 // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
5 // http://redmine.teslayout.com/projects/anna-suite
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
17 // * Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 // Authors: eduardo.ramos.testillano@gmail.com
34 // cisco.tierra@gmail.com
37 #ifndef anna_core_oam_Handler_hpp
38 #define anna_core_oam_Handler_hpp
41 #include <anna/core/RuntimeException.hpp>
46 #include <anna/core/oam/defines.hpp>
59 * Class used to manage OAM events and registration over a OAM module
66 * Event for counters generated at the module provided. Base implementation trace the event based on #Module::getDefaultCounterDescription.
68 * Any re-implementation should invoke base class method.
70 * @param module Reference OAM module.
71 * @param type Counter enum-identification within the own context/module.
72 * @param amount Units increased.
74 * @return Boolean counter data for 'type' when registered, NULL if not found
76 virtual const counter_data_t *counterEvent(const Module *module, const int & type, const int & amount) const throw();
79 * Event for alarms generated at the module provided. Base implementation trace the event based on #Module::getDefaultAlarmDescription,
80 * replacing tags '__s__' and '__d__' by '<\%s>' and '<\%d>' (for texts and numbers) if they exists, and parsing with
81 * dynamic variables passed on activateAlarm()/cancelAlarm() prototypes.
83 * Any re-implementation should invoke base class method.
85 * @param module Reference OAM module.
86 * @param textPreffix Dynamic alarm modification regarding text preffix.
87 * @param textSuffix Dynamic alarm modification regarding text suffix.
88 * @param textSeparator Dynamic alarm modification regarding text sections separator.
89 * @param Activation activation/cancellation indicator.
90 * @param type Alarm enum-identification within the own context/module.
91 * @param argList Optional parsing data for dynamic-composed text.
93 * @return Boolean alarm data for 'type' when registered, NULL if not found
95 virtual const alarm_data_t *alarmEvent(const Module *module, const char *textPreffix, const char *textSuffix, char textSeparator, bool activation, const int & type, va_list argList) const throw();
112 * Invokes module counter registration procedure.
113 * Default implementation does nothing specific
115 * @param module Reference OAM module
116 * @see #anna::oam::Module::registerCounter
118 virtual void registerCounter(Module *module, const int &type, const std::string &description, const int &offset) throw(anna::RuntimeException) {;}
121 * Invokes module alarm registration procedure.
122 * Default implementation does nothing specific
124 * @param module Reference OAM module
125 * @see #anna::oam::Module::registerAlarm
127 virtual void registerAlarm(Module *module, const int &type, const std::string &description, const int &externalId, const std::string &dynamicVariablesCSL, const int &activationId, const int &cancellationId = -1) throw(anna::RuntimeException) {;}