OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_capture.cpp File Reference
#include "test_common.hpp"
#include "test_generators.hpp"
#include <iostream>
#include <openvpn/common/file.hpp>
#include <openvpn/tun/builder/capture.hpp>
Include dependency graph for test_capture.cpp:

Go to the source code of this file.

Functions

 TEST (misc, capture)
 
 TEST (RemoteAddress, EmptyIsNotDefined)
 
 RC_ASSERT (remote_address.defined())
 
 TEST (RemoteAddress, EmptyStringRepresentation)
 
 TEST (RemoteAddress, EmptyStringRepresentationIncludesIPv6Setting)
 
 RC_ASSERT_THROWS_AS (remote_address.validate(title), openvpn::IP::ip_exception)
 
remote_address validate (title)
 
from_json from_json (address_as_json, title)
 
 RC_ASSERT_THROWS_AS (from_json.validate(title), openvpn::IP::ip_exception)
 
from_json from_json (invalid_json, title)
 
 RC_ASSERT (from_json.ipv6==ipv6)
 
 TEST (RerouteGW, EmptyStringRepresentationReturnsUnsetOptions)
 
 if (flags &RedirectGatewayFlags::RG_ENABLE) ret+
 
 if (flags &RedirectGatewayFlags::RG_REROUTE_GW) ret+
 
 if (flags &RedirectGatewayFlags::RG_LOCAL) ret+
 
 if (flags &RedirectGatewayFlags::RG_AUTO_LOCAL) ret+
 
 if (flags &RedirectGatewayFlags::RG_DEF1) ret+
 
 if (flags &RedirectGatewayFlags::RG_BYPASS_DHCP) ret+
 
 if (flags &RedirectGatewayFlags::RG_BYPASS_DNS) ret+
 
 if (flags &RedirectGatewayFlags::RG_BLOCK_LOCAL) ret+
 
 if (flags &RedirectGatewayFlags::RG_IPv4) ret+
 
 if (flags &RedirectGatewayFlags::RG_IPv6) ret+
 
 RC_ASSERT (reroute_gw.to_string()==ipv4_and_ipv6_return_string+"flags="+ret)
 
from_json from_json (reroute_gw_as_json, title)
 
 RC_ASSERT_THROWS_AS (from_json.from_json(invalid_json, title), json::json_parse)
 
 TEST (ProxyBypass, EmptyIsNotDefined)
 
 RC_ASSERT (proxy_bypass.defined())
 
 TEST (ProxyBypass, EmptyStringRepresentation)
 
from_json from_json (proxy_bypass_as_json, title)
 
 TEST (ProxyAutoConfigURL, EmptyIsNotDefined)
 
 RC_ASSERT (proxy_autoconfig_url.defined())
 
 TEST (ProxyAutoConfigURL, EmptyStringRepresentation)
 
from_json from_json (proxy_autoconfig_url_as_json, title)
 
 TEST (ProxyHostPort, EmptyIsNotDefined)
 
 RC_ASSERT (proxy_host_port.defined())
 
 TEST (ProxyHostPort, EmptyStringRepresentationReturnsDefaultPort)
 
from_json from_json (proxy_host_port_as_json, title)
 
 TEST (WINSServer, EmptyStringRepresentation)
 
 RC_ASSERT (wins_server.to_string()==address)
 
 RC_ASSERT_THROWS_AS (wins_server.validate(title), openvpn::IP::ip_exception)
 
from_json from_json (wins_server_as_json, title)
 

Variables

TunBuilderCapture::RemoteAddress remote_address
 
remote_address address = address
 
remote_address ipv6 = true
 
const auto address_as_json = remote_address.to_json()
 
TunBuilderCapture::RemoteAddress from_json
 
const Json::Value invalid_json
 
reroute_gw ipv4 = ipv4
 
reroute_gw flags = flags
 
std::string ret = "[ "
 
const std::string ipv4_and_ipv6_return_string = {"IPv4=" + std::to_string(ipv4) + " IPv6=" + std::to_string(ipv6) + " "}
 
const auto reroute_gw_as_json = reroute_gw.to_json()
 
TunBuilderCapture::ProxyBypass proxy_bypass
 
proxy_bypass bypass_host = bypass_host
 
const auto proxy_bypass_as_json = proxy_bypass.to_json()
 
TunBuilderCapture::ProxyAutoConfigURL proxy_autoconfig_url
 
proxy_autoconfig_url url = url
 
const auto proxy_autoconfig_url_as_json = proxy_autoconfig_url.to_json()
 
TunBuilderCapture::ProxyHostPort proxy_host_port
 
proxy_host_port host = host
 
proxy_host_port port = port
 
const auto proxy_host_port_as_json = proxy_host_port.to_json()
 
const auto wins_server_as_json = wins_server.to_json()
 

Function Documentation

◆ from_json() [1/7]

from_json from_json ( address_as_json  ,
title   
)

◆ from_json() [2/7]

from_json from_json ( invalid_json  ,
title   
)

◆ from_json() [3/7]

from_json from_json ( proxy_autoconfig_url_as_json  ,
title   
)

◆ from_json() [4/7]

from_json from_json ( proxy_bypass_as_json  ,
title   
)

◆ from_json() [5/7]

from_json from_json ( proxy_host_port_as_json  ,
title   
)

◆ from_json() [6/7]

from_json from_json ( reroute_gw_as_json  ,
title   
)

◆ from_json() [7/7]

from_json from_json ( wins_server_as_json  ,
title   
)

◆ if() [1/10]

if ( flags &RedirectGatewayFlags::RG_AUTO_LOCAL  )

◆ if() [2/10]

if ( flags &RedirectGatewayFlags::RG_BLOCK_LOCAL  )

◆ if() [3/10]

if ( flags &RedirectGatewayFlags::RG_BYPASS_DHCP  )

◆ if() [4/10]

if ( flags &RedirectGatewayFlags::RG_BYPASS_DNS  )

◆ if() [5/10]

if ( flags &RedirectGatewayFlags::RG_DEF1  )

◆ if() [6/10]

if ( flags &RedirectGatewayFlags::RG_ENABLE  )
Here is the caller graph for this function:

◆ if() [7/10]

if ( flags &RedirectGatewayFlags::RG_IPv4  )

◆ if() [8/10]

if ( flags &RedirectGatewayFlags::RG_IPv6  )

◆ if() [9/10]

if ( flags &RedirectGatewayFlags::RG_LOCAL  )

◆ if() [10/10]

if ( flags &RedirectGatewayFlags::RG_REROUTE_GW  )

◆ RC_ASSERT() [1/7]

RC_ASSERT ( from_json.  ipv6 = =ipv6)

◆ RC_ASSERT() [2/7]

RC_ASSERT ( proxy_autoconfig_url.  defined())

◆ RC_ASSERT() [3/7]

RC_ASSERT ( proxy_bypass.  defined())

◆ RC_ASSERT() [4/7]

RC_ASSERT ( proxy_host_port.  defined())

◆ RC_ASSERT() [5/7]

RC_ASSERT ( remote_address.  defined())

◆ RC_ASSERT() [6/7]

RC_ASSERT ( reroute_gw.  to_string() = =ipv4_and_ipv6_return_string+"flags="+ret)

◆ RC_ASSERT() [7/7]

RC_ASSERT ( wins_server.  to_string() = =address)

◆ RC_ASSERT_THROWS_AS() [1/4]

RC_ASSERT_THROWS_AS ( from_json.  from_jsoninvalid_json, title,
json::json_parse   
)

◆ RC_ASSERT_THROWS_AS() [2/4]

RC_ASSERT_THROWS_AS ( from_json.  validatetitle,
openvpn::IP::ip_exception   
)

◆ RC_ASSERT_THROWS_AS() [3/4]

RC_ASSERT_THROWS_AS ( remote_address.  validatetitle,
openvpn::IP::ip_exception   
)
Initial value:

◆ RC_ASSERT_THROWS_AS() [4/4]

RC_ASSERT_THROWS_AS ( wins_server.  validatetitle,
openvpn::IP::ip_exception   
)

◆ TEST() [1/12]

TEST ( misc  ,
capture   
)

write_string(fn1, j1_txt);

Definition at line 11 of file test_capture.cpp.

◆ TEST() [2/12]

TEST ( ProxyAutoConfigURL  ,
EmptyIsNotDefined   
)

Definition at line 494 of file test_capture.cpp.

◆ TEST() [3/12]

TEST ( ProxyAutoConfigURL  ,
EmptyStringRepresentation   
)

Definition at line 508 of file test_capture.cpp.

◆ TEST() [4/12]

TEST ( ProxyBypass  ,
EmptyIsNotDefined   
)

Definition at line 402 of file test_capture.cpp.

◆ TEST() [5/12]

TEST ( ProxyBypass  ,
EmptyStringRepresentation   
)

Definition at line 416 of file test_capture.cpp.

◆ TEST() [6/12]

TEST ( ProxyHostPort  ,
EmptyIsNotDefined   
)

Definition at line 588 of file test_capture.cpp.

◆ TEST() [7/12]

TEST ( ProxyHostPort  ,
EmptyStringRepresentationReturnsDefaultPort   
)

Definition at line 602 of file test_capture.cpp.

◆ TEST() [8/12]

TEST ( RemoteAddress  ,
EmptyIsNotDefined   
)

Definition at line 71 of file test_capture.cpp.

◆ TEST() [9/12]

TEST ( RemoteAddress  ,
EmptyStringRepresentation   
)

Definition at line 85 of file test_capture.cpp.

◆ TEST() [10/12]

TEST ( RemoteAddress  ,
EmptyStringRepresentationIncludesIPv6Setting   
)

Definition at line 91 of file test_capture.cpp.

◆ TEST() [11/12]

TEST ( RerouteGW  ,
EmptyStringRepresentationReturnsUnsetOptions   
)

Definition at line 254 of file test_capture.cpp.

◆ TEST() [12/12]

TEST ( WINSServer  ,
EmptyStringRepresentation   
)

Definition at line 686 of file test_capture.cpp.

◆ validate()

from_json validate ( title  )
Initial value:

Variable Documentation

◆ address

wins_server address = address

Definition at line 81 of file test_capture.cpp.

◆ address_as_json

const auto address_as_json = remote_address.to_json()

Definition at line 157 of file test_capture.cpp.

◆ bypass_host

proxy_bypass bypass_host = bypass_host

Definition at line 412 of file test_capture.cpp.

◆ flags

from_json flags = flags

Definition at line 265 of file test_capture.cpp.

◆ from_json

from_json from_json

Definition at line 158 of file test_capture.cpp.

◆ host

from_json host = host

Definition at line 598 of file test_capture.cpp.

◆ invalid_json

const Json::Value invalid_json
Initial value:
{
TunBuilderCapture::RemoteAddress from_json

Definition at line 244 of file test_capture.cpp.

◆ ipv4

from_json ipv4 = ipv4

Definition at line 263 of file test_capture.cpp.

◆ ipv4_and_ipv6_return_string

const std::string ipv4_and_ipv6_return_string = {"IPv4=" + std::to_string(ipv4) + " IPv6=" + std::to_string(ipv6) + " "}

Definition at line 290 of file test_capture.cpp.

◆ ipv6

from_json ipv6 = true

Definition at line 108 of file test_capture.cpp.

◆ port

from_json port = port

Definition at line 612 of file test_capture.cpp.

◆ proxy_autoconfig_url

Initial value:
{
const auto url = *rc::gen::nonEmpty<std::string>()
proxy_autoconfig_url url

Definition at line 503 of file test_capture.cpp.

◆ proxy_autoconfig_url_as_json

const auto proxy_autoconfig_url_as_json = proxy_autoconfig_url.to_json()

Definition at line 530 of file test_capture.cpp.

◆ proxy_bypass

Initial value:
{
const auto bypass_host = *rc::gen::nonEmpty<std::string>()
proxy_bypass bypass_host

Definition at line 411 of file test_capture.cpp.

◆ proxy_bypass_as_json

const auto proxy_bypass_as_json = proxy_bypass.to_json()

Definition at line 438 of file test_capture.cpp.

◆ proxy_host_port

Initial value:
{
const auto host = *rc::gen::nonEmpty<std::string>()
proxy_host_port host

Definition at line 597 of file test_capture.cpp.

◆ proxy_host_port_as_json

const auto proxy_host_port_as_json = proxy_host_port.to_json()

Definition at line 625 of file test_capture.cpp.

◆ remote_address

Initial value:
{
const auto address = *rc::gen::nonEmpty<std::string>()
remote_address address

Definition at line 80 of file test_capture.cpp.

◆ reroute_gw_as_json

const auto reroute_gw_as_json = reroute_gw.to_json()

Definition at line 297 of file test_capture.cpp.

◆ ret

ret = "[ "

Definition at line 267 of file test_capture.cpp.

◆ url

from_json url = url

Definition at line 504 of file test_capture.cpp.

◆ wins_server_as_json

const auto wins_server_as_json = wins_server.to_json()

Definition at line 722 of file test_capture.cpp.