Bitcoin Core 28.99.0
P2P Digital Currency
Functions | Variables
netbase_tests.cpp File Reference
#include <net_permissions.h>
#include <netaddress.h>
#include <netbase.h>
#include <netgroup.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 <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 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, bool validPort=true)
 
 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, NodeSeconds{0x4966bc61s}, }, CAddress{ CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1), NODE_NETWORK, NodeSeconds{0x83766279s}, }, CAddress{ CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2), static_cast< ServiceFlags >(NODE_WITNESS|NODE_COMPACT_FILTERS|NODE_NETWORK_LIMITED), NodeSeconds{0xffffffffs}, }, })
 
 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)
 
 BOOST_AUTO_TEST_CASE (isbadport)
 

Variables

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

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/15]

BOOST_AUTO_TEST_CASE ( caddress_serialize_v1  )

Definition at line 562 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/15]

BOOST_AUTO_TEST_CASE ( caddress_serialize_v2  )

Definition at line 579 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/15]

BOOST_AUTO_TEST_CASE ( caddress_unserialize_v1  )

Definition at line 570 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/15]

BOOST_AUTO_TEST_CASE ( caddress_unserialize_v2  )

Definition at line 587 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/15]

BOOST_AUTO_TEST_CASE ( embedded_test  )

Definition at line 143 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/15]

BOOST_AUTO_TEST_CASE ( isbadport  )

Definition at line 596 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/15]

BOOST_AUTO_TEST_CASE ( netbase_dont_resolve_strings_with_embedded_nul_characters  )

Definition at line 478 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/15]

BOOST_AUTO_TEST_CASE ( netbase_getgroup  )

Definition at line 324 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/15]

BOOST_AUTO_TEST_CASE ( netbase_lookupnumeric  )

Definition at line 127 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/15]

BOOST_AUTO_TEST_CASE ( netbase_networks  )

Definition at line 36 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/15]

BOOST_AUTO_TEST_CASE ( netbase_parsenetwork  )

Definition at line 344 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/15]

BOOST_AUTO_TEST_CASE ( netbase_properties  )

Definition at line 46 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/15]

BOOST_AUTO_TEST_CASE ( netbase_splithost  )

Definition at line 85 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/15]

BOOST_AUTO_TEST_CASE ( netpermissions_test  )

Definition at line 364 of file netbase_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/15]

BOOST_AUTO_TEST_CASE ( subnet_test  )

Definition at line 151 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 29 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, NodeSeconds{0x4966bc61s}, }, CAddress{ CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1), NODE_NETWORK, NodeSeconds{0x83766279s}, }, CAddress{ CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2), static_cast< ServiceFlags >(NODE_WITNESS|NODE_COMPACT_FILTERS|NODE_NETWORK_LIMITED), NodeSeconds{0xffffffffs}, }, }  )
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:

◆ TestParse()

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

Definition at line 121 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,
bool  validPort = true 
)
static

Definition at line 77 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 518 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 538 of file netbase_tests.cpp.