From: Eduardo Ramos Testillano Date: Tue, 21 Apr 2015 21:36:16 +0000 (+0200) Subject: Make Fix Mode commandline configurable X-Git-Tag: REFACTORING_TESTING_LIBRARY~152 X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=c6c1c4d0ae132261d93b933e97d5234d49040128 Make Fix Mode commandline configurable --- diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 39b0a02..92dd89b 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -1099,7 +1099,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 +1629,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: