Botan 3.6.1
Crypto and TLS for C&
secqueue.h
Go to the documentation of this file.
1/*
2* SecureQueue
3* (C) 1999-2007 Jack Lloyd
4* 2012 Markus Wanner
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#ifndef BOTAN_SECURE_QUEUE_H_
10#define BOTAN_SECURE_QUEUE_H_
11
12#include <botan/data_src.h>
13#include <botan/filter.h>
14
15namespace Botan {
16
17/**
18* A queue that knows how to zeroize itself
19*/
21 public DataSource {
22 public:
23 std::string name() const override { return "Queue"; }
24
25 void write(const uint8_t[], size_t) override;
26
27 size_t read(uint8_t[], size_t) override;
28 size_t peek(uint8_t[], size_t, size_t = 0) const override;
29 size_t get_bytes_read() const override;
30
31 bool end_of_data() const override;
32
33 bool empty() const;
34
35 bool check_available(size_t n) override { return n <= size(); }
36
37 /**
38 * @return number of bytes available in the queue
39 */
40 size_t size() const;
41
42 bool attachable() override { return false; }
43
44 /**
45 * SecureQueue assignment
46 * @param other the queue to copy
47 */
48 SecureQueue& operator=(const SecureQueue& other);
49
50 SecureQueue& operator=(SecureQueue&& other) = delete;
51 SecureQueue(SecureQueue&& other) = delete;
52
53 /**
54 * SecureQueue default constructor (creates empty queue)
55 */
57
58 /**
59 * SecureQueue copy constructor
60 * @param other the queue to copy
61 */
62 SecureQueue(const SecureQueue& other);
63
64 ~SecureQueue() override { destroy(); }
65
66 private:
67 void destroy();
68 size_t m_bytes_read;
69 class SecureQueueNode* m_head;
70 class SecureQueueNode* m_tail;
71};
72
73} // namespace Botan
74
75#endif
SecureQueue & operator=(SecureQueue &&other)=delete
bool check_available(size_t n) override
Definition secqueue.h:35
std::string name() const override
Definition secqueue.h:23
SecureQueue(SecureQueue &&other)=delete
bool attachable() override
Definition secqueue.h:42
~SecureQueue() override
Definition secqueue.h:64
int(* final)(unsigned char *, CTX *)
#define BOTAN_TEST_API
Definition compiler.h:51