Tpserver-cpp/Admin

From Thousand Parsec Wiki

Jump to: navigation, search

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

Procedure

  1. Write a full administration protocol specification.
  2. Create AdminTcpSocket, AdminConnection, and AdminTcpConnection objects.
  3. Implement the protocol in the AdminConnection object.
  4. Create the main CLI client.
  5. Remove Console object and all associated code.
  6. Daemonize the server and make a different logging option default.
  7. 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:

  1. Clone and compile the 'config' branch of the tpserver-cpp repository.
  2. Clone and compile the 'config' branch of the libtpproto-cpp repository.
  3. Clone and compile the tpadmin-cpp repository, linking against the above libtpproto-cpp (also requires libtprl).
  4. Run an instance of the above tpserver-cpp as normal (use the -d switch for non-daemon operation).
  5. Run tpadmin-cpp.
  6. Type 'open localhost' (or replace 'localhost' with the host running tpserver-cpp).
  7. Type 'login admin admin' (or other admin password, if specified).
  8. Type 'help' to get a list of local and server commands.
  9. Type 'quit' and close the server when finished.

If you find any bugs, please send a detailed description to ezod.

Personal tools