15#ifndef OPENVPN_CLIENT_RGOPT_H
16#define OPENVPN_CLIENT_RGOPT_H
58 doinit(opt,
"redirect-gateway",
true);
59 doinit(opt,
"redirect-private",
false);
97 ret +=
"BYPASS_DHCP ";
101 ret +=
"BLOCK_LOCAL ";
116 void doinit(
const OptionList &opt,
const std::string &directive,
const bool redirect_gateway)
118 OptionList::IndexMap::const_iterator rg = opt.
map().find(directive);
119 if (rg != opt.
map().end())
120 add_flags(opt, rg->second, redirect_gateway);
126 if (redirect_gateway)
130 for (OptionList::IndexList::const_iterator i = idx.begin(); i != idx.end(); ++i)
132 const Option &o = opt[*i];
133 for (
size_t j = 1; j < o.
size(); ++j)
135 const std::string &
f = o.
get(j, 64);
138 else if (
f ==
"autolocal")
140 else if (
f ==
"def1")
142 else if (
f ==
"bypass-dhcp")
144 else if (
f ==
"bypass-dns")
146 else if (
f ==
"block-local")
148 else if (
f ==
"ipv4")
150 else if (
f ==
"!ipv4")
152 else if (
f ==
"ipv6")
154 else if (
f ==
"!ipv6")
const IndexMap & map() const
std::vector< unsigned int > IndexList
const std::string & get(const size_t index, const size_t max_len) const
bool redirect_gateway_ipv6_enabled() const
bool redirect_gateway_ipv4_enabled() const
unsigned int operator()() const
RedirectGatewayFlags(const OptionList &opt)
void init(const OptionList &opt)
RedirectGatewayFlags(unsigned int flags)
void doinit(const OptionList &opt, const std::string &directive, const bool redirect_gateway)
bool redirect_gateway_local() const
void add_flags(const OptionList &opt, const OptionList::IndexList &idx, const bool redirect_gateway)
std::string to_string() const