X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter.comm%2FClientSession.cpp;h=9db3ca70f12e7cf4fede66d99fcd9e3b9a8198d0;hb=refs%2Fheads%2Fmaster;hp=73d097a40f7c7d67ec28d3c7435c4324175af407;hpb=4e12ac57e93c052f716a6305ad8fc099c45899d1;p=anna.git diff --git a/source/diameter.comm/ClientSession.cpp b/source/diameter.comm/ClientSession.cpp index 73d097a..9db3ca7 100644 --- a/source/diameter.comm/ClientSession.cpp +++ b/source/diameter.comm/ClientSession.cpp @@ -1,37 +1,9 @@ -// ANNA - Anna is Not 'N' Anymore -// -// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo -// -// https://bitbucket.org/testillano/anna -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Authors: eduardo.ramos.testillano@gmail.com -// cisco.tierra@gmail.com +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // #include @@ -50,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +42,6 @@ #include - using namespace std; using namespace anna::diameter; using namespace anna::diameter::comm; @@ -85,7 +57,7 @@ ClientSession::ClientSession() : Session("diameter::comm::ClientSession", "Diame { initialize(); } -void ClientSession::initialize() throw() { +void ClientSession::initialize() { Session::initialize(); a_autoRecovery = true; a_parent = NULL; @@ -97,22 +69,22 @@ void ClientSession::initialize() throw() { //ClientSession::~ClientSession() {;} -const std::string& ClientSession::getAddress() const throw() { +const std::string& ClientSession::getAddress() const { return a_parent->getAddress(); } -int ClientSession::getPort() const throw() { +int ClientSession::getPort() const { return a_parent->getPort(); } -void ClientSession::setState(State::_v state) throw() { +void ClientSession::setState(State::_v state) { Session::setState(state); // Inform father server (availability changes): - bool changes = a_parent->refreshAvailability(); + a_parent->refreshAvailability(); } -void ClientSession::bind() throw(anna::RuntimeException) { +void ClientSession::bind() noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "bind", ANNA_FILE_LOCATION)); if(a_state != State::Closed) @@ -140,7 +112,11 @@ void ClientSession::bind() throw(anna::RuntimeException) { return; } - // OAM Lo comento, porque no se contabilizan los reintentos y por lo tanto no son muy útiles. + // Some operations could be done before sending CER, for example non-standard Origin-Host manipulation for + // Tekelec PCRF + a_engine->bindingClientSession(this); + + // OAM Lo comento, porque no se contabilizan los reintentos y por lo tanto no son muy �tiles. // OamModule &oamModule = OamModule::instantiate(); // oamModule.count(a_server->isAvailable() ? OamModule::Counter::TCPConnectOK:OamModule::Counter::TCPConnectNOK); // Application bind @@ -149,26 +125,7 @@ void ClientSession::bind() throw(anna::RuntimeException) { } -void ClientSession::setCERandDWR(const anna::DataBlock & cer, const anna::DataBlock & dwr) throw(anna::RuntimeException) { - 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) throw(anna::RuntimeException) { +const Response* ClientSession::send(const Message* message) noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "send", ANNA_FILE_LOCATION)); if(!message) @@ -177,6 +134,8 @@ const Response* ClientSession::send(const Message* message) throw(anna::RuntimeE // Command id: bool isRequest; diameter::CommandId cid = message->getCommandId(isRequest); + diameter::ApplicationId aid = message->getApplicationId(); + LOGDEBUG( std::string msg = "Sending diameter message: "; msg += anna::diameter::functions::commandIdAsPairString(cid); @@ -297,7 +256,7 @@ const Response* ClientSession::send(const Message* message) throw(anna::RuntimeE } // Fixing indicator: - fixed = message_nc->fixRequestSequence(a_nextHopByHop, a_nextEndToEnd, a_engine->getFreezeEndToEndOnSending()); + fixed = message_nc->fixRequestSequence(a_nextHopByHop, a_nextEndToEnd); message_nc->updateRequestTimestampMs(); // statistics purposes (processing time for request type) } @@ -320,15 +279,21 @@ const Response* ClientSession::send(const Message* message) throw(anna::RuntimeE // updateOutgoingActivityTime(); // OAM - countSendings(cid, true /* send ok */); + countSendings(cid, aid, true /* send ok */); // Trace non-application messages: LOGDEBUG( - if((cid == helpers::base::COMMANDID__Capabilities_Exchange_Request) || (cid == helpers::base::COMMANDID__Device_Watchdog_Request) || - (cid == helpers::base::COMMANDID__Disconnect_Peer_Request)) { - anna::Logger::debug("Sent DataBlock to XML representation:", ANNA_FILE_LOCATION); - try { anna::diameter::codec::Message msg; msg.decode(message->getBody()); /* decode to be traced */ } catch(anna::RuntimeException&) {;} + (cid == helpers::base::COMMANDID__Disconnect_Peer_Request)) { + anna::Logger::debug("Sent DataBlock to XML representation:", ANNA_FILE_LOCATION); + try { + anna::diameter::codec::Message msg(a_engine->getBaseProtocolCodecEngine()); msg.decode(message->getBody()); /* decode to be traced */ + } + catch(anna::RuntimeException &ex) { + std::string msg = ex.getText(); + msg += " | Use diameter::comm::Engine::setBaseProtocolCodecEngine() to allow internal base protocol messages full tracing"; + anna::Logger::debug(msg, ANNA_FILE_LOCATION); + } } ); @@ -338,7 +303,7 @@ const Response* ClientSession::send(const Message* message) throw(anna::RuntimeE if(fixed) message_nc->restoreSequencesAfterFix(); // restore to application sequences after fix // OAM - countSendings(cid, false /* send no ok */); + countSendings(cid, aid, false /* send no ok */); throw; } @@ -372,7 +337,7 @@ const Response* ClientSession::send(const Message* message) throw(anna::RuntimeE } bool ClientSession::unbind(bool forceDisconnect) -throw(anna::RuntimeException) { +noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "unbind", ANNA_FILE_LOCATION)); if(a_state == State::Closed) @@ -458,24 +423,40 @@ throw(anna::RuntimeException) { return false; } -void ClientSession::eventPeerShutdown() throw() { +void ClientSession::eventPeerShutdown() { // Inform father server: a_parent->eventPeerShutdown(this); } -void ClientSession::eventResponse(const Response& response) throw(anna::RuntimeException) { +void ClientSession::eventRequestRetransmission(Message *request) { + + // OAM + OamModule &oamModule = OamModule::instantiate(); + oamModule.count(OamModule::Counter::RequestRetransmitted); + oamModule.count(OamModule::Counter::RequestRetransmittedOnClientSession); + + // Inform father server: + a_parent->eventRequestRetransmission(this, request); +} + +void ClientSession::eventResponse(const Response& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { + // Inform father server: + a_parent->eventResponse(response, myNode); +} + +void ClientSession::eventRequest(const anna::DataBlock &request, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventResponse(response); + a_parent->eventRequest(this, request, myNode); } -void ClientSession::eventRequest(const anna::DataBlock &request) throw(anna::RuntimeException) { +void ClientSession::eventUnknownResponse(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventRequest(this, request); + a_parent->eventUnknownResponse(this, response, myNode); } -void ClientSession::eventUnknownResponse(const anna::DataBlock& response) throw(anna::RuntimeException) { +void ClientSession::eventDPA(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false) { // Inform father server: - a_parent->eventUnknownResponse(this, response); + a_parent->eventDPA(this, response, myNode); } @@ -484,7 +465,7 @@ void ClientSession::eventUnknownResponse(const anna::DataBlock& response) throw( // Se invoca desde el diameter::comm::Receiver //------------------------------------------------------------------------------------------ void ClientSession::receive(const anna::comm::Message& message) -throw(anna::RuntimeException) { +noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "receive", ANNA_FILE_LOCATION)); // Activity: updateIncomingActivityTime(); @@ -498,15 +479,25 @@ throw(anna::RuntimeException) { msg += anna::diameter::functions::commandIdAsPairString(cid); anna::Logger::debug(msg, ANNA_FILE_LOCATION); - if((cid == helpers::base::COMMANDID__Capabilities_Exchange_Answer) || (cid.first == helpers::base::COMMANDID__Device_Watchdog_Request.first)) - try { anna::diameter::codec::Message dmsg; dmsg.decode(db); /* decode to be traced */ } catch(anna::RuntimeException&) {;} + if( (cid == helpers::base::COMMANDID__Capabilities_Exchange_Answer) || + (cid.first == helpers::base::COMMANDID__Device_Watchdog_Request.first)) { + try { + anna::diameter::codec::Message dmsg(a_engine->getBaseProtocolCodecEngine()); dmsg.decode(db); /* decode to be traced */ + } + catch(anna::RuntimeException &ex) { + std::string msg = ex.getText(); + msg += " | Use diameter::comm::Engine::setBaseProtocolCodecEngine() to allow internal base protocol messages full tracing"; + anna::Logger::debug(msg, ANNA_FILE_LOCATION); + } + } ); + // Main counters: OamModule &oamModule = OamModule::instantiate(); oamModule.count(isRequest ? OamModule::Counter::RequestReceived : OamModule::Counter::AnswerReceived); oamModule.count(isRequest ? OamModule::Counter::RequestReceivedOnClientSession : OamModule::Counter::AnswerReceivedOnClientSession); // Statistic (size) - a_parent->updateReceivedMessageSizeStatisticConcept(message.getSize()); // only on reception (application could manage sent sizes) + a_parent->updateReceivedMessageSizeStatisticConcept(message.getSize(), cid); // only on reception (application could manage sent sizes) if(isRequest) { ///////////////////////////// @@ -532,18 +523,20 @@ throw(anna::RuntimeException) { 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 } } try { - eventRequest(db); + // 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, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); } catch(anna::RuntimeException& ex) { ex.trace(); } @@ -556,12 +549,13 @@ throw(anna::RuntimeException) { ///////////////////////////// bool doUnbind = false; bool immediateUnbind = false; - int resultCode = 0; + int resultCode = -1; try { resultCode = helpers::base::functions::getResultCode(db); } catch(anna::RuntimeException& ex) { - ex.trace(); + // Not always mandatory ... + //ex.trace(); } // Received CEA @@ -578,13 +572,16 @@ throw(anna::RuntimeException) { } if(resultCode != helpers::base::AVPVALUES__Result_Code::DIAMETER_SUCCESS) { - LOGWARNING(anna::Logger::warning("Received CEA with non-success Result-Code. Unbinding connection.", ANNA_FILE_LOCATION)); + LOGWARNING( + std::string msg = anna::functions::asString("Received CEA with non-success Result-Code (%d). Unbinding connection.", resultCode); + anna::Logger::warning(msg, ANNA_FILE_LOCATION); + ); doUnbind = true; } else { setState(State::Bound); //activateTimer(); // Ya se invoca al inicio de este metodo ::receive // Inform father server (availability changes): - bool changes = a_parent->refreshAvailability(); + a_parent->refreshAvailability(); //startClock(); } } @@ -594,7 +591,10 @@ throw(anna::RuntimeException) { setWatchdogState(WatchdogState::WaitingTimerExpiration); if(resultCode != helpers::base::AVPVALUES__Result_Code::DIAMETER_SUCCESS) - LOGWARNING(anna::Logger::warning("Received DWA with non-success Result-Code... but ASSUME keep-alive is reached", ANNA_FILE_LOCATION)); + LOGWARNING( + std::string msg = anna::functions::asString("Received DWA with non-success Result-Code (%d)... but ASSUME keep-alive is reached", resultCode); + anna::Logger::warning(msg, ANNA_FILE_LOCATION); + ); if(a_state == State::Failover) { setState(State::Bound); @@ -615,7 +615,10 @@ throw(anna::RuntimeException) { if(a_state == State::WaitingDPA) { if(resultCode != helpers::base::AVPVALUES__Result_Code::DIAMETER_SUCCESS) { - LOGWARNING(anna::Logger::warning("Received DPA with non-success Result-Code. Ignoring and recovering Bound state", ANNA_FILE_LOCATION)); + LOGWARNING( + std::string msg = anna::functions::asString("Received DPA with non-success Result-Code (%d). Ignoring and recovering Bound state", resultCode); + anna::Logger::warning(msg, ANNA_FILE_LOCATION); + ); setState(State::Bound); } else { LOGWARNING(anna::Logger::warning("Received DPA With Result-Code = DIAMETER_SUCCESS. Disconnect now.", ANNA_FILE_LOCATION)); @@ -634,7 +637,11 @@ throw(anna::RuntimeException) { oamModule.count(OamModule::Counter::AnswerReceivedUnknown); oamModule.count(OamModule::Counter::AnswerReceivedOnClientSessionUnknown); oamModule.activateAlarm(OamModule::Alarm::AnswerReceivedOnClientSessionUnknown); - eventUnknownResponse(db); + + // application message counters + ApplicationMessageOamModule::instantiate().count(cid.first, resultCode, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Answer_UnknownReceived_AsClient); + + 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); @@ -653,20 +660,19 @@ throw(anna::RuntimeException) { anna::Millisecond current = (anna::Millisecond)anna::functions::millisecond(); anna::Millisecond request = response->getRequest()->getRequestTimestampMs(); anna::Millisecond timeToAnswerMs = current - request; - a_parent->updateProcessingTimeStatisticConcept(timeToAnswerMs); - LOGDEBUG - ( - std::string msg = "This diameter request context lasted "; - msg += anna::functions::asString(timeToAnswerMs); - msg += " milliseconds at diameter server (included network time)"; - anna::Logger::debug(msg, ANNA_FILE_LOCATION); - ); + a_parent->updateProcessingTimeStatisticConcept(timeToAnswerMs, cid); + //LOGDEBUG + //( + // std::string msg = "This diameter request context lasted "; + // msg += anna::functions::asString(timeToAnswerMs); + // msg += " milliseconds at diameter server (included network time)"; + // anna::Logger::debug(msg, ANNA_FILE_LOCATION); + //); // Progress origin for tracking purposes on asyncronous boxes with both diameter interfaces (entities and clients) Message * requestMessage = const_cast(response->getRequest()); requestMessage->setRequestServerSessionKey(response->getRequest()->getRequestServerSessionKey()); // -1 means unkown/unset if(cid != helpers::base::COMMANDID__Disconnect_Peer_Answer) { - // don't progress DPA: unbind is automatically performed and not open to any application decision try { response->setMessage(&db); // Restore received datablock @@ -680,11 +686,21 @@ throw(anna::RuntimeException) { ); diameter::codec::functions::setHopByHop((anna::DataBlock&)db, response->getRequest()->getRequestHopByHop()); diameter::codec::functions::setEndToEnd((anna::DataBlock&)db, response->getRequest()->getRequestEndToEnd()); - eventResponse(*response); + + // application message counters + 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, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); } catch(anna::RuntimeException& ex) { ex.trace(); } } + else { // DPA + // unbind is automatically performed, anyway we can inform to the application just in case some additional + // procedure could be issued: + eventDPA(db, nullptr /* client classes have a valid engine usage to distinguish, and get origin host from */); + } response_erase(response); @@ -693,13 +709,11 @@ throw(anna::RuntimeException) { unbind(immediateUnbind); } -void ClientSession::finalize() throw() { +void ClientSession::finalize() { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "finalize", ANNA_FILE_LOCATION)); Session::finalize(); - // Check deprecated entity: - const Entity *entity = getParent() /* server */ ->getParent() /* entity */; // Inform father server (availability changes): - bool changes = a_parent->refreshAvailability(); + a_parent->refreshAvailability(); // OAM const Server *server = getParent(); bool multipleConnections = (server->getMaxClientSessions() > 1); @@ -715,7 +729,7 @@ void ClientSession::finalize() throw() { } } -void ClientSession::recover() throw() { +void ClientSession::recover() { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "recover", ANNA_FILE_LOCATION)); try { @@ -730,7 +744,7 @@ void ClientSession::recover() throw() { } // Inform father server (availability changes): - bool changes = a_parent->refreshAvailability(); + a_parent->refreshAvailability(); // OAM const Server *server = getParent(); bool multipleConnections = (server->getMaxClientSessions() > 1); @@ -747,7 +761,7 @@ void ClientSession::recover() throw() { } void ClientSession::sendDWAToServer(const anna::DataBlock& dwrDB) -throw(anna::RuntimeException) { +noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "sendDWAToServer", ANNA_FILE_LOCATION)); anna::DataBlock dwa(true); a_engine->readDWA(dwa, dwrDB); // Asume that DWA is valid ... @@ -764,7 +778,7 @@ throw(anna::RuntimeException) { // Se invoca desde diameter::comm::Timer //------------------------------------------------------------------------- void ClientSession::expireResponse(diameter::comm::Response* response) -throw() { +{ LOGMETHOD(anna::TraceMethod traceMethod(a_className, "expireResponse", ANNA_FILE_LOCATION)); Session::expireResponse(response); // OAM @@ -787,7 +801,7 @@ throw() { std::string ClientSession::asString() const -throw() { +{ string result = Session::asString(); result += " | Parent Server: "; result += anna::functions::socketLiteralAsString(getAddress(), getPort()); @@ -810,7 +824,7 @@ throw() { } anna::xml::Node* ClientSession::asXML(anna::xml::Node* parent) const -throw() { +{ anna::xml::Node* result = Session::asXML(parent); parent->createChild("diameter.comm.ClientSession"); result->createAttribute("ParentServer", anna::functions::socketLiteralAsString(getAddress(), getPort())); @@ -827,7 +841,7 @@ throw() { const char* ClientSession::asText(const WatchdogState::_v watchdogState) -throw() { +{ static const char* text [] = { "TimerStopped", "WaitingTimerExpiration", "WaitingDWA" }; return text [watchdogState]; } @@ -836,7 +850,7 @@ throw() { //------------------------------------------------------------------------------ //------------------------------------------------------ ClientSession::expire() //------------------------------------------------------------------------------ -void ClientSession::expire(anna::timex::Engine *timeController) throw(anna::RuntimeException) { +void ClientSession::expire(anna::timex::Engine *timeController) noexcept(false) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "expire (watchdog timer)", ANNA_FILE_LOCATION)); // The client MUST NOT close the primary connection until the @@ -873,11 +887,11 @@ void ClientSession::expire(anna::timex::Engine *timeController) throw(anna::Runt activateTimer(); } -void ClientSession::setWatchdogPeriod(const anna::Millisecond & watchdogPeriod) throw() { +void ClientSession::setWatchdogPeriod(const anna::Millisecond & watchdogPeriod) { setTimeout(watchdogPeriod); } -void ClientSession::setWatchdogState(WatchdogState::_v wState) throw() { +void ClientSession::setWatchdogState(WatchdogState::_v wState) { LOGDEBUG( if(wState != a_watchdogState) { @@ -892,12 +906,12 @@ void ClientSession::setWatchdogState(WatchdogState::_v wState) throw() { } -void ClientSession::timerStopped() throw() { +void ClientSession::timerStopped() { LOGDEBUG(anna::Logger::debug("Watchdog timer stopped", ANNA_FILE_LOCATION)); setWatchdogState(WatchdogState::TimerStopped); } -void ClientSession::timerStarted() throw() { +void ClientSession::timerStarted() { LOGDEBUG(anna::Logger::debug("Watchdog timer started", ANNA_FILE_LOCATION)); if(a_watchdogState == WatchdogState::WaitingDWA) return; @@ -909,7 +923,7 @@ void ClientSession::timerStarted() throw() { //------------------------------------------------------------------------------ //---------------------------------- ClientSession::updateIncomingActivityTime() //------------------------------------------------------------------------------ -void ClientSession::updateIncomingActivityTime() throw() { +void ClientSession::updateIncomingActivityTime() { Session::updateIncomingActivityTime(); a_parent->updateIncomingActivityTime(); } @@ -918,7 +932,7 @@ void ClientSession::updateIncomingActivityTime() throw() { //------------------------------------------------------------------------------ //---------------------------------- ClientSession::updateOutgoingActivityTime() //------------------------------------------------------------------------------ -void ClientSession::updateOutgoingActivityTime(void) throw() { +void ClientSession::updateOutgoingActivityTime(void) { Session::updateOutgoingActivityTime(); a_parent->updateOutgoingActivityTime(); } @@ -928,8 +942,10 @@ void ClientSession::updateOutgoingActivityTime(void) throw() { //------------------------------------------------------------------------------ //----------------------------------------------- ClientSession::countSendings() //------------------------------------------------------------------------------ -void ClientSession::countSendings(const diameter::CommandId & cid, bool ok)throw() { +void ClientSession::countSendings(const diameter::CommandId & cid, unsigned int aid, bool ok){ OamModule &oamModule = OamModule::instantiate(); + ApplicationMessageOamModule &appMsgOamModule = ApplicationMessageOamModule::instantiate(); + bool isRequest = cid.second; if(ok) { @@ -942,6 +958,10 @@ void ClientSession::countSendings(const diameter::CommandId & cid, bool ok)throw else if(cid == helpers::base::COMMANDID__Device_Watchdog_Answer) oamModule.count(OamModule::Counter::DWASentOK); // not usual (dwr was received from server) else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Request) oamModule.count(OamModule::Counter::DPRSentOK); else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Answer) oamModule.count(OamModule::Counter::DPASentOK); + // Application messages: + else { + appMsgOamModule.count(cid.first, -1 /* no result code */, aid, isRequest ? ApplicationMessageOamModule::Counter::Request_SentOK_AsClient : ApplicationMessageOamModule::Counter::Answer_SentOK_AsClient); + } } else { // Main counters: oamModule.count(isRequest ? OamModule::Counter::RequestSentNOK : OamModule::Counter::AnswerSentNOK); @@ -952,6 +972,10 @@ void ClientSession::countSendings(const diameter::CommandId & cid, bool ok)throw else if(cid == helpers::base::COMMANDID__Device_Watchdog_Answer) oamModule.count(OamModule::Counter::DWASentNOK); // not usual (dwr was received from server) else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Request) oamModule.count(OamModule::Counter::DPRSentNOK); else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Answer) oamModule.count(OamModule::Counter::DPASentNOK); + // Application messages: + else { + appMsgOamModule.count(cid.first, -1 /* no result code */, aid, isRequest ? ApplicationMessageOamModule::Counter::Request_SentNOK_AsClient : ApplicationMessageOamModule::Counter::Answer_SentNOK_AsClient); + } } }