aboutsummaryrefslogtreecommitdiffstats
path: root/include/ui.h
blob: a956518d62d24958825565068823c3f60802966e (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
56
57
58
59
60
61
62
63
/*************************************************
* User Interface Header File                     *
* (C) 1999-2006 The Botan Project                *
*************************************************/

#ifndef BOTAN_UI_H__
#define BOTAN_UI_H__

#include <string>

namespace Botan {

/*************************************************
* User Interface                                 *
*************************************************/
class User_Interface
   {
   public:
      enum UI_Result { OK, CANCEL_ACTION };

      virtual std::string get_passphrase(const std::string&,
                                         const std::string&,
                                         UI_Result&) const;
      User_Interface(const std::string& = "");
      virtual ~User_Interface() {}
   protected:
      const std::string preset_passphrase;
      mutable bool first_try;
   };

namespace UI {

/*************************************************
* Pulse Function                                 *
*************************************************/
enum Pulse_Type {
   GENERAL_PULSE,

   PIPE_WRITE,

   PRIME_SEARCHING,
   PRIME_SIEVING,
   PRIME_PASSED_SIEVE,
   PRIME_TESTING,
   PRIME_FOUND
};
typedef void (*pulse_func)(Pulse_Type, void*);

/*************************************************
* Set the UI pulse function                      *
*************************************************/
void set_pulse(pulse_func, void* = 0);

/*************************************************
* Call the UI pulse function                     *
*************************************************/
void pulse(Pulse_Type = GENERAL_PULSE);

}

}

#endif