OpenVPN 3 Core Library
|
#include <proto.hpp>
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, BufferPtr &&net_bp) |
bool | control_net_recv (const PacketType &type, BufferAllocated &&net_buf) |
pass received control channel network packets (ciphertext) into protocol object | |
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) |
CryptoDCSettings & | dc_settings () |
void | reset_dc_factory () |
void | set_local_peer_id (const int local_peer_id) |
const Time & | now () const |
void | update_now () |
const Frame & | frame () const |
const Frame::Ptr & | frameptr () const |
const Mode & | mode () const |
bool | is_server () const |
bool | is_client () const |
bool | is_tcp () |
bool | is_udp () |
const ProtoConfig & | conf () const |
ProtoConfig & | conf () |
ProtoConfig::Ptr | conf_ptr () const |
SessionStats & | stat () 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 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 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 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) |
KeyContext & | select_key_context (const PacketType &type, const bool control) |
KeyContext & | select_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) |
Static Private Attributes | |
static constexpr PacketIDControl::id_t | EARLY_NEG_START = 0x0f000000 |
Additional Inherited Members | |
![]() | |
static constexpr int | max_log_level |
static constexpr int | default_log_level |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
inline |
|
virtualdefault |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
pass received control channel network packets (ciphertext) into protocol object
type | Packet type discriminator |
net_buf | Buffer containing the network packet |
true
if successfully processed, false
if not
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlinestaticprotected |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inlineprivate |
|
inline |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestatic |
openvpn::ProtoContext::OPENVPN_SIMPLE_EXCEPTION | ( | select_key_context_error | ) |
openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT | ( | option_error | , |
process_server_push_error | |||
) |
openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT | ( | option_error | , |
proto_error | |||
) |
openvpn::ProtoContext::OPENVPN_UNTAGGED_EXCEPTION_INHERIT | ( | option_error | , |
proto_option_error | |||
) |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inlineprivate |
|
inline |
Resets ProtoContext *this to it's initial state.
cookie_psid | the 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.
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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()
cookie_psid | see ProtoContext::reset() |
Definition at line 4123 of file proto.hpp.
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
staticconstexprprotected |
|
private |
|
staticconstexprprivate |
|
private |
|
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
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |