X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter%2Fstack%2FEngine.hpp;h=5dcb44046787c6ebc07c05e900756ee2f31c68d5;hb=1a7a2591d75aef76173a0e8f80bf0183b3b72e82;hp=22848e5af38b20475e3e0f9d6dd1163870b99750;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/diameter/stack/Engine.hpp b/include/anna/diameter/stack/Engine.hpp index 22848e5..5dcb440 100644 --- a/include/anna/diameter/stack/Engine.hpp +++ b/include/anna/diameter/stack/Engine.hpp @@ -2,7 +2,7 @@ // // (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo // -// https://bitbucket.org/testillano/anna +// http://redmine.teslayout.com/projects/anna-suite // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -14,7 +14,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -71,19 +71,20 @@ class Engine : public anna::Singleton { public: - typedef std::map stack_container; + typedef std::map stack_container; typedef stack_container::const_iterator const_stack_iterator; typedef stack_container::iterator stack_iterator; // get /** - * Returns the dictionary registered with the provided identifier + * Returns the dictionary registered with the provided identifier, which commonly + * is the 'Application-Id'. * * @param stackId Stack identifier. * @return Dictionary reference, NULL if no stack found */ - const Dictionary * getDictionary(int stackId) const throw(); + const Dictionary * getDictionary(unsigned int stackId) const throw(); /** Beginning stack iterator */ const_stack_iterator stack_begin() const throw() { return a_stacks.begin(); } @@ -103,9 +104,11 @@ public: /** * Class string representation * + * @param all Complete engine information versus only stacks list with its ids and dictionary names + * * @return String with class content */ - std::string asString(void) const throw(); + std::string asString(bool all = true) const throw(); // set @@ -123,7 +126,7 @@ public: * Dictionary * d = engine->createDictionary(MMS_STACK_ID); * // Loading data: * d->load("/var/tmp/mms.xml"); - * + * ... * Method 3 - Create and then, load data through Dictionary API (*): * Dictionary * d = engine->createDictionary(MMS_STACK_ID); * // Loading data: @@ -136,12 +139,24 @@ public: * * * - * @param stackId Stack identifier for created dictionary. + * @param stackId Stack identifier for created dictionary. We recommend to use the Diameter 'Application-Id' unless + * the application is going to use dictionaries covering different applications (which is not very usual). * @param xmlPathFile Path file to the xml document which represents the diameter dictionary. * * @return Dictionary registered. When exception happen, dictionary can be accessed by #getDictionary */ - Dictionary * createDictionary(int stackId, const std::string & xmlPathFile = "") throw(anna::RuntimeException); + Dictionary * createDictionary(unsigned int stackId, const std::string & xmlPathFile = "") throw(anna::RuntimeException); + + /** + * Register a externally created Dictionary or a derived class from Dictionary + * + * @param stackId Stack identifier for provided dictionary. We recommend to use the Diameter 'Application-Id' unless + * the application is going to use dictionaries covering different applications (which is not very usual). + * @param dictionary Externally created dictionary + * + * @return Dictionary registered. When exception happen, dictionary can be accessed by #getDictionary + */ + Dictionary * registerDictionary(unsigned int stackId, Dictionary *dictionary) throw(anna::RuntimeException); /** * Loads an XML dictionary document over the diameter stack identifiers (one or more stack id's). @@ -151,7 +166,7 @@ public: * @param stacks Stacks identifiers over which the dictionary will be load. * @param xmlPathFile Path file to the xml document which represents the diameter dictionary. */ - void loadDictionary(const std::vector & stacks, const std::string & xmlPathFile) throw(anna::RuntimeException); + void loadDictionary(const std::vector & stacks, const std::string & xmlPathFile) throw(anna::RuntimeException); /** * Loads an XML dictionary document over all the diameter engine registered stacks. When more than one stack id is @@ -172,7 +187,7 @@ public: * * @param stackId Stack identifier for created dictionary */ - void removeStack(int stackId) throw(); + void removeStack(unsigned int stackId) throw(); private: