Allow to log statistics samples as a event operation
[anna.git] / source / diameter.comm / Entity.cpp
index 25a879c..23b8a31 100644 (file)
@@ -90,10 +90,11 @@ int Entity::readSocketId(const Message* message, int maxClientSessions) const th
       anna::diameter::helpers::base::functions::decodeSessionId(sid, diameterIdentity, high, low /* context-teid */, optional);
       return (low % maxClientSessions);
     }
-    //case anna::diameter::helpers::dcca::ChargingContext::SMS:
-    //case anna::diameter::helpers::dcca::ChargingContext::MMS:
-    //default:
-    //   return -1; // IEC model and Unknown traffic types
+    case anna::diameter::helpers::dcca::ChargingContext::SMS:
+    case anna::diameter::helpers::dcca::ChargingContext::MMS:
+    case anna::diameter::helpers::dcca::ChargingContext::Unknown:
+    default:
+       return -1; // IEC model and Unknown traffic types
     }
   } catch(anna::RuntimeException &ex) {
     LOGDEBUG(
@@ -323,19 +324,24 @@ void Entity::eventPeerShutdown(const ClientSession* clientSession) throw() {
 void Entity::eventRequestRetransmission(const ClientSession* clientSession, Message *request) throw() {
   LOGWARNING(
     std::string msg(clientSession->asString());
-    msg += " | eventRequestRetransmission";
+
+    HopByHop hopByHop = codec::functions::getHopByHop(request->getBody()); // context identification
+    int retries = request->getRetries();
+
+    msg += anna::functions::asString(" | eventRequestRetransmission: request with application HopByHop: %u; remaining %d retries", hopByHop, retries);
     anna::Logger::warning(msg, ANNA_FILE_LOCATION);
   );
 }
 
 std::string Entity::asString() const throw() {
   std::string result("diameter::comm::Entity { ");
-  std::string realm = a_engine->getRealm();
+  std::string originRealm = a_engine->getOriginRealm();
+  std::string originHost = a_engine->getOriginHost();
 
-  if(realm != "") {
-    result += "Parent Engine (realm): ";
-    result += realm;
-  }
+  result += "Parent Engine Origin-Realm: ";
+  result += (originRealm != "") ? originRealm:"<not configured>";
+  result += " | Parent Engine Origin-Host: ";
+  result += (originHost != "") ? originHost:"<not configured>";
 
   result += " | Category: ";
   result += anna::functions::asString(a_category);
@@ -372,9 +378,11 @@ std::string Entity::asString() const throw() {
 
 anna::xml::Node* Entity::asXML(anna::xml::Node* parent) const throw() {
   anna::xml::Node* result = parent->createChild("diameter.Entity");
-  std::string realm = a_engine->getRealm();
+  std::string originRealm = a_engine->getOriginRealm();
+  std::string originHost = a_engine->getOriginHost();
 
-  if(realm != "") result->createAttribute("ParentEngineRealm", realm);
+  if(originRealm != "") result->createAttribute("ParentEngineOriginRealm", originRealm);
+  if(originHost != "") result->createAttribute("ParentEngineOriginHost", originHost);
 
   result->createAttribute("Category", anna::functions::asString(a_category));