Fix local server for multiple applications
[anna.git] / example / diameter / launcher / Launcher.cpp
index d0151cd..54fb750 100644 (file)
@@ -144,21 +144,22 @@ Launcher::Launcher() : anna::comm::Application("launcher", "DiameterLauncher", "
   a_counterRecorderClock = NULL;
 
   a_workingNode = NULL;
+  a_operatedHost = NULL;
 
   a_httpServerSocket = NULL;
 }
 
 
-std::string Launcher::getSignalUSR2InputFile() const throw() {
+std::string Launcher::getSignalUSR2InputFile() const {
   return (getInitialWorkingDirectory() + "/" + SIGUSR2_TASKS_INPUT_FILENAME);
 }
 
-std::string Launcher::getSignalUSR2OutputFile() const throw() {
+std::string Launcher::getSignalUSR2OutputFile() const {
   return (getInitialWorkingDirectory() + "/" + SIGUSR2_TASKS_OUTPUT_FILENAME);
 }
 
 
-void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindResources) throw(anna::RuntimeException) {
+void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindResources) noexcept(false) {
 
   CommandLine& cl(anna::CommandLine::instantiate());
   bool allLogsDisabled = cl.exists("disableLogs");
@@ -188,7 +189,8 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes
   // We will register a scope per stack id registered. The counters will be dynamically registered at count method.
   anna::diameter::comm::ApplicationMessageOamModule & appMsgOamModule = anna::diameter::comm::ApplicationMessageOamModule::instantiate();
   appMsgOamModule.enableCounters(); // this special module is disabled by default (the only)
-  static int scope_id = 3;
+  static int scope_id = 3 + appMsgOamModule.scopes();
+
   unsigned int id_value;
   std::string codecEngineName;
 
@@ -360,7 +362,7 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes
       }
 
       /////////////////////////////////////////////////////////////////////////////////////////////
-      // Diameter communication engine:
+      // Diameter communication engine: ONE ENGINE PER OWN ORIGIN HOST
       std::string commEngineName = originHost->getValue() + "_DiameterCommEngine";
       MyDiameterEngine *commEngine = new MyDiameterEngine(commEngineName.c_str(), bpd);
       commEngine->setAutoBind(false);  // allow to create client-sessions without binding them, in order to set timeouts.
@@ -370,7 +372,7 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes
       if (originRealm) commEngine->setOriginRealmName(originRealm->getValue());
 
       // Origin host node:
-      a_workingNode = new anna::diameter::comm::OriginHost((anna::diameter::comm::Engine*)commEngine, applicationId);
+      a_workingNode = new anna::diameter::comm::OriginHost((anna::diameter::comm::Engine*)commEngine, applicationId /* OriginHost constructor extracts corresponding stack codec engine */);
       a_workingNode->setRequestRetransmissions(retransmissions);
       /////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -384,9 +386,13 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes
           commEngine->setNumberOfClientSessionsPerServer(sessions);
 
           // Client CER and DWR
-          std::string cerPathfile = cer ? cer->getValue() : "";
-          std::string dwrPathfile = dwr ? dwr->getValue() : "";
-          commEngine->setClientCERandDWR(cerPathfile, dwrPathfile);
+          if (cer) { // pathfile provided
+            commEngine->setClientCER(cer->getValue());
+          }
+          else {
+            commEngine->setClientCER(applicationId); // default engine CER
+          }
+          commEngine->setClientDWR(dwr ? dwr->getValue() : "" /* default DWR */);
 
           // Register one entity for this engine:
           a_workingNode->createEntity(entity->getValue(), ceaTimeoutMs, answersTimeoutMs);
@@ -435,7 +441,7 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes
 }
 
 
-void Launcher::loadServicesFromFile(const std::string & xmlPathFile, bool bindResources) throw(anna::RuntimeException) {
+void Launcher::loadServicesFromFile(const std::string & xmlPathFile, bool bindResources) noexcept(false) {
 
   if (xmlPathFile == "null" || xmlPathFile == "") {
     LOGWARNING(anna::Logger::warning("Ignoring services configuration on start: empty or 'null' string provided as xml file. Use management interface (operation 'services') in order to add services", ANNA_FILE_LOCATION));
@@ -476,7 +482,7 @@ void Launcher::loadServicesFromFile(const std::string & xmlPathFile, bool bindRe
 }
 
 
-void Launcher::loadServicesFromXMLString(const std::string & xmlString, bool bindResources) throw(anna::RuntimeException) {
+void Launcher::loadServicesFromXMLString(const std::string & xmlString, bool bindResources) noexcept(false) {
 
   anna::xml::DocumentMemory xmlDocument; // has private copy constructor defined but not implemented to avoid inhenrit/copy (is very heavy)
   anna::xml::DTDMemory xmlDTD;
@@ -504,7 +510,7 @@ void Launcher::loadServicesFromXMLString(const std::string & xmlString, bool bin
 }
 
 
-anna::Millisecond Launcher::checkTimeMeasure(const std::string &parameter, const std::string &value) throw(anna::RuntimeException) {
+anna::Millisecond Launcher::checkTimeMeasure(const std::string &parameter, const std::string &value) noexcept(false) {
 
   if(anna::functions::isLike("^[0-9]+$", value)) {  // para incluir numeros decimales: ^[0-9]+(.[0-9]+)?$
     int msecs;
@@ -545,7 +551,7 @@ anna::Millisecond Launcher::checkTimeMeasure(const std::string &parameter, const
   throw RuntimeException(msg, ANNA_FILE_LOCATION);
 }
 
-bool Launcher::setWorkingNode(const std::string &name) throw() {
+bool Launcher::setWorkingNode(const std::string &name) {
   bool result = false;
 
   anna::diameter::comm::OriginHostManager &ohm = anna::diameter::comm::OriginHostManager::instantiate();
@@ -559,7 +565,7 @@ bool Launcher::setWorkingNode(const std::string &name) throw() {
   return result;
 }
 
-anna::diameter::comm::OriginHost *Launcher::getOriginHost(const std::string &name) const throw(anna::RuntimeException) {
+anna::diameter::comm::OriginHost *Launcher::getOriginHost(const std::string &name) const noexcept(false) {
   anna::diameter::comm::OriginHostManager &ohm = anna::diameter::comm::OriginHostManager::instantiate();
   anna::diameter::comm::OriginHost *result = ohm.getOriginHost(name);
 
@@ -569,30 +575,39 @@ anna::diameter::comm::OriginHost *Launcher::getOriginHost(const std::string &nam
   return result;
 }
 
-anna::diameter::comm::OriginHost *Launcher::getOriginHost(const anna::diameter::codec::Message &message) const throw(anna::RuntimeException) {
+anna::diameter::comm::OriginHost *Launcher::getOriginHost(const anna::diameter::codec::Message &message) const noexcept(false) {
   std::string originHost = message.getAvp(anna::diameter::helpers::base::AVPID__Origin_Host)->getDiameterIdentity()->getValue();
   return (getOriginHost(originHost));
 }
 
-bool Launcher::uniqueOriginHost() const throw() {
+anna::diameter::comm::OriginHost *Launcher::getOriginHost(const anna::DataBlock &messageDataBlock) const noexcept(false) {
+  std::string originHost = anna::diameter::helpers::base::functions::getOriginHost(messageDataBlock);
+  return (getOriginHost(originHost));
+}
+
+bool Launcher::uniqueOriginHost() const {
   anna::diameter::comm::OriginHostManager &ohm = anna::diameter::comm::OriginHostManager::instantiate();
   return (ohm.size() == 1);
 }
 
-
-void Launcher::updateOperatedOriginHostWithMessage(const anna::diameter::codec::Message &message) throw(anna::RuntimeException) {
+void Launcher::updateOperatedOriginHostWithMessage(const anna::diameter::codec::Message &message) noexcept(false) {
   if (!a_operatedHost) // priority for working node by mean 'node' operation
     a_operatedHost = getOriginHost(message);
 }
 
-anna::diameter::comm::OriginHost *Launcher::getWorkingNode() const throw(anna::RuntimeException) {
+void Launcher::updateOperatedOriginHostWithMessage(const anna::DataBlock &messageDataBlock) noexcept(false) {
+  if (!a_operatedHost) // priority for working node by mean 'node' operation
+    a_operatedHost = getOriginHost(messageDataBlock);
+}
+
+anna::diameter::comm::OriginHost *Launcher::getWorkingNode() const noexcept(false) {
   if(!a_workingNode)
     throw anna::RuntimeException("Working node not identified (try to load services)", ANNA_FILE_LOCATION);
 
   return a_workingNode;
 }
 
-anna::diameter::comm::OriginHost *Launcher::getOperatedHost() const throw(anna::RuntimeException) {
+anna::diameter::comm::OriginHost *Launcher::getOperatedHost() const noexcept(false) {
   if(!a_operatedHost)
     throw anna::RuntimeException("Node not identified (try to force a specific Origin-Host with 'node' operation)", ANNA_FILE_LOCATION);
 
@@ -603,26 +618,26 @@ void Launcher::setOperatedHost(anna::diameter::comm::OriginHost *op) {
   a_operatedHost = op;
 }
 
-MyDiameterEntity *Launcher::getOperatedEntity() const throw(anna::RuntimeException) {
+MyDiameterEntity *Launcher::getOperatedEntity() const noexcept(false) {
   MyDiameterEntity *result = (MyDiameterEntity *)(getOperatedHost()->getEntity());
   if (!result)
     throw anna::RuntimeException("No entity configured for the operated node", ANNA_FILE_LOCATION);
   return result;
 }
 
-MyLocalServer *Launcher::getOperatedServer() const throw(anna::RuntimeException) {
+MyLocalServer *Launcher::getOperatedServer() const noexcept(false) {
   MyLocalServer *result = (MyLocalServer *)(getOperatedHost()->getDiameterServer());
   if (!result)
     throw anna::RuntimeException("No local server configured for the operated node", ANNA_FILE_LOCATION);
   return result;
 }
 
-MyDiameterEngine *Launcher::getOperatedEngine() const throw(anna::RuntimeException) {
+MyDiameterEngine *Launcher::getOperatedEngine() const noexcept(false) {
   return (MyDiameterEngine *)getOperatedHost()->getCommEngine(); // never will be NULL
 }
 
 void Launcher::initialize()
-throw(anna::RuntimeException) {
+noexcept(false) {
   anna::comm::Application::initialize();
   CommandLine& cl(anna::CommandLine::instantiate());
   anna::comm::Communicator::WorkMode::_v workMode(anna::comm::Communicator::WorkMode::Single);
@@ -661,7 +676,7 @@ throw(anna::RuntimeException) {
 }
 
 void Launcher::run()
-throw(anna::RuntimeException) {
+noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("Launcher", "run", ANNA_FILE_LOCATION));
   CommandLine& cl(anna::CommandLine::instantiate());
   anna::diameter::stack::Engine::instantiate();
@@ -843,7 +858,7 @@ throw(anna::RuntimeException) {
   a_communicator->accept();
 }
 
-bool Launcher::getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw(anna::RuntimeException) {
+bool Launcher::getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const noexcept(false) {
   // Get hex string
   static char buffer[8192];
   std::ifstream infile(pathfile.c_str(), std::ifstream::in);
@@ -868,7 +883,7 @@ bool Launcher::getDataBlockFromHexFile(const std::string &pathfile, anna::DataBl
   return false;
 }
 
-void Launcher::resetStatistics() throw() {
+void Launcher::resetStatistics() {
   if (a_workingNode) {
     a_workingNode->getCommEngine()->resetStatistics();
   }
@@ -880,13 +895,13 @@ void Launcher::resetStatistics() throw() {
   }
 }
 
-void Launcher::resetCounters() throw() {
+void Launcher::resetCounters() {
   anna::diameter::comm::OamModule::instantiate().resetCounters();
   anna::diameter::comm::ApplicationMessageOamModule::instantiate().resetCounters();
   anna::diameter::codec::OamModule::instantiate().resetCounters();
 }
 
-void Launcher::signalTerminate() throw(anna::RuntimeException) {
+void Launcher::signalTerminate() noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("Launcher", "signalTerminate", ANNA_FILE_LOCATION));
 
   forceCountersRecord();
@@ -895,7 +910,7 @@ void Launcher::signalTerminate() throw(anna::RuntimeException) {
   comm::Application::signalTerminate ();
 }
 
-void Launcher::signalUSR2() throw(anna::RuntimeException) {
+void Launcher::signalUSR2() noexcept(false) {
 
   std::string inputFile = getSignalUSR2InputFile();
   std::string outputFile = getSignalUSR2OutputFile();
@@ -945,7 +960,7 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) {
 }
 
 
-void Launcher::logStatisticsSamples(const std::string &conceptsList) throw() {
+void Launcher::logStatisticsSamples(const std::string &conceptsList) {
   anna::statistics::Engine &statEngine = anna::statistics::Engine::instantiate();
 
   if(conceptsList == "all") {
@@ -976,7 +991,7 @@ void Launcher::logStatisticsSamples(const std::string &conceptsList) throw() {
 }
 
 
-bool Launcher::eventOperation(const std::string &operation, std::string &response) throw(anna::RuntimeException) {
+bool Launcher::eventOperation(const std::string &operation, std::string &response) noexcept(false) {
 
   bool result = true;
 
@@ -1161,7 +1176,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     outfile.write(xmlString.c_str(), xmlString.size());
     outfile.close();
   } else if((opType == "hide") || (opType == "show") || (opType == "hidden") || (opType == "shown")) {
-    return eop.visibility(opt_response, opType, param1, (param2 != "") ? atoi(param2.c_str()) : -1);
+    result = eop.visibility(opt_response, opType, param1, (param2 != "") ? atoi(param2.c_str()) : -1);
 
   } else if((opType == "sendxml2e") || (opType == "sendhex2e")) {
     anna::diameter::comm::Message *msg;
@@ -1177,6 +1192,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
       // Get DataBlock from file with hex content:
       if(!getDataBlockFromHexFile(param1, db_aux))
         throw anna::RuntimeException("Error reading hex file provided", ANNA_FILE_LOCATION);
+      updateOperatedOriginHostWithMessage(db_aux);
       msg = getOperatedHost()->createCommMessage();
       msg->setBody(db_aux);
       try { if(getOperatedHost()->logEnabled()) codecMsg.decode(db_aux); } catch(anna::RuntimeException &ex) { ex.trace(); }
@@ -1189,9 +1205,90 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     if(getOperatedHost()->logEnabled()) {
       anna::diameter::comm::Server *usedServer = getOperatedEntity()->getLastUsedResource();
       anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL;
-      std::string detail = usedClientSession ? usedClientSession->asString() : "<null client session>"; // shouldn't happen
+      std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // shouldn't happen
       getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2e" : "send2eError"), detail);
     }
+  } else if((opType == "sendxml2c") || (opType == "sendhex2c")) {
+    anna::diameter::comm::Message *msg;
+
+    if(opType == "sendxml2c") {
+      codecMsg.loadXMLFile(param1);
+      updateOperatedOriginHostWithMessage(codecMsg);
+      msg = getOperatedHost()->createCommMessage();
+      msg->clearBody();
+      try { 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)
+
+      msg->setBody(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);
+      updateOperatedOriginHostWithMessage(db_aux);
+      msg = getOperatedHost()->createCommMessage();
+      msg->setBody(db_aux);
+    }
+
+    bool success = getOperatedServer()->send(msg);
+    getOperatedHost()->releaseCommMessage(msg);
+
+    // Detailed log:
+    if(getOperatedHost()->logEnabled()) {
+      anna::diameter::comm::ServerSession *usedServerSession = getOperatedServer()->getLastUsedResource();
+      std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen
+      getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail);
+    }
+  } else if(opType == "answerxml2e") {
+
+    if(param1 == "") { // programmed answers FIFO's to stdout
+      response = getOperatedHost()->getReactingAnswers()->asString("ANSWERS TO ENTITY");
+      return true; // OK
+    } else if (param1 == "rotate") {
+      getOperatedHost()->getReactingAnswers()->rotate(true);
+    } else if (param1 == "exhaust") {
+      getOperatedHost()->getReactingAnswers()->rotate(false);
+    } else if (param1 == "clear") {
+      getOperatedHost()->getReactingAnswers()->clear();
+    } else if (param1 == "dump") {
+      getOperatedHost()->getReactingAnswers()->dump("programmed_answer");
+    } else {
+      codecMsg.loadXMLFile(param1);
+      updateOperatedOriginHostWithMessage(codecMsg);
+      anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
+      LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));
+
+      if(message->isRequest())
+        throw anna::RuntimeException("Cannot program diameter requests. Answer type must be provided", ANNA_FILE_LOCATION);
+
+      int code = message->getId().first;
+      LOGDEBUG(anna::Logger::debug("Adding a new programed 'answer to entity' to the FIFO queue corresponding to its message code ...", ANNA_FILE_LOCATION));
+      getOperatedHost()->getReactingAnswers()->addMessage(code, message);
+    }
+  } else if(opType == "answerxml2c") {
+
+    if(param1 == "") { // programmed answers FIFO's to stdout
+      response = getOperatedHost()->getReactingAnswers()->asString("ANSWERS TO CLIENT");
+      return true; // OK
+    } else if (param1 == "rotate") {
+      getOperatedHost()->getReactingAnswers()->rotate(true);
+    } else if (param1 == "exhaust") {
+      getOperatedHost()->getReactingAnswers()->rotate(false);
+    } else if (param1 == "clear") {
+      getOperatedHost()->getReactingAnswers()->clear();
+    } else if (param1 == "dump") {
+      getOperatedHost()->getReactingAnswers()->dump("programmed_answer");
+    } else {
+      codecMsg.loadXMLFile(param1);
+      updateOperatedOriginHostWithMessage(codecMsg);
+      anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
+      LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));
+
+      if(message->isRequest())
+        throw anna::RuntimeException("Cannot program diameter requests. Answer type must be provided", ANNA_FILE_LOCATION);
+
+      int code = message->getId().first;
+      LOGDEBUG(anna::Logger::debug("Adding a new programed 'answer to client' to the FIFO queue corresponding to its message code ...", ANNA_FILE_LOCATION));
+      getOperatedHost()->getReactingAnswers()->addMessage(code, message);
+    }
   } else if((opType == "burst")) {
 
     if (!uniqueOriginHost())
@@ -1348,12 +1445,12 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
         limit = atoi(param2.c_str());
         testManager.setInProgressLimit(limit);
         opt_response = "new in-progress limit: ";
-        opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "<no limit>";
+        opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]";
       }
       else {
         opt_response = "in-progress limit amount: ";
         limit = testManager.getInProgressLimit();
-        opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "<no limit>";
+        opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]";
         opt_response += "; currently there are ";
         opt_response += anna::functions::asString(testManager.getInProgressCount());
         opt_response += " test cases running";
@@ -1583,12 +1680,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
       if (numParams > 1)
         throw anna::RuntimeException("Wrong body content format on HTTP Request. Check 'HELP.md' for more information.", ANNA_FILE_LOCATION);
 
-      if (testManager.clearPool()) {
-        opt_response = "all the programmed test cases have been dropped";
-      }
-      else {
-        opt_response = "there are not programmed test cases to be removed";
-      }
+      result = testManager.clearPool(opt_response);
     }
     else if(param1 == "junit") {
       response = testManager.junitAsXMLString();
@@ -1732,18 +1824,22 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
           std::string::size_type pos, pos_1, pos_2;
 
           pos = regexp.find("end-to-end-id=", 0u);
-          pos = regexp.find("\"", pos);
-          pos_1 = pos;
-          pos = regexp.find("\"", pos+1);
-          pos_2 = pos;
-          regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          if (pos != std::string::npos) {
+            pos = regexp.find("\"", pos);
+            pos_1 = pos;
+            pos = regexp.find("\"", pos+1);
+            pos_2 = pos;
+            regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          }
 
           pos = regexp.find("hop-by-hop-id=", 0u);
-          pos = regexp.find("\"", pos);
-          pos_1 = pos;
-          pos = regexp.find("\"", pos+1);
-          pos_2 = pos;
-          regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          if (pos != std::string::npos) {
+            pos = regexp.find("\"", pos);
+            pos_1 = pos;
+            pos = regexp.find("\"", pos+1);
+            pos_2 = pos;
+            regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          }
 
           // For this representation: <avp name="Origin-State-Id" data="1428633668"/>
           //pos = regexp.find("Origin-State-Id", 0u);
@@ -1755,13 +1851,15 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
           //regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
           // But we have this one: <avp data="1428633668" name="Origin-State-Id"/>
           pos = regexp.find("Origin-State-Id", 0u);
-          pos = regexp.rfind("\"", pos);
-          pos = regexp.rfind("\"", pos-1);
-          pos = regexp.rfind("\"", pos-1);
-          pos_1 = pos;
-          pos = regexp.find("\"", pos+1);
-          pos_2 = pos;
-          regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          if (pos != std::string::npos) {
+            pos = regexp.rfind("\"", pos);
+            pos = regexp.rfind("\"", pos-1);
+            pos = regexp.rfind("\"", pos-1);
+            pos_1 = pos;
+            pos = regexp.find("\"", pos+1);
+            pos_2 = pos;
+            regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+          }
 
           //regexp.insert(0, "^");
           //regexp += "$";
@@ -1784,34 +1882,6 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
       }
     }
 
-  } else if((opType == "sendxml2c") || (opType == "sendhex2c")) {
-    anna::diameter::comm::Message *msg;
-
-    if(opType == "sendxml2c") {
-      codecMsg.loadXMLFile(param1);
-      updateOperatedOriginHostWithMessage(codecMsg);
-      msg = getOperatedHost()->createCommMessage();
-      msg->clearBody();
-      try { 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)
-
-      msg->setBody(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);
-      msg = getOperatedHost()->createCommMessage();
-      msg->setBody(db_aux);
-    }
-
-    bool success = getOperatedServer()->send(msg);
-    getOperatedHost()->releaseCommMessage(msg);
-
-    // Detailed log:
-    if(getOperatedHost()->logEnabled()) {
-      anna::diameter::comm::ServerSession *usedServerSession = getOperatedServer()->getLastUsedResource();
-      std::string detail = usedServerSession ? usedServerSession->asString() : "<null server session>"; // shouldn't happen
-      getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail);
-    }
   } else if(opType == "loadxml") {
     codecMsg.loadXMLFile(param1);
     response = codecMsg.asXMLString();
@@ -1820,61 +1890,14 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     int diameterServerSessions = atoi(param1.c_str());
     getOperatedServer()->setMaxConnections(diameterServerSessions);
 
-  } else if(opType == "answerxml2c") {
-    if(param1 == "") { // programmed answers FIFO's to stdout
-      response = getOperatedServer()->getReactingAnswers()->asString("ANSWERS TO CLIENT");
-      return true; // OK
-    } else if (param1 == "rotate") {
-      getOperatedServer()->getReactingAnswers()->rotate(true);
-    } else if (param1 == "exhaust") {
-      getOperatedServer()->getReactingAnswers()->rotate(false);
-    } else if (param1 == "clear") {
-      getOperatedServer()->getReactingAnswers()->clear();
-    } else if (param1 == "dump") {
-      getOperatedServer()->getReactingAnswers()->dump("programmed_answer");
-    } else {
-      codecMsg.loadXMLFile(param1);
-      updateOperatedOriginHostWithMessage(codecMsg);
-      anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
-      LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));
-
-      if(message->isRequest())
-        throw anna::RuntimeException("Cannot program diameter requests. Answer type must be provided", ANNA_FILE_LOCATION);
-
-      int code = message->getId().first;
-      LOGDEBUG(anna::Logger::debug("Adding a new programed 'answer to client' to the FIFO queue corresponding to its message code ...", ANNA_FILE_LOCATION));
-      getOperatedServer()->getReactingAnswers()->addMessage(code, message);
-    }
-  } else if(opType == "answerxml2e") {
-
-    if(param1 == "") { // programmed answers FIFO's to stdout
-      response = getOperatedEntity()->getReactingAnswers()->asString("ANSWERS TO ENTITY");
-      return true; // OK
-    } else if (param1 == "rotate") {
-      getOperatedEntity()->getReactingAnswers()->rotate(true);
-    } else if (param1 == "exhaust") {
-      getOperatedEntity()->getReactingAnswers()->rotate(false);
-    } else if (param1 == "clear") {
-      getOperatedEntity()->getReactingAnswers()->clear();
-    } else if (param1 == "dump") {
-      getOperatedEntity()->getReactingAnswers()->dump("programmed_answer");
-    } else {
-      codecMsg.loadXMLFile(param1);
-      updateOperatedOriginHostWithMessage(codecMsg);
-      anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
-      LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));
 
-      if(message->isRequest())
-        throw anna::RuntimeException("Cannot program diameter requests. Answer type must be provided", ANNA_FILE_LOCATION);
 
-      int code = message->getId().first;
-      LOGDEBUG(anna::Logger::debug("Adding a new programed 'answer to entity' to the FIFO queue corresponding to its message code ...", ANNA_FILE_LOCATION));
-      getOperatedEntity()->getReactingAnswers()->addMessage(code, message);
-    }
   } else {
     throw anna::RuntimeException("Wrong body content format on HTTP Request. Check 'HELP.md' for more information.", ANNA_FILE_LOCATION);
   }
 
+
+
   // HTTP response
   response = "Operation correctly processed: "; response += operation;
   if (opt_response != "") {
@@ -1886,7 +1909,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
 }
 
 anna::xml::Node* Launcher::asXML(anna::xml::Node* parent) const
-throw() {
+{
   anna::xml::Node* result = parent->createChild("launcher");
   anna::comm::Application::asXML(result);
   // Timming:
@@ -1914,7 +1937,7 @@ throw() {
 }
 
 anna::xml::Node* Launcher::oamAsXML(anna::xml::Node* parent) const
-throw() {
+{
   anna::xml::Node* result = parent->createChild("Oam");
 
   // OAM:
@@ -1926,7 +1949,7 @@ throw() {
 }
 
 anna::xml::Node* Launcher::statsAsXML(anna::xml::Node* parent) const
-throw() {
+{
   anna::xml::Node* result = parent->createChild("Statistics");
 
   // Statistics: