summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-23 11:11:26 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-23 11:11:26 +0200
commitfd4f4ace264a91355df46186dd88f566fb451aa5 (patch)
tree49d8ea7bfc647a5d31c2f37b082d5fcef07842d9
parent7c6a78910429f2fa6cb3f0570e66c782d2f17748 (diff)
Move rcon to server-rcon in preparation for separate rcon tool
-rw-r--r--idle.c3
-rw-r--r--meson.build2
-rw-r--r--server-rcon.c (renamed from rcon.c)2
-rw-r--r--server-rcon.h (renamed from rcon.h)4
-rw-r--r--server.c2
5 files changed, 7 insertions, 6 deletions
diff --git a/idle.c b/idle.c
index dd1eeee..c49846d 100644
--- a/idle.c
+++ b/idle.c
@@ -32,6 +32,7 @@ write_byte(char **pos, char byte)
#define MC_GET_STATUS 0x00
#define MC_VARINT_MAX_BYTES 5
#define MC_STATUS_REPLY 0x00
+#define MC_UNDEFINED_VERSION -1
static inline void
write_varint(char **pos, int32_t orig)
@@ -297,7 +298,7 @@ idle_check_get_player_count(struct server *server, struct connection *conn)
pos = buf;
write_byte(&pos, MC_HELO);
- write_varint(&pos, -1); /* Protocol version, -1 = undefined */
+ write_varint(&pos, MC_UNDEFINED_VERSION);
write_str(&pos, hostname);
write_byte(&pos, (port >> 8) & 0xff);
write_byte(&pos, (port >> 0) & 0xff);
diff --git a/meson.build b/meson.build
index 34ad7b6..ca38341 100644
--- a/meson.build
+++ b/meson.build
@@ -39,9 +39,9 @@ mcproxy_sources = [
'server.c',
'server-proxy.c',
'server-config.c',
+ 'server-rcon.c',
'announce.c',
'config-parser.c',
- 'rcon.c',
'idle.c',
'ptimer.c',
'igmp.c',
diff --git a/rcon.c b/server-rcon.c
index ef46d44..5409b48 100644
--- a/rcon.c
+++ b/server-rcon.c
@@ -13,7 +13,7 @@
#include "main.h"
#include "uring.h"
#include "server.h"
-#include "rcon.h"
+#include "server-rcon.h"
struct rcon {
struct server *server;
diff --git a/rcon.h b/server-rcon.h
index 6604304..1e4ea24 100644
--- a/rcon.h
+++ b/server-rcon.h
@@ -1,5 +1,5 @@
-#ifndef foorconhfoo
-#define foorconhfoo
+#ifndef fooserverrconhfoo
+#define fooserverrconhfoo
void rcon_refdump(struct rcon *rcon);
diff --git a/server.c b/server.c
index 379adb8..9f0baec 100644
--- a/server.c
+++ b/server.c
@@ -16,10 +16,10 @@
#include "ptimer.h"
#include "server.h"
#include "server-proxy.h"
+#include "server-rcon.h"
#include "utils.h"
#include "config-parser.h"
#include "idle.h"
-#include "rcon.h"
#include "systemd.h"
static bool