11#include <botan/filter.h>
12#include <botan/mem_ops.h>
13#include <botan/internal/mem_utils.h>
14#include <botan/internal/out_buf.h>
21Pipe::message_id Pipe::get_message_no(std::string_view func_name, message_id msg)
const {
36 this->
write(input.data(), input.size());
44 throw Invalid_State(
"Cannot write to a Pipe while it is not processing");
46 m_pipe->write(input, length);
69 size_t got = source.
read(buffer.data(), buffer.size());
70 write(buffer.data(), got);
78 return m_outputs->read(output, length, get_message_no(
"read", msg));
92 return read(&out, 1, msg);
101 size_t got =
read(buffer.data(), buffer.size(), msg);
116 size_t got =
read(buffer.data(), buffer.size(), msg);
130 return m_outputs->remaining(get_message_no(
"remaining", msg));
137 return m_outputs->peek(output, length, offset, get_message_no(
"peek", msg));
143size_t Pipe::peek(uint8_t output[],
size_t length,
size_t offset)
const {
151 return peek(&out, 1, offset, msg);
159 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
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
std::span< const uint8_t > as_span_of_bytes(const char *s, size_t len)
const char * cast_uint8_ptr_to_char(const uint8_t *b)
std::vector< T, secure_allocator< T > > secure_vector
constexpr size_t DefaultBufferSize