#include <ban.hpp>
Public Member Functions | |
ban_manager () | |
~ban_manager () | |
void | read () |
void | write () |
bool | parse_time (const std::string &duration, 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 time_t &, const std::string &, const std::string &, const std::string &, const std::string &="") |
void | unban (std::ostringstream &os, const std::string &ip) |
void | unban_group (std::ostringstream &os, const std::string &group) |
void | check_ban_times (time_t time_now) |
void | list_deleted_bans (std::ostringstream &out, const std::string &mask="*") const |
void | list_bans (std::ostringstream &out, const std::string &mask="*") const |
std::string | is_ip_banned (const std::string &ip) const |
const std::string & | get_ban_help () const |
void | load_config (const config &) |
Private Member Functions | |
bool | is_digit (const char &c) const |
size_t | to_digit (const char &c) const |
void | init_ban_help () |
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 720 of file ban.cpp.
References init_ban_help().
std::string wesnothd::ban_manager::ban | ( | const std::string & | ip, |
const time_t & | end_time, | ||
const std::string & | reason, | ||
const std::string & | who_banned, | ||
const std::string & | group, | ||
const std::string & | nick = "" |
||
) |
Definition at line 490 of file ban.cpp.
References bans_, wesnothd::banned::create_dummy(), dirty_, e, ERR_SERVER, game::error::message, and time_queue_.
Referenced by wesnothd::server::ban_handler(), check_ban_times(), wesnothd::server::gban_handler(), wesnothd::server::handle_login(), is_ip_banned(), wesnothd::server::kickban_handler(), and unban().
void wesnothd::ban_manager::check_ban_times | ( | time_t | time_now | ) |
Definition at line 560 of file ban.cpp.
References ban(), DBG_SERVER, LOG_SERVER, time_queue_, unban(), and write().
|
inline |
Definition at line 167 of file ban.hpp.
References ban_help_.
Referenced by wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), and wesnothd::server::kickban_handler().
|
private |
Definition at line 669 of file ban.cpp.
References ban_help_, ban_times_, and itor.
Referenced by ban_manager(), and load_config().
|
inlineprivate |
Definition at line 134 of file ban.hpp.
Referenced by parse_time().
std::string wesnothd::ban_manager::is_ip_banned | ( | const std::string & | ip | ) | const |
Definition at line 655 of file ban.cpp.
References ban(), bans_, cursor::get(), wesnothd::banned::match_ip(), and wesnothd::parse_ip().
Referenced by wesnothd::server::is_ip_banned().
void wesnothd::ban_manager::list_bans | ( | std::ostringstream & | out, |
const std::string & | mask = "*" |
||
) | const |
Definition at line 612 of file ban.cpp.
References bans_, e, i, 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 584 of file ban.cpp.
References deleted_bans_, e, i, game::error::message, and wesnothd::parse_ip().
Referenced by wesnothd::server::bans_handler().
Definition at line 696 of file ban.cpp.
References ban_times_, config::child_range(), dirty_, filename_, init_ban_help(), and parse_time().
Referenced by wesnothd::server::load_config().
bool wesnothd::ban_manager::parse_time | ( | const std::string & | duration, |
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 326 of file ban.cpp.
References ban_times_, e, ERR_SERVER, i, is_digit(), LOG_SERVER, utf8::lowercase(), schema_validation::number, and to_digit().
Referenced by wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), wesnothd::server::kickban_handler(), and load_config().
void wesnothd::ban_manager::read | ( | ) |
Definition at line 261 of file ban.cpp.
References bans_, config::child(), config::child_range(), deleted_bans_, e, ERR_SERVER, filesystem::file_exists(), filename_, filesystem::istream_file(), LOG_SERVER, game::error::message, read_gz(), and time_queue_.
Referenced by wesnothd::server::server().
|
inlineprivate |
Definition at line 136 of file ban.hpp.
Referenced by parse_time().
void wesnothd::ban_manager::unban | ( | std::ostringstream & | os, |
const std::string & | ip | ||
) |
Definition at line 524 of file ban.cpp.
References ban(), bans_, wesnothd::banned::create_dummy(), deleted_bans_, dirty_, e, ERR_SERVER, and game::error::message.
Referenced by check_ban_times(), and wesnothd::server::unban_handler().
void wesnothd::ban_manager::unban_group | ( | std::ostringstream & | os, |
const std::string & | group | ||
) |
Definition at line 549 of file ban.cpp.
References bans_, dirty_, cursor::get(), and wesnothd::banned::match_group().
Referenced by wesnothd::server::ungban_handler().
void wesnothd::ban_manager::write | ( | ) |
Definition at line 300 of file ban.cpp.
References config::add_child(), bans_, deleted_bans_, dirty_, filename_, itor, LOG_SERVER, filesystem::ostream_file(), config_writer::write(), and writer().
Referenced by check_ban_times(), and ~ban_manager().
|
private |
Definition at line 130 of file ban.hpp.
Referenced by get_ban_help(), and init_ban_help().
|
private |
Definition at line 129 of file ban.hpp.
Referenced by init_ban_help(), load_config(), and parse_time().
|
private |
Definition at line 126 of file ban.hpp.
Referenced by ban(), is_ip_banned(), list_bans(), read(), unban(), unban_group(), and write().
|
private |
|
private |
Definition at line 132 of file ban.hpp.
Referenced by ban(), load_config(), unban(), unban_group(), and write().
|
private |
Definition at line 131 of file ban.hpp.
Referenced by load_config(), read(), and write().
|
private |
Definition at line 128 of file ban.hpp.
Referenced by ban(), check_ban_times(), and read().