/** \page guiServerProtocol guiServer Interface Protocol \brief Detailed description of the communications protocol used to drive DiFX via the guiServer. \tableofcontents The DiFX GUI controls DiFX using a network connection to the guiServer application running on the DiFX host. Effectively the GUI is only a visual front end - guiServer is where the actual control takes place. This document describes the network connection(s) and communication protocol that act between the DiFX GUI and guiServer - presumably any piece of software could exploit this interface and control DiFX externally. \section protocolConnecting Connecting GuiServer needs to be started on the DiFX "host". The host can be any machine that has access to the DiFX applications (vex2difx, mpifxcorr, etc.). The user that starts guiServer must be able to run these applications. Once start, guiServer maintains an open TCP server socket at a port specifed by:
Packet ID |
Integer (network byte order) |
A unique integer identifying the
packet |
Data bytes |
Integer (network byte order) |
Number of bytes that follow |
Data |
byte data (undefined order) |
Packet content |
Packet ID |
Int Value |
guiServer |
client |
Description |
\ref relayPacket "RELAY_PACKET" | 1 |
X |
X |
Turn on/off multicast relay, or relay
multicast packet to client |
\ref relayCommandPacket "RELAY_COMMAND_PACKET" | 2 |
X |
Broadcast XML to DiFX processes using
multicast |
|
\ref commandPacket "COMMAND_PACKET" | 3 |
X |
Send a command to guiServer
(usually to run a DiFX function) |
|
\ref informationPacket "INFORMATION_PACKET" | 4 |
X |
guiServer information for
client |
|
\ref informationPacket "WARNING_PACKET" | 5 |
X |
guiServer warning for client |
|
\ref informationPacket "ERROR_PACKET" | 6 |
X |
guiServer error for client |
|
\ref multicastSettingsPacket "MULTICAST_SETTINGS_PACKET" | 7 |
X |
Change the multicast settings for the
guiServer DiFX monitor |
|
\ref guiServerVersion "GUISERVER_VERSION" | 8 |
X |
X |
Request version information from guiServer
or report it to the client |
\ref guiServerDifxVersion "GUISERVER_DIFX_VERSION" | 9 |
X |
Report version of DiFX used to build guiServer |
|
\ref availableDifxVersion "AVAILABLE_DIFX_VERSION" | 10 |
X |
Report a version of DiFX software the
guiServer can use |
|
\ref difxBase "DIFX_BASE" | 11 |
X |
Base of DiFX software on the
host running guiServer |
|
\ref guiServerEnvironment "GUISERVER_ENVIRONMENT" | 12 |
X |
Environment variable accessible to guiServer |
|
\ref difxSetupPath "DIFX_SETUP_PATH" | 13 |
X |
Path to the "execute" script |
|
\ref startDifxMonitor "START_DIFX_MONITOR" | 14 |
X |
Start a guiServer thread to
monitor a job |
|
\ref difxRunLabel "DIFX_RUN_LABEL" | 15 |
X |
The "label" of the DiFX version that
should be used. |
|
\ref guiServerUser "GUISERVER_USER" | 16 |
X |
User that started guiServer |
\"getlogin()\"
function call.
\subsection availableDifxVersion AVAILABLE_DIFX_VERSION
This packet contains the name of a DiFX version that guiServer
has access to. There can be any number of these. The
values are found by guiServer through listing all files matching the name:
\verbatim[DIFX_BASE]/*/setup_difx.*\endverbatim
The names of the extensions
of the \"setup_difx.EXTENSION\"
files are assumed to be DiFX version
names.
\subsection guiServerEnvironment GUISERVER_ENVIRONMENT
This packet contains an environment variable, and its value,
separated by \"=\"
in a string. One of these packets is sent
by guiServer for each environment variable it has access
to.
\subsection difxSetupPath DIFX_SETUP_PATH
This packet contains the path to an "execution script" that is
used by guiServer to run DiFX functions. When guiServer
runs a DiFX program (as an example, use vex2difx), it
inserts this script in a system command as follows:
[DIFX_SETUP_PATH] vex2difx [ARGS]Note that the string used for the DIFX_SETUP_PATH can be anything you want - as long as it contains some method of executing the commands that follow it. The purpose of the DIFX_SETUP_PATH is to allow guiServer to execute different versions of DiFX. The execution script is used to source the proper setup file for the version (putting in place all of the correct values for environment variables), then execute the command. \subsection startDifxMonitor START_DIFX_MONITOR This packet tells guiServer to start a new thread containing a "DiFX monitor". The packet contains a port number (in string form) for a server port opened by the application sending the START_DIFX_MONITOR packet (e.g. the GUI). The DiFX monitor thread will immediately attempt to make a TCP client connection to the specified port (using the IP address the packet came from). When that is successful, an interactive session is started between the client (the thread) and the server that follows the same "packet protocol" described \ref protocolConnectionProtocol "above", but with a different set of packet IDs and functions:
Packet ID | Int Value | thread | server | Description |
MESSAGE | 0 |
|||
WARNING |
1 |
|||
ERROR |
2 |
|||
INPUT_FILE_PATH |
3 |
|||
CLOSE_CONNECTION |
4 |
|||
NUM_BASELINES |
5 |
|||
NUM_FREQUENCIES |
6 |
|||
BASELINE |
7 |
|||
FREQUENCY |
8 |
|||
NUM_SCANS |
9 |
|||
SCAN |
10 |
|||
TELESCOPE_1 |
11 |
|||
TELESCOPE_2 |
12 |
|||
CORRELATION_PRODUCTS |
13 |
|||
NUM_PHASE_CENTERS |
14 |
|||
PHASE_CENTER |
15 |
|||
NUM_PULSAR_BINS |
16 |
|||
PULSAR_BIN |
17 |
|||
NUM_POL_PRODUCTS |
18 |
|||
POL_PRODUCT |
19 |
|||
NEW_PRODUCT |
20 |
|||
AUTOCORRELATION |
21 |
|||
PRODUCT_REQUEST |
22 |
|||
START_PRODUCT_REQUEST |
23 |
|||
END_PRODUCT_REQUEST |
24 |
|||
VISIBILITY_DATA |
25 |
|||
AMPLITUDE_DATA |
26 |
|||
PHASE_DATA |
27 |
|||
LAG_DATA |
28 |
|||
END_VISIBILITY_BLOCK |
29 |
|||
JOB_NAME |
30 |
|||
OBS_CODE |
31 |
|||
SCAN_IDENTIFIER |
32 |
|||
SCAN_START_TIME |
33 |
|||
SCAN_END_TIME |
34 |
|||
SOURCE |
35 |
|||
SOURCE_RA |
36 |
|||
SOURCE_DEC |
37 |