OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::ClientAPI::OpenVPNClient Class Referenceabstract

#include <ovpncli.hpp>

Inheritance diagram for openvpn::ClientAPI::OpenVPNClient:
[legend]
Collaboration diagram for openvpn::ClientAPI::OpenVPNClient:
[legend]

Public Member Functions

 OpenVPNClient ()
 
virtual ~OpenVPNClient ()
 
EvalConfig eval_config (const Config &)
 
Status provide_creds (const ProvideCreds &)
 
virtual bool socket_protect (openvpn_io::detail::socket_type socket, std::string remote, bool ipv6)
 
Status connect ()
 
ConnectionInfo connection_info ()
 
bool session_token (SessionToken &tok)
 
void stop ()
 
void pause (const std::string &reason)
 
void resume ()
 
void reconnect (int seconds)
 
virtual bool pause_on_connection_timeout ()=0
 
long long stats_value (int index) const
 
std::vector< long long > stats_bundle () const
 
InterfaceStats tun_stats () const
 
TransportStats transport_stats () const
 
void post_cc_msg (const std::string &msg)
 
void send_app_control_channel_msg (const std::string &protocol, const std::string &msg)
 
void start_cert_check (const std::string &client_cert, const std::string &clientkey, const std::optional< const std::string > &ca=std::nullopt)
 Start up the cert check handshake using the given certs and key.
 
void start_cert_check_epki (const std::string &alias, const std::optional< const std::string > &ca)
 Start up the cert check handshake using the given epki_alias string.
 
virtual void event (const Event &)=0
 
virtual void acc_event (const AppCustomControlMessageEvent &)=0
 
virtual void log (const LogInfo &) override=0
 
virtual void external_pki_cert_request (ExternalPKICertRequest &)=0
 
virtual void external_pki_sign_request (ExternalPKISignRequest &)=0
 
virtual bool remote_override_enabled ()
 
virtual void remote_override (RemoteOverride &)
 
virtual void clock_tick ()
 
- Public Member Functions inherited from openvpn::TunBuilderBase
virtual bool tun_builder_new ()
 Callback to construct a new TunBuilder. This function should be called first.
 
virtual bool tun_builder_set_layer (int layer)
 Optional callback that indicates OSI layer to be used.
 
virtual bool tun_builder_set_remote_address (const std::string &address, bool ipv6)
 Callback to set the address of the remote server.
 
virtual bool tun_builder_add_address (const std::string &address, int prefix_length, const std::string &gateway, bool ipv6, bool net30)
 Callback to add a network address to the VPN interface.
 
virtual bool tun_builder_set_route_metric_default (int metric)
 Optional callback to set default value for route metric.
 
virtual bool tun_builder_reroute_gw (bool ipv4, bool ipv6, unsigned int flags)
 Callback to reroute the default gateway to the VPN interface.
 
virtual bool tun_builder_add_route (const std::string &address, int prefix_length, int metric, bool ipv6)
 Callback to add a route to the VPN interface.
 
virtual bool tun_builder_exclude_route (const std::string &address, int prefix_length, int metric, bool ipv6)
 Callback to exclude route from VPN interface.
 
virtual bool tun_builder_set_dns_options (const DnsOptions &dns)
 Callback to set DNS related options to VPN interface.
 
virtual bool tun_builder_set_mtu (int mtu)
 Callback to set the MTU of the VPN interface.
 
virtual bool tun_builder_set_session_name (const std::string &name)
 Sets the session name for the TunBuilder.
 
virtual bool tun_builder_add_proxy_bypass (const std::string &bypass_host)
 Callback to add a host which should bypass the proxy.
 
virtual bool tun_builder_set_proxy_auto_config_url (const std::string &url)
 Callback to set the proxy "Auto Config URL".
 
virtual bool tun_builder_set_proxy_http (const std::string &host, int port)
 Callback to set the HTTP proxy.
 
virtual bool tun_builder_set_proxy_https (const std::string &host, int port)
 Set the HTTPS proxy for the TunBuilder session.
 
virtual bool tun_builder_add_wins_server (const std::string &address)
 Callback to add a Windows WINS server to the VPN interface.
 
virtual bool tun_builder_set_allow_family (int af, bool allow)
 Indicates whether traffic of a certain address family (AF_INET or AF_INET6) should be blocked or allowed.
 
virtual bool tun_builder_set_allow_local_dns (bool allow)
 Optional callback that indicates whether local DNS traffic should be blocked or allowed to prevent DNS queries from leaking while the tunnel is connected.
 
virtual int tun_builder_establish ()
 Callback to establish the VPN tunnel.
 
virtual bool tun_builder_persist ()
 Determines if the TUN interface can be persisted.
 
virtual std::vector< std::string > tun_builder_get_local_networks (bool ipv6)
 Retrieves a list of local networks to exclude from the VPN network.
 
virtual void tun_builder_establish_lite ()
 Indicates a reconnection with persisted TUN state.
 
virtual void tun_builder_teardown (bool disconnect)
 Indicates that tunnel is being torn down.
 
virtual ~TunBuilderBase ()=default
 Virtual destructor for the TunBuilderBase class.
 
- Public Member Functions inherited from openvpn::ClientAPI::LogReceiver
virtual ~LogReceiver ()=default
 

Static Public Member Functions

static int stats_n ()
 
static std::string stats_name (int index)
 

Protected Member Functions

Status do_connect ()
 
virtual void connect_attach ()
 
virtual void connect_pre_run ()
 
virtual void connect_run ()
 
virtual void connect_session_stop ()
 
virtual Stopget_async_stop ()
 

Protected Attributes

Private::ClientStatestate
 

Private Member Functions

void connect_setup (Status &, bool &)
 
void do_connect_async ()
 
void parse_extras (const Config &, EvalConfig &)
 
void external_pki_error (const ExternalPKIRequestBase &, const size_t)
 
void process_epki_cert_chain (const ExternalPKICertRequest &)
 
void on_disconnect ()
 
bool sign (const std::string &alias, const std::string &data, std::string &sig, const std::string &algorithm, const std::string &hashalg, const std::string &saltlen) override
 
 OpenVPNClient (const OpenVPNClient &)=delete
 
OpenVPNClientoperator= (const OpenVPNClient &)=delete
 
- Private Member Functions inherited from openvpn::ExternalPKIBase
virtual ~ExternalPKIBase ()=default
 

Static Private Member Functions

static Status status_from_exception (const std::exception &)
 

Friends

class MyClientEvents
 

Detailed Description

Definition at line 606 of file ovpncli.hpp.

Constructor & Destructor Documentation

◆ OpenVPNClient() [1/2]

OPENVPN_CLIENT_EXPORT openvpn::ClientAPI::OpenVPNClient::OpenVPNClient ( )

Definition at line 593 of file ovpncli.cpp.

◆ ~OpenVPNClient()

OPENVPN_CLIENT_EXPORT openvpn::ClientAPI::OpenVPNClient::~OpenVPNClient ( )
virtual

Definition at line 1433 of file ovpncli.cpp.

◆ OpenVPNClient() [2/2]

openvpn::ClientAPI::OpenVPNClient::OpenVPNClient ( const OpenVPNClient )
privatedelete

Member Function Documentation

◆ acc_event()

virtual void openvpn::ClientAPI::OpenVPNClient::acc_event ( const AppCustomControlMessageEvent )
pure virtual

Implemented in Client, and Client.

Here is the caller graph for this function:

◆ clock_tick()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::clock_tick ( )
virtual

Reimplemented in Client.

Definition at line 1394 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connect()

OPENVPN_CLIENT_EXPORT Status openvpn::ClientAPI::OpenVPNClient::connect ( )

Definition at line 861 of file ovpncli.cpp.

◆ connect_attach()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::connect_attach ( )
protectedvirtual

Definition at line 1049 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connect_pre_run()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::connect_pre_run ( )
protectedvirtual

Definition at line 1056 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connect_run()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::connect_run ( )
protectedvirtual

Definition at line 1060 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connect_session_stop()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::connect_session_stop ( )
protectedvirtual

Definition at line 1065 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connect_setup()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::connect_setup ( Status status,
bool &  session_started 
)
private

Definition at line 935 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ connection_info()

OPENVPN_CLIENT_EXPORT ConnectionInfo openvpn::ClientAPI::OpenVPNClient::connection_info ( )

Definition at line 1071 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ do_connect()

OPENVPN_CLIENT_EXPORT Status openvpn::ClientAPI::OpenVPNClient::do_connect ( )
protected

Definition at line 878 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ do_connect_async()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::do_connect_async ( )
private

Definition at line 902 of file ovpncli.cpp.

◆ eval_config()

OPENVPN_CLIENT_EXPORT EvalConfig openvpn::ClientAPI::OpenVPNClient::eval_config ( const Config config)

Definition at line 768 of file ovpncli.cpp.

◆ event()

virtual void openvpn::ClientAPI::OpenVPNClient::event ( const Event )
pure virtual

Implemented in Client, and Client.

Here is the caller graph for this function:

◆ external_pki_cert_request()

virtual void openvpn::ClientAPI::OpenVPNClient::external_pki_cert_request ( ExternalPKICertRequest )
pure virtual

Implemented in Client, and Client.

Here is the caller graph for this function:

◆ external_pki_error()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::external_pki_error ( const ExternalPKIRequestBase req,
const size_t  err_type 
)
private

Definition at line 1103 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ external_pki_sign_request()

virtual void openvpn::ClientAPI::OpenVPNClient::external_pki_sign_request ( ExternalPKISignRequest )
pure virtual

Implemented in Client, and Client.

Here is the caller graph for this function:

◆ get_async_stop()

OPENVPN_CLIENT_EXPORT Stop * openvpn::ClientAPI::OpenVPNClient::get_async_stop ( )
protectedvirtual

Definition at line 1098 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ log()

virtual void openvpn::ClientAPI::OpenVPNClient::log ( const LogInfo )
overridepure virtual

Implements openvpn::ClientAPI::LogReceiver.

Implemented in Client, and Client.

◆ on_disconnect()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::on_disconnect ( )
private

Definition at line 1398 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ operator=()

OpenVPNClient & openvpn::ClientAPI::OpenVPNClient::operator= ( const OpenVPNClient )
privatedelete

◆ parse_extras()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::parse_extras ( const Config config,
EvalConfig eval 
)
private

Definition at line 667 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ pause()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::pause ( const std::string &  reason)

Definition at line 1280 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ pause_on_connection_timeout()

virtual bool openvpn::ClientAPI::OpenVPNClient::pause_on_connection_timeout ( )
pure virtual

Implemented in Client, Client, and Client.

Here is the caller graph for this function:

◆ post_cc_msg()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::post_cc_msg ( const std::string &  msg)

Definition at line 1310 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ process_epki_cert_chain()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::process_epki_cert_chain ( const ExternalPKICertRequest req)
private

Definition at line 827 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ provide_creds()

OPENVPN_CLIENT_EXPORT Status openvpn::ClientAPI::OpenVPNClient::provide_creds ( const ProvideCreds creds)

Definition at line 782 of file ovpncli.cpp.

◆ reconnect()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::reconnect ( int  seconds)

Definition at line 1300 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ remote_override()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::remote_override ( RemoteOverride )
virtual

Definition at line 1153 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ remote_override_enabled()

OPENVPN_CLIENT_EXPORT bool openvpn::ClientAPI::OpenVPNClient::remote_override_enabled ( )
virtual

Definition at line 1148 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ resume()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::resume ( )

Definition at line 1290 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ send_app_control_channel_msg()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::send_app_control_channel_msg ( const std::string &  protocol,
const std::string &  msg 
)

Definition at line 1320 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ session_token()

OPENVPN_CLIENT_EXPORT bool openvpn::ClientAPI::OpenVPNClient::session_token ( SessionToken tok)

Definition at line 1083 of file ovpncli.cpp.

◆ sign()

OPENVPN_CLIENT_EXPORT bool openvpn::ClientAPI::OpenVPNClient::sign ( const std::string &  alias,
const std::string &  data,
std::string &  sig,
const std::string &  algorithm,
const std::string &  hashalg,
const std::string &  saltlen 
)
overrideprivatevirtual

Implements openvpn::ExternalPKIBase.

Definition at line 1122 of file ovpncli.cpp.

◆ socket_protect()

OPENVPN_CLIENT_EXPORT bool openvpn::ClientAPI::OpenVPNClient::socket_protect ( openvpn_io::detail::socket_type  socket,
std::string  remote,
bool  ipv6 
)
virtual

Reimplemented in Client, and ClientBase.

Definition at line 805 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ start_cert_check()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::start_cert_check ( const std::string &  client_cert,
const std::string &  clientkey,
const std::optional< const std::string > &  ca = std::nullopt 
)

Start up the cert check handshake using the given certs and key.

Parameters
client_certString containing the properly encoded client certificate
clientkeyString containing the properly encoded private key for client_cert
caOptional string containing the properly encoded authority

This function forwards to ClientProto::Session::start_acc_certcheck, which sets up the session ACC certcheck TLS handshake object. Every time this function is called the state of the handshake object will be reset and the handshake will be restarted.

Definition at line 1350 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ start_cert_check_epki()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::start_cert_check_epki ( const std::string &  alias,
const std::optional< const std::string > &  ca 
)

Start up the cert check handshake using the given epki_alias string.

Parameters
aliasString containing the epki used for callbacks for certificate and signing operations
caOptional string containing the properly encoded authority

This function forwards to ClientProto::Session::start_acc_certcheck, which sets up the session ACC certcheck TLS handshake object. Every time this function is called the state of the handshake object will be reset and the handshake will be restarted.

Definition at line 1367 of file ovpncli.cpp.

◆ stats_bundle()

OPENVPN_CLIENT_EXPORT std::vector< long long > openvpn::ClientAPI::OpenVPNClient::stats_bundle ( ) const

Definition at line 1182 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ stats_n()

OPENVPN_CLIENT_EXPORT int openvpn::ClientAPI::OpenVPNClient::stats_n ( )
static

Definition at line 1157 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ stats_name()

OPENVPN_CLIENT_EXPORT std::string openvpn::ClientAPI::OpenVPNClient::stats_name ( int  index)
static

Definition at line 1162 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ stats_value()

OPENVPN_CLIENT_EXPORT long long openvpn::ClientAPI::OpenVPNClient::stats_value ( int  index) const

Definition at line 1167 of file ovpncli.cpp.

◆ status_from_exception()

OPENVPN_CLIENT_EXPORT Status openvpn::ClientAPI::OpenVPNClient::status_from_exception ( const std::exception &  e)
staticprivate

Definition at line 1033 of file ovpncli.cpp.

Here is the caller graph for this function:

◆ stop()

OPENVPN_CLIENT_EXPORT void openvpn::ClientAPI::OpenVPNClient::stop ( )

Definition at line 1274 of file ovpncli.cpp.

◆ transport_stats()

OPENVPN_CLIENT_EXPORT TransportStats openvpn::ClientAPI::OpenVPNClient::transport_stats ( ) const

Definition at line 1236 of file ovpncli.cpp.

◆ tun_stats()

OPENVPN_CLIENT_EXPORT InterfaceStats openvpn::ClientAPI::OpenVPNClient::tun_stats ( ) const

Definition at line 1203 of file ovpncli.cpp.

Friends And Related Symbol Documentation

◆ MyClientEvents

friend class MyClientEvents
friend

Definition at line 769 of file ovpncli.hpp.

Member Data Documentation

◆ state

Private::ClientState* openvpn::ClientAPI::OpenVPNClient::state
protected

Definition at line 759 of file ovpncli.hpp.


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