aboutsummaryrefslogtreecommitdiffstats
path: root/include/config.h
blob: 6a6a4fa103d490102801d76fe117d882cdb965b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*************************************************
* Configuration Handling Header File             *
* (C) 1999-2008 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_POLICY_CONF_H__
#define BOTAN_POLICY_CONF_H__

#include <botan/mutex.h>
#include <string>
#include <map>

namespace Botan {

/*************************************************
* Library Configuration Settings                 *
*************************************************/
class BOTAN_DLL Config
   {
   public:
      Config();
      ~Config();

      void load_defaults();

      std::string get(const std::string&, const std::string&) const;
      bool is_set(const std::string&, const std::string&) const;
      void set(const std::string&, const std::string&,
               const std::string&, bool = true);

      std::string option(const std::string&) const;
      u32bit option_as_time(const std::string&) const;

      void set_option(const std::string, const std::string&);

      void add_alias(const std::string&, const std::string&);
      std::string deref_alias(const std::string&) const;

      void load_inifile(const std::string&);
   private:
      Config(const Config&) {}
      Config& operator=(const Config&) { return (*this); }

      std::map<std::string, std::string> settings;
      Mutex* mutex;
   };

/*************************************************
* Hook for the global config                     *
*************************************************/
BOTAN_DLL Config& global_config();

}

#endif