OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::PacketIDDataSend Class Reference

#include <packet_id_data.hpp>

Inheritance diagram for openvpn::PacketIDDataSend:
[legend]
Collaboration diagram for openvpn::PacketIDDataSend:
[legend]

Public Member Functions

 OPENVPN_SIMPLE_EXCEPTION (packet_id_wrap)
 
 PacketIDDataSend (bool wide_arg, uint16_t epoch)
 
 PacketIDDataSend ()
 
PacketIDData next ()
 
void write_next (Buffer &buf)
 
void prepend_next (Buffer &buf)
 
std::string str () const
 
constexpr std::size_t length () const
 
bool wrap_warning () const
 
bool at_limit ()
 

Static Public Attributes

static constexpr PacketIDData::data_id_t epoch_packet_id_max = 0x0000ffffffffffffull
 

Protected Attributes

PacketIDData pid_
 

Detailed Description

Definition at line 167 of file packet_id_data.hpp.

Constructor & Destructor Documentation

◆ PacketIDDataSend() [1/2]

openvpn::PacketIDDataSend::PacketIDDataSend ( bool  wide_arg,
uint16_t  epoch 
)
inlineexplicit

Definition at line 176 of file packet_id_data.hpp.

◆ PacketIDDataSend() [2/2]

openvpn::PacketIDDataSend::PacketIDDataSend ( )
inlineexplicit

Definition at line 181 of file packet_id_data.hpp.

Member Function Documentation

◆ at_limit()

bool openvpn::PacketIDDataSend::at_limit ( )
inline

Definition at line 259 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ length()

constexpr std::size_t openvpn::PacketIDDataSend::length ( ) const
inlineconstexpr

Returns the size of the packet id. This is either 4 or 8 depending on the mode in use

Returns
4 or 8

Definition at line 234 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ next()

PacketIDData openvpn::PacketIDDataSend::next ( )
inline

Increment the packet ID and return the next packet id to use.

Exceptions
packet_id_wrapif the packet id space is exhausted
Returns
packet id to use next.

Definition at line 190 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ OPENVPN_SIMPLE_EXCEPTION()

openvpn::PacketIDDataSend::OPENVPN_SIMPLE_EXCEPTION ( packet_id_wrap  )

◆ prepend_next()

void openvpn::PacketIDDataSend::prepend_next ( Buffer buf)
inline

increases the packet id and prepends it to a buffer

Parameters
bufbuffer to write to

Definition at line 215 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ str()

std::string openvpn::PacketIDDataSend::str ( ) const
inline

Definition at line 221 of file packet_id_data.hpp.

◆ wrap_warning()

bool openvpn::PacketIDDataSend::wrap_warning ( ) const
inline

When a VPN runs in TLS mode (the only mode that OpenVPN supports, there is no –secret mode anymore), it needs to be warned about wrapping to start thinking about triggering a new SSL/TLS handshake. This method can be called to see if that level has been reached.

For 64bit counters, even with (non-existing) 1 byte packets, we would need to transfer 16 EB (exabytes) and 1,6 ZB (zettabytes) with 100 byte packets. This is not reachable in reasonable amount of time. And we still have the failsafe to throw an exception if we would overflow the ocunter.

Definition at line 250 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ write_next()

void openvpn::PacketIDDataSend::write_next ( Buffer buf)
inline

increases the packet id and writes it to a buffer

Parameters
bufbuffer to write to

Definition at line 205 of file packet_id_data.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ epoch_packet_id_max

constexpr PacketIDData::data_id_t openvpn::PacketIDDataSend::epoch_packet_id_max = 0x0000ffffffffffffull
inlinestaticconstexpr

the maximum allowed value for a epoch packet counter (48 bit)

Definition at line 173 of file packet_id_data.hpp.

◆ pid_

PacketIDData openvpn::PacketIDDataSend::pid_
protected

Definition at line 274 of file packet_id_data.hpp.


The documentation for this class was generated from the following file: