Multistack launcher
[anna.git] / example / diameter / launcher / Launcher.cpp
index 8804736..f5fac98 100644 (file)
@@ -12,7 +12,6 @@
 #include <anna/http/Transport.hpp>
 #include <anna/diameter/stack/Engine.hpp>
 #include <anna/diameter/helpers/base/functions.hpp>
-#include <anna/diameter/helpers/dcca/functions.hpp>
 #include <anna/time/functions.hpp>
 #include <anna/diameter.comm/ApplicationMessageOamModule.hpp>
 
 #define SIGUSR2_TASKS_OUTPUT_FILENAME "./sigusr2.tasks.output"
 #define DIAMETER_CODEC_ENGINE_NAME_PREFIX "MyCodecEngine"
 
+const char *ServicesDTD = "\
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
+<!-- Diameter services DTD -->\n\
+\n\
+<!ELEMENT services (stack*, node*)>\n\
+\n\
+<!ELEMENT stack EMPTY>\n\
+<!ATTLIST stack id CDATA #REQUIRED dictionary CDATA #REQUIRED>\n\
+<!--\n\
+   Stack record\n\
+\n\
+   id:         Normally the id corresponds to the Application-Id for which the dictionary provided is designed\n\
+   dictionary: Path to the dictionary file\n\
+-->\n\
+\n\
+<!ELEMENT node EMPTY>\n\
+<!ATTLIST node name CDATA #REQUIRED application-id CDATA #REQUIRED cer CDATA #IMPLIED dwr CDATA #IMPLIED entity CDATA #IMPLIED entityServerSessions CDATA #IMPLIED diameterServer CDATA #IMPLIED diameterServerSessions CDATA #IMPLIED balance (yes | no) #IMPLIED sessionBasedModelsClientSocketSelection (SessionIdHighPart | SessionIdOptionalPart | RoundRobin) #IMPLIED ignoreFlags (yes | no) #IMPLIED ignoreErrors (yes | no) #IMPLIED>\n\
+<!--\n\
+   Node record\n\
+\n\
+   name:                                    Each node will be named normally with the Origin-Realm value\n\
+   application-id:                          The Application-Id provided must exists as a registered 'stack id'\n\
+   cer:                                     User defined CER path file to be encoded to establish diameter connections. If missing, will be harcoded\n\
+   dwr:                                     User defined DWR path file to be encoded for diameter protocol keep alive. If missing, will be harcoded\n\
+   entity:                                  Target diameter entity (comma-separated '<address>:<port>' format). For example: 10.20.30.40:3868,10.20.30.41:3868. If missing, no entity will be enabled\n\
+   entityServerSessions:                    Diameter entity server sessions (0: diameter entity disabled). Default value of 1\n\
+   diameterServer:                          Diameter own server address in '<address>:<port>' format. For example: 10.20.30.40:3868. If missing, no local server will be enabled\n\
+   diameterServerSessions:                  Diameter own server available connections (0: diameter server disabled). Default value of 1\n\
+   balance:                                 Balance over entity servers instead of doing standard behaviour (first primary, secondary if fails, etc.). Default value 'no'\n\
+   ignoreErrors:                            Local server skips requests errors analysis which would prepare automatic answers for them when a problem is found. If no answer is programmed and entity is configured, a failed request would be forwarded (delegates at the end point) even if this parameter is missing. Default value 'no'\n\
+-->\n\
+\n\
+";
+
+
 Launcher::Launcher() : anna::comm::Application("launcher", "DiameterLauncher", "1.1"), a_communicator(NULL) {
   a_myDiameterEngine = new MyDiameterEngine();
   a_myDiameterEngine->setRealm("ADL.ericsson.com");
@@ -40,6 +74,8 @@ Launcher::Launcher() : anna::comm::Application("launcher", "DiameterLauncher", "
   a_diameterLocalServer = NULL;
   a_cerPathfile = "cer.xml";
   a_dwrPathfile = "dwr.xml";
+  a_workingStackId = 0;
+
   // Burst
   a_burstCycle = 1;
   a_burstRepeat = false;
@@ -58,16 +94,14 @@ void Launcher::releaseCommMessage(anna::diameter::comm::Message *msg) throw() {
   a_commMessages.release(msg);
 }
 
-anna::diameter::codec::Message *Launcher::createCodecMessage() throw(anna::RuntimeException) {
-  return a_codecMessages.create();
-}
+void Launcher::baseProtocolSetupAsClient() throw(anna::RuntimeException) {
 
-void Launcher::releaseCodecMessage(anna::diameter::codec::Message *msg) throw() {
-  a_codecMessages.release(msg);
-}
+  anna::diameter::codec::Engine *codecEngine;
+
+  codecEngine = getCodecEngine();
+  // XXXXXXXXXXXXXXXXXXXX codecEngine = a_myDiameterEngine->getBaseProtocolCodecEngine();
 
 
-void Launcher::baseProtocolSetupAsClient(void) throw(anna::RuntimeException) {
   // Build CER
   //   <CER> ::= < Diameter Header: 257, REQ >
   //             { Origin-Host } 264 diameterIdentity
@@ -79,7 +113,7 @@ void Launcher::baseProtocolSetupAsClient(void) throw(anna::RuntimeException) {
   //           * [ Supported-Vendor-Id ]  265 Unsigned32
   //           * [ Auth-Application-Id ] 258 Unsigned32
   //           * [Acct-Application-Id]  259 Unsigned32
-  anna::diameter::codec::Message diameterCER;
+  anna::diameter::codec::Message diameterCER(codecEngine);
   int applicationId = 0 /*anna::diameter::helpers::APPID__3GPP_Rx*/; // Unsigned32
   std::string OH = a_myDiameterEngine->getHost();
   std::string OR = a_myDiameterEngine->getRealm();
@@ -111,7 +145,7 @@ void Launcher::baseProtocolSetupAsClient(void) throw(anna::RuntimeException) {
   //   <DWR>  ::= < Diameter Header: 280, REQ >
   //              { Origin-Host }
   //              { Origin-Realm }
-  anna::diameter::codec::Message diameterDWR;
+  anna::diameter::codec::Message diameterDWR(codecEngine);
   loadingError = false;
 
   try {
@@ -129,77 +163,14 @@ void Launcher::baseProtocolSetupAsClient(void) throw(anna::RuntimeException) {
     diameterDWR.addAvp(anna::diameter::helpers::base::AVPID__Origin_Realm)->getDiameterIdentity()->setValue(OR);
   }
 
-//////////////////////////
-// IDEM FOR CEA AND DWA //
-//////////////////////////
-//            // Build CER
-//            //   <CER> ::= < Diameter Header: 257, REQ >
-//            //             { Origin-Host } 264 diameterIdentity
-//            //             { Origin-Realm } 296 idem
-//            //          1* { Host-IP-Address } 257, address
-//            //             { Vendor-Id } 266 Unsigned32
-//            //             { Product-Name } 269 UTF8String
-//            //             [Origin-State-Id] 278 Unsigned32
-//            //           * [ Supported-Vendor-Id ]  265 Unsigned32
-//            //           * [ Auth-Application-Id ] 258 Unsigned32
-//            //           * [Acct-Application-Id]  259 Unsigned32
-//            anna::diameter::codec::Message diameterCER;
-//            int applicationId = 0 /*anna::diameter::helpers::APPID__3GPP_Rx*/; // Unsigned32
-//            std::string OH = a_myDiameterEngine->getHost();
-//            std::string OR = a_myDiameterEngine->getRealm();
-//            std::string hostIP = anna::functions::getHostnameIP(); // Address
-//            int vendorId = anna::diameter::helpers::VENDORID__tgpp; // Unsigned32
-//            std::string productName = "ANNA Diameter Launcher"; // UTF8String
-//            bool loadingError = false;
-//
-//            try {
-//               diameterCER.loadXML("cer.xml");
-//            } catch (anna::RuntimeException &ex) {
-//               ex.trace();
-//               loadingError = true;
-//            }
-//
-//            if (loadingError) {
-//               LOGWARNING(anna::Logger::warning("CER file not found. Get harcoded.", ANNA_FILE_LOCATION));
-//               diameterCER.setId(anna::diameter::helpers::base::COMMANDID__Capabilities_Exchange_Request);
-//               diameterCER.setApplicationId(applicationId);
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Origin_Host)->getDiameterIdentity()->setValue(OH);
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Origin_Realm)->getDiameterIdentity()->setValue(OR);
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Host_IP_Address)->getAddress()->fromPrintableString(hostIP.c_str()); // supported by Address class, anyway is better to provide "1|<ip address>"
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Vendor_Id)->getUnsigned32()->setValue(vendorId);
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Product_Name)->getUTF8String()->setValue(productName);
-//               diameterCER.addAvp(anna::diameter::helpers::base::AVPID__Auth_Application_Id)->getUnsigned32()->setValue(applicationId);
-//            }
-//
-//            // Build DWR
-//            //   <DWR>  ::= < Diameter Header: 280, REQ >
-//            //              { Origin-Host }
-//            //              { Origin-Realm }
-//            anna::diameter::codec::Message diameterDWR;
-//            loadingError = false;
-//
-//            try {
-//               diameterDWR.loadXML("dwr.xml");
-//            } catch (anna::RuntimeException &ex) {
-//               ex.trace();
-//               loadingError = true;
-//            }
-//
-//            if (loadingError) {
-//               LOGWARNING(anna::Logger::warning("DWR file not found. Get harcoded.", ANNA_FILE_LOCATION));
-//               diameterDWR.setId(anna::diameter::helpers::base::COMMANDID__Device_Watchdog_Request);
-//               diameterDWR.setApplicationId(applicationId);
-//               diameterDWR.addAvp(anna::diameter::helpers::base::AVPID__Origin_Host)->getDiameterIdentity()->setValue(OH);
-//               diameterDWR.addAvp(anna::diameter::helpers::base::AVPID__Origin_Realm)->getDiameterIdentity()->setValue(OR);
-//            }
   // Assignment for CER/DWR and CEA/DWA:
   a_myDiameterEngine->setCERandDWR(diameterCER.code(), diameterDWR.code());
   //a_myDiameterEngine->setCEAandDWA(diameterCEA.code(), diameterDWA.code());
 }
 
-void Launcher::writeLogFile(const anna::DataBlock & db, const std::string &logExtension, const std::string &detail) const throw() {
+void Launcher::writeLogFile(const anna::DataBlock & db, const std::string &logExtension, const std::string &detail, anna::diameter::codec::Engine *codecEngine) const throw() {
 //   if (!logEnabled()) return;
-  anna::diameter::codec::Message codecMsg;
+  anna::diameter::codec::Message codecMsg(codecEngine);
   try { codecMsg.decode(db); } catch(anna::RuntimeException &ex) { ex.trace(); }
   writeLogFile(codecMsg, logExtension, detail);
 
@@ -327,7 +298,7 @@ void Launcher::startDiameterServer(int diameterServerSessions) throw(anna::Runti
   //ServerSocket *createServerSocket(const std::string & addr, int port = Session::DefaultPort, int maxConnections = -1, int category = 1, const std::string & description = "")
   a_diameterLocalServer = (MyLocalServer*)(a_myDiameterEngine->createLocalServer(address, port, diameterServerSessions));
   a_diameterLocalServer->setDescription("Launcher diameter local server");
-  a_diameterLocalServer->setProgrammedAnswersCodecEngine(getCodecEngine());
+  a_diameterLocalServer->setCodecEngine(getCodecEngine()); // this is for automatic answers (failed-avp) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX el del nodo correspondiente
   int allowedInactivityTime = 90000; // ms
 
   if(cl.exists("allowedInactivityTime")) allowedInactivityTime = cl.getIntegerValue("allowedInactivityTime");
@@ -343,7 +314,8 @@ throw(anna::RuntimeException) {
 //   if (cl.exists ("clone"))
 //      workMode = anna::comm::Communicator::WorkMode::Clone;
   a_communicator = new MyCommunicator(workMode);
-  a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, (anna::Millisecond)150);
+  //a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, anna::timex::Engine::minResolution);
+  a_timeEngine = new anna::timex::Engine((anna::Millisecond)600000, (anna::Millisecond)100); // puedo bajar hasta 10
   // Counters record procedure:
   anna::Millisecond cntRecordPeriod = (anna::Millisecond)300000; // ms
 
@@ -405,36 +377,49 @@ throw(anna::RuntimeException) {
   // Stack:
   a_codecEngine = new anna::diameter::codec::Engine(DIAMETER_CODEC_ENGINE_NAME_PREFIX);
   anna::diameter::stack::Engine &stackEngine = anna::diameter::stack::Engine::instantiate();
-  anna::diameter::stack::Dictionary * d = stackEngine.createDictionary(0 /* stack id; its value don't mind, is not used (ADL is monostack) */);
-  // Analyze comma-separated list:
-  anna::Tokenizer lst;
-  std::string dictionaryParameter = cl.getValue("dictionary");
-  lst.apply(dictionaryParameter, ",");
-
-  if(lst.size() >= 1) {  // always true (at least one, because -dictionary is mandatory)
-    anna::Tokenizer::const_iterator tok_min(lst.begin());
-    anna::Tokenizer::const_iterator tok_max(lst.end());
-    anna::Tokenizer::const_iterator tok_iter;
-    std::string pathFile;
-    d->allowUpdates();
-
-    for(tok_iter = tok_min; tok_iter != tok_max; tok_iter++) {
-      pathFile = anna::Tokenizer::data(tok_iter);
-      d->load(pathFile);
+  std::string stacks = cl.getValue("stacks");
+  bool multistack = false;
+  try {
+    anna::Tokenizer stacksTok;
+    stacksTok.apply(stacks, "#");
+    anna::Tokenizer::const_iterator stacks_it, stack_it;
+
+    for(stacks_it = stacksTok.begin(); stacks_it != stacksTok.end(); stacks_it++) {
+      std::string stack = anna::Tokenizer::data(stacks_it);
+      anna::Tokenizer stackTok;
+      stackTok.apply(stack, ",");
+
+      if(stackTok.size() == 1) {
+        if(stacksTok.size() != 1)
+          throw anna::RuntimeException("Application Id value is mandatory when more than one stack is going to be configured", ANNA_FILE_LOCATION);
+
+        anna::diameter::stack::Dictionary * d = stackEngine.createDictionary(0 /* no matter */, stack); // the stack is the dictionary
+        codecEngine->setDictionary(d);
+        break;
+      }
+
+      if(stackTok.size() != 2)
+        throw anna::RuntimeException("Each stack must be in the form '<application-id>,<xml dictionary pathfile>'", ANNA_FILE_LOCATION);
+
+      multistack = true;
+      stack_it = stackTok.begin();
+      unsigned int stackId = atoll(anna::Tokenizer::data(stack_it));
+      stack_it++;
+      std::string file = anna::Tokenizer::data(stack_it);
+      anna::diameter::stack::Dictionary * d = stackEngine.createDictionary(stackId, file);
     }
-  }
 
-  getCodecEngine()->setDictionary(d);
-  LOGDEBUG(anna::Logger::debug(getCodecEngine()->asString(), ANNA_FILE_LOCATION));
+    // Auto stack selection based on Application-ID:
+    if (multistack) getCodecEngine()->selectStackWithApplicationId(true);
 
-  if(lst.size() > 1) {
-    std::string all_in_one = "./dictionary-all-in-one.xml";
-    std::ofstream out(all_in_one.c_str(), std::ifstream::out);
-    std::string buffer = d->asXMLString();
-    out.write(buffer.c_str(), buffer.size());
-    out.close();
-    std::cout << "Written accumulated '" << all_in_one << "' (provide it next time to be more comfortable)." << std::endl;
+    std::cout << "Stacks provided:          " << std::endl;
+    std::cout << anna::functions::tab(stackEngine.asString(false /* light */));
+    std::cout << std::endl;
+  } catch(anna::RuntimeException &ex) {
+    _exit(ex.asString());
   }
+  //LOGDEBUG(anna::Logger::debug(codecEngine->asString(), ANNA_FILE_LOCATION));
+
 
   ///////////////////////////////
   // Diameter library COUNTERS //
@@ -571,7 +556,7 @@ throw(anna::RuntimeException) {
   // Integration (validation 'Complete' for receiving messages) and debugging (validation also before encoding: 'Always').
   // If missing 'integrationAndDebugging', default behaviour at engine is: mode 'AfterDecoding', depth 'FirstError':
   if(cl.exists("integrationAndDebugging")) {
-    getCodecEngine()->setValidationMode(anna::diameter::codec::Engine::ValidationMode::Always);
+    getCodecEngine()->setValidationMode(anna::diameter::codec::Engine::ValidationMode::Always); // XXXXXXXXXXXXXXXXXXXXXXXXX
     getCodecEngine()->setValidationDepth(anna::diameter::codec::Engine::ValidationDepth::Complete);
   }
 
@@ -584,10 +569,14 @@ throw(anna::RuntimeException) {
     else if (fixMode == "Always") fm = anna::diameter::codec::Engine::FixMode::Always;
     else if (fixMode == "Never") fm = anna::diameter::codec::Engine::FixMode::Never;
     else LOGINFORMATION(anna::Logger::information("Unreconized command-line fix mode. Assumed default 'BeforeEncoding'", ANNA_FILE_LOCATION));
-    getCodecEngine()->setFixMode(fm);
+    getCodecEngine()->setFixMode(fm); // XXXXXXXXXXXXXXXXXXXXXXX
   }
 
-  getCodecEngine()->ignoreFlagsOnValidation(cl.exists("ignoreFlags"));
+  getCodecEngine()->ignoreFlagsOnValidation(cl.exists("ignoreFlags")); // XXXXXXXXXXXXXXXXXXXXXXX
+
+  // Base protocol for internal use (CEA, DWA, DPA and tracing:
+  a_myDiameterEngine->setBaseProtocolCodecEngine(getCodecEngine());
+
 
   // Diameter Server:
   if(cl.exists("diameterServer"))
@@ -638,13 +627,13 @@ throw(anna::RuntimeException) {
     int entityServerSessions = cl.exists("entityServerSessions") ? cl.getIntegerValue("entityServerSessions") : 1;
 
     if(entityServerSessions > 0) {
-      baseProtocolSetupAsClient(); // Same CER/CEA, DWR/DWA for all diameter servers
+      baseProtocolSetupAsClient();
       anna::socket_v servers = anna::functions::getSocketVectorFromString(cl.getValue("entity"));
       a_myDiameterEngine->setNumberOfClientSessionsPerServer(entityServerSessions);
       a_entity = (MyDiameterEntity*)(a_myDiameterEngine->createEntity(servers, "Launcher diameter entity"));
       a_entity->setClassCodeTimeout(anna::diameter::comm::ClassCode::Bind, ceaTimeout);
       a_entity->setClassCodeTimeout(anna::diameter::comm::ClassCode::ApplicationMessage, answersTimeout);
-      a_entity->setProgrammedAnswersCodecEngine(getCodecEngine());
+      a_entity->setCodecEngine(getCodecEngine()); // XXXXXXXXXXXXXXXXXXXXXXX
       a_entity->bind();
     }
   }
@@ -901,7 +890,7 @@ bool Launcher::sendBurstMessage(bool anyway) throw() {
     anna::diameter::comm::Server *usedServer = a_entity->getLastUsedResource();
     anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL;
     std::string detail = usedClientSession ? usedClientSession->asString() : "<null client session>"; // esto no deberia ocurrir
-    writeLogFile(msg->getBody(), (result ? "sent2e" : "send2eError"), detail);
+    writeLogFile(msg->getBody(), (result ? "sent2e" : "send2eError"), detail, getCodecEngine()); // el del nodo de trabajo
   }
 
   return result;
@@ -915,7 +904,7 @@ std::string Launcher::lookBurst(int order) const throw() {
 
   if(it != a_burstMessages.end()) {
     // Decode
-    anna::diameter::codec::Message codecMsg;
+    anna::diameter::codec::Message codecMsg(getCodecEngine()); // XXXXXXXXXXXXXXXX el del nodo de trabajo
     try { codecMsg.decode((*it).second->getBody()); } catch(anna::RuntimeException &ex) { ex.trace(); }
     result = codecMsg.asXMLString();
   }
@@ -1012,7 +1001,7 @@ 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 += "\n handlers, diameter dictionary, etc.), and a powerful log module could dump all the events";
+  result += "\n handlers, diameter stacks, 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.";
@@ -1027,8 +1016,8 @@ std::string Launcher::help() const throw() {
   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 += "\nAs mandatory, the stack definition given through the xml dictionary:";
-  result += "\n   --dictionary <path to dictionary file>";
+  result += "\nAs mandatory, the stacks enabled given through the application-id and the xml dictionary:";
+  result += "\n   --stacks <appid1,dictionary1#appid2,dictionary2#...#appidN,dictionaryN>";
   result += "\n";
   result += "\nActing as a diameter server (accepting i.e. 10 connections), you would have:";
   result += "\n   --diameterServer localhost:3868 --diameterServerSessions 10 --entityServerSessions 0";
@@ -1058,6 +1047,11 @@ std::string Launcher::help() const throw() {
   result += "\n";
   result += "\nhelp                                 This help. Startup information-level traces also dump this help.";
   result += "\n";
+  result += "\n--------------------------------------------------------------------------------------- Stack selection";
+  result += "\n";
+  result += "\nstack|<id>                           Select current working stack id (node selection). Many operations";
+  result += "                                        could use this value if proceed, in multistack configurations.";
+  result += "\n";
   result += "\n------------------------------------------------------------------------------------ Parsing operations";
   result += "\n";
   result += "\ncode|<source_file>|<target_file>     Encodes source file (pathfile) into target file (pathfile).";
@@ -1135,14 +1129,14 @@ std::string Launcher::help() const throw() {
   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 += "\nBalance ('-balance' command line parameter) could be used to forward server socket receptions through";
+  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 += "\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)";
@@ -1157,6 +1151,7 @@ std::string Launcher::help() const throw() {
   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   [retry]                Request retransmission";
   result += "\n";
   result += "\n-------------------------------------------------------------------------------------------- Load tests";
   result += "\n";
@@ -1174,7 +1169,7 @@ std::string Launcher::help() const throw() {
   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                                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.";
@@ -1194,7 +1189,7 @@ std::string Launcher::help() const throw() {
   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 += "\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";
@@ -1232,7 +1227,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
   response_content = "Operation processed with exception. See traces\n"; // supposed
   std::string result = "";
   anna::DataBlock db_aux(true);
-  anna::diameter::codec::Message codecMsg;
+  anna::diameter::codec::Message codecMsg(getCodecEngine()); // XXXXXXXXXXXXXX el del nodo de trabajo
 
   ///////////////////////////////////////////////////////////////////
   // Simple operations without arguments:
@@ -1375,6 +1370,8 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
 
     if(!entity) throw anna::RuntimeException("No entity configured to send the message", ANNA_FILE_LOCATION);
     anna::diameter::comm::Message *msg = createCommMessage();
+    //msg->setRetries(4);
+    //msg->setOnExpiry(anna::diameter::comm::Message::OnExpiry::Retransmit);
 
     if((opType == "sendxml") || (opType == "sendxml2e")) {
       codecMsg.loadXML(param1);
@@ -1563,7 +1560,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     } else if (param1 == "dump") {
       localServer->getReactingAnswers()->dump();
     } else {
-      anna::diameter::codec::Message *message = getCodecEngine()->createMessage(param1);
+      anna::diameter::codec::Message *message = getCodecEngine()->createMessage(param1); // // XXXXXXXXXXXXXX el del nodo de trabajo
       LOGDEBUG
       (
         anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION);
@@ -1595,7 +1592,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     } else if (param1 == "dump") {
       entity->getReactingAnswers()->dump();
     } else {
-      anna::diameter::codec::Message *message = getCodecEngine()->createMessage(param1);
+      anna::diameter::codec::Message *message = getCodecEngine()->createMessage(param1); // XXXXXXXXXXXXXX el del nodo de trabajo
       LOGDEBUG
       (
         anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION);
@@ -1707,10 +1704,12 @@ int MyDiameterEntity::readSocketId(const anna::diameter::comm::Message* message,
 
       if(sessionBasedModelsType == "SessionIdOptionalPart") return (atoi(optional.c_str()) % 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;
     }
   } catch(anna::RuntimeException &ex) {
     LOGDEBUG(
@@ -1731,7 +1730,7 @@ throw() {
   result->createAttribute("StartTime", a_start_time.asString());
   result->createAttribute("SecondsLifeTime", anna::time::functions::lapsedMilliseconds() / 1000);
   // Diameter:
-  getCodecEngine()->asXML(result);
+  getCodecEngine()->asXML(result); // XXXXXXXXXXXXXXX todos los nodos ...
   // OAM:
   anna::diameter::comm::OamModule::instantiate().asXML(result);
   anna::diameter::comm::ApplicationMessageOamModule::instantiate().asXML(result);
@@ -1740,3 +1739,4 @@ throw() {
   anna::statistics::Engine::instantiate().asXML(result);
   return result;
 }
+