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

#include <sessionstats.hpp>

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

Classes

struct  DCOTransportSource
 

Public Types

enum  Stats {
  BYTES_IN = 0 , BYTES_OUT , PACKETS_IN , PACKETS_OUT ,
  TUN_BYTES_IN , TUN_BYTES_OUT , TUN_PACKETS_IN , TUN_PACKETS_OUT ,
  N_STATS
}
 
typedef RCPtr< SessionStatsPtr
 
using inc_callback_t = std::function< void(const count_t value)>
 
- Public Types inherited from openvpn::RC< thread_safe_refcount >
typedef RCPtr< RCPtr
 

Public Member Functions

 SessionStats ()
 
virtual void error (const size_t type, const std::string *text=nullptr)
 
bool verbose () const
 
void inc_stat (const size_t type, const count_t value)
 
count_t get_stat (const size_t type) const
 
count_t get_stat_fast (const size_t type) const
 
void update_last_packet_received (const Time &now)
 
const Timelast_packet_received () const
 
void dco_configure (SessionStats::DCOTransportSource *source)
 
bool dco_update ()
 
std::shared_ptr< inc_callback_tset_inc_callback (Stats stat, inc_callback_t callback)
 Sets a callback to be triggered upon increment of stats.
 
- Public Member Functions inherited from openvpn::RC< thread_safe_refcount >
 RC () noexcept=default
 
 RC (const RC &)=delete
 
virtual ~RC ()=default
 
RCoperator= (const RC &)=delete
 
olong use_count () const noexcept
 Delegates call to RCImpl and returns the result.
 

Static Public Member Functions

static const char * stat_name (const size_t type)
 
- Static Public Member Functions inherited from openvpn::RC< thread_safe_refcount >
static constexpr bool is_thread_safe ()
 Delegates call to RCImpl and returns the result.
 

Protected Member Functions

void session_stats_set_verbose (const bool v)
 

Private Attributes

bool verbose_
 
Time last_packet_received_
 
DCOTransportSource::Ptr dco_
 
volatile count_t stats_ [N_STATS]
 
std::array< std::weak_ptr< inc_callback_t >, N_STATSinc_callbacks_
 

Detailed Description

Definition at line 27 of file sessionstats.hpp.

Member Typedef Documentation

◆ inc_callback_t

using openvpn::SessionStats::inc_callback_t = std::function<void(const count_t value)>

Definition at line 31 of file sessionstats.hpp.

◆ Ptr

Definition at line 30 of file sessionstats.hpp.

Member Enumeration Documentation

◆ Stats

Enumerator
BYTES_IN 
BYTES_OUT 
PACKETS_IN 
PACKETS_OUT 
TUN_BYTES_IN 
TUN_BYTES_OUT 
TUN_PACKETS_IN 
TUN_PACKETS_OUT 
N_STATS 

Definition at line 33 of file sessionstats.hpp.

Constructor & Destructor Documentation

◆ SessionStats()

openvpn::SessionStats::SessionStats ( )
inline

Definition at line 47 of file sessionstats.hpp.

Member Function Documentation

◆ dco_configure()

void openvpn::SessionStats::dco_configure ( SessionStats::DCOTransportSource source)
inline

Definition at line 197 of file sessionstats.hpp.

◆ dco_update()

bool openvpn::SessionStats::dco_update ( )
inline

Definition at line 202 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ error()

virtual void openvpn::SessionStats::error ( const size_t  type,
const std::string *  text = nullptr 
)
inlinevirtual

Reimplemented in openvpn::ClientAPI::MySessionStats, MySessionStats, MySessionStats, MySessionStats, and MySessionStats.

Definition at line 53 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ get_stat()

count_t openvpn::SessionStats::get_stat ( const size_t  type) const
inline

Definition at line 78 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ get_stat_fast()

count_t openvpn::SessionStats::get_stat_fast ( const size_t  type) const
inline

Definition at line 86 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ inc_stat()

void openvpn::SessionStats::inc_stat ( const size_t  type,
const count_t  value 
)
inline

Definition at line 68 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ last_packet_received()

const Time & openvpn::SessionStats::last_packet_received ( ) const
inline

Definition at line 115 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ session_stats_set_verbose()

void openvpn::SessionStats::session_stats_set_verbose ( const bool  v)
inlineprotected

Definition at line 245 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ set_inc_callback()

std::shared_ptr< inc_callback_t > openvpn::SessionStats::set_inc_callback ( Stats  stat,
inc_callback_t  callback 
)
inline

Sets a callback to be triggered upon increment of stats.

The callback can be removed by client code by deleting the returned shared pointer

Parameters
statType of stat to be tracked
callbackNotification callback
Returns
Shared pointer which maintains the lifetime of the callback

Definition at line 237 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ stat_name()

static const char * openvpn::SessionStats::stat_name ( const size_t  type)
inlinestatic

Definition at line 91 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ update_last_packet_received()

void openvpn::SessionStats::update_last_packet_received ( const Time now)
inline

Definition at line 110 of file sessionstats.hpp.

Here is the caller graph for this function:

◆ verbose()

bool openvpn::SessionStats::verbose ( ) const
inline

Definition at line 59 of file sessionstats.hpp.

Member Data Documentation

◆ dco_

DCOTransportSource::Ptr openvpn::SessionStats::dco_
private

Definition at line 253 of file sessionstats.hpp.

◆ inc_callbacks_

std::array<std::weak_ptr<inc_callback_t>, N_STATS> openvpn::SessionStats::inc_callbacks_
private

Definition at line 255 of file sessionstats.hpp.

◆ last_packet_received_

Time openvpn::SessionStats::last_packet_received_
private

Definition at line 252 of file sessionstats.hpp.

◆ stats_

volatile count_t openvpn::SessionStats::stats_[N_STATS]
private

Definition at line 254 of file sessionstats.hpp.

◆ verbose_

bool openvpn::SessionStats::verbose_
private

Definition at line 251 of file sessionstats.hpp.


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