2019-11-04 13:18:19 +01:00
|
|
|
// Copyright (c) 2019 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_NET_TYPES_H
|
|
|
|
#define BITCOIN_NET_TYPES_H
|
|
|
|
|
2023-12-17 18:16:23 +01:00
|
|
|
#include <util/expected.h>
|
|
|
|
|
2019-11-04 13:18:19 +01:00
|
|
|
#include <map>
|
2023-12-17 18:16:23 +01:00
|
|
|
#include <string>
|
2019-11-04 13:18:19 +01:00
|
|
|
|
|
|
|
class CBanEntry;
|
|
|
|
class CSubNet;
|
|
|
|
|
|
|
|
using banmap_t = std::map<CSubNet, CBanEntry>;
|
|
|
|
|
2023-12-17 18:16:23 +01:00
|
|
|
struct MisbehavingError
|
|
|
|
{
|
|
|
|
int score;
|
|
|
|
std::string message;
|
|
|
|
|
|
|
|
MisbehavingError(int s) : score{s} {}
|
|
|
|
|
|
|
|
// Constructor does a perfect forwarding reference
|
|
|
|
template <typename T>
|
|
|
|
MisbehavingError(int s, T&& msg) :
|
|
|
|
score{s},
|
|
|
|
message{std::forward<T>(msg)}
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
using PeerMsgRet = tl::expected<void, MisbehavingError>;
|
|
|
|
|
2019-11-04 13:18:19 +01:00
|
|
|
#endif // BITCOIN_NET_TYPES_H
|