Tpserver-cpp/Admin
From Thousand Parsec Wiki
The remote administration project intends to remove the internal console from tpserver-cpp and replace it with a protocol which can be accessed by administration clients in a variety of useful ways. This is being developed for Google Summer of Code 2008 by Aaron Mavrinac / ezod.
Contents |
Plan
Functional Milestones
- 2008-05-25: protocol specification document - complete
- 2008-06-02: tpserver-cpp will accept administration connections - complete
- 2008-06-02: tpserver-cpp will log to administration clients - complete
- 2008-06-06: tpserver-cpp will respond to requests for command lists and descriptions - complete
- 2008-06-13: tpserver-cpp will start as a daemon by default - complete
- 2008-06-20: tpserver-cpp will accept basic command set - complete
- 2008-06-20: tpadmin-cpp client will be able to connect to tpserver-cpp - complete
- 2008-06-27: tpadmin-cpp client will support command frames - complete
- 2008-07-07: tpserver-cpp will implement full command set - complete
- 2008-07-14: libtpproto-py will include a partial admin client - complete
Planned Clients
- Main CLI client, written in C++, based on a minimal libtpproto-cpp.
- Single-player mode wizard in tpclient-pywx, based on libtpproto-py (currently does not use administration protocol).
- Main GUI client, written in Python, based on libtpproto2-py.
Procedure
- Write a full administration protocol specification.
- Create
AdminTcpSocket,AdminConnection, andAdminTcpConnectionobjects. - Implement the protocol in the
AdminConnectionobject. - Create the main CLI client.
- Remove
Consoleobject and all associated code. - Daemonize the server and make a different logging option default.
- Remove libtprl dependency from packages.
Administration Protocol Extension
Overview
The administration client will connect and authenticate in a manner similar to the game protocol. Once connected, it may receive log messages and issue commands.
The main CLI client must store all available command descriptions locally (for command line verification, tab completion, etc.). It initially grabs the full current command set from the server upon a successful connection. After any operation which could result in new commands becoming available on the server, such as loading a ruleset, this local set must be updated.
Some command IDs are static and reserved for important server commands which all servers support. These include the commands which will be used by tpclient-pywx and other game clients to start a local server for single-player mode.
Summary
The following table contains both existing protocol frames and new administration-related frames (the latter are bold). The server must support all of these frame types and ignore others.
This protocol extension requires version 0.3 or greater of the TP protocol.
| Value | Name | Description | Base | Dir |
|---|---|---|---|---|
| Header Frame | any | |||
| Request Frame | Header | server | ||
| Response Frame | Header | client | ||
| 0 | Okay Frame | A request was successful in some sort of way. | Response | |
| 1 | Fail Frame | A request has failed in some sort of way. | Response | |
| 2 | Sequence Frame | Frame which says that there are multiple frames coming in response to the request. | Response | |
| 3 | Connect Frame | Request | ||
| 4 | Login Frame | Request | ||
| 1000 | Log Message Frame | Frame containing a log message to display at the client. | Header | client |
| 1001 | Command Update Frame | Frame instructing the client to pull command set descriptions. | Header | client |
| Get With ID Frame | Used to get things (commands) using their IDs. | Request | ||
| Get ID Sequence Frame | Request | |||
| ID Sequence Frame | A sequence of IDs. | Response | ||
| 1002 | Get Command Description Frame | Gets a description for a single command. | Get With ID | |
| 1003 | Command Description Frame | Frame describing a command. | Response | |
| 1004 | Get Command Description IDs Frame | Gets a sequence of active commands available on this server. | Get ID Sequence | |
| 1005 | List of Command Description IDs Frame | ID Sequence | ||
| 1006 | Command Frame | Issues a command to the server. | Request | |
| 1007 | Command Result Frame | Response frame with the result of the command. | Response |
Testing
You can test remote administration using the following procedure:
- Clone and compile the 'config' branch of the tpserver-cpp repository.
- Clone and compile the 'config' branch of the libtpproto-cpp repository.
- Clone and compile the tpadmin-cpp repository, linking against the above libtpproto-cpp (also requires libtprl).
- Run an instance of the above tpserver-cpp as normal (use the -d switch for non-daemon operation).
- Run tpadmin-cpp.
- Type 'open localhost' (or replace 'localhost' with the host running tpserver-cpp).
- Type 'login admin admin' (or other admin password, if specified).
- Type 'help' to get a list of local and server commands.
- Type 'quit' and close the server when finished.
If you find any bugs, please send a detailed description to ezod.
