#include <ban.h>
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 |
BanManager::BanManager | ( | const std::string & | banfilepath | ) |
BanManager::~BanManager | ( | ) |
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().
std::string BanManager::getBanDescription | ( | const std::string & | ip_or_name | ) |
References m_ips, and m_mutex.
Referenced by Server::getBanDescription(), and TestBan::testGetBanDescription().
std::string BanManager::getBanName | ( | const std::string & | ip | ) |
References m_ips, and m_mutex.
Referenced by Server::denyIfBanned(), TestBan::testAdd(), TestBan::testGetBanName(), and TestBan::testRemove().
bool BanManager::isIpBanned | ( | const std::string & | ip | ) |
References m_ips, and m_mutex.
Referenced by Server::denyIfBanned().
bool BanManager::isModified | ( | ) |
References m_modified, and m_mutex.
Referenced by Server::AsyncRunStep(), and TestBan::testModificationFlag().
void BanManager::load | ( | ) |
References infostream, m_banfilepath, m_ips, m_modified, m_mutex, BasicStrfnd< T >::next(), open_ifstream(), and trim().
Referenced by BanManager().
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().
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().
|
private |
Referenced by BanManager(), load(), and save().
|
private |
Referenced by add(), getBanDescription(), getBanName(), isIpBanned(), load(), remove(), and save().
|
private |
Referenced by add(), isModified(), load(), remove(), and save().
|
private |
Referenced by add(), getBanDescription(), getBanName(), isIpBanned(), isModified(), load(), remove(), and save().