|
OpenVPN 3 Core Library
|
Immutable buffer with double ended access and adjustable free space at both ends. More...
#include <buffer.hpp>
Public Types | |
| using | value_type = T |
| using | type = T * |
| using | const_type = const T * |
| using | NCT = typename std::remove_const_t< T > |
Public Member Functions | |
| ConstBufferType () | |
| Default constructor for ConstBufferType. | |
| ConstBufferType (void *data, const size_t size, const bool filled) | |
| Constructs a ConstBufferType from a void pointer and size. | |
| template<typename U = T, typename std::enable_if_t<!std::is_const_v< U >, int > = 0> | |
| ConstBufferType (const void *data, const size_t size, const bool filled) | |
| Constructs a ConstBufferType from a const void pointer and size. This constructor is disabled when T is already const. | |
| ConstBufferType (T *data, const size_t size, const bool filled) | |
| Constructs a ConstBufferType from a pointer to T and size. | |
| template<typename U = T, typename std::enable_if_t<!std::is_const_v< U >, int > = 0> | |
| ConstBufferType (const U *data, const size_t size, const bool filled) | |
| Constructs a ConstBufferType from a const pointer to T and size. This constructor is disabled when T is already const. | |
| virtual | ~ConstBufferType ()=default |
| Needed because this class has virtual member functions and is intended as a base class. | |
| const auto & | operator[] (const size_t index) const |
| Const indexing operator for ConstBufferType. | |
| auto & | operator[] (const size_t index) |
| Non-const indexing operator for ConstBufferType. | |
| void | init_headroom (const size_t headroom) |
| Initializes the headroom (offset) of the buffer. | |
| void | reset_offset (const size_t offset) |
| Resets the offset of the buffer. | |
| void | reset_size () |
| Resets the size of the buffer to zero. | |
| void | reset_content () |
| Resets the content of the buffer. | |
| const T * | c_str () const |
| Returns a const pointer to the null-terminated string representation of the buffer. | |
| size_t | length () const |
| Returns the length of the buffer. | |
| const T * | c_data () const |
| Returns a const pointer to the start of the buffer. | |
| const T * | c_data_end () const |
| Returns a const pointer to the end of the buffer. | |
| const T * | c_data_raw () const |
| Returns a const pointer to the start of the raw data in the buffer. | |
| size_t | capacity () const |
| Returns the capacity (raw size) of the allocated buffer in T objects. | |
| size_t | offset () const |
| Returns the current offset (headroom) into the buffer. | |
| bool | defined () const |
| Returns true if the buffer is not empty. | |
| bool | allocated () const |
| Returns true if the data memory is defined (allocated). | |
| bool | empty () const |
| Returns true if the buffer is empty. | |
| size_t | size () const |
| Returns the size of the buffer in T objects. | |
| T | pop_back () |
| Removes and returns the last element from the buffer. | |
| T | pop_front () |
| Removes and returns the first element from the buffer. | |
| T | front () const |
| Returns the first element of the buffer. | |
| T | back () const |
| Returns the last element of the buffer. | |
| void | advance (const size_t delta) |
| Advances the buffer by the specified delta. | |
| bool | contains_null () const |
| Returns true if the buffer contains a null character. | |
| bool | is_zeroed () const |
| Returns true if the buffer is zeroed (all elements are zero). | |
| openvpn_io::const_buffer | const_buffer () const |
| Return an openvpn_io::const_buffer object used by asio write methods. | |
| openvpn_io::const_buffer | const_buffer_clamp () const |
| Return a clamped version of const_buffer(). | |
| openvpn_io::const_buffer | const_buffer_limit (const size_t limit) const |
| Return a const_buffer object with a specified size limit. | |
| void | read (NCT *data, const size_t size) |
| Read data from the buffer into the specified memory location. | |
| void | read (void *data, const size_t size) |
| Read data from the buffer into the specified memory location. | |
| auto * | read_alloc (const size_t size) |
| Allocate memory and read data from the buffer into the allocated memory. | |
| auto | read_alloc_buf (const size_t size) |
| Allocate memory and read data from the buffer into the allocated memory. | |
| size_t | max_size () const |
| Return the maximum allowable size value in T objects given the current offset (without considering resize). | |
| void | set_size (const size_t size) |
| After an external method, operating on the array as a mutable unsigned char buffer, has written data to the array, use this method to set the array length in terms of T objects. | |
| void | inc_size (const size_t delta) |
| Increment the size of the array (usually used in a similar context to set_size such as after mutable_buffer_append). | |
| ConstBufferType | range (size_t offset, size_t len) const |
| Get a range of the buffer as a ConstBufferType object. | |
| const T * | c_index (const size_t index) const |
| Get a const pointer to the element at the specified index in the array. | |
| bool | operator== (const ConstBufferType &other) const |
| Equality operator to compare this buffer with another ConstBufferType object. | |
| bool | operator!= (const ConstBufferType &other) const |
| Inequality operator to compare this buffer with another ConstBufferType object. | |
Protected Member Functions | |
| void | reserve (const size_t n) |
| Reserve additional memory for the buffer. | |
| T * | data () |
| Get a mutable pointer to the start of the array. | |
| T * | data_end () |
| Get a mutable pointer to the end of the array. | |
| T * | data_raw () |
| Get a mutable pointer to the start of the raw data. | |
| 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 considering resize). | |
| size_t | max_size_tailroom (const size_t tailroom) const |
| Return the maximum allowable size value in T objects, taking into account the specified tailroom. | |
| void | push_back (const T &value) |
| Append a T object to the end of the array, resizing the array if necessary. | |
| void | push_front (const T &value) |
| Append a T object to the array, with possible resize. | |
| void | set_trailer (const T &value) |
| Place a T object after the last object in the array, with possible resize to contain it. However, it doesn't actually change the size of the array to reflect the added object. Useful for maintaining null-terminated strings. | |
| void | null_terminate () |
| Null-terminate the array. | |
| T * | index (const size_t index) |
| Get a mutable index into the array. | |
| openvpn_io::mutable_buffer | mutable_buffer (const size_t tailroom=0) |
| Return an openvpn_io::mutable_buffer object used by asio read methods, starting from data(). | |
| openvpn_io::mutable_buffer | mutable_buffer_append (const size_t tailroom=0) |
| Return an openvpn_io::mutable_buffer object used by asio read methods, starting from data_end(). | |
| openvpn_io::mutable_buffer | mutable_buffer_clamp (const size_t tailroom=0) |
| Clamped version of mutable_buffer(). | |
| openvpn_io::mutable_buffer | mutable_buffer_append_clamp (const size_t tailroom=0) |
| Clamped version of mutable_buffer_append(). | |
| void | realign (size_t headroom) |
| Realign the buffer with the specified headroom. | |
| void | write (const T *data, const size_t size) |
| Write data to the buffer. | |
| void | write (const void *data, const size_t size) |
| Write data to the buffer. | |
| void | prepend (const T *data, const size_t size) |
| Prepend data to the buffer. | |
| void | prepend (const void *data, const size_t size) |
| Prepend data to the buffer. | |
| T * | write_alloc (const size_t size) |
| Allocate space for writing data to the buffer. | |
| T * | prepend_alloc (const size_t size) |
| Allocate space for prepending data to the buffer. | |
| void | reset (const size_t min_capacity, const BufferFlags flags) |
| Reset the buffer with the specified minimum capacity and flags. | |
| void | reset (const size_t headroom, const size_t min_capacity, const BufferFlags flags) |
| Reset the buffer with the specified headroom, minimum capacity, and flags. | |
| template<typename B > | |
| void | append (const B &other) |
| Append data from another buffer to this buffer. | |
| template<typename T_ > | |
| void | swap (ConstBufferType< T_ > &other) |
| Swap the contents of this buffer with another buffer. | |
| void | buffer_full_error (const size_t newcap, const bool allocated) const |
| Throw an exception when the buffer is full. | |
| virtual void | reset_impl (const size_t min_capacity, const BufferFlags flags) |
| Called when the reset method needs to expand the buffer size. | |
| virtual void | resize (const size_t new_capacity) |
| Derived classes can implement buffer growing semantics by overloading this method. In the default implementation, buffers are non-growable, so an exception is thrown. | |
| ConstBufferType (T *data, const size_t offset, const size_t size, const size_t capacity) | |
| Construct a ConstBufferType object. | |
| template<typename U = T, typename std::enable_if_t<!std::is_const_v< U >, int > = 0> | |
| ConstBufferType (const U *data, const size_t offset, const size_t size, const size_t capacity) | |
| Construct a ConstBufferType object from a const U* pointer. This constructor is disabled when T is already const. | |
Private Attributes | |
| T * | data_ |
| size_t | offset_ |
| size_t | size_ |
| size_t | capacity_ |
Immutable buffer with double ended access and adjustable free space at both ends.
This template implements a buffer with double ended access and adjustable free space at both ends. It's generalized for type T but is only really fully functional with various types that can represent strings, as it does have string interoperation helpers. It is particularly useful for use as a building block in implementing protocols such as wire protocols for a network.
Data layout:
data_ ->|--------------|------------------ Buffered Data --------------------|--------------|
^-- offset_ ---^ ^ ^
^ ^----- size_ -----------------------------------------^ ^
^ ^
^-- capacity_ ----------------------------------------------------------------------^
Definition at line 234 of file buffer.hpp.
| using openvpn::ConstBufferType< T >::const_type = const T * |
Definition at line 239 of file buffer.hpp.
| using openvpn::ConstBufferType< T >::NCT = typename std::remove_const_t<T> |
Definition at line 240 of file buffer.hpp.
| using openvpn::ConstBufferType< T >::type = T * |
Definition at line 238 of file buffer.hpp.
| using openvpn::ConstBufferType< T >::value_type = T |
Definition at line 237 of file buffer.hpp.
| openvpn::ConstBufferType< T >::ConstBufferType | ( | ) |
Default constructor for ConstBufferType.
Definition at line 1101 of file buffer.hpp.
| openvpn::ConstBufferType< T >::ConstBufferType | ( | void * | data, |
| const size_t | size, | ||
| const bool | filled | ||
| ) |
Constructs a ConstBufferType from a void pointer and size.
| data | Pointer to the data. |
| size | Size of the data in bytes. |
| filled | Indicates whether the buffer is filled or not. |
Definition at line 1110 of file buffer.hpp.
| openvpn::ConstBufferType< T >::ConstBufferType | ( | const void * | data, |
| const size_t | size, | ||
| const bool | filled | ||
| ) |
Constructs a ConstBufferType from a const void pointer and size. This constructor is disabled when T is already const.
| data | Pointer to the const data. |
| size | Size of the data in bytes. |
| filled | Indicates whether the buffer is filled or not. |
Definition at line 1115 of file buffer.hpp.
| openvpn::ConstBufferType< T >::ConstBufferType | ( | T * | data, |
| const size_t | size, | ||
| const bool | filled | ||
| ) |
Constructs a ConstBufferType from a pointer to T and size.
| data | Pointer to the data. |
| size | Size of the data in bytes. |
| filled | Indicates whether the buffer is filled or not. |
Definition at line 1119 of file buffer.hpp.
| openvpn::ConstBufferType< T >::ConstBufferType | ( | const U * | data, |
| const size_t | size, | ||
| const bool | filled | ||
| ) |
Constructs a ConstBufferType from a const pointer to T and size. This constructor is disabled when T is already const.
| data | Pointer to the const data. |
| size | Size of the data in bytes. |
| filled | Indicates whether the buffer is filled or not. |
Definition at line 1127 of file buffer.hpp.
|
virtualdefault |
Needed because this class has virtual member functions and is intended as a base class.
|
protected |
Construct a ConstBufferType object.
| data | A pointer to the data buffer. |
| offset | The offset from data where the T array starts. |
| size | The number of T objects in the array. |
| capacity | The maximum number of T objects that can be stored in the buffer. |
Definition at line 1652 of file buffer.hpp.
|
protected |
Construct a ConstBufferType object from a const U* pointer. This constructor is disabled when T is already const.
| U | The type of the data pointer. |
| data | A pointer to the data buffer. |
| offset | The offset from data where the T array starts. |
| size | The number of T objects in the array. |
| capacity | The maximum number of T objects that can be stored in the buffer. |
Definition at line 1657 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::advance | ( | const size_t | delta | ) |
Advances the buffer by the specified delta.
| delta | The amount to advance the buffer. |
Definition at line 1276 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::allocated | ( | ) | const |
Returns true if the data memory is defined (allocated).
Definition at line 1229 of file buffer.hpp.
|
protected |
Append data from another buffer to this buffer.
| B | The type of the other buffer. |
| other | The other buffer to be appended. |
Definition at line 1623 of file buffer.hpp.
| T openvpn::ConstBufferType< T >::back | ( | ) | const |
Returns the last element of the buffer.
Definition at line 1270 of file buffer.hpp.
|
protected |
Throw an exception when the buffer is full.
| newcap | The new capacity required for the buffer. |
| allocated | A flag indicating whether memory was allocated. |
Definition at line 1642 of file buffer.hpp.
| const T * openvpn::ConstBufferType< T >::c_data | ( | ) | const |
Returns a const pointer to the start of the buffer.
Definition at line 1193 of file buffer.hpp.
| const T * openvpn::ConstBufferType< T >::c_data_end | ( | ) | const |
Returns a const pointer to the end of the buffer.
Definition at line 1199 of file buffer.hpp.
| const T * openvpn::ConstBufferType< T >::c_data_raw | ( | ) | const |
Returns a const pointer to the start of the raw data in the buffer.
Definition at line 1205 of file buffer.hpp.
| const T * openvpn::ConstBufferType< T >::c_index | ( | const size_t | index | ) | const |
Get a const pointer to the element at the specified index in the array.
| index | The index of the element to retrieve. |
Definition at line 1408 of file buffer.hpp.
| const T * openvpn::ConstBufferType< T >::c_str | ( | ) | const |
Returns a const pointer to the null-terminated string representation of the buffer.
Definition at line 1181 of file buffer.hpp.
| size_t openvpn::ConstBufferType< T >::capacity | ( | ) | const |
Returns the capacity (raw size) of the allocated buffer in T objects.
Definition at line 1211 of file buffer.hpp.
| openvpn_io::const_buffer openvpn::ConstBufferType< T >::const_buffer | ( | ) | const |
Return an openvpn_io::const_buffer object used by asio write methods.
Definition at line 1311 of file buffer.hpp.
| openvpn_io::const_buffer openvpn::ConstBufferType< T >::const_buffer_clamp | ( | ) | const |
Return a clamped version of const_buffer().
This function returns a const_buffer object that represents the underlying buffer data, but with a size clamped to a certain limit. This can be useful when you want to ensure that the buffer size does not exceed a specific value.
Definition at line 1317 of file buffer.hpp.
| openvpn_io::const_buffer openvpn::ConstBufferType< T >::const_buffer_limit | ( | const size_t | limit | ) | const |
Return a const_buffer object with a specified size limit.
This function returns a const_buffer object that represents the underlying buffer data, but with a size limited to the specified limit value. This can be useful when you want to ensure that the buffer size does not exceed a specific value.
| limit | The maximum size of the returned const_buffer object. |
limit value. Definition at line 1323 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::contains_null | ( | ) | const |
Returns true if the buffer contains a null character.
Definition at line 1285 of file buffer.hpp.
|
protected |
Get a mutable pointer to the start of the array.
Definition at line 1447 of file buffer.hpp.
|
protected |
Get a mutable pointer to the end of the array.
Definition at line 1453 of file buffer.hpp.
|
protected |
Get a mutable pointer to the start of the raw data.
Definition at line 1459 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::defined | ( | ) | const |
Returns true if the buffer is not empty.
Definition at line 1223 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::empty | ( | ) | const |
Returns true if the buffer is empty.
Definition at line 1235 of file buffer.hpp.
| T openvpn::ConstBufferType< T >::front | ( | ) | const |
Returns the first element of the buffer.
Definition at line 1264 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::inc_size | ( | const size_t | delta | ) |
Increment the size of the array (usually used in a similar context to set_size such as after mutable_buffer_append).
| delta | The amount to increment the size by. |
Definition at line 1389 of file buffer.hpp.
|
protected |
Get a mutable index into the array.
| index | The index of the element to be accessed. |
Definition at line 1512 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::init_headroom | ( | const size_t | headroom | ) |
Initializes the headroom (offset) of the buffer.
| headroom | The desired headroom value. |
Definition at line 1150 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::is_zeroed | ( | ) | const |
Returns true if the buffer is zeroed (all elements are zero).
Definition at line 1297 of file buffer.hpp.
| size_t openvpn::ConstBufferType< T >::length | ( | ) | const |
Returns the length of the buffer.
Definition at line 1187 of file buffer.hpp.
| size_t openvpn::ConstBufferType< T >::max_size | ( | ) | const |
Return the maximum allowable size value in T objects given the current offset (without considering resize).
Definition at line 1374 of file buffer.hpp.
|
protected |
Return the maximum allowable size value in T objects, taking into account the specified tailroom.
| tailroom | The amount of additional space to reserve at the end of the buffer. |
Definition at line 1472 of file buffer.hpp.
|
protected |
Return an openvpn_io::mutable_buffer object used by asio read methods, starting from data().
| tailroom | The amount of tailroom to reserve in the buffer (default: 0). |
Definition at line 1523 of file buffer.hpp.
|
protected |
Return an openvpn_io::mutable_buffer object used by asio read methods, starting from data_end().
| tailroom | The amount of tailroom to reserve in the buffer (default: 0). |
Definition at line 1529 of file buffer.hpp.
|
protected |
Clamped version of mutable_buffer_append().
| tailroom | The amount of tailroom to reserve in the buffer (default: 0). |
Definition at line 1541 of file buffer.hpp.
|
protected |
Clamped version of mutable_buffer().
| tailroom | The amount of tailroom to reserve in the buffer (default: 0). |
Definition at line 1535 of file buffer.hpp.
|
protected |
Null-terminate the array.
| Will | throw an exception if there is no room, termination is required, and the resize fails. |
Definition at line 1505 of file buffer.hpp.
| size_t openvpn::ConstBufferType< T >::offset | ( | ) | const |
Returns the current offset (headroom) into the buffer.
Definition at line 1217 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::operator!= | ( | const ConstBufferType< T > & | other | ) | const |
Inequality operator to compare this buffer with another ConstBufferType object.
| other | The ConstBufferType object to compare with. |
Definition at line 1434 of file buffer.hpp.
| bool openvpn::ConstBufferType< T >::operator== | ( | const ConstBufferType< T > & | other | ) | const |
Equality operator to compare this buffer with another ConstBufferType object.
| other | The ConstBufferType object to compare with. |
Definition at line 1426 of file buffer.hpp.
| auto & openvpn::ConstBufferType< T >::operator[] | ( | const size_t | index | ) |
Non-const indexing operator for ConstBufferType.
| index | Index of the element to access. |
Definition at line 1139 of file buffer.hpp.
| const auto & openvpn::ConstBufferType< T >::operator[] | ( | const size_t | index | ) | const |
Const indexing operator for ConstBufferType.
| index | Index of the element to access. |
Definition at line 1131 of file buffer.hpp.
| T openvpn::ConstBufferType< T >::pop_back | ( | ) |
Removes and returns the last element from the buffer.
Definition at line 1247 of file buffer.hpp.
| T openvpn::ConstBufferType< T >::pop_front | ( | ) |
Removes and returns the first element from the buffer.
Definition at line 1255 of file buffer.hpp.
|
protected |
Prepend data to the buffer.
| data | A pointer to the data to be prepended. |
| size | The number of T objects to be prepended. |
Definition at line 1572 of file buffer.hpp.
|
protected |
Prepend data to the buffer.
| data | A pointer to the data to be prepended. |
| size | The number of bytes to be prepended. |
Definition at line 1578 of file buffer.hpp.
|
protected |
Allocate space for prepending data to the buffer.
| size | The number of T objects to allocate space for. |
Definition at line 1594 of file buffer.hpp.
|
protected |
Append a T object to the end of the array, resizing the array if necessary.
| value | The T object to append. |
Definition at line 1479 of file buffer.hpp.
|
protected |
Append a T object to the array, with possible resize.
| value | The T object to be appended to the array. |
Definition at line 1487 of file buffer.hpp.
| ConstBufferType< T > openvpn::ConstBufferType< T >::range | ( | size_t | offset, |
| size_t | len | ||
| ) | const |
Get a range of the buffer as a ConstBufferType object.
| offset | The starting offset of the range. |
| len | The length of the range. |
Definition at line 1395 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::read | ( | NCT * | data, |
| const size_t | size | ||
| ) |
Read data from the buffer into the specified memory location.
| data | Pointer to the memory location where the data will be read. |
| size | Number of bytes to read from the buffer. |
Definition at line 1330 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::read | ( | void * | data, |
| const size_t | size | ||
| ) |
Read data from the buffer into the specified memory location.
| data | Pointer to the memory location where the data will be read. |
| size | Number of bytes to read from the buffer. |
Definition at line 1336 of file buffer.hpp.
| auto * openvpn::ConstBufferType< T >::read_alloc | ( | const size_t | size | ) |
Allocate memory and read data from the buffer into the allocated memory.
| size | Number of bytes to read from the buffer. |
Definition at line 1342 of file buffer.hpp.
| auto openvpn::ConstBufferType< T >::read_alloc_buf | ( | const size_t | size | ) |
Allocate memory and read data from the buffer into the allocated memory.
| size | Number of bytes to read from the buffer. |
Definition at line 1360 of file buffer.hpp.
|
protected |
Realign the buffer with the specified headroom.
| headroom | The amount of headroom to reserve in the buffer. |
Definition at line 1548 of file buffer.hpp.
|
protected |
Return the number of additional T objects that can be added before capacity is reached (without considering resize).
| tailroom | (Optional) The amount of additional space to reserve at the end of the buffer. |
Definition at line 1465 of file buffer.hpp.
|
protected |
Reserve additional memory for the buffer.
| n | The amount of additional memory to reserve. |
Definition at line 1440 of file buffer.hpp.
|
protected |
Reset the buffer with the specified headroom, minimum capacity, and flags.
| headroom | The amount of headroom to reserve in the buffer. |
| min_capacity | The minimum capacity of the buffer. |
| flags | Flags to control the behavior of the reset operation. |
Definition at line 1613 of file buffer.hpp.
|
protected |
Reset the buffer with the specified minimum capacity and flags.
| min_capacity | The minimum capacity of the buffer. |
| flags | Flags to control the behavior of the reset operation. |
Definition at line 1606 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::reset_content | ( | ) |
Resets the content of the buffer.
Definition at line 1175 of file buffer.hpp.
|
protectedvirtual |
Called when the reset method needs to expand the buffer size.
| min_capacity | The minimum capacity required for the buffer. |
| flags | Flags to control the behavior of the reset operation. |
Reimplemented in openvpn::BufferAllocatedType< T >, and openvpn::BufferAllocatedType< unsigned char >.
Definition at line 1629 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::reset_offset | ( | const size_t | offset | ) |
Resets the offset of the buffer.
| offset | The new offset value. |
Definition at line 1159 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::reset_size | ( | ) |
Resets the size of the buffer to zero.
Definition at line 1169 of file buffer.hpp.
|
protectedvirtual |
Derived classes can implement buffer growing semantics by overloading this method. In the default implementation, buffers are non-growable, so an exception is thrown.
| new_capacity | The new capacity required for the buffer. |
| std::exception | if the buffer cannot be resized. |
Reimplemented in openvpn::BufferAllocatedType< T >, and openvpn::BufferAllocatedType< unsigned char >.
Definition at line 1635 of file buffer.hpp.
| void openvpn::ConstBufferType< T >::set_size | ( | const size_t | size | ) |
After an external method, operating on the array as a mutable unsigned char buffer, has written data to the array, use this method to set the array length in terms of T objects.
| size | The new size of the array in terms of T objects. |
Definition at line 1381 of file buffer.hpp.
|
protected |
Place a T object after the last object in the array, with possible resize to contain it. However, it doesn't actually change the size of the array to reflect the added object. Useful for maintaining null-terminated strings.
| value | The T object to be placed after the last object in the array. |
| Will | throw an exception if there is no room for the trailing value and the resize fails. |
Definition at line 1497 of file buffer.hpp.
| size_t openvpn::ConstBufferType< T >::size | ( | ) | const |
Returns the size of the buffer in T objects.
Definition at line 1241 of file buffer.hpp.
|
protected |
Swap the contents of this buffer with another buffer.
| T_ | The type of the other buffer. |
| other | The other buffer to swap with. |
Definition at line 1417 of file buffer.hpp.
|
protected |
Write data to the buffer.
| data | A pointer to the data to be written. |
| size | The number of T objects to be written. |
Definition at line 1560 of file buffer.hpp.
|
protected |
Write data to the buffer.
| data | A pointer to the data to be written. |
| size | The number of bytes to be written. |
Definition at line 1566 of file buffer.hpp.
|
protected |
Allocate space for writing data to the buffer.
| size | The number of T objects to allocate space for. |
Definition at line 1584 of file buffer.hpp.
|
private |
Definition at line 784 of file buffer.hpp.
|
private |
Definition at line 781 of file buffer.hpp.
|
private |
Definition at line 782 of file buffer.hpp.
|
private |
Definition at line 783 of file buffer.hpp.