Minetest  5.4.0
BanManager Class Reference

#include <ban.h>

+ Collaboration diagram for BanManager:

Public Member Functions

 BanManager (const std::string &banfilepath)
 
 ~BanManager ()
 
void load ()
 
void save ()
 
bool isIpBanned (const std::string &ip)
 
std::string getBanDescription (const std::string &ip_or_name)
 
std::string getBanName (const std::string &ip)
 
void add (const std::string &ip, const std::string &name)
 
void remove (const std::string &ip_or_name)
 
bool isModified ()
 

Private Attributes

std::mutex m_mutex
 
std::string m_banfilepath = ""
 
StringMap m_ips
 
bool m_modified = false
 

Constructor & Destructor Documentation

◆ BanManager()

BanManager::BanManager ( const std::string &  banfilepath)

References infostream, load(), and m_banfilepath.

+ Here is the call graph for this function:

◆ ~BanManager()

BanManager::~BanManager ( )

References save().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

void BanManager::add ( const std::string &  ip,
const std::string &  name 
)

References m_ips, m_modified, and m_mutex.

Referenced by Server::setIpBanned(), TestBan::testAdd(), TestBan::testGetBanDescription(), TestBan::testGetBanName(), TestBan::testModificationFlag(), and TestBan::testRemove().

+ Here is the caller graph for this function:

◆ getBanDescription()

std::string BanManager::getBanDescription ( const std::string &  ip_or_name)

References m_ips, and m_mutex.

Referenced by Server::getBanDescription(), and TestBan::testGetBanDescription().

+ Here is the caller graph for this function:

◆ getBanName()

std::string BanManager::getBanName ( const std::string &  ip)

References m_ips, and m_mutex.

Referenced by Server::ProcessData(), TestBan::testAdd(), TestBan::testGetBanName(), and TestBan::testRemove().

+ Here is the caller graph for this function:

◆ isIpBanned()

bool BanManager::isIpBanned ( const std::string &  ip)

References m_ips, and m_mutex.

Referenced by Server::ProcessData().

+ Here is the caller graph for this function:

◆ isModified()

bool BanManager::isModified ( )

References m_modified, and m_mutex.

Referenced by Server::AsyncRunStep(), and TestBan::testModificationFlag().

+ Here is the caller graph for this function:

◆ load()

void BanManager::load ( )

References infostream, m_banfilepath, m_ips, m_modified, m_mutex, BasicStrfnd< T >::next(), and trim().

Referenced by BanManager().

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

◆ remove()

void BanManager::remove ( const std::string &  ip_or_name)

References m_ips, m_modified, and m_mutex.

Referenced by TestBan::testModificationFlag(), TestBan::testRemove(), and Server::unsetIpBanned().

+ Here is the caller graph for this function:

◆ save()

void BanManager::save ( )

References infostream, m_banfilepath, m_ips, m_modified, m_mutex, and fs::safeWriteToFile().

Referenced by ~BanManager(), Server::AsyncRunStep(), TestBan::testCreate(), and TestBan::testModificationFlag().

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

Member Data Documentation

◆ m_banfilepath

std::string BanManager::m_banfilepath = ""
private

Referenced by BanManager(), load(), and save().

◆ m_ips

StringMap BanManager::m_ips
private

◆ m_modified

bool BanManager::m_modified = false
private

Referenced by add(), isModified(), load(), remove(), and save().

◆ m_mutex

std::mutex BanManager::m_mutex
private

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