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

#include <tunsetup.hpp>

Inheritance diagram for openvpn::TunWin::Setup:
[legend]
Collaboration diagram for openvpn::TunWin::Setup:
[legend]

Classes

struct  L2State
 
class  UseDNS
 

Public Types

typedef RCPtr< SetupPtr
 
- Public Types inherited from openvpn::TunWin::SetupBase
typedef RCPtr< SetupBasePtr
 
- Public Types inherited from openvpn::DestructorBase
typedef RCPtr< DestructorBasePtr
 
- Public Types inherited from openvpn::RC< thread_unsafe_refcount >
typedef RCPtr< RCPtr
 

Public Member Functions

 Setup (openvpn_io::io_context &io_context_arg, const Type tun_type, bool allow_local_dns_resolvers_arg)
 
Util::TapNameGuidPair get_adapter_state () override
 
void set_adapter_state (const Util::TapNameGuidPair &tap) override
 
void set_process_id (DWORD process_id)
 Set the process id to be used with the NPRT rules.
 
HANDLE get_handle (std::ostream &os) override
 
HANDLE establish (const TunBuilderCapture &pull, const std::wstring &openvpn_app_path, Stop *stop, std::ostream &os, RingBuffer::Ptr ring_buffer) override
 
bool l2_ready (const TunBuilderCapture &pull) override
 
void l2_finish (const TunBuilderCapture &pull, Stop *stop, std::ostream &os) override
 
void destroy (std::ostream &os) override
 
virtual ~Setup ()
 
DWORD vpn_interface_index () const override
 
- Public Member Functions inherited from openvpn::TunWin::SetupBase
 OPENVPN_EXCEPTION (tun_win_setup)
 
virtual void confirm ()
 
virtual void set_service_fail_handler (std::function< void()> &&handler)
 
- Public Member Functions inherited from openvpn::DestructorBase
virtual ~DestructorBase ()=default
 
- Public Member Functions inherited from openvpn::RC< thread_unsafe_refcount >
 RC () noexcept=default
 
 RC (const RC &)=delete
 
virtual ~RC ()=default
 
RCoperator= (const RC &)=delete
 
olong use_count () const noexcept
 Delegates call to RCImpl and returns the result.
 

Static Public Member Functions

static void add_bypass_route (const Util::BestGateway &gw, const std::string &route, bool ipv6, ActionList &add_cmds, ActionList &remove_cmds_bypass_gw)
 
- Static Public Member Functions inherited from openvpn::RC< thread_unsafe_refcount >
static constexpr bool is_thread_safe ()
 Delegates call to RCImpl and returns the result.
 

Private Types

enum  MetricType { MT_ROUTE , MT_NETSH , MT_IFACE }
 

Private Member Functions

void register_rings (HANDLE handle, RingBuffer::Ptr ring_buffer)
 
void adapter_config (HANDLE th, const std::wstring &openvpn_app_path, const Util::TapNameGuidPair &tap, const TunBuilderCapture &pull, const bool l2_post, ActionList &create, ActionList &destroy, std::ostream &os)
 
void adapter_config_l2 (HANDLE th, const std::wstring &openvpn_app_path, const Util::TapNameGuidPair &tap, const TunBuilderCapture &pull, ActionList &create, ActionList &destroy, std::ostream &os)
 

Static Private Member Functions

static std::string route_metric_opt (const TunBuilderCapture &pull, const TunBuilderCapture::RouteBase &route, const MetricType mt)
 

Private Attributes

std::unique_ptr< std::thread > l2_thread
 
std::unique_ptr< L2Statel2_state
 
DWORD vpn_interface_index_ = INVALID_ADAPTER_INDEX
 
ActionList::Ptr remove_cmds
 
AsioTimer delete_route_timer
 
const Type tun_type_
 
Util::TapNameGuidPair tap_
 
bool allow_local_dns_resolvers = false
 
DWORD process_id_ = 0
 

Detailed Description

Definition at line 57 of file tunsetup.hpp.

Member Typedef Documentation

◆ Ptr

Definition at line 60 of file tunsetup.hpp.

Member Enumeration Documentation

◆ MetricType

Enumerator
MT_ROUTE 
MT_NETSH 
MT_IFACE 

Definition at line 893 of file tunsetup.hpp.

Constructor & Destructor Documentation

◆ Setup()

openvpn::TunWin::Setup::Setup ( openvpn_io::io_context &  io_context_arg,
const Type  tun_type,
bool  allow_local_dns_resolvers_arg 
)
inline

Definition at line 62 of file tunsetup.hpp.

◆ ~Setup()

virtual openvpn::TunWin::Setup::~Setup ( )
inlinevirtual

Definition at line 247 of file tunsetup.hpp.

Member Function Documentation

◆ adapter_config()

void openvpn::TunWin::Setup::adapter_config ( HANDLE  th,
const std::wstring &  openvpn_app_path,
const Util::TapNameGuidPair tap,
const TunBuilderCapture pull,
const bool  l2_post,
ActionList create,
ActionList destroy,
std::ostream &  os 
)
inlineprivate

Definition at line 361 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ adapter_config_l2()

void openvpn::TunWin::Setup::adapter_config_l2 ( HANDLE  th,
const std::wstring &  openvpn_app_path,
const Util::TapNameGuidPair tap,
const TunBuilderCapture pull,
ActionList create,
ActionList destroy,
std::ostream &  os 
)
inlineprivate

Definition at line 846 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ add_bypass_route()

static void openvpn::TunWin::Setup::add_bypass_route ( const Util::BestGateway gw,
const std::string &  route,
bool  ipv6,
ActionList add_cmds,
ActionList remove_cmds_bypass_gw 
)
inlinestatic

Definition at line 258 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ destroy()

void openvpn::TunWin::Setup::destroy ( std::ostream &  os)
inlineoverridevirtual

Implements openvpn::DestructorBase.

Definition at line 217 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ establish()

HANDLE openvpn::TunWin::Setup::establish ( const TunBuilderCapture pull,
const std::wstring &  openvpn_app_path,
Stop stop,
std::ostream &  os,
RingBuffer::Ptr  ring_buffer 
)
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 126 of file tunsetup.hpp.

◆ get_adapter_state()

Util::TapNameGuidPair openvpn::TunWin::Setup::get_adapter_state ( )
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 69 of file tunsetup.hpp.

◆ get_handle()

HANDLE openvpn::TunWin::Setup::get_handle ( std::ostream &  os)
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 94 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ l2_finish()

void openvpn::TunWin::Setup::l2_finish ( const TunBuilderCapture pull,
Stop stop,
std::ostream &  os 
)
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 203 of file tunsetup.hpp.

◆ l2_ready()

bool openvpn::TunWin::Setup::l2_ready ( const TunBuilderCapture pull)
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 180 of file tunsetup.hpp.

◆ register_rings()

void openvpn::TunWin::Setup::register_rings ( HANDLE  handle,
RingBuffer::Ptr  ring_buffer 
)
inlineprivate

Definition at line 334 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ route_metric_opt()

static std::string openvpn::TunWin::Setup::route_metric_opt ( const TunBuilderCapture pull,
const TunBuilderCapture::RouteBase route,
const MetricType  mt 
)
inlinestaticprivate

Definition at line 900 of file tunsetup.hpp.

Here is the caller graph for this function:

◆ set_adapter_state()

void openvpn::TunWin::Setup::set_adapter_state ( const Util::TapNameGuidPair tap)
inlineoverridevirtual

Implements openvpn::TunWin::SetupBase.

Definition at line 74 of file tunsetup.hpp.

◆ set_process_id()

void openvpn::TunWin::Setup::set_process_id ( DWORD  process_id)
inline

Set the process id to be used with the NPRT rules.

The NRPT c'tor expects a process id parameter, which is used internally. This function can be used if you want that pid to be different from the current process id, e.g. if you are doing the setup for a different process, like in the agent.

Parameters
process_idThe process id used with the NRPT class

Definition at line 89 of file tunsetup.hpp.

◆ vpn_interface_index()

DWORD openvpn::TunWin::Setup::vpn_interface_index ( ) const
inlineoverridevirtual

Reimplemented from openvpn::TunWin::SetupBase.

Definition at line 253 of file tunsetup.hpp.

Member Data Documentation

◆ allow_local_dns_resolvers

bool openvpn::TunWin::Setup::allow_local_dns_resolvers = false
private

Definition at line 936 of file tunsetup.hpp.

◆ delete_route_timer

AsioTimer openvpn::TunWin::Setup::delete_route_timer
private

Definition at line 932 of file tunsetup.hpp.

◆ l2_state

std::unique_ptr<L2State> openvpn::TunWin::Setup::l2_state
private

Definition at line 927 of file tunsetup.hpp.

◆ l2_thread

std::unique_ptr<std::thread> openvpn::TunWin::Setup::l2_thread
private

Definition at line 926 of file tunsetup.hpp.

◆ process_id_

DWORD openvpn::TunWin::Setup::process_id_ = 0
private

Definition at line 937 of file tunsetup.hpp.

◆ remove_cmds

ActionList::Ptr openvpn::TunWin::Setup::remove_cmds
private

Definition at line 930 of file tunsetup.hpp.

◆ tap_

Util::TapNameGuidPair openvpn::TunWin::Setup::tap_
private

Definition at line 935 of file tunsetup.hpp.

◆ tun_type_

const Type openvpn::TunWin::Setup::tun_type_
private

Definition at line 934 of file tunsetup.hpp.

◆ vpn_interface_index_

DWORD openvpn::TunWin::Setup::vpn_interface_index_ = INVALID_ADAPTER_INDEX
private

Definition at line 929 of file tunsetup.hpp.


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