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

All DNS options set with the –dns or –dhcp-option directive. More...

#include <dns_options.hpp>

Inheritance diagram for openvpn::DnsOptions:
[legend]

Public Member Functions

 DnsOptions ()=default
 
 ~DnsOptions () noexcept=default
 
 DnsOptions (const Json::Value &root, const std::string &title="")
 
std::string to_string () const
 
Json::Value to_json () const
 
void from_json (const Json::Value &root, const std::string &title)
 
bool operator== (const DnsOptions &at) const =default
 

Public Attributes

bool from_dhcp_options = false
 Set to true if the DNS options comes from –dhcp-option options.
 
std::vector< DnsDomainsearch_domains
 List of global DNS search domains to use.
 
std::map< int, DnsServerservers
 List of DNS servers to use, according to the list of priority.
 

Protected Member Functions

DnsServerget_server (const int priority)
 

Detailed Description

All DNS options set with the –dns or –dhcp-option directive.

Definition at line 530 of file dns_options.hpp.

Constructor & Destructor Documentation

◆ DnsOptions() [1/2]

openvpn::DnsOptions::DnsOptions ( )
default

◆ ~DnsOptions()

openvpn::DnsOptions::~DnsOptions ( )
defaultnoexcept

◆ DnsOptions() [2/2]

openvpn::DnsOptions::DnsOptions ( const Json::Value &  root,
const std::string &  title = "" 
)
inlineexplicit

Instantiate a new DnsOptions object with information from a JSON blob, typically exported using the DnsOptions::to_json() method

Parameters
rootThe root Json::Value object to import
titlestd::string with details used for error logging

Definition at line 543 of file dns_options.hpp.

Member Function Documentation

◆ from_json()

void openvpn::DnsOptions::from_json ( const Json::Value &  root,
const std::string &  title 
)
inline

Import a Json::Value, typically generated by DnsOptions::to_json() which will reconfigure this object to carry the information from the JSON data.

Parameters
rootThe root Json::Value object to import
titlestd::string with details used for error logging

Definition at line 613 of file dns_options.hpp.

Here is the caller graph for this function:

◆ get_server()

DnsServer & openvpn::DnsOptions::get_server ( const int  priority)
inlineprotected

Instantiate a new DnsServer object for a given DNS server priority and add it to the DnsOptions server list.

Parameters
priorityPriority value for the new DnsServer setting
Returns
A new instantiated DnsServer object

Definition at line 641 of file dns_options.hpp.

Here is the caller graph for this function:

◆ operator==()

bool openvpn::DnsOptions::operator== ( const DnsOptions at) const
default

◆ to_json()

Json::Value openvpn::DnsOptions::to_json ( ) const
inline

Generate a JSON representation of the configured DnsOptions variables.

The output of this function can be imported into another DnsOptions object by passing the Json::Value to the DnsOptions constructor or using the DnsOptions::from_json() method.

Returns
Json::Value of information this object carries

Definition at line 591 of file dns_options.hpp.

Here is the caller graph for this function:

◆ to_string()

std::string openvpn::DnsOptions::to_string ( ) const
inline

Generate a human readable representation of the configured DnsOptions variables

Returns
std::string the string representation generated

Definition at line 555 of file dns_options.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ from_dhcp_options

bool openvpn::DnsOptions::from_dhcp_options = false

Set to true if the DNS options comes from –dhcp-option options.

Definition at line 629 of file dns_options.hpp.

◆ search_domains

std::vector<DnsDomain> openvpn::DnsOptions::search_domains

List of global DNS search domains to use.

Definition at line 630 of file dns_options.hpp.

◆ servers

std::map<int, DnsServer> openvpn::DnsOptions::servers

List of DNS servers to use, according to the list of priority.

Definition at line 631 of file dns_options.hpp.


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