OpenVPN 3 Core Library
|
#include <packet_id_data.hpp>
Public Types | |
typedef std::uint64_t | data_id_t |
Public Member Functions | |
constexpr std::size_t | size () const |
PacketIDData (bool wide_arg) | |
PacketIDData (bool wide_arg, data_id_t id_arg) | |
bool | is_valid () const |
void | reset () |
uint16_t | get_epoch () |
void | read (ConstBuffer &buf) |
void | write (Buffer &buf) const |
void | write_prepend (Buffer &buf) const |
std::string | str () const |
Static Public Member Functions | |
static constexpr size_t | size (bool wide) |
Public Attributes | |
data_id_t | id = 0 |
bool | wide = false |
Static Public Attributes | |
static constexpr data_id_t | epoch_packet_id_mask = 0x0000ffffffffffffull |
static constexpr std::size_t | short_id_size = sizeof(std::uint32_t) |
static constexpr std::size_t | long_id_size = sizeof(std::uint64_t) |
Communicate packet-id over the wire for data channel packets A short packet-id is just a 32 bit sequence number. A long packet-id is a 16 bit epoch + 48 bit sequence number. This sequence number is reused for AEAD IV when AEAD is used as a cipher. CBC transmits an additional IV.
This data structure is always sent over the net in network byte order,
This class is different from PacketIDControl in the way that it always uses a "flat" packet id that is either 32 or 64 bit while PacketIDControl has a long packet id that is 32bit + 32bit but follow different rules and includes a timestamp. Merging PacketIData and PacketIDControl would result in a much more convoluted and hard to understand class than keeping them separate.
Definition at line 50 of file packet_id_data.hpp.
typedef std::uint64_t openvpn::PacketIDData::data_id_t |
Definition at line 52 of file packet_id_data.hpp.
|
inlineexplicit |
Definition at line 80 of file packet_id_data.hpp.
|
inlineexplicit |
Definition at line 85 of file packet_id_data.hpp.
|
inline |
Definition at line 103 of file packet_id_data.hpp.
|
inline |
|
inline |
Reads the packet id from the specified buffer.
buf | the buffer to read the packet id from |
Definition at line 112 of file packet_id_data.hpp.
|
inline |
Definition at line 98 of file packet_id_data.hpp.
|
inlineconstexpr |
Returns the size of the packet id. This is either 4 or 8 depending on the mode in use
Definition at line 66 of file packet_id_data.hpp.
|
inlinestaticconstexpr |
Definition at line 71 of file packet_id_data.hpp.
|
inline |
|
inline |
Writes the packet id to a buffer
Definition at line 129 of file packet_id_data.hpp.
|
inline |
Prepend the packet id to a buffer
Definition at line 144 of file packet_id_data.hpp.
|
inlinestaticconstexpr |
Definition at line 56 of file packet_id_data.hpp.
data_id_t openvpn::PacketIDData::id = 0 |
Definition at line 59 of file packet_id_data.hpp.
|
staticconstexpr |
Definition at line 91 of file packet_id_data.hpp.
|
staticconstexpr |
Definition at line 90 of file packet_id_data.hpp.
bool openvpn::PacketIDData::wide = false |
Definition at line 60 of file packet_id_data.hpp.