summaryrefslogtreecommitdiff
path: root/src/console/a2s.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/console/a2s.h')
-rw-r--r--src/console/a2s.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/console/a2s.h b/src/console/a2s.h
new file mode 100644
index 0000000..c96e445
--- /dev/null
+++ b/src/console/a2s.h
@@ -0,0 +1,27 @@
+#ifndef A2S_H
+#define A2S_H
+
+#include <stdint.h>
+
+/*
+ * A2S_INFO query (Valve Source engine query protocol).
+ * Retrieves server information over UDP.
+ *
+ * Only used for units with health.type == HEALTH_A2S.
+ */
+
+typedef struct {
+ int players; /* current player count */
+ int max_players; /* server player limit */
+ char map[64]; /* current map name */
+} A2SInfo;
+
+/*
+ * a2s_query: Send an A2S_INFO request and parse the response.
+ *
+ * Returns 0 on success with *out populated.
+ * Returns -1 on timeout, parse error, or any network failure.
+ */
+int a2s_query(const char *host, uint16_t port, int timeout_ms, A2SInfo *out);
+
+#endif /* A2S_H */