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

#include <tunutil.hpp>

Public Member Functions

 BestGateway (ADDRESS_FAMILY af)
 
 BestGateway (ADDRESS_FAMILY af, const std::string &dest_str, DWORD vpn_interface_index)
 
bool defined () const
 
DWORD interface_index () const
 
const std::string & gateway_address () const
 
bool local_route () const
 

Private Member Functions

void fill_gw_details (const MIB_IPFORWARD_ROW2 *row, const std::string &dest)
 

Static Private Member Functions

static ULONG get_iface_metric (std::map< NET_IFINDEX, ULONG > &metric_per_iface, NET_IFINDEX iface, ADDRESS_FAMILY af)
 

Private Attributes

DWORD index = -1
 
std::string addr
 
bool local_route_ = false
 

Detailed Description

Definition at line 984 of file tunutil.hpp.

Constructor & Destructor Documentation

◆ BestGateway() [1/2]

openvpn::TunWin::Util::BestGateway::BestGateway ( ADDRESS_FAMILY  af)
inline

Construct object which represents default gateway

Definition at line 990 of file tunutil.hpp.

◆ BestGateway() [2/2]

openvpn::TunWin::Util::BestGateway::BestGateway ( ADDRESS_FAMILY  af,
const std::string &  dest_str,
DWORD  vpn_interface_index 
)
inline

Construct object which represents best gateway to given destination, excluding gateway on VPN interface. Gateway is chosen first by the longest prefix match and then by metric. If destination is in local network, no gateway is selected and "local_route" flag is set.

Parameters
afaddress family, AF_INET or AF_INET6
dest_strdestination IPv4/IPv6 address
vpn_interface_indexindex of VPN interface which is excluded from gateway selection

Definition at line 1044 of file tunutil.hpp.

Member Function Documentation

◆ defined()

bool openvpn::TunWin::Util::BestGateway::defined ( ) const
inline

Definition at line 1150 of file tunutil.hpp.

◆ fill_gw_details()

void openvpn::TunWin::Util::BestGateway::fill_gw_details ( const MIB_IPFORWARD_ROW2 *  row,
const std::string &  dest 
)
inlineprivate

Definition at line 1175 of file tunutil.hpp.

Here is the caller graph for this function:

◆ gateway_address()

const std::string & openvpn::TunWin::Util::BestGateway::gateway_address ( ) const
inline

Definition at line 1160 of file tunutil.hpp.

Here is the caller graph for this function:

◆ get_iface_metric()

static ULONG openvpn::TunWin::Util::BestGateway::get_iface_metric ( std::map< NET_IFINDEX, ULONG > &  metric_per_iface,
NET_IFINDEX  iface,
ADDRESS_FAMILY  af 
)
inlinestaticprivate

Definition at line 1185 of file tunutil.hpp.

Here is the caller graph for this function:

◆ interface_index()

DWORD openvpn::TunWin::Util::BestGateway::interface_index ( ) const
inline

Definition at line 1155 of file tunutil.hpp.

Here is the caller graph for this function:

◆ local_route()

bool openvpn::TunWin::Util::BestGateway::local_route ( ) const
inline

Return true if destination, provided to constructor, doesn't require gateway, false otherwise.

Definition at line 1169 of file tunutil.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ addr

std::string openvpn::TunWin::Util::BestGateway::addr
private

Definition at line 1199 of file tunutil.hpp.

◆ index

DWORD openvpn::TunWin::Util::BestGateway::index = -1
private

Definition at line 1198 of file tunutil.hpp.

◆ local_route_

bool openvpn::TunWin::Util::BestGateway::local_route_ = false
private

Definition at line 1200 of file tunutil.hpp.


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