Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
connection.h File Reference
#include <time.h>
#include "shared.h"
#include "support.h"
#include "timing.h"
#include "fc_types.h"
#include "conn_types.h"
#include "specenum_gen.h"
#include "speclist.h"
#include "specvec.h"

Go to the source code of this file.

Data Structures

struct  socket_packet_buffer
 
struct  packet_header
 
struct  connection
 

Macros

#define USE_COMPRESSION
 
#define SPECENUM_NAME   cmdlevel
 
#define SPECENUM_VALUE0   ALLOW_NONE
 
#define SPECENUM_VALUE0NAME   "none"
 
#define SPECENUM_VALUE1   ALLOW_INFO
 
#define SPECENUM_VALUE1NAME   "info"
 
#define SPECENUM_VALUE2   ALLOW_BASIC
 
#define SPECENUM_VALUE2NAME   "basic"
 
#define SPECENUM_VALUE3   ALLOW_CTRL
 
#define SPECENUM_VALUE3NAME   "ctrl"
 
#define SPECENUM_VALUE4   ALLOW_ADMIN
 
#define SPECENUM_VALUE4NAME   "admin"
 
#define SPECENUM_VALUE5   ALLOW_HACK
 
#define SPECENUM_VALUE5NAME   "hack"
 
#define SPECENUM_COUNT   CMDLEVEL_COUNT
 
#define SPECLIST_TAG   conn
 
#define SPECLIST_TYPE   struct connection
 
#define conn_list_iterate(connlist, pconn)    TYPED_LIST_ITERATE(struct connection, connlist, pconn)
 
#define conn_list_iterate_end   LIST_ITERATE_END
 
#define SPECVEC_TAG   byte
 
#define SPECVEC_TYPE   unsigned char
 
#define SPECLIST_TAG   conn_pattern
 
#define SPECLIST_TYPE   struct conn_pattern
 
#define conn_pattern_list_iterate(plist, ppatern)    TYPED_LIST_ITERATE(struct conn_pattern, plist, ppatern)
 
#define conn_pattern_list_iterate_end   LIST_ITERATE_END
 
#define SPECENUM_NAME   conn_pattern_type
 
#define SPECENUM_VALUE0   CPT_USER
 
#define SPECENUM_VALUE0NAME   "user"
 
#define SPECENUM_VALUE1   CPT_HOST
 
#define SPECENUM_VALUE1NAME   "host"
 
#define SPECENUM_VALUE2   CPT_IP
 
#define SPECENUM_VALUE2NAME   "ip"
 
#define conn_is_webclient(__pconn__)   ((__pconn__)->client_gui == GUI_WEB)
 

Typedefs

typedef void(* conn_close_fn_t) (struct connection *pconn)
 

Enumerations

enum  auth_status {
  AS_NOT_ESTABLISHED = 0 , AS_FAILED , AS_REQUESTING_NEW_PASS , AS_REQUESTING_OLD_PASS ,
  AS_ESTABLISHED
}
 

Functions

void connections_set_close_callback (conn_close_fn_t func)
 
void connection_close (struct connection *pconn, const char *reason)
 
int read_socket_data (int sock, struct socket_packet_buffer *buffer)
 
void flush_connection_send_buffer_all (struct connection *pc)
 
bool connection_send_data (struct connection *pconn, const unsigned char *data, int len)
 
void connection_do_buffer (struct connection *pc)
 
void connection_do_unbuffer (struct connection *pc)
 
void conn_list_do_buffer (struct conn_list *dest)
 
void conn_list_do_unbuffer (struct conn_list *dest)
 
struct connectionconn_by_user (const char *user_name)
 
struct connectionconn_by_user_prefix (const char *user_name, enum m_pre_result *result)
 
struct connectionconn_by_number (int id)
 
struct socket_packet_buffernew_socket_packet_buffer (void)
 
void connection_common_init (struct connection *pconn)
 
void connection_common_close (struct connection *pconn)
 
void conn_set_capability (struct connection *pconn, const char *capability)
 
void free_compression_queue (struct connection *pconn)
 
void conn_reset_delta_state (struct connection *pconn)
 
void conn_compression_freeze (struct connection *pconn)
 
bool conn_compression_thaw (struct connection *pconn)
 
bool conn_compression_frozen (const struct connection *pconn)
 
void conn_list_compression_freeze (const struct conn_list *pconn_list)
 
void conn_list_compression_thaw (const struct conn_list *pconn_list)
 
const charconn_description (const struct connection *pconn)
 
bool conn_controls_player (const struct connection *pconn)
 
bool conn_is_global_observer (const struct connection *pconn)
 
enum cmdlevel conn_get_access (const struct connection *pconn)
 
struct playerconn_get_player (const struct connection *pconn)
 
bool can_conn_edit (const struct connection *pconn)
 
bool can_conn_enable_editing (const struct connection *pconn)
 
int get_next_request_id (int old_request_id)
 
struct conn_patternconn_pattern_new (enum conn_pattern_type type, const char *wildcard)
 
void conn_pattern_destroy (struct conn_pattern *ppattern)
 
bool conn_pattern_match (const struct conn_pattern *ppattern, const struct connection *pconn)
 
bool conn_pattern_list_match (const struct conn_pattern_list *plist, const struct connection *pconn)
 
size_t conn_pattern_to_string (const struct conn_pattern *ppattern, char *buf, size_t buf_len)
 
struct conn_patternconn_pattern_from_string (const char *pattern, enum conn_pattern_type prefer, char *error_buf, size_t error_buf_len)
 
bool conn_is_valid (const struct connection *pconn)
 

Variables

const char blank_addr_str []
 

Macro Definition Documentation

◆ conn_is_webclient

#define conn_is_webclient (   __pconn__)    ((__pconn__)->client_gui == GUI_WEB)

Definition at line 367 of file connection.h.

◆ conn_list_iterate

#define conn_list_iterate (   connlist,
  pconn 
)     TYPED_LIST_ITERATE(struct connection, connlist, pconn)

Definition at line 108 of file connection.h.

◆ conn_list_iterate_end

#define conn_list_iterate_end   LIST_ITERATE_END

Definition at line 110 of file connection.h.

◆ conn_pattern_list_iterate

#define conn_pattern_list_iterate (   plist,
  ppatern 
)     TYPED_LIST_ITERATE(struct conn_pattern, plist, ppatern)

Definition at line 336 of file connection.h.

◆ conn_pattern_list_iterate_end

#define conn_pattern_list_iterate_end   LIST_ITERATE_END

Definition at line 338 of file connection.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   CMDLEVEL_COUNT

Definition at line 83 of file connection.h.

◆ SPECENUM_NAME [1/2]

Definition at line 63 of file connection.h.

◆ SPECENUM_NAME [2/2]

Definition at line 63 of file connection.h.

◆ SPECENUM_VALUE0 [1/2]

#define SPECENUM_VALUE0   ALLOW_NONE

Definition at line 65 of file connection.h.

◆ SPECENUM_VALUE0 [2/2]

#define SPECENUM_VALUE0   CPT_USER

Definition at line 65 of file connection.h.

◆ SPECENUM_VALUE0NAME [1/2]

#define SPECENUM_VALUE0NAME   "none"

Definition at line 66 of file connection.h.

◆ SPECENUM_VALUE0NAME [2/2]

#define SPECENUM_VALUE0NAME   "user"

Definition at line 66 of file connection.h.

◆ SPECENUM_VALUE1 [1/2]

#define SPECENUM_VALUE1   ALLOW_INFO

Definition at line 68 of file connection.h.

◆ SPECENUM_VALUE1 [2/2]

#define SPECENUM_VALUE1   CPT_HOST

Definition at line 68 of file connection.h.

◆ SPECENUM_VALUE1NAME [1/2]

#define SPECENUM_VALUE1NAME   "info"

Definition at line 69 of file connection.h.

◆ SPECENUM_VALUE1NAME [2/2]

#define SPECENUM_VALUE1NAME   "host"

Definition at line 69 of file connection.h.

◆ SPECENUM_VALUE2 [1/2]

#define SPECENUM_VALUE2   ALLOW_BASIC

Definition at line 71 of file connection.h.

◆ SPECENUM_VALUE2 [2/2]

#define SPECENUM_VALUE2   CPT_IP

Definition at line 71 of file connection.h.

◆ SPECENUM_VALUE2NAME [1/2]

#define SPECENUM_VALUE2NAME   "basic"

Definition at line 72 of file connection.h.

◆ SPECENUM_VALUE2NAME [2/2]

#define SPECENUM_VALUE2NAME   "ip"

Definition at line 72 of file connection.h.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   ALLOW_CTRL

Definition at line 75 of file connection.h.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   "ctrl"

Definition at line 76 of file connection.h.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   ALLOW_ADMIN

Definition at line 78 of file connection.h.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   "admin"

Definition at line 79 of file connection.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   ALLOW_HACK

Definition at line 81 of file connection.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "hack"

Definition at line 82 of file connection.h.

◆ SPECLIST_TAG [1/2]

#define SPECLIST_TAG   conn

Definition at line 104 of file connection.h.

◆ SPECLIST_TAG [2/2]

#define SPECLIST_TAG   conn_pattern

Definition at line 104 of file connection.h.

◆ SPECLIST_TYPE [1/2]

#define SPECLIST_TYPE   struct connection

Definition at line 105 of file connection.h.

◆ SPECLIST_TYPE [2/2]

#define SPECLIST_TYPE   struct conn_pattern

Definition at line 105 of file connection.h.

◆ SPECVEC_TAG

#define SPECVEC_TAG   byte

Definition at line 128 of file connection.h.

◆ SPECVEC_TYPE

#define SPECVEC_TYPE   unsigned char

Definition at line 129 of file connection.h.

◆ USE_COMPRESSION

#define USE_COMPRESSION

Definition at line 34 of file connection.h.

Typedef Documentation

◆ conn_close_fn_t

typedef void(* conn_close_fn_t) (struct connection *pconn)

Definition at line 281 of file connection.h.

Enumeration Type Documentation

◆ auth_status

Enumerator
AS_NOT_ESTABLISHED 
AS_FAILED 
AS_REQUESTING_NEW_PASS 
AS_REQUESTING_OLD_PASS 
AS_ESTABLISHED 

Definition at line 92 of file connection.h.

Function Documentation

◆ can_conn_edit()

bool can_conn_edit ( const struct connection pconn)

◆ can_conn_enable_editing()

bool can_conn_enable_editing ( const struct connection pconn)

Return TRUE iff the connection is allowed to start editing.

Definition at line 521 of file connection.c.

Referenced by can_conn_edit(), handle_edit_mode(), and real_menus_update().

◆ conn_by_number()

struct connection * conn_by_number ( int  id)

Find connection by id, from game.all_connections. Returns NULL if not found. Number of connections will always be relatively small given current implementation, so linear search should be fine.

Definition at line 421 of file connection.c.

Referenced by check_vote(), conn_list_selection(), connect_list_right_button(), connection_list_event(), handle_conn_info(), handle_conn_ping_info(), lsend_vote_new(), lsend_vote_update(), makeup_connection_name(), object_extract(), and vote_get_caller().

◆ conn_by_user()

struct connection * conn_by_user ( const char user_name)

Find connection by exact user name, from game.all_connections, case-insensitive. Returns NULL if not found.

Definition at line 377 of file connection.c.

Referenced by delegate_command(), establish_new_connection(), get_unique_guest_name(), is_allowed_city_name(), and makeup_connection_name().

◆ conn_by_user_prefix()

struct connection * conn_by_user_prefix ( const char user_name,
enum m_pre_result result 
)

◆ conn_compression_freeze()

void conn_compression_freeze ( struct connection pconn)

Freeze the connection. Then the packets sent to it won't be sent immediately, but later, using a compression method. See further details in common/networking/packets.[ch].

Definition at line 694 of file connection.c.

Referenced by conn_list_compression_freeze(), connection_attach_real(), establish_new_connection(), and start_processing_request().

◆ conn_compression_frozen()

bool conn_compression_frozen ( const struct connection pconn)

Returns TRUE if the connection is frozen. See also conn_compression_freeze().

Definition at line 708 of file connection.c.

Referenced by send_packet_data().

◆ conn_compression_thaw()

bool conn_compression_thaw ( struct connection pconn)

Thaw the connection. Then maybe compress the data waiting to send them to the connection. Returns TRUE on success. See also conn_compression_freeze().

Definition at line 194 of file packets.c.

Referenced by conn_list_compression_thaw(), connection_attach_real(), establish_new_connection(), and finish_processing_request().

◆ conn_controls_player()

bool conn_controls_player ( const struct connection pconn)

Returns TRUE if the given connection is attached to a player which it also controls (i.e. not a player observer).

Definition at line 745 of file connection.c.

Referenced by away_command(), conn_can_vote(), connection_delegate_restore(), connection_delegate_take(), cut_client_connection(), delegate_command(), establish_new_connection(), kick_command(), lost_connection_to_client(), send_all_info(), and surrender_command().

◆ conn_description()

const char * conn_description ( const struct connection pconn)

Return pointer to static string containing a description for this connection, based on pconn->name, pconn->addr, and (if applicable) pconn->playing->name. (Also pconn->established and pconn->observer.)

Note that when pconn is client.conn (connection to server), pconn->name and pconn->addr contain empty string, and pconn->playing is NULL: in this case return string "server".

Definition at line 474 of file connection.c.

Referenced by conn_compression_thaw(), conn_list_select_conn(), connection_ping(), connection_send_data(), cut_lagging_connection(), default_conn_close_callback(), flush_packets(), handle_conn_pong(), handle_edit_mode(), handle_login_request(), handle_vote_submit(), lost_connection_to_client(), packet_check(), reject_new_connection(), send_packet_achievement_info(), send_packet_authentication_reply(), send_packet_authentication_req(), send_packet_begin_turn(), send_packet_calendar_info(), send_packet_chat_msg(), send_packet_chat_msg_req(), send_packet_city_buy(), send_packet_city_change(), send_packet_city_change_specialist(), send_packet_city_info(), send_packet_city_make_specialist(), send_packet_city_make_worker(), send_packet_city_name_suggestion_info(), send_packet_city_name_suggestion_req(), send_packet_city_nationalities(), send_packet_city_options_req(), send_packet_city_rally_point(), send_packet_city_refresh(), send_packet_city_remove(), send_packet_city_rename(), send_packet_city_sabotage_list(), send_packet_city_sell(), send_packet_city_short_info(), send_packet_city_update_counters(), send_packet_city_worklist(), send_packet_client_heartbeat(), send_packet_client_info(), send_packet_conn_info(), send_packet_conn_ping(), send_packet_conn_ping_info(), send_packet_conn_pong(), send_packet_connect_msg(), send_packet_diplomacy_accept_treaty(), send_packet_diplomacy_accept_treaty_req(), send_packet_diplomacy_cancel_meeting(), send_packet_diplomacy_cancel_meeting_req(), send_packet_diplomacy_cancel_pact(), send_packet_diplomacy_create_clause(), send_packet_diplomacy_create_clause_req(), send_packet_diplomacy_init_meeting(), send_packet_diplomacy_init_meeting_req(), send_packet_diplomacy_remove_clause(), send_packet_diplomacy_remove_clause_req(), send_packet_early_chat_msg(), send_packet_edit_check_tiles(), send_packet_edit_city(), send_packet_edit_city_create(), send_packet_edit_city_remove(), send_packet_edit_fogofwar_state(), send_packet_edit_game(), send_packet_edit_mode(), send_packet_edit_object_created(), send_packet_edit_player(), send_packet_edit_player_create(), send_packet_edit_player_remove(), send_packet_edit_player_vision(), send_packet_edit_recalculate_borders(), send_packet_edit_scenario_desc(), send_packet_edit_startpos(), send_packet_edit_startpos_full(), send_packet_edit_tile(), send_packet_edit_tile_extra(), send_packet_edit_tile_terrain(), send_packet_edit_toggle_fogofwar(), send_packet_edit_unit(), send_packet_edit_unit_create(), send_packet_edit_unit_remove(), send_packet_edit_unit_remove_by_id(), send_packet_end_phase(), send_packet_end_turn(), send_packet_endgame_player(), send_packet_endgame_report(), send_packet_freeze_client(), send_packet_game_info(), send_packet_game_load(), send_packet_investigate_finished(), send_packet_investigate_started(), send_packet_map_info(), send_packet_nation_availability(), send_packet_nation_select_req(), send_packet_new_year(), send_packet_nuke_tile_info(), send_packet_page_msg(), send_packet_page_msg_part(), send_packet_play_music(), send_packet_player_attribute_block(), send_packet_player_attribute_chunk(), send_packet_player_change_government(), send_packet_player_diplstate(), send_packet_player_info(), send_packet_player_multiplier(), send_packet_player_phase_done(), send_packet_player_place_infra(), send_packet_player_rates(), send_packet_player_ready(), send_packet_player_remove(), send_packet_player_research(), send_packet_player_tech_goal(), send_packet_popup_image(), send_packet_processing_finished(), send_packet_processing_started(), send_packet_report_req(), send_packet_research_info(), send_packet_ruleset_achievement(), send_packet_ruleset_action(), send_packet_ruleset_action_auto(), send_packet_ruleset_action_enabler(), send_packet_ruleset_base(), send_packet_ruleset_building(), send_packet_ruleset_choices(), send_packet_ruleset_city(), send_packet_ruleset_clause(), send_packet_ruleset_control(), send_packet_ruleset_counter(), send_packet_ruleset_description_part(), send_packet_ruleset_disaster(), send_packet_ruleset_effect(), send_packet_ruleset_extra(), send_packet_ruleset_extra_flag(), send_packet_ruleset_game(), send_packet_ruleset_goods(), send_packet_ruleset_government(), send_packet_ruleset_government_ruler_title(), send_packet_ruleset_impr_flag(), send_packet_ruleset_multiplier(), send_packet_ruleset_music(), send_packet_ruleset_nation(), send_packet_ruleset_nation_groups(), send_packet_ruleset_nation_sets(), send_packet_ruleset_resource(), send_packet_ruleset_road(), send_packet_ruleset_select(), send_packet_ruleset_specialist(), send_packet_ruleset_style(), send_packet_ruleset_summary(), send_packet_ruleset_tech(), send_packet_ruleset_tech_class(), send_packet_ruleset_tech_flag(), send_packet_ruleset_terrain(), send_packet_ruleset_terrain_control(), send_packet_ruleset_terrain_flag(), send_packet_ruleset_trade(), send_packet_ruleset_unit(), send_packet_ruleset_unit_bonus(), send_packet_ruleset_unit_class(), send_packet_ruleset_unit_class_flag(), send_packet_ruleset_unit_flag(), send_packet_rulesets_ready(), send_packet_save_scenario(), send_packet_scenario_description(), send_packet_scenario_info(), send_packet_server_info(), send_packet_server_join_reply(), send_packet_server_join_req(), send_packet_server_setting_bitwise(), send_packet_server_setting_bool(), send_packet_server_setting_const(), send_packet_server_setting_control(), send_packet_server_setting_enum(), send_packet_server_setting_int(), send_packet_server_setting_str(), send_packet_server_shutdown(), send_packet_set_topology(), send_packet_single_want_hack_reply(), send_packet_single_want_hack_req(), send_packet_spaceship_info(), send_packet_spaceship_launch(), send_packet_spaceship_place(), send_packet_start_phase(), send_packet_sync_serial(), send_packet_sync_serial_reply(), send_packet_team_name_info(), send_packet_thaw_client(), send_packet_tile_info(), send_packet_timeout_info(), send_packet_trade_route_info(), send_packet_unit_action_answer(), send_packet_unit_action_query(), send_packet_unit_actions(), send_packet_unit_change_activity(), send_packet_unit_combat_info(), send_packet_unit_do_action(), send_packet_unit_get_actions(), send_packet_unit_info(), send_packet_unit_orders(), send_packet_unit_remove(), send_packet_unit_server_side_agent_set(), send_packet_unit_short_info(), send_packet_unit_sscs_set(), send_packet_unit_type_upgrade(), send_packet_unknown_research(), send_packet_vote_new(), send_packet_vote_remove(), send_packet_vote_resolve(), send_packet_vote_submit(), send_packet_vote_update(), send_packet_web_city_info_addition(), send_packet_web_cma_clear(), send_packet_web_cma_set(), send_packet_web_player_info_addition(), send_packet_web_ruleset_unit_addition(), send_packet_worker_task(), send_remove_team_votes(), send_running_votes(), server_packet_input(), server_sniff_all_input(), and show_connections().

◆ conn_get_access()

enum cmdlevel conn_get_access ( const struct connection pconn)

Returns the current access level of the given connection. NB: If 'pconn' is NULL, this function will return ALLOW_NONE.

Definition at line 775 of file connection.c.

Referenced by api_auth_get_cmdlevel(), cancelvote_command(), cmdlevel_command(), conn_can_vote(), conn_set_access(), delegate_command(), handle_stdin_input_real(), kick_command(), and may_use_nothing().

◆ conn_get_player()

struct player * conn_get_player ( const struct connection pconn)

◆ conn_is_global_observer()

bool conn_is_global_observer ( const struct connection pconn)

Returns TRUE if the given connection is a global observer.

Definition at line 753 of file connection.c.

Referenced by broadcast_city_info(), chat_msg_to_global_observers(), conn_can_see_vote(), send_city_info_at_tile(), send_pending_events(), and server_remove_unit_full().

◆ conn_is_valid()

bool conn_is_valid ( const struct connection pconn)

Returns TRUE if the connection is valid, i.e. not NULL, not closed, not closing, etc.

Definition at line 934 of file connection.c.

Referenced by api_auth_get_cmdlevel(), api_auth_get_ipaddr(), api_auth_get_username(), and api_auth_set_cmdlevel().

◆ conn_list_compression_freeze()

void conn_list_compression_freeze ( const struct conn_list pconn_list)

Freeze a connection list.

Definition at line 720 of file connection.c.

Referenced by buffer_shared_vision(), load_command(), send_rulesets(), and srv_ready().

◆ conn_list_compression_thaw()

void conn_list_compression_thaw ( const struct conn_list pconn_list)

Thaw a connection list.

Definition at line 732 of file connection.c.

Referenced by load_command(), send_rulesets(), srv_ready(), and unbuffer_shared_vision().

◆ conn_list_do_buffer()

void conn_list_do_buffer ( struct conn_list dest)

◆ conn_list_do_unbuffer()

void conn_list_do_unbuffer ( struct conn_list dest)

◆ conn_pattern_destroy()

void conn_pattern_destroy ( struct conn_pattern ppattern)

Free a connection pattern.

Definition at line 809 of file connection.c.

Referenced by ignore_command(), and server_make_connection().

◆ conn_pattern_from_string()

struct conn_pattern * conn_pattern_from_string ( const char pattern,
enum conn_pattern_type  prefer,
char error_buf,
size_t  error_buf_len 
)

Creates a new connection pattern from the string. If the type is not specified in 'pattern', then 'prefer' type will be used. If the type is needed, then pass conn_pattern_type_invalid() for 'prefer'.

Definition at line 878 of file connection.c.

Referenced by ignore_command().

◆ conn_pattern_list_match()

bool conn_pattern_list_match ( const struct conn_pattern_list plist,
const struct connection pconn 
)

Returns TRUE whether the connection fits one of the connection patterns.

Definition at line 850 of file connection.c.

Referenced by conn_is_ignored().

◆ conn_pattern_match()

bool conn_pattern_match ( const struct conn_pattern ppattern,
const struct connection pconn 
)

Returns TRUE whether the connection fits the connection pattern.

Definition at line 819 of file connection.c.

Referenced by conn_pattern_list_match().

◆ conn_pattern_new()

struct conn_pattern * conn_pattern_new ( enum conn_pattern_type  type,
const char wildcard 
)

Creates a new connection pattern.

Definition at line 795 of file connection.c.

Referenced by conn_pattern_from_string().

◆ conn_pattern_to_string()

size_t conn_pattern_to_string ( const struct conn_pattern ppattern,
char buf,
size_t  buf_len 
)

Put a string representation of the pattern in 'buf'.

Definition at line 865 of file connection.c.

Referenced by ignore_command(), show_ignore(), and unignore_command().

◆ conn_reset_delta_state()

void conn_reset_delta_state ( struct connection pc)

Remove all is-game-info cached packets from the connection. This resets the delta-state partially.

Definition at line 673 of file connection.c.

Referenced by connection_attach_real(), and set_client_state().

◆ conn_set_capability()

void conn_set_capability ( struct connection pconn,
const char capability 
)

Set the network capability string for 'pconn'.

Definition at line 661 of file connection.c.

Referenced by handle_login_request(), and handle_server_join_reply().

◆ connection_close()

void connection_close ( struct connection pconn,
const char reason 
)

◆ connection_common_close()

void connection_common_close ( struct connection pconn)

Connection closing part common to server and client.

Definition at line 630 of file connection.c.

Referenced by close_connection(), and close_socket_nomessage().

◆ connection_common_init()

void connection_common_init ( struct connection pconn)

Initialize common part of connection structure. This is used by both server and client.

Definition at line 603 of file connection.c.

Referenced by make_connection(), manual_settings(), and server_make_connection().

◆ connection_do_buffer()

void connection_do_buffer ( struct connection pc)

◆ connection_do_unbuffer()

void connection_do_unbuffer ( struct connection pc)

◆ connection_send_data()

bool connection_send_data ( struct connection pconn,
const unsigned char data,
int  len 
)

Write data to socket. Return TRUE on success.

Definition at line 287 of file connection.c.

Referenced by send_packet_data(), and server_packet_input().

◆ connections_set_close_callback()

void connections_set_close_callback ( conn_close_fn_t  func)

Register the close_callback.

Definition at line 80 of file connection.c.

Referenced by server_open_socket(), and try_to_connect().

◆ flush_connection_send_buffer_all()

void flush_connection_send_buffer_all ( struct connection pc)

◆ free_compression_queue()

void free_compression_queue ( struct connection pc)

Free compression queue for given connection.

Definition at line 547 of file connection.c.

Referenced by connection_common_close().

◆ get_next_request_id()

int get_next_request_id ( int  old_request_id)

Get next request id. Takes wrapping of the 16 bit wide unsigned int into account.

Definition at line 530 of file connection.c.

Referenced by handle_processing_started(), incoming_client_packets(), and send_packet_data().

◆ new_socket_packet_buffer()

struct socket_packet_buffer * new_socket_packet_buffer ( void  )

Return malloced struct, appropriately initialized.

Definition at line 439 of file connection.c.

Referenced by connection_common_init().

◆ read_socket_data()

int read_socket_data ( int  sock,
struct socket_packet_buffer buffer 
)

Read data from socket, and check if a packet is ready. Returns: -1 : an error occurred - you should close the socket -2 : the connection was closed >0 : number of bytes read =0 : non-blocking sockets only; no data read, would block

Definition at line 129 of file connection.c.

Referenced by read_from_connection(), and server_sniff_all_input().

Variable Documentation

◆ blank_addr_str

const char blank_addr_str[]
extern

Definition at line 55 of file connection.c.

Referenced by col_host().