OpenVPN 3 Core Library
Loading...
Searching...
No Matches
Client Class Reference
Inheritance diagram for Client:
[legend]
Collaboration diagram for Client:
[legend]

Classes

class  ConfigError
 
class  CredsUnspecifiedError
 

Public Types

enum  ClockTickAction {
  CT_UNDEF , CT_STOP , CT_RECONNECT , CT_PAUSE ,
  CT_RESUME , CT_STATS
}
 

Public Member Functions

 Client (String config_text, String username, String password) throws ConfigError, CredsUnspecifiedError
 
void connect ()
 
void stop ()
 
void show_stats ()
 
void event (ClientAPI_Event event)
 
void external_pki_cert_request (ClientAPI_ExternalPKICertRequest req)
 
void external_pki_sign_request (ClientAPI_ExternalPKISignRequest req)
 
void log (ClientAPI_LogInfo loginfo)
 
void done (ClientAPI_Status status)
 
boolean socket_protect (int socket)
 
boolean pause_on_connection_timeout ()
 
OpenVPNClientThread.TunBuilder tun_builder_new ()
 
 Client (OMI *omi)
 
bool is_dynamic_challenge () const
 
std::string dynamic_challenge_cookie ()
 
void set_clock_tick_action (const ClockTickAction action)
 
void print_stats ()
 
void set_write_url_fn (const std::string &fn)
 
- Public Member Functions inherited from openvpn::ClientAPI::OpenVPNClient
 OpenVPNClient ()
 
virtual ~OpenVPNClient ()
 
EvalConfig eval_config (const Config &)
 
Status provide_creds (const ProvideCreds &)
 
Status connect ()
 
ConnectionInfo connection_info ()
 
bool session_token (SessionToken &tok)
 
void stop ()
 
void pause (const std::string &reason)
 
void resume ()
 
void reconnect (int seconds)
 
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 bool remote_override_enabled ()
 
virtual void remote_override (RemoteOverride &)
 
- Public Member Functions inherited from openvpn::TunBuilderBase
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
 
- Public Member Functions inherited from ClientBase
bool socket_protect (openvpn_io::detail::socket_type socket, std::string remote, bool ipv6) override
 

Public Attributes

std::string epki_ca
 
std::string epki_cert
 
std::string certcheck_cert
 file name of properly encoded server cert
 
std::string certcheck_clientca_fn
 file name of properly encoded client ca
 

Private Member Functions

bool socket_protect (openvpn_io::detail::socket_type socket, std::string remote, bool ipv6) override
 
bool pause_on_connection_timeout () override
 
void event (const ClientAPI::Event &ev) override
 
void log (const ClientAPI::LogInfo &msg) override
 
void external_pki_cert_request (ClientAPI::ExternalPKICertRequest &certreq) override
 
void external_pki_sign_request (ClientAPI::ExternalPKISignRequest &signreq) override
 
void acc_event (const openvpn::ClientAPI::AppCustomControlMessageEvent &event) override
 
void event (const ClientAPI::Event &ev) override
 
void handle_dpc1_protocol (const ClientAPI::AppCustomControlMessageEvent &acev)
 
void acc_event (const ClientAPI::AppCustomControlMessageEvent &acev) override
 Handles ACC messages.
 
void handle_certcheck_request ()
 Begin a cck1 (certcheck) handshake in response to a dpc1 server request.
 
void open_url (std::string url_str)
 
void log (const ClientAPI::LogInfo &log) override
 
void clock_tick () override
 
void external_pki_cert_request (ClientAPI::ExternalPKICertRequest &certreq) override
 
void external_pki_sign_request (ClientAPI::ExternalPKISignRequest &signreq) override
 
bool pause_on_connection_timeout () override
 

Static Private Member Functions

static int rng_callback (void *arg, unsigned char *data, size_t len)
 

Private Attributes

OpenVPNClientThread client_thread
 
OMIparent
 
std::mutex log_mutex
 
std::string dc_cookie
 
StrongRandomAPI::Ptr rng
 
volatile ClockTickAction clock_tick_action = CT_UNDEF
 
std::string write_url_fn
 

Static Private Attributes

static constexpr char certcheck_init_verb [] = "dpc1"
 

Additional Inherited Members

- Static Public Member Functions inherited from openvpn::ClientAPI::OpenVPNClient
static int stats_n ()
 
static std::string stats_name (int index)
 
- Protected Member Functions inherited from openvpn::ClientAPI::OpenVPNClient
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 inherited from openvpn::ClientAPI::OpenVPNClient
Private::ClientStatestate
 

Detailed Description

Definition at line 14 of file Client.java.

Member Enumeration Documentation

◆ ClockTickAction

Enumerator
CT_UNDEF 
CT_STOP 
CT_RECONNECT 
CT_PAUSE 
CT_RESUME 
CT_STATS 

Definition at line 213 of file cli.cpp.

Constructor & Destructor Documentation

◆ Client() [1/2]

Client.Client ( String  config_text,
String  username,
String  password 
) throws ConfigError, CredsUnspecifiedError
inline

Definition at line 32 of file Client.java.

◆ Client() [2/2]

Client.Client ( OMI omi)
inline

Definition at line 56 of file openvpn.cpp.

Member Function Documentation

◆ acc_event() [1/2]

void Client.acc_event ( const ClientAPI::AppCustomControlMessageEvent acev)
inlineoverrideprivatevirtual

Handles ACC messages.

Parameters
acevThe current ACC event

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 370 of file cli.cpp.

◆ acc_event() [2/2]

void Client::acc_event ( const openvpn::ClientAPI::AppCustomControlMessageEvent event)
overrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 1037 of file openvpn.cpp.

◆ clock_tick()

void Client.clock_tick ( )
inlineoverrideprivatevirtual

Reimplemented from openvpn::ClientAPI::OpenVPNClient.

Definition at line 469 of file cli.cpp.

◆ connect()

void Client.connect ( )
inline

Definition at line 60 of file Client.java.

Here is the caller graph for this function:

◆ done()

void Client.done ( ClientAPI_Status  status)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 112 of file Client.java.

◆ dynamic_challenge_cookie()

std::string Client.dynamic_challenge_cookie ( )
inline

Definition at line 228 of file cli.cpp.

◆ event() [1/3]

void Client.event ( ClientAPI_Event  event)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 84 of file Client.java.

Here is the caller graph for this function:

◆ event() [2/3]

void Client::event ( const ClientAPI::Event ev)
overrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 1011 of file openvpn.cpp.

◆ event() [3/3]

void Client.event ( const ClientAPI::Event ev)
inlineoverrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 279 of file cli.cpp.

◆ external_pki_cert_request() [1/3]

void Client::external_pki_cert_request ( ClientAPI::ExternalPKICertRequest certreq)
overrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 1027 of file openvpn.cpp.

◆ external_pki_cert_request() [2/3]

void Client.external_pki_cert_request ( ClientAPI::ExternalPKICertRequest certreq)
inlineoverrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 501 of file cli.cpp.

◆ external_pki_cert_request() [3/3]

void Client.external_pki_cert_request ( ClientAPI_ExternalPKICertRequest  req)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 93 of file Client.java.

◆ external_pki_sign_request() [1/3]

void Client::external_pki_sign_request ( ClientAPI::ExternalPKISignRequest signreq)
overrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 1032 of file openvpn.cpp.

◆ external_pki_sign_request() [2/3]

void Client.external_pki_sign_request ( ClientAPI::ExternalPKISignRequest signreq)
inlineoverrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 678 of file cli.cpp.

◆ external_pki_sign_request() [3/3]

void Client.external_pki_sign_request ( ClientAPI_ExternalPKISignRequest  req)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 100 of file Client.java.

◆ handle_certcheck_request()

void Client.handle_certcheck_request ( )
inlineprivate

Begin a cck1 (certcheck) handshake in response to a dpc1 server request.

Definition at line 390 of file cli.cpp.

Here is the caller graph for this function:

◆ handle_dpc1_protocol()

void Client.handle_dpc1_protocol ( const ClientAPI::AppCustomControlMessageEvent acev)
inlineprivate

Definition at line 341 of file cli.cpp.

◆ is_dynamic_challenge()

bool Client.is_dynamic_challenge ( ) const
inline

Definition at line 223 of file cli.cpp.

◆ log() [1/3]

void Client.log ( ClientAPI_LogInfo  loginfo)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 106 of file Client.java.

◆ log() [2/3]

void Client.log ( const ClientAPI::LogInfo log)
inlineoverrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 463 of file cli.cpp.

◆ log() [3/3]

void Client::log ( const ClientAPI::LogInfo msg)
overrideprivatevirtual

Implements openvpn::ClientAPI::OpenVPNClient.

Definition at line 1022 of file openvpn.cpp.

◆ open_url()

void Client.open_url ( std::string  url_str)
inlineprivate

Definition at line 422 of file cli.cpp.

Here is the caller graph for this function:

◆ pause_on_connection_timeout() [1/3]

boolean Client.pause_on_connection_timeout ( )
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 123 of file Client.java.

◆ pause_on_connection_timeout() [2/3]

bool Client.pause_on_connection_timeout ( )
inlineoverrideprivate

Implements OpenVPNClientThread.EventReceiver.

Definition at line 67 of file openvpn.cpp.

◆ pause_on_connection_timeout() [3/3]

bool Client.pause_on_connection_timeout ( )
inlineoverrideprivate

Implements OpenVPNClientThread.EventReceiver.

Definition at line 761 of file cli.cpp.

◆ print_stats()

void Client.print_stats ( )
inline

Definition at line 251 of file cli.cpp.

Here is the caller graph for this function:

◆ rng_callback()

static int Client.rng_callback ( void *  arg,
unsigned char *  data,
size_t  len 
)
inlinestaticprivate

Definition at line 751 of file cli.cpp.

◆ set_clock_tick_action()

void Client.set_clock_tick_action ( const ClockTickAction  action)
inline

Definition at line 246 of file cli.cpp.

◆ set_write_url_fn()

void Client.set_write_url_fn ( const std::string &  fn)
inline

Definition at line 272 of file cli.cpp.

◆ show_stats()

void Client.show_stats ( )
inline

Definition at line 72 of file Client.java.

Here is the caller graph for this function:

◆ socket_protect() [1/2]

boolean Client.socket_protect ( int  socket)
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 117 of file Client.java.

◆ socket_protect() [2/2]

bool Client.socket_protect ( openvpn_io::detail::socket_type  socket,
std::string  remote,
bool  ipv6 
)
inlineoverrideprivatevirtual

Reimplemented from openvpn::ClientAPI::OpenVPNClient.

Definition at line 62 of file openvpn.cpp.

◆ stop()

void Client.stop ( )
inline

Definition at line 68 of file Client.java.

Here is the caller graph for this function:

◆ tun_builder_new()

OpenVPNClientThread.TunBuilder Client.tun_builder_new ( )
inline

Implements OpenVPNClientThread.EventReceiver.

Definition at line 129 of file Client.java.

Member Data Documentation

◆ certcheck_cert

std::string Client.certcheck_cert

file name of properly encoded server cert

Definition at line 243 of file cli.cpp.

◆ certcheck_clientca_fn

std::string Client.certcheck_clientca_fn

file name of properly encoded client ca

Definition at line 244 of file cli.cpp.

◆ certcheck_init_verb

constexpr char Client.certcheck_init_verb[] = "dpc1"
staticconstexprprivate

Definition at line 210 of file cli.cpp.

◆ client_thread

OpenVPNClientThread Client.client_thread
private

Definition at line 15 of file Client.java.

◆ clock_tick_action

volatile ClockTickAction Client.clock_tick_action = CT_UNDEF
private

Definition at line 807 of file cli.cpp.

◆ dc_cookie

std::string Client.dc_cookie
private

Definition at line 805 of file cli.cpp.

◆ epki_ca

std::string Client.epki_ca

Definition at line 233 of file cli.cpp.

◆ epki_cert

std::string Client.epki_cert

Definition at line 234 of file cli.cpp.

◆ log_mutex

std::mutex Client.log_mutex
private

Definition at line 804 of file cli.cpp.

◆ parent

OMI* Client.parent
private

Definition at line 78 of file openvpn.cpp.

◆ rng

StrongRandomAPI::Ptr Client.rng
private

Definition at line 806 of file cli.cpp.

◆ write_url_fn

std::string Client.write_url_fn
private

Definition at line 813 of file cli.cpp.


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