15#ifndef OPENVPN_FRAME_FRAME_H
16#define OPENVPN_FRAME_FRAME_H
25class Frame :
public RC<thread_unsafe_refcount>
75 const size_t align_adjust,
76 const size_t align_block,
143 b->write(data, size);
161 const size_t size = buf ? buf->size() : 0;
166 b->write(buf->c_data(), size);
204 std::ostringstream
info;
268 return (*
this)[context].prepare(buf);
286 throw frame_context_index();
293 throw frame_context_index();
301 unsigned int mask = context_mask;
void init_headroom(const size_t headroom)
Initializes the headroom (offset) of the buffer.
void reset(const size_t min_capacity, const BufferFlags flags)
Reset the buffer with the specified minimum capacity and flags.
size_t size() const
Returns the size of the buffer in T objects.
T * data()
Get a mutable pointer to the start of the array.
const T * c_data_raw() const
Returns a const pointer to the start of the raw data in the buffer.
void write(const T *data, const size_t size)
Write data to the buffer.
void realign(size_t headroom)
Realign the buffer with the specified headroom.
openvpn_io::mutable_buffer mutable_buffer_clamp(Buffer &buf) const
BufferFlags buffer_flags_
BufferPtr copy(const BufferPtr &buf) const
BufferPtr copy(const unsigned char *data, const size_t size) const
Context(const size_t headroom, const size_t payload, const size_t tailroom, const size_t align_adjust, const size_t align_block, const BufferFlags buffer_flags)
void standardize_capacity(const size_t newcap)
size_t prepare(Buffer &buf) const
BufferAllocated alloc() const
void reset_align_adjust(const size_t align_adjust)
size_t remaining_payload(const Buffer &buf) const
BufferAllocated copy_by_value(const unsigned char *data, const size_t size) const
BufferFlags buffer_flags() const
size_t actual_headroom(const void *base) const
void realign(Buffer &buf) const
openvpn_io::mutable_buffer mutable_buffer(Buffer &buf) const
Context contexts[N_ALIGN_CONTEXTS]
BufferPtr prepare(const unsigned int context) const
size_t n_contexts() const
Context & operator[](const size_t i)
size_t prepare(const unsigned int context, Buffer &buf) const
OPENVPN_SIMPLE_EXCEPTION(frame_context_index)
void set_default_context(const Context &c)
const Context & operator[](const size_t i) const
void standardize_capacity(const unsigned int context_mask)
Reference count base class for objects tracked by RCPtr. Disallows copying and assignment.
static Ptr Create(ArgsT &&...args)
Creates a new instance of RcEnable with the given arguments.
constexpr BufferFlags NO_FLAGS(0u)
no flags set
size_t buf_clamp_read(const size_t size)