Changeset View
Changeset View
Standalone View
Standalone View
src/banman.h
Show All 32 Lines | |||||
// 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. | ||||
class BanMan { | class BanMan { | ||||
public: | public: | ||||
~BanMan(); | ~BanMan(); | ||||
BanMan(fs::path ban_file, const CChainParams &chainParams, | BanMan(fs::path ban_file, const CChainParams &chainparams, | ||||
CClientUIInterface *client_interface, int64_t default_ban_time); | CClientUIInterface *client_interface, int64_t default_ban_time); | ||||
void Ban(const CNetAddr &netAddr, const BanReason &banReason, | void Ban(const CNetAddr &net_addr, const BanReason &ban_reason, | ||||
int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | int64_t ban_time_offset = 0, bool since_unix_epoch = false); | ||||
void Ban(const CSubNet &subNet, const BanReason &banReason, | void Ban(const CSubNet &sub_net, const BanReason &ban_reason, | ||||
int64_t bantimeoffset = 0, bool sinceUnixEpoch = false); | int64_t ban_time_offset = 0, bool since_unix_epoch = false); | ||||
void ClearBanned(); | void ClearBanned(); | ||||
bool IsBanned(CNetAddr netAddr); | bool IsBanned(CNetAddr net_addr); | ||||
bool IsBanned(CSubNet subNet); | bool IsBanned(CSubNet sub_net); | ||||
bool Unban(const CNetAddr &netAddr); | bool Unban(const CNetAddr &net_addr); | ||||
bool Unban(const CSubNet &subNet); | bool Unban(const CSubNet &sub_net); | ||||
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(); | ||||
CCriticalSection m_cs_banned; | CCriticalSection m_cs_banned; | ||||
banmap_t m_banned GUARDED_BY(m_cs_banned); | banmap_t m_banned GUARDED_BY(m_cs_banned); | ||||
Show All 9 Lines |