The Battle for Wesnoth  1.15.12+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)
 
- Public Member Functions inherited from server_base
 server_base (unsigned short port, bool keep_alive)
 
virtual ~server_base ()
 
void run ()
 
void coro_send_doc (socket_ptr 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...
 
std::unique_ptr< simple_wml::documentcoro_receive_doc (socket_ptr socket, boost::asio::yield_context yield)
 Receive WML document from a coroutine. More...
 
void async_send_doc_queued (socket_ptr socket, simple_wml::document &doc)
 High level wrapper for sending a WML document. More...
 
void async_send_error (socket_ptr socket, const std::string &msg, const char *error_code="", const info_table &info={})
 
void async_send_warning (socket_ptr socket, const std::string &msg, const char *warning_code="", const info_table &info={})
 

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 login_client (boost::asio::yield_context yield, socket_ptr socket)
 
bool is_login_allowed (socket_ptr socket, const simple_wml::node *const login, const std::string &username, bool &registered, bool &is_moderator)
 
bool authenticate (socket_ptr socket, const std::string &username, const std::string &password, bool name_taken, bool &registered)
 
void send_password_request (socket_ptr socket, const std::string &msg, const std::string &user, const char *error_code="", bool force_confirmation=false)
 
bool accepting_connections () const
 
void handle_player (boost::asio::yield_context yield, socket_ptr 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)
 
void send_server_message (socket_ptr 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_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
 
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)
 

Private Attributes

wesnothd::ban_manager ban_manager_
 
std::deque< connection_logip_log_
 
std::deque< login_logfailed_logins_
 
std::unique_ptr< user_handleruser_handler_
 
std::map< socket_ptr::element_type *, std::string > seeds_
 
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_
 

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 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::ip::tcp::acceptor acceptor_v6_
 
boost::asio::ip::tcp::acceptor acceptor_v4_
 
union {
   uint32_t   connection_num
 
   char   buf [4]
 
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 34 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 207 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 305 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()

bool wesnothd::server::authenticate ( socket_ptr  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 2397 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 1867 of file server.cpp.

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 2815 of file server.cpp.

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

Referenced by setup_handlers().

◆ dump_stats()

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

Definition at line 578 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 112 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 2184 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 286 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 310 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()

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

Implements server_base.

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

void wesnothd::server::handle_player ( boost::asio::yield_context  yield,
socket_ptr  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 1424 of file server.cpp.

References simple_wml::node::add_child(), simple_wml::node::apply_diff(), server_base::async_send_doc_queued(), 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(), 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 273 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 2103 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 541 of file server.cpp.

References client_address(), 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 557 of file server.cpp.

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

◆ is_login_allowed()

bool wesnothd::server::is_login_allowed ( socket_ptr  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 2313 of file server.cpp.

References LOG_SERVER, and send_server_message_to_lobby().

◆ login_client()

void wesnothd::server::login_client ( boost::asio::yield_context  yield,
socket_ptr  socket 
)
private

◆ metrics_handler()

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

Definition at line 2123 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 2741 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 2290 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
inlineprivate

Definition at line 70 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 407 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 600 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 2132 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 2141 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 2082 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()

void wesnothd::server::send_password_request ( socket_ptr  socket,
const std::string &  msg,
const std::string &  user,
const char *  error_code = "",
bool  force_confirmation = false 
)
private

◆ send_server_message() [1/2]

void wesnothd::server::send_server_message ( socket_ptr  socket,
const std::string &  message,
const std::string &  type 
)
private

◆ send_server_message() [2/2]

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

◆ send_server_message_to_all()

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

Definition at line 1936 of file server.cpp.

References player_connections_, and send_server_message().

Referenced by msg_handler(), and send_server_message().

◆ send_server_message_to_lobby()

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

Definition at line 1926 of file server.cpp.

References p, player_connections_, and send_server_message().

Referenced by lobbymsg_handler(), and send_server_message().

◆ send_to_lobby()

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

◆ setup_fifo()

void wesnothd::server::setup_fifo ( )
private

Definition at line 318 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_dump_stats()

void wesnothd::server::start_dump_stats ( )
private

Definition at line 568 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 299 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 1945 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 590 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 2112 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 2836 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 2660 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 2675 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 2193 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 143 of file server.hpp.

Referenced by load_config(), and login_client().

◆ admin_passwd_

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

Definition at line 148 of file server.hpp.

Referenced by handle_query(), and load_config().

◆ allow_remote_shutdown_

bool wesnothd::server::allow_remote_shutdown_
private

Definition at line 165 of file server.hpp.

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

◆ announcements_

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

Definition at line 150 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 137 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 166 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 208 of file server.hpp.

Referenced by process_command().

◆ concurrent_connections_

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

Definition at line 156 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 136 of file server.hpp.

Referenced by read_config().

◆ default_max_messages_

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

Definition at line 154 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 155 of file server.hpp.

Referenced by load_config(), and login_client().

◆ deny_unregistered_login_

bool wesnothd::server::deny_unregistered_login_
private

Definition at line 162 of file server.hpp.

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

◆ die_

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

Definition at line 108 of file server.hpp.

Referenced by roll_handler().

◆ disallowed_names_

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

Definition at line 147 of file server.hpp.

Referenced by is_login_allowed(), and load_config().

◆ dump_stats_timer_

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

Definition at line 184 of file server.hpp.

Referenced by start_dump_stats().

◆ failed_login_ban_

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

Definition at line 169 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 170 of file server.hpp.

Referenced by authenticate(), and load_config().

◆ failed_login_limit_

int wesnothd::server::failed_login_limit_
private

Definition at line 168 of file server.hpp.

Referenced by authenticate(), and load_config().

◆ failed_logins_

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

Definition at line 103 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 153 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 131 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 88 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 158 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 246 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 159 of file server.hpp.

◆ login_response_

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

Definition at line 179 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 161 of file server.hpp.

Referenced by load_config(), and login_client().

◆ metrics_

metrics wesnothd::server::metrics_
private

Definition at line 182 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 149 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 146 of file server.hpp.

Referenced by load_config().

◆ recommended_version_

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

Definition at line 144 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 145 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 164 of file server.hpp.

Referenced by handle_create_game(), and load_config().

◆ restart_command

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

Definition at line 160 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 163 of file server.hpp.

Referenced by handle_create_game(), and load_config().

◆ seeds_

std::map<socket_ptr::element_type*, std::string> wesnothd::server::seeds_
private

Definition at line 106 of file server.hpp.

Referenced by authenticate(), and send_password_request().

◆ server_id_

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

Definition at line 151 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 243 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 167 of file server.hpp.

Referenced by is_ip_banned(), and load_config().

◆ tournaments_

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

Definition at line 152 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 188 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 134 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 178 of file server.hpp.

Referenced by login_client().


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