X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter%2Fcodec%2FEngineImpl.cpp;h=50b8134ccd996e38d79476b16e5cea3210c45a88;hb=e782294456d0877aa8fc05aa931291ac79808eb3;hp=5d24eb978fa21bcf61cef96d2955a8bb316a5150;hpb=129500a50678c43ff28fb0054d6197899b8c0b2c;p=anna.git diff --git a/source/diameter/codec/EngineImpl.cpp b/source/diameter/codec/EngineImpl.cpp index 5d24eb9..50b8134 100644 --- a/source/diameter/codec/EngineImpl.cpp +++ b/source/diameter/codec/EngineImpl.cpp @@ -23,114 +23,22 @@ #include - -namespace anna { -namespace diameter { -namespace codec { - -const char *MessageDTD = "\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -"; - - -} -} -} - using namespace anna::diameter::codec; //------------------------------------------------------------------------------ //----------------------------------------------------- EngineImpl::EngineImpl() //------------------------------------------------------------------------------ -EngineImpl::EngineImpl(const char* className) : +EngineImpl::EngineImpl(const char* className, const stack::Dictionary * dictionary) : anna::Component(className), - a_dictionary(NULL), + a_dictionary(dictionary), a_validationDepth(ValidationDepth::FirstError), a_validationMode(ValidationMode::AfterDecoding), + a_singleFailedAVP(true), a_ignoreFlags(false), - a_selectStackWithApplicationId(false), a_fixMode(FixMode::BeforeEncoding) { anna::diameter::sccs::activate(); anna::xml::functions::initialize(); - a_dtd.initialize(MessageDTD); -} - - -//------------------------------------------------------------------------------ -//-------------------------------------------------- EngineImpl::setDictionary() -//------------------------------------------------------------------------------ -const anna::diameter::stack::Dictionary *EngineImpl::setDictionary(unsigned int stackId) throw() { - a_dictionary = (stack::Engine::instantiate()).getDictionary(stackId); - return a_dictionary; } @@ -177,9 +85,13 @@ Message* EngineImpl::createMessage(const CommandId *id) throw(anna::RuntimeExcep //------------------------------------------------------------------------------ //-------------------------------------------------- EngineImpl::createMessage() //------------------------------------------------------------------------------ -Message *EngineImpl::createMessage(const std::string & xmlPathFile) throw(anna::RuntimeException) { +Message *EngineImpl::createMessage(const std::string & xmlPathFile_or_string, bool pathfile_or_string) throw(anna::RuntimeException) { Message *result = createMessage(); - result->loadXML(xmlPathFile); + if (pathfile_or_string) + result->loadXMLFile(xmlPathFile_or_string); + else + result->loadXMLString(xmlPathFile_or_string); + return result; } @@ -191,12 +103,14 @@ std::string EngineImpl::asString(void) const throw() { result += asText(a_validationDepth); result += "\nValidationMode: "; result += asText(a_validationMode); + result += "\nSingle Failed-AVP: "; + result += a_singleFailedAVP ? "yes" : "no"; result += "\nIgnore flags: "; result += a_ignoreFlags ? "yes" : "no"; result += "\nFixMode: "; result += asText(a_fixMode); result += "\nActivated Dictionary: "; - result += a_dictionary ? (a_dictionary->getName()) : ""; + result += a_dictionary ? (a_dictionary->getName()) : "[null]"; return result; } @@ -209,9 +123,10 @@ throw() { anna::xml::Node* result = parent->createChild("diameter.codec.EngineImpl"); result->createAttribute("ValidationDepth", asText(a_validationDepth)); result->createAttribute("ValidationMode", asText(a_validationMode)); + result->createAttribute("SingleFailedAVP", a_singleFailedAVP ? "yes" : "no"); result->createAttribute("IgnoreFlags", a_ignoreFlags ? "yes" : "no"); result->createAttribute("FixMode", asText(a_fixMode)); - anna::xml::Node* dictionary = result->createChild("EngineImpl.ActivatedDictionary"); + result->createChild("EngineImpl.ActivatedDictionary"); if(a_dictionary) a_dictionary->asXML(result);