26#ifdef FREECIV_MSWINDOWS
30#ifdef FREECIV_HAVE_SYS_TYPES_H
69#define WAIT_BETWEEN_TRIES 100000
71#ifdef FREECIV_PATIENT_CONNECT
72#define NUMBER_OF_TRIES 10000
74#define NUMBER_OF_TRIES 500
77#if defined(HAVE_WORKING_FORK) && !defined(FREECIV_MSWINDOWS)
80#define HAVE_USABLE_FORK
83#ifdef HAVE_USABLE_FORK
85#elif FREECIV_MSWINDOWS
129#ifdef HAVE_USABLE_FORK
131#elif FREECIV_MSWINDOWS
155#ifdef HAVE_USABLE_FORK
166#elif FREECIV_MSWINDOWS
201#ifdef HAVE_USABLE_FORK
205#elif FREECIV_MSWINDOWS
226#if !defined(HAVE_USABLE_FORK) && !defined(FREECIV_MSWINDOWS)
237#if !defined(HAVE_USABLE_FORK)
261#ifdef FREECIV_IPV6_SUPPORT
284 _(
"You'll have to start one manually. Sorry..."));
292 _(
"You'll have to start server manually. Sorry..."));
298#ifdef HAVE_USABLE_FORK
409#ifdef FREECIV_APPIMAGE
447#ifdef FREECIV_MSWINDOWS
502 depr =
" --warnings";
513 "-p %d --bind localhost -q 1 -e%s%s%s --saves \"%s\" "
514 "--scenarios \"%s\" -A none %s%s",
520 "./server/freeciv-web %s", options);
524 "./server/freeciv-server %s", options);
529 BINDIR "/freeciv-web %s", options);
531 "freeciv-web %s", options);
534 BINDIR "/freeciv-server %s", options);
536 "freeciv-server %s", options);
557 log_error(
"Failed to start server process.");
566 _(
"You'll have to start one manually. Sorry..."));
570 log_verbose(
"Arguments to spawned server: %s", options);
579 buf,
sizeof(
buf)) == -1) {
581#ifdef HAVE_USABLE_FORK
582#ifndef FREECIV_MSWINDOWS
589 log_error(
"Last error from connect attempts: '%s'",
buf);
600 log_error(
"Failed to connect to spawned server!");
603 _(
"We probably couldn't start it from here."));
605 _(
"You'll have to start one manually. Sorry..."));
662 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
665 for (
i = 0;
i <
n - 1;
i++) {
681 if (filename[0] !=
'\0') {
695 log_error(
"Couldn't create storage directory for token.");
708 log_error(
"Couldn't write token to temporary file: %s",
735 _(
"Established control over the server. "
736 "You have command access level 'hack'."));
741 _(
"Failed to obtain the required access "
742 "level to take control of the server. "
743 "Attempting to shut down server."));
void astr_free(struct astring *astr)
void astr_add(struct astring *astr, const char *format,...)
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
void attribute_flush(void)
int send_chat_printf(const char *format,...)
int send_chat(const char *message)
void output_window_append(const struct ft_color color, const char *featured_text)
int connect_to_server(const char *username, const char *hostname, int port, char *errbuf, int errbufsize)
void handle_ruleset_choices(const struct packet_ruleset_choices *packet)
void handle_single_want_hack_reply(bool you_have_hack)
void send_client_wants_hack(const char *filename)
static bool client_has_hack
void send_save_game(const char *filename)
static void randomize_string(char *str, size_t n)
#define WAIT_BETWEEN_TRIES
void set_ruleset(const char *ruleset)
bool is_server_running(void)
void client_kill_server(bool force)
bool client_start_server(void)
bool can_client_access_hack(void)
static char challenge_fullname[MAX_LEN_PATH]
bool are_deprecation_warnings_enabled(void)
char * internal_to_local_string_buffer(const char *text, char *buf, size_t bufsz)
char * internal_to_local_string_malloc(const char *text)
const struct ft_color ftc_client
void set_rulesets(int num_rulesets, char **rulesets)
const char * log_level_name(enum log_level lvl)
enum log_level log_get_level(void)
#define log_verbose(message,...)
#define fc_assert(condition)
#define log_error(message,...)
int find_next_free_port(int starting_port, int highest_port, enum fc_addr_family family, char *net_interface, bool not_avail_ok)
void desired_settable_option_update(const char *op_name, const char *op_value, bool allow_replace)
int send_packet_ruleset_select(struct connection *pc, const struct packet_ruleset_select *packet)
int send_packet_single_want_hack_req(struct connection *pc, const struct packet_single_want_hack_req *packet)
struct section_file * secfile_new(bool allow_duplicates)
void secfile_destroy(struct section_file *secfile)
bool secfile_save(const struct section_file *secfile, const char *filename, int compression_level, enum fz_method compression_method)
#define secfile_insert_str(secfile, string, path,...)
bool make_dir(const char *pathname)
bool is_safe_filename(const char *name)
char * freeciv_storage_dir(void)
char rulesets[MAX_NUM_RULESETS][MAX_RULESET_NAME_LENGTH]
char modpack[MAX_RULESET_NAME_LENGTH]
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
void fc_usleep(unsigned long usec)
size_t fc_strlcat(char *dest, const char *src, size_t n)
int fc_remove(const char *filename)
int tileset_hex_width(const struct tileset *t)
bool tileset_is_isometric(const struct tileset *t)
int tileset_hex_height(const struct tileset *t)
char * tileset_what_ruleset(struct tileset *t)