#include <secqueue.h>

Public Member Functions | |
| bool | attachable () |
| u32bit | discard_next (u32bit N) |
| virtual void | end_msg () |
| bool | end_of_data () const |
| virtual std::string | id () const |
| std::string | name () const |
| SecureQueue & | operator= (const SecureQueue &) |
| u32bit | peek (byte[], u32bit, u32bit=0) const |
| u32bit | peek_byte (byte &out) const |
| u32bit | read (byte[], u32bit) |
| u32bit | read_byte (byte &out) |
| SecureQueue (const SecureQueue &) | |
| SecureQueue () | |
| u32bit | size () const |
| virtual void | start_msg () |
| void | write (const byte[], u32bit) |
| ~SecureQueue () | |
Protected Member Functions | |
| void | attach (Filter *f) |
| void | incr_owns () |
| void | send (const MemoryRegion< byte > &in) |
| void | send (byte in) |
| void | send (const byte in[], u32bit length) |
| void | set_next (Filter *f[], u32bit n) |
| void | set_port (u32bit n) |
Definition at line 19 of file secqueue.h.
| Botan::SecureQueue::SecureQueue | ( | ) |
Definition at line 58 of file secqueue.cpp.
References Botan::Fanout_Filter::set_next().
00059 { 00060 set_next(0, 0); 00061 head = tail = new SecureQueueNode; 00062 }
| Botan::SecureQueue::SecureQueue | ( | const SecureQueue & | input | ) |
Definition at line 67 of file secqueue.cpp.
References head, Botan::Fanout_Filter::set_next(), and write().
00067 : 00068 Fanout_Filter(), DataSource() 00069 { 00070 set_next(0, 0); 00071 00072 head = tail = new SecureQueueNode; 00073 SecureQueueNode* temp = input.head; 00074 while(temp) 00075 { 00076 write(temp->buffer + temp->start, temp->end - temp->start); 00077 temp = temp->next; 00078 } 00079 }
| Botan::SecureQueue::~SecureQueue | ( | ) | [inline] |
| void Botan::Fanout_Filter::attach | ( | Filter * | f | ) | [inline, protected, inherited] |
Attach another filter to this one
| f | filter to attach |
Reimplemented from Botan::Filter.
Definition at line 136 of file filter.h.
Referenced by Botan::Chain::Chain().
00136 { Filter::attach(f); }
| bool Botan::SecureQueue::attachable | ( | ) | [inline, virtual] |
Check whether this filter is an attachable filter.
Reimplemented from Botan::Filter.
Definition at line 31 of file secqueue.h.
Discard the next N bytes of the data
| N | the number of bytes to discard |
Definition at line 36 of file data_src.cpp.
References Botan::DataSource::read_byte().
00037 { 00038 u32bit discarded = 0; 00039 byte dummy; 00040 for(u32bit j = 0; j != n; ++j) 00041 discarded += read_byte(dummy); 00042 return discarded; 00043 }
| virtual void Botan::Filter::end_msg | ( | ) | [inline, virtual, inherited] |
Notify that the current message is finished; flush buffers and do end-of-message processing (if any).
Reimplemented in Botan::Base64_Encoder, Botan::Base64_Decoder, Botan::Bzip_Compression, Botan::Bzip_Decompression, Botan::Hash_Filter, Botan::MAC_Filter, Botan::Hex_Encoder, Botan::Hex_Decoder, Botan::PK_Encryptor_Filter, Botan::PK_Decryptor_Filter, Botan::PK_Signer_Filter, Botan::PK_Verifier_Filter, Botan::Zlib_Compression, Botan::Zlib_Decompression, Botan::PBE_PKCS5v15, and Botan::PBE_PKCS5v20.
Definition at line 44 of file filter.h.
| bool Botan::SecureQueue::end_of_data | ( | ) | const [virtual] |
Test whether the source still has data that can be read.
Implements Botan::DataSource.
Definition at line 204 of file secqueue.cpp.
References size().
00205 { 00206 return (size() == 0); 00207 }
| virtual std::string Botan::DataSource::id | ( | ) | const [inline, virtual, inherited] |
return the id of this data source
Reimplemented in Botan::DataSource_Command, and Botan::DataSource_Stream.
Definition at line 57 of file data_src.h.
| void Botan::Fanout_Filter::incr_owns | ( | ) | [inline, protected, inherited] |
Increment the number of filters past us that we own
Definition at line 130 of file filter.h.
Referenced by Botan::Chain::Chain().
| std::string Botan::SecureQueue::name | ( | ) | const [inline, virtual] |
Implements Botan::Filter.
Definition at line 22 of file secqueue.h.
| SecureQueue & Botan::SecureQueue::operator= | ( | const SecureQueue & | input | ) |
Definition at line 99 of file secqueue.cpp.
00100 { 00101 destroy(); 00102 head = tail = new SecureQueueNode; 00103 SecureQueueNode* temp = input.head; 00104 while(temp) 00105 { 00106 write(temp->buffer + temp->start, temp->end - temp->start); 00107 temp = temp->next; 00108 } 00109 return (*this); 00110 }
| u32bit Botan::SecureQueue::peek | ( | byte | out[], | |
| u32bit | length, | |||
| u32bit | peek_offset = 0 | |||
| ) | const [virtual] |
Read from the source but do not modify the internal offset. Consecutive calls to peek() will return portions of the source starting at the same position.
| out | the byte array to write the output to | |
| length | the length of the byte array out | |
| peek_offset | the offset into the stream to read at |
Implements Botan::DataSource.
Definition at line 157 of file secqueue.cpp.
References n.
Referenced by Botan::Record_Reader::get_record(), and Botan::Output_Buffers::peek().
00158 { 00159 SecureQueueNode* current = head; 00160 00161 while(offset && current) 00162 { 00163 if(offset >= current->size()) 00164 { 00165 offset -= current->size(); 00166 current = current->next; 00167 } 00168 else 00169 break; 00170 } 00171 00172 u32bit got = 0; 00173 while(length && current) 00174 { 00175 const u32bit n = current->peek(output, length, offset); 00176 offset = 0; 00177 output += n; 00178 got += n; 00179 length -= n; 00180 current = current->next; 00181 } 00182 return got; 00183 }
Peek at one byte.
| out | an output byte |
Definition at line 28 of file data_src.cpp.
References Botan::DataSource::peek().
Referenced by Botan::ASN1::maybe_BER().
00029 { 00030 return peek(&out, 1, 0); 00031 }
Read from the source. Moves the internal offset so that every call to read will return a new portion of the source.
| out | the byte array to write the result to | |
| length | the length of the byte array out |
Implements Botan::DataSource.
Definition at line 135 of file secqueue.cpp.
References n.
Referenced by Botan::Record_Reader::get_record(), Botan::TLS_Server::read(), Botan::TLS_Client::read(), and Botan::Output_Buffers::read().
00136 { 00137 u32bit got = 0; 00138 while(length && head) 00139 { 00140 const u32bit n = head->read(output, length); 00141 output += n; 00142 got += n; 00143 length -= n; 00144 if(head->size() == 0) 00145 { 00146 SecureQueueNode* holder = head->next; 00147 delete head; 00148 head = holder; 00149 } 00150 } 00151 return got; 00152 }
Read one byte.
| out | the byte to read to |
Definition at line 20 of file data_src.cpp.
References Botan::DataSource::read().
Referenced by Botan::PEM_Code::decode(), Botan::DataSource::discard_next(), Botan::BER_Decoder::discard_remaining(), Botan::PGP_decode(), and Botan::BER_Decoder::raw_bytes().
00021 { 00022 return read(&out, 1); 00023 }
| void Botan::Filter::send | ( | const MemoryRegion< byte > & | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 68 of file filter.h.
References Botan::MemoryRegion< T >::begin(), Botan::Filter::send(), and Botan::MemoryRegion< T >::size().
Referenced by Botan::Filter::send().
00068 { send(in.begin(), in.size()); }
| void Botan::Filter::send | ( | byte | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 63 of file filter.h.
References Botan::Filter::send().
Referenced by Botan::Filter::send().
00063 { send(&in, 1); }
| in | some input for the filter | |
| length | the length of in |
Definition at line 28 of file filter.cpp.
References Botan::MemoryRegion< T >::append(), Botan::MemoryRegion< T >::destroy(), Botan::MemoryRegion< T >::size(), and Botan::Filter::write().
Referenced by Botan::Zlib_Decompression::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::PK_Verifier_Filter::end_msg(), Botan::PK_Signer_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::PK_Encryptor_Filter::end_msg(), Botan::Hex_Encoder::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Base64_Decoder::end_msg(), Botan::Base64_Encoder::end_msg(), Botan::MAC_Filter::end_msg(), Botan::Hash_Filter::end_msg(), Botan::Zlib_Compression::flush(), Botan::Bzip_Compression::flush(), Botan::Zlib_Decompression::write(), Botan::Zlib_Compression::write(), Botan::Bzip_Decompression::write(), Botan::Bzip_Compression::write(), and Botan::StreamCipher_Filter::write().
00029 { 00030 bool nothing_attached = true; 00031 for(u32bit j = 0; j != total_ports(); ++j) 00032 if(next[j]) 00033 { 00034 if(write_queue.size()) 00035 next[j]->write(write_queue, write_queue.size()); 00036 next[j]->write(input, length); 00037 nothing_attached = false; 00038 } 00039 00040 if(nothing_attached) 00041 write_queue.append(input, length); 00042 else 00043 write_queue.destroy(); 00044 }
| void Botan::Fanout_Filter::set_next | ( | Filter * | filters[], | |
| u32bit | count | |||
| ) | [inline, protected, inherited] |
| filters | the filters to set | |
| count | number of items in filters |
Reimplemented from Botan::Filter.
Definition at line 134 of file filter.h.
Referenced by Botan::Fork::Fork(), and SecureQueue().
00134 { Filter::set_next(f, n); }
| void Botan::Fanout_Filter::set_port | ( | u32bit | new_port | ) | [inline, protected, inherited] |
Set the active port
| new_port | the new value |
Reimplemented from Botan::Filter.
Reimplemented in Botan::Fork.
Definition at line 132 of file filter.h.
Referenced by Botan::Fork::set_port().
00132 { Filter::set_port(n); }
| u32bit Botan::SecureQueue::size | ( | ) | const |
Definition at line 188 of file secqueue.cpp.
Referenced by end_of_data(), Botan::Record_Reader::get_record(), Botan::TLS_Server::read(), Botan::TLS_Client::read(), and Botan::Output_Buffers::remaining().
00189 { 00190 SecureQueueNode* current = head; 00191 u32bit count = 0; 00192 00193 while(current) 00194 { 00195 count += current->size(); 00196 current = current->next; 00197 } 00198 return count; 00199 }
| virtual void Botan::Filter::start_msg | ( | ) | [inline, virtual, inherited] |
Start a new message. Must be closed by end_msg() before another message can be started.
Reimplemented in Botan::Bzip_Compression, Botan::Bzip_Decompression, Botan::EAX_Base, Botan::Zlib_Compression, Botan::Zlib_Decompression, Botan::PBE_PKCS5v15, and Botan::PBE_PKCS5v20.
Definition at line 38 of file filter.h.
| void Botan::SecureQueue::write | ( | const | input[], | |
| u32bit | length | |||
| ) | [virtual] |
Write a portion of a message to this filter.
| input | the input as a byte array | |
| length | the length of the byte array input |
Implements Botan::Filter.
Definition at line 115 of file secqueue.cpp.
References n.
Referenced by Botan::Record_Reader::add_input(), operator=(), and SecureQueue().
00116 { 00117 if(!head) 00118 head = tail = new SecureQueueNode; 00119 while(length) 00120 { 00121 const u32bit n = tail->write(input, length); 00122 input += n; 00123 length -= n; 00124 if(length) 00125 { 00126 tail->next = new SecureQueueNode; 00127 tail = tail->next; 00128 } 00129 } 00130 }
1.5.8