Module capsules_extra::net::thread::tlv

source ·
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:

  1. A child device multicasts a Parent Request MLE command.
  2. Each potential parent device on the network unicasts a Parent Response MLE command.
  3. The child device selects a parent based on a hierarchy of connectivity metrics and unicasts a Child ID Request MLE command.
  4. The selected parent unicasts a Child ID Response MLE command.

A TLV is comprised of three parts:

  1. Type - A one-byte TLV type number.
  2. Length - A one-byte number representing the length of the TLV value in bytes.
  3. 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§

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.

Functions§