Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | public: | ||||
// node's peers drop it. If there is, an attacker | // node's peers drop it. If there is, an attacker | ||||
// can isolate a node and/or try to split the network. | // can isolate a node and/or try to split the network. | ||||
// Dropping a node for sending stuff that is invalid | // Dropping a node for sending stuff that is invalid | ||||
// now but might be valid in a later version is also | // now but might be valid in a later version is also | ||||
// dangerous, because it can cause a network split | // dangerous, because it can cause a network split | ||||
// between nodes running old code and nodes running | // between nodes running old code and nodes running | ||||
// new code. | // new code. | ||||
~BanMan(); | ~BanMan(); | ||||
BanMan(const CChainParams &_params, CClientUIInterface *client_interface); | BanMan(fs::path ban_file, const CChainParams &chainParams, | ||||
CClientUIInterface *client_interface); | |||||
void Ban(const CNetAddr &netAddr, const BanReason &reason, | void Ban(const CNetAddr &netAddr, const BanReason &reason, | ||||
int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | ||||
void Ban(const CSubNet &subNet, const BanReason &reason, | void Ban(const CSubNet &subNet, const BanReason &reason, | ||||
int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | ||||
void ClearBanned(); // needed for unit testing | void ClearBanned(); // needed for unit testing | ||||
bool IsBanned(CNetAddr ip); | bool IsBanned(CNetAddr ip); | ||||
bool IsBanned(CSubNet subnet); | bool IsBanned(CSubNet subnet); | ||||
bool Unban(const CNetAddr &ip); | bool Unban(const CNetAddr &ip); | ||||
bool Unban(const CSubNet &ip); | bool Unban(const CSubNet &ip); | ||||
void GetBanned(banmap_t &banmap); | void GetBanned(banmap_t &banmap); | ||||
void DumpBanlist(); | void DumpBanlist(); | ||||
private: | private: | ||||
void SetBanned(const banmap_t &banmap); | void SetBanned(const banmap_t &banmap); | ||||
bool BannedSetIsDirty(); | bool BannedSetIsDirty(); | ||||
//! set the "dirty" flag for the banlist | //! set the "dirty" flag for the banlist | ||||
void SetBannedSetDirty(bool dirty = true); | void SetBannedSetDirty(bool dirty = true); | ||||
//! clean unused entries (if bantime has expired) | //! clean unused entries (if bantime has expired) | ||||
void SweepBanned(); | void SweepBanned(); | ||||
banmap_t setBanned; | banmap_t setBanned; | ||||
CCriticalSection cs_setBanned; | CCriticalSection cs_setBanned; | ||||
bool setBannedIsDirty; | bool setBannedIsDirty; | ||||
CClientUIInterface *clientInterface = nullptr; | CClientUIInterface *clientInterface = nullptr; | ||||
CBanDB m_ban_db; | |||||
const CChainParams ¶ms; | |||||
}; | }; | ||||
class NetEventsInterface; | class NetEventsInterface; | ||||
class CConnman { | class CConnman { | ||||
public: | public: | ||||
enum NumConnections { | enum NumConnections { | ||||
CONNECTIONS_NONE = 0, | CONNECTIONS_NONE = 0, | ||||
CONNECTIONS_IN = (1U << 0), | CONNECTIONS_IN = (1U << 0), | ||||
▲ Show 20 Lines • Show All 728 Lines • Show Last 20 Lines |