App counters including message name and result code if proceed
[anna.git] / include / anna / diameter.comm / ApplicationMessageOamModule.hpp
index c9c5b0d..d8f6fa6 100644 (file)
@@ -29,10 +29,10 @@ 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:
+  communication layer and result code in case of answer, 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 event (message and optionally result code description). Having N counters within
+  each scope (for example N=14), the total capacity is N/(number of counter types) different events:
 
   <pre>
     Scope for Gx:
@@ -96,11 +96,15 @@ namespace comm {
       Re-Auth-Request_Received_AsServer
       Re-Auth-Answer_Received_AsServer
       Re-Auth-Answer_UnknownReceived_AsServer
+
+    Note: all other combinations including the result code for answers
+          may be dynamically created.
+
   </pre> 
 */
 class ApplicationMessageOamModule : public anna::oam::Module, public anna::Singleton <ApplicationMessageOamModule> {
 
-  std::map<int /* message code */, int /* base offset */> a_messageMap;
+  std::map<std::string /* event id */, int /* base offset */> a_eventMap;
   std::map<unsigned int /* stack id */, int /* scope id */> a_stackMap;
 
   int a_counter_types;
@@ -140,11 +144,17 @@ public:
   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);
+  // resultCode shall be -1 for non-answers
+  void count (int messageCode, int resultCode, 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; }
 
+  // -1 if multistack 
+  int monoStackScopeId() const throw() {
+    return ((a_stackMap.size() != 1) ? -1 : a_stackMap.begin()->second);
+  }
+
 private:
 
   // private constructor