Bitcoin Core  0.20.99
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BanMan Class Reference

#include <banman.h>

Collaboration diagram for BanMan:
[legend]

Public Member Functions

 ~BanMan ()
 
 BanMan (fs::path ban_file, CClientUIInterface *client_interface, int64_t default_ban_time)
 
void Ban (const CNetAddr &net_addr, int64_t ban_time_offset=0, bool since_unix_epoch=false)
 
void Ban (const CSubNet &sub_net, int64_t ban_time_offset=0, bool since_unix_epoch=false)
 
void Discourage (const CNetAddr &net_addr)
 
void ClearBanned ()
 
bool IsBanned (const CNetAddr &net_addr)
 Return whether net_addr is banned. More...
 
bool IsBanned (const CSubNet &sub_net)
 Return whether sub_net is exactly banned. More...
 
bool IsDiscouraged (const CNetAddr &net_addr)
 Return whether net_addr is discouraged. More...
 
bool Unban (const CNetAddr &net_addr)
 
bool Unban (const CSubNet &sub_net)
 
void GetBanned (banmap_t &banmap)
 
void DumpBanlist ()
 

Private Member Functions

void SetBanned (const banmap_t &banmap)
 
bool BannedSetIsDirty ()
 
void SetBannedSetDirty (bool dirty=true)
 set the "dirty" flag for the banlist More...
 
void SweepBanned ()
 clean unused entries (if bantime has expired) More...
 
banmap_t m_banned GUARDED_BY (m_cs_banned)
 
bool m_is_dirty GUARDED_BY (m_cs_banned)
 
CRollingBloomFilter m_discouraged GUARDED_BY (m_cs_banned)
 

Private Attributes

RecursiveMutex m_cs_banned
 
CClientUIInterfacem_client_interface = nullptr
 
CBanDB m_ban_db
 
const int64_t m_default_ban_time
 

Detailed Description

Definition at line 57 of file banman.h.

Constructor & Destructor Documentation

◆ ~BanMan()

BanMan::~BanMan ( )

Definition at line 37 of file banman.cpp.

Here is the call graph for this function:

◆ BanMan()

BanMan::BanMan ( fs::path  ban_file,
CClientUIInterface client_interface,
int64_t  default_ban_time 
)

Definition at line 15 of file banman.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ Ban() [1/2]

void BanMan::Ban ( const CNetAddr net_addr,
int64_t  ban_time_offset = 0,
bool  since_unix_epoch = false 
)

Definition at line 106 of file banman.cpp.

◆ Ban() [2/2]

void BanMan::Ban ( const CSubNet sub_net,
int64_t  ban_time_offset = 0,
bool  since_unix_epoch = false 
)

Definition at line 118 of file banman.cpp.

Here is the call graph for this function:

◆ BannedSetIsDirty()

bool BanMan::BannedSetIsDirty ( )
private

Definition at line 202 of file banman.cpp.

Here is the caller graph for this function:

◆ ClearBanned()

void BanMan::ClearBanned ( )

Definition at line 60 of file banman.cpp.

Here is the call graph for this function:

◆ Discourage()

void BanMan::Discourage ( const CNetAddr net_addr)

Definition at line 112 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpBanlist()

void BanMan::DumpBanlist ( )

Definition at line 42 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBanned()

void BanMan::GetBanned ( banmap_t banmap)

Definition at line 162 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GUARDED_BY() [1/3]

banmap_t m_banned BanMan::GUARDED_BY ( m_cs_banned  )
private

◆ GUARDED_BY() [2/3]

bool m_is_dirty BanMan::GUARDED_BY ( m_cs_banned  )
private

◆ GUARDED_BY() [3/3]

CRollingBloomFilter m_discouraged BanMan::GUARDED_BY ( m_cs_banned  )
inlineprivate

Definition at line 95 of file banman.h.

◆ IsBanned() [1/2]

bool BanMan::IsBanned ( const CNetAddr net_addr)

Return whether net_addr is banned.

Definition at line 77 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsBanned() [2/2]

bool BanMan::IsBanned ( const CSubNet sub_net)

Return whether sub_net is exactly banned.

Definition at line 92 of file banman.cpp.

Here is the call graph for this function:

◆ IsDiscouraged()

bool BanMan::IsDiscouraged ( const CNetAddr net_addr)

Return whether net_addr is discouraged.

Definition at line 71 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBanned()

void BanMan::SetBanned ( const banmap_t banmap)
private

Definition at line 170 of file banman.cpp.

Here is the caller graph for this function:

◆ SetBannedSetDirty()

void BanMan::SetBannedSetDirty ( bool  dirty = true)
private

set the "dirty" flag for the banlist

Definition at line 208 of file banman.cpp.

Here is the caller graph for this function:

◆ SweepBanned()

void BanMan::SweepBanned ( )
private

clean unused entries (if bantime has expired)

Definition at line 177 of file banman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Unban() [1/2]

bool BanMan::Unban ( const CNetAddr net_addr)

Definition at line 144 of file banman.cpp.

◆ Unban() [2/2]

bool BanMan::Unban ( const CSubNet sub_net)

Definition at line 150 of file banman.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_ban_db

CBanDB BanMan::m_ban_db
private

Definition at line 93 of file banman.h.

◆ m_client_interface

CClientUIInterface* BanMan::m_client_interface = nullptr
private

Definition at line 92 of file banman.h.

◆ m_cs_banned

RecursiveMutex BanMan::m_cs_banned
private

Definition at line 89 of file banman.h.

◆ m_default_ban_time

const int64_t BanMan::m_default_ban_time
private

Definition at line 94 of file banman.h.


The documentation for this class was generated from the following files: