Automatic Repeat Request
ARQ Message Format
|
|
Reliable delivery of a message is accomplished by an automatic repeat request (ARQ) scheme. When a message is to be encoded for transmit, it is broken up into smaller chunks, typically of not more than 1000 bytes. Each chunk has a header applied to it, as seen in the table above, and is passed down to the next layer for further processing. If an ACK for an individual chunk is not received within a time-out period, typically 120 seconds, then the chunk is retransmitted. Chunks are retransmitted until the maximum retransmission limit is reached. This limit is typically 4, after which the message is considered to have failed.
The header for each chunk of an ARQ message is given by:
R#from#to#seq:part:total>
The leading "R
" indicates that the message is requesting reliable delivery.
from
is the unique station identifier of the sending node (also referred to as its MAC address).to
is the unique station identifier of the recipient node. The station identifiers can be any alphanumeric sequence made up of characters other than '#
'. There is no preset requirement on the length of station identifiers. The only requirement is that they be unique across the network.seq
is a unique message identifier. It must be an ASCII string of a numeric values, but there is no requirement that its value be related to the value used on any other messages. (i.e., it does not need to be sequential in relation to previous messages, despite its name). It must be unique across all messages sent from a source node to a destination node, but it is the same for all chunks of a given message. Note that in order to support the reinitialization of one node without requiring the restart of all other nodes, the sequence number should attempt to be unique for all time, not just unique to a given invocation of the software (i.e., initialize with a sufficiently diverse random value, or save state across restarts).part
indicates which chunk of the message follows.total
indicates the total number of chunks. Both are ASCII strings representing decimal numbers.- The "
>
"character indicates that it is an outgoing chunk.
Immediately following the header will be one chunk of message data. Message chunks are typically 1000 bytes long, but there is no requirement that the chunks be any particular size, or all the same size. The final chunk will typically be shorter than the previous ones, as the message is not padded to fill out a partial chunk.
When a reliable message addressed to a particular station is received from the radio by that station, the receiving station should indicate successful reception with the ACK message:
R#from#to#seq:part:total<
where seq
, part
, and total
are exactly as taken from the received message. The "<
" character indicates that the message is an ACK. No data should follow the ACK. (However, there may be multiple independent messages concatenated and sent, as detailed in the "Bit Framing" section.) The values for from
and to
are relative to the station sending the ACK. (i.e., they would be swapped from the message being ACKed.)
When a chunk of a reliable message is received, it should be buffered until all parts have been received. When all parts have been received, the entire message should be reassembled (without any ARQ headers), and passed up the stack for delivery. Message parts may arrive out of sequence. Individual parts may be received more than once. In either of these cases, the message should only be passed up exactly once, regardless of how many times various parts arrive.
In order to meet this requirement, it is necessary that a receiving station continue to keep a record of messages that have been received after the complete message has arrived and been passed up the stack. In the case where the ACKs are not properly received at the sending node, the sender may re-send the entire message multiple times, and despite multiple complete sets of chunks arriving, only one copy of the message should be passed up the stack.
If a message is not to receive reliable transport (i.e., SA message that are to be routinely resent), then the ARQ header should be 'U#
', to indicate unreliable delivery. When a message with a leading 'U#
' is received, the 'U#
' should be stripped off, and the message body should be immediately passed up the stack.
For example, if the message "hello" wishes to be sent reliably from station "a" to station "b", the sending station ("a") would transmit:
R#a#b#12:1:1>hello
with the corresponding hex dump:
52 23 61 23 62 23 31 32 3a 31 3a 31 3e 68 65 6c 6c 6f
In this case, the sequence number for this message is 12.
Upon receipt, station "b" would respond with:
R#b#a#12:1:1<
with the corresponding hex dump: 52 23 62 23 61 23 31 32 3a 31 3a 31 3c
and station "b" would pass the message up the stack, as it is complete.
If a reliable message arrives at any station other than the one to which it is addressed, it is discarded, no ACK is generated, and no message is passed up to higher layers.
If station "a" wanted to send the message "hello" unreliably, it would send:
U#hello
With the corresponding hex dump:
55 23 68 65 6c 6c 6f
As unreliable messages are all implicitly broadcast, there is no address specified. Upon receipt of the unreliable message, the receiving station(s) should pass the message up immediately, and no ACK is generated or sent. It should be noted that unreliable messages cannot be fragmented.