Botan 1.10.17
global_state.h
Go to the documentation of this file.
1/*
2* Global State Management
3* (C) 2010 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_GLOBAL_STATE_H__
9#define BOTAN_GLOBAL_STATE_H__
10
11#include <botan/build.h>
12
13namespace Botan {
14
15/*
16* Forward declare to avoid recursive dependency between this header
17* and libstate.h
18*/
19class Library_State;
20
21/**
22* Namespace for management of the global state
23*/
25
26/**
27* Access the global library state
28* @return reference to the global library state
29*/
30BOTAN_DLL Library_State& global_state();
31
32/**
33* Set the global state object
34* @param state the new global state to use
35*/
36BOTAN_DLL void set_global_state(Library_State* state);
37
38/**
39* Set the global state object unless it is already set
40* @param state the new global state to use
41* @return true if the state parameter is now being used as the global
42* state, or false if one was already set, in which case the
43* parameter was deleted immediately
44*/
45BOTAN_DLL bool set_global_state_unless_set(Library_State* state);
46
47/**
48* Swap the current state for another
49* @param new_state the new state object to use
50* @return previous state (or NULL if none)
51*/
52BOTAN_DLL Library_State* swap_global_state(Library_State* new_state);
53
54/**
55* Query if the library is currently initialized
56* @return true iff the library is initialized
57*/
58BOTAN_DLL bool global_state_exists();
59
60}
61
62/*
63* Insert into Botan ns for convenience/backwards compatability
64*/
66
67}
68
69#endif
Library_State * swap_global_state(Library_State *new_state)
bool set_global_state_unless_set(Library_State *new_state)
void set_global_state(Library_State *new_state)