The Battle for Wesnoth  1.17.0-dev
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
wesnothd::server Class Reference

#include <server.hpp>

Inheritance diagram for wesnothd::server:

Classes

struct  connection_log
 
struct  login_log
 

Public Member Functions

 server (int port, bool keep_alive, const std::string &config_file, std::size_t, std::size_t)
 
template<class SocketPtr >
void send_server_message (SocketPtr socket, const std::string &message, const std::string &type)
 
void send_server_message (player_iterator player, const std::string &message, const std::string &type)
 
void send_to_lobby (simple_wml::document &data, std::optional< player_iterator > exclude={})
 
void send_to_player (player_iterator player, simple_wml::document &data)
 
void send_server_message_to_lobby (const std::string &message, std::optional< player_iterator > exclude={})
 
void send_server_message_to_all (const std::string &message, std::optional< player_iterator > exclude={})
 
bool player_is_in_game (player_iterator player) const
 
- Public Member Functions inherited from server_base
 server_base (unsigned short port, bool keep_alive)
 
virtual ~server_base ()
 
void run ()
 
template<class SocketPtr >
void coro_send_doc (SocketPtr socket, simple_wml::document &doc, boost::asio::yield_context yield)
 Send a WML document from within a coroutine. More...
 
void coro_send_file (socket_ptr socket, const std::string &filename, boost::asio::yield_context yield)
 Send contents of entire file directly to socket from within a coroutine. More...
 
void coro_send_file (tls_socket_ptr socket, const std::string &filename, boost::asio::yield_context yield)
 
template<class SocketPtr >
std::unique_ptr< simple_wml::documentcoro_receive_doc (SocketPtr socket, boost::asio::yield_context yield)
 Receive WML document from a coroutine. More...
 
template<class SocketPtr >
void async_send_doc_queued (SocketPtr socket, simple_wml::document &doc)
 High level wrapper for sending a WML document. More...
 
template<class SocketPtr >
void async_send_error (SocketPtr socket, const std::string &msg, const char *error_code="", const info_table &info={})
 
template<class SocketPtr >
void async_send_warning (SocketPtr socket, const std::string &msg, const char *warning_code="", const info_table &info={})
 
std::string create_unsecure_nonce (int length=8)
 Create the poor security nonce for use with passwords still hashed with MD5. More...
 
std::string create_secure_nonce ()
 Create a good security nonce for use with bcrypt/crypt_blowfish hashing. More...
 
std::string hash_password (const std::string &pw, const std::string &salt, const std::string &username)
 Handles hashing the password provided by the player before comparing it to the hashed password in the forum database. More...
 

Private Types

typedef std::function< void(const std::string &, const std::string &, std::string &, std::ostringstream *)> cmd_handler
 

Private Member Functions

void handle_new_client (socket_ptr socket)
 
void handle_new_client (tls_socket_ptr socket)
 
template<class SocketPtr >
void login_client (boost::asio::yield_context yield, SocketPtr socket)
 
template<class SocketPtr >
bool is_login_allowed (SocketPtr socket, const simple_wml::node *const login, const std::string &username, bool &registered, bool &is_moderator)
 
template<class SocketPtr >
bool authenticate (SocketPtr socket, const std::string &username, const std::string &password, bool name_taken, bool &registered)
 
template<class SocketPtr >
void send_password_request (SocketPtr socket, const std::string &msg, const char *error_code="", bool force_confirmation=false)
 
bool accepting_connections () const
 
template<class SocketPtr >
void handle_player (boost::asio::yield_context yield, SocketPtr socket, const player &player)
 
void handle_player_in_lobby (player_iterator player, simple_wml::document &doc)
 
void handle_player_in_game (player_iterator player, simple_wml::document &doc)
 
void handle_whisper (player_iterator player, simple_wml::node &whisper)
 
void handle_query (player_iterator player, simple_wml::node &query)
 
void handle_nickserv (player_iterator player, simple_wml::node &nickserv)
 
void handle_message (player_iterator player, simple_wml::node &message)
 
void handle_create_game (player_iterator player, simple_wml::node &create_game)
 
void cleanup_game (game *)
 
void handle_join_game (player_iterator player, simple_wml::node &join)
 
void disconnect_player (player_iterator player)
 
void remove_player (player_iterator player)
 
std::deque< std::shared_ptr< game > > games () const
 
config read_config () const
 Read the server config from file 'config_file_'. More...
 
void load_config ()
 Parse the server config into local variables. More...
 
bool ip_exceeds_connection_limit (const std::string &ip) const
 
std::string is_ip_banned (const std::string &ip)
 
void start_dump_stats ()
 
void dump_stats (const boost::system::error_code &ec)
 
void start_tournaments_timer ()
 
void refresh_tournaments (const boost::system::error_code &ec)
 
std::string process_command (std::string cmd, std::string issuer_name)
 Process commands from admins and users. More...
 
void delete_game (int, const std::string &reason="")
 
void update_game_in_lobby (const game &g, std::optional< player_iterator > exclude={})
 
void start_new_server ()
 
void setup_fifo ()
 
void handle_read_from_fifo (const boost::system::error_code &error, std::size_t bytes_transferred)
 
void setup_handlers ()
 
void shut_down_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void restart_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void sample_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void help_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void stats_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void metrics_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void requests_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void roll_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void games_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void wml_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void adminmsg_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void pm_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void version_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void msg_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void lobbymsg_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void status_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void clones_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void bans_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void ban_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void unban_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void ungban_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void kick_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void kickban_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void gban_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void motd_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void searchlog_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void dul_handler (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void stopgame (const std::string &, const std::string &, std::string &, std::ostringstream *)
 
void handle_sighup (const boost::system::error_code &error, int signal_number)
 
void handle_graceful_timeout (const boost::system::error_code &error)
 
void start_lan_server_timer ()
 
void abort_lan_server_timer ()
 
void handle_lan_server_shutdown (const boost::system::error_code &error)
 
void start_dummy_player_updates ()
 
void dummy_player_updates (const boost::system::error_code &ec)
 

Private Attributes

wesnothd::ban_manager ban_manager_
 
std::deque< connection_logip_log_
 
std::deque< login_logfailed_logins_
 
std::unique_ptr< user_handleruser_handler_
 
std::mt19937 die_
 
player_connections player_connections_
 
std::string input_path_
 server socket/fifo. More...
 
std::string uuid_
 
const std::string config_file_
 
config cfg_
 
std::vector< std::string > accepted_versions_
 
std::string recommended_version_
 
std::map< std::string, configredirected_versions_
 
std::map< std::string, configproxy_versions_
 
std::vector< std::string > disallowed_names_
 
std::string admin_passwd_
 
std::string motd_
 
std::string announcements_
 
std::string server_id_
 
std::string tournaments_
 
std::string information_
 
std::size_t default_max_messages_
 
std::size_t default_time_period_
 
std::size_t concurrent_connections_
 
bool graceful_restart
 
std::time_t lan_server_
 
std::time_t last_user_seen_time_
 
std::string restart_command
 
std::size_t max_ip_log_size_
 
bool deny_unregistered_login_
 
bool save_replays_
 
std::string replay_save_path_
 
bool allow_remote_shutdown_
 
std::set< std::string > client_sources_
 
std::vector< std::string > tor_ip_list_
 
int failed_login_limit_
 
std::time_t failed_login_ban_
 
std::deque< login_log >::size_type failed_login_buffer_size_
 
simple_wml::document version_query_response_
 
simple_wml::document login_response_
 
simple_wml::document games_and_users_list_
 
metrics metrics_
 
boost::asio::steady_timer dump_stats_timer_
 
boost::asio::steady_timer tournaments_timer_
 
std::map< std::string, cmd_handlercmd_handlers_
 
boost::asio::steady_timer timer_
 
boost::asio::steady_timer lan_server_timer_
 
boost::asio::steady_timer dummy_player_timer_
 
int dummy_player_timer_interval_
 

Additional Inherited Members

- Public Types inherited from server_base
typedef std::map< std::string, std::string > info_table
 
- Protected Member Functions inherited from server_base
void load_tls_config (const config &cfg)
 
void start_server ()
 
void serve (boost::asio::yield_context yield, boost::asio::ip::tcp::acceptor &acceptor, boost::asio::ip::tcp::endpoint endpoint)
 
void read_from_fifo ()
 
void handle_termination (const boost::system::error_code &error, int signal_number)
 
- Protected Attributes inherited from server_base
unsigned short port_
 
bool keep_alive_
 
boost::asio::io_service io_service_
 
boost::asio::ssl::context tls_context_ { boost::asio::ssl::context::sslv23 }
 
bool tls_enabled_ { false }
 
boost::asio::ip::tcp::acceptor acceptor_v6_
 
boost::asio::ip::tcp::acceptor acceptor_v4_
 
uint32_t handshake_response_
 
boost::asio::posix::stream_descriptor input_
 
std::string fifo_path_
 
boost::asio::streambuf admin_cmd_
 
boost::asio::signal_set sighup_
 
boost::asio::signal_set sigs_
 

Detailed Description

Definition at line 35 of file server.hpp.

Member Typedef Documentation

◆ cmd_handler

typedef std::function<void(const std::string&, const std::string&, std::string&, std::ostringstream *)> wesnothd::server::cmd_handler
private

Definition at line 218 of file server.hpp.

Constructor & Destructor Documentation

◆ server()

wesnothd::server::server ( int  port,
bool  keep_alive,
const std::string &  config_file,
std::size_t  ,
std::size_t   
)

Member Function Documentation

◆ abort_lan_server_timer()

void wesnothd::server::abort_lan_server_timer ( )
private

Definition at line 309 of file server.cpp.

References lan_server_timer_.

Referenced by handle_player().

◆ accepting_connections()

bool wesnothd::server::accepting_connections ( ) const
inlineprivatevirtual

◆ adminmsg_handler()

void wesnothd::server::adminmsg_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ authenticate()

template<class SocketPtr >
bool wesnothd::server::authenticate ( SocketPtr  socket,
const std::string &  username,
const std::string &  password,
bool  name_taken,
bool &  registered 
)
private

◆ ban_handler()

void wesnothd::server::ban_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ bans_handler()

void wesnothd::server::bans_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ cleanup_game()

void wesnothd::server::cleanup_game ( game game_ptr)
private

◆ clones_handler()

void wesnothd::server::clones_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2446 of file server.cpp.

References next, player_connections_, and wesnothd::player_status().

Referenced by setup_handlers().

◆ delete_game()

void wesnothd::server::delete_game ( int  gameid,
const std::string &  reason = "" 
)
private

◆ disconnect_player()

void wesnothd::server::disconnect_player ( player_iterator  player)
private

Definition at line 1910 of file server.cpp.

References utils::decayed_is_same.

Referenced by accepting_connections(), kick_handler(), and kickban_handler().

◆ dul_handler()

void wesnothd::server::dul_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2864 of file server.cpp.

References deny_unregistered_login_, e, ERR_SERVER, and utf8::lowercase().

Referenced by setup_handlers().

◆ dummy_player_updates()

void wesnothd::server::dummy_player_updates ( const boost::system::error_code &  ec)
private

◆ dump_stats()

void wesnothd::server::dump_stats ( const boost::system::error_code &  ec)
private

Definition at line 598 of file server.cpp.

References ERR_SERVER, games(), LOG_SERVER, player_connections_, and start_dump_stats().

Referenced by start_dump_stats().

◆ games()

std::deque<std::shared_ptr<game> > wesnothd::server::games ( ) const
inlineprivate

Definition at line 123 of file server.hpp.

Referenced by cleanup_game(), dump_stats(), handle_graceful_timeout(), and stats_handler().

◆ games_handler()

void wesnothd::server::games_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2233 of file server.cpp.

References metrics::games(), and metrics_.

Referenced by setup_handlers().

◆ gban_handler()

void wesnothd::server::gban_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ handle_create_game()

void wesnothd::server::handle_create_game ( player_iterator  player,
simple_wml::node create_game 
)
private

◆ handle_graceful_timeout()

void wesnothd::server::handle_graceful_timeout ( const boost::system::error_code &  error)
private

Definition at line 290 of file server.cpp.

References games(), process_command(), and timer_.

Referenced by restart_handler(), and shut_down_handler().

◆ handle_join_game()

void wesnothd::server::handle_join_game ( player_iterator  player,
simple_wml::node join 
)
private

◆ handle_lan_server_shutdown()

void wesnothd::server::handle_lan_server_shutdown ( const boost::system::error_code &  error)
private

Definition at line 314 of file server.cpp.

Referenced by start_lan_server_timer().

◆ handle_message()

void wesnothd::server::handle_message ( player_iterator  player,
simple_wml::node message 
)
private

◆ handle_new_client() [1/2]

void wesnothd::server::handle_new_client ( socket_ptr  socket)
privatevirtual

Implements server_base.

Definition at line 671 of file server.cpp.

References server_base::io_service_, and login_client().

◆ handle_new_client() [2/2]

void wesnothd::server::handle_new_client ( tls_socket_ptr  socket)
privatevirtual

Implements server_base.

Definition at line 676 of file server.cpp.

References server_base::io_service_, and login_client().

◆ handle_nickserv()

void wesnothd::server::handle_nickserv ( player_iterator  player,
simple_wml::node nickserv 
)
private

◆ handle_player()

template<class SocketPtr >
void wesnothd::server::handle_player ( boost::asio::yield_context  yield,
SocketPtr  socket,
const player player 
)
private

◆ handle_player_in_game()

void wesnothd::server::handle_player_in_game ( player_iterator  player,
simple_wml::document doc 
)
private
Todo:
FIXME: Why not save the level data in the history_?

&& cfg_change->child("side")

Definition at line 1467 of file server.cpp.

References simple_wml::node::add_child(), simple_wml::node::apply_diff(), simple_wml::node::attr(), wesnothd::game::ban_user(), simple_wml::node::child(), simple_wml::document::child(), simple_wml::node::children(), simple_wml::document::children(), simple_wml::document::clear(), client_sources_, wesnothd::player::config_address(), simple_wml::node::copy_into(), wesnothd::game::db_id(), DBG_SERVER, delete_game(), wesnothd::game::describe_slots(), wesnothd::game::description(), e, wesnothd::player_record::enter_lobby(), ERR_SERVER, g, games_and_users_list_, wesnothd::game::get_replay_filename(), wesnothd::game::get_sides_list(), wesnothd::game::handle_choice(), simple_wml::node::has_attr(), wesnothd::game::has_password(), wesnothd::game::id(), lg::info(), simple_wml::INIT_COMPRESSED, server_base::io_service_, wesnothd::game::is_owner(), wesnothd::game::is_player(), wesnothd::game::is_reload(), wesnothd::game::kick_member(), wesnothd::game::level(), wesnothd::game::level_init(), wesnothd::game::load_next_scenario(), LOG_SERVER, wesnothd::make_add_diff(), wesnothd::make_change_diff(), wesnothd::game::mute_all_observers(), wesnothd::game::mute_observer(), wesnothd::player::name(), wesnothd::game::name(), wesnothd::game::new_scenario(), wesnothd::game::next_db_id(), simple_wml::node_to_string(), simple_wml::document::output(), p, wesnothd::game::perform_controller_tweaks(), player_connections_, wesnothd::game::process_change_turns_wml(), wesnothd::game::process_message(), wesnothd::game::process_turn(), wesnothd::game::process_whiteboard(), wesnothd::game::remove_player(), wesnothd::game::reset_last_synced_context_id(), simple_wml::document::root(), s, wesnothd::game::save_replay(), wesnothd::game::send_and_record_server_message(), wesnothd::game::send_data(), send_server_message(), wesnothd::game::send_server_message(), send_to_lobby(), send_to_player(), server_id_, simple_wml::node::set_attr(), simple_wml::node::set_attr_dup(), wesnothd::game::set_description(), wesnothd::game::set_termination_reason(), wesnothd::player::source(), wesnothd::game::start_game(), wesnothd::game::starting_pos(), simple_wml::document::swap(), simple_wml::string_span::to_int(), wesnothd::game::transfer_side_control(), wesnothd::game::unban_user(), wesnothd::game::unmute_observer(), update_game_in_lobby(), wesnothd::game::update_side_data(), user_handler_, uuid_, wesnothd::player::version(), and WRN_SERVER.

Referenced by accepting_connections(), and handle_player().

◆ handle_player_in_lobby()

void wesnothd::server::handle_player_in_lobby ( player_iterator  player,
simple_wml::document doc 
)
private

◆ handle_query()

void wesnothd::server::handle_query ( player_iterator  player,
simple_wml::node query 
)
private

◆ handle_read_from_fifo()

void wesnothd::server::handle_read_from_fifo ( const boost::system::error_code &  error,
std::size_t  bytes_transferred 
)
privatevirtual

◆ handle_sighup()

void wesnothd::server::handle_sighup ( const boost::system::error_code &  error,
int  signal_number 
)
privatevirtual

Implements server_base.

Definition at line 277 of file server.cpp.

References cfg_, load_config(), read_config(), server_base::sighup_, and WRN_SERVER.

◆ handle_whisper()

void wesnothd::server::handle_whisper ( player_iterator  player,
simple_wml::node whisper 
)
private

◆ help_handler()

void wesnothd::server::help_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2152 of file server.cpp.

References wesnothd::help_msg.

Referenced by setup_handlers().

◆ ip_exceeds_connection_limit()

bool wesnothd::server::ip_exceeds_connection_limit ( const std::string &  ip) const
privatevirtual

Reimplemented from server_base.

Definition at line 565 of file server.cpp.

References concurrent_connections_, and player_connections_.

◆ is_ip_banned()

std::string wesnothd::server::is_ip_banned ( const std::string &  ip)
privatevirtual

Reimplemented from server_base.

Definition at line 581 of file server.cpp.

References ban_manager_, wesnothd::ban_manager::is_ip_banned(), and tor_ip_list_.

◆ is_login_allowed()

template<class SocketPtr >
bool wesnothd::server::is_login_allowed ( SocketPtr  socket,
const simple_wml::node *const  login,
const std::string &  username,
bool &  registered,
bool &  is_moderator 
)
private

◆ kick_handler()

void wesnothd::server::kick_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ kickban_handler()

void wesnothd::server::kickban_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ load_config()

void wesnothd::server::load_config ( )
private

◆ lobbymsg_handler()

void wesnothd::server::lobbymsg_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2362 of file server.cpp.

References LOG_SERVER, and send_server_message_to_lobby().

◆ login_client()

template<class SocketPtr >
void wesnothd::server::login_client ( boost::asio::yield_context  yield,
SocketPtr  socket 
)
private

◆ metrics_handler()

void wesnothd::server::metrics_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2172 of file server.cpp.

References metrics_.

Referenced by setup_handlers().

◆ motd_handler()

void wesnothd::server::motd_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2790 of file server.cpp.

References motd_.

Referenced by setup_handlers().

◆ msg_handler()

void wesnothd::server::msg_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2339 of file server.cpp.

References LOG_SERVER, and send_server_message_to_all().

Referenced by setup_handlers().

◆ player_is_in_game()

bool wesnothd::server::player_is_in_game ( player_iterator  player) const
inline

Definition at line 81 of file server.hpp.

Referenced by handle_player().

◆ pm_handler()

void wesnothd::server::pm_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ process_command()

std::string wesnothd::server::process_command ( std::string  cmd,
std::string  issuer_name 
)
private

◆ read_config()

config wesnothd::server::read_config ( ) const
private

Read the server config from file 'config_file_'.

Definition at line 411 of file server.cpp.

References config_file_, e, ERR_CONFIG, LOG_SERVER, game::error::message, preprocess_file(), and read().

Referenced by handle_sighup().

◆ refresh_tournaments()

void wesnothd::server::refresh_tournaments ( const boost::system::error_code &  ec)
private

Definition at line 659 of file server.cpp.

References ERR_SERVER, start_tournaments_timer(), tournaments_, and user_handler_.

Referenced by start_tournaments_timer().

◆ remove_player()

void wesnothd::server::remove_player ( player_iterator  player)
private

◆ requests_handler()

void wesnothd::server::requests_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2181 of file server.cpp.

References metrics_, and metrics::requests().

Referenced by setup_handlers().

◆ restart_handler()

void wesnothd::server::restart_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

◆ roll_handler()

void wesnothd::server::roll_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2190 of file server.cpp.

References die_, and player_connections_.

Referenced by setup_handlers().

◆ sample_handler()

void wesnothd::server::sample_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2131 of file server.cpp.

References wesnothd::denied_msg, and wesnothd::request_sample_frequency.

Referenced by setup_handlers().

◆ searchlog_handler()

void wesnothd::server::searchlog_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ send_password_request()

template<class SocketPtr >
void wesnothd::server::send_password_request ( SocketPtr  socket,
const std::string &  msg,
const char *  error_code = "",
bool  force_confirmation = false 
)
private

◆ send_server_message() [1/2]

template<class SocketPtr >
void wesnothd::server::send_server_message ( SocketPtr  socket,
const std::string &  message,
const std::string &  type 
)

◆ send_server_message() [2/2]

void wesnothd::server::send_server_message ( player_iterator  player,
const std::string &  message,
const std::string &  type 
)
inline

Definition at line 65 of file server.hpp.

References send_server_message(), and send_to_lobby().

◆ send_server_message_to_all()

void wesnothd::server::send_server_message_to_all ( const std::string &  message,
std::optional< player_iterator exclude = {} 
)

Definition at line 1985 of file server.cpp.

References player_connections_, and send_server_message().

Referenced by msg_handler(), and send_to_player().

◆ send_server_message_to_lobby()

void wesnothd::server::send_server_message_to_lobby ( const std::string &  message,
std::optional< player_iterator exclude = {} 
)

Definition at line 1975 of file server.cpp.

References p, player_connections_, and send_server_message().

Referenced by lobbymsg_handler(), and send_to_player().

◆ send_to_lobby()

void wesnothd::server::send_to_lobby ( simple_wml::document data,
std::optional< player_iterator exclude = {} 
)

◆ send_to_player()

void wesnothd::server::send_to_player ( player_iterator  player,
simple_wml::document data 
)
inline

◆ setup_fifo()

void wesnothd::server::setup_fifo ( )
private

Definition at line 322 of file server.cpp.

References ERR_SERVER, server_base::input_, input_path_, LOG_SERVER, and server_base::read_from_fifo().

Referenced by load_config().

◆ setup_handlers()

void wesnothd::server::setup_handlers ( )
private

◆ shut_down_handler()

void wesnothd::server::shut_down_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ start_dummy_player_updates()

void wesnothd::server::start_dummy_player_updates ( )
private

◆ start_dump_stats()

void wesnothd::server::start_dump_stats ( )
private

Definition at line 592 of file server.cpp.

References dump_stats(), and dump_stats_timer_.

Referenced by dump_stats(), and server().

◆ start_lan_server_timer()

void wesnothd::server::start_lan_server_timer ( )
private

Definition at line 303 of file server.cpp.

References handle_lan_server_shutdown(), lan_server_, and lan_server_timer_.

Referenced by remove_player().

◆ start_new_server()

void wesnothd::server::start_new_server ( )
private

Definition at line 1994 of file server.cpp.

References ERR_SERVER, LOG_SERVER, and restart_command.

Referenced by restart_handler().

◆ start_tournaments_timer()

void wesnothd::server::start_tournaments_timer ( )
private

Definition at line 653 of file server.cpp.

References refresh_tournaments(), and tournaments_timer_.

Referenced by refresh_tournaments(), and server().

◆ stats_handler()

void wesnothd::server::stats_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2161 of file server.cpp.

References games(), and player_connections_.

Referenced by setup_handlers().

◆ status_handler()

void wesnothd::server::status_handler ( const std::string &  issuer_name,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ stopgame()

void wesnothd::server::stopgame ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2885 of file server.cpp.

References delete_game(), g, wesnothd::player::name(), and player_connections_.

Referenced by setup_handlers().

◆ unban_handler()

void wesnothd::server::unban_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2709 of file server.cpp.

References ban_manager_, and wesnothd::ban_manager::unban().

Referenced by setup_handlers().

◆ ungban_handler()

void wesnothd::server::ungban_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

Definition at line 2724 of file server.cpp.

References ban_manager_, and wesnothd::ban_manager::unban_group().

Referenced by setup_handlers().

◆ update_game_in_lobby()

void wesnothd::server::update_game_in_lobby ( const game g,
std::optional< player_iterator exclude = {} 
)
private

◆ version_handler()

void wesnothd::server::version_handler ( const std::string &  ,
const std::string &  ,
std::string &  parameters,
std::ostringstream *  out 
)
private

◆ wml_handler()

void wesnothd::server::wml_handler ( const std::string &  ,
const std::string &  ,
std::string &  ,
std::ostringstream *  out 
)
private

Definition at line 2242 of file server.cpp.

References simple_wml::document::stats().

Referenced by setup_handlers().

Member Data Documentation

◆ accepted_versions_

std::vector<std::string> wesnothd::server::accepted_versions_
private

Definition at line 154 of file server.hpp.

Referenced by load_config(), and login_client().

◆ admin_passwd_

std::string wesnothd::server::admin_passwd_
private

Definition at line 159 of file server.hpp.

Referenced by handle_query(), and load_config().

◆ allow_remote_shutdown_

bool wesnothd::server::allow_remote_shutdown_
private

Definition at line 176 of file server.hpp.

Referenced by load_config(), restart_handler(), and shut_down_handler().

◆ announcements_

std::string wesnothd::server::announcements_
private

Definition at line 161 of file server.hpp.

Referenced by handle_player(), and load_config().

◆ ban_manager_

wesnothd::ban_manager wesnothd::server::ban_manager_
private

◆ cfg_

config wesnothd::server::cfg_
private

Definition at line 148 of file server.hpp.

Referenced by handle_sighup(), and load_config().

◆ client_sources_

std::set<std::string> wesnothd::server::client_sources_
private

Definition at line 177 of file server.hpp.

Referenced by handle_player_in_game(), and load_config().

◆ cmd_handlers_

std::map<std::string, cmd_handler> wesnothd::server::cmd_handlers_
private

Definition at line 219 of file server.hpp.

Referenced by process_command().

◆ concurrent_connections_

std::size_t wesnothd::server::concurrent_connections_
private

Definition at line 167 of file server.hpp.

Referenced by ip_exceeds_connection_limit(), and load_config().

◆ config_file_

const std::string wesnothd::server::config_file_
private

Definition at line 147 of file server.hpp.

Referenced by read_config().

◆ default_max_messages_

std::size_t wesnothd::server::default_max_messages_
private

Definition at line 165 of file server.hpp.

Referenced by load_config(), and login_client().

◆ default_time_period_

std::size_t wesnothd::server::default_time_period_
private

Definition at line 166 of file server.hpp.

Referenced by load_config(), and login_client().

◆ deny_unregistered_login_

bool wesnothd::server::deny_unregistered_login_
private

Definition at line 173 of file server.hpp.

Referenced by dul_handler(), is_login_allowed(), and load_config().

◆ die_

std::mt19937 wesnothd::server::die_
private

Definition at line 119 of file server.hpp.

Referenced by roll_handler().

◆ disallowed_names_

std::vector<std::string> wesnothd::server::disallowed_names_
private

Definition at line 158 of file server.hpp.

Referenced by is_login_allowed(), and load_config().

◆ dummy_player_timer_

boost::asio::steady_timer wesnothd::server::dummy_player_timer_
private

Definition at line 262 of file server.hpp.

Referenced by start_dummy_player_updates().

◆ dummy_player_timer_interval_

int wesnothd::server::dummy_player_timer_interval_
private

Definition at line 263 of file server.hpp.

Referenced by load_config(), and start_dummy_player_updates().

◆ dump_stats_timer_

boost::asio::steady_timer wesnothd::server::dump_stats_timer_
private

Definition at line 195 of file server.hpp.

Referenced by start_dump_stats().

◆ failed_login_ban_

std::time_t wesnothd::server::failed_login_ban_
private

Definition at line 180 of file server.hpp.

Referenced by authenticate(), and load_config().

◆ failed_login_buffer_size_

std::deque<login_log>::size_type wesnothd::server::failed_login_buffer_size_
private

Definition at line 181 of file server.hpp.

Referenced by authenticate(), and load_config().

◆ failed_login_limit_

int wesnothd::server::failed_login_limit_
private

Definition at line 179 of file server.hpp.

Referenced by authenticate(), and load_config().

◆ failed_logins_

std::deque<login_log> wesnothd::server::failed_logins_
private

Definition at line 115 of file server.hpp.

Referenced by authenticate().

◆ games_and_users_list_

simple_wml::document wesnothd::server::games_and_users_list_
private

◆ graceful_restart

bool wesnothd::server::graceful_restart
private

◆ information_

std::string wesnothd::server::information_
private

Definition at line 164 of file server.hpp.

Referenced by handle_player(), and load_config().

◆ input_path_

std::string wesnothd::server::input_path_
private

server socket/fifo.

Definition at line 142 of file server.hpp.

Referenced by load_config(), and setup_fifo().

◆ ip_log_

std::deque<connection_log> wesnothd::server::ip_log_
private

Definition at line 100 of file server.hpp.

Referenced by login_client(), remove_player(), and searchlog_handler().

◆ lan_server_

std::time_t wesnothd::server::lan_server_
private

Definition at line 169 of file server.hpp.

Referenced by handle_player(), load_config(), remove_player(), and start_lan_server_timer().

◆ lan_server_timer_

boost::asio::steady_timer wesnothd::server::lan_server_timer_
private

Definition at line 257 of file server.hpp.

Referenced by abort_lan_server_timer(), and start_lan_server_timer().

◆ last_user_seen_time_

std::time_t wesnothd::server::last_user_seen_time_
private

Definition at line 170 of file server.hpp.

◆ login_response_

simple_wml::document wesnothd::server::login_response_
private

Definition at line 190 of file server.hpp.

Referenced by login_client().

◆ max_ip_log_size_

std::size_t wesnothd::server::max_ip_log_size_
private

Definition at line 172 of file server.hpp.

Referenced by load_config(), and login_client().

◆ metrics_

metrics wesnothd::server::metrics_
private

Definition at line 193 of file server.hpp.

Referenced by cleanup_game(), games_handler(), metrics_handler(), and requests_handler().

◆ motd_

std::string wesnothd::server::motd_
private

Definition at line 160 of file server.hpp.

Referenced by handle_player(), load_config(), and motd_handler().

◆ player_connections_

player_connections wesnothd::server::player_connections_
private

◆ proxy_versions_

std::map<std::string,config> wesnothd::server::proxy_versions_
private

Definition at line 157 of file server.hpp.

Referenced by load_config().

◆ recommended_version_

std::string wesnothd::server::recommended_version_
private

Definition at line 155 of file server.hpp.

Referenced by handle_player(), and load_config().

◆ redirected_versions_

std::map<std::string,config> wesnothd::server::redirected_versions_
private

Definition at line 156 of file server.hpp.

Referenced by load_config(), and login_client().

◆ replay_save_path_

std::string wesnothd::server::replay_save_path_
private

Definition at line 175 of file server.hpp.

Referenced by handle_create_game(), and load_config().

◆ restart_command

std::string wesnothd::server::restart_command
private

Definition at line 171 of file server.hpp.

Referenced by load_config(), restart_handler(), and start_new_server().

◆ save_replays_

bool wesnothd::server::save_replays_
private

Definition at line 174 of file server.hpp.

Referenced by handle_create_game(), and load_config().

◆ server_id_

std::string wesnothd::server::server_id_
private

Definition at line 162 of file server.hpp.

Referenced by handle_player_in_game(), and load_config().

◆ timer_

boost::asio::steady_timer wesnothd::server::timer_
private

Definition at line 254 of file server.hpp.

Referenced by handle_graceful_timeout(), restart_handler(), and shut_down_handler().

◆ tor_ip_list_

std::vector<std::string> wesnothd::server::tor_ip_list_
private

Definition at line 178 of file server.hpp.

Referenced by is_ip_banned(), and load_config().

◆ tournaments_

std::string wesnothd::server::tournaments_
private

Definition at line 163 of file server.hpp.

Referenced by handle_player(), load_config(), and refresh_tournaments().

◆ tournaments_timer_

boost::asio::steady_timer wesnothd::server::tournaments_timer_
private

Definition at line 199 of file server.hpp.

Referenced by start_tournaments_timer().

◆ user_handler_

std::unique_ptr<user_handler> wesnothd::server::user_handler_
private

◆ uuid_

std::string wesnothd::server::uuid_
private

Definition at line 145 of file server.hpp.

Referenced by cleanup_game(), handle_player_in_game(), and load_config().

◆ version_query_response_

simple_wml::document wesnothd::server::version_query_response_
private

Definition at line 189 of file server.hpp.

Referenced by login_client().


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