Suuports clang compiler
[anna.git] / example / diameter / launcher / main.cpp
index 89858b2..280624c 100644 (file)
@@ -1,8 +1,8 @@
-// ANNA - Anna is Not 'N' Anymore
+// ANNA - Anna is Not Nothingness Anymore
 //
 // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
 //
-// https://bitbucket.org/testillano/anna
+// http://redmine.teslayout.com/projects/anna-suite
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions
@@ -14,7 +14,7 @@
 // copyright notice, this list of conditions and the following disclaimer
 // in the documentation and/or other materials provided with the
 // distribution.
-//     * Neither the name of Google Inc. nor the names of its
+//     *  Neither the name of the copyright holder nor the names of its
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
 //          cisco.tierra@gmail.com
 
 
-/*
-   Establece un manejador externo para controlar el teclado, recoge los parametros de la operacion
-   por este y envia la peticion al servidor.
-*/
-#include <iostream>
 #include <fstream>
+#include <iostream>
+#include <time.h>
+#include <sys/stat.h> // chmod
+#include <fcntl.h> // open / write
 
 #include <string>
 #include <map>
@@ -57,6 +56,7 @@
 #include <anna/http/functions.hpp>
 #include <anna/comm/functions.hpp>
 #include <anna/timex/Engine.hpp>
+#include <anna/timex/Clock.hpp>
 #include <anna/diameter/stack/Engine.hpp>
 #include <anna/diameter/codec/Engine.hpp>
 #include <anna/diameter.comm/OamModule.hpp>
@@ -86,6 +86,7 @@ namespace diameter {
 namespace comm {
 class Entity;
 class Response;
+class LocalServer;
 }
 }
 }
@@ -98,8 +99,7 @@ class Response;
 anna::diameter::comm::Message G_commMsgSent2c, G_commMsgSent2e, G_commMsgFwd2c, G_commMsgFwd2e;
 anna::diameter::comm::Message G_commMsg;
 anna::diameter::codec::Message G_codecMsg, G_codecAnsMsg;
-anna::Recycler<anna::diameter::comm::Message> G_commMessages; // create en el forward de requets sin answer programada
-// realease en el forward de answers
+anna::Recycler<anna::diameter::comm::Message> G_commMessages; // create on requests forwards without programmed answer / release in answers forward
 
 
 // Auxiliary resources for answers programming
@@ -110,6 +110,102 @@ reacting_answers_container G_reactingAnswers2C, G_reactingAnswers2E;
 
 
 
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// COUNTERS RECORD PROCEDURE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+class MyCounterRecorderClock : public anna::timex::Clock {
+  public:
+  MyCounterRecorderClock(const char *clockName, const anna::Millisecond & timeout) :
+    anna::timex::Clock(clockName, timeout) {;}
+  //virtual ~MyCounterRecorderClock();
+
+  virtual bool tick() throw (RuntimeException) {
+    anna::diameter::comm::OamModule::instantiate().recordCounters();
+    anna::diameter::codec::OamModule::instantiate().recordCounters(); 
+    return true;
+  }
+};
+
+class MyCounterRecorder : public anna::oam::CounterRecorder {
+
+  // attributes
+  int a_stream;
+  std::string a_fileNamePrefix;
+  std::string a_fileName;
+  time_t a_previousTime;
+  std::string a_fixedLine;
+
+  // pure virtual definitions:
+  void open() throw(anna::RuntimeException) {
+    static char str [256];
+   
+    const time_t now = ::time (NULL);
+    struct tm tmNow;
+    struct tm tmPrevious;
+   
+    anna_memcpy (&tmNow, localtime (&now), sizeof (tmNow));
+    anna_memcpy (&tmPrevious, localtime (&a_previousTime), sizeof (tmPrevious));
+
+    sprintf (
+      str,".Date%04d%02d%02d.Time%02d%02d%02d",
+      1900 + (tmNow.tm_year), (tmNow.tm_mon) + 1,
+      tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec);
+
+    a_fileName = a_fileNamePrefix;
+    a_fileName += str;
+
+    LOGDEBUG (
+      std::string msg ("Flush counters | ");
+      msg += a_fileName;
+      anna::Logger::debug(msg, ANNA_FILE_LOCATION);
+    );   
+
+    if ((a_stream = ::open (a_fileName.c_str (), O_WRONLY | O_CREAT, S_IWUSR)) == -1)
+      throw RuntimeException (anna::functions::asString("Error opening file '%s'; errno = %d", a_fileName.c_str(), errno), ANNA_FILE_LOCATION);
+      
+    sprintf (str, "%04d-%02d-%02d %02d:%02d|%04d-%02d-%02d %02d:%02d",
+      1900 + (tmPrevious.tm_year), (tmPrevious.tm_mon) + 1,
+      tmPrevious.tm_mday, tmPrevious.tm_hour, tmPrevious.tm_min,
+      1900 + (tmNow.tm_year), (tmNow.tm_mon) + 1,
+      tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min
+    );         
+   
+    a_fixedLine = str;
+  }
+
+
+  void apply(const anna::oam::Counter& counter) throw(anna::RuntimeException) {
+    static char line [356];
+    anna::oam::Counter::type_t value = counter;
+    sprintf (line, "%s|%06d|%07u|%s\n", a_fixedLine.c_str (), counter.getReference(), value, counter.getName ().c_str ());
+    if (write (a_stream, line, anna_strlen (line)) == -1)
+      throw RuntimeException (anna::functions::asString("Error writting to file '%s'; errno = %d", a_fileName.c_str(), errno), ANNA_FILE_LOCATION);
+  }
+
+  void close() throw() {
+    if (a_stream != -1) {
+      ::close (a_stream);
+      a_stream = -1;
+     }
+     chmod (a_fileName.c_str (), S_IWUSR | S_IRUSR);
+     a_previousTime = ::time (NULL);
+  }
+
+  std::string asString() const throw() {
+    std::string result = "Physical counters dump at file '";
+    result += a_fileName;
+    result += "'. Another way to see counters: context dump (kill -10 <pid>";
+    return result;
+  }
+
+  public:
+    MyCounterRecorder(const std::string &fnp) : a_stream(-1), a_fileNamePrefix(fnp) {
+      a_previousTime = ::time (NULL);
+    }
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
 class MyDiameterEntity : public anna::diameter::comm::Entity {
 
    void eventResponse(const anna::diameter::comm::Response&) throw(anna::RuntimeException);
@@ -186,17 +282,6 @@ private:
    void eventBreakConnection(Server* server) throw();
 };
 
-
-class MyCounterRecorder : public anna::oam::CounterRecorder {
-
-   // pure virtual definitions:
-   void open() throw(anna::RuntimeException) {;}
-   void apply(const anna::oam::Counter& counter) throw(anna::RuntimeException) {;}
-   void close() throw() {;}
-   std::string asString() const throw() { return "Physical dump not implemented: see memory accumulations writting context (kill -10 <pid>)"; }
-};
-
-
 class Launcher : public anna::comm::Application {
 
    MyCommunicator *a_communicator;
@@ -208,6 +293,7 @@ class Launcher : public anna::comm::Application {
    anna::time::Date a_start_time;
    anna::timex::Engine* a_timeEngine;
    MyCounterRecorder *a_counterRecorder;
+   MyCounterRecorderClock *a_counterRecorderClock;
    std::string a_cerPathfile;
    std::string a_dwrPathfile;
 
@@ -251,6 +337,9 @@ public:
    std::string programmedAnswers2e() const throw();
    std::string programmedAnswers2c() const throw();
 
+   // helpers
+   bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();
+
    // Burst feature
    int clearBurst() throw(); // returns removed
    int loadBurstMessage(const anna::DataBlock & db) throw(anna::RuntimeException);
@@ -266,6 +355,23 @@ public:
    std::string gotoBurst(int order) throw();
 };
 
+bool Launcher::getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw() {
+
+  // Get hex string
+  static char buffer[2048];
+  std::ifstream infile(pathfile.c_str(), std::ifstream::in);
+  if(infile.is_open()) {
+    infile >> buffer;
+    std::string hexString(buffer, strlen(buffer));
+    anna::functions::fromHexString(hexString, db);
+    // Close file
+    infile.close();
+    return true;
+  }
+
+  return false;
+}
+
 int Launcher::clearBurst() throw() {
    int size = a_burstMessages.size();
 
@@ -346,7 +452,7 @@ int Launcher::pushBurst(int loadAmount) throw() {
    }
 
    a_burstActive = true;
-   register int count;
+   int count;
 
    for (count = 0; count < loadAmount; count++)
       if (!sendBurstMessage()) break;
@@ -370,7 +476,7 @@ int Launcher::sendBurst(int loadAmount) throw() {
       return -2;
    }
 
-   register int count;
+   int count;
 
    for (count = 0; count < loadAmount; count++)
       if (!sendBurstMessage(true /* anyway */)) break;
@@ -411,7 +517,7 @@ bool Launcher::sendBurstMessage(bool anyway) throw() {
          if (a_burstRepeat) {
             a_burstCycle++;
 
-            if (burstLogEnabled()) writeBurstLogFile(anna::functions::asString(("\nCompleted burst cycle. Starting again (repeat mode) on cycle %d.\n", a_burstCycle)));
+            if (burstLogEnabled()) writeBurstLogFile(anna::functions::asString("\nCompleted burst cycle. Starting again (repeat mode) on cycle %d.\n", a_burstCycle));
          } else {
             if (burstLogEnabled()) writeBurstLogFile("\nCompleted burst cycle. Burst finished (repeat mode disabled).\n");
 
@@ -542,12 +648,24 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) {
 std::string Launcher::help() const throw() {
    std::string result = "\n";
    result += "\n                     ------------- HELP -------------\n";
+   result += "\n";
+   result += "\nOVERVIEW";
+   result += "\n--------";
+   result += "\n";
    result += "\nThe ADL (ANNA Diameter Launcher) process is a complete diameter agent with client and server";
-   result += "\ncapabilities as well as balancer (proxy) features. It could be used as diameter server";
-   result += "\n(i.e. to simulate PCRF nodes, OCS systems, etc.), as diameter client (GGSNs, DPIs, etc.)";
-   result += "\nand balancer systems to provide failover to external round-robin launchers). Also, auxiliary";
-   result += "\nencoder/decoder/loader function could be deployed to reinterpret certain external flow and";
-   result += "\nsend it to another process.";
+   result += "\n capabilities as well as balancer (proxy) features. It could be used as diameter server";
+   result += "\n (i.e. to simulate PCRF nodes, OCS systems, etc.), as diameter client (GGSNs, DPIs, etc.),";
+   result += "\n and balancer systems to provide failover to external round-robin launchers. Also, auxiliary";
+   result += "\n encoder/decoder/loader function could be deployed to reinterpret certain external flow and";
+   result += "\n send it to another process.";
+   result += "\n";
+   result += "\nThe ANNA::diameter_comm built-in module provides a great set of characteristics as multiple connections";
+   result += "\n on both server and client side, definition for multiple-server entities (and not only two as standard";
+   result += "\n establish as minimum), separate statistics analyzer per each resource, automatic CER/CEA and DWR/DWA";
+   result += "\n generation, expiration control and many more features.";
+   result += "\n";
+   result += "\nProcess traces are dump on \"launcher.traces\" and could have any trace level (POSIX levels), usually";
+   result += "\n 'debug' or 'warning'. See ANNA documentation for more details.";
    result += "\n";
    result += "\nAs any other ANNA process, context dump could be retrieved sending SIGUSR1 signal:";
    result += "\n   kill -10 <pid>";
@@ -557,93 +675,118 @@ std::string Launcher::help() const throw() {
    result += "\n   vi /var/tmp/anna.context.<pid>";
    result += "\n";
    result += "\nA complete xml report will show all the context information (counters, alarms, statistics,";
-   result += "\nhandlers, diameter dictionary, etc.), and a powerful log module could dump all the events";
-   result += "\nprocessed and flow information. Statistics could be analized at context dump and optionally";
-   result += "\nwritten to disk as sample files with all the events measurements.";
+   result += "\n handlers, diameter dictionary, etc.), and a powerful log module could dump all the events";
+   result += "\n processed and flow information. Statistics could be analized at context dump and optionally";
+   result += "\n written to disk as sample files (useful for graphs and spreadsheet reports) with all the";
+   result += "\n measurements.";
    result += "\n";
-   result += "\nAlso SIGUSR2 is handled as an alternative to http operation interface.";
-   result += "\nWe will talk later about this management interface.";
+   result += "\nAlso SIGUSR2 is handled for management purposes. We will talk later about this.";
    result += "\n";
-   result += "\nProcess traces are dump on \"launcher.traces\" and could have any trace level (POSIX levels):";
-   result += "\nusually 'debug' or 'warning'. See ANNA documentation.";
    result += "\n";
-   result += "\nThe ANNA::diameter_comm built-in module provide a great set of characteristics as multiple connections";
-   result += "\non both server and client side, definition for multiple-server entities (and not only two as standard";
-   result += "\nestablish as minimum), separate statistics analyzer per each resource, automatic CER/CEA and DWR/DWA";
-   result += "\ngeneration, expiration control and many more features";
+   result += "\nCOMMAND LINE";
+   result += "\n------------";
    result += "\n";
-   result += "\nOPERATIONS INTERFACE";
+   result += "\nStart the launcher process without arguments in order to see all the startup configuration";
+   result += "\n posibilities, many of which could be modified on the air through the management interface";
+   result += "\n (we will talk later about this great feature). Some of the more common parameters are:";
    result += "\n";
-   result += "\nADL supports several operations via HTTP interface. The HTTP request body content will";
-   result += "\nbe an string with a command:";
+   result += "\nAs mandatory, the stack definition given through the xml dictionary:";
+   result += "\n   -dictionary <path to dictionary file>";
    result += "\n";
-   result += "\nFor example, we could launch an operation via curl:";
+   result += "\nActing as a diameter server (accepting i.e. 10 connections), you would have:";
+   result += "\n   -diameterServer localhost:3868 -diameterServerSessions 10 -entityServerSessions 0";
    result += "\n";
-   result += "\n   curl -m 1 --data \"diameterServerSessions|4\" localhost:9000";
-   result += "\n   curl -m 1 --data \"code|ccr.xml\" localhost:9000";
-   result += "\n   curl -m 1 --data \"decode|ccr.hex\" localhost:9000";
-   result += "\n   curl -m 1 --data \"sendxml2e|ccr.xml\" localhost:9000";
-   result += "\n   etc.";
+   result += "\nActing as a diameter client (launching i.e. 10 connections to each entity server), you would have:";
+   result += "\n   -entity 192.168.12.11:3868,192.168.12.21:3868 -entityServerSessions 10 -diameterServerSessions 0";
+   result += "\n";
+   result += "\nIf you act as a proxy or a translation agent, you need to combine both former setups, and probably";
+   result += "\n will need to program the answers to be replied through the operations interface. To balance the";
+   result += "\n traffic at your client side you shall use '-balance' and '-sessionBasedModelsClientSocketSelection'";
+   result += "\n arguments in order to define the balancing behaviour.";
    result += "\n";
-   result += "\nThese are the available commands:";
+   result += "\nThe process builds automatically CER and DWR messages as a client, but you could specify your own";
+   result += "\n customized ones using '-cer <xml message file>' and '-dwr <xml message file>'.";
+   result += "\nThe process builds automatically CEA and DWA messages as a server, but you could program your own";
+   result += "\n customized ones using operations interface.";
    result += "\n";
    result += "\n";
-   result += "\nGeneral -----------------------------";
+   result += "\nDYNAMIC OPERATIONS";
+   result += "\n------------------";
+   result += "\n";
+   result += "\nADL supports several operations which could be reconized via HTTP interface or SIGUSR2 caugh.";
+   result += "\nAn operation is specified by mean a string containing the operation name and needed arguments";
+   result += "\n separated by pipes. These are the available commands:";
+   result += "\n";
+   result += "\n--------------------------------------------------------------------------------------- General purpose";
    result += "\n";
    result += "\nhelp                                 This help. Startup information-level traces also dump this help.";
    result += "\n";
-   result += "\nParsing operations ------------------";
+   result += "\n------------------------------------------------------------------------------------ Parsing operations";
    result += "\n";
    result += "\ncode|<source_file>|<target_file>     Encodes source file (pathfile) into target file (pathfile).";
    result += "\ndecode|<source_file>|<target_file>   Decodes source file (pathfile) into target file (pathfile).";
    result += "\nloadxml|<source_file>                Reinterpret xml source file (pathfile).";
    result += "\n";
-   result += "\nHot changes -------------------------";
+   result += "\n------------------------------------------------------------------------------------------- Hot changes";
    result += "\n";
-   result += "\ndiameterServerSessions|<integer>     Updates the maximum number of accepted connections to diameter server socket.";
-   result += "\ncollect                              Reset statistics and counters to start a new test stage of performance measurement.";
-   result += "\n                                     Context data is written at '/var/tmp/anna.context.<pid>' by mean 'kill -10 <pid>'.";
+   result += "\ndiameterServerSessions|<integer>     Updates the maximum number of accepted connections to diameter";
+   result += "\n                                      server socket.";
+   result += "\ncollect                              Reset statistics and counters to start a new test stage of";
+   result += "\n                                      performance measurement. Context data is written at";
+   result += "\n                                      '/var/tmp/anna.context.<pid>' by mean 'kill -10 <pid>'.";
    result += "\n";
    result += "\n<visibility action>|[<address>:<port>]|[socket id]";
    result += "\n";
-   result += "\n                                     Actions: hide, show (update state) and hidden, shown (query state).";
-   result += "\n                                     Acts over a client session for messages delivery (except CER/A, DWR/A, DPR/A).";
-   result += "\n                                     If missing server (first parameter) all applications sockets will be affected.";
-   result += "\n                                     If missing socket (second parameter) for specific server, all its sockets will be affected.";
+   result += "\n       Actions: hide, show (update state) and hidden, shown (query state).";
+   result += "\n       Acts over a client session for messages delivery (except CER/A, DWR/A, DPR/A).";
+   result += "\n       If missing server (first parameter) all applications sockets will be affected.";
+   result += "\n       If missing socket (second parameter) for specific server, all its sockets will be affected.";
+   result += "\n";
+   result += "\n       All application client sessions are shown on startup, but standard delivery only use primary";
+   result += "\n        server ones except if fails. Balance configuration use all the allowed sockets. You could also";
+   result += "\n        use command line 'sessionBasedModelsClientSocketSelection' to force traffic flow over certain";
+   result += "\n        client sessions, but for this, hide/show feature seems easier.";
    result += "\n";
-   result += "\n     All application client sessions are shown on startup, but standard delivery only use primary server ones except if fails.";
-   result += "\n     Balance configuration use all the allowed sockets. You could also use command line 'sessionBasedModelsClientSocketSelection'";
-   result += "\n     to force traffic flow over certain client sessions, but for this, hide/show feature seems easier.";
+   result += "\n--------------------------------------------------------------------------------------- Flow operations";
    result += "\n";
-   result += "\nFlow operations ---------------------";
+   result += "\nsendxml2e|<source_file>    Sends xml source file (pathfile) through configured entity.";
+   result += "\nsendxml2c|<source_file>    Sends xml source file (pathfile) to client.";
+   result += "\nsendxml|<source_file>      Same as 'sendxml2e'.";
+   result += "\nanswerxml2e|[source_file]  Answer xml source file (pathfile) for corresponding request from entity.";
+   result += "\nanswerxml2c|[source_file]  Answer xml source file (pathfile) for corresponding request from client.";
+   result += "\nanswerxml|[source_file]    Same as 'answerxml2c'.";
+   result += "\n                           List programmed answers if no parameter provided.";
    result += "\n";
-   result += "\nsendxml2e|<source_file>              Sends xml source file (pathfile) through configured diameter entity.";
-   result += "\nsendxml2c|<source_file>              Sends xml source file (pathfile) to diameter client.";
-   result += "\nsendxml|<source_file>                Same as 'sendxml2e'.";
-   result += "\nanswerxml2e|[source_file]            Answer xml source file (pathfile) for corresponding request from diameter entity.";
-   result += "\nanswerxml2c|[source_file]            Answer xml source file (pathfile) for corresponding request from diameter client.";
-   result += "\nanswerxml|[source_file]              Same as 'answerxml2c'.";
-   result += "\n                                     List programmed answers if no parameter provided.";
+   result += "\nSend operations are available using hexadecimal content (hex formatted files) which also allow to test";
+   result += "\nspecial scenarios (protocol errors):";
    result += "\n";
-   result += "\nIf a request is received, answer map (built with 'answerxml<[2c] or 2e>' operations) will be checked to find";
-   result += "\na corresponding programmed answer to be replied(*). If no ocurrence is found, or answer message was received,";
-   result += "\nthe message is forwarded to the other side (entity or client), or nothing but trace when no peer at that side";
-   result += "\nis configured. Answer to client have sense when diameter server socket is configured, answer to entity have";
-   result += "\nsense when entity does.";
+   result += "\nsendhex2e|<source_file>    Sends hex source file (pathfile) through configured entity.";
+   result += "\nsendhex2c|<source_file>    Sends hex source file (pathfile) to client.";
+   result += "\nsendhex|<source_file>      Same as 'sendhex2e'.";
    result += "\n";
-   result += "\n(*) sequence values (hop-by-hop and end-to-end), Session-Id and Subscription-Id avps, are mirrored to the";
-   result += "\n    peer which sent the request. If user wants to test a specific answer without changing it, use sendxml";
-   result += "\n    operations better than programming.";
+   result += "\nAnswer programming in hexadecimal is not really neccessary (you could use send primitives) and also";
+   result += "\nis intended to be used with decoded messages in order to replace things like hop by hop, end to end,";
+   result += "\nsubscriber id, session id, etc.";
    result += "\n";
-   result += "\nBalance ('-balance' command line parameter) could be used to forward server socket receptions through entity servers";
-   result += "\nby mean a round-robin algorithm. Both diameter server socket and entity targets should have been configured, that is";
-   result += "\nto say: launcher acts as client and server. If no balance is used, an standard delivery is performed: first primary";
-   result += "\nentity server, secondary when fails, etc.";
+   result += "\nIf a request is received, answer map (built with 'answerxml<[2c] or 2e>' operations) will be";
+   result += "\n checked to find a corresponding programmed answer to be replied(*). If no ocurrence is found,";
+   result += "\n or answer message was received, the message is forwarded to the other side (entity or client),";
+   result += "\n or nothing but trace when no peer at that side is configured. Answer to client have sense when";
+   result += "\n diameter server socket is configured, answer to entity have sense when entity does.";
    result += "\n";
-   result += "\nProcessing types --------------------";
+   result += "\n(*) sequence values (hop-by-hop and end-to-end), Session-Id and Subscription-Id avps, are mirrored";
+   result += "\n    to the peer which sent the request. If user wants to test a specific answer without changing it,";
+   result += "\n    use sendxml/sendhex operations better than programming.";
    result += "\n";
-   result += "\nUsed as log file extensions (when '-splitLog' is provided on command line) and context preffixes on log details when";
-   result += "\nunique log file is dumped:";
+   result += "\nBalance ('-balance' command line parameter) could be used to forward server socket receptions through";
+   result += "\n entity servers by mean a round-robin algorithm. Both diameter server socket and entity targets should";
+   result += "\n have been configured, that is to say: launcher acts as client and server. If no balance is used, an";
+   result += "\n standard delivery is performed: first primary entity server, secondary when fails, etc.";
+   result += "\n";
+   result += "\n--------------------------------------------------------------------------- Processing types (log tags)";
+   result += "\n";
+   result += "\nUsed as log file extensions (when '-splitLog' is provided on command line) and context preffixes on log";
+   result += "\n details when unique log file is dumped:";
    result += "\n";
    result += "\n   [sent2e/send2eError]   Send to entity (success/error)";
    result += "\n   [sent2c/send2cError]   Send to client (success/error)";
@@ -653,36 +796,61 @@ std::string Launcher::help() const throw() {
    result += "\n   [recvfe]               Reception from entity";
    result += "\n   [req2c-expired]        A request sent to client has been expired";
    result += "\n   [req2e-expired]        A request sent to entity has been expired";
-   result += "\n   [recvfc-ans-unknown]   Reception from client of an unknown answer (probably former [req2c-expired] has been logged)";
-   result += "\n   [recvfe-ans-unknown]   Reception from entity of an unknown answer (probably former [req2e-expired] has been logged)";
+   result += "\n   [recvfc-ans-unknown]   Reception from client of an unknown answer (probably former [req2c-expired]";
+   result += "\n                           has been logged)";
+   result += "\n   [recvfe-ans-unknown]   Reception from entity of an unknown answer (probably former [req2e-expired]";
+   result += "\n                           has been logged)";
+   result += "\n";
+   result += "\n-------------------------------------------------------------------------------------------- Load tests";
+   result += "\n";
+   result += "\nburst|<action>|[parameter]     Used for performance testing, we first program diameter requests";
+   result += "\n                                messages in order to launch them from client side to the configured";
+   result += "\n                                diameter entity. We could start the burst with an initial load";
+   result += "\n                                (non-asynchronous sending), after this, a new request will be sent";
+   result += "\n                                per answer received or expired context. There are 10 actions: clear,";
+   result += "\n                                load, start, push, pop, stop, repeat, send, goto and look.";
+   result += "\n";
+   result += "\n   burst|clear                 Clears all loaded burst messages.";
+   result += "\n   burst|load|<source_file>    Loads the next diameter message into launcher burst.";
+   result += "\n   burst|start|<initial load>  Starts (or restarts if already in progress) the message sending with";
+   result += "\n                                a certain initial load.";
+   result += "\n   burst|push|<load amount>    Sends specific non-aynchronous load.";
+   result += "\n   burst|pop|<release amount>  Skip send burst messages in order to reduce over-the-air requests.";
+   result += "\n                               Popping all OTA requests implies burst stop because no more answer";
+   result += "\n                                will arrive to the process. Burst output file (-burstLog command";
+   result += "\n                                line parameter) shows popped messages with crosses (x). Each cross";
+   result += "\n                                represents one received answer for which no new request is sent.";
+   result += "\n   burst|stop                  Stops the burst cycle. You can resume pushing 1 load amount.";
+   result += "\n   burst|repeat|[[yes]|no]     Restarts the burst launch when finish. If initial load or push load";
+   result += "\n                                amount is greater than burst list size, they will be limited when";
+   result += "\n                                the list is processed except when repeat mode is enabled.";
+   result += "\n   burst|send|<amount>         Sends messages from burst list. The main difference with start/push";
+   result += "\n                                operations is that burst won't be awaken. Externally we could control";
+   result += "\n                                sending time (no request will be sent for answers).";
+   result += "\n   burst|goto|<order>          Updates current burst pointer position.";
+   result += "\n   burst|look|<order>          Show programmed burst message for order provided.";
    result += "\n";
-   result += "\nLoad tests --------------------------";
    result += "\n";
-   result += "\nburst|<action>|[parameter]           Used for performance testing, we first program diameter requests messages in order";
-   result += "\n                                     to launch them from client side to the configured diameter entity. We could start";
-   result += "\n                                     the burst with an initial load (non-asynchronous sending), after this, a new request";
-   result += "\n                                     will be sent per answer received or expired context. There are 10 actions: clear, load";
-   result += "\n                                     start, push, pop, stop, repeat, send, goto and look.";
+   result += "\nUSING OPERATIONS INTERFACE";
+   result += "\n--------------------------";
    result += "\n";
-   result += "\n   burst|clear                       clears all loaded burst messages.";
-   result += "\n   burst|load|<source_file>          loads the next diameter message into launcher burst.";
-   result += "\n   burst|start|<initial load>        starts (or restarts if already in progress) the message sending with a certain initial load.";
-   result += "\n   burst|push|<load amount>          sends specific non-aynchronous load.";
-   result += "\n   burst|pop|<release amount>        skip send burst messages in order to reduce over-the-air requests. Popping all OTA requests";
-   result += "\n                                     implies burst stop because no more answer will arrive to the process. Burst output file";
-   result += "\n                                     (-burstLog command line parameter) shows popped messages with crosses (x). Each cross";
-   result += "\n                                     represents one received answer for which no new request is sent.";
-   result += "\n   burst|stop                        stops the burst cycle. You can resume pushing 1 load amount.";
-   result += "\n   burst|repeat|[[yes]|no]           restarts the burst launch when finish. If initial load or push load amount is";
-   result += "\n                                     greater than burst list size, they will be limited when the list is processed";
-   result += "\n                                     except when repeat mode is enabled.";
-   result += "\n   burst|send|<amount>               send messages from burst list. The main difference with start/push operations is that burst";
-   result += "\n                                     won't be awaken. Externally we could control sending time (no request will be sent for answers).";
-   result += "\n   burst|goto|<order>                Updates current burst pointer position.";
-   result += "\n   burst|look|<order>                Show programmed burst message for order provided.";
+   result += "\n------------------------------------------------------------------------- Operations via HTTP interface";
    result += "\n";
+   result += "\nAll the operations described above can be used through the optional HTTP interface. You only have";
+   result += "\n to define the http server at the command line with something like: '-httpServer localhost:9000'.";
+   result += "\nTo send the task, we shall build the http request body with the operation string. Some examples";
+   result += "\n using curl client could be:";
    result += "\n";
-   result += "\nAnother way to execute operations is to create a task file and send SIGUSR2 signal to interpret it:";
+   result += "\n   curl -m 1 --data \"diameterServerSessions|4\" localhost:9000";
+   result += "\n   curl -m 1 --data \"code|ccr.xml\" localhost:9000";
+   result += "\n   curl -m 1 --data \"decode|ccr.hex\" localhost:9000";
+   result += "\n   curl -m 1 --data \"sendxml2e|ccr.xml\" localhost:9000";
+   result += "\n   etc.";
+   result += "\n";
+   result += "\n------------------------------------------------------------------------- Operations via SIGUSR2 signal";
+   result += "\n";
+   result += "\nThe alternative using SIGUSR2 signal requires the creation of the task(s) file which will be read at";
+   result += "\n signal event:";
    result += "\n   echo \"<<operation>\" > "; result += SIGUSR2_TASKS_INPUT_FILENAME;
    result += "\n    then";
    result += "\n   kill -12 <pid>";
@@ -692,7 +860,9 @@ std::string Launcher::help() const throw() {
    result += "\n   cat "; result += SIGUSR2_TASKS_OUTPUT_FILENAME;
    result += "\n";
    result += "\nYou could place more than one line (task) in the input file. Output reports will be appended in that";
-   result += "\n case over the output file.";
+   result += "\n case over the output file. Take into account that all the content of the task file will be executed";
+   result += "\n sinchronously by the process. If you are planning traffic load, better use the asynchronous http";
+   result += "\n interface.";
    result += "\n";
    result += "\n";
 
@@ -810,6 +980,8 @@ int main(int argc, const char** argv) {
       commandLine.add("detailedLog", anna::CommandLine::Argument::Optional, "Insert detailed information at log files. Should be disabled on automatic tests. Useful on '-balance' mode to know messages flow along the sockets", false);
       commandLine.add("logStatisticSamples", anna::CommandLine::Argument::Optional, "Log statistics samples for the provided concept id list, over './sample.<concept id>.csv' files. For example: \"1,2\" will log concepts 1 and 2. Reserved word \"all\" activates all registered statistics concept identifiers. That ids are shown at context dump (see help to get it).");
       commandLine.add("burstLog", anna::CommandLine::Argument::Optional, "Burst operations log file. By default 'launcher.burst'. Empty string or \"null\" name, to disable. Warning: there is no rotation for log files (use logrotate or whatever). Output: dot (.) for each burst message sent/pushed, cross (x) for popped ones, and order number when multiple of 1% of burst list size, plus OTA requests when changed.");
+      commandLine.add("cntDir", anna::CommandLine::Argument::Optional, "Counters directory. By default is the current execution directory. Warning: a counter file will be dump per record period; take care about the possible accumulation of files");
+      commandLine.add("cntRecordPeriod", anna::CommandLine::Argument::Optional, "Counters record procedure period in milliseconds. If missing, default value of 300000 (5 minutes) will be assigned. Value of 0 disables the record procedure.");
       // Communications
       commandLine.add("httpServer", anna::CommandLine::Argument::Optional, "HTTP Management interface address (using i.e. curl tool) in '<address>:<port>' format. For example: 10.20.30.40:8080");
       commandLine.add("httpServerShared", anna::CommandLine::Argument::Optional, "Enables shared bind for HTTP Management interface address. It would be useful i.e. to allow a great amount of curl operations per second", false);
@@ -856,6 +1028,7 @@ Launcher::Launcher() : anna::comm::Application("launcher", "DiameterLauncher", "
    a_detailedLog = false;
    a_timeEngine = NULL;
    a_counterRecorder = NULL;
+   a_counterRecorderClock = NULL;
    a_entity = NULL;
    a_diameterLocalServer = NULL;
    a_cerPathfile = "cer.xml";
@@ -1032,7 +1205,7 @@ void Launcher::writeLogFile(const anna::diameter::codec::Message & decodedMessag
 
    if (a_detailedLog) {
       anna::time::Date now;
-      now.setCurrent();
+      now.setNow();
       title += " ";
       title += now.asString();
       log += anna::functions::highlight(title, anna::functions::TextHighlightMode::OverAndUnderline);
@@ -1066,7 +1239,7 @@ void Launcher::writeBurstLogFile(const std::string &buffer) throw() {
 void Launcher::checkTimeMeasure(const char * commandLineParameter, bool optional) throw(anna::RuntimeException) {
    CommandLine& cl(anna::CommandLine::instantiate());
 
-   if (!cl.exists(commandLineParameter) && optional) return; // si fuese obligatorio daria error de arranque.
+   if (!cl.exists(commandLineParameter) && optional) return; // start error if mandatory
 
    std::string parameter = cl.getValue(commandLineParameter);
 
@@ -1129,7 +1302,18 @@ throw(anna::RuntimeException) {
 //      workMode = anna::comm::Communicator::WorkMode::Clone;
    a_communicator = new MyCommunicator(workMode);
    a_timeEngine = new anna::timex::Engine((anna::Millisecond)300000, (anna::Millisecond)150);
-   a_counterRecorder = new MyCounterRecorder();
+
+  // Counters record procedure:
+  anna::Millisecond cntRecordPeriod = (anna::Millisecond)300000; // ms
+  if (cl.exists("cntRecordPeriod")) cntRecordPeriod = cl.getIntegerValue("cntRecordPeriod");
+  if (cntRecordPeriod != 0) {
+    checkTimeMeasure("cntRecordPeriod");
+    a_counterRecorderClock = new MyCounterRecorderClock("Counters record procedure clock", cntRecordPeriod); // clock
+
+    std::string cntDir = ".";
+    if (cl.exists("cntDir")) cntDir = cl.getValue("cntDir");
+    a_counterRecorder = new MyCounterRecorder(cntDir + anna::functions::asString("/Counters.Pid%d", (int)getPid()));
+  }
 }
 
 void Launcher::run()
@@ -1137,7 +1321,7 @@ throw(anna::RuntimeException) {
    LOGMETHOD(anna::TraceMethod tm("Launcher", "run", ANNA_FILE_LOCATION));
    CommandLine& cl(anna::CommandLine::instantiate());
    // Start time:
-   a_start_time.setCurrent();
+   a_start_time.setNow();
    // Statistics:
    anna::statistics::Engine::instantiate().enable();
    ///////////////////////////////
@@ -1147,6 +1331,7 @@ throw(anna::RuntimeException) {
    oamDiameterComm.initializeCounterScope(1);  // 1000 - 1999
    anna::diameter::codec::OamModule & oamDiameterCodec = anna::diameter::codec::OamModule::instantiate();
    oamDiameterCodec.initializeCounterScope(2);  // 2000 - 2999
+
    /////////////////
    // COMM MODULE //
    /////////////////
@@ -1244,10 +1429,15 @@ throw(anna::RuntimeException) {
    oamDiameterCodec.registerCounter(anna::diameter::codec::OamModule::Counter::LevelValidation__FailedRuleForCardinalityMoreThanNeeded,                 "", 17 /*2017*/);
    oamDiameterCodec.registerCounter(anna::diameter::codec::OamModule::Counter::LevelValidation__FailedGenericAvpRuleForCardinalityFoundDisregardedItem, "", 18 /*2018*/);
    oamDiameterCodec.registerCounter(anna::diameter::codec::OamModule::Counter::LevelValidation__FoundDisregardedItemsAndGenericAVPWasNotSpecified,      "", 19 /*2019*/);
-   anna::oam::CounterManager& cm = anna::oam::CounterManager::instantiate();
-   cm.setEngine(a_timeEngine);
-   cm.setRecordPeriod(Millisecond(300000));
-   cm.setCounterRecorder(static_cast<anna::oam::CounterRecorder*>(a_counterRecorder));
+
+   /////////////////////////////////
+   // Counter recorder associated //
+   /////////////////////////////////
+   if (a_counterRecorderClock) {
+     oamDiameterComm.setCounterRecorder(a_counterRecorder);
+     oamDiameterCodec.setCounterRecorder(a_counterRecorder);
+     a_timeEngine->activate(a_counterRecorderClock); // start clock
+   }
 
    // Checking command line parameters
    if (cl.exists("sessionBasedModelsClientSocketSelection")) {
@@ -1486,10 +1676,16 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
    LOGDEBUG(anna::Logger::debug(operation, ANNA_FILE_LOCATION));
    response_content = "Operation processed with exception. See traces\n"; // supposed
    std::string result = "";
+   anna::DataBlock db_aux(true);
+
+   ///////////////////////////////////////////////////////////////////
+   // Simple operations without arguments:
 
    // Help:
    if (operation == "help") {
-      std::cout << help() << std::endl;
+      std::string s_help = help();
+      std::cout << s_help << std::endl;
+      LOGINFORMATION(anna::Logger::information(s_help, ANNA_FILE_LOCATION));
       response_content = "Help dumped on stdout and information-level traces (launcher.traces file)\n";
       return;
    }
@@ -1501,61 +1697,69 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       response_content = "All process counters & statistic information have been reset\n";
       return;
    }
+   ///////////////////////////////////////////////////////////////////
 
    // Tokenize operation
    Tokenizer params;
    params.apply(operation, "|");
    int numParams = params.size() - 1;
-   //LOGDEBUG(anna::Logger::debug(anna::functions::asString("Number of operation parameters: %d", numParams), ANNA_FILE_LOCATION));
 
+   // No operation has more than 2 arguments ...
    if (numParams > 2) {
       LOGWARNING(anna::Logger::warning(help(), ANNA_FILE_LOCATION));
       throw anna::RuntimeException("Wrong body content format on HTTP Request", ANNA_FILE_LOCATION);
    }
 
+   // Get the operation type:
    Tokenizer::const_iterator tok_iter = params.begin();
    std::string opType = Tokenizer::data(tok_iter);
-   std::string param1, param2;
 
-   if (numParams >= 1) { tok_iter++; param1 = Tokenizer::data(tok_iter); }
+   // Check the number of parameters:
+   bool wrongBody = false;
+   if ( ((opType == "code")||(opType == "decode")) && (numParams != 2) ) wrongBody = true;
+   if ( ((opType == "sendxml") || (opType == "sendxml2e") || (opType == "sendhex") || (opType == "sendhex2e")) && (numParams != 1) ) wrongBody = true;
+   if ( (opType == "burst") && (numParams < 1) ) wrongBody = true;
+   if ( ((opType == "sendxml2c")||(opType == "sendhex2c")||(opType == "loadxml")||(opType == "diameterServerSessions")) && (numParams != 1) ) wrongBody = true;
+   if (wrongBody) {
+     // Launch exception
+     std::string msg = "Wrong body content format on HTTP Request for '";
+     msg += opType;
+     msg += "' operation (missing parameter/s)";
+     throw anna::RuntimeException(msg, ANNA_FILE_LOCATION);
+   }
 
+   // All seems ok:
+   std::string param1, param2;
+   if (numParams >= 1) { tok_iter++; param1 = Tokenizer::data(tok_iter); }
    if (numParams == 2) { tok_iter++; param2 = Tokenizer::data(tok_iter); }
 
-   if (opType == "code") {
-      if (numParams != 2)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'code' operation (missing parameter/s)", ANNA_FILE_LOCATION);
 
+   // Operations:
+   if (opType == "code") {
       G_codecMsg.loadXML(param1);
       std::string hexString = anna::functions::asHexString(G_codecMsg.code());
       // write to outfile
       ofstream outfile(param2.c_str(), ifstream::out);
       outfile.write(hexString.c_str(), hexString.size());
       outfile.close();
-   } else if (opType == "decode") {
-      if (numParams != 2)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'decode' operation (missing parameter/s)", ANNA_FILE_LOCATION);
 
-      char buffer[2048];
-      ifstream infile(param1.c_str(), ifstream::in);
-      infile >> buffer;
-      std::string hexString(buffer, strlen(buffer));
-      anna::DataBlock db(true);
-      anna::functions::fromHexString(hexString, db);
+   } else if (opType == "decode") {
+      // Get DataBlock from file with hex content:
+      if (!getDataBlockFromHexFile(param1, db_aux))
+         throw anna::RuntimeException("Error reading hex file provided", ANNA_FILE_LOCATION);
 
       // Decode
-      try { G_codecMsg.decode(db); } catch (anna::RuntimeException &ex) { ex.trace(); }
+      try { G_codecMsg.decode(db_aux); } catch (anna::RuntimeException &ex) { ex.trace(); }
 
       std::string xmlString = G_codecMsg.asXMLString();
       // write to outfile
       ofstream outfile(param2.c_str(), ifstream::out);
       outfile.write(xmlString.c_str(), xmlString.size());
       outfile.close();
-      infile.close();
+
    } else if ((opType == "hide") || (opType == "show") || (opType == "hidden") || (opType == "shown")) {
       anna::diameter::comm::Entity *entity = getEntity();
-
       if (!entity) throw anna::RuntimeException("No entity configured to send messages", ANNA_FILE_LOCATION);
-
       if (param1 != "") {
          if (param2 != "") {
             std::string key = param1;
@@ -1563,11 +1767,8 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
             key += param2;
 
             if (opType == "hide") getMyDiameterEngine()->findClientSession(key)->hide();
-
             if (opType == "show") getMyDiameterEngine()->findClientSession(key)->show();
-
             if (opType == "hidden") result = getMyDiameterEngine()->findClientSession(key)->hidden() ? "true" : "false";
-
             if (opType == "shown") result = getMyDiameterEngine()->findClientSession(key)->shown() ? "true" : "false";
          } else {
             std::string address;
@@ -1575,35 +1776,34 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
             anna::functions::getAddressAndPortFromSocketLiteral(param1, address, port);
 
             if (opType == "hide") getMyDiameterEngine()->findServer(address, port)->hide();
-
             if (opType == "show") getMyDiameterEngine()->findServer(address, port)->show();
-
             if (opType == "hidden") result = getMyDiameterEngine()->findServer(address, port)->hidden() ? "true" : "false";
-
             if (opType == "shown") result = getMyDiameterEngine()->findServer(address, port)->shown() ? "true" : "false";
          }
       } else {
          if (opType == "hide") entity->hide();
-
          if (opType == "show") entity->show();
-
          if (opType == "hidden") result = entity->hidden() ? "true" : "false";
-
          if (opType == "shown") result = entity->shown() ? "true" : "false";
       }
-   } else if ((opType == "sendxml") || (opType == "sendxml2e")) {
-      if (numParams != 1)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'sendxml/sendxml2e' operation (missing parameter)", ANNA_FILE_LOCATION);
+   } else if ((opType == "sendxml") || (opType == "sendxml2e") || (opType == "sendhex") || (opType == "sendhex2e")) {
 
       anna::diameter::comm::Entity *entity = getEntity();
-
       if (!entity) throw anna::RuntimeException("No entity configured to send the message", ANNA_FILE_LOCATION);
 
-      G_codecMsg.loadXML(param1);
-      G_commMsgSent2e.clearBody();
-      try { G_codecMsg.valid(); } catch (anna::RuntimeException &ex) { ex.trace(); } // at least we need to see validation errors although it will continue sending (see validation mode configured in launcher)
+      if ((opType == "sendxml") || (opType == "sendxml2e")) {
+        G_codecMsg.loadXML(param1);
+        G_commMsgSent2e.clearBody();
+        try { G_codecMsg.valid(); } catch (anna::RuntimeException &ex) { ex.trace(); } // at least we need to see validation errors although it will continue sending (see validation mode configured in launcher)
+        G_commMsgSent2e.setBody(G_codecMsg.code());
+      }
+      else {
+        // Get DataBlock from file with hex content:
+        if (!getDataBlockFromHexFile(param1, db_aux))
+          throw anna::RuntimeException("Error reading hex file provided", ANNA_FILE_LOCATION);
+        G_commMsgSent2e.setBody(db_aux);
+      }
 
-      G_commMsgSent2e.setBody(G_codecMsg.code());
       bool success = entity->send(G_commMsgSent2e, cl.exists("balance"));
 
       // Detailed log:
@@ -1614,11 +1814,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
          writeLogFile(G_codecMsg, (success ? "sent2e" : "send2eError"), detail);
       }
    } else if ((opType == "burst")) {
-      if (numParams < 1)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'burst' operation (missing action parameter)", ANNA_FILE_LOCATION);
-
       anna::diameter::comm::Entity *entity = getEntity();
-
       if (!entity) throw anna::RuntimeException("No entity configured to use burst feature", ANNA_FILE_LOCATION);
 
       // burst|clear                     clears all loaded burst messages.
@@ -1720,19 +1916,24 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       } else {
          throw anna::RuntimeException("Wrong body content format on HTTP Request for 'burst' operation (unexpected action parameter). See help", ANNA_FILE_LOCATION);
       }
-   } else if (opType == "sendxml2c") {
-      if (numParams != 1)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'sendxml2c' operation (missing parameter)", ANNA_FILE_LOCATION);
 
+   } else if ((opType == "sendxml2c") || (opType == "sendhex2c")) {
       anna::diameter::comm::LocalServer *localServer = getDiameterLocalServer();
-
       if (!localServer) throw anna::RuntimeException("No local server configured to send the message", ANNA_FILE_LOCATION);
 
-      G_codecMsg.loadXML(param1);
-      G_commMsgSent2c.clearBody();
-      try { G_codecMsg.valid(); } catch (anna::RuntimeException &ex) { ex.trace(); } // at least we need to see validation errors although it will continue sending (see validation mode configured in launcher)
+      if (opType == "sendxml2c") {
+        G_codecMsg.loadXML(param1);
+        G_commMsgSent2c.clearBody();
+        try { G_codecMsg.valid(); } catch (anna::RuntimeException &ex) { ex.trace(); } // at least we need to see validation errors although it will continue sending (see validation mode configured in launcher)
+        G_commMsgSent2c.setBody(G_codecMsg.code());
+      }
+      else {
+        // Get DataBlock from file with hex content:
+        if (!getDataBlockFromHexFile(param1, db_aux))
+          throw anna::RuntimeException("Error reading hex file provided", ANNA_FILE_LOCATION);
+        G_commMsgSent2c.setBody(db_aux);
+      }
 
-      G_commMsgSent2c.setBody(G_codecMsg.code());
       bool success = localServer->send(G_commMsgSent2c);
 
       // Detailed log:
@@ -1741,16 +1942,13 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
          std::string detail = usedServerSession ? usedServerSession->asString() : "<null server session>"; // esto no deberia ocurrir
          writeLogFile(G_codecMsg, (success ? "sent2c" : "send2cError"), detail);
       }
-   } else if (opType == "loadxml") {
-      if (numParams != 1)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'loadxml' operation (missing parameter)", ANNA_FILE_LOCATION);
 
+   } else if (opType == "loadxml") {
       G_codecMsg.loadXML(param1);
       std::string xmlString = G_codecMsg.asXMLString();
       std::cout << xmlString << std::endl;
+
    } else if (opType == "diameterServerSessions") {
-      if (numParams != 1)
-         throw anna::RuntimeException("Wrong body content format on HTTP Request for 'diameterServerSessions' operation (missing parameter)", ANNA_FILE_LOCATION);
 
       int diameterServerSessions = atoi(param1.c_str());
 
@@ -1789,7 +1987,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
          response_content = "Programmed answers dumped on stdout\n";
          return;
       }
-   } else if ((opType == "answerxml2e")) {
+   } else if (opType == "answerxml2e") {
       anna::diameter::comm::Entity *entity = getEntity();
 
       if (!entity)
@@ -1853,7 +2051,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       response_content += "Result: ";
       response_content += result;
       response_content += "\n";
-   } else if ((opType == "sendxml") || (opType == "sendxml2e")) {
+   } else if ((opType == "sendxml") || (opType == "sendxml2e") || (opType == "sendhex") || (opType == "sendhex2e")) {
       response_content += "Message '";
       response_content += param1;
       response_content += "' sent to entity.";
@@ -1864,7 +2062,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       response_content += "' executed. ";
       response_content += result;
       response_content += "\n";
-   } else if (opType == "sendxml2c") {
+   } else if ((opType == "sendxml2c")||(opType == "sendhex2c")) {
       response_content += "Message '";
       response_content += param1;
       response_content += "' sent to client.";
@@ -1879,7 +2077,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       response_content += param1;
       response_content += "' programmed.";
       response_content += "\n";
-   } else if ((opType == "answerxml2e")) {
+   } else if (opType == "answerxml2e") {
       response_content += "Answer to entity '";
       response_content += param1;
       response_content += "' programmed.";