26#ifdef HAVE_NETINET_IN_H
27#include <netinet/in.h>
29#ifdef HAVE_SYS_SOCKET_H
30#include <sys/socket.h>
32#ifdef HAVE_SYS_TYPES_H
38#ifdef HAVE_ARPA_INET_H
75#ifdef FREECIV_META_ENABLED
76static fc_thread *meta_srv_thread = NULL;
93 return "unstable pre-" NEXT_STABLE_VERSION
": beware";
96 return "development version: beware";
119#ifdef FREECIV_META_ENABLED
123static const char *get_meta_type_string(
void)
153 const char *user_message;
157 if (user_message == NULL) {
159 if (automatic != NULL) {
189 if (
string != NULL &&
string[0] !=
'\0') {
207#ifdef FREECIV_META_ENABLED
211static void metaserver_failed(
void)
227static inline bool meta_insert_setting(
struct netfile_post *post,
228 const char *set_name)
234 "Setting \"%s\" not found!", set_name);
244static void send_metaserver_post(
void *arg)
266static bool send_to_metaserver(
enum meta_flag flag)
311 const char *srvtype = get_meta_type_string();
313 if (srvtype != NULL) {
333 bool is_player_available =
TRUE;
337 if (!plr->is_alive) {
341 }
else if (
is_ai(plr)) {
361 pconn ? pconn->
addr :
"");
367 is_player_available =
FALSE;
369 is_player_available =
FALSE;
370 }
else if (
is_ai(plr)
373 is_player_available =
FALSE;
377 is_player_available =
FALSE;
381 is_player_available =
FALSE;
384 if (is_player_available) {
388 if (
is_human(plr) && plr->is_alive) {
401 "timeout",
"endturn",
"minplayers",
"maxplayers",
402 "aifill",
"allowtake",
"generator"
407 meta_insert_setting(post,
settings[i]);
413 meta_insert_setting(post,
"size");
416 meta_insert_setting(post,
"tilesperplayer");
419 meta_insert_setting(post,
"xsize");
420 meta_insert_setting(post,
"ysize");
437 if (meta_srv_thread != NULL) {
441 meta_srv_thread =
fc_malloc(
sizeof(meta_srv_thread));
492#ifndef FREECIV_META_ENABLED
498 static struct timer *last_send_timer = NULL;
499 static bool want_update;
517 if (last_send_timer) {
519 last_send_timer = NULL;
521 send_to_metaserver(flag);
525 free(meta_srv_thread);
526 meta_srv_thread = NULL;
531 if (last_send_timer != NULL) {
554 if (last_send_timer == NULL) {
562 return send_to_metaserver(flag);
const char *const our_capability
struct connection * conn_by_user(const char *user_name)
void con_puts(enum rfc_status rfc_status, const char *str)
int fc_thread_start(fc_thread *thread, void(*function)(void *arg), void *arg)
void fc_thread_wait(fc_thread *thread)
static GtkWidget * persistent
#define fc_assert_ret_val_msg(condition, val, message,...)
struct nation_type * nation_of_player(const struct player *pplayer)
const char * nation_plural_for_player(const struct player *pplayer)
#define NO_NATION_SELECTED
void netfile_close_post(struct netfile_post *post)
struct netfile_post * netfile_start_post(void)
bool netfile_send_post(const char *URL, struct netfile_post *post, FILE *reply_fp, struct netfile_write_cb_data *mem_data, const char *addr)
void netfile_add_form_int(struct netfile_post *post, const char *name, const int val)
void netfile_add_form_str(struct netfile_post *post, const char *name, const char *val)
const char * player_name(const struct player *pplayer)
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
int normal_player_count(void)
struct setting * setting_by_name(const char *name)
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
static struct setting settings[]
const char * setting_name(const struct setting *pset)
struct server_arguments srvarg
enum server_states server_state(void)
struct civ_game::@30::@34 server
struct packet_ruleset_control control
struct packet_game_info info
struct civ_game::@30::@34::@37 meta_info
char allow_take[MAX_LEN_ALLOW_TAKE]
enum mapsize_type mapsize
struct civ_map::@41::@43 server
char version[MAX_LEN_NAME]
char metaserver_addr[256]
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_gethostname(char *buf, size_t len)
#define sz_strlcpy(dest, src)
struct timer * timer_new(enum timer_timetype type, enum timer_use use)
void timer_clear(struct timer *t)
void timer_destroy(struct timer *t)
void timer_start(struct timer *t)
double timer_read_seconds(struct timer *t)