RCGI Summary


RCGI provides a standard method of invoking scripts and programs using TCP. This appendix describes the protocol components and directives.

RCGI Components

The RCGI protocol establishes a conversation between an RCGI client and an RCGI server. The client and the server converse using lines of 7-bit ASCII text terminated with either CR+LF or LF.

Environment variables are 7-bit ASCII strings terminated by the "=" character. Values are 7-bit ASCII strings terminated by either CR+LF or LF.

Directives are not case sensitive and must begin at the first character of each input line. Some directives require space-separated arguments.

The server responses have the following syntax:

<responsecode> space <descriptivetext>

Response codes can be grouped by their values:

The server responds to every directive.

Directives

Commands are sent to the server as directives that force the server connection through a set of simple states. This section describes the five directives: ENV, CMD, INPUT, PORT, and END.

ENV

The ENV directive marks the beginning of the transmission of environment variables. This command has the form:

ENV

Environment variables are sent in {variable-value} tuples, one per line. The list is terminated by a single line containing a period.

CMD

The CMD directive sends commands and arguments. The syntax of this directive is

CMD <commandpath> <arguments>

The command, with a full or partial path, is sent along with optional arguments. The RCGI protocol does not interpret the command, its path information, or the argument information. It assumes that the information is printable 7-bit ASCII text.

INPUT

The INPUT directive marks the beginning of input transmission. This directive has the form

INPUT

If the command requires input (STDIN), line-by-line based input can be supplied using the "INPUT" directive. Input lines are fed to the command one by one until input is terminated. The line-by-line input is terminated by a single line containing a period.

PORT

The PORT directive specifies the port for the input/output session. The syntax of this directive is

PORT <numericportnumber>

Alternately, input and output for a command can be specified by another TCP session. The PORT directive specifies the TCP port number on which the server will open a session back to the client.

END

The END directive executes a command. This directive has the form

END

The END directive informs the server that no further input is coming from the client side. This does not close down the session, but instead signals the server that the STDIN has reached an EOF.