Bitcoin Core  27.99.0
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) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void Ban (const CSubNet &sub_net, int64_t ban_time_offset=0, bool since_unix_epoch=false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void Discourage (const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void ClearBanned () EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
bool IsBanned (const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 Return whether net_addr is banned. More...
 
bool IsBanned (const CSubNet &sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 Return whether sub_net is exactly banned. More...
 
bool IsDiscouraged (const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 Return whether net_addr is discouraged. More...
 
bool Unban (const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
bool Unban (const CSubNet &sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void GetBanned (banmap_t &banmap) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void DumpBanlist () EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 

Private Member Functions

void LoadBanlist () EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
 
void SweepBanned () EXCLUSIVE_LOCKS_REQUIRED(m_banned_mutex)
 clean unused entries (if bantime has expired) More...
 
banmap_t m_banned GUARDED_BY (m_banned_mutex)
 
bool m_is_dirty GUARDED_BY (m_banned_mutex)
 
CRollingBloomFilter m_discouraged GUARDED_BY (m_banned_mutex)
 

Private Attributes

Mutex m_banned_mutex
 
CClientUIInterfacem_client_interface = nullptr
 
CBanDB m_ban_db
 
const int64_t m_default_ban_time
 

Detailed Description

Definition at line 58 of file banman.h.

Constructor & Destructor Documentation

◆ ~BanMan()

BanMan::~BanMan ( )

Definition at line 24 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 17 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 118 of file banman.cpp.

Here is the caller graph for this function:

◆ Ban() [2/2]

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

Definition at line 130 of file banman.cpp.

Here is the call graph for this function:

◆ ClearBanned()

void BanMan::ClearBanned ( )

Definition at line 72 of file banman.cpp.

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

◆ Discourage()

void BanMan::Discourage ( const CNetAddr net_addr)

Definition at line 124 of file banman.cpp.

Here is the call graph for this function:

◆ DumpBanlist()

void BanMan::DumpBanlist ( )

Definition at line 48 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 174 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_banned_mutex  )
private

◆ GUARDED_BY() [2/3]

bool m_is_dirty BanMan::GUARDED_BY ( m_banned_mutex  )
inlineprivate

Definition at line 89 of file banman.h.

◆ GUARDED_BY() [3/3]

CRollingBloomFilter m_discouraged BanMan::GUARDED_BY ( m_banned_mutex  )
inlineprivate

Definition at line 93 of file banman.h.

◆ IsBanned() [1/2]

bool BanMan::IsBanned ( const CNetAddr net_addr)

Return whether net_addr is banned.

Definition at line 89 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 104 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 83 of file banman.cpp.

Here is the call graph for this function:

◆ LoadBanlist()

void BanMan::LoadBanlist ( )
private

Definition at line 29 of file banman.cpp.

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

◆ SweepBanned()

void BanMan::SweepBanned ( )
private

clean unused entries (if bantime has expired)

Definition at line 182 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 156 of file banman.cpp.

Here is the caller graph for this function:

◆ Unban() [2/2]

bool BanMan::Unban ( const CSubNet sub_net)

Definition at line 162 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 91 of file banman.h.

◆ m_banned_mutex

Mutex BanMan::m_banned_mutex
private

Definition at line 87 of file banman.h.

◆ m_client_interface

CClientUIInterface* BanMan::m_client_interface = nullptr
private

Definition at line 90 of file banman.h.

◆ m_default_ban_time

const int64_t BanMan::m_default_ban_time
private

Definition at line 92 of file banman.h.


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