Botan  2.7.0
Crypto and TLS for C++11
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.

References BOTAN_ASSERT.

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:43

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

References Botan::SecureQueue::get_bytes_read().

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

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

References Botan::SecureQueue::peek().

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

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

References Botan::SecureQueue::read().

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

◆ remaining()

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

Definition at line 42 of file out_buf.cpp.

References Botan::SecureQueue::size().

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

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