0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|0|1| Length | 6LoRH Type |D| TU| DTL | OTL | BinaryPt |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DT (variable length) | OTD(variable length)(optional)|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
Length (5 bits):
-
Length represents the total length of the Deadline-6LoRHE Type measured in octets.
-
6LoRH Type:
-
7 (See Section 7.)
-
D flag (1 bit):
-
The 'D' flag, set by the sender, qualifies the action to be taken when a 6LoWPAN Router (6LR) detects that the deadline time has elapsed.
If 'D' bit is 1, then the 6LR MUST drop the packet if the deadline time is elapsed.
If 'D' bit is 0, the packet MAY be forwarded on an exception basis, if the forwarding node is NOT in a situation of constrained resource, and if there are reasons to suspect that downstream nodes might find it useful (delay measurements, interpolations, etc.).
-
TU (2 bits):
-
Indicates the time units for DT and OTD fields. The encodings for the DT and OTD fields use the same time units and precision.
-
00
-
Time represented in seconds and fractional seconds
-
01
-
Reserved
-
10
-
Network ASN
-
11
-
Reserved
-
DTL (4 bits):
-
Length of the DT field as an unsigned 4-bit integer, encoding the length ofthe field in hex digits, minus one.
-
OTL (3 bits):
-
Length of the OTD field as an unsigned 3-bit integer, encoding the length of the field in hex digits. If OTL == 0, the OTD field is not present. The value of OTL MUST NOT exceed the value of DTL plus one.
For example, DTL = 0b0000 means the DT field in the 6LoRHE is 1 hex digit (4 bits) long. OTL = 0b111 means the OTD field is 7 hex digits (28 bits) long.
-
BinaryPt (6 bits):
-
If zero, the number of bits of the integer part the DT is equal to the number of bits of the fractional part of the DT. If nonzero, the BinaryPt is a (2's complement) signed integer determining the position of the binary point within the value for the DT. This allows BinaryPt to be within the range [-32,31].
-
If BinaryPt value is positive, then the number of bits for the integer part of the DT is increased by the value of BinaryPt, and the number of bits for the fractional part of the DT is correspondingly reduced. This increases the range of DT.
-
If BinaryPt value is negative, then the number of bits for the integer part of the DT is decreased by the value of BinaryPt, and the number of bits for the fractional part of the DT is correspondingly increased. This increases the precision of the fractional seconds part of DT.
-
DT Value (4..64 bits):
-
An unsigned integer of DTL+1 hex digits giving the DT value.
-
OTD Value (4..28 bits):
-
If present, an unsigned integer of OTL hex digits giving the origination time as anegative offset from the DT value.
Whenever a sender initiates the IP datagram, it includes the Deadline-6LoRHE along with other 6LoRH information. For information about the time-synchronization requirements between sender and receiver, see
Section 8.
For the chosen time unit, a compressed time representation is available as follows. First, the application on the originating node determines how many time bits are needed to represent the difference between the time at which the packet is launched and the deadline time, including the representation of fractional time units. That number of bits (say, N_bits) determines DTL as follows:
DTL = ((N_bits - 1) / 4)
The number of bits determined by DTL allows the counting of any number of fractional time units in the range of interest determined by DT and the OT. Denote this number of fractional time units to be Epoch_Range(DTL) (i.e., Epoch_Range is a function of DTL):
Epoch_Range(DTL) = 2
4*(DTL+1)
Each point of time between OT and DT is represented by a time unit and a fractional time unit; in this section, this combined representation is called a rational time unit (RTU). 1 RTU measures the smallest fractional time that can be represented between two points of time in the epoch (i.e., within the range of interest).
DT - OT cannot exceed 2
4*(DTL+1) == 16
DTL+1. A low value of DTL leads to a small Epoch_Range; if DTL = 0, there will only be 16 RTUs within the Epoch_Range (i.e., Epoch_Range(DTL) = 16
1) for any TU. The values that can be represented in the current epoch are in the range [0, (Epoch_Range(DTL) - 1)].
Assuming wraparound does not occur, OT is represented by the value (OT mod Epoch_Range), and DT is represented by the value (DT mod Epoch_Range). All arithmetic is to be performed modulo (Epoch_Range(DTL)), yielding only positive values for DT - OT.
In order to allow fine-grained control over the setting of the deadline time, the fields for DT and OTD use fractional seconds. This is done by specifying a binary point, which allocates some of the bits for fractional times. Thus, all such fractions are restricted to be negative powers of 2. Each point of time between OT and DT is then represented by a time unit (either seconds or ASNs) and a fractional time unit.
Let OT_abs, DT_abs, and CT_abs denote the true (absolute) values (on the synchronized timelines) for OT, DT, and current time. Let N be the number of bits to be used to represent the integer parts of OT_abs, DT_abs, and CT_abs:
N = {4*(DTL+1)/2} + BinaryPt
The originating node has to pick a segment size (2^N) so that DT_abs - OT_abs < 2^N, and so that intermediate network nodes can detect whether or not CT_abs > DT_abs.
Given a value for N, the value for DT is represented in the deadline-time format by DT = (DT_abs mod 2^N). DT is typically represented as a positive value (even though negative modular values make sense). Also, let OT = OT_abs mod 2^N and CT = CT_abs mod 2^N, where both OT and CT are also considered as non-negative values.
When the packet is launched by the originating node, CT_abs == OT_abs and CT == OT. Given a particular value for N, then in order for downstream nodes to detect whether or not the deadline has expired (i.e., whether DT_abs > CT_abs), the following is required:
Assumption 1: DT_abs - OT_abs < 2^N.
Otherwise the ambiguity inherent in the modulus arithmetic yielding OT and DT will cause failure: one cannot measure time differences greater than 2^N using numbers in a time segment of length less than 2^N.
Under
Assumption 1, downstream nodes must effectively check whether or not their current time is later than the DT -- but the value of the DT has to be inferred from the value of DT in the 6LoRHE, which is a number less than 2^N. This inference cannot be expected to reliably succeed unless
Assumption 1 is valid, which means that the originating node has to be careful to pick proper values for DTL and for BinaryPt.
Since OT is not necessarily provided in the 6loRHE, there may be a danger of ambiguity. Surely, when DT = CT, the deadline time is expiring and the packet should be dropped. However, what if an intermediate node measures that CT = DT+1? Was the packet launched a short time before arrival at the intermediate node, or has the current time wrapped around so that CT_abs - OT_abs > 2^N?
In order to solve this problem, a safety margin has to be provided, in addition to requiring that DT_abs - OT_abs < 2^N. The value of this safety margin is proportional to 2^N and is determined by a new parameter, called the "SAFETY_FACTOR". Then, for safety the originating node MUST further ensure that (DT_abs - OT_abs) < 2^N*(1-SAFETY_FACTOR).
Each intermediate node that receives the packet with the Deadline-6LoRHE must determine whether ((CT - DT) mod 2^N) > SAFETY_FACTOR*2^N. If this test condition is not satisfied, the deadline time has expired. See
Appendix A for more explanation about the test condition. All nodes that receive a packet with a Deadline-6LoRHE included MUST use the same value for the SAFETY_FACTOR. The SAFETY_FACTOR is to be chosen so that a packet with the Deadline-6LoRHE included will be tested against the current time at least once during every subinterval of length SAFETY_FACTOR*2^N. In this way, it can be guaranteed that the packet will be tested often enough to make sure it can be dropped whenever CT_abs > DT_abs. The value of SAFETY_FACTOR is specified in this document to be 20%.
Example: Consider a 6TiSCH network with time-slot length of 10 ms. Let the time units be ASNs (TU == (binary)0b10). Let the current ASN when the packet is originated be 54400, and the maximum allowable delay (max_delay) for the packet delivery be 1 second from the packet origination, then:
deadline_time = packet_origination_time + max_delay
= 0xD480 + 0x64 (Network ASNs)
= 0xD4E4 (Network ASNs)
Then, the Deadline-6LoRHE encoding with nonzero OTL is:
DTL = 3, OTL = 2, TU = 0b10, BinaryPt = 8, DT = 0xD4E4, OTD = 0x64