58 bool observing,
bool connecting);
78 if (old_level != new_level) {
125 struct conn_list *dest = pconn->
self;
130 bool delegation_error =
FALSE;
164 _(
"Welcome to the %s Server running at %s port %d."),
168 _(
"Welcome to the %s Server at port %d."),
199 _(
"Your delegate %s was controlling your player '%s'; "
200 "now detached."), pdelegate->
username,
203 _(
"%s reconnected, ending your delegated control of "
208 log_error(
"Failed to revoke delegate %s's control of %s, so owner %s "
209 "can't regain control.", pdelegate->
username,
212 _(
"Couldn't get control of '%s' from delegation to %s."),
214 delegation_error =
TRUE;
219 if (!delegation_error) {
234 _(
"Couldn't attach your connection to new player."));
244 if (NULL == pplayer) {
252 _(
"You are logged in as '%s' connected to no player."),
256 _(
"You are logged in as '%s' connected to %s."),
271 _(
"%s has connected (player %s)."),
276 _(
"%s has connected from %s (player %s)."),
283 _(
"%s has connected."),
287 _(
"%s has connected from %s."),
292 if (aconn != pconn) {
302 && !cplayer->phase_done
303 && cplayer != pconn->
playing) {
305 _(
"Turn-blocking game play: "
306 "waiting on %s to finish turn..."),
314 _(
" *** Server is in edit mode. *** "));
317 if (NULL != pplayer) {
356 int kick_time_remaining;
364 log_normal(
_(
"Connection request from %s from %s"),
378 _(
"The client is missing a capability that this server needs.\n"
379 "Server version: %d.%d.%d%s Client version: %d.%d.%d%s."
380 " Upgrading may help!"),
381 MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION, VERSION_LABEL,
385 log_normal(
_(
"%s was rejected: Mismatched capabilities."),
393 _(
"The server is missing a capability that the client needs.\n"
394 "Server version: %d.%d.%d%s Client version: %d.%d.%d%s."
395 " Upgrading may help!"),
396 MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION, VERSION_LABEL,
400 log_normal(
_(
"%s was rejected: Mismatched capabilities."),
413#ifdef EMERGENCY_VERSION
428 log_normal(
_(
"%s was rejected: Invalid name [%s]."),
434 fc_snprintf(msg,
sizeof(msg),
_(
"You have been kicked from this server "
435 "and cannot reconnect for %d seconds."),
436 kick_time_remaining);
439 "(%d seconds remaining)."),
440 req->
username, kick_time_remaining);
447 fc_snprintf(msg,
sizeof(msg),
_(
"'%s' already connected."),
450 log_normal(
_(
"%s was rejected: Duplicate login name [%s]."),
458 "Ping timer list size %d, should be 1. Have we sent "
459 "a ping to unestablished connection %s?",
497 _(
"Lost connection: %s."), desc);
512 packet->
id = pconn->
id;
536 struct conn_list *dest,
bool remove_conn)
577 if (!played->is_connected && !played->was_created) {
603 bool observing,
bool connecting)
607 "connections must be detached with "
608 "connection_detach() before calling this!");
611 if (NULL == pplayer) {
615 if (NULL == pplayer) {
661 }
else if (pplayer == NULL) {
663 bool already =
FALSE;
668 if (pconn2 == pconn) {
681 if (aplayer != pplayer
684 aplayer->unassigned_user =
TRUE;
771 if (NULL != (pplayer = pconn->
playing)) {
787 if (!aconn->observer) {
795 if (remove_unused_player
823 log_verbose(
"connection_detach() calls send_player_info_c()");
871#ifndef FREECIV_NDEBUG
const char * default_ai_type_name(void)
bool auth_user(struct connection *pconn, char *username)
bool has_capabilities(const char *us, const char *them)
const char *const our_capability
static bool connection_attach_real(struct connection *pconn, struct player *pplayer, bool observing, bool connecting)
void send_conn_info(struct conn_list *src, struct conn_list *dest)
bool connection_attach(struct connection *pconn, struct player *pplayer, bool observing)
static void package_conn_info(struct connection *pconn, struct packet_conn_info *packet)
void reject_new_connection(const char *msg, struct connection *pconn)
static void send_conn_info_arg(struct conn_list *src, struct conn_list *dest, bool remove_conn)
bool connection_delegate_take(struct connection *pconn, struct player *dplayer)
bool handle_login_request(struct connection *pconn, struct packet_server_join_req *req)
struct player * find_uncontrolled_player(void)
static void restore_access_level(struct connection *pconn)
void lost_connection_to_client(struct connection *pconn)
void connection_close_server(struct connection *pconn, const char *reason)
void connection_detach(struct connection *pconn, bool remove_unused_player)
void conn_set_access(struct connection *pconn, enum cmdlevel new_level, bool granted)
bool connection_delegate_restore(struct connection *pconn)
void send_conn_info_remove(struct conn_list *src, struct conn_list *dest)
void establish_new_connection(struct connection *pconn)
struct player * conn_get_player(const struct connection *pconn)
bool can_conn_edit(const struct connection *pconn)
struct connection * conn_by_user(const char *user_name)
void flush_connection_send_buffer_all(struct connection *pc)
void conn_set_capability(struct connection *pconn, const char *capability)
void conn_reset_delta_state(struct connection *pc)
void connection_close(struct connection *pconn, const char *reason)
bool conn_controls_player(const struct connection *pconn)
const char * conn_description(const struct connection *pconn)
void conn_compression_freeze(struct connection *pconn)
enum cmdlevel conn_get_access(const struct connection *pconn)
bool conn_compression_thaw(struct connection *pconn)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
void send_diplomatic_meetings(struct connection *dest)
void edithand_send_initial_packets(struct conn_list *dest)
const struct ft_color ftc_player_lost
const struct ft_color ftc_server
const struct ft_color ftc_editor
const struct ft_color ftc_any
void send_scenario_description(struct conn_list *dest)
void send_scenario_info(struct conn_list *dest)
void send_game_info(struct conn_list *dest)
const char * new_challenge_filename(struct connection *pc)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
#define fc_assert_ret_val_msg(condition, val, message,...)
void send_pending_events(struct connection *pconn, bool include_public)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void package_event(struct packet_chat_msg *packet, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void event_cache_add_for_all(const struct packet_chat_msg *packet)
int dsend_packet_connect_msg(struct connection *pc, const char *message)
void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
int dsend_packet_start_phase(struct connection *pc, int phase)
int send_packet_server_join_reply(struct connection *pc, const struct packet_server_join_reply *packet)
bool is_valid_username(const char *name)
int player_slot_count(void)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
struct player * player_by_user(const char *name)
#define players_iterate_end
#define players_iterate(_pplayer)
#define set_as_human(plr)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
void server_player_set_name(struct player *pplayer, const char *name)
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
int normal_player_count(void)
struct player * player_by_user_delegated(const char *name)
void send_player_info_c(struct player *src, struct conn_list *dest)
void send_delegation_info(const struct connection *pconn)
void server_remove_player(struct player *pplayer)
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
const char * player_delegation_get(const struct player *pplayer)
void reset_all_start_commands(bool plrchange)
void report_final_scores(struct conn_list *dest)
void send_current_history_report(struct conn_list *dest)
void send_rulesets(struct conn_list *dest)
struct setting_list * level[OLEVELS_NUM]
void send_server_setting_control(struct connection *pconn)
void send_server_settings(struct conn_list *dest)
void send_server_access_level_settings(struct conn_list *dest, enum cmdlevel old_level, enum cmdlevel new_level)
void remove_leading_trailing_spaces(char *s)
const char * aifill(int amount)
bool game_was_started(void)
struct server_arguments srvarg
void check_for_full_turn_done(void)
void send_all_info(struct conn_list *dest)
enum server_states server_state(void)
void notify_if_first_access_level_is_available(void)
bool conn_is_kicked(struct connection *pconn, int *time_remaining)
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
struct civ_game::@30::@34 server
char connectmsg[MAX_LEN_MSG]
struct conn_list * glob_observers
struct conn_list * est_connections
struct packet_game_info info
struct conn_list * all_connections
struct connection::@57::@63::@64 delegation
enum cmdlevel access_level
struct timer_list * ping_timers
char username[MAX_LEN_NAME]
struct connection::@57::@63 server
char capability[MAX_LEN_CAPSTR]
char password[MAX_LEN_PASSWORD]
enum cmdlevel granted_access_level
char capability[MAX_LEN_CAPSTR]
char username[MAX_LEN_NAME]
enum cmdlevel access_level
char challenge_file[4095]
char username[MAX_LEN_NAME]
struct conn_list * connections
struct nation_type * nation
struct player::@69::@71 server
char orig_username[MAX_LEN_NAME]
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_gethostname(char *buf, size_t len)
int fc_strcasecmp(const char *str0, const char *str1)
#define sz_strlcpy(dest, src)
void team_remove_player(struct player *pplayer)
const char * freeciv_name_version(void)
void send_running_votes(struct connection *pconn, bool only_team_votes)
void send_remove_team_votes(struct connection *pconn)
void cancel_connection_votes(struct connection *pconn)
void send_updated_vote_totals(struct conn_list *dest)