===================================================================== Rise Of Flight game Server Remote Console ===================================================================== Manual v.1.01, 27 October 2011, by Ilya Vilk ===================================================================== This document includes: 1. User-end description of Console-Server communication 2. API-style description of Console-Server communication ===================================================================== ===================================================================== I. User-end description of Console-Server communication Remote Console-Server part of Rise Of Flight consists of a DServer-server part, which is coded into the dserver.exe binary, and a remote-console part, which is a stand-alone application. Dserver part of console is not serving connections by default. To enable the DServer part of remote console you should add additional configuration lines to the "system" part of your dserver startup.cfg file: [KEY = system] rcon_ip = "127.0.0.1" rcon_port = 8991 rcon_start = 1 [END] Enter your server's ip adress in the rcon_ip parameter. You can change rcon_port parameter to the one that suits your firewall/server administration/etc. case, or leave it 8991, which is default. When you launch your dserver.exe with those values set in the config, you will see a message of a remote console status in dserver's output textarea. Error message report (Failed to start Remote Console service..) is generated in case of inability of the server part of a remote console to bind to the ip adress and port, which were set in the startup.cfg. Dserver part also generates messages in case of connect/disconnect of a remote client and executing remote client's commands. After a tcp connection established, the remote client can issue server commands, which are listed in the section II of the document. Server Remote Console has a base authentication mechanism, implemeted through the remote command routine. Before any other server command issued, remote client should execute "auth" command, specifying the login and password pair. This login-password pair must match the one which is specified in a dserver's startup.cfg file (not a dserver .dds file!) Otherwise, dserver will answer with a status 6 (RCR_ERR_AUTH_INCORRECT). For a complete list of return statuses refer to the section II of the document. Attention! Client-server communication is not encrypted at all (yet?..), so be sure to use safe communication channels. Login-password pair is also transmitted to a dserver in a plane-text format. II. API-style description of a Console-Server communication Client server communication is simple text protocol, based on a tcp-socket internet connection. Client sends text commands to the server, which are presented in a simple character strings, one command at a time. Client must wait for a current command execution, and get a command response from the server before sending another command to server. The command consists of its name and parameters, separated by space symbol. Each command has it's own number of parameters. The resolution command string for a command with two parameters must be generated as follows: command_name parameter1 parameter2 For a command with no parameters, it should be just command_name Thats it. That simple :) Commands, which sre sended to server, and responces, recieved from the serverver are nested into packets. Every packet should have a structure as follows: | length of data | data | | | | The string containing command or responce |00000000| | two bytes | length of string |one byte| So, in fact, the whole packet consists of two bytes, representing the length of data, and the data, which is a C-string (just chars, bytes), terminated with 0-byte. One command/responce is nested in one packet. So as you can see, the maximum packet data lendth is 64K (two bytes for data length). The server response is coded in a parameter=value pairs, which are joined together with a "&" symbol. Values are URL-encoded. So common response string looks like this: STATUS=1&console=some%20text%20of%20your%20console Full information about URL-encode algorythm you can get from the Net, for example here: http://en.wikipedia.org/wiki/Percent_encoding or here: http://www.w3schools.com/tags/ref_urlencode.asp The Value may also contain not just a simple text, but a List of records. This fact is also specified in a command responce description. Here is an example of a list representation: STATUS=1&someList=column1,column2,column3|some%20text,1.0,foo%21|some%20another%20text|2.0|bar%21 There is two records coded here. The first one is column1 = some text column2 = 1.0 column3 = foo! And another one: column1 = some another text column2 = 2.0 column3 = bar! The number of records (and the length of a rasoense at all) is limited to a command response buffer lengh. Now it is 64K :) Each responce string is nested into a packet, as described above. The full commands list is written below. To get more familiar with remote server commands and responces you can also study the way that Remote Console Client application generates command strings, and watch for a Dserver responces. cmd: mystatus (no parameters) response example: STATUS=1&authed=1 cmd: auth e-mail password response example: STATUS=1 cmd: getconsole response example: STATUS=1&console= cmd: getplayerlist response example: STATUS=1&playerList= playerList isnot defined when there is no players on the server, or a list of records with a columns: playerList=cId,profileId,playerId,name,ingameStatus,nServerPing| enum ingameStatus { PS_SPECTATOR=0, PS_LOBBY_READY, PS______NONE___, PS_DOGFIGHT_READY, PS_CRAFTSITE_READY } cmd: serverstatus response example: STATUS=1 cmd: kick cid/name/playerid/profileid value response example: STATUS=1 cmd: ban cid/name/playerid/profileid value response example: STATUS=1 cmd: banuser cid/name/playerid/profileid value response example: STATUS=1 cmd: unbanall response example: STATUS=1 cmd: serverinput translator_name response example: STATUS=1 cmd: sendstatnow response example: STATUS=1 cmd: cutchatlog response example: STATUS=1 cmd: chatmsg roomtype id Message to send response example: STATUS=1 roomtype 0 - All roomtype 1 - Client Id roomtype 2 - Coalition roomtype 3 - Country Server STATUS responses: RCR_OK=1, RCR_ERR_UNKNOWN=2, RCR_ERR_UNKNOWN_COMMAND=3, RCR_ERR_PARAM_COUNT=4, RCR_ERR_RECVBUFFER=5, RCR_ERR_AUTH_INCORRECT=6, RCR_ERR_SERVER_NOT_RUNNING=7, RCR_ERR_SERVER_USER=8, RCR_ERR_UNKNOWN_USER=9,