OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE > Class Template Reference

#include <packet_id_data.hpp>

Public Member Functions

void init (const char *name_arg, const int unit_arg, bool wide_arg)
 
bool test_add (const PacketIDData &pin, const Time::base_type now, const SessionStats::Ptr &stats)
 
Error::Type do_test_add (const PacketIDData &pin, const Time::base_type now)
 
PacketIDData read_next (Buffer &buf) const
 
std::string str () const
 
std::size_t constexpr length () const
 

Static Public Attributes

static constexpr unsigned int REPLAY_WINDOW_BYTES = 1u << REPLAY_WINDOW_ORDER
 
static constexpr unsigned int REPLAY_WINDOW_SIZE = REPLAY_WINDOW_BYTES * 8
 

Private Member Functions

constexpr std::size_t replay_index (PacketIDData::data_id_t i) const
 

Private Attributes

std::size_t base = 0
 
std::size_t extent = 0
 
Time::base_type expire = 0
 
PacketIDData::data_id_t id_high = 0
 
PacketIDData::data_id_t id_floor = 0
 
bool wide = false
 < 32 or 64 bit packet counter
 
int unit = -1
 
std::string name {"not initialised"}
 
std::uint8_t history [REPLAY_WINDOW_BYTES]
 "sliding window" bitmask of recent packet IDs received *‍/
 

Detailed Description

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
class openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >

Definition at line 286 of file packet_id_data.hpp.

Member Function Documentation

◆ do_test_add()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
Error::Type openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::do_test_add ( const PacketIDData pin,
const Time::base_type  now 
)
inline

Checks if a packet ID is allowed and modifies the history of seen packets ids.

It returns the verdict of the packet id if it is fine or not

Parameters
pinpacket ID to check
nowCurrent time to check that reordered packets are in the allowed time
Returns
Error::SUCCESS if successful, otherwise PKTID_EXPIRE, PKTID_BACKTRACK or PKTID_REPLAY

Definition at line 382 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ init()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
void openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::init ( const char *  name_arg,
const int  unit_arg,
bool  wide_arg 
)
inline

Definition at line 332 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ length()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::size_t constexpr openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::length ( ) const
inlineconstexpr

Definition at line 470 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ read_next()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
PacketIDData openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::read_next ( Buffer buf) const
inline

Definition at line 456 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ replay_index()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
constexpr std::size_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::replay_index ( PacketIDData::data_id_t  i) const
inlineconstexprprivate

Definition at line 476 of file packet_id_data.hpp.

Here is the caller graph for this function:

◆ str()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::string openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::str ( ) const
inline

Definition at line 463 of file packet_id_data.hpp.

◆ test_add()

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
bool openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::test_add ( const PacketIDData pin,
const Time::base_type  now,
const SessionStats::Ptr stats 
)
inline

Checks if a packet ID is allowed and modifies the history of seen packets ids and adds any errors to the internal stats.

It returns the verdict of the packet id if it is fine or not

Parameters
pinpacket ID to check
nowCurrent time to check that reordered packets are in the allowed time
statsStats to update when an error occurs
Returns
true if the packet id is okay and has been accepted

Definition at line 359 of file packet_id_data.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ base

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::size_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::base = 0
private

Definition at line 481 of file packet_id_data.hpp.

◆ expire

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
Time::base_type openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::expire = 0
private

Definition at line 483 of file packet_id_data.hpp.

◆ extent

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::size_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::extent = 0
private

Definition at line 482 of file packet_id_data.hpp.

◆ history

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::uint8_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::history[REPLAY_WINDOW_BYTES]
private

"sliding window" bitmask of recent packet IDs received *‍/

Definition at line 493 of file packet_id_data.hpp.

◆ id_floor

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
PacketIDData::data_id_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::id_floor = 0
private

Definition at line 485 of file packet_id_data.hpp.

◆ id_high

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
PacketIDData::data_id_t openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::id_high = 0
private

Definition at line 484 of file packet_id_data.hpp.

◆ name

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
std::string openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::name {"not initialised"}
private

Definition at line 490 of file packet_id_data.hpp.

◆ REPLAY_WINDOW_BYTES

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
constexpr unsigned int openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::REPLAY_WINDOW_BYTES = 1u << REPLAY_WINDOW_ORDER
staticconstexpr

Definition at line 289 of file packet_id_data.hpp.

◆ REPLAY_WINDOW_SIZE

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
constexpr unsigned int openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::REPLAY_WINDOW_SIZE = REPLAY_WINDOW_BYTES * 8
staticconstexpr

Definition at line 290 of file packet_id_data.hpp.

◆ unit

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
int openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::unit = -1
private

Definition at line 489 of file packet_id_data.hpp.

◆ wide

template<unsigned int REPLAY_WINDOW_ORDER, unsigned int PKTID_RECV_EXPIRE>
bool openvpn::PacketIDDataReceiveType< REPLAY_WINDOW_ORDER, PKTID_RECV_EXPIRE >::wide = false
private

< 32 or 64 bit packet counter

Definition at line 488 of file packet_id_data.hpp.


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