Odyssey Wire Protocols: JVM Request

This page describes the format of a JVM request. These arrive at the JVM on standard input, which is redirected from the .fifo FIFO in the connect directory. In the case of the server JVM, the input is expected to be nothing except a sequence of these records. In the case of the client and local JVMs, the input starts with an SSH connect key (OdysseyWireProtocolConnectKey) followed by a sequence of these records.

Introduction

There are actually 4 variations on the wire protocol depending on the JVM (client CGI, local, or main server), and in the case of the local JVM, depending on whether the request is a CGI or command-line request. Strings are represented as a sequence of non-zero bytes followed by a zero byte. Bytes with bit 7 cleared represent ASCII. Although the adapter programs do nothing to warrant more detail regarding the content of the strings, the only reasonable use for bytes with bit 7 set is to encode Unicode strings using UTF-8.

Detailed Record Format

Identification

In the case of webgate and cmdgate, where we are feeding requests into the "local" JVM, we start with a two-byte value that identifies the connection type, 0 for webgate and 1 for cmdgate.

Next always comes a string consisting of the log userid of the user making the request.

Then a four-byte value giving the process ID of the adapter. This is used for naming response FIFOs.

Request Contents

In the case of restart, we send the $REMOTEHOST, which is expected to be set by ssh. If it is not set, we send the string "**UNKNOWN**".

Alternatively, in the case of all the other adapters (not restart), we send the entire environment. We send each environment variable as a single string as found in envp, followed by an empty string to mark the end of the environment.

Next in the case of the Web adapters webgate and cgigate we send the POST data earlier read from standard input, if any. This is sent as a block of bytes consisting of exactly what was read from stdin with no delimiters of any kind. The environment contains the length of this block in $CONTENT_LENGTH. This environment variable is used to determine whether or not to read the POST data and how much to read, so the data sent here and the environment are guaranteed to agree.

Alternatively, in the case of cmdgate, we send the command-line parameters as a four-byte value indicating how many there are (argc), followed by the parameters as strings (argv).

To summarize:

  • restart: Originating hostname
  • webgate, cgigate: Environment, POST data
  • cmdgate: Environment, command line parameters

-- IsaacMorland - 16 Jan 2007

Topic revision: r1 - 2007-01-16 - IsaacMorland
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback