diff options
Diffstat (limited to 'src/core/init_def.cpp')
-rw-r--r-- | src/core/init_def.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/core/init_def.cpp b/src/core/init_def.cpp new file mode 100644 index 000000000..03f97252e --- /dev/null +++ b/src/core/init_def.cpp @@ -0,0 +1,60 @@ +/************************************************* +* Default Initialization Function Source File * +* (C) 1999-2007 Jack Lloyd * +*************************************************/ + +#include <botan/init.h> +#include <botan/libstate.h> +#include <botan/modules.h> + +namespace Botan { + +/************************************************* +* Library Initialization * +*************************************************/ +void LibraryInitializer::initialize(const InitializerOptions& args, + Modules& modules) + { + try + { + set_global_state(new Library_State); + + global_state().initialize(args, modules); + } + catch(...) + { + deinitialize(); + throw; + } + } + +/************************************************* +* Library Shutdown * +*************************************************/ +void LibraryInitializer::deinitialize() + { + set_global_state(0); + } + +/************************************************* +* Library Initialization * +*************************************************/ +void LibraryInitializer::initialize(const std::string& arg_string) + { + InitializerOptions args(arg_string); + Builtin_Modules modules(args); + + initialize(args, modules); + } + +/************************************************* +* Library Initialization * +*************************************************/ +void LibraryInitializer::initialize(const InitializerOptions& args) + { + Builtin_Modules modules(args); + + initialize(args, modules); + } + +} |