From 0d706ae72ceefd74053ad6cb0900ecce6cf1f085 Mon Sep 17 00:00:00 2001 From: auric Date: Sat, 21 Feb 2026 11:08:36 -0600 Subject: Add Umbrella 0.1.5 --- src/console/rcon.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/console/rcon.h (limited to 'src/console/rcon.h') diff --git a/src/console/rcon.h b/src/console/rcon.h new file mode 100644 index 0000000..ffcbde7 --- /dev/null +++ b/src/console/rcon.h @@ -0,0 +1,39 @@ +#ifndef UMBRELLA_RCON_H +#define UMBRELLA_RCON_H + +/* + * Valve RCON protocol implementation. + * https://developer.valvesoftware.com/wiki/Source_RCON_Protocol + * + * RCON uses a simple TCP framing: + * [int32 size][int32 id][int32 type][string body][null][null] + * + * Types: + * SERVERDATA_AUTH = 3 + * SERVERDATA_AUTH_RESPONSE = 2 + * SERVERDATA_EXECCOMMAND = 2 (same value as AUTH_RESPONSE — context-dependent) + * SERVERDATA_RESPONSE_VALUE = 0 + */ + +#define RCON_AUTH_REQUEST 3 +#define RCON_AUTH_RESPONSE 2 +#define RCON_EXEC_REQUEST 2 +#define RCON_EXEC_RESPONSE 0 + +/* + * rcon_exec: connect to an RCON server, authenticate, run a command, + * collect the response, and disconnect. + * + * host - server hostname or IP + * port - RCON port (usually 27015) + * password - RCON password + * command - command string to execute + * response - output buffer + * resp_len - size of response buffer + * + * Returns 0 on success, -1 on failure. + */ +int rcon_exec(const char *host, int port, const char *password, + const char *command, char *response, int resp_len); + +#endif /* UMBRELLA_RCON_H */ -- cgit v1.2.3