X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter.comm%2FServerSession.cpp;fp=source%2Fdiameter.comm%2FServerSession.cpp;h=3c493d0bd01b3b0603c74f15b37cb6c58db8d05f;hb=3d71e5185fa9c93bde7363a668aecf96240ae2e9;hp=1be14702ae734307d77b8582c20327e10259bdf7;hpb=5f094136b1817b5c4d14dbcc33c9819a8569cd1e;p=anna.git diff --git a/source/diameter.comm/ServerSession.cpp b/source/diameter.comm/ServerSession.cpp index 1be1470..3c493d0 100644 --- a/source/diameter.comm/ServerSession.cpp +++ b/source/diameter.comm/ServerSession.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -90,6 +91,8 @@ const Response* ServerSession::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); @@ -208,7 +211,7 @@ const Response* ServerSession::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( @@ -225,7 +228,7 @@ const Response* ServerSession::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; } @@ -395,6 +398,9 @@ throw(anna::RuntimeException) { } try { + // application message counters + ApplicationMessageOamModule::instantiate().count(cid.first, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Request_Received_AsServer); + eventRequest(db); } catch(anna::RuntimeException& ex) { ex.trace(); @@ -444,7 +450,12 @@ throw(anna::RuntimeException) { oamModule.count(OamModule::Counter::AnswerReceivedUnknown); oamModule.count(OamModule::Counter::AnswerReceivedOnServerSessionUnknown); oamModule.activateAlarm(OamModule::Alarm::AnswerReceivedOnServerSessionUnknown); + + // application message counters + ApplicationMessageOamModule::instantiate().count(cid.first, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Answer_UnknownReceived_AsServer); + eventUnknownResponse(db); + string msg(asString()); msg += anna::functions::asString(" | Response received from client, for non registered context (HopByHop: %u)", hopByHop); throw anna::RuntimeException(msg, ANNA_FILE_LOCATION); @@ -490,7 +501,12 @@ throw(anna::RuntimeException) { ); diameter::codec::functions::setHopByHop((anna::DataBlock&)db, response->getRequest()->getRequestHopByHop()); diameter::codec::functions::setEndToEnd((anna::DataBlock&)db, response->getRequest()->getRequestEndToEnd()); + + // application message counters + ApplicationMessageOamModule::instantiate().count(cid.first, anna::diameter::codec::functions::getApplicationId(db), ApplicationMessageOamModule::Counter::Answer_Received_AsServer); + eventResponse(*response); + } catch(anna::RuntimeException& ex) { ex.trace(); } @@ -696,8 +712,10 @@ void ServerSession::updateOutgoingActivityTime(void) throw() { //------------------------------------------------------------------------------ //----------------------------------------------- ServerSession::countSendings() //------------------------------------------------------------------------------ -void ServerSession::countSendings(const diameter::CommandId & cid, bool ok)throw() { +void ServerSession::countSendings(const diameter::CommandId & cid, unsigned int aid, bool ok)throw() { OamModule &oamModule = OamModule::instantiate(); + ApplicationMessageOamModule &appMsgOamModule = ApplicationMessageOamModule::instantiate(); + bool isRequest = cid.second; if(ok) { @@ -710,6 +728,10 @@ void ServerSession::countSendings(const diameter::CommandId & cid, bool ok)throw else if(cid == helpers::base::COMMANDID__Device_Watchdog_Request) oamModule.count(OamModule::Counter::DWRSentOK); // not usual else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Answer) oamModule.count(OamModule::Counter::DPASentOK); else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Request) oamModule.count(OamModule::Counter::DPRSentOK); + // Application messages: + else { + appMsgOamModule.count(cid.first, aid, isRequest ? ApplicationMessageOamModule::Counter::Request_SentOK_AsServer : ApplicationMessageOamModule::Counter::Answer_SentOK_AsServer); + } } else { // Main counters: oamModule.count(isRequest ? OamModule::Counter::RequestSentNOK : OamModule::Counter::AnswerSentNOK); @@ -720,6 +742,10 @@ void ServerSession::countSendings(const diameter::CommandId & cid, bool ok)throw else if(cid == helpers::base::COMMANDID__Device_Watchdog_Request) oamModule.count(OamModule::Counter::DWRSentNOK); // not usual else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Answer) oamModule.count(OamModule::Counter::DPASentNOK); else if(cid == helpers::base::COMMANDID__Disconnect_Peer_Request) oamModule.count(OamModule::Counter::DPRSentNOK); + // Application messages: + else { + appMsgOamModule.count(cid.first, aid, isRequest ? ApplicationMessageOamModule::Counter::Request_SentNOK_AsServer : ApplicationMessageOamModule::Counter::Answer_SentNOK_AsServer); + } } }