Commit Graph

243 Commits

Author SHA1 Message Date
Tiiffi
2cd2fa66f6 Add handling for protocol quirks in different servers.
RCON protocol is quite broken and inconsistent across different server implementations. This patch adds handling for the quirks found in the following servers:
- Rust
- Palworld
- Factorio
2025-12-01 21:33:13 +02:00
Tiiffi
f143501b4e Change timeout from 5s to 2s 2025-12-01 21:26:54 +02:00
Tiiffi
da5d692f89 Add byteswap to net_send_packet() function
Fixes broken packet size calculation on big endian machines.
2025-11-27 17:55:23 +02:00
Tiiffi
b03cc2b236 Update BUILDING.md 2025-11-27 07:13:15 +02:00
Tiiffi
8963c9c2a7 Perform endianness conversion when running on a big-endian host 2025-11-27 06:58:04 +02:00
Tiiffi
cabddcb185 Add a net_recv_all() function to ensure complete receives at all times 2025-11-27 06:56:40 +02:00
Tiiffi
9bcbe1c85d Update Makefile 2025-11-27 05:40:50 +02:00
Tiiffi
4a720e44a4 Fix fprintf() indentation 2025-11-27 04:53:57 +02:00
Tiiffi
c497f9fd6e Remove log_error macro and revert back to fprintf() 2025-11-27 04:39:07 +02:00
Tiiffi
c9dd5b118d Remove '-Wno-gnu-zero-variadic-macro-arguments' flag 2025-11-27 04:34:20 +02:00
Tiiffi
d61da026b9 Refactor windows getline function and fix color handling:
- rename utf8_getline() to windows_getline()
- windows_getline() should now handle UTF-8 input correctly
- color printing now resets bold/bright status for each line
- remove unnecessary _setmode() calls
- disable color printing if 'valve protocol' detected
- print newline after last packet if last character was not newline
2025-11-27 01:22:54 +02:00
Tiiffi
edbadf5a7f Add "TODO" to .gitignore 2025-11-27 01:11:26 +02:00
Tiiffi
da5821e7ab Remove unused color printing code and set stdout/stderr to binary mode to avoid newline translation confusion on Windows 2025-11-21 21:04:43 +02:00
Tiiffi
3a049e75fc Newline fixes:
- Add additional newline check to prevent double newlines
- Print newline only after multipacket guard is received
2025-11-21 16:36:33 +02:00
Tiiffi
b4da108a71 Update copyright year 2025-11-21 16:07:40 +02:00
Tiiffi
f0ef884cd5 Update CHANGELOG.md and README.md 2025-11-21 16:07:05 +02:00
Tiiffi
142479f9ee Refactor color handling and add error handling to UTF-8 code 2025-11-21 15:53:39 +02:00
Tiiffi
1518d96475 Update BUILDING.md 2025-11-21 15:49:12 +02:00
Tiiffi
2094048d46 Remove few hardening flags, let's not go overboard :^) 2024-12-12 22:15:50 +02:00
Tiiffi
f0e7e71589 Revert back to old way of flushing input buffer 2024-12-12 22:14:40 +02:00
Tiiffi
dfd840de1f Update BUILDING.md 2024-12-07 21:19:47 +02:00
Tiiffi
d5515f43ce Update BUILDING.md 2024-12-07 21:18:17 +02:00
Tiiffi
4a1da8d373 Convert tab indentation to spaces. This is how normal people do it. :D 2024-12-06 23:44:04 +02:00
Tiiffi
b1b46ca08c Implement platform specific input buffer flushing 2024-12-06 21:53:39 +02:00
Tiiffi
2bb1fafdaa Add hardening flags 2024-12-06 21:53:14 +02:00
Tiiffi
0fb17971c0 Fix typo and remove 'Q' as quitting command 2024-12-06 20:26:42 +02:00
Tiiffi
ec11d77e89 Update CHANGELOG.md 2024-12-06 16:32:11 +02:00
Tiiffi
2d29741691 Fixes to Windows utf-8 support + one more Minecraft newline fix 2024-12-06 16:24:04 +02:00
Tiiffi
cc77044df1 Add experimental utf-8 support for Windows and change the behaviour of Minecraft "stop" hack 2024-12-06 14:43:40 +02:00
Tiiffi
dba07aacf7 Update CHANGELOG.md 2024-12-06 12:35:30 +02:00
Tiiffi
bd76b897de Fix missing newlines in Minecraft RCON messages:
Minecraft servers have a longstanding bug that omits newlines
when sending messages via RCON. This patch manually inserts
newlines to address the issue.

Reference: https://bugs.mojang.com/browse/MC-7569

Fixes #1
2024-12-06 11:00:18 +02:00
Tiiffi
1106f27700 Bump version to 0.8.0 2024-12-06 08:47:45 +02:00
Tiiffi
00fc3b5bcb Set select() timeout to 5 seconds and replace putchar() loop with fputs() call 2024-12-06 08:47:45 +02:00
Tiiffi
a0fe9e1645 Enable input/output buffering and fflush only explicitly
As suggested in old pull request: #39
2024-12-06 08:47:45 +02:00
Tiiffi
5f460e8912 Remove Valve protocol checks and set select() timeout to 1.5 seconds
Use the same method for handling multipacket responses across all servers.
2024-12-06 08:47:45 +02:00
Tiiffi
6fed74ba74 Implement select() loop to receive all incoming packets:
Send a "multipacket guard" - an empty packet with an invalid 'cmd' field
and a unique packet ID to trigger a reply from the server once the previous
command's reply has been fully sent.

Valve returns an empty payload, while Minecraft includes an error message in the payload.

This workaround ensures that all packets related to the last valid command
are received from the server, avoiding the need to wait for the select() timeout.
2024-12-06 08:47:45 +02:00
Tiiffi
5d1c87b26f Don't call memcpy() if there is nothing to copy v0.7.3-develop 2024-12-04 08:17:56 +02:00
Tiiffi
fd77ad7fc0 packet_build(): add [static 1] to generate warning if NULL pointer is passed 2024-12-03 05:40:45 +02:00
Tiiffi
bc5617407d Update CHANGELOG.md 2024-12-02 10:40:51 +02:00
Tiiffi
5ae06f4d37 Update man page 2024-12-02 10:35:00 +02:00
Tiiffi
233031cdcb Update README.md 2024-12-02 10:31:38 +02:00
Tiiffi
ebf5172cd0 Update BUILDING.md 2024-12-02 10:13:38 +02:00
Tiiffi
0b72e4d17d Update README.md 2024-12-02 09:56:06 +02:00
Tiiffi
af70f87bc1 Update README.md 2024-12-02 09:52:30 +02:00
Tiiffi
53fd703911 Rename INSTALL.md to BUILDING.md 2024-12-02 09:42:44 +02:00
Tiiffi
c0d28bcb17 Rename INSTALL.md to BUILDING.md 2024-12-02 09:42:11 +02:00
Tiiffi
edf8344983 Add "-Wno-gnu-zero-variadic-macro-arguments" flag to suppress Clang warnings about GNU macro extensions 2024-12-02 09:37:08 +02:00
Tiiffi
a502204e26 Remove unused headers 2024-12-02 09:34:48 +02:00
Tiiffi
7162bc6fe6 - add log_error macro
- rename "flag_connection_alive" variable back to "global_connection_alive"
- return exit code from run_terminal_mode()
- rcon_command(): add error messages
2024-12-02 08:55:18 +02:00
Tiiffi
f270a485b5 Remove url from version string 2024-12-02 07:40:34 +02:00