Botan  1.10.9
secqueue.h
Go to the documentation of this file.
1 /*
2 * SecureQueue
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_SECURE_QUEUE_H__
9 #define BOTAN_SECURE_QUEUE_H__
10 
11 #include <botan/data_src.h>
12 #include <botan/filter.h>
13 
14 namespace Botan {
15 
16 /**
17 * A queue that knows how to zeroize itself
18 */
19 class BOTAN_DLL SecureQueue : public Fanout_Filter, public DataSource
20  {
21  public:
22  std::string name() const { return "Queue"; }
23 
24  void write(const byte[], size_t);
25 
26  size_t read(byte[], size_t);
27  size_t peek(byte[], size_t, size_t = 0) const;
28 
29  bool end_of_data() const;
30 
31  /**
32  * @return number of bytes available in the queue
33  */
34  size_t size() const;
35 
36  bool attachable() { return false; }
37 
38  /**
39  * SecureQueue assignment
40  * @param other the queue to copy
41  */
42  SecureQueue& operator=(const SecureQueue& other);
43 
44  /**
45  * SecureQueue default constructor (creates empty queue)
46  */
47  SecureQueue();
48 
49  /**
50  * SecureQueue copy constructor
51  * @param other the queue to copy
52  */
53  SecureQueue(const SecureQueue& other);
54 
55  ~SecureQueue() { destroy(); }
56  private:
57  void destroy();
58  class SecureQueueNode* head;
59  class SecureQueueNode* tail;
60  };
61 
62 }
63 
64 #endif
bool attachable()
Definition: secqueue.h:36
unsigned char byte
Definition: types.h:22
std::string name() const
Definition: secqueue.h:22