Network layer
From Zenitel Wiki
The network layer is responsible for message transport from a source device to a destination device, possibly via one or more transit nodes. It will also monitor broadcasts and discard messages that have been forwarded too many times (possibly going in loop). The network layer’s message header must always be included independent of which data link layer is used. Note that the header contains an <options> field, which need not be processed but your data receiver must advance the correct number of bytes.
Contents
AlphaCom Dataprotocol Networklayer header Format
The network layer message has the following format:
<source> <destination> <hopcountbyte> <options> <application data....>
where:
- <hopcountbyte>: UINT1 <options size> <hop counter>
- <option size> 3 upper bits (mask: 0xE0)
- The number of optional bytes in the following <options> field. External applications can normally set this byte to zero. External applications may receive messages with options from AlphaCom, so the option length field must be handled when parsing messages, but the contents of the <options> can normally be ignored.
- For backward compatibility reasons AMC always removes the <options> field when sending on a ISO1745 link. The hop-count/options fields are removed all together when sent on port 0 to AlphaPro.
- (AMC 06.xx does not support the <options> field, and ignores these three bits.)
- <hop counter> 5 lower bits (mask: 0x1F)
- A hop counter, counting the number of links that the message has traveled. The hop count (initially 0) is used for graceful handling of data routing configuration errors, by increasing it for every hop and discarding looping messages after 31 hops.
- <option size> 3 upper bits (mask: 0xE0)
- <options> The number of bytes is given by <hopcountbyte>. 0-7 bytes. See below.
The maximum size of a network layer message handled by AlphaCom is 64 bytes.
Netlayer options
The netlayer options are only used for inter-exchange routing, and can be ignored by external devices.
Two optional bytes are defined:
First UINT1 is a message sequence number. The sequence number is chosen by the sender, and must follow the message to the destination. The sequence number is used in order to handle broadcast messages between exchanges in AlphaNet. Sequence number set to zero means “no sequence number”.
Second UINT1 (if present) is uses as options flags:
Flagvalue | Description |
---|---|
0x01 | Message is Node broadcast message expanded to unicast |
0x02 | Force old-style node broadcast flooding, do not expand to multiple unicasts |
0x10 | Message is backtracking towards source from failed transit |
0x20 | Message has been rerouted to an alternative route at least once, diagnostics only |
Handling of Broadcast messages
Node broadcast (destination node = 255) is handled in two different ways.
- Before AMC 10.55 node broadcasts was done with "Flooding". A node node receiving a broadcast message, forwards the message to on all links to neighbor nodes (except to the incomming link). The neighbor nodes in turn does the same. Looping messages was dropped by the sequence number check described under.
- From AMC 10.55 AlphaCom multiplies a node-broadcast message by sending one unicast message addressed to every known node. (This change was done because with AlphaNet-over-IP, it is very common to connect every node to every other node in the AlphaNet, making the flooding algorithm very inefficient.)
- From AMC 10.61.1.5 such expanded messages are tagged with the "Message is Node broadcast message expanded to unicast " optional flag.
- From AMC 10.61.1.5 it is possible to force Flooded Broadcast by setting "Force old-style node broadcast flooding" optional flag.
Sequence numbers used for "Flooding Broadcast
When the AlphaCom message router receives a message addressed to a broadcast address, and the message does not have a sequence number, the router adds a nonzero sequence number to the message. Then the sequence number and the source address are stored in a message reference ring buffer with 20 elements, and the message is forwarded to all neighbour nodes.
When the AlphaCom message router receives a message addressed to a broadcast address, and the message does have a sequence number, the router searches the ring buffer in order find if the message is already forwarded. If the message reference is found, the message is discarded. Otherwise, the sequence number and the source address are stored in the ring buffer, and the message is forwarded to all neighbor nodes.