The Battle for Wesnoth  1.15.0-dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
wesnothd::ban_manager Class Reference

#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_
 

Detailed Description

Definition at line 121 of file ban.hpp.

Constructor & Destructor Documentation

◆ ban_manager()

wesnothd::ban_manager::ban_manager ( )

Definition at line 727 of file ban.cpp.

References init_ban_help().

◆ ~ban_manager()

wesnothd::ban_manager::~ban_manager ( )

Definition at line 720 of file ban.cpp.

References wesnothd::banned::write().

Member Function Documentation

◆ ban()

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 = "" 
)

◆ check_ban_times()

void wesnothd::ban_manager::check_ban_times ( std::time_t  time_now)
private

Definition at line 565 of file ban.cpp.

References DBG_SERVER, LOG_SERVER, and wesnothd::banned::write().

◆ expire_bans()

void wesnothd::ban_manager::expire_bans ( )
inlineprivate

Definition at line 139 of file ban.hpp.

References read(), and write().

◆ get_ban_help()

const std::string& wesnothd::ban_manager::get_ban_help ( ) const
inline

◆ init_ban_help()

void wesnothd::ban_manager::init_ban_help ( )
private

Definition at line 676 of file ban.cpp.

Referenced by ban_manager().

◆ is_digit()

bool wesnothd::ban_manager::is_digit ( const char &  c) const
inlineprivate

Definition at line 132 of file ban.hpp.

◆ is_ip_banned()

std::string wesnothd::ban_manager::is_ip_banned ( const std::string &  ip)

Definition at line 661 of file ban.cpp.

References p, and wesnothd::parse_ip().

Referenced by wesnothd::server::is_ip_banned().

◆ list_bans()

void wesnothd::ban_manager::list_bans ( std::ostringstream &  out,
const std::string &  mask = "*" 
)

Definition at line 617 of file ban.cpp.

References e, i, game::error::message, and wesnothd::parse_ip().

Referenced by wesnothd::server::bans_handler().

◆ list_deleted_bans()

void wesnothd::ban_manager::list_deleted_bans ( std::ostringstream &  out,
const std::string &  mask = "*" 
) const

Definition at line 589 of file ban.cpp.

References e, i, game::error::message, and wesnothd::parse_ip().

Referenced by wesnothd::server::bans_handler().

◆ load_config()

void wesnothd::ban_manager::load_config ( const config cfg)

Definition at line 703 of file ban.cpp.

References config::child_range(), and filename_.

Referenced by wesnothd::server::load_config().

◆ parse_time()

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'.

Returns
false if an invalid time modifier is encountered. *time is undefined in that case.

Definition at line 327 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().

◆ read()

void wesnothd::ban_manager::read ( )

◆ to_digit()

std::size_t wesnothd::ban_manager::to_digit ( const char &  c) const
inlineprivate

Definition at line 134 of file ban.hpp.

◆ unban()

void wesnothd::ban_manager::unban ( std::ostringstream &  os,
const std::string &  ip,
bool  immediate_write = true 
)

◆ unban_group()

void wesnothd::ban_manager::unban_group ( std::ostringstream &  os,
const std::string &  group 
)

Definition at line 553 of file ban.cpp.

References p, and wesnothd::banned::write().

Referenced by wesnothd::server::ungban_handler().

◆ write()

void wesnothd::ban_manager::write ( )

Member Data Documentation

◆ ban_help_

std::string wesnothd::ban_manager::ban_help_
private

Definition at line 128 of file ban.hpp.

◆ ban_times_

default_ban_times wesnothd::ban_manager::ban_times_
private

Definition at line 127 of file ban.hpp.

◆ bans_

ban_set wesnothd::ban_manager::bans_
private

Definition at line 124 of file ban.hpp.

◆ deleted_bans_

deleted_ban_list wesnothd::ban_manager::deleted_bans_
private

Definition at line 125 of file ban.hpp.

◆ dirty_

bool wesnothd::ban_manager::dirty_
private

Definition at line 130 of file ban.hpp.

◆ filename_

std::string wesnothd::ban_manager::filename_
private

Definition at line 129 of file ban.hpp.

◆ time_queue_

ban_time_queue wesnothd::ban_manager::time_queue_
private

Definition at line 126 of file ban.hpp.


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