Freeciv-3.2
|
#include <string.h>
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "rand.h"
#include "support.h"
#include "capstr.h"
#include "events.h"
#include "game.h"
#include "packets.h"
#include "player.h"
#include "version.h"
#include "aiiface.h"
#include "auth.h"
#include "diplhand.h"
#include "edithand.h"
#include "gamehand.h"
#include "maphand.h"
#include "meta.h"
#include "notify.h"
#include "plrhand.h"
#include "report.h"
#include "ruleset.h"
#include "sernet.h"
#include "settings.h"
#include "srv_main.h"
#include "stdinhand.h"
#include "voting.h"
#include "script_fcdb.h"
#include "connecthand.h"
Go to the source code of this file.
Set the access level of a connection, and re-send some needed info. If granted is TRUE, then it will overwrite the granted_access_level too. Else, it will affect only the current access level.
NB: This function does not send updated connection information to other clients, you need to do that yourself afterwards.
Definition at line 72 of file connecthand.c.
Referenced by api_auth_set_cmdlevel(), firstlevel_command(), handle_single_want_hack_req(), restore_access_level(), set_cmdlevel(), and start_game().
Setup pconn as a client connected to pplayer or observer.
Definition at line 793 of file connecthand.c.
Referenced by connection_delegate_restore(), connection_delegate_take(), load_command(), observe_command(), and take_command().
|
static |
Setup pconn as a client connected to pplayer or observer: Updates pconn->playing, pplayer->connections, pplayer->is_connected and pconn->observer.
Note take_command() needs to know if this function will success before it's time to call this. Keep take_command() checks in sync when modifying this.
Definition at line 645 of file connecthand.c.
Referenced by connection_attach(), and establish_new_connection().
void connection_close_server | ( | struct connection * | pconn, |
const char * | reason | ||
) |
Close a connection. Use this in the server to take care of delegation stuff (reset the username of the controlled connection).
Definition at line 1006 of file connecthand.c.
Referenced by auth_process_status(), cut_client_connection(), cut_lagging_connection(), flush_packets(), incoming_client_packets(), kick_command(), and server_sniff_all_input().
bool connection_delegate_restore | ( | struct connection * | pconn | ) |
Restore the original status of a delegate connection pconn after potentially using a delegation. pconn is detached from the delegated player, and reattached to its previous view (e.g. observer), if any. (Reattaching the original user to the delegated player is not handled here.)
Definition at line 945 of file connecthand.c.
Referenced by connection_close_server(), delegate_command(), and establish_new_connection().
bool connection_delegate_take | ( | struct connection * | pconn, |
struct player * | dplayer | ||
) |
Use a delegation to get control over another player.
Definition at line 884 of file connecthand.c.
Referenced by delegate_command().
void connection_detach | ( | struct connection * | pconn, |
bool | remove_unused_player | ||
) |
Remove pconn as a client connected to pplayer: Updates pconn->playing, pconn->playing->connections, pconn->playing->is_connected and pconn->observer.
pconn remains a member of game.est_connections.
If remove_unused_player is TRUE, may remove a player left with no controlling connection (only in pregame, and not if explicitly /created).
Definition at line 809 of file connecthand.c.
Referenced by connection_delegate_restore(), connection_delegate_take(), connection_detach(), detach_command(), handle_edit_player_remove(), load_command(), lost_connection_to_client(), observe_command(), server_remove_player(), and take_command().
void establish_new_connection | ( | struct connection * | pconn | ) |
This is used when a new player joins a server, before the game has started. If pconn is NULL, is an AI, else a client.
N.B. this only attaches a connection to a player if pconn->username == player->username
Here we send initial packets:
Definition at line 130 of file connecthand.c.
Referenced by auth_handle_reply(), auth_user(), and handle_login_request().
Search for first uncontrolled player
Definition at line 618 of file connecthand.c.
Referenced by connection_attach_real(), create_command_pregame(), and take_command().
bool handle_login_request | ( | struct connection * | pconn, |
struct packet_server_join_req * | req | ||
) |
Returns FALSE if the clients gets rejected and the connection should be closed. Returns TRUE if the client get accepted.
Definition at line 396 of file connecthand.c.
Referenced by server_packet_input().
void handle_sync_serial | ( | struct connection * | conn, |
int | serial | ||
) |
Handle client's request to sync via packet serial number.
Definition at line 1016 of file connecthand.c.
Referenced by server_handle_packet().
void lost_connection_to_client | ( | struct connection * | pconn | ) |
High-level server stuff when connection to client is closed or lost. Reports loss to log, and to other players if the connection was a player. Also removes player in pregame, applies auto_toggle, and does check for turn done (since can depend on connection/ai status). Note you shouldn't this function directly. You should use server_break_connection() if you want to close the connection.
Definition at line 530 of file connecthand.c.
Referenced by really_close_connections().
|
static |
Fill in packet_conn_info from full connection struct.
Definition at line 553 of file connecthand.c.
Referenced by send_conn_info_arg().
void reject_new_connection | ( | const char * | msg, |
struct connection * | pconn | ||
) |
send the rejection packet to the client.
Definition at line 375 of file connecthand.c.
Referenced by auth_handle_reply(), auth_process_status(), auth_user(), and handle_login_request().
|
static |
Restore access level for the given connection (user). Used when taking a player, observing, or detaching.
NB: This function does not send updated connection information to other clients, you need to do that yourself afterwards.
Definition at line 97 of file connecthand.c.
Referenced by connection_attach_real(), connection_detach(), and establish_new_connection().
Send conn_info packets to tell 'dest' connections all about 'src' connections.
Definition at line 601 of file connecthand.c.
Referenced by connection_attach_real(), connection_detach(), establish_new_connection(), and handle_single_want_hack_req().
|
static |
Handle both send_conn_info() and send_conn_info_removed(), depending on 'remove' arg. Sends conn_info packets for 'src' to 'dest', turning off 'used' if 'remove' is specified.
Definition at line 579 of file connecthand.c.
Referenced by send_conn_info(), and send_conn_info_remove().
Like send_conn_info(), but turn off the 'used' bits to tell clients to remove info about these connections instead of adding it.
Definition at line 610 of file connecthand.c.
Referenced by lost_connection_to_client().