Botan 2.19.5 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
15 BOTAN_FUTURE_INTERNAL_HEADER(secqueue.h)
16
17namespace Botan {
18
19/**
20* A queue that knows how to zeroize itself
21*/
22 class BOTAN_PUBLIC_API(2,0) SecureQueue final : public Fanout_Filter, public DataSource
23 {
24 public:
25 std::string name() const override { return "Queue"; }
26
27 void write(const uint8_t[], size_t) override;
28
29 size_t read(uint8_t[], size_t) override;
30 size_t peek(uint8_t[], size_t, size_t = 0) const override;
31 size_t get_bytes_read() const override;
32
33 bool end_of_data() const override;
34
35 bool empty() const;
36
37 bool check_available(size_t n) override { return n <= size(); }
38
39 /**
40 * @return number of bytes available in the queue
41 */
42 size_t size() const;
43
44 bool attachable() override { return false; }
45
46 /**
47 * SecureQueue assignment
48 * @param other the queue to copy
49 */
50 SecureQueue& operator=(const SecureQueue& other);
51
52 /**
53 * SecureQueue default constructor (creates empty queue)
54 */
55 SecureQueue();
56
57 /**
58 * SecureQueue copy constructor
59 * @param other the queue to copy
60 */
61 SecureQueue(const SecureQueue& other);
62
63 ~SecureQueue() { destroy(); }
64
65 private:
66 void destroy();
67 size_t m_bytes_read;
68 class SecureQueueNode* m_head;
69 class SecureQueueNode* m_tail;
70 };
71
72}
73
74#endif
Botan::DataSource
Definition: data_src.h:22
Botan::DataSource::get_bytes_read
virtual size_t get_bytes_read() const =0
Botan::DataSource::peek
virtual size_t peek(uint8_t out[], size_t length, size_t peek_offset) const BOTAN_WARN_UNUSED_RESULT=0
Botan::DataSource::read
virtual size_t read(uint8_t out[], size_t length) BOTAN_WARN_UNUSED_RESULT=0
Botan::DataSource::end_of_data
virtual bool end_of_data() const =0
Botan::Fanout_Filter
Definition: filter.h:145
Botan::Filter::write
virtual void write(const uint8_t input[], size_t length)=0
Botan::Filter::operator=
Filter & operator=(const Filter &)=delete
Botan::SecureQueue
Definition: secqueue.h:23
Botan::SecureQueue::~SecureQueue
~SecureQueue()
Definition: secqueue.h:63
Botan::SecureQueue::check_available
bool check_available(size_t n) override
Definition: secqueue.h:37
Botan::SecureQueue::name
std::string name() const override
Definition: secqueue.h:25
Botan::SecureQueue::attachable
bool attachable() override
Definition: secqueue.h:44
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Botan
Definition: alg_id.cpp:13