11#include <botan/filter.h>
12#include <botan/mem_ops.h>
13#include <botan/internal/out_buf.h>
20Pipe::message_id Pipe::get_message_no(std::string_view func_name, message_id msg)
const {
28 throw Invalid_Message_Number(func_name, msg);
39 throw Invalid_State(
"Cannot write to a Pipe while it is not processing");
41 m_pipe->
write(input, length);
64 size_t got = source.
read(buffer.data(), buffer.size());
65 write(buffer.data(), got);
73 return m_outputs->read(output, length, get_message_no(
"read", msg));
87 return read(&out, 1, msg);
96 size_t got =
read(buffer.data(), buffer.size(), msg);
111 size_t got =
read(buffer.data(), buffer.size(), msg);
125 return m_outputs->remaining(get_message_no(
"remaining", msg));
132 return m_outputs->peek(output, length, offset, get_message_no(
"peek", msg));
138size_t Pipe::peek(uint8_t output[],
size_t length,
size_t offset)
const {
146 return peek(&out, 1, offset, msg);
154 return m_outputs->get_bytes_read(msg);
virtual size_t read(uint8_t out[], size_t length)=0
virtual bool end_of_data() const =0
virtual void write(const uint8_t input[], size_t length)=0
static const message_id LAST_MESSAGE
size_t read(uint8_t output[], size_t length) override
bool check_available_msg(size_t n, message_id msg) const
std::string read_all_as_string(message_id msg=DEFAULT_MESSAGE)
void write(const uint8_t in[], size_t length)
size_t get_bytes_read() const override
size_t default_msg() const
secure_vector< uint8_t > read_all(message_id msg=DEFAULT_MESSAGE)
static const message_id DEFAULT_MESSAGE
size_t remaining(message_id msg=DEFAULT_MESSAGE) const
size_t peek(uint8_t output[], size_t length, size_t offset) const override
message_id message_count() const
bool check_available(size_t n) override
#define BOTAN_DEFAULT_BUFFER_SIZE
const char * cast_uint8_ptr_to_char(const uint8_t *b)
std::vector< T, secure_allocator< T > > secure_vector
const uint8_t * cast_char_ptr_to_uint8(const char *s)