Botan 3.6.1
Crypto and TLS for C&
Botan::Output_Buffers Class Referencefinal

#include <out_buf.h>

Public Member Functions

void add (SecureQueue *)
 
size_t get_bytes_read (Pipe::message_id) const
 
Pipe::message_id message_count () const
 
 Output_Buffers ()
 
size_t peek (uint8_t[], size_t, size_t, Pipe::message_id) const
 
size_t read (uint8_t[], size_t, Pipe::message_id)
 
size_t remaining (Pipe::message_id) const
 
void retire ()
 

Detailed Description

Container of output buffers for Pipe

Definition at line 23 of file out_buf.h.

Constructor & Destructor Documentation

◆ Output_Buffers()

Botan::Output_Buffers::Output_Buffers ( )

Definition at line 109 of file out_buf.cpp.

109 {
110 m_offset = 0;
111}

Member Function Documentation

◆ add()

void Botan::Output_Buffers::add ( SecureQueue * queue)

Definition at line 62 of file out_buf.cpp.

62 {
63 BOTAN_ASSERT(queue, "queue was provided");
64
65 BOTAN_ASSERT(m_buffers.size() < m_buffers.max_size(), "Room was available in container");
66
67 m_buffers.push_back(std::unique_ptr<SecureQueue>(queue));
68}
#define BOTAN_ASSERT(expr, assertion_made)
Definition assert.h:50

References BOTAN_ASSERT.

◆ get_bytes_read()

size_t Botan::Output_Buffers::get_bytes_read ( Pipe::message_id msg) const

Definition at line 51 of file out_buf.cpp.

51 {
52 SecureQueue* q = get(msg);
53 if(q) {
54 return q->get_bytes_read();
55 }
56 return 0;
57}

References Botan::SecureQueue::get_bytes_read().

◆ message_count()

Pipe::message_id Botan::Output_Buffers::message_count ( ) const

Definition at line 102 of file out_buf.cpp.

102 {
103 return (m_offset + m_buffers.size());
104}

◆ peek()

size_t Botan::Output_Buffers::peek ( uint8_t output[],
size_t length,
size_t stream_offset,
Pipe::message_id msg ) const

Definition at line 29 of file out_buf.cpp.

29 {
30 SecureQueue* q = get(msg);
31 if(q) {
32 return q->peek(output, length, stream_offset);
33 }
34 return 0;
35}

References Botan::SecureQueue::peek().

◆ read()

size_t Botan::Output_Buffers::read ( uint8_t output[],
size_t length,
Pipe::message_id msg )

Definition at line 18 of file out_buf.cpp.

18 {
19 SecureQueue* q = get(msg);
20 if(q) {
21 return q->read(output, length);
22 }
23 return 0;
24}

References Botan::SecureQueue::read().

◆ remaining()

size_t Botan::Output_Buffers::remaining ( Pipe::message_id msg) const

Definition at line 40 of file out_buf.cpp.

40 {
41 SecureQueue* q = get(msg);
42 if(q) {
43 return q->size();
44 }
45 return 0;
46}

References Botan::SecureQueue::size().

◆ retire()

void Botan::Output_Buffers::retire ( )

Definition at line 73 of file out_buf.cpp.

73 {
74 for(auto& buf : m_buffers) {
75 if(buf && buf->empty()) {
76 buf.reset();
77 }
78 }
79
80 while(!m_buffers.empty() && !m_buffers[0]) {
81 m_buffers.pop_front();
82 m_offset = m_offset + Pipe::message_id(1);
83 }
84}
size_t message_id
Definition pipe.h:34

The documentation for this class was generated from the following files: