X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter%2Fcodec%2FMessage.cpp;h=b374b90e058064a88e3219e5ed1f325c7b5fc629;hb=a67b088509f8ff740f206e8e928ae1db92b25e0c;hp=4938a031e04f68c8ffe77490e2c0f3b03b850702;hpb=db04ba506b776f4fd925df83a3d092687cf674c5;p=anna.git diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 4938a03..b374b90 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); @@ -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; }