X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter%2Fcodec%2FMessage.cpp;h=b286fbcab801c7ad2db38aa31a64998a616b9be2;hb=42f606f1c76bfbef24e7e772b6939d69d5ea970e;hp=4938a031e04f68c8ffe77490e2c0f3b03b850702;hpb=ad7fdc865803176f1dd1696960073f616cfa3fda;p=anna.git diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 4938a03..b286fbc 100644 --- a/source/diameter/codec/Message.cpp +++ b/source/diameter/codec/Message.cpp @@ -234,7 +234,7 @@ void Message::setApplicationId(U32 aid) throw() { a_applicationId = aid; // Default behaviour: - if (!getEngine()->selectStackWithApplicationId()) return; + if (!getEngine()->hasSelectStackWithApplicationId()) return; // Adapts for Application-ID stack identifier: getEngine()->setDictionary(aid); @@ -345,10 +345,9 @@ void Message::decode(const anna::DataBlock &db, Message *ptrAnswer) throw(anna:: U24 code = DECODE3BYTES_INDX_VALUETYPE(buffer, 5, U24); - // This is called before setId, and in general before any operation which needs to know about the stack elements. - setApplicationId(DECODE4BYTES_INDX_VALUETYPE(buffer, 8, U32)); // centralize set, because it could be used for stack selection. + a_id = CommandId(code, requestBit() /* based on a_flags */); - setId(CommandId(code, requestBit() /* based on a_flags */)); + setApplicationId(DECODE4BYTES_INDX_VALUETYPE(buffer, 8, U32)); // centralize set, because it could be used for stack selection. a_hopByHop = DECODE4BYTES_INDX_VALUETYPE(buffer, 12, U32); @@ -660,7 +659,7 @@ const anna::DataBlock & Message::code() throw(anna::RuntimeException) { // Pre-Validation Engine::ValidationMode::_v vmode = getEngine()->getValidationMode(); - if((vmode == Engine::ValidationMode::BeforeCoding) || (vmode == Engine::ValidationMode::Always)) { + if((vmode == Engine::ValidationMode::BeforeEncoding) || (vmode == Engine::ValidationMode::Always)) { if(!valid()) throw anna::RuntimeException("Try to encode an invalid message. See previous report on warning-level traces", ANNA_FILE_LOCATION); } @@ -668,7 +667,7 @@ const anna::DataBlock & Message::code() throw(anna::RuntimeException) { // Pre-Fixing Engine::FixMode::_v fmode = getEngine()->getFixMode(); - if((fmode == Engine::FixMode::BeforeCoding) || (fmode == Engine::FixMode::Always)) fix(); + if((fmode == Engine::FixMode::BeforeEncoding) || (fmode == Engine::FixMode::Always)) fix(); // Trace LOGDEBUG( @@ -771,6 +770,9 @@ void Message::fromXML(const anna::xml::Node* messageNode) throw(anna::RuntimeExc int i_aux; unsigned int u_aux; + // Clear the message + clear(); + if(version) { i_aux = version->getIntegerValue(); @@ -784,8 +786,8 @@ void Message::fromXML(const anna::xml::Node* messageNode) throw(anna::RuntimeExc } // Application-id - // This is called before setId, and in general before any operation which needs to know about the stack elements. - setApplicationId(appid->getIntegerValue()); // this could set the dictionary... + // This is called before any operation which needs to know about the stack elements (this could set the dictionary) + setApplicationId(appid->getIntegerValue()); // Dictionary const stack::Dictionary * dictionary = getEngine()->getDictionary(); @@ -816,7 +818,7 @@ void Message::fromXML(const anna::xml::Node* messageNode) throw(anna::RuntimeExc throw anna::RuntimeException(msg, ANNA_FILE_LOCATION); } - setId(stackCommand->getId()); + setId(stackCommand->getId(), false /* don't clear */); // 'P', 'E' and 'T' flags: bool activateP = pbit ? (pbit->getValue() == "yes") : false; bool activateE = ebit ? (ebit->getValue() == "yes") : false; @@ -867,7 +869,7 @@ void Message::fromXML(const anna::xml::Node* messageNode) throw(anna::RuntimeExc a_flags = i_aux; int flagsBCK = a_flags; // Final assignments - setId(CommandId(u_code, requestBit() /* based on a_flags */)); + a_id = CommandId(u_code, requestBit() /* based on a_flags */); // Flags could have been updated regarding dictionary, but during parsing we must respect xml file: a_flags = flagsBCK; }