Botan 2.19.1
Crypto and TLS for C&
Public Member Functions | List of all members
Botan::Output_Buffers Class Referencefinal

#include <out_buf.h>

Public Member Functions

void add (class 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 21 of file out_buf.h.

Constructor & Destructor Documentation

◆ Output_Buffers()

Botan::Output_Buffers::Output_Buffers ( )

Definition at line 116 of file out_buf.cpp.

117 {
118 m_offset = 0;
119 }

Member Function Documentation

◆ add()

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

Definition at line 64 of file out_buf.cpp.

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

References BOTAN_ASSERT.

◆ get_bytes_read()

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

Definition at line 53 of file out_buf.cpp.

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

References Botan::SecureQueue::get_bytes_read().

◆ message_count()

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

Definition at line 108 of file out_buf.cpp.

109 {
110 return (m_offset + m_buffers.size());
111 }

◆ 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.

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

References Botan::SecureQueue::peek().

◆ read()

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

Definition at line 17 of file out_buf.cpp.

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

References Botan::SecureQueue::read().

◆ remaining()

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

Definition at line 42 of file out_buf.cpp.

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

References Botan::SecureQueue::size().

◆ retire()

void Botan::Output_Buffers::retire ( )

Definition at line 77 of file out_buf.cpp.

78 {
79 for(size_t i = 0; i != m_buffers.size(); ++i)
80 if(m_buffers[i] && m_buffers[i]->size() == 0)
81 {
82 m_buffers[i].reset();
83 }
84
85 while(m_buffers.size() && !m_buffers[0])
86 {
87 m_buffers.pop_front();
88 m_offset = m_offset + Pipe::message_id(1);
89 }
90 }
size_t message_id
Definition: pipe.h:35

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