X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fmain.cpp;h=44d2c069f9dea4dcf110130b3db26bb336c6b578;hb=7ac94d8f360628b59b7fed8bfbc4509ad055712e;hp=39b0a023ffe8b81eeac24f680719e445c41019b1;hpb=48d4097ad5936dfc7df88cc7772333d249beb45b;p=anna.git diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 39b0a02..44d2c06 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -436,6 +436,7 @@ public: void writeBurstLogFile(const std::string &buffer) throw(); bool burstLogEnabled() const throw() { return (((a_burstLogFile == "") || (a_burstLogFile == "null")) ? false : true); } void startDiameterServer(int) throw(anna::RuntimeException); + void forceCountersRecord() throw(anna::RuntimeException) { if (a_counterRecorderClock) a_counterRecorderClock->tick(); } anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); void resetStatistics() throw() { a_myDiameterEngine->resetStatistics(); } @@ -846,6 +847,7 @@ std::string Launcher::help() const throw() { 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.' by mean 'kill -10 '."; + result += "\nforceCountersRecord Forces dump to file the current counters of the process."; result += "\n"; result += "\n|[
:]|[socket id]"; result += "\n"; @@ -1099,7 +1101,8 @@ int main(int argc, const char** argv) { commandLine.add("originHost", anna::CommandLine::Argument::Optional, "Diameter application host name (system name). If missing, process sets o.s. hostname"); commandLine.add("originRealm", anna::CommandLine::Argument::Optional, "Diameter application node realm name. If missing, process sets domain name"); commandLine.add("integrationAndDebugging", anna::CommandLine::Argument::Optional, "Sets validation mode to 'Always' (default validates only after decoding), and validation depth to 'Complete' (default validates until 'FirstError')", false); -// commandLine.add("clone", anna::CommandLine::Argument::Optional, "Enables fork mode for request processing", false); + commandLine.add("fixMode", anna::CommandLine::Argument::Optional, "Sets message fix mode (unreconized values will assume default 'BeforeEncoding'). Allowed: 'BeforeEncoding', 'AfterDecoding', 'Always', 'Never'"); + commandLine.initialize(argv, argc); commandLine.verify(); std::cout << commandLine.asString() << std::endl; @@ -1628,6 +1631,18 @@ throw(anna::RuntimeException) { codecEngine->setValidationDepth(anna::diameter::codec::Engine::ValidationDepth::Complete); } + // Fix mode + if(cl.exists("fixMode")) { // BeforeEncoding(default), AfterDecoding, Always, Never + std::string fixMode = cl.getValue("fixMode"); + anna::diameter::codec::Engine::FixMode::_v fm; + if (fixMode == "BeforeEncoding") fm = anna::diameter::codec::Engine::FixMode::BeforeEncoding; + else if (fixMode == "AfterDecoding") fm = anna::diameter::codec::Engine::FixMode::AfterDecoding; + 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)); + codecEngine->setFixMode(fm); + } + codecEngine->ignoreFlagsOnValidation(cl.exists("ignoreFlags")); // Diameter Server: @@ -1822,6 +1837,13 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons return; } + // Counters dump on demand: + if(operation == "forceCountersRecord") { + forceCountersRecord(); + response_content = "Current counters have been dump to disk\n"; + return; + } + /////////////////////////////////////////////////////////////////// // Tokenize operation Tokenizer params; @@ -2215,14 +2237,14 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons response_content += "' loaded."; response_content += "\n"; } else if((opType == "answerxml") || (opType == "answerxml2c")) { - response_content += "Answer to client '"; + response_content += "'"; response_content += param1; - response_content += "' programmed."; + response_content += "' applied on server FIFO queue"; response_content += "\n"; } else if(opType == "answerxml2e") { - response_content += "Answer to entity '"; + response_content += "'"; response_content += param1; - response_content += "' programmed."; + response_content += "' applied on client FIFO queue"; response_content += "\n"; } else if(opType == "diameterServerSessions") { response_content += "Maximum server socket connections updated to '";