aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/algo_factory.h
blob: 57b94fbb30c2f63dca524aa2c4b5b80ca97e4e97 (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
/**
* Algorithm Factory
* (C) 2008 Jack Lloyd
*/

#ifndef BOTAN_ALGORITHM_FACTORY_H__
#define BOTAN_ALGORITHM_FACTORY_H__

#include <botan/scan_name.h>
#include <botan/mutex.h>
#include <botan/hash.h>
#include <string>
#include <vector>

namespace Botan {

/**
* Algorithm Factory
*/
class BOTAN_DLL Algorithm_Factory
   {
   public:
      ~Algorithm_Factory();

      const HashFunction* prototype_hash_function(const SCAN_Name& request);
      HashFunction* make_hash_function(const SCAN_Name& request);

      void add_engine(class Engine*);

      class BOTAN_DLL Engine_Iterator
         {
         public:
            class Engine* next() { return af.get_engine_n(n++); }
            Engine_Iterator(const Algorithm_Factory& a) : af(a) { n = 0; }
         private:
            const Algorithm_Factory& af;
            u32bit n;
         };
      friend class Engine_Iterator;

   private:
      class Engine* get_engine_n(u32bit) const;

      std::vector<class Engine*> engines;
   };

}

#endif