X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;ds=sidebyside;f=source%2Fdiameter%2Fcodec%2FMessage.cpp;h=ddf769482f4ae974ed684c027452155153085159;hb=d723d5bf571eb48c641b092058eaa38bb6c4fcc8;hp=6593dd4626d22472995683a626ef1108abddf2d3;hpb=8a83c3072f9c073ad0b29e79c19ca88e1ac636d9;p=anna.git diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 6593dd4..ddf7694 100644 --- a/source/diameter/codec/Message.cpp +++ b/source/diameter/codec/Message.cpp @@ -84,7 +84,12 @@ Message::~Message() { //------------------------------------------------------------------------------ void Message::setEngine(Engine *engine) throw() { - if (a_engine && engine != a_engine) { + if (!engine) { + LOGWARNING(anna::Logger::warning("Ignored: you must assign a valid codec engine. If you want to set NULL engine, clear the message", ANNA_FILE_LOCATION)); + return; + } + + if (a_engine && (engine != a_engine)) { LOGWARNING(anna::Logger::warning("Ignored: it is not a good practice to change the codec engine once assigned. Clear the message first to set the engine again.", ANNA_FILE_LOCATION)); return; } @@ -145,7 +150,9 @@ bool Message::flagsOK(int &rc) const throw() { const stack::Command *stackCommand = getStackCommand(); if(!stackCommand) { - anna::Logger::error("Impossible to decide if flags are correct because stack command is not identified. Assume flags ok", ANNA_FILE_LOCATION); + std::string msg = "Impossible to decide if flags are correct because stack command is not identified. Assume flags ok for Message "; + msg += anna::diameter::functions::commandIdAsPairString(a_id); + anna::Logger::error(msg, ANNA_FILE_LOCATION); //rc = helpers::base::AVPVALUES__Result_Code::?????; return true; }; @@ -160,12 +167,16 @@ bool Message::flagsOK(int &rc) const throw() { if(stackCommand->isRequest() != isRequest()) ok = false; // en teoria es imposible salir por aqui: blindado en la dtd if(isRequest() && errorBit()) { - anna::Logger::error("E(rror) bit is not allowed at diameter requests", ANNA_FILE_LOCATION); + std::string msg = "E(rror) bit is not allowed at diameter requests as "; + msg += stackCommand->getName(); + anna::Logger::error(msg, ANNA_FILE_LOCATION); ok = false; } if(isAnswer() && potentiallyReTransmittedMessageBit()) { - anna::Logger::error("T(Potentially re-transmitted message) bit is not allowed at diameter answers", ANNA_FILE_LOCATION); + std::string msg = "T(Potentially re-transmitted message) bit is not allowed at diameter answers as "; + msg += stackCommand->getName(); + anna::Logger::error(msg, ANNA_FILE_LOCATION); ok = false; } @@ -180,7 +191,9 @@ bool Message::flagsOK(int &rc) const throw() { // is set to one (1) or the bits in the Diameter header are set // incorrectly. if((a_flags & 0x0f) != 0x00) { - anna::Logger::error("Any (or more than one) of the reserved message flags bit has been activated. Reserved bits must be null", ANNA_FILE_LOCATION); + std::string msg = "Any (or more than one) of the reserved message flags bit has been activated. Reserved bits must be null. Message is "; + msg += stackCommand->getName(); + anna::Logger::error(msg, ANNA_FILE_LOCATION); rc = helpers::base::AVPVALUES__Result_Code::DIAMETER_INVALID_BIT_IN_HEADER; return false; }