RCON: Difference between revisions
Committing current progress; I need to finish the GAME events table, among other things. |
m →VOTE: fixed a typo |
||
Line 238: | Line 238: | ||
| Rx_VoteMenuChoice_MineBan || "player" | Player || Restricts a player from mining | | Rx_VoteMenuChoice_MineBan || "player" | Player || Restricts a player from mining | ||
|- | |- | ||
| Rx_VoteMenuChoice_RemoveBots || "team" | "GDI" / "Nod" / " | | Rx_VoteMenuChoice_RemoveBots || "team" | "GDI" / "Nod" / "Both" | "amount" | Number of bots || Removes bots | ||
|- | |- | ||
| Rx_VoteMenuChoice_RetsartMap || || Forcefully ends the game and restarts the level | | Rx_VoteMenuChoice_RetsartMap || || Forcefully ends the game and restarts the level |
Revision as of 20:37, 9 August 2016
RCON is a text based protocol completely unrelated to the Source RCON protocol. It is designed with readability, ease of implementation, and human usability in mind.
Packet Format
RCON packets consist of a single-byte Type ID, a variable number of ASCII strings separated by the Delimiter (Start of Text/0x02), and a newline. The text after the Type ID and before the newline is referred to as the message.
Type ID | Message | End Message |
---|---|---|
1 byte | Variable Characters | 0x0A (Newline) |
Limitations
RCON strictly contains standard ASCII strings and does not support null characters. RCON therefore only guarantees the reliability of character values [1, 127]. This is largely because RCON is interpreted entirely as strings by the Renegade X server, but both TCPLink and Rx_TCPLink are incapable of directly reading or transmitting non-ASCII characters when in text mode.
Player are consistently represented in the format id,team,name. This means that you can parse RCON output directly without retaining any information about players if you so choose.
Escaping
Unicode sequences are escaped and interpreted in the format "\uXXXX", where XXXX is the hexadecimal representation of a Unicode code point. There is no support for Unicode code points beyond 16 bits in size, largely because the Unreal Development Kit does not support these strings. Therefore, both RCON and the Unreal Development Kit can only possibly support characters within the Unicode Basic Multilingual Plane (BMP).
The only non-Unicode character that you must sequence is the backslash (\) character, which can be escaped as \\
Processing
The recommended and intended method of processing RCON output is to:
- Process incoming data into lines (split on newline; no CR is included)
- Process tokens in each line into an array
- Process each token for escaped Unicode sequences
- Begin processing the content normally, based on the Type ID.
Type ID values
Server refers to the Renegade X server and client refers to the RCON client. Type IDs
Client -> Server
If not yet authenticated, the server will only accept Authenticate messages.
Type ID | Description |
---|---|
a | Authenticate |
s | Subscribe |
u | Unsubscribe |
c | Command |
d | DevBot specific (reserved) |
Server -> Client
Type ID | Description |
---|---|
v | RCON and game version information |
a | Authentication success |
e | Error |
r | Command response |
c | Command execution finished |
l | Log |
d | DevBot specific |
Example Implementation
An actively maintained and fully functional RCON client implementation can be found on Agent's GitHub here. Jupiter Bot is entirely ISC licensed, and you are free to reference, modify, and redistribute any code from it.
Version
The version provides information about the server in the following format. Each element is separated by the Delimiter (STX/0x02).
RCON Version Number | Game Version Number | Game Version String |
---|---|---|
004 | 5230 | Open Beta 5.23 |
The zeroes preceding the RCON version number are to maintain compatibility with previous version of RCON where there was not a delimiter between the version number and the game version string, and may be removed in the future. The RCON version number is base 10.
Authentication
The TypeID for authentication is 'a'. The message portion from the client is just the RCON/admin password for the server. The message portion from the server is the RCON client's connection ID, so that the RCON client can identify its own command executions from other clients. The sequence for authenticating is as follows:
- Client connects to Server
- Server sends version information
- Client sends authentication request
- Server replies with authentication success or an error
Once the client is authenticated, they may subscribe to the log stream and execute commands.
Subscribe & Unsubscribe
The message elements for both of these Type IDs are empty and ignored. Subscribe marks the stream to receive RCON logs, and Unsubscribe marks the stream to not receive RCON logs. The default state in unsubscribed; therefore, you will need to Subscribe after successful authentication in order to receive any log messages.
Commands
In addition to the following RCON commands, RCON clients can also execute console commands. Console commands do not return any useful output. Some RCON commands are not available when bIsCompetitive is true.
The message format for commands is the command; if there are any parameters to pass to the command's execution, you need to add a space character (0x20), followed by the string representing the parameters. Required parameters are marked as <Parameter>, and optional parameters are marked as [Parameter].
Player can be a portion of a player's name, a player's full name, pid<player's ID>, or Player<player's ID>.
Command | Parameters | Available with bIsCompetitive | Response | Description |
---|---|---|---|---|
Help | [Command] | True | List of commands if parameters is not empty, command-specific message otherwise | Provides a list of commands if no parameters are specified, a description of the specified command otherwise |
Kick | <Player> [Reason] | True | Nothing on success, error otherwise | Forcefully kicks a player from the server, and displays a kick message if specified |
Kill | <Player> | False | Nothing on success, error otherwise | Kills a player's pawn |
Logs
Most game events are logged, including everything from players joining/leaving to mines being placed/disarmed. Some logs are disabled when bIsCompetitive is true.
Format
Logs follow the following format:
- Token 0 is the primary header
- Token 1 is the secondary header
- Tokens beyond 1 depend entirely upon the primary and secondary headers
The '|' character in the following tables notates represents the Delimiter (STX/0x02). String constants in the parameters are surrounded by double quotes. Sections surrounded in [ Brackets ] indicate that these parameters may not always appear.
PLAYER
Player state changes and warnings are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Enter; | "from" | IP Address | "hwid" | "" | "nosteam" / <"steamid" | Steam ID> | A player entered the server; hwid may later be removed |
TeamJoin; | "joined" | Team [ | "left" | Old Team ] | A player joined a team |
HWID; | HWID | Reports a player's HWID |
Exit; | Player | A player left the server |
Kick; | "for" | Reason | A player was kicked |
NameChange; | "to:" | New Name | A player's name changed |
ChangeID; | New ID | "from" | Old ID | A player's Player ID changed |
Rank; | Rank | A player's leaderboard Rank has been assigned |
Dev; | "true" / "false" | A player has been marked as a Developer |
Command; | Command | A player executed an RCON command |
SpeedHack; | Player | A player has thrown a SpeedHack warning |
GAME
Game events are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Deployed; | Example | Example |
Disarmed; | Example | Example |
Exploded; | Example | Example |
ProjectileExploded; | Example | Example |
Captured; | Example | Example |
Neutralized; | Example | Example |
Purchase; | Example | Example |
Spawn; | Example | Example |
Crate; | Example | Example |
Death; | Example | Example |
Stolen; | Example | Example |
Destroyed; | Example | Example |
Donated; | Example | Example |
OverMine; | Example | Example |
MatchEnd; | Example | Example |
CHAT
Chat messages are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Say; | "said:" | Message | A player said something in public chat |
TeamSay; | "said:" | Message | A player said something in team chat |
Radio; | "said:" | Message | A player used a radio command |
AdminSay; | "said:" | Message | A player said something in the admin chat |
ReportSay; | "said:" | Message | A player said something to the administrators |
HostSay; | Message | Host said something in public chat |
VOTE
Votes are covered by this header. Team Type is either "GDI", "Nod", or "Global". It is theoretically possible for Team Type to be empty.
Secondary Header | Parameters | Description |
---|---|---|
Called; | Vote Type | "by" | Player [ | Parameters... ] | A vote has been started; see the table below for a list of parameters |
Results; | Vote Type | "pass" / "fail" | "Yes=" Total yes votes | "No=" Total no votes | A vote has ended with the following results |
Cancelled; | Vote Type | A vote was forcefully cancelled |
Vote Type | Called; Parameters | Description |
---|---|---|
Rx_VoteMenuChoice_AddBots | "GDI" / "Nod" / "Both" | "amount" | Number of bots | "skill" | Skill Level | Adds bots |
Rx_VoteMenuChoice_ChangeMap | Forcefully ends the game on success | |
Rx_VoteMenuChoice_Kick | Player | Kicks a player from the server |
Rx_VoteMenuChoice_MineBan | Player | Restricts a player from mining |
Rx_VoteMenuChoice_RemoveBots | "GDI" / "Nod" / "Both" | "amount" | Number of bots | Removes bots |
Rx_VoteMenuChoice_RetsartMap | Forcefully ends the game and restarts the level | |
Rx_VoteMenuChoice_Surrender | Forcefully ends the game as a loss for the team | |
Rx_VoteMenuChoice_Survey | Message | A survey with a user-specifiable message |
MAP
Changes to the level's state are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Changing; | "nonseamless" / "seamless" | Server is changing levels |
Loaded; | Map | Server finished loading a level |
Start; | Map | Match started |
DEMO
Demo recording state changes are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Record; | Player> / <"admin command by" | Player> / "rcon command" | A demo recording has started |
RecordStop; | A demo recording has stopped |
ADMIN
Events related to a player's administrator or moderator permissions are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Rcon; | "executed:" | Command | A player executed an RCON command |
Login; | "as" | Type = "moderator" / "administrator" | A player logged into administrative permissions |
Logout; | "as" | Type = "moderator" / "administrator" | A player logged out from administrative permissions |
Granted; | "as" | Type = "moderator" / "administrator" | A player was granted administrative permissions |
RCON
RCON events are covered by this header.
Secondary Header | Parameters | Description |
---|---|---|
Command; | "executed:" | Command | An RCON client executed a command |
Subscribed; | User | An RCON client subscribed to RCON logs |
Unsubscribed; | User | An RCON client unsubscribed from RCON logs |
Blocked; | Reason | An RCON client was blocked from connecting |
Connected; | User | An RCON client connected |
Authenticated; | User | An RCON client authenticated |
Banned; | "reason" | Reason | An RCON client was banned |
InvalidPassword; | User | An RCON client attempted to login with an incorrect password |
Dropped; | "reason" | Reason | An RCON client was dropped |
Disconnected; | User | An RCON client disconnected |
StoppedListen; | Reason | No further RCON clients can connect |
ResumedListen; | Reason | Additional RCON clients can now connect |
Warning; | Warning Message | An RCON-related warning string |
ERROR
This header is currently unused, but was used in previous versions of RCON and may be used again in the future.
Trivia
- RCON v3 used a non-breaking space (nbsp/0xA0) was the token deliminator despite it not being in the standard ASCII range. This lead to inconsistent results between servers, and was therefore replaced with the Start of Text character (STX/0x02) in RCON v4. In order to retain in-game readability of RCON output, the deliminator is replaced with a space before being displayed.