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

#include <proto.hpp>

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

Classes

class  IvProtoHelper
 
class  KeyContext
 
class  Packet
 
class  PacketType
 
class  ProtoConfig
 
class  PsidCookieHelper
 
class  TLSAuthPreValidate
 
class  TLSCryptPreValidate
 
class  TLSWrapPreValidate
 

Public Member Functions

 OPENVPN_UNTAGGED_EXCEPTION_INHERIT (option_error, proto_error)
 
 OPENVPN_UNTAGGED_EXCEPTION_INHERIT (option_error, process_server_push_error)
 
 OPENVPN_UNTAGGED_EXCEPTION_INHERIT (option_error, proto_option_error)
 
std::string dump_packet (const Buffer &buf)
 
template<typename S >
void write_control_string (const S &str)
 
 OPENVPN_SIMPLE_EXCEPTION (select_key_context_error)
 
 ProtoContext (ProtoContextCallbackInterface *cb_arg, const ProtoConfig::Ptr &config_arg, const SessionStats::Ptr &stats_arg)
 
void reset_tls_wrap_mode (const ProtoConfig &c)
 
uint32_t get_tls_warnings () const
 
bool uses_bs64_cipher () const
 
void reset_tls_crypt (const ProtoConfig &c, const OpenVPNStaticKey &key)
 
void set_dynamic_tls_crypt (const ProtoConfig &c, const KeyContext::Ptr &key_ctx)
 
void reset_tls_crypt_server (const ProtoConfig &c)
 
void reset (const ProtoSessionID cookie_psid=ProtoSessionID())
 Resets ProtoContext *this to it's initial state.
 
void set_protocol (const Protocol &p)
 
void pre_destroy ()
 
bool primary_defined ()
 
virtual ~ProtoContext ()=default
 
PacketType packet_type (const Buffer &buf)
 
void start (const ProtoSessionID cookie_psid=ProtoSessionID())
 Initialize the state machine and start protocol negotiation.
 
void renegotiate ()
 
void flush (const bool control_channel)
 
void housekeeping ()
 
Time next_housekeeping () const
 
void control_send (BufferPtr &&app_bp)
 
void control_send (BufferAllocated &&app_buf)
 
bool control_net_validate (const PacketType &type, const Buffer &net_buf)
 
bool control_net_recv (const PacketType &type, BufferAllocated &&net_buf)
 
bool control_net_recv (const PacketType &type, BufferPtr &&net_bp)
 
void data_encrypt (BufferAllocated &in_out)
 
bool data_decrypt (const PacketType &type, BufferAllocated &in_out)
 
void disconnect (const Error::Type reason)
 
void send_explicit_exit_notify ()
 
void update_last_sent ()
 
bool data_channel_ready () const
 
unsigned int negotiations () const
 
const Time::Duration & slowest_handshake ()
 
bool invalidated () const
 
Error::Type invalidation_reason () const
 
void init_data_channel ()
 
void process_push (const OptionList &opt, const ProtoContextCompressionOptions &pco)
 
size_t align_adjust_hint () const
 
bool is_keepalive_enabled () const
 
void disable_keepalive (unsigned int &keepalive_ping, unsigned int &keepalive_timeout)
 
void data_limit_notify (const unsigned int key_id, const DataLimit::Mode cdl_mode, const DataLimit::State cdl_status)
 
CryptoDCSettingsdc_settings ()
 
void reset_dc_factory ()
 
void set_local_peer_id (const int local_peer_id)
 
const Timenow () const
 
void update_now ()
 
const Frameframe () const
 
const Frame::Ptrframeptr () const
 
const Modemode () const
 
bool is_server () const
 
bool is_client () const
 
bool is_tcp ()
 
bool is_udp ()
 
const ProtoConfigconf () const
 
ProtoConfigconf ()
 
ProtoConfig::Ptr conf_ptr () const
 
SessionStatsstat () const
 
bool is_state_client_wait_reset_ack () const
 

Static Public Member Functions

static const char * opcode_name (const unsigned int opcode)
 
static void write_uint16_length (const size_t size, Buffer &buf)
 
static uint16_t read_uint16_length (Buffer &buf)
 
template<typename S >
static void write_auth_string (const S &str, Buffer &buf)
 
template<typename S >
static S read_auth_string (Buffer &buf)
 
template<typename S >
static void write_control_string (const S &str, Buffer &buf)
 
static void write_empty_string (Buffer &buf)
 
template<typename S >
static S read_control_string (const Buffer &buf)
 
- Static Public Member Functions inherited from openvpn::logging::LoggingMixin< OPENVPN_DEBUG_PROTO, logging::LOG_LEVEL_VERB, ProtoContext >
static int log_level ()
 return the current logging level for all logging
 
static void set_log_level (int level)
 set the log level for all loggigng
 

Protected Types

enum  {
  KEY_ID_MASK = 0x07 , OPCODE_SHIFT = 3 , CONTROL_SOFT_RESET_V1 = 3 , CONTROL_V1 = 4 ,
  CONTROL_WKC_V1 = 11 , ACK_V1 = 5 , DATA_V1 = 6 , DATA_V2 = 9 ,
  CONTROL_HARD_RESET_CLIENT_V2 = 7 , CONTROL_HARD_RESET_CLIENT_V3 = 10 , CONTROL_HARD_RESET_SERVER_V2 = 8 , INVALID_OPCODE = 0 ,
  OP_SIZE_V2 = 4 , OP_PEER_ID_UNDEF = 0x00FFFFFF , STATE_UNDEF = -1 , C_WAIT_RESET_ACK = 0 ,
  C_WAIT_AUTH_ACK = 1 , S_WAIT_RESET_ACK = 2 , S_WAIT_AUTH_ACK = 3 , LAST_ACK_STATE = 3 ,
  C_INITIAL = 4 , C_WAIT_RESET = 5 , C_WAIT_AUTH = 6 , S_INITIAL = 7 ,
  S_WAIT_RESET = 8 , S_WAIT_AUTH = 9 , ACTIVE = 10
}
 
enum  iv_proto_flag : unsigned int {
  IV_PROTO_DATA_V2 = (1 << 1) , IV_PROTO_REQUEST_PUSH = (1 << 2) , IV_PROTO_TLS_KEY_EXPORT = (1 << 3) , IV_PROTO_AUTH_PENDING_KW = (1 << 4) ,
  IV_PROTO_NCP_P2P = (1 << 5) , IV_PROTO_DNS_OPTION = (1 << 6) , IV_PROTO_CC_EXIT_NOTIFY = (1 << 7) , IV_PROTO_AUTH_FAIL_TEMP = (1 << 8) ,
  IV_PROTO_DYN_TLS_CRYPT = (1 << 9) , IV_PROTO_DATA_EPOCH = (1 << 10) , IV_PROTO_DNS_OPTION_V2 = (1 << 11) , IV_PROTO_PUSH_UPDATE = (1 << 12)
}
 
enum  tlv_types : uint16_t { EARLY_NEG_FLAGS = 0x0001 }
 
enum  early_neg_flags : uint16_t { EARLY_NEG_FLAG_RESEND_WKC = 0x0001 }
 

Protected Member Functions

int primary_state () const
 

Static Protected Member Functions

static unsigned int opcode_extract (const unsigned int op)
 
static unsigned int key_id_extract (const unsigned int op)
 
static size_t op_head_size (const unsigned int op)
 
static unsigned char op_compose (const unsigned int opcode, const unsigned int key_id)
 
static unsigned int op32_compose (const unsigned int opcode, const unsigned int key_id, const int op_peer_id)
 

Static Protected Attributes

static constexpr size_t APP_MSG_MAX = 65536
 
- Static Protected Attributes inherited from openvpn::logging::LoggingMixin< OPENVPN_DEBUG_PROTO, logging::LOG_LEVEL_VERB, ProtoContext >
static logging::Logger< DEFAULT_LOG_LEVEL, MAX_LEVEL > log_
 

Private Types

enum  TLSWrapMode { TLS_PLAIN , TLS_AUTH , TLS_CRYPT , TLS_CRYPT_V2 }
 

Private Member Functions

void reset_all ()
 
void client_auth (Buffer &buf)
 
void update_last_received ()
 
void net_send (const unsigned int key_id, const Packet &net_pkt)
 
void app_recv (const unsigned int key_id, BufferPtr &&to_app_buf)
 
bool renegotiate_request (Packet &pkt)
 
KeyContextselect_key_context (const PacketType &type, const bool control)
 
KeyContextselect_control_send_context ()
 
void keepalive_housekeeping ()
 
bool process_events ()
 
void new_secondary_key (const bool initiator)
 
void promote_secondary_to_primary ()
 
void process_primary_event ()
 
void process_secondary_event ()
 
std::string debug_prefix ()
 
unsigned int next_key_id ()
 
void keepalive_parms_modified ()
 
void tls_crypt_append_wkc (BufferAllocated &dst)
 

Private Attributes

ProtoContextCallbackInterfaceproto_callback
 
ProtoConfig::Ptr config
 
SessionStats::Ptr stats
 
size_t hmac_size
 
TLSWrapMode tls_wrap_mode
 
Mode mode_
 
unsigned int upcoming_key_id = 0
 
unsigned int n_key_ids
 
TimePtr now_
 
Time keepalive_xmit
 
Time keepalive_expire
 
Time::Duration slowest_handshake_
 
OvpnHMACInstance::Ptr ta_hmac_send
 
OvpnHMACInstance::Ptr ta_hmac_recv
 
TLSCryptInstance::Ptr tls_crypt_send
 
TLSCryptInstance::Ptr tls_crypt_recv
 
TLSCryptInstance::Ptr tls_crypt_server
 
TLSCryptMetadata::Ptr tls_crypt_metadata
 
PacketIDControlSend ta_pid_send
 
PacketIDControlReceive ta_pid_recv
 
ProtoSessionID psid_self
 
ProtoSessionID psid_peer
 
KeyContext::Ptr primary
 
KeyContext::Ptr secondary
 
bool dc_deferred = false
 

Static Private Attributes

static constexpr PacketIDControl::id_t EARLY_NEG_START = 0x0f000000
 

Additional Inherited Members

- Static Public Attributes inherited from openvpn::logging::LoggingMixin< OPENVPN_DEBUG_PROTO, logging::LOG_LEVEL_VERB, ProtoContext >
static constexpr int max_log_level
 
static constexpr int default_log_level
 

Detailed Description

Definition at line 205 of file proto.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
KEY_ID_MASK 
OPCODE_SHIFT 
CONTROL_SOFT_RESET_V1 
CONTROL_V1 
CONTROL_WKC_V1 
ACK_V1 
DATA_V1 
DATA_V2 
CONTROL_HARD_RESET_CLIENT_V2 
CONTROL_HARD_RESET_CLIENT_V3 
CONTROL_HARD_RESET_SERVER_V2 
INVALID_OPCODE 
OP_SIZE_V2 
OP_PEER_ID_UNDEF 
STATE_UNDEF 
C_WAIT_RESET_ACK 
C_WAIT_AUTH_ACK 
S_WAIT_RESET_ACK 
S_WAIT_AUTH_ACK 
LAST_ACK_STATE 
C_INITIAL 
C_WAIT_RESET 
C_WAIT_AUTH 
S_INITIAL 
S_WAIT_RESET 
S_WAIT_AUTH 
ACTIVE 

Definition at line 216 of file proto.hpp.

◆ early_neg_flags

enum openvpn::ProtoContext::early_neg_flags : uint16_t
protected
Enumerator
EARLY_NEG_FLAG_RESEND_WKC 

Definition at line 295 of file proto.hpp.

◆ iv_proto_flag

enum openvpn::ProtoContext::iv_proto_flag : unsigned int
protected
Enumerator
IV_PROTO_DATA_V2 
IV_PROTO_REQUEST_PUSH 
IV_PROTO_TLS_KEY_EXPORT 
IV_PROTO_AUTH_PENDING_KW 
IV_PROTO_NCP_P2P 
IV_PROTO_DNS_OPTION 
IV_PROTO_CC_EXIT_NOTIFY 
IV_PROTO_AUTH_FAIL_TEMP 
IV_PROTO_DYN_TLS_CRYPT 
IV_PROTO_DATA_EPOCH 
IV_PROTO_DNS_OPTION_V2 
IV_PROTO_PUSH_UPDATE 

Definition at line 269 of file proto.hpp.

◆ TLSWrapMode

Enumerator
TLS_PLAIN 
TLS_AUTH 
TLS_CRYPT 
TLS_CRYPT_V2 

Definition at line 4510 of file proto.hpp.

◆ tlv_types

enum openvpn::ProtoContext::tlv_types : uint16_t
protected
Enumerator
EARLY_NEG_FLAGS 

Definition at line 290 of file proto.hpp.

Constructor & Destructor Documentation

◆ ProtoContext()

openvpn::ProtoContext::ProtoContext ( ProtoContextCallbackInterface cb_arg,
const ProtoConfig::Ptr config_arg,
const SessionStats::Ptr stats_arg 
)
inline

Definition at line 3859 of file proto.hpp.

◆ ~ProtoContext()

virtual openvpn::ProtoContext::~ProtoContext ( )
virtualdefault

Member Function Documentation

◆ align_adjust_hint()

size_t openvpn::ProtoContext::align_adjust_hint ( ) const
inline

Definition at line 4371 of file proto.hpp.

Here is the caller graph for this function:

◆ app_recv()

void openvpn::ProtoContext::app_recv ( const unsigned int  key_id,
BufferPtr &&  to_app_buf 
)
inlineprivate

Definition at line 4545 of file proto.hpp.

Here is the caller graph for this function:

◆ client_auth()

void openvpn::ProtoContext::client_auth ( Buffer buf)
inlineprivate

Definition at line 4530 of file proto.hpp.

Here is the caller graph for this function:

◆ conf() [1/2]

ProtoConfig & openvpn::ProtoContext::conf ( )
inline

Definition at line 4478 of file proto.hpp.

◆ conf() [2/2]

const ProtoConfig & openvpn::ProtoContext::conf ( ) const
inline

Definition at line 4474 of file proto.hpp.

Here is the caller graph for this function:

◆ conf_ptr()

ProtoConfig::Ptr openvpn::ProtoContext::conf_ptr ( ) const
inline

Definition at line 4482 of file proto.hpp.

Here is the caller graph for this function:

◆ control_net_recv() [1/2]

bool openvpn::ProtoContext::control_net_recv ( const PacketType type,
BufferAllocated &&  net_buf 
)
inline

Definition at line 4224 of file proto.hpp.

Here is the caller graph for this function:

◆ control_net_recv() [2/2]

bool openvpn::ProtoContext::control_net_recv ( const PacketType type,
BufferPtr &&  net_bp 
)
inline

Definition at line 4235 of file proto.hpp.

◆ control_net_validate()

bool openvpn::ProtoContext::control_net_validate ( const PacketType type,
const Buffer net_buf 
)
inline

Definition at line 4217 of file proto.hpp.

◆ control_send() [1/2]

void openvpn::ProtoContext::control_send ( BufferAllocated &&  app_buf)
inline

Definition at line 4211 of file proto.hpp.

◆ control_send() [2/2]

void openvpn::ProtoContext::control_send ( BufferPtr &&  app_bp)
inline

Definition at line 4206 of file proto.hpp.

Here is the caller graph for this function:

◆ data_channel_ready()

bool openvpn::ProtoContext::data_channel_ready ( ) const
inline

Definition at line 4317 of file proto.hpp.

◆ data_decrypt()

bool openvpn::ProtoContext::data_decrypt ( const PacketType type,
BufferAllocated in_out 
)
inline

Definition at line 4254 of file proto.hpp.

Here is the caller graph for this function:

◆ data_encrypt()

void openvpn::ProtoContext::data_encrypt ( BufferAllocated in_out)
inline

Definition at line 4244 of file proto.hpp.

Here is the caller graph for this function:

◆ data_limit_notify()

void openvpn::ProtoContext::data_limit_notify ( const unsigned int  key_id,
const DataLimit::Mode  cdl_mode,
const DataLimit::State  cdl_status 
)
inline

Definition at line 4401 of file proto.hpp.

Here is the caller graph for this function:

◆ dc_settings()

CryptoDCSettings & openvpn::ProtoContext::dc_settings ( )
inline

Definition at line 4412 of file proto.hpp.

Here is the caller graph for this function:

◆ debug_prefix()

std::string openvpn::ProtoContext::debug_prefix ( )
inlineprivate

Definition at line 4757 of file proto.hpp.

Here is the caller graph for this function:

◆ disable_keepalive()

void openvpn::ProtoContext::disable_keepalive ( unsigned int &  keepalive_ping,
unsigned int &  keepalive_timeout 
)
inline

Definition at line 4385 of file proto.hpp.

Here is the caller graph for this function:

◆ disconnect()

void openvpn::ProtoContext::disconnect ( const Error::Type  reason)
inline

Definition at line 4279 of file proto.hpp.

Here is the caller graph for this function:

◆ dump_packet()

std::string openvpn::ProtoContext::dump_packet ( const Buffer buf)
inline

Definition at line 1419 of file proto.hpp.

Here is the caller graph for this function:

◆ flush()

void openvpn::ProtoContext::flush ( const bool  control_channel)
inline

Definition at line 4149 of file proto.hpp.

Here is the caller graph for this function:

◆ frame()

const Frame & openvpn::ProtoContext::frame ( ) const
inline

Definition at line 4440 of file proto.hpp.

Here is the caller graph for this function:

◆ frameptr()

const Frame::Ptr & openvpn::ProtoContext::frameptr ( ) const
inline

Definition at line 4444 of file proto.hpp.

◆ get_tls_warnings()

uint32_t openvpn::ProtoContext::get_tls_warnings ( ) const
inline

Definition at line 3910 of file proto.hpp.

Here is the caller graph for this function:

◆ housekeeping()

void openvpn::ProtoContext::housekeeping ( )
inline

Definition at line 4167 of file proto.hpp.

Here is the caller graph for this function:

◆ init_data_channel()

void openvpn::ProtoContext::init_data_channel ( )
inline

Definition at line 4349 of file proto.hpp.

Here is the caller graph for this function:

◆ invalidated()

bool openvpn::ProtoContext::invalidated ( ) const
inline

Definition at line 4335 of file proto.hpp.

Here is the caller graph for this function:

◆ invalidation_reason()

Error::Type openvpn::ProtoContext::invalidation_reason ( ) const
inline

Definition at line 4341 of file proto.hpp.

Here is the caller graph for this function:

◆ is_client()

bool openvpn::ProtoContext::is_client ( ) const
inline

Definition at line 4458 of file proto.hpp.

Here is the caller graph for this function:

◆ is_keepalive_enabled()

bool openvpn::ProtoContext::is_keepalive_enabled ( ) const
inline

Definition at line 4377 of file proto.hpp.

Here is the caller graph for this function:

◆ is_server()

bool openvpn::ProtoContext::is_server ( ) const
inline

Definition at line 4454 of file proto.hpp.

Here is the caller graph for this function:

◆ is_state_client_wait_reset_ack()

bool openvpn::ProtoContext::is_state_client_wait_reset_ack ( ) const
inline

Definition at line 4494 of file proto.hpp.

◆ is_tcp()

bool openvpn::ProtoContext::is_tcp ( )
inline

Definition at line 4464 of file proto.hpp.

Here is the caller graph for this function:

◆ is_udp()

bool openvpn::ProtoContext::is_udp ( )
inline

Definition at line 4468 of file proto.hpp.

Here is the caller graph for this function:

◆ keepalive_housekeeping()

void openvpn::ProtoContext::keepalive_housekeeping ( )
inlineprivate

Definition at line 4609 of file proto.hpp.

Here is the caller graph for this function:

◆ keepalive_parms_modified()

void openvpn::ProtoContext::keepalive_parms_modified ( )
inlineprivate

Definition at line 4785 of file proto.hpp.

Here is the caller graph for this function:

◆ key_id_extract()

static unsigned int openvpn::ProtoContext::key_id_extract ( const unsigned int  op)
inlinestaticprotected

Definition at line 305 of file proto.hpp.

Here is the caller graph for this function:

◆ mode()

const Mode & openvpn::ProtoContext::mode ( ) const
inline

Definition at line 4450 of file proto.hpp.

Here is the caller graph for this function:

◆ negotiations()

unsigned int openvpn::ProtoContext::negotiations ( ) const
inline

Definition at line 4323 of file proto.hpp.

Here is the caller graph for this function:

◆ net_send()

void openvpn::ProtoContext::net_send ( const unsigned int  key_id,
const Packet net_pkt 
)
inlineprivate

Definition at line 4540 of file proto.hpp.

Here is the caller graph for this function:

◆ new_secondary_key()

void openvpn::ProtoContext::new_secondary_key ( const bool  initiator)
inlineprivate

Definition at line 4654 of file proto.hpp.

Here is the caller graph for this function:

◆ next_housekeeping()

Time openvpn::ProtoContext::next_housekeeping ( ) const
inline

Definition at line 4187 of file proto.hpp.

Here is the caller graph for this function:

◆ next_key_id()

unsigned int openvpn::ProtoContext::next_key_id ( )
inlineprivate

Definition at line 4774 of file proto.hpp.

Here is the caller graph for this function:

◆ now()

const Time & openvpn::ProtoContext::now ( ) const
inline

Definition at line 4430 of file proto.hpp.

Here is the caller graph for this function:

◆ op32_compose()

static unsigned int openvpn::ProtoContext::op32_compose ( const unsigned int  opcode,
const unsigned int  key_id,
const int  op_peer_id 
)
inlinestaticprotected

Definition at line 322 of file proto.hpp.

Here is the caller graph for this function:

◆ op_compose()

static unsigned char openvpn::ProtoContext::op_compose ( const unsigned int  opcode,
const unsigned int  key_id 
)
inlinestaticprotected

Definition at line 315 of file proto.hpp.

Here is the caller graph for this function:

◆ op_head_size()

static size_t openvpn::ProtoContext::op_head_size ( const unsigned int  op)
inlinestaticprotected

Definition at line 310 of file proto.hpp.

Here is the caller graph for this function:

◆ opcode_extract()

static unsigned int openvpn::ProtoContext::opcode_extract ( const unsigned int  op)
inlinestaticprotected

Definition at line 300 of file proto.hpp.

Here is the caller graph for this function:

◆ opcode_name()

static const char * openvpn::ProtoContext::opcode_name ( const unsigned int  opcode)
inlinestatic

Definition at line 1393 of file proto.hpp.

Here is the caller graph for this function:

◆ OPENVPN_SIMPLE_EXCEPTION()

openvpn::ProtoContext::OPENVPN_SIMPLE_EXCEPTION ( select_key_context_error  )

◆ OPENVPN_UNTAGGED_EXCEPTION_INHERIT() [1/3]

openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT ( option_error  ,
process_server_push_error   
)

◆ OPENVPN_UNTAGGED_EXCEPTION_INHERIT() [2/3]

openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT ( option_error  ,
proto_error   
)

◆ OPENVPN_UNTAGGED_EXCEPTION_INHERIT() [3/3]

openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT ( option_error  ,
proto_option_error   
)

◆ packet_type()

PacketType openvpn::ProtoContext::packet_type ( const Buffer buf)
inline

Definition at line 4110 of file proto.hpp.

Here is the caller graph for this function:

◆ pre_destroy()

void openvpn::ProtoContext::pre_destroy ( )
inline

Definition at line 4096 of file proto.hpp.

Here is the caller graph for this function:

◆ primary_defined()

bool openvpn::ProtoContext::primary_defined ( )
inline

Definition at line 4102 of file proto.hpp.

Here is the caller graph for this function:

◆ primary_state()

int openvpn::ProtoContext::primary_state ( ) const
inlineprotected

Definition at line 4500 of file proto.hpp.

Here is the caller graph for this function:

◆ process_events()

bool openvpn::ProtoContext::process_events ( )
inlineprivate

Definition at line 4629 of file proto.hpp.

Here is the caller graph for this function:

◆ process_primary_event()

void openvpn::ProtoContext::process_primary_event ( )
inlineprivate

Definition at line 4676 of file proto.hpp.

Here is the caller graph for this function:

◆ process_push()

void openvpn::ProtoContext::process_push ( const OptionList opt,
const ProtoContextCompressionOptions pco 
)
inline

Definition at line 4361 of file proto.hpp.

Here is the caller graph for this function:

◆ process_secondary_event()

void openvpn::ProtoContext::process_secondary_event ( )
inlineprivate

Definition at line 4715 of file proto.hpp.

Here is the caller graph for this function:

◆ promote_secondary_to_primary()

void openvpn::ProtoContext::promote_secondary_to_primary ( )
inlineprivate

Definition at line 4666 of file proto.hpp.

Here is the caller graph for this function:

◆ read_auth_string()

template<typename S >
static S openvpn::ProtoContext::read_auth_string ( Buffer buf)
inlinestatic

Definition at line 1549 of file proto.hpp.

◆ read_control_string()

template<typename S >
static S openvpn::ProtoContext::read_control_string ( const Buffer buf)
inlinestatic

Definition at line 1575 of file proto.hpp.

◆ read_uint16_length()

static uint16_t openvpn::ProtoContext::read_uint16_length ( Buffer buf)
inlinestatic

Definition at line 1522 of file proto.hpp.

Here is the caller graph for this function:

◆ renegotiate()

void openvpn::ProtoContext::renegotiate ( )
inline

Definition at line 4132 of file proto.hpp.

Here is the caller graph for this function:

◆ renegotiate_request()

bool openvpn::ProtoContext::renegotiate_request ( Packet pkt)
inlineprivate

Definition at line 4551 of file proto.hpp.

Here is the caller graph for this function:

◆ reset()

void openvpn::ProtoContext::reset ( const ProtoSessionID  cookie_psid = ProtoSessionID())
inline

Resets ProtoContext *this to it's initial state.

Parameters
cookie_psidthe ProtoSessionID parameter that allows a server implementation using the psid cookie mechanism to pass in the verified hmac server session cookie. In the client implementation, the parameter is meaningless and defaults to an empty ProtoSessionID which is created at compile time since the default ProtoSessionID ctor is constexpr. For the default cookie_psid, defined() returns false (vs true for the verified session cookie) so the absence of a parameter selects the correct code path.

tls-auth/tls-crypt packet id. We start with a different id here to indicate EARLY_NEG_START/CONTROL_WKC_V1 support

Initialize tls_auth packet ID for the send case

The second argument sets the expected packet id. If the server implementation is using the psid cookie mechanism, the state creation is deferred until the client's second packet, id 1, is received; otherwise we expect to handle the 1st packet, id 0.

Definition at line 3993 of file proto.hpp.

Here is the caller graph for this function:

◆ reset_all()

void openvpn::ProtoContext::reset_all ( )
inlineprivate

Definition at line 4520 of file proto.hpp.

Here is the caller graph for this function:

◆ reset_dc_factory()

void openvpn::ProtoContext::reset_dc_factory ( )
inline

Definition at line 4418 of file proto.hpp.

Here is the caller graph for this function:

◆ reset_tls_crypt()

void openvpn::ProtoContext::reset_tls_crypt ( const ProtoConfig c,
const OpenVPNStaticKey key 
)
inline

Definition at line 3924 of file proto.hpp.

Here is the caller graph for this function:

◆ reset_tls_crypt_server()

void openvpn::ProtoContext::reset_tls_crypt_server ( const ProtoConfig c)
inline

Definition at line 3961 of file proto.hpp.

Here is the caller graph for this function:

◆ reset_tls_wrap_mode()

void openvpn::ProtoContext::reset_tls_wrap_mode ( const ProtoConfig c)
inline

Definition at line 3872 of file proto.hpp.

Here is the caller graph for this function:

◆ select_control_send_context()

KeyContext & openvpn::ProtoContext::select_control_send_context ( )
inlineprivate

Definition at line 4599 of file proto.hpp.

Here is the caller graph for this function:

◆ select_key_context()

KeyContext & openvpn::ProtoContext::select_key_context ( const PacketType type,
const bool  control 
)
inlineprivate

Definition at line 4568 of file proto.hpp.

Here is the caller graph for this function:

◆ send_explicit_exit_notify()

void openvpn::ProtoContext::send_explicit_exit_notify ( )
inline

Definition at line 4289 of file proto.hpp.

Here is the caller graph for this function:

◆ set_dynamic_tls_crypt()

void openvpn::ProtoContext::set_dynamic_tls_crypt ( const ProtoConfig c,
const KeyContext::Ptr key_ctx 
)
inline

Definition at line 3940 of file proto.hpp.

Here is the caller graph for this function:

◆ set_local_peer_id()

void openvpn::ProtoContext::set_local_peer_id ( const int  local_peer_id)
inline

Definition at line 4424 of file proto.hpp.

Here is the caller graph for this function:

◆ set_protocol()

void openvpn::ProtoContext::set_protocol ( const Protocol p)
inline

Definition at line 4085 of file proto.hpp.

Here is the caller graph for this function:

◆ slowest_handshake()

const Time::Duration & openvpn::ProtoContext::slowest_handshake ( )
inline

Definition at line 4329 of file proto.hpp.

Here is the caller graph for this function:

◆ start()

void openvpn::ProtoContext::start ( const ProtoSessionID  cookie_psid = ProtoSessionID())
inline

Initialize the state machine and start protocol negotiation.

Called by both derived client and server protocol classes, this function hands off to the implementation in KeyContext::start()

Parameters
cookie_psidsee ProtoContext::reset()

Definition at line 4123 of file proto.hpp.

Here is the caller graph for this function:

◆ stat()

SessionStats & openvpn::ProtoContext::stat ( ) const
inline

Definition at line 4488 of file proto.hpp.

Here is the caller graph for this function:

◆ tls_crypt_append_wkc()

void openvpn::ProtoContext::tls_crypt_append_wkc ( BufferAllocated dst)
inlineprivate

Definition at line 4797 of file proto.hpp.

Here is the caller graph for this function:

◆ update_last_received()

void openvpn::ProtoContext::update_last_received ( )
inlineprivate

Definition at line 4535 of file proto.hpp.

Here is the caller graph for this function:

◆ update_last_sent()

void openvpn::ProtoContext::update_last_sent ( )
inline

Definition at line 4310 of file proto.hpp.

Here is the caller graph for this function:

◆ update_now()

void openvpn::ProtoContext::update_now ( )
inline

Definition at line 4434 of file proto.hpp.

Here is the caller graph for this function:

◆ uses_bs64_cipher()

bool openvpn::ProtoContext::uses_bs64_cipher ( ) const
inline

Definition at line 3919 of file proto.hpp.

Here is the caller graph for this function:

◆ write_auth_string()

template<typename S >
static void openvpn::ProtoContext::write_auth_string ( const S &  str,
Buffer buf 
)
inlinestatic

Definition at line 1535 of file proto.hpp.

Here is the caller graph for this function:

◆ write_control_string() [1/2]

template<typename S >
void openvpn::ProtoContext::write_control_string ( const S &  str)
inline

Definition at line 1596 of file proto.hpp.

◆ write_control_string() [2/2]

template<typename S >
static void openvpn::ProtoContext::write_control_string ( const S &  str,
Buffer buf 
)
inlinestatic

Definition at line 1562 of file proto.hpp.

Here is the caller graph for this function:

◆ write_empty_string()

static void openvpn::ProtoContext::write_empty_string ( Buffer buf)
inlinestatic

Definition at line 1569 of file proto.hpp.

Here is the caller graph for this function:

◆ write_uint16_length()

static void openvpn::ProtoContext::write_uint16_length ( const size_t  size,
Buffer buf 
)
inlinestatic

Definition at line 1514 of file proto.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ APP_MSG_MAX

constexpr size_t openvpn::ProtoContext::APP_MSG_MAX = 65536
staticconstexprprotected

Definition at line 214 of file proto.hpp.

◆ config

ProtoConfig::Ptr openvpn::ProtoContext::config
private

Definition at line 4813 of file proto.hpp.

◆ dc_deferred

bool openvpn::ProtoContext::dc_deferred = false
private

Definition at line 4845 of file proto.hpp.

◆ EARLY_NEG_START

constexpr PacketIDControl::id_t openvpn::ProtoContext::EARLY_NEG_START = 0x0f000000
staticconstexprprivate

Definition at line 4518 of file proto.hpp.

◆ hmac_size

size_t openvpn::ProtoContext::hmac_size
private

Definition at line 4816 of file proto.hpp.

◆ keepalive_expire

Time openvpn::ProtoContext::keepalive_expire
private

Definition at line 4824 of file proto.hpp.

◆ keepalive_xmit

Time openvpn::ProtoContext::keepalive_xmit
private

Definition at line 4823 of file proto.hpp.

◆ mode_

Mode openvpn::ProtoContext::mode_
private

Definition at line 4818 of file proto.hpp.

◆ n_key_ids

unsigned int openvpn::ProtoContext::n_key_ids
private

Definition at line 4820 of file proto.hpp.

◆ now_

TimePtr openvpn::ProtoContext::now_
private

Definition at line 4822 of file proto.hpp.

◆ primary

KeyContext::Ptr openvpn::ProtoContext::primary
private

Definition at line 4843 of file proto.hpp.

◆ proto_callback

ProtoContextCallbackInterface* openvpn::ProtoContext::proto_callback
private

the class that uses this class needs to be called back on a few things. Typically a class that uses this class as field for composition. This parent/callback class needs to ensure that it lives longer than this class, e.g. by having this class as field as this class blindly assumes that this pointer is always valid for its lifetime

Definition at line 4811 of file proto.hpp.

◆ psid_peer

ProtoSessionID openvpn::ProtoContext::psid_peer
private

Definition at line 4841 of file proto.hpp.

◆ psid_self

ProtoSessionID openvpn::ProtoContext::psid_self
private

Definition at line 4840 of file proto.hpp.

◆ secondary

KeyContext::Ptr openvpn::ProtoContext::secondary
private

Definition at line 4844 of file proto.hpp.

◆ slowest_handshake_

Time::Duration openvpn::ProtoContext::slowest_handshake_
private

Definition at line 4826 of file proto.hpp.

◆ stats

SessionStats::Ptr openvpn::ProtoContext::stats
private

Definition at line 4814 of file proto.hpp.

◆ ta_hmac_recv

OvpnHMACInstance::Ptr openvpn::ProtoContext::ta_hmac_recv
private

Definition at line 4829 of file proto.hpp.

◆ ta_hmac_send

OvpnHMACInstance::Ptr openvpn::ProtoContext::ta_hmac_send
private

Definition at line 4828 of file proto.hpp.

◆ ta_pid_recv

PacketIDControlReceive openvpn::ProtoContext::ta_pid_recv
private

Definition at line 4838 of file proto.hpp.

◆ ta_pid_send

PacketIDControlSend openvpn::ProtoContext::ta_pid_send
private

Definition at line 4837 of file proto.hpp.

◆ tls_crypt_metadata

TLSCryptMetadata::Ptr openvpn::ProtoContext::tls_crypt_metadata
private

Definition at line 4835 of file proto.hpp.

◆ tls_crypt_recv

TLSCryptInstance::Ptr openvpn::ProtoContext::tls_crypt_recv
private

Definition at line 4832 of file proto.hpp.

◆ tls_crypt_send

TLSCryptInstance::Ptr openvpn::ProtoContext::tls_crypt_send
private

Definition at line 4831 of file proto.hpp.

◆ tls_crypt_server

TLSCryptInstance::Ptr openvpn::ProtoContext::tls_crypt_server
private

Definition at line 4834 of file proto.hpp.

◆ tls_wrap_mode

TLSWrapMode openvpn::ProtoContext::tls_wrap_mode
private

Definition at line 4817 of file proto.hpp.

◆ upcoming_key_id

unsigned int openvpn::ProtoContext::upcoming_key_id = 0
private

Definition at line 4819 of file proto.hpp.


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