#include <ban.hpp>
Public Member Functions | |
ban_manager () | |
~ban_manager () | |
void | read () |
void | write () |
bool | parse_time (const std::string &duration, std::time_t *time) const |
Parses the given duration and adds it to *time except if the duration is '0' or 'permanent' in which case *time will be set to '0'. More... | |
std::string | ban (const std::string &, const std::time_t &, const std::string &, const std::string &, const std::string &, const std::string &="") |
void | unban (std::ostringstream &os, const std::string &ip, bool immediate_write=true) |
void | unban_group (std::ostringstream &os, const std::string &group) |
void | list_deleted_bans (std::ostringstream &out, const std::string &mask="*") const |
void | list_bans (std::ostringstream &out, const std::string &mask="*") |
std::string | is_ip_banned (const std::string &ip) |
const std::string & | get_ban_help () const |
void | load_config (const config &) |
Private Member Functions | |
bool | is_digit (const char &c) const |
std::size_t | to_digit (const char &c) const |
void | init_ban_help () |
void | check_ban_times (std::time_t time_now) |
void | expire_bans () |
Private Attributes | |
ban_set | bans_ |
deleted_ban_list | deleted_bans_ |
ban_time_queue | time_queue_ |
default_ban_times | ban_times_ |
std::string | ban_help_ |
std::string | filename_ |
bool | dirty_ |
wesnothd::ban_manager::ban_manager | ( | ) |
Definition at line 723 of file ban.cpp.
References init_ban_help().
wesnothd::ban_manager::~ban_manager | ( | ) |
Definition at line 714 of file ban.cpp.
References DBG_SERVER, utils::get_unknown_exception_type(), and wesnothd::banned::write().
std::string wesnothd::ban_manager::ban | ( | const std::string & | ip, |
const std::time_t & | end_time, | ||
const std::string & | reason, | ||
const std::string & | who_banned, | ||
const std::string & | group, | ||
const std::string & | nick = "" |
||
) |
Definition at line 495 of file ban.cpp.
References e, ERR_SERVER, game::error::message, and wesnothd::banned::write().
Referenced by wesnothd::server::authenticate(), wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), and wesnothd::server::kickban_handler().
|
private |
Definition at line 571 of file ban.cpp.
References DBG_SERVER, LOG_SERVER, and wesnothd::banned::write().
|
inlineprivate |
|
inline |
Definition at line 174 of file ban.hpp.
Referenced by wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), and wesnothd::server::kickban_handler().
|
private |
Definition at line 673 of file ban.cpp.
Referenced by ban_manager().
|
inlineprivate |
std::string wesnothd::ban_manager::is_ip_banned | ( | const std::string & | ip | ) |
Definition at line 657 of file ban.cpp.
References p, and wesnothd::parse_ip().
Referenced by wesnothd::server::is_ip_banned().
void wesnothd::ban_manager::list_bans | ( | std::ostringstream & | out, |
const std::string & | mask = "*" |
||
) |
Definition at line 617 of file ban.cpp.
References b, e, game::error::message, and wesnothd::parse_ip().
Referenced by wesnothd::server::bans_handler().
void wesnothd::ban_manager::list_deleted_bans | ( | std::ostringstream & | out, |
const std::string & | mask = "*" |
||
) | const |
Definition at line 594 of file ban.cpp.
References e, i, game::error::message, and wesnothd::parse_ip().
Referenced by wesnothd::server::bans_handler().
void wesnothd::ban_manager::load_config | ( | const config & | cfg | ) |
Definition at line 697 of file ban.cpp.
References config::child_range(), and filename_.
Referenced by wesnothd::server::load_config().
bool wesnothd::ban_manager::parse_time | ( | const std::string & | duration, |
std::time_t * | time | ||
) | const |
Parses the given duration and adds it to *time except if the duration is '0' or 'permanent' in which case *time will be set to '0'.
Definition at line 333 of file ban.cpp.
References e, ERR_SERVER, i, LOG_SERVER, and utf8::lowercase().
Referenced by wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), and wesnothd::server::kickban_handler().
void wesnothd::ban_manager::read | ( | ) |
Definition at line 270 of file ban.cpp.
References b, config::child(), config::child_range(), e, ERR_SERVER, filesystem::file_exists(), filename_, filesystem::istream_file(), LOG_SERVER, game::error::message, and read_gz().
Referenced by wesnothd::server::server().
|
inlineprivate |
void wesnothd::ban_manager::unban | ( | std::ostringstream & | os, |
const std::string & | ip, | ||
bool | immediate_write = true |
||
) |
Definition at line 532 of file ban.cpp.
References e, ERR_SERVER, game::error::message, and wesnothd::banned::write().
Referenced by wesnothd::server::unban_handler().
void wesnothd::ban_manager::unban_group | ( | std::ostringstream & | os, |
const std::string & | group | ||
) |
Definition at line 559 of file ban.cpp.
References p, and wesnothd::banned::write().
Referenced by wesnothd::server::ungban_handler().
void wesnothd::ban_manager::write | ( | ) |
Definition at line 307 of file ban.cpp.
References config::add_child(), b, filename_, LOG_SERVER, filesystem::ostream_file(), and config_writer::write().
|
private |
|
private |
|
private |