Changes between Initial Version and Version 1 of ringtocoax


Ignore:
Timestamp:
03/18/12 18:58:02 (9 years ago)
Author:
branden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ringtocoax

    v1 v1  
     1[[PageOutline]] 
     2 
     3= [wiki:Earthworm Earthworm] Module: ringtocoax = 
     4'''Contributed by: ''' 
     5 
     6== Function == 
     7Reads EARTHWORM messages from shared memory and broadcasts them onto Ethernet 
     8 
     9== Details == 
     10Program to broadcast Earthworm messages from a shared memory transport ring onto Ethernet. Messages may be of any installation id, message type, and module id. To prevent bursty data on the Ethernet, the program sleeps between outgoing packets. A parameter in the configuration file controls whether heartbeat and error messages are passed or blocked. If heartbeats and error messages are not sent, they should be handled by a local copy of the statmgr program. 
     11 
     12This module does connection-less broadcasts. In normal usage, it broadcasts onto an isolated, dedicated class b subnet. There must be no routing to or from that subnet. The broadcast is restricted to the subnet specified in the configuration file. Note that the companion module, coaxtoring, has strange system-specific addressing requirements. 
     13 
     14 
     15On startup, ringtocoax reads the configuration file named on the command line. Commands in this file set up all parameters used in reading Earthworm messages from shared memory and broadcasting them onto ethernet as UDP packets. In the control file, lines may begin with a valid ringtocoax command (listed below) or with one of 2 special characters: 
     16{{{ 
     17#  marks the line as a comment (example: # This is a comment). 
     18 
     19@  allows control files to be nested; one control file can be 
     20   accessed from another with the command "@" followed by 
     21   a string representing the path name of the next control file 
     22   (example: @model.d). 
     23}}} 
     24 
     25Command names must be typed in the control file exactly as shown in this document (upper/lower case matters!). 
     26 
     27=== EXAMPLE CONFIGURATION FILE === 
     28{{{ 
     29 # 
     30# This is ringtocoax's parameter file 
     31# 
     32# This program gets earthworm messages from a transport ring and broadcasts 
     33# them to ethernet. 
     34# 
     35#       *** WARNING *** 
     36#       This module does connection-less broadcasts. 
     37#       In normal usage, it broadcasts onto an isolated, dedicated class b 
     38#       subnet. There must be no routing to or from that subnet. 
     39#       The broadcast is restricted to that subnet as stated below. 
     40#       Note that the companion module, coaxtoring, has strange 
     41#       system-specific addressing requirements 
     42 
     43MyModName         MOD_RINGTOCOAX  # Module id for this instance of ringtocoax 
     44RingName          WAVE_RING       # Shared memory ring for input/output 
     45LogSwitch         1               # 0 to completely turn off disk log file 
     46HeartBeatInterval 15              # Seconds between heartbeats 
     47MsgMaxBytes       4096            # Size of biggest message to be sent 
     48OutAddress        192.168.4.255   # IP address of net to broadcast to. 
     49                                  # Set the node number to 255 
     50                                  # eg. OutAddress    192.168.4.255 
     51OutPortNumber     2025            # Note: Under Solaris, if the port number 
     52                                  # is at or below 1024, 
     53                                  # ringtocoax must run as root. 
     54MaxLogo           256             # Maximum number of logos we can handle 
     55                                  # Set to a number >= 0 
     56ScrnMsg           1               # If 1, print message logos on screen 
     57                                  #    0, don't print logos. 
     58CopyStatus        1               # If 1, broadcast heartbeat and errors msgs. 
     59                                  #    0, don't broadcast them. 
     60BurstInterval     10              # Sleep this many msec between bursts 
     61BurstCount        4               # Number of UDP packets per burst 
     62SqrtCount         2000            # Number of square roots between packets within a burst. 
     63 
     64# List each logo that you want to broadcast in a BroadcastLogo command. 
     65# If the BroadcastLogo command is omitted, all messages in RingName will 
     66# be shipped. 
     67#               installation   module_id     message_type 
     68#               ------------   ---------     ------------ 
     69BroadcastLogo   INST_WILDCARD  MOD_WILDCARD  TYPE_TRACEBUF 
     70}}} 
     71 
     72=== FUNCTIONAL COMMAND LISTING === 
     73Below are the commands recognized by ringtocoax, grouped by the function they influence. All of the commands are required; they must be specified in the control file in order for ringtocoax to operate. 
     74{{{ 
     75         Earthworm system setup: 
     76                HeartBeatInterval       required 
     77                MyModName               required 
     78                RingName                required 
     79 
     80        Network Information: 
     81                OutAddress              required 
     82                OutPortNumber           required 
     83 
     84        Message Handling: 
     85                CopyStatus              required 
     86                MaxLogo                 required 
     87                MsgMaxBytes             required 
     88                BurstInterval           required 
     89                BurstCount              required 
     90                SqrtCount               required 
     91                BroadcastLogo 
     92 
     93        Output Control: 
     94                ScrnMsg                 required 
     95                LogSwitch               required 
     96}}} 
     97 
     98=== ALPHABETIC COMMAND LISTING & DESCRIPTION === 
     99In the following section, all configuration file commands are listed in alphabetical order. Listed along with the command (bold-type) are its arguments (in red), the name of the subroutine that processes the command, and the function within the module that the command influences. A detailed description of the command and is also given. Default values and example commands are listed after each command description. 
     100 
     101The following list is organized by: 
     102 
     103command [argument here] 
     104 
     105 
     106'''!BroadcastLogo [instid  modid  msgtype]'''[[BR]] 
     107Processed by: ringtocoax_config[[BR]] 
     108Function: msg handling 
     109 
     110Specifies one message logo (instid, modid, and msgtype) to read from the shared memory region (named in the "!RingName" command) and to broadcast onto ethernet. The instid must be a valid string in earthworm.h; modid and msgtype must be valid strings in earthworm.d. List one logo per "!BroadcastLogo" command, and use as many commands as needed. If msgtype is TYPE_HEARTBEAT or TYPE_ERROR, be sure that the !CopyStatus value is non-zero. If no "!BroadcastLogo" command is given, ringtocoax defaults to broadcasting all messages in the designated shared memory region. 
     111{{{ 
     112Example:  BroadcastLogo INST_MENLO MOD_WILDCARD TYPE_TRACEBUF 
     113}}} 
     114 
     115'''!BurstCount [!BurstCount]'''[[BR]] 
     116Processed by: ringtocoax_config[[BR]] 
     117Function: msg handling 
     118 
     119Defines the number of UDP packets, !BurstCount, in a broadcast "burst". Three commands, "!BurstCount", "!SqrtCount", and "!BurstInterval", control the temporal spacing of UDP packets broadcast by ringtocoax. Ringtocoax broadcasts messages in groups of !BurstCount packets; between the packets within a "burst", ringtocoax loops thru !SqrtCount square root calculations to waste a little time. After broadcasting a "burst" of packets, ringtocoax sleeps for !BurstInterval milliseconds, then it starts sending the next burst. The goal of spacing packets a tiny bit in time is to give the receiving program a better chance of catching every packet. 
     120 
     121UDP packets are variable in length up to a maximum of 1472 bytes (6 bytes of header, 1466 bytes of data). If an Earthworm message has a length less than or equal to 1466 bytes, it will be broadcast in a single UDP packet. If an Earthworm message is longer than 1466 bytes, it will be fragmented by ringtocoax, broadcast in multiple UDP packets, and reassembled by the receiving program (coaxtoring). Ringtocoax will never pack more than one Earthworm message in a single UDP packet. 
     122 
     123It is very important that the overall rate of broadcast is as at least as fast as the rate of local information production. For example, if your system produces 256 TYPE_TRACEBUF messages per second (464 bytes each = 1 UDP packet each), then the !BurstCount, !SqrtCount, and !BurstInterval commands should be configured such that ringtocoax will broadcast at least 256 UDP packets per second. System clock resolution must be considered when configuring the three commands, especially BurstInterval. As of April 1999, the time resolution of each sleep on Windows NT is about 16 msec (one clock tick). On Solaris, the resolution is about 10 msec. 
     124{{{ 
     125Default:  none 
     126Example:  BurstCount 3 
     127}}} 
     128 
     129'''!BurstInterval [!BurstInterval]'''[[BR]] 
     130Processed by: ringtocoax_config[[BR]] 
     131Function: msg handling 
     132 
     133Defines the minimum interval, in milliseconds, between "bursts" of UDP broadcasts. See the !BurstCount command for a detailed description of ringtocoax's broadcasting scheme. !BurstInterval must be a number greater than or equal to zero. Remember to consider the system clock resolution when configuring !BurstInterval. As of April 1999, the clock-tick resolution is about 16 msec on Windows NT, and about 10 msec on Solaris. 
     134{{{ 
     135Default:  none 
     136Example:  BurstInterval 10 
     137}}} 
     138 
     139'''!CopyStatus [!CopyStatus]'''[[BR]] 
     140Processed by: ringtocoax_config[[BR]] 
     141Function: msg handling 
     142 
     143Sets the !CopyStatus switch to control whether ringtocoax broadcasts TYPE_ERROR and TYPE_HEARTBEAT messages. If no "!BroadcastLogo" command is present, then ringtocoax will default to reading all messages in the shared memory region specified by the "!RingName" command. If !CopyStatus is non-zero, all of these messages will be broadcast onto ethernet. If !CopyStatus is 0, TYPE_HEARTBEAT and TYPE_ERROR will not be broadcast, but all other messages will. 
     144{{{ 
     145Default:  none 
     146Example:  CopyStatus 0 
     147}}} 
     148 
     149'''!HeartBeatInterval [nsec]'''[[BR]] 
     150Processed by: ringtocoax_config[[BR]] 
     151Function: Earthworm setup 
     152 
     153Defines the number of seconds nsec between TYPE_HEARTBEAT messages issued by ringtocoax. 
     154{{{ 
     155Default:  none 
     156Example:  HeartBeatInterval 15 
     157}}} 
     158 
     159'''!LogSwitch [switch]'''[[BR]] 
     160Processed by: ringtocoax_config [[BR]] 
     161Function: output 
     162 
     163Sets the on-off switch for writing a log file to disk. If switch is 0, no log file will be written. If switch is 1, ringtocoax will write a daily log file(s) called ringtocoaxxx.log_ccyymmdd where xx is ringtocoax's module id (set with "!MyModName" command) and ccyymmdd is the current UTC date (ex: 19990123) on the system clock. The file(s) will be written in the EW_LOG directory (environment variable). 
     164{{{ 
     165Default:  none 
     166}}} 
     167 
     168'''!MaxLogo [nlogo]'''[[BR]] 
     169Processed by: ringtocoax_config[[BR]] 
     170Function: msg handling 
     171 
     172Sets the maximum number, nlogo, of different message logos that ringtocoax can process. Ringtocoax assigns a sequence number (unsigned char) to each message based on its logo before it broadcasts the message. Space is allocated to store the last sequence number used for up to nlogo different logos. If the tracking arrays are full and ringtocoax gets a never-seen-before message logo from shared memory, ringtocoax will not broadcast that message, but it will issue a TYPE_ERROR message explaining the problem. 
     173{{{ 
     174Default:  none 
     175Example:  MaxLogo 256 
     176}}} 
     177 
     178'''!MsgMaxBytes [nbytes]'''[[BR]] 
     179Processed by: ringtocoax_config[[BR]] 
     180Function: msg handling 
     181 
     182Sets the size, in bytes, of the buffer that ringtocoax uses for storing Earthworm messages read from shared memory. nbytes should be the size of the largest message you expect ringtocoax to receive. If ringtocoax receives a message larger than nbytes, it will drop the entire message and issue a TYPE_ERROR message containing the string "too big for Buffer" and the logo of the dropped message. 
     183{{{ 
     184Default:  none 
     185Example:  MsgMaxBytes 51740 
     186}}} 
     187 
     188'''!MyModName [mod_id]'''[[BR]] 
     189Processed by: ringtocoax_config[[BR]] 
     190Function: Earthworm setup 
     191 
     192Sets the module id for labeling all outgoing heartbeat and error messages. mod_id is a character string (valid strings are listed in earthworm.d) that relates (in earthworm.d) to a unique single-byte number. All messages that ringtocoax receives from shared memory are tagged with their original logos when they are broadcast onto ethernet. 
     193{{{ 
     194Default:  none 
     195Example:  MyModName MOD_RINGTOCOAX 
     196}}} 
     197 
     198'''!OutAddress [a.b.c.d]'''[[BR]] 
     199Processed by: ringtocoax_config[[BR]] 
     200Function: network info 
     201 
     202Tells ringtocoax the TCP/IP address of the ethernet line onto which it should broadcast Earthworm messages. a.b.c.d is a character string in tcp/ip's standard dotted-decimal notation that ringtocoax uses along with the port number from the "!OutPortNumber" command to set up a socket to which it will broadcast UDP Datagram packets. By convention, all Earthworm broadcasts have the node ("d" part of address) set to 255 (for example a.b.c.255). 
     203{{{ 
     204Default:  none 
     205Example:  OutAddress 192.168.4.255 
     206}}} 
     207 
     208'''!OutPortNumber [port]'''[[BR]] 
     209Processed by: ringtocoax_config[[BR]] 
     210Function: network info 
     211 
     212Defines the well-known port number port to be used by ringtocoax for broadcasting. port is an integer that ringtocoax uses along with the address from the "OutAddress" command to set up a socket to which it will broadcast UDP Datagram packets.  
     213NOTE: The port number must be greater than 1024. Smaller port numbers require root permission. 
     214{{{ 
     215Default:  none 
     216Example:  OutPortNumber 2025 
     217}}} 
     218 
     219'''!RingName [ring]'''[[BR]] 
     220Processed by: ringtocoax_config[[BR]] 
     221Function: Earthworm setup 
     222 
     223Tells ringtocoax which shared memory region to use for input/output. ring is a character string (valid strings are listed in earthworm.d) that relates (in earthworm.d) to a unique number for the key to the shared memory region. All messages that ringtocoax reads from shared memory are tagged with their original logos when they are broadcast onto ethernet. 
     224{{{ 
     225Default:  none 
     226Example:  RingName WAVE_RING 
     227}}} 
     228 
     229'''!ScrnMsg [switch]'''[[BR]] 
     230Processed by: ringtocoax_config[[BR]] 
     231Function: output 
     232 
     233Sets a switch for writing messages to the screen. If switch is 1, a line is printed to the screen detailing the logo and the sequence number of each Earthworm message broadcast to ethernet. If switch is 0, no messages are written to the screen. 
     234{{{ 
     235Default:  none 
     236Example:  ScrnMsg 0 
     237}}} 
     238 
     239'''!SqrtCount [!SqrtCount]'''[[BR]] 
     240Processed by: ringtocoax_config[[BR]] 
     241Function: msg handling 
     242 
     243Defines the number of square root calculations ringtocoax performs between broadcasting each UDP packet of a "burst." See the !BurstCount command for a detailed description of ringtocoax's broadcasting scheme. !SqrtCount must be an integer greater than or equal to zero. 
     244{{{ 
     245Default:  none 
     246Example:  SqrtCount 2000 
     247}}} 
     248 
     249== Helpful Hints =='''