6 #include <chainparams.h> 35 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
51 }
catch (
const std::ios_base::failure&) {
82 connman.Init(options);
92 connman.AddTestNode(p2p_node);
120 connman.DisconnectNode(random_netaddr);
126 connman.DisconnectNode(random_subnet);
129 connman.ForEachNode([](
auto) {});
138 (void)connman.GetAddressesUnsafe(max_addresses, max_pct, std::nullopt, filtered);
143 (void)connman.GetAddresses(random_node, max_addresses, max_pct);
158 connman.PushMessage(&random_node, std::move(serialized_net_msg));
176 connman.OpenNetworkConnection(
187 connman.CreateNodeFromAcceptedSocketPublic(
188 CreateSock(AF_INET, SOCK_STREAM, IPPROTO_TCP),
198 options.
vWhiteBinds = std::vector<NetWhitebindPermissions>{
210 connman.InitBindsPublic(options);
213 connman.SocketHandlerPublic();
217 (void)connman.GetExtraFullOutboundCount();
218 (void)connman.GetLocalServices();
219 assert(connman.GetMaxOutboundTarget() == max_outbound_limit);
220 (void)connman.GetMaxOutboundTimeframe();
221 (void)connman.GetMaxOutboundTimeLeftInCycle();
222 (void)connman.GetNetworkActive();
223 std::vector<CNodeStats> stats;
224 connman.GetNodeStats(stats);
225 (void)connman.GetOutboundTargetBytesLeft();
226 (void)connman.GetTotalBytesRecv();
227 (void)connman.GetTotalBytesSent();
228 (void)connman.GetTryNewOutboundPeer();
229 (void)connman.GetUseAddrmanOutgoing();
230 (void)connman.ASMapHealthCheck();
232 connman.ClearTestNodes();
std::vector< CService > vBinds
Inbound connections are those initiated by a peer.
WeakEnumType ConsumeWeakEnum(FuzzedDataProvider &fuzzed_data_provider, const WeakEnumType(&all_types)[size]) noexcept
constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]
std::vector< unsigned char > data
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, const std::optional< NodeId > &node_id_in=std::nullopt)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
const TestingSetup * g_setup
auto ConsumeNode(FuzzedDataProvider &fuzzed_data_provider, const std::optional< NodeId > &node_id_in=std::nullopt) noexcept
NetGroupManager ConsumeNetGroupManager(FuzzedDataProvider &fuzzed_data_provider) noexcept
These are the default connections that we use to connect with the network.
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
CAddress ConsumeAddress(FuzzedDataProvider &fuzzed_data_provider) noexcept
constexpr ConnectionType ALL_CONNECTION_TYPES[]
std::string random_string(uint32_t length)
Double ended buffer combining vector and stream-like interfaces.
NetEventsInterface * m_msgproc
CService ConsumeService(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::string ConsumeRandomLengthString(size_t max_length)
A CService with information about it as peer.
std::vector< CService > ConsumeServiceVector(FuzzedDataProvider &fuzzed_data_provider, size_t max_vector_size=5) noexcept
CNetAddr ConsumeNetAddr(FuzzedDataProvider &fuzzed_data_provider, FastRandomContext *rand) noexcept
Create a CNetAddr.
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
std::vector< CService > onion_binds
FuzzedNetEvents ConsumeNetEvents(FuzzedDataProvider &fdp) noexcept
const CChainParams & Params()
Return the currently selected parameters.
FUZZ_TARGET(connman,.init=initialize_connman)
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
FuzzedDataProvider & fuzzed_data_provider
uint64_t nMaxOutboundLimit
static int32_t GetCheckRatio(const NodeContext &node_ctx)
ConnectionType
Different types of connections to a peer.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
std::function< std::unique_ptr< Sock >int, int, int)> CreateSock
Socket factory.
Information about a peer.
T ConsumeIntegralInRange(T min, T max)
Seed with a compile time constant of zeros.
T PickValueInArray(const T(&array)[size])
void initialize_connman()
std::vector< NetWhitebindPermissions > vWhiteBinds
std::shared_ptr< CThreadInterrupt > ConsumeThreadInterrupt(FuzzedDataProvider &fuzzed_data_provider)
bool bind_on_any
True if the user did not specify -bind= or -whitebind= and thus we should bind on 0...
Testing setup that configures a complete environment.
CSubNet ConsumeSubNet(FuzzedDataProvider &fuzzed_data_provider) noexcept