diff options
Diffstat (limited to 'minecproxy/server.h')
-rw-r--r-- | minecproxy/server.h | 73 |
1 files changed, 7 insertions, 66 deletions
diff --git a/minecproxy/server.h b/minecproxy/server.h index 937fa67..7201ba6 100644 --- a/minecproxy/server.h +++ b/minecproxy/server.h @@ -1,6 +1,8 @@ #ifndef fooserverhfoo #define fooserverhfoo +#include "config-parser.h" + /* clang-format off */ enum server_state { SERVER_STATE_INIT = 0, @@ -11,51 +13,17 @@ enum server_state { }; /* clang-format on */ -enum server_type { - SERVER_TYPE_UNDEFINED, - SERVER_TYPE_ANNOUNCE, - SERVER_TYPE_PROXY, -}; - -enum server_stop_method { - SERVER_STOP_METHOD_UNDEFINED, - SERVER_STOP_METHOD_RCON, - SERVER_STOP_METHOD_SYSTEMD, - SERVER_STOP_METHOD_EXEC, -}; - -enum server_start_method { - SERVER_START_METHOD_UNDEFINED, - SERVER_START_METHOD_SYSTEMD, - SERVER_START_METHOD_EXEC, -}; - struct server { - enum server_type type; char *name; - char *pretty_name; - uint16_t announce_port; - struct list_head locals; - struct list_head remotes; + struct server_config scfg; + struct list_head listenings; struct list_head proxys; - struct list_head rcons; - struct list_head dnslookups; enum server_state state; - enum server_stop_method stop_method; - enum server_start_method start_method; - /* For calling external start/stop executables */ - char *stop_exec; - char *start_exec; struct uring_task exec_task; - /* For systemd services */ - char *systemd_service; - char *systemd_obj; - /* For rcon connections */ - char *rcon_password; struct connection rcon_conn; struct uring_task rcon_task; struct uring_task_buf rcon_tbuf; @@ -68,7 +36,6 @@ struct server { struct uring_task idle_task; struct connection idle_conn; struct uring_task_buf idle_buf; - unsigned idle_timeout; unsigned idle_count; /* For reading config files */ @@ -82,7 +49,7 @@ void server_refdump(struct server *server); void server_delete(struct server *server); -void server_delete_by_name(const char *name); +void server_delete_by_filename(const char *filename); bool server_start(struct server *server); @@ -90,40 +57,14 @@ bool server_stop(struct server *server); void server_set_active_players(struct server *server, int count); +void server_async_dns_update(struct server_config *scfg, bool done); + bool server_idle_check(struct server *server); bool server_announce(struct server *server, int fd); bool server_commit(struct server *server); -bool server_add_remote(struct server *server, struct saddr *remote); - -bool server_add_local(struct server *server, struct saddr *saddr); - -bool server_add_rcon(struct server *server, struct saddr *rcon); - -bool server_set_rcon_password(struct server *server, const char *password); - -bool server_set_systemd_service(struct server *server, const char *service); - -bool server_set_stop_method(struct server *server, - enum server_stop_method stop_method); - -bool server_set_start_method(struct server *server, - enum server_start_method start_method); - -bool server_set_stop_exec(struct server *server, const char *cmd); - -bool server_set_start_exec(struct server *server, const char *cmd); - -bool server_set_idle_timeout(struct server *server, uint16_t timeout); - -bool server_set_port(struct server *server, uint16_t port); - -bool server_set_type(struct server *server, enum server_type type); - -bool server_set_pretty_name(struct server *server, const char *pretty_name); - struct server *server_new(const char *name); #endif |