librnd: remctrl_tcp plugin

The remctrl_tcp plugin provides a portable way for a Ringdove application to connect to a remote TCP server (typically on localhost) to be remote controlled. The most common use case is connecting to a project manager which then coordinates suite-level operations between different Ringdove applications.

The plugin can maintain multiple tcp connections. When a tcp connection is lost, the plugin attempts to reconnect periodically. If the environment variable PRJ_RND_PORT is set, it is a decimal integer port number and the plugin automatically connects to that port on localhost.

There is a line based plain text protocol on the tcp connection. Right after a connection opened, the plugin sends a hello message:

hello appname    version

There is a tab character between appname and version. The purpose of this message is to let the server software know who joined and how to treat it.

After the hello command the the protocol is plain action script with each line featuring a single action with the only other exception being the "bye" command.

When the plugin receives a line that reads bye, it removes the current connection and does not attempt to reconnect. This is used when the remote controller quits without bringing down the application.

Actions implemented

  • remctrl_tcp_req: send out one or more requests (action commands) to all active connections
  • remctrl_tcp_conn: create a new tcp connection
  • remctrl_tcp_del: closes and removes a tcp connection
  • remctrl_tcp_stat: print statistics on all currently registered tcp remote control connections