Bitcoin Core  22.99.0
P2P Digital Currency
Functions | Variables
netbase_tests.cpp File Reference
#include <net_permissions.h>
#include <netaddress.h>
#include <netbase.h>
#include <protocol.h>
#include <serialize.h>
#include <streams.h>
#include <test/util/setup_common.h>
#include <util/strencodings.h>
#include <util/translation.h>
#include <version.h>
#include <string>
#include <boost/test/unit_test.hpp>
Include dependency graph for netbase_tests.cpp:

Go to the source code of this file.

Functions

static CNetAddr ResolveIP (const std::string &ip)
 
static CSubNet ResolveSubNet (const std::string &subnet)
 
static CNetAddr CreateInternal (const std::string &host)
 
 BOOST_AUTO_TEST_CASE (netbase_networks)
 
 BOOST_AUTO_TEST_CASE (netbase_properties)
 
static bool TestSplitHost (const std::string &test, const std::string &host, uint16_t port)
 
 BOOST_AUTO_TEST_CASE (netbase_splithost)
 
static bool TestParse (std::string src, std::string canon)
 
 BOOST_AUTO_TEST_CASE (netbase_lookupnumeric)
 
 BOOST_AUTO_TEST_CASE (embedded_test)
 
 BOOST_AUTO_TEST_CASE (subnet_test)
 
 BOOST_AUTO_TEST_CASE (netbase_getgroup)
 
 BOOST_AUTO_TEST_CASE (netbase_parsenetwork)
 
 BOOST_AUTO_TEST_CASE (netpermissions_test)
 
 BOOST_AUTO_TEST_CASE (netbase_dont_resolve_strings_with_embedded_nul_characters)
 
static const std::vector< CAddressfixture_addresses ({ CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0), NODE_NONE, 0x4966bc61U), CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1), NODE_NETWORK, 0x83766279U), CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2), static_cast< ServiceFlags >(NODE_WITNESS|NODE_COMPACT_FILTERS|NODE_NETWORK_LIMITED), 0xffffffffU) })
 
 BOOST_AUTO_TEST_CASE (caddress_serialize_v1)
 
 BOOST_AUTO_TEST_CASE (caddress_unserialize_v1)
 
 BOOST_AUTO_TEST_CASE (caddress_serialize_v2)
 
 BOOST_AUTO_TEST_CASE (caddress_unserialize_v2)
 

Variables

static constexpr const char * stream_addrv1_hex
 
static constexpr const char * stream_addrv2_hex
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/14]

BOOST_AUTO_TEST_CASE ( caddress_serialize_v1  )

Definition at line 543 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/14]

BOOST_AUTO_TEST_CASE ( caddress_serialize_v2  )

Definition at line 560 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/14]

BOOST_AUTO_TEST_CASE ( caddress_unserialize_v1  )

Definition at line 551 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/14]

BOOST_AUTO_TEST_CASE ( caddress_unserialize_v2  )

Definition at line 568 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/14]

BOOST_AUTO_TEST_CASE ( embedded_test  )

Definition at line 135 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/14]

BOOST_AUTO_TEST_CASE ( netbase_dont_resolve_strings_with_embedded_nul_characters  )

Definition at line 458 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/14]

BOOST_AUTO_TEST_CASE ( netbase_getgroup  )

Definition at line 316 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/14]

BOOST_AUTO_TEST_CASE ( netbase_lookupnumeric  )

Definition at line 119 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/14]

BOOST_AUTO_TEST_CASE ( netbase_networks  )

Definition at line 45 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/14]

BOOST_AUTO_TEST_CASE ( netbase_parsenetwork  )

Definition at line 336 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/14]

BOOST_AUTO_TEST_CASE ( netbase_properties  )

Definition at line 55 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/14]

BOOST_AUTO_TEST_CASE ( netbase_splithost  )

Definition at line 94 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/14]

BOOST_AUTO_TEST_CASE ( netpermissions_test  )

Definition at line 354 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/14]

BOOST_AUTO_TEST_CASE ( subnet_test  )

Definition at line 143 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ CreateInternal()

static CNetAddr CreateInternal ( const std::string &  host)
static

Definition at line 38 of file netbase_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fixture_addresses()

static const std::vector<CAddress> fixture_addresses ( { CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0), NODE_NONE, 0x4966bc61U), CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1), NODE_NETWORK, 0x83766279U), CAddress(CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2), static_cast< ServiceFlags >(NODE_WITNESS|NODE_COMPACT_FILTERS|NODE_NETWORK_LIMITED), 0xffffffffU) }  )
static
Here is the caller graph for this function:

◆ ResolveIP()

static CNetAddr ResolveIP ( const std::string &  ip)
static

Definition at line 24 of file netbase_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResolveSubNet()

static CSubNet ResolveSubNet ( const std::string &  subnet)
static

Definition at line 31 of file netbase_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestParse()

static bool TestParse ( std::string  src,
std::string  canon 
)
static

Definition at line 113 of file netbase_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestSplitHost()

static bool TestSplitHost ( const std::string &  test,
const std::string &  host,
uint16_t  port 
)
static

Definition at line 86 of file netbase_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ stream_addrv1_hex

constexpr const char* stream_addrv1_hex
staticconstexpr
Initial value:
=
"03"
"61bc6649"
"0000000000000000"
"00000000000000000000000000000001"
"0000"
"79627683"
"0100000000000000"
"00000000000000000000000000000001"
"00f1"
"ffffffff"
"4804000000000000"
"00000000000000000000000000000001"
"f1f2"

Definition at line 499 of file netbase_tests.cpp.

◆ stream_addrv2_hex

constexpr const char* stream_addrv2_hex
staticconstexpr
Initial value:
=
"03"
"61bc6649"
"00"
"02"
"10"
"00000000000000000000000000000001"
"0000"
"79627683"
"01"
"02"
"10"
"00000000000000000000000000000001"
"00f1"
"ffffffff"
"fd4804"
"02"
"10"
"00000000000000000000000000000001"
"f1f2"

Definition at line 519 of file netbase_tests.cpp.