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

#include <servproto.hpp>

Inheritance diagram for openvpn::ServerProto::Session:
[legend]
Collaboration diagram for openvpn::ServerProto::Session:
[legend]

Public Types

typedef RCPtr< SessionPtr
 

Public Member Functions

bool defined () const override
 
TunClientInstance::Recvoverride_tun (TunClientInstance::Send *tun) override
 
void start (const TransportClientInstance::Send::Ptr &parent, const PeerAddr::Ptr &addr, const int local_peer_id, const ProtoSessionID cookie_psid=ProtoSessionID()) override
 
PeerStats stats_poll () override
 
bool should_preserve_session_id () override
 
void stop () override
 
bool transport_recv (BufferAllocated &buf) override
 
void tun_recv (BufferAllocated &buf) override
 
bool is_keepalive_enabled () const override
 
void disable_keepalive (unsigned int &keepalive_ping, unsigned int &keepalive_timeout) override
 
void override_dc_factory (const CryptoDCFactory::Ptr &dc_factory) override
 
virtual ~Session ()
 

Private Types

enum  DisconnectType { DT_NONE = 0 , DT_AUTH_PENDING , DT_RELAY_TRANSITION , DT_HALT_RESTART }
 

Private Member Functions

 Session (openvpn_io::io_context &io_context_arg, const Factory &factory, ManClientInstance::Factory::Ptr man_factory_arg, TunClientInstance::Factory::Ptr tun_factory_arg)
 
bool supports_epoch_data () override
 
bool defined_ () const
 
void control_net_send (const Buffer &net_buf) override
 
void server_auth (const std::string &username, const SafeString &password, const std::string &peer_info, const AuthCert::Ptr &auth_cert) override
 
void control_recv (BufferPtr &&app_bp) override
 
void active (bool primary) override
 Called when KeyContext transitions to ACTIVE state.
 
void auth_failed (const std::string &reason, const std::string &client_reason) override
 
void relay (const IP::Addr &target, const int port) override
 
void push_reply (std::vector< BufferPtr > &&push_msgs) override
 
TunClientInstance::NativeHandle tun_native_handle () override
 
void push_halt_restart_msg (const HaltRestart::Type type, const std::string &reason, const std::string &client_reason) override
 
void schedule_disconnect (const unsigned int seconds) override
 
void schedule_auth_pending_timeout (const unsigned int seconds) override
 
void post_cc_msg (BufferPtr &&msg) override
 
void stats_notify (const PeerStats &ps, const bool final) override
 
void float_notify (const PeerAddr::Ptr &addr) override
 
void ipma_notify (const struct ovpn_tun_head_ipma &ipma) override
 
void data_limit_notify (const int key_id, const DataLimit::Mode cdl_mode, const DataLimit::State cdl_status) override
 
bool get_management ()
 
bool get_tun ()
 
void disconnect_in (const Time::Duration &dur)
 
void cancel_disconnect ()
 
void housekeeping_callback (const openvpn_io::error_code &e)
 
void set_housekeeping_timer ()
 
std::string client_endpoint_render ()
 
void error (const std::string &error)
 
void error (const std::exception &e)
 
void error ()
 
void invalidation_error (const Error::Type err)
 
std::string instance_name () const
 
- Private Member Functions inherited from openvpn::ProtoContextCallbackInterface
virtual ~ProtoContextCallbackInterface ()=default
 
virtual void client_auth (Buffer &buf)
 

Private Attributes

ProtoContext proto_context
 
int disconnect_type = DT_NONE
 
bool preserve_session_id = true
 
bool halt = false
 
PeerAddr::Ptr peer_addr
 
CoarseTime housekeeping_schedule
 
AsioTimer housekeeping_timer
 
Time disconnect_at
 
SessionStats::Ptr stats
 
ManClientInstance::Factory::Ptr man_factory
 
TunClientInstance::Factory::Ptr tun_factory
 
bool proto_request_push = false
 

Friends

class Factory
 

Additional Inherited Members

- Static Private Member Functions inherited from openvpn::ProtoContextCallbackInterface
static void write_empty_string (Buffer &buf)
 

Detailed Description

Definition at line 105 of file servproto.hpp.

Member Typedef Documentation

◆ Ptr

Definition at line 113 of file servproto.hpp.

Member Enumeration Documentation

◆ DisconnectType

Enumerator
DT_NONE 
DT_AUTH_PENDING 
DT_RELAY_TRANSITION 
DT_HALT_RESTART 

Definition at line 754 of file servproto.hpp.

Constructor & Destructor Documentation

◆ ~Session()

virtual openvpn::ServerProto::Session::~Session ( )
inlinevirtual

Definition at line 282 of file servproto.hpp.

◆ Session()

openvpn::ServerProto::Session::Session ( openvpn_io::io_context &  io_context_arg,
const Factory factory,
ManClientInstance::Factory::Ptr  man_factory_arg,
TunClientInstance::Factory::Ptr  tun_factory_arg 
)
inlineprivate

Definition at line 290 of file servproto.hpp.

Member Function Documentation

◆ active()

void openvpn::ServerProto::Session::active ( bool  primary)
inlineoverrideprivatevirtual

Called when KeyContext transitions to ACTIVE state.

Implements openvpn::ProtoContextCallbackInterface.

Definition at line 381 of file servproto.hpp.

◆ auth_failed()

void openvpn::ServerProto::Session::auth_failed ( const std::string &  reason,
const std::string &  client_reason 
)
inlineoverrideprivate

Definition at line 387 of file servproto.hpp.

Here is the caller graph for this function:

◆ cancel_disconnect()

void openvpn::ServerProto::Session::cancel_disconnect ( )
inlineprivate

Definition at line 639 of file servproto.hpp.

Here is the caller graph for this function:

◆ client_endpoint_render()

std::string openvpn::ServerProto::Session::client_endpoint_render ( )
inlineprivate

Definition at line 707 of file servproto.hpp.

Here is the caller graph for this function:

◆ control_net_send()

void openvpn::ServerProto::Session::control_net_send ( const Buffer net_buf)
inlineoverrideprivatevirtual

Sends out bytes to the network.

Implements openvpn::ProtoContextCallbackInterface.

Definition at line 315 of file servproto.hpp.

◆ control_recv()

void openvpn::ServerProto::Session::control_recv ( BufferPtr &&  app_bp)
inlineoverrideprivatevirtual

Implements openvpn::ProtoContextCallbackInterface.

Definition at line 346 of file servproto.hpp.

◆ data_limit_notify()

void openvpn::ServerProto::Session::data_limit_notify ( const int  key_id,
const DataLimit::Mode  cdl_mode,
const DataLimit::State  cdl_status 
)
inlineoverrideprivate

Definition at line 598 of file servproto.hpp.

◆ defined()

bool openvpn::ServerProto::Session::defined ( ) const
inlineoverride

Definition at line 115 of file servproto.hpp.

◆ defined_()

bool openvpn::ServerProto::Session::defined_ ( ) const
inlineprivate

Definition at line 309 of file servproto.hpp.

Here is the caller graph for this function:

◆ disable_keepalive()

void openvpn::ServerProto::Session::disable_keepalive ( unsigned int &  keepalive_ping,
unsigned int &  keepalive_timeout 
)
inlineoverride

Definition at line 268 of file servproto.hpp.

◆ disconnect_in()

void openvpn::ServerProto::Session::disconnect_in ( const Time::Duration &  dur)
inlineprivate

Definition at line 634 of file servproto.hpp.

Here is the caller graph for this function:

◆ error() [1/3]

void openvpn::ServerProto::Session::error ( )
inlineprivate

Definition at line 726 of file servproto.hpp.

Here is the caller graph for this function:

◆ error() [2/3]

void openvpn::ServerProto::Session::error ( const std::exception &  e)
inlineprivate

Definition at line 721 of file servproto.hpp.

◆ error() [3/3]

void openvpn::ServerProto::Session::error ( const std::string &  error)
inlineprivate

Definition at line 715 of file servproto.hpp.

◆ float_notify()

void openvpn::ServerProto::Session::float_notify ( const PeerAddr::Ptr addr)
inlineoverrideprivate

Definition at line 586 of file servproto.hpp.

◆ get_management()

bool openvpn::ServerProto::Session::get_management ( )
inlineprivate

Definition at line 608 of file servproto.hpp.

Here is the caller graph for this function:

◆ get_tun()

bool openvpn::ServerProto::Session::get_tun ( )
inlineprivate

Definition at line 620 of file servproto.hpp.

Here is the caller graph for this function:

◆ housekeeping_callback()

void openvpn::ServerProto::Session::housekeeping_callback ( const openvpn_io::error_code &  e)
inlineprivate

Definition at line 644 of file servproto.hpp.

◆ instance_name()

std::string openvpn::ServerProto::Session::instance_name ( ) const
inlineprivate

Definition at line 745 of file servproto.hpp.

Here is the caller graph for this function:

◆ invalidation_error()

void openvpn::ServerProto::Session::invalidation_error ( const Error::Type  err)
inlineprivate

Definition at line 731 of file servproto.hpp.

Here is the caller graph for this function:

◆ ipma_notify()

void openvpn::ServerProto::Session::ipma_notify ( const struct ovpn_tun_head_ipma &  ipma)
inlineoverrideprivate

Definition at line 592 of file servproto.hpp.

◆ is_keepalive_enabled()

bool openvpn::ServerProto::Session::is_keepalive_enabled ( ) const
inlineoverride

Definition at line 260 of file servproto.hpp.

◆ override_dc_factory()

void openvpn::ServerProto::Session::override_dc_factory ( const CryptoDCFactory::Ptr dc_factory)
inlineoverride

Definition at line 277 of file servproto.hpp.

◆ override_tun()

TunClientInstance::Recv * openvpn::ServerProto::Session::override_tun ( TunClientInstance::Send tun)
inlineoverride

Definition at line 120 of file servproto.hpp.

◆ post_cc_msg()

void openvpn::ServerProto::Session::post_cc_msg ( BufferPtr &&  msg)
inlineoverrideprivate

Definition at line 568 of file servproto.hpp.

◆ push_halt_restart_msg()

void openvpn::ServerProto::Session::push_halt_restart_msg ( const HaltRestart::Type  type,
const std::string &  reason,
const std::string &  client_reason 
)
inlineoverrideprivate

Definition at line 457 of file servproto.hpp.

Here is the caller graph for this function:

◆ push_reply()

void openvpn::ServerProto::Session::push_reply ( std::vector< BufferPtr > &&  push_msgs)
inlineoverrideprivate

Definition at line 419 of file servproto.hpp.

◆ relay()

void openvpn::ServerProto::Session::relay ( const IP::Addr target,
const int  port 
)
inlineoverrideprivate

Definition at line 393 of file servproto.hpp.

◆ schedule_auth_pending_timeout()

void openvpn::ServerProto::Session::schedule_auth_pending_timeout ( const unsigned int  seconds)
inlineoverrideprivate

Definition at line 558 of file servproto.hpp.

◆ schedule_disconnect()

void openvpn::ServerProto::Session::schedule_disconnect ( const unsigned int  seconds)
inlineoverrideprivate

Definition at line 549 of file servproto.hpp.

◆ server_auth()

void openvpn::ServerProto::Session::server_auth ( const std::string &  username,
const SafeString password,
const std::string &  peer_info,
const AuthCert::Ptr auth_cert 
)
inlineoverrideprivatevirtual

Called on server with credentials and peer info provided by client. Should be overriden by derived class if credentials are required.

Reimplemented from openvpn::ProtoContextCallbackInterface.

Definition at line 327 of file servproto.hpp.

◆ set_housekeeping_timer()

void openvpn::ServerProto::Session::set_housekeeping_timer ( )
inlineprivate

Definition at line 685 of file servproto.hpp.

Here is the caller graph for this function:

◆ should_preserve_session_id()

bool openvpn::ServerProto::Session::should_preserve_session_id ( )
inlineoverride

Definition at line 153 of file servproto.hpp.

◆ start()

void openvpn::ServerProto::Session::start ( const TransportClientInstance::Send::Ptr parent,
const PeerAddr::Ptr addr,
const int  local_peer_id,
const ProtoSessionID  cookie_psid = ProtoSessionID() 
)
inlineoverride

Definition at line 126 of file servproto.hpp.

◆ stats_notify()

void openvpn::ServerProto::Session::stats_notify ( const PeerStats ps,
const bool  final 
)
inlineoverrideprivate

Definition at line 580 of file servproto.hpp.

◆ stats_poll()

PeerStats openvpn::ServerProto::Session::stats_poll ( )
inlineoverride

Definition at line 145 of file servproto.hpp.

Here is the caller graph for this function:

◆ stop()

void openvpn::ServerProto::Session::stop ( )
inlineoverride

Definition at line 158 of file servproto.hpp.

Here is the caller graph for this function:

◆ supports_epoch_data()

bool openvpn::ServerProto::Session::supports_epoch_data ( )
inlineoverrideprivatevirtual

the protocol context needs to know if the parent and its tun/transport layer are able to support epoch key data format to properly handshake this protocol feature

Implements openvpn::ProtoContextCallbackInterface.

Definition at line 303 of file servproto.hpp.

◆ transport_recv()

bool openvpn::ServerProto::Session::transport_recv ( BufferAllocated buf)
inlineoverride

Definition at line 196 of file servproto.hpp.

◆ tun_native_handle()

TunClientInstance::NativeHandle openvpn::ServerProto::Session::tun_native_handle ( )
inlineoverrideprivate

Definition at line 449 of file servproto.hpp.

◆ tun_recv()

void openvpn::ServerProto::Session::tun_recv ( BufferAllocated buf)
inlineoverride

Definition at line 254 of file servproto.hpp.

Friends And Related Symbol Documentation

◆ Factory

friend class Factory
friend

Definition at line 110 of file servproto.hpp.

Member Data Documentation

◆ disconnect_at

Time openvpn::ServerProto::Session::disconnect_at
private

Definition at line 773 of file servproto.hpp.

◆ disconnect_type

int openvpn::ServerProto::Session::disconnect_type = DT_NONE
private

Definition at line 763 of file servproto.hpp.

◆ halt

bool openvpn::ServerProto::Session::halt = false
private

Definition at line 766 of file servproto.hpp.

◆ housekeeping_schedule

CoarseTime openvpn::ServerProto::Session::housekeeping_schedule
private

Definition at line 770 of file servproto.hpp.

◆ housekeeping_timer

AsioTimer openvpn::ServerProto::Session::housekeeping_timer
private

Definition at line 771 of file servproto.hpp.

◆ man_factory

ManClientInstance::Factory::Ptr openvpn::ServerProto::Session::man_factory
private

Definition at line 777 of file servproto.hpp.

◆ peer_addr

PeerAddr::Ptr openvpn::ServerProto::Session::peer_addr
private

Definition at line 768 of file servproto.hpp.

◆ preserve_session_id

bool openvpn::ServerProto::Session::preserve_session_id = true
private

Definition at line 764 of file servproto.hpp.

◆ proto_context

ProtoContext openvpn::ServerProto::Session::proto_context
private

Definition at line 762 of file servproto.hpp.

◆ proto_request_push

bool openvpn::ServerProto::Session::proto_request_push = false
private

Definition at line 780 of file servproto.hpp.

◆ stats

SessionStats::Ptr openvpn::ServerProto::Session::stats
private

Definition at line 775 of file servproto.hpp.

◆ tun_factory

TunClientInstance::Factory::Ptr openvpn::ServerProto::Session::tun_factory
private

Definition at line 778 of file servproto.hpp.


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