OpenVPN 3 Core Library
Loading...
Searching...
No Matches
rc::helpers Namespace Reference

Functions

auto genHost (const bool valid=true) -> Gen< std::string >
 Generates a host string.
 
auto genDnsServerSecurity () -> Gen< openvpn::DnsServer::Security >
 Generates random DNS server security settings.
 
auto genDnsServerTransport () -> Gen< openvpn::DnsServer::Transport >
 Generates random DNS server transport.
 
constexpr auto otherVersion (const openvpn::IP::Addr::Version version) -> openvpn::IP::Addr::Version
 The address version that is not version; UNSPEC maps to V4.
 
auto singleBit (const openvpn::IP::Addr::Version version, const unsigned int bit) -> openvpn::IP::Addr
 The address of version with only bit set; bit 0 is the least significant.
 
auto nonContiguousNetmask (const openvpn::IP::Addr::Version version, const unsigned int cleared_bit) -> openvpn::IP::Addr
 A mask of version with every bit set except cleared_bit.
 
template<typename Parse >
std::optional< std::string > rejectionMessageOf (Parse &&parse)
 The diagnostic AddrMaskPair::from_string throws when parse calls it, or nullopt when it accepts.
 
std::optional< std::string > rejectionMessage (const std::string &input, const char *title=nullptr)
 
std::optional< std::string > rejectionMessageForTerms (const std::string &address, const std::string &mask)
 Named apart from rejectionMessage: a literal "" second argument would otherwise bind to the title parameter.
 
std::optional< std::string > rejectionMessage (const openvpn::IP::AddrMaskPair::StringPair &pair)
 

Function Documentation

◆ genDnsServerSecurity()

auto rc::helpers::genDnsServerSecurity ( ) -> Gen<openvpn::DnsServer::Security>
inline

Generates random DNS server security settings.

Creates a generator that produces random values from the openvpn::DnsServer::Security enumeration. The generated values can be one of: Unset, No, Yes, or Optional.

Returns
A generator that yields random openvpn::DnsServer::Security enum values.

Definition at line 721 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genDnsServerTransport()

auto rc::helpers::genDnsServerTransport ( ) -> Gen<openvpn::DnsServer::Transport>
inline

Generates random DNS server transport.

Creates a generator that produces random values from the openvpn::DnsServer::Transport enumeration. The generator yields one of: Unset, Plain, HTTPS, or TLS.

Returns
A generator that yields random openvpn::DnsServer::Transport enum values.

Definition at line 736 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genHost()

auto rc::helpers::genHost ( const bool  valid = true) -> Gen<std::string>
inline

Generates a host string.

Creates a string based on the input parameter. Valid hosts conform to length constraints (between HOST_MIN_LENGTH and HOST_MAX_LENGTH characters) and contain only allowed characters. Invalid hosts may exceed the maximum length or contain invalid characters.

Parameters
validIf true (default), the function will generally produce valid host strings If false, the function will deliberately generate invalid host strings.
Returns
A generator for host strings with the specified validity characteristics.
Note
This generator does not produce meaningful hosts, just string with valid length and from allowed characters

Definition at line 701 of file test_generators.hpp.

Here is the caller graph for this function:

◆ nonContiguousNetmask()

auto rc::helpers::nonContiguousNetmask ( const openvpn::IP::Addr::Version  version,
const unsigned int  cleared_bit 
) -> openvpn::IP::Addr
inline

A mask of version with every bit set except cleared_bit.

Bit 0 is the least significant address bit, so cleared_bit must be at least 1 for the result to be non-contiguous — the shape openvpn::IP::Addr::prefix_len() rejects.

Definition at line 765 of file test_generators.hpp.

Here is the caller graph for this function:

◆ otherVersion()

constexpr auto rc::helpers::otherVersion ( const openvpn::IP::Addr::Version  version) -> openvpn::IP::Addr::Version
constexpr

The address version that is not version; UNSPEC maps to V4.

Definition at line 746 of file test_generators.hpp.

Here is the caller graph for this function:

◆ rejectionMessage() [1/2]

std::optional< std::string > rc::helpers::rejectionMessage ( const openvpn::IP::AddrMaskPair::StringPair &  pair)
inline

Definition at line 798 of file test_generators.hpp.

◆ rejectionMessage() [2/2]

std::optional< std::string > rc::helpers::rejectionMessage ( const std::string &  input,
const char *  title = nullptr 
)
inline

Definition at line 785 of file test_generators.hpp.

◆ rejectionMessageForTerms()

std::optional< std::string > rc::helpers::rejectionMessageForTerms ( const std::string &  address,
const std::string &  mask 
)
inline

Named apart from rejectionMessage: a literal "" second argument would otherwise bind to the title parameter.

Definition at line 792 of file test_generators.hpp.

◆ rejectionMessageOf()

template<typename Parse >
std::optional< std::string > rc::helpers::rejectionMessageOf ( Parse &&  parse)

The diagnostic AddrMaskPair::from_string throws when parse calls it, or nullopt when it accepts.

Definition at line 772 of file test_generators.hpp.

Here is the caller graph for this function:

◆ singleBit()

auto rc::helpers::singleBit ( const openvpn::IP::Addr::Version  version,
const unsigned int  bit 
) -> openvpn::IP::Addr
inline

The address of version with only bit set; bit 0 is the least significant.

Definition at line 752 of file test_generators.hpp.

Here is the caller graph for this function: