X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Fdiameter.comm%2FClientSession.cpp;h=9db3ca70f12e7cf4fede66d99fcd9e3b9a8198d0;hp=fa4a9c3b3661a166bdb8832f832a0b826cb062a5;hb=HEAD;hpb=7681cb4079366eb6908dd5d0dc0124c3fcef4b6b diff --git a/source/diameter.comm/ClientSession.cpp b/source/diameter.comm/ClientSession.cpp index fa4a9c3..9db3ca7 100644 --- a/source/diameter.comm/ClientSession.cpp +++ b/source/diameter.comm/ClientSession.cpp @@ -125,25 +125,6 @@ void ClientSession::bind() noexcept(false) { } -void ClientSession::setCERandDWR(const anna::DataBlock & cer, const anna::DataBlock & dwr) noexcept(false) { - if(codec::functions::getCommandId(cer) != helpers::base::COMMANDID__Capabilities_Exchange_Request) { - throw anna::RuntimeException("The message provided as 'CER' is not a Capabilities-Exchange-Request", ANNA_FILE_LOCATION); - } - - if(codec::functions::getCommandId(dwr) != helpers::base::COMMANDID__Device_Watchdog_Request) { - throw anna::RuntimeException("The message provided as 'DWR' is not a Device-Watchdog-Request", ANNA_FILE_LOCATION); - } - - // La verificacion ya se hace implicitamente antes - // if ((a_cer.isEmpty()) || (a_dwr.isEmpty())) { - // LOGDEBUG (anna::Logger::debug ("Must define valid CER and DWR messages before use bind !", ANNA_FILE_LOCATION)); - // return; - // } - a_cer.setBody(cer); - a_dwr.setBody(dwr); -} - - const Response* ClientSession::send(const Message* message) noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "send", ANNA_FILE_LOCATION)); @@ -458,24 +439,24 @@ void ClientSession::eventRequestRetransmission(Message *request) { a_parent->eventRequestRetransmission(this, request); } -void ClientSession::eventResponse(const Response& response) noexcept(false) { +void ClientSession::eventResponse(const Response& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventResponse(response); + a_parent->eventResponse(response, myNode); } -void ClientSession::eventRequest(const anna::DataBlock &request) noexcept(false) { +void ClientSession::eventRequest(const anna::DataBlock &request, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventRequest(this, request); + a_parent->eventRequest(this, request, myNode); } -void ClientSession::eventUnknownResponse(const anna::DataBlock& response) noexcept(false) { +void ClientSession::eventUnknownResponse(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventUnknownResponse(this, response); + a_parent->eventUnknownResponse(this, response, myNode); } -void ClientSession::eventDPA(const anna::DataBlock& response) noexcept(false) { +void ClientSession::eventDPA(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventDPA(this, response); + a_parent->eventDPA(this, response, myNode); } @@ -542,11 +523,10 @@ noexcept(false) { oamModule.count(OamModule::Counter::DPRReceived); if(a_state == State::Bound) { - a_dpr.setBody(db); setState(State::Disconnecting); LOGWARNING(anna::Logger::warning("DPR has been received from peer (diameter server)", ANNA_FILE_LOCATION)); - if(getOTARequests() == 0) sendDPA(); + if(getOTARequests() == 0) sendDPA(a_engine, db); return; // DPR won't be informed because virtual readDPA is available for this } @@ -556,7 +536,7 @@ noexcept(false) { // application message counters ApplicationMessageOamModule::instantiate().count(cid.first, -1 /* no result code */, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Request_Received_AsClient); - eventRequest(db); + eventRequest(db, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); } catch(anna::RuntimeException& ex) { ex.trace(); } @@ -661,7 +641,7 @@ noexcept(false) { // application message counters ApplicationMessageOamModule::instantiate().count(cid.first, resultCode, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Answer_UnknownReceived_AsClient); - eventUnknownResponse(db); + eventUnknownResponse(db, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); string msg(asString()); msg += anna::functions::asString(" | Response received from entity, for non registered context (HopByHop: %u)", hopByHop); throw anna::RuntimeException(msg, ANNA_FILE_LOCATION); @@ -711,7 +691,7 @@ noexcept(false) { if(cid != helpers::base::COMMANDID__Capabilities_Exchange_Answer) ApplicationMessageOamModule::instantiate().count(cid.first, resultCode, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Answer_Received_AsClient); - eventResponse(*response); + eventResponse(*response, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); } catch(anna::RuntimeException& ex) { ex.trace(); } @@ -719,7 +699,7 @@ noexcept(false) { else { // DPA // unbind is automatically performed, anyway we can inform to the application just in case some additional // procedure could be issued: - eventDPA(db); + eventDPA(db, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); } response_erase(response);