Botan 1.10.17
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
14namespace Botan {
15
16/**
17* A queue that knows how to zeroize itself
18*/
19class 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 bool check_available(size_t n) { return n <= size(); }
39
40 /**
41 * SecureQueue assignment
42 * @param other the queue to copy
43 */
44 SecureQueue& operator=(const SecureQueue& other);
45
46 /**
47 * SecureQueue default constructor (creates empty queue)
48 */
50
51 /**
52 * SecureQueue copy constructor
53 * @param other the queue to copy
54 */
55 SecureQueue(const SecureQueue& other);
56
57 ~SecureQueue() { destroy(); }
58 private:
59 void destroy();
60 class SecureQueueNode* head;
61 class SecureQueueNode* tail;
62 };
63
64}
65
66#endif
size_t size() const
Definition secqueue.cpp:190
bool check_available(size_t n)
Definition secqueue.h:38
std::string name() const
Definition secqueue.h:22