Expand description
Implements Type-Length-Value (TLV) encoding and decoding as outlined in the Thread 1.1.1 Specification.
TLVs are used to serialize information exchanged during mesh link establishment (MLE). MLE is covered in Chapter 4.
MLE messages consist of a command type and a series of TLV parameters.
This module, as it stands, implements the minimum subset of TLVs required to support MLE for attaching a Sleepy End Device (SED) to a Thread network.
MLE for network attaching comprises a four-step handshake that works as follows:
- A child device multicasts a Parent Request MLE command.
- Each potential parent device on the network unicasts a Parent Response MLE command.
- The child device selects a parent based on a hierarchy of connectivity metrics and unicasts a Child ID Request MLE command.
- The selected parent unicasts a Child ID Response MLE command.
A TLV is comprised of three parts:
- Type - A one-byte TLV type number.
- Length - A one-byte number representing the length of the TLV value in bytes.
- Value - The TLV value.
For some TLVs, the TLV type number is shifted left by one to leave the least significant bit to denote whether information in the TLV value is stable. Stable network data is data that is expected to be stable over weeks or months (Section 5.14).
TLVs can be nested within a TLV value. Some types of Network Data TLVs, for example, contain sub-TLVs inside of their TLV value.
To simplify variable-length TLV value decoding in Rust, TLV values are assumed to have a maximum length of 128 bytes. This assumption is made only when a variable-length value must be decoded from network byte order before it can be interpreted correctly. Excluded from this case are variable-length values that contain data that must later be decoded by the caller before being interpreted (for example, sub-TLVs). Such a value is instead returned as a slice of the original buffer passed to the decode function.
Author: Mateo Garcia mateog@stanford.edu
Structs§
- Used in Border Router TLV.
- Used in Channel Mask TLV.
- Used in Has Route TLV.
Enums§
- Used in Border Router TLV value.
- Used in Mode TLV.
- Used in Scan Mask TLV.
- These TLVs are contained within the value of a Network Data TLV. See Section 5.18.
- Value encoded in the type field of a Network Data TLV. Gaps in type numbers are filled by PrefixSubTlv and ServiceSubTlv.
- These TLVs are contained within the value of a Pending Operational Dataset TLV or an Active Operational Dataset TLV. See Section 8.10.1.
- Value encoded in the type field of a Network Management TLV.
- Used in Connectivity TLV.
- These TLVs are contained within the value of a Prefix TLV.
- Value encoded in the type field of a Prefix sub-TLV. Gaps in type numbers are filled by NetworkDataTlv and ServiceSubTlv.
- Used in Security Policy TLV. See 8.10.1.15
- These TLVs are contained within the value of a Service TLV.
- Value encoded in the type field of a Service sub-TLV. Gaps in type numbers are filled by NetworkDataTlv and PrefixSubTlv.
- Type-Length-Value structure.
- Value encoded in the type field of a Type-Length-Value (TLV) structure.