Channelization
Channelized Message Format
|
|
Messages from one Seriald to another are sent over virtual channels, allowing multiple logical data streams to be carried over a single serial connection. The channel is identified by a single byte prepended to the message, as seen in Figure 2 above. The channel with the identifier '0' (ASCII character 0x30) is used as the management channel for inter-node control communications. The channel with the identifier '1' (ASCII character 0x31) is designated as the CoT channel, and is expected to carry Cursor-on-Target messages exclusively. Other channels are treated as carrying opaque data, with no expectation as to their content. There are typically 5 user channels, designated as "CoT", "Chan2", "Chan3", "Chan4", and "Chan5", which use the channel tags "1", "2", "3", "4", and "5", respectively.
For example, if a station wishes to send the message "hello" on channel "3", it would send:
3hello
With the corresponding hex dump:
33 68 65 6c 6c 6f
There are currently two messages defined for the management channel. The first one is the "Comm Check" request, and the other is the corresponding "Comm Check" response. These messages are used to verify basic communication over the end-to-end communication system. The format of the Comm Check message is:
?seq#time#host
where:
seq
is a unique (usually monotonically increasing) sequence number. It can be any alphanumeric string not containing the character '#
'.time
is the current time at the sending station. It is usually expressed as an ASCII string representing the current time. in seconds since the epoch (1970-01-01T00:00:00.00Z); however, it may be expressed in any format desired by the sending station, as long as the representation does not contain the character '#'. This time value is not to be interpreted by other stations; it will be returned to the sending station for round trip time (RTT) calculation.host
is an identifier for the sending station. It is commonly the ASCII string returned by thegethostname(2)
system call, but it may be any sequence of bytes that does not contain the character '#'.
Upon receipt of a Comm Check request message, a station should change only the first character from a '?
' to a '!
' (to indicate a change from a request to a reply), and send the new message back out.
Upon receipt of a Comm Check reply, the host should use the contents of the time field to calculate a round trip time for the message.
If a station with a hostname of "foo" wishes to send its 12th Comm. Check at 2006-0316T17:03:38.00Z, the string passed to the layer below (including the leading "0" to indicate that it is a message on the management channel) would be:
0?12#1132528618.00#foo
with hex dump:
30 3f 31 32 23 31 31 33 32 35 32 38 36 31 38 2e 30 30 23 66 6f 6f
Upon receipt, any (and all) other station(s) would respond with:
0!12#1132528618.00#foo
with hex dump:
30 21 31 32 23 31 31 33 32 35 32 38 36 31 38 2e 30 30 23 66 6f 6f0