15#ifndef OPENVPN_FRAME_MEMQ_STREAM_H
16#define OPENVPN_FRAME_MEMQ_STREAM_H
61 const unsigned char *from = b.
read_alloc(write_size);
62 qb->write(from, write_size);
71 const size_t write_size = std::min(b.
size(), fc.
payload());
72 const unsigned char *from = b.
read_alloc(write_size);
73 newbuf->write(from, write_size);
80 throw frame_uninitialized();
83 size_t read(
unsigned char *data,
size_t len)
85 Buffer b(data, len,
false);
92 const size_t read_size = std::min(remaining, qf->size());
94 qf->read(to, read_size);
T * write_alloc(const size_t size)
Allocate space for writing data to the buffer.
size_t size() const
Returns the size of the buffer in T objects.
bool empty() const
Returns true if the buffer is empty.
auto * read_alloc(const size_t size)
Allocate memory and read data from the buffer into the allocated memory.
size_t remaining(const size_t tailroom=0) const
Return the number of additional T objects that can be added before capacity is reached (without consi...
size_t prepare(Buffer &buf) const
size_t remaining_payload(const Buffer &buf) const
size_t total_length() const
void set_frame(const Frame::Ptr &frame)
void write(const unsigned char *data, size_t size)
size_t read(unsigned char *data, size_t len)
OPENVPN_SIMPLE_EXCEPTION(frame_uninitialized)
MemQStream(const Frame::Ptr &frame)
static Ptr Create(ArgsT &&...args)
Creates a new instance of RcEnable with the given arguments.