Page Last Updated 7/31/2001
 Mimic
User Manual

Table of Contents

Synopsis
General
Remote Monitoring Facility
Critical-Message Notification

System Command

Environment Variables
File Formats

Log File
Critical Message File

Operator Interaction

Daemon Mode
Interactive Mode
Signal Handling

Periodic Cleanup



Mimic
User Manual

Synopsis

rmimic [serial [tcid [days [wdir [baud [port]]]]]]

emimic [serial [tcid [days [wdir [baud [port]]]]]]

General

Mimic presents dealing information on a serial line according to the specifications given by Reuters (TOF format, in the Dealing 2000 Datafeed User Guide Version 3.3) or EBS in the ASI specification (revision 12 - login modes P and N only). Mimic uses a deal store gathered, from a "real" Dealing 2000 or EBS server, by Genesis FX. The most recent 6,000 deals are stored and processed from the Genesis FX deal files that comprise the deal store. Mimic runs on any hardware and operating system that supports an ANSI C compiler.

The parameters for mimic are as follows:

serial the name of the device to be used to present the network protocol (e.g. /dev/ttya, COM1, etc.)

tcid a sequence of four alpha-numeric characters that uniquely identify this instance of mimic. This sequence should correspond to the TCID of the interface being mimed.

days the number of days to look into the past for deals.

wdir the path to the directory containing the corresponding Softek interface's ".dls" files.

baud this optional parameter, if present and set to either "fast" or "FAST", will cause the mimic serial port to be initialized to work at 19.2k baud. See DL_BAUD for another mechanism to activate this feature. Any string other than "fast" or "FAST" will be interpreted as a baud-rate number to be set. If the parameter cannot be decoded or the baud-rate is illegal, the parameter is ignored and the baud rate is set to the default 9600 (useful if the port parameter must be activated with a mimic working at the default 9600 baud).

port this optional parameter sets the TCP-IP port number or service port name on which the mimic will listen for connects for remote status requests. The default value for this parameter is 1603 for Reuters TOF and 1703 for EBS ASI. See DL_PORT for another mechanism to override the default port. This feature was introduced 7/20/2001.

Remote Monitoring Facility

Introduced 7/20/2001, this facility allows a remote user on the intranet to receive status information about what the mimic is currently doing. By default a Reuters TOF mimic listens for TCP-IP connections on port 1603 and an EBS ASI mimic listens for TCP-IP connections on port 1703. The port number may be controlled by program parameter or by environment variable if both mechanisms are used, the program parameter takes precedence over the environment variable. This facility may be disabled by setting a port value of "off", "OFF", or 0 (the number zero).

When a connection is established (e.g. via from a telnet command) the mimic logs the connection event, together with the connecting IP number and will then respond to specific (newline terminated) commands in real-time from this connection as follows:

QuitMe
The mimic terminates in an orderly fashion (note the mixture of upper and lower case characters in this command, to guard against accidental invocation). Use of this command together with the issuing IP number is logged prior to mimic shutdown. This remote command may be disabled with the use of the DL_REMOTEQUIT environment variable.

status
The mimic outputs one line of information down the same TCP-IP connection that issued the command as follows:

Now=t1, FirstDeal=n1, LastDeal=n2(received@t2), LastRequested=n3@t3, LastQueued=n4@t4, LastSerialCom=t5

where:

t1 is the time (in seconds) that the operating system executed the status request.

n1 is the number of the first (oldest) deal stored in the mimic's deal store. Zero if no deals are available.

n2 is the number of the last (most recent) deal stored in the mimic's deal store. Zero if no deals are available.

t2 was the operating system time (in seconds) when the oldest deal was read by this invokation of the mimic. Note, this time may not be associated with when the deal was actually done since the deal may be historic i.e. this invocation of the mimic may not have been running when the deal was placed in the deal store. Zero if no deals are available.

n3 is the number of the most recent deal requested by the TOF client of this mimic. Zero if no deals have been requested.

t3 was the operating system time (in seconds) that the TOF client of this mimic requested deal #n3. Zero if no deals have been requested.

n4 is the number of the deal most recently sent to the TOF client of this mimic. Zero if no deals have been sent.

t4 was the operating system time (in seconds) that deal n4 was sent to the TOF client of this mimic. Zero if no deals have been sent.

t5 was the operating system time (in seconds) of the last valid serial communication received from the TOF client. Zero if 2-way communication has yet to be established with the TOF client.

The time formats used in the above report may be formatted by setting the DL_REMOTEFORMAT environment variable to an appropriate value.

Closing the remote TCP-IP monitor connection does not affect the mimic.

Critical-Message Notification

System Command

Critical Messages are delivered by a “system” command which is driven by the environment variable DL_ECMD. The shell command specified in this variable is executed with a minimum granularity of 10 minutes and is passed any critical messages issued since the last time the command was executed. Unsent critical messages are stored in the file <TCID>.msg which is passed on the standard-input to the command in the DL_ECMD environment variable. The execution of this command is noted in the logfile (see later). To prevent unnecessary repetition of identical messages, critical messages stored in <TCID>.msg may be processed with “uniq” for example, as follows:
setenv DL_ECMD “(uniq -6 | cat > /dev/console)”
Each line in the <TCID>.msg file is timestamped and its process-origin is identified. <TCID>.msg is deleted each time after the command in DL_ECMD is executed.

To prevent short-term error conditions from producing “orphaned notifications” a 45 second delay is implemented for new batches of error notifications.

Environment Variables

The default behaviour for certain interface functions may be modified by the use of “environment variables”. These variables must be set prior to the interface execution (usually in a “shell” or “batch” file). Command parameters take precendence over equivalent environment variables. The environment variables, used by the interface, all (except one) start with “DL_” and are as follows:

DL_ECMD The command to be used to process critical (information and error) messages (including all arguments to run the command) is taken from this variable. The command must take its input from the “standard input” stream.
DL_WDIR The equivalent Softek interface “.dls” directory.
DL_MSGDIR The directory where transitory work files will be stored. Both critical messages and conversation details (Reuters only) make a temporary appearance in this directory.
DL_DAYS The number of days into the past from which this mimic will serve deals.
MMC_LOGDIR The directory that will be used to store the logfiles generated by this program. The prefix MMC is used in place of the usual DL prefix to allow mimic processes to coexist with GenesisFX processes which use the environment variable DL_LOGDIR.
DL_BAUD If this variable is set to the value "fast" or "FAST", the mimic serial port will be initialized to 19.2k baud otherwise, the value of this variable is interpreted as a number to which the baud-rate of the serial port is set. Use of this variable is superseded by the baud program argument.
DL_PORT Sets the TCP-IP port number or service port name on which the mimic will listen for connects for remote status requests. This value may be overridden by the use of a program parameter. A value of "off", "OFF", or 0 (zero) will completely disable TCP-IP connections to this program.
DL_REMOTEQUIT If this variable is present and set to "yes", "YES", "ON" or "on", the QuitMe remote command is available otherwise this remote command is disabled and its use (and denial) is logged as a critical message.
DL_REMOTEFORMAT If this variable is present and of non-zero length it is used as a strftime() template to all the times output by the remote status command. e.g. a value of:
"%D %T"

would output times in the format:

"07/31/01 15:16:03"

When this formatting option is enabled, reported events that have not yet happened are output as "never".

File Formats

Log File

A logfile named <tcid><mmdd>.log (where <TCID> is the string used as the first parameter to mimic and <mmdd> stands for the digits representing the month and day that the file was created) is appended to as log-events occur. All “critical messages” are logged.

If mimic is left running overnight, a new logfile is automatically created as soon as necessary after midnight.

Critical Message File

(UNIX and NT installations only, see “Critical-Message Notification” above)
The file <tcid><mmdd>.msg contains one line for each critical message. Each line comprises four sections:

  1. <application name>
  2. [<DateTime>]
  3. <a critical message>
  4. #<a critical message number>. Error numbers for the EBS mimic are in the 80,000 to 89,999 range, Error numbers for the R2k mimic are in the 70,000 to 79,999 range.

For Example:
mimic [Tue Nov 14 19:03:06 1995] Expected end of deal 3002, got start of deal 3003 #70501

Operator Interaction

Daemon Mode

The program automatically detects if it is to be run non-interactively. If the standard-input is closed during program execution or is redirected to /dev/null at startup, mimic stops reading the standard-input and stops delivering output to the standard-output and standard-error channels.

Interactive Mode

When the program is run in interactive mode, the following commands are available, all operating systems except MacOS and Windows NT require a <CR> to be appended for the command to be accepted:

q or Q quit the program gracefully
eof mimic enters Daemon Mode (see above).

Signal Handling

On UNIX operating systems, the program catches SIGINT, SIGHUP, and SIGTERM. When one of these signals is detected, the program exits cleanly, closing sockets and writing shutdown information to the logfile. A Critical Message is also generated. On MacOS, only SIGINT is caught, causing clean program termination. Under MSWindows, both SIGINT and SIGTERM receive this treatment.

On UNIX operating systems, SIGPIPE is caught and its passage is noted in the logfile.

Periodic Cleanup

Disk space is consumed according to the number of errors detected by mimic. Each day that mimic is executed, a new file (a log file) is created in the mimic execution directory. It is suggested that these files are archived and deleted from the drive every few months.