Luanti 5.16.0-dev
Loading...
Searching...
No Matches
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) const
std::string getBanDescription (const std::string &ip_or_name) const
std::string getBanName (const std::string &ip) const
void add (const std::string &ip, const std::string &name)
void remove (const std::string &ip_or_name)
bool isModified () const

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 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) const

References m_ips, and m_mutex.

Referenced by TestBan::testGetBanDescription().

Here is the caller graph for this function:

◆ getBanName()

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

References m_ips, and m_mutex.

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

Here is the caller graph for this function:

◆ isIpBanned()

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

References m_ips, and m_mutex.

◆ isModified()

bool BanManager::isModified ( ) const

References m_modified, and m_mutex.

Referenced by 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(), open_ifstream(), 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(), and TestBan::testRemove().

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(), 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
mutableprivate

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