aboutsummaryrefslogtreecommitdiff
path: root/src/rcon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rcon.h')
-rw-r--r--src/rcon.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/rcon.h b/src/rcon.h
index 1c1e232..566aa0b 100644
--- a/src/rcon.h
+++ b/src/rcon.h
@@ -12,7 +12,9 @@
* 2-byte pad byte^2 Two null bytes
*
* sizeof int: 4B
- * */
+ */
+
+#pragma once
#include <stdint.h>
#include <stdlib.h>
@@ -43,17 +45,30 @@ typedef struct rcon_packet_s {
uint32_t payload_len;
} rcon_packet_t;
-int rcon_parse_packet ( rcon_packet_t* _packet, char* _buffer, uint32_t _len );
-
-int rcon_construct_packet ( char* _buffer, uint32_t _len, rcon_packet_t* _packet );
-
+/**
+ * Authenticate RCON connection
+ */
int rcon_login ( int _socket, const char* _password );
+/**
+ * Send command via authenticated RCON connection
+ * Result is written to _output.
+ */
int rcon_command ( char** _output, int _socket, const char* _command );
-int rcon_recv_packet ( int _socket, rcon_packet_t* _packet, int _timeout_msecs );
+/**
+ * Get rcon_* return code string representation
+ */
+const char* rcon_strerror ( int _errno );
-int rcon_send_packet ( int _socket, rcon_packet_t* _packet );
+/**
+ * rcon_login and rcon_command are wrappers around the following functions
+ */
-const char* rcon_strerror ( int _errno );
+int rcon_parse_packet ( rcon_packet_t* _packet, char* _buffer, uint32_t _len );
+
+int rcon_construct_packet ( char* _buffer, uint32_t _len, rcon_packet_t* _packet );
+int rcon_recv_packet ( int _socket, rcon_packet_t* _packet, int _timeout_msecs );
+
+int rcon_send_packet ( int _socket, rcon_packet_t* _packet );