25#ifdef FREECIV_HAVE_SYS_TYPES_H
28#ifdef HAVE_SYS_SOCKET_H
29#include <sys/socket.h>
31#ifdef HAVE_NETINET_IN_H
32#include <netinet/in.h>
34#ifdef HAVE_ARPA_INET_H
43#ifdef HAVE_SYS_SELECT_H
44#include <sys/select.h>
52#ifdef HAVE_SYS_UTSNAME_H
53#include <sys/utsname.h>
97#define AUTOCONNECT_INTERVAL 500
100#define MAX_AUTOCONNECT_ATTEMPTS 100
154#ifdef FREECIV_JSON_CONNECTION
233#ifdef FREECIV_HAVE_WINSOCK
351 && 0 <
pc->send_buffer->ndata);
388 log_error(
"select() return=%d errno=%d (%s)",
424 if (
NULL != packet) {
434 }
else if (-2 ==
nb) {
453 log_debug(
"input_from_server_till_request_got_processed("
465 if (
NULL == packet) {
483 }
else if (-2 ==
nb) {
501 static int count = 0;
502#ifndef FREECIV_MSWINDOWS
513 log_fatal(
_(
"Failed to contact server \"%s\" at port "
514 "%d as \"%s\" after %d attempts"),
524#ifndef FREECIV_MSWINDOWS
528 log_error(
"Connection to server refused. Please start the server.");
530 "Please start the server."));
537 log_fatal(
_(
"Error contacting server \"%s\" at port %d "
538 "as \"%s\":\n %s\n"),
558 _(
"Auto-connecting to server \"%s\" at port %d "
559 "as \"%s\" every %f second(s) for %d times"),
565 log_fatal(
_(
"Error contacting server \"%s\" at port %d "
566 "as \"%s\":\n %s\n"),
void agents_thaw_hint(void)
void agents_freeze_hint(void)
void attribute_flush(void)
void audio_play_sound(const char *const tag, const char *const alt_tag, const char *const alt_tag2)
const char *const our_capability
void output_window_append(const struct ft_color color, const char *featured_text)
void output_window_printf(const struct ft_color color, const char *format,...)
void client_packet_input(void *packet, int type)
void stop_turn_change_wait(void)
void set_client_state(enum client_states newstate)
void start_autoconnecting_to_server(void)
static struct fc_sockaddr_list * list
int connect_to_server(const char *username, const char *hostname, int port, char *errbuf, int errbufsize)
static bool autoconnecting
void disconnect_from_server(bool leaving_sound)
static void client_conn_close_callback(struct connection *pconn)
void make_connection(int sock, const char *username)
static int read_from_connection(struct connection *pc, bool block)
#define AUTOCONNECT_INTERVAL
static int try_to_connect(const char *username, char *errbuf, int errbufsize)
double try_to_autoconnect(void)
#define MAX_AUTOCONNECT_ATTEMPTS
void input_from_server_till_request_got_processed(int fd, int expected_request_id)
void input_from_server(int fd)
static void close_socket_nomessage(struct connection *pc)
static int get_server_address(const char *hostname, int port, char *errbuf, int errbufsize)
void client_kill_server(bool force)
void connections_set_close_callback(conn_close_fn_t func)
void flush_connection_send_buffer_all(struct connection *pc)
void connection_common_init(struct connection *pconn)
void connection_close(struct connection *pconn, const char *reason)
void connection_common_close(struct connection *pconn)
int read_socket_data(int sock, struct socket_packet_buffer *buffer)
const struct ft_color ftc_client
void close_connection_dialog(void)
void popdown_races_dialog(void)
void remove_net_input(void)
void add_net_input(int sock)
#define fc_assert_ret(condition)
#define log_fatal(message,...)
#define log_debug(message,...)
#define log_error(message,...)
struct fc_sockaddr_list * net_lookup_service(const char *name, int port, enum fc_addr_family family)
void fc_closesocket(int sock)
int sockaddr_size(union fc_sockaddr *addr)
int fc_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen)
int fc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, fc_timeval *timeout)
struct timeval fc_timeval
#define fc_sockaddr_list_iterate_end
#define fc_sockaddr_list_iterate(sockaddrlist, paddr)
void options_save(option_save_log_callback log_cb)
struct client_options gui_options
#define get_packet_from_connection(pc, ptype)
void packet_destroy(void *packet, enum packet_type type)
int send_packet_server_join_req(struct connection *pc, const struct packet_server_join_req *packet)
@ PACKET_PROCESSING_FINISHED
void notify_about_incoming_packet(struct connection *pc, int packet_type, int size)
void notify_about_outgoing_packet(struct connection *pc, int packet_type, int size, int request_id)
char default_server_host[512]
bool save_options_on_exit
int request_id_of_currently_handled_packet
struct connection::@61::@66 client
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)
int last_processed_request_id_seen
size_t fc_strlcpy(char *dest, const char *src, size_t n)
const char * fc_strerror(fc_errno err)
fc_errno fc_get_errno(void)
#define sz_strlcpy(dest, src)
#define RETURN_VALUE_AFTER_EXIT(_val_)