}
+//------------------------------------------------------------------------------
+//-------------------------------------------------- Message::setApplicationId()
+//------------------------------------------------------------------------------
+void Message::setApplicationId(U32 aid) throw() {
+ a_applicationId = aid;
+
+ // Default behaviour:
+ if (!getEngine()->selectStackWithApplicationId()) return;
+
+ // Adapts for Application-ID stack identifier:
+ getEngine()->setDictionary(aid);
+}
+
+
//------------------------------------------------------------------------------
//------------------------------------------------------------ Message::addAvp()
//------------------------------------------------------------------------------
//
// VALIDATION PHASE
// Launch exception on first validation error (validateAll == false), or log warning reporting all validation errors when
- // complete validation is desired (validateAll == true, engine default) launching a final exception like "decoded an invalid message".
+ // complete validation is desired (validateAll == true, engine default) launching a final exception like "the decoded message is invalid".
// OAM
OamModule &oamModule = OamModule::instantiate();
U24 code = DECODE3BYTES_INDX_VALUETYPE(buffer, 5, U24);
- setId(CommandId(code, requestBit() /* based on a_flags */));
+ // 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_applicationId = DECODE4BYTES_INDX_VALUETYPE(buffer, 8, U32);
+ setId(CommandId(code, requestBit() /* based on a_flags */));
a_hopByHop = DECODE4BYTES_INDX_VALUETYPE(buffer, 12, U32);
if((vmode == Engine::ValidationMode::AfterDecoding) || (vmode == Engine::ValidationMode::Always))
if(!valid(answer))
- throw anna::RuntimeException("Decoded an invalid message. See previous report on warning-level traces", ANNA_FILE_LOCATION);
+ throw anna::RuntimeException("The decoded message is invalid. See previous report on warning-level traces", ANNA_FILE_LOCATION);
}
a_version = i_aux;
}
+ // 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...
+
// Dictionary
const stack::Dictionary * dictionary = getEngine()->getDictionary();
const stack::Command *stackCommand = NULL;
a_flags = flagsBCK;
}
- // Application-id
- u_aux = appid->getIntegerValue();
-
- /*
- if(u_aux < 0) {
- std::string msg = "Error processing command <application-id '"; msg += appid->getValue();
- msg += "': negative values are not allowed";
- throw anna::RuntimeException(msg, ANNA_FILE_LOCATION);
- }
- */
-
- setApplicationId(u_aux);
-
// Hob-by-hop-id
if(hbh) {
u_aux = hbh->getIntegerValue();