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

#include <continuation.hpp>

Inheritance diagram for openvpn::OptionListContinuation:
[legend]
Collaboration diagram for openvpn::OptionListContinuation:
[legend]

Public Member Functions

 OPENVPN_SIMPLE_EXCEPTION (olc_complete)
 
 OPENVPN_EXCEPTION (push_update_unsupported_option)
 
 OptionListContinuation (const PushOptionsBase::Ptr &push_base_arg)
 
 OptionListContinuation ()=default
 
void add (const OptionList &other, OptionList::FilterBase *filt, bool push_update=false)
 
void finalize (const PushOptionsMerger::Ptr merger)
 
bool partial () const
 
bool complete () const
 
void reset_completion ()
 Resets completion flag. Intended to use by PUSH_UPDATE.
 
- Public Member Functions inherited from openvpn::OptionList
 OptionList ()
 
template<typename T , typename... Args>
 OptionList (T first, Args... args)
 
void clear ()
 
void parse_from_csv (const std::string &str, Limits *lim)
 
void parse_from_argv (const std::vector< std::string > &argv)
 
void parse_from_peer_info (const std::string &str, Limits *lim)
 
void parse_from_key_value_list (const KeyValueList &list, const std::string &meta_tag, Limits *lim)
 
void parse_from_config (const std::string &str, Limits *lim)
 
void parse_meta_from_config (const std::string &str, const std::string &tag, Limits *lim)
 
void extend (const OptionList &other, FilterBase *filt=nullptr)
 
void extend (OptionList &&other, FilterBase *filt=nullptr)
 
unsigned int extend (const OptionList &other, const std::string &name)
 
void extend_nonexistent (const OptionList &other)
 
const Optionget_ptr (const std::string &name) const
 
const Optionget_unique_ptr (const std::string &name) const
 
const Optionget_consistent (const std::string &name) const
 
const Optionget (const std::string &name) const
 
const IndexListget_index (const std::string &name) const
 
const IndexListget_index_ptr (const std::string &name) const
 
std::string cat (const std::string &name) const
 
bool exists_unique (const std::string &name) const
 
bool exists (const std::string &name) const
 
const std::string & get (const std::string &name, size_t index, const size_t max_len) const
 
std::string get_optional (const std::string &name, size_t index, const size_t max_len) const
 
std::string get_optional_relaxed (const std::string &name, size_t index, const size_t max_len) const
 
std::string get_optional_noexcept (const std::string &name, size_t index, const size_t max_len) const
 
const char * get_c_str (const std::string &name, size_t index, const size_t max_len) const
 
std::string get_default (const std::string &name, size_t index, const size_t max_len, const std::string &default_value) const
 
std::string get_default_relaxed (const std::string &name, size_t index, const size_t max_len, const std::string &default_value) const
 
template<typename T >
get_num (const std::string &name, const size_t idx, const T default_value) const
 
template<typename T >
get_num (const std::string &name, const size_t idx, const T default_value, const T min_value, const T max_value) const
 
template<typename T >
get_num (const std::string &name, const size_t idx, const T min_value, const T max_value) const
 
template<typename T >
get_num (const std::string &name, const size_t idx) const
 
void touch (const std::string &name) const
 
std::string render (const unsigned int flags) const
 
std::string render_csv () const
 
std::string render_map () const
 
size_t n_unused (bool ignore_meta=false) const
 
size_t meta_unused () const
 
void show_unused_options (const char *title=nullptr) const
 
void add_item (const Option &opt)
 
const IndexMapmap () const
 
void update_map ()
 
- Public Member Functions inherited from openvpn::RCCopyable< thread_unsafe_refcount >
virtual ~RCCopyable ()=default
 
 RCCopyable () noexcept=default
 
 RCCopyable (const RCCopyable &) noexcept
 Construct a new RCCopyable object.
 
 RCCopyable (RCCopyable &&) noexcept
 Construct a new RCCopyable object by move.
 
RCCopyableoperator= (const RCCopyable &) noexcept
 Ensures the new ref count is not copied with the rest of the object.
 
RCCopyableoperator= (RCCopyable &&) noexcept
 Ensures the new ref count is not moved with the rest of the object.
 
olong use_count () const noexcept
 Returns the use count as reported by defering to the injected ref count type.
 

Private Member Functions

void update (OptionList &opts)
 

Static Private Member Functions

static bool continuation (const OptionList &opt)
 

Private Attributes

bool partial_ = false
 
bool complete_ = false
 
PushOptionsBase::Ptr push_base
 
std::unordered_set< std::string > update_list
 A list of options to be updated or deleted during the update process. Existing options with the same name as in PUSH_UPDATE are replaced, and the ones prefixed with "-" in PUSH_UPDATE are deleted.
 

Static Private Attributes

static std::unordered_set< std::string > updatable_options
 

Additional Inherited Members

- Public Types inherited from openvpn::OptionList
typedef RCPtr< OptionListPtr
 
typedef std::vector< unsigned int > IndexList
 
typedef std::unordered_map< std::string, IndexListIndexMap
 
typedef std::pair< std::string, IndexListIndexPair
 
typedef StandardLex Lex
 
- Static Public Member Functions inherited from openvpn::OptionList
static bool is_comment (const char c)
 
static OptionList parse_from_csv_static (const std::string &str, Limits *lim)
 
static OptionList parse_from_csv_static_nomap (const std::string &str, Limits *lim)
 
static OptionList parse_from_config_static (const std::string &str, Limits *lim)
 
static OptionList::Ptr parse_from_config_static_ptr (const std::string &str, Limits *lim)
 
static OptionList parse_from_argv_static (const std::vector< std::string > &argv)
 
static Option parse_option_from_line (const std::string &line, Limits *lim)
 
static bool ignore_line (const std::string &line)
 
static bool is_open_tag (const std::string &str)
 
static bool is_close_tag (const std::string &str, const std::string &tag)
 
static void untag_open_tag (std::string &str)
 
static bool detect_multiline_breakout_nothrow (const std::string &opt, const std::string &tag)
 
static void detect_multiline_breakout (const std::string &opt, const std::string &tag)
 

Detailed Description

Definition at line 44 of file continuation.hpp.

Constructor & Destructor Documentation

◆ OptionListContinuation() [1/2]

openvpn::OptionListContinuation::OptionListContinuation ( const PushOptionsBase::Ptr push_base_arg)
inline

Definition at line 50 of file continuation.hpp.

◆ OptionListContinuation() [2/2]

openvpn::OptionListContinuation::OptionListContinuation ( )
default

Member Function Documentation

◆ add()

void openvpn::OptionListContinuation::add ( const OptionList other,
OptionList::FilterBase filt,
bool  push_update = false 
)
inline

Processes pushed list of options from PUSH_REPLY or PUSH_UPDATE.

For PUSH_REPLY, all incoming options are added subject to filter.

For PUSH_UPDATE, incoming options prefixed with "-" do remove current options. If some options cannot be updated, exception is thrown. Incoming options prefixed with "?" are considered optional and might be ignored if update is not supported.

Parameters
otherIncoming list of options
filtOptions filter
push_updatetrue if this is PUSH_UPDATE, false if PUSH_REPLY

Definition at line 75 of file continuation.hpp.

Here is the caller graph for this function:

◆ complete()

bool openvpn::OptionListContinuation::complete ( ) const
inline

Definition at line 134 of file continuation.hpp.

Here is the caller graph for this function:

◆ continuation()

static bool openvpn::OptionListContinuation::continuation ( const OptionList opt)
inlinestaticprivate

Definition at line 237 of file continuation.hpp.

Here is the caller graph for this function:

◆ finalize()

void openvpn::OptionListContinuation::finalize ( const PushOptionsMerger::Ptr  merger)
inline

Definition at line 116 of file continuation.hpp.

Here is the caller graph for this function:

◆ OPENVPN_EXCEPTION()

openvpn::OptionListContinuation::OPENVPN_EXCEPTION ( push_update_unsupported_option  )

◆ OPENVPN_SIMPLE_EXCEPTION()

openvpn::OptionListContinuation::OPENVPN_SIMPLE_EXCEPTION ( olc_complete  )

◆ partial()

bool openvpn::OptionListContinuation::partial ( ) const
inline

Definition at line 128 of file continuation.hpp.

Here is the caller graph for this function:

◆ reset_completion()

void openvpn::OptionListContinuation::reset_completion ( )
inline

Resets completion flag. Intended to use by PUSH_UPDATE.

Definition at line 143 of file continuation.hpp.

Here is the caller graph for this function:

◆ update()

void openvpn::OptionListContinuation::update ( OptionList opts)
inlineprivate

Handles PUSH_UPDATE options

This method:

  • throws an exception if an option in the list doesn't support PUSH_UPDATE
  • removes an original option which is prefixed with "-" in incoming options list
  • removes an original option with the same name as incoming options list

Note that options prefixed with "-" are removed from incoming options list

Parameters
optsA list of PUSH_UPDATE options.

Definition at line 161 of file continuation.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ complete_

bool openvpn::OptionListContinuation::complete_ = false
private

Definition at line 244 of file continuation.hpp.

◆ partial_

bool openvpn::OptionListContinuation::partial_ = false
private

Definition at line 243 of file continuation.hpp.

◆ push_base

PushOptionsBase::Ptr openvpn::OptionListContinuation::push_base
private

Definition at line 246 of file continuation.hpp.

◆ updatable_options

std::unordered_set<std::string> openvpn::OptionListContinuation::updatable_options
inlinestaticprivate
Initial value:
= {
"block-ipv4",
"block-ipv6",
"block-outside-dns",
"dhcp-options",
"dns",
"ifconfig",
"ifconfig-ipv6",
"push-continuation",
"redirect-gateway",
"redirect-private",
"route",
"route-gateway",
"route-ipv6",
"route-metric",
"topology",
"tun-mtu"}

Definition at line 255 of file continuation.hpp.

◆ update_list

std::unordered_set<std::string> openvpn::OptionListContinuation::update_list
private

A list of options to be updated or deleted during the update process. Existing options with the same name as in PUSH_UPDATE are replaced, and the ones prefixed with "-" in PUSH_UPDATE are deleted.

Definition at line 253 of file continuation.hpp.


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