Botan  1.11.10
Public Member Functions | List of all members
Botan::Output_Buffers Class Reference

#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 (byte[], size_t, size_t, Pipe::message_id) const
 
size_t read (byte[], size_t, Pipe::message_id)
 
size_t remaining (Pipe::message_id) const
 
void retire ()
 
 ~Output_Buffers ()
 

Detailed Description

Container of output buffers for Pipe

Definition at line 21 of file out_buf.h.

Constructor & Destructor Documentation

Botan::Output_Buffers::Output_Buffers ( )

Definition at line 117 of file out_buf.cpp.

118  {
119  offset = 0;
120  }
Botan::Output_Buffers::~Output_Buffers ( )

Definition at line 125 of file out_buf.cpp.

126  {
127  for(size_t j = 0; j != buffers.size(); ++j)
128  delete buffers[j];
129  }

Member Function Documentation

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(buffers.size() < buffers.max_size(),
69  "Room was available in container");
70 
71  buffers.push_back(queue);
72  }
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
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().

Referenced by Botan::Pipe::get_bytes_read().

54  {
55  SecureQueue* q = get(msg);
56  if (q)
57  return q->get_bytes_read();
58  return 0;
59  }
Pipe::message_id Botan::Output_Buffers::message_count ( ) const

Definition at line 109 of file out_buf.cpp.

Referenced by Botan::Pipe::message_count().

110  {
111  return (offset + buffers.size());
112  }
size_t Botan::Output_Buffers::peek ( byte  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().

Referenced by Botan::Pipe::peek().

32  {
33  SecureQueue* q = get(msg);
34  if(q)
35  return q->peek(output, length, stream_offset);
36  return 0;
37  }
size_t Botan::Output_Buffers::read ( byte  output[],
size_t  length,
Pipe::message_id  msg 
)

Definition at line 17 of file out_buf.cpp.

References Botan::SecureQueue::read().

Referenced by Botan::Pipe::read().

19  {
20  SecureQueue* q = get(msg);
21  if(q)
22  return q->read(output, length);
23  return 0;
24  }
size_t Botan::Output_Buffers::remaining ( Pipe::message_id  msg) const

Definition at line 42 of file out_buf.cpp.

References Botan::SecureQueue::size().

Referenced by Botan::Pipe::remaining().

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

Definition at line 77 of file out_buf.cpp.

Referenced by Botan::Pipe::end_msg().

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

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