X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter.comm%2FApplicationMessageOamModule.hpp;fp=include%2Fanna%2Fdiameter.comm%2FApplicationMessageOamModule.hpp;h=c9c5b0dedc54f6311a86a8ba6ecd5d5ca228bb5b;hb=3d71e5185fa9c93bde7363a668aecf96240ae2e9;hp=0000000000000000000000000000000000000000;hpb=5f094136b1817b5c4d14dbcc33c9819a8569cd1e;p=anna.git diff --git a/include/anna/diameter.comm/ApplicationMessageOamModule.hpp b/include/anna/diameter.comm/ApplicationMessageOamModule.hpp new file mode 100644 index 0000000..c9c5b0d --- /dev/null +++ b/include/anna/diameter.comm/ApplicationMessageOamModule.hpp @@ -0,0 +1,162 @@ +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // + + +#ifndef anna_diameter_comm_ApplicationMessageOamModule_hpp +#define anna_diameter_comm_ApplicationMessageOamModule_hpp + + +// Project +#include +#include +#include +#include + +// Standard +#include +#include + +namespace anna { + +namespace diameter { + +namespace comm { + + +/** + Special OAM module which tracks a replica for a set of counter types for each different application message managed by the + communication layer in a specific stack id. For example, if one process is managing CCR/A, RAR/A for Gx and AAR/A, RAR/A for Rx, + then two counter scopes should be registered (one for Gx, another for Rx). Each scope will store counters sets for each diameter + message. Having N counters within each scope (for example N=14), the total capacity is N/(number of counter types) different + message codes: + +
+    Scope for Gx:
+
+      Credit-Control-Request_SentOK_AsClient
+      Credit-Control-Request_SentNOK_AsClient
+      Credit-Control-Answer_SentOK_AsClient
+      Credit-Control-Answer_SentNOK_AsClient
+      Credit-Control-Request_Received_AsClient
+      Credit-Control-Answer_Received_AsClient
+      Credit-Control-Answer_UnknownReceived_AsClient
+      Credit-Control-Request_SentOK_AsServer
+      Credit-Control-Request_SentNOK_AsServer
+      Credit-Control-Answer_SentOK_AsServer
+      Credit-Control-Answer_SentNOK_AsServer
+      Credit-Control-Request_Received_AsServer
+      Credit-Control-Answer_Received_AsServer
+      Credit-Control-Answer_UnknownReceived_AsServer
+      Re-Auth-Request_SentOK_AsClient
+      Re-Auth-Request_SentNOK_AsClient
+      Re-Auth-Answer_SentOK_AsClient
+      Re-Auth-Answer_SentNOK_AsClient
+      Re-Auth-Request_Received_AsClient
+      Re-Auth-Answer_Received_AsClient
+      Re-Auth-Answer_UnknownReceived_AsClient
+      Re-Auth-Request_SentOK_AsServer
+      Re-Auth-Request_SentNOK_AsServer
+      Re-Auth-Answer_SentOK_AsServer
+      Re-Auth-Answer_SentNOK_AsServer
+      Re-Auth-Request_Received_AsServer
+      Re-Auth-Answer_Received_AsServer
+      Re-Auth-Answer_UnknownReceived_AsServer
+   
+    Scope for Rx:
+
+      AA-Request_SentOK_AsClient
+      AA-Request_SentNOK_AsClient
+      AA-Answer_SentOK_AsClient
+      AA-Answer_SentNOK_AsClient
+      AA-Request_Received_AsClient
+      AA-Answer_Received_AsClient
+      AA-Answer_UnknownReceived_AsClient
+      AA-Request_SentOK_AsServer
+      AA-Request_SentNOK_AsServer
+      AA-Answer_SentOK_AsServer
+      AA-Answer_SentNOK_AsServer
+      AA-Request_Received_AsServer
+      AA-Answer_Received_AsServer
+      AA-Answer_UnknownReceived_AsServer
+      Re-Auth-Request_SentOK_AsClient
+      Re-Auth-Request_SentNOK_AsClient
+      Re-Auth-Answer_SentOK_AsClient
+      Re-Auth-Answer_SentNOK_AsClient
+      Re-Auth-Request_Received_AsClient
+      Re-Auth-Answer_Received_AsClient
+      Re-Auth-Answer_UnknownReceived_AsClient
+      Re-Auth-Request_SentOK_AsServer
+      Re-Auth-Request_SentNOK_AsServer
+      Re-Auth-Answer_SentOK_AsServer
+      Re-Auth-Answer_SentNOK_AsServer
+      Re-Auth-Request_Received_AsServer
+      Re-Auth-Answer_Received_AsServer
+      Re-Auth-Answer_UnknownReceived_AsServer
+  
+*/ +class ApplicationMessageOamModule : public anna::oam::Module, public anna::Singleton { + + std::map a_messageMap; + std::map a_stackMap; + + int a_counter_types; + + anna::Mutex a_mutex; // counter scope switch + +public: + + struct Counter { + enum _v + { + None = -1, + + Request_SentOK_AsClient, + Request_SentNOK_AsClient, + Answer_SentOK_AsClient, + Answer_SentNOK_AsClient, + Request_Received_AsClient, + Answer_Received_AsClient, + Answer_UnknownReceived_AsClient, + + Request_SentOK_AsServer, + Request_SentNOK_AsServer, + Answer_SentOK_AsServer, + Answer_SentNOK_AsServer, + Request_Received_AsServer, + Answer_Received_AsServer, + Answer_UnknownReceived_AsServer + }; + + anna_declare_enum(Counter); + }; + + /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const throw() { return Counter::asCString((Counter::_v)counterType); } + + // map stack id with a scope id + void createStackCounterScope(int /* scope id */, unsigned int /* stack id */) throw(anna::RuntimeException); + + // translate message code into offset and invoke parent class count method. The message applicationId will be used as stack id + void count (int messageCode, unsigned int stackId, const int & type, const int & amount = 1) throw(anna::RuntimeException); + + // Number of different counter types for each message + int getCounterTypes() const throw() { return a_counter_types; } + +private: + + // private constructor + ApplicationMessageOamModule() : anna::oam::Module("Application Message Comm OAM Events") { a_counter_types = Counter::calculateSize(); } + + + friend class anna::Singleton ; +}; + +} +} +} + +#endif +