13#ifndef FC__CONNECTION_H
14#define FC__CONNECTION_H
22#ifdef FREECIV_HAVE_SYS_TYPES_H
25#ifdef FREECIV_HAVE_SYS_TIME_H
29#ifdef FREECIV_JSON_CONNECTION
33#ifndef FREECIV_JSON_CONNECTION
34#define USE_COMPRESSION
63#define SPECENUM_NAME cmdlevel
65#define SPECENUM_VALUE0 ALLOW_NONE
66#define SPECENUM_VALUE0NAME "none"
68#define SPECENUM_VALUE1 ALLOW_INFO
69#define SPECENUM_VALUE1NAME "info"
71#define SPECENUM_VALUE2 ALLOW_BASIC
72#define SPECENUM_VALUE2NAME "basic"
75#define SPECENUM_VALUE3 ALLOW_CTRL
76#define SPECENUM_VALUE3NAME "ctrl"
78#define SPECENUM_VALUE4 ALLOW_ADMIN
79#define SPECENUM_VALUE4NAME "admin"
81#define SPECENUM_VALUE5 ALLOW_HACK
82#define SPECENUM_VALUE5NAME "hack"
83#define SPECENUM_COUNT CMDLEVEL_COUNT
104#define SPECLIST_TAG conn
105#define SPECLIST_TYPE struct connection
108#define conn_list_iterate(connlist, pconn) \
109 TYPED_LIST_ITERATE(struct connection, connlist, pconn)
110#define conn_list_iterate_end LIST_ITERATE_END
128#define SPECVEC_TAG byte
129#define SPECVEC_TYPE unsigned char
156#ifdef FREECIV_JSON_CONNECTION
268#ifdef USE_COMPRESSION
288 const unsigned char *data,
int len);
333#define SPECLIST_TAG conn_pattern
334#define SPECLIST_TYPE struct conn_pattern
336#define conn_pattern_list_iterate(plist, ppatern) \
337 TYPED_LIST_ITERATE(struct conn_pattern, plist, ppatern)
338#define conn_pattern_list_iterate_end LIST_ITERATE_END
340#define SPECENUM_NAME conn_pattern_type
341#define SPECENUM_VALUE0 CPT_USER
342#define SPECENUM_VALUE0NAME "user"
343#define SPECENUM_VALUE1 CPT_HOST
344#define SPECENUM_VALUE1NAME "host"
345#define SPECENUM_VALUE2 CPT_IP
346#define SPECENUM_VALUE2NAME "ip"
367#define conn_is_webclient(__pconn__) ((__pconn__)->client_gui == GUI_WEB)
size_t conn_pattern_to_string(const struct conn_pattern *ppattern, char *buf, size_t buf_len)
struct player * conn_get_player(const struct connection *pconn)
void conn_list_do_unbuffer(struct conn_list *dest)
void free_compression_queue(struct connection *pconn)
struct connection * conn_by_user_prefix(const char *user_name, enum m_pre_result *result)
bool can_conn_edit(const struct connection *pconn)
void(* conn_close_fn_t)(struct connection *pconn)
struct connection * conn_by_user(const char *user_name)
void conn_list_compression_thaw(const struct conn_list *pconn_list)
void connections_set_close_callback(conn_close_fn_t func)
bool conn_compression_thaw(struct connection *pconn)
void flush_connection_send_buffer_all(struct connection *pc)
int get_next_request_id(int old_request_id)
struct socket_packet_buffer * new_socket_packet_buffer(void)
void conn_list_do_buffer(struct conn_list *dest)
bool can_conn_enable_editing(const struct connection *pconn)
void connection_do_buffer(struct connection *pc)
bool conn_pattern_match(const struct conn_pattern *ppattern, const struct connection *pconn)
void conn_set_capability(struct connection *pconn, const char *capability)
void conn_pattern_destroy(struct conn_pattern *ppattern)
void connection_common_init(struct connection *pconn)
void connection_close(struct connection *pconn, const char *reason)
void conn_list_compression_freeze(const struct conn_list *pconn_list)
struct conn_pattern * conn_pattern_new(enum conn_pattern_type type, const char *wildcard)
bool conn_controls_player(const struct connection *pconn)
bool conn_is_global_observer(const struct connection *pconn)
const char * conn_description(const struct connection *pconn)
void connection_common_close(struct connection *pconn)
struct conn_pattern * conn_pattern_from_string(const char *pattern, enum conn_pattern_type prefer, char *error_buf, size_t error_buf_len)
void conn_compression_freeze(struct connection *pconn)
struct connection * conn_by_number(int id)
const char blank_addr_str[]
int read_socket_data(int sock, struct socket_packet_buffer *buffer)
void conn_reset_delta_state(struct connection *pconn)
bool connection_send_data(struct connection *pconn, const unsigned char *data, int len)
enum cmdlevel conn_get_access(const struct connection *pconn)
bool conn_is_valid(const struct connection *pconn)
bool conn_compression_frozen(const struct connection *pconn)
bool conn_pattern_list_match(const struct conn_pattern_list *plist, const struct connection *pconn)
void connection_do_unbuffer(struct connection *pc)
int currently_processed_request_id
struct genhash ** received
struct connection::@60 phs
int request_id_of_currently_handled_packet
struct connection::@58::@63 client
enum cmdlevel access_level
const struct packet_handlers * handlers
struct timer_list * ping_timers
char username[MAX_LEN_NAME]
struct connection::@61 compression
struct connection::@58::@64 server
struct timer * last_write
char ipaddr[MAX_LEN_ADDR]
void(* incoming_packet_notify)(struct connection *pc, int packet_type, int size)
void(* outgoing_packet_notify)(struct connection *pc, int packet_type, int size, int request_id)
struct socket_packet_buffer * send_buffer
struct connection::@58::@64::@65 delegation
char capability[MAX_LEN_CAPSTR]
void(* notify_of_writable_data)(struct connection *pc, bool data_available_and_socket_full)
int last_processed_request_id_seen
struct connection::@62 statistics
struct socket_packet_buffer * buffer
char password[MAX_LEN_PASSWORD]
struct conn_pattern_list * ignore_list
enum cmdlevel granted_access_level