X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.cpp;h=5ee34669c3f8b3cf3cb78d3883b2e6747b536e06;hb=ceba20e0efab1bc4e564c18fe05a9a0047983653;hp=e8ac212fbde8eedc554edafd0f1e608c8d64eb6c;hpb=13b6f0196c2091f9e88a0778155cdcb733cfdafd;p=anna.git diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index e8ac212..5ee3466 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -159,7 +159,6 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp 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; - bool id_0_registered = false; unsigned int id_value; std::string codecEngineName; @@ -185,10 +184,7 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp throw ex; } - if (id_value == 0) { - id_0_registered = true; - bpd = d; - } + bpd = d; // base protocol dictionary in case of monostack. If multistack, will be calculated later // Create codec engine and register it in the codec engine manager: codecEngineName = anna::functions::asString("CodecEngineForStackId_%llu", id_value); @@ -236,14 +232,10 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp // Basic checking for multistack: bool multistack = (stackEngine.stack_size() > 1); if (multistack) { - if(!id_0_registered) + bpd = stackEngine.getDictionary(0); + if(!bpd) throw anna::RuntimeException("In multistack applications is mandatory register a stack id = 0 using a dictionary which contains the needed elements to build base protocol messages (CER/A, DWR/A, DPR/A, STR/A, etc.)", ANNA_FILE_LOCATION); } - else { // monostack - if (!bpd) - bpd = ce->getDictionary(); // in mono-stack applications, we understand the existing stack as the used - // for base protocol, regardless if it is registered with stack id 0 or not - } // REALMS: for(anna::xml::Node::const_child_iterator it = servicesNode->child_begin(); it != servicesNode->child_end(); it++) { @@ -988,6 +980,8 @@ std::string Launcher::help() const throw() { result += "\n This operation applies over all the registered realm nodes"; result += "\n except if one specific working node has been set."; result += "\nforceCountersRecord Forces dump to file the current counters of the process."; + result += "\noam-and-stats Dumps current counters and statistics of the process. This is"; + result += "\n also done at process context dump."; result += "\n"; result += "\n[|
:][|socket id]"; result += "\n"; @@ -1438,6 +1432,13 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons return; } + // OAM & statistics: + if(operation == "oam-and-stats") { + anna::xml::Node root("root"); + response_content = anna::xml::Compiler().apply(oamAndStatsAsXML(&root)); + return; + } + /////////////////////////////////////////////////////////////////// // Tokenize operation Tokenizer params; @@ -1517,7 +1518,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } catch(anna::RuntimeException &ex) { ex.trace(); - response_content = anna::functions::asString("Loaded services from file '%s' with some problems (ignored ones)", servicesFile.c_str()); + response_content = anna::functions::asString("Loaded services from file '%s' with errors", servicesFile.c_str()); return; } response_content = anna::functions::asString("Loaded services from file '%s'", servicesFile.c_str()); @@ -2119,6 +2120,19 @@ throw() { it->second->asXML(result); } + // OAM & statistics: + oamAndStatsAsXML(result); + + // Testing: could be heavy if test case reports are enabled + TestManager::instantiate().asXML(result); + + return result; +} + +anna::xml::Node* Launcher::oamAndStatsAsXML(anna::xml::Node* parent) const +throw() { + anna::xml::Node* result = parent->createChild("OamAndStatistics"); + // OAM: anna::diameter::comm::OamModule::instantiate().asXML(result); anna::diameter::comm::ApplicationMessageOamModule::instantiate().asXML(result); @@ -2126,8 +2140,6 @@ throw() { // Statistics: anna::statistics::Engine::instantiate().asXML(result); - // Testing: could be heavy if test case reports are enabled - TestManager::instantiate().asXML(result); - return result; } +