ValidationMode::_v a_validationMode;
bool a_ignoreFlags;
FixMode::_v a_fixMode;
+ bool a_selectStackWithApplicationId; // default behaviour: let the user switch the stack (false for this boolean)
+
// Auxiliary
const stack::Dictionary * a_dictionary;
virtual ~EngineImpl() {;}
+ // setters
/**
Sets diameter dictionary loaded at stack engine. It's recommended to configure a valid dictionary
(if not, or NULL provided at #setDictionary, all avps will be managed as 'Unknown' format and all
@param dictionary Diameter dictionary. At single threaded processes, the same codec engine could be used with
different diameter dictionaries (multi-stack applications). In that case the process must switch the stack for
- the whole decoding or enconding operation over a Message depending on the context. But the smart way implies
- inherit from this engine creating a component for each diameter stack managed in the application. Inheritance
- is mandatory in multi-threaded processes: one engine, a unique stack.
+ the whole decoding or enconding operation over a Message depending on the context (normally the message header
+ Application-Id is used as stack identifier). But the smart way implies inherit from this engine creating a
+ component for each diameter stack managed in the application. Inheritance is mandatory in multi-threaded processes:
+ one engine, a unique stack.
*/
void setDictionary(const stack::Dictionary * dictionary) throw() { a_dictionary = dictionary; }
- // get
/**
* Sets diameter dictionary loaded at stack engine with the provided identifier.
*
- * @param stackId Stack identifier. When missing, default stack (stack::Engine::getDefaultStack()) will be used
+ * @param stackId Stack identifier. When missing, NULL will be returned
* @return Returns configured dictionary (NULL if stack id was not found)
*/
- const stack::Dictionary *setDictionary(int stackId = -1) throw();
+ const stack::Dictionary *setDictionary(unsigned int stackId) throw();
+
+
+ /**
+ * By default, the user will select the appropiate stack id depending on the context (see #setDictionary), but
+ * some applications could consider interesting automatic stack selection based on managed messages (incoming
+ * decoded ones, or built messages to be encoded). By default, no changes are done through the engine. Multithreaded
+ * processes should have a unique codec engine for each managed stack (this selection is disabled by default, then
+ * you don't have to worry about), but mono processes with multistack implementation over the same-unique engine,
+ * should activate this to have the commonly recommended way to choose the stack: using the Application-Id value.
+ *
+ * @warning do not activate in case of multithreaded applications.
+ * @param enable Activates/deactivates the stack selection from the Application-Id value within the message header.
+ */
+ void selectStackWithApplicationId (bool enable) throw() { a_selectStackWithApplicationId = enable; }
+
+ // getters
+
+ /**
+ Gets the currently configured behaviour regarding stack selection for multistack codec engines in mono thread
+ applications.
+
+ @return True if selection is done with the Application-Id. False if no selection is performed (user responsibility).
+ */
+ bool selectStackWithApplicationId (void) throw() { return a_selectStackWithApplicationId; }
+
/**
Gets currently configured dictionary. NULL if not configured (manual encode/decode operations).