X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.cpp;h=59f5202beeed5c2e61c00268b44bb46a1e10a7d4;hb=a8cde75abebb30020be4d9cb10d898f8986e124c;hp=710ebfe9965d230540cd87bf3b7d02a0bd9dc75b;hpb=6f990d26c49e6f5bbb31cb1a2a47615918b6c339;p=anna.git diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 710ebfe..59f5202 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -58,7 +58,14 @@ void Launcher::releaseCommMessage(anna::diameter::comm::Message *msg) throw() { a_commMessages.release(msg); } -void Launcher::baseProtocolSetupAsClient(anna::diameter::codec::Engine *codecEngine) throw(anna::RuntimeException) { +void Launcher::baseProtocolSetupAsClient() throw(anna::RuntimeException) { + + anna::diameter::codec::Engine *codecEngine; + + codecEngine = getCodecEngine(); + // XXXXXXXXXXXXXXXXXXXX codecEngine = a_myDiameterEngine->getBaseProtocolCodecEngine(); + + // Build CER // ::= < Diameter Header: 257, REQ > // { Origin-Host } 264 diameterIdentity @@ -271,7 +278,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 @@ -339,7 +347,7 @@ throw(anna::RuntimeException) { std::string dictionaryParameter = cl.getValue("dictionary"); lst.apply(dictionaryParameter, ","); - if(lst.size() >= 1) { // always true (at least one, because -dictionary is mandatory) + 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; @@ -517,6 +525,10 @@ throw(anna::RuntimeException) { 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")) startDiameterServer(cl.exists("diameterServerSessions") ? cl.getIntegerValue("diameterServerSessions") : 1); @@ -566,7 +578,7 @@ throw(anna::RuntimeException) { int entityServerSessions = cl.exists("entityServerSessions") ? cl.getIntegerValue("entityServerSessions") : 1; if(entityServerSessions > 0) { - baseProtocolSetupAsClient(getCodecEngine()); // Same CER/CEA, DWR/DWA for all diameter servers XXXXXXXXXXXXXXXXXXXXXXXXX + 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")); @@ -1085,6 +1097,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"; @@ -1303,6 +1316,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); @@ -1635,10 +1650,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(