Expand description
Versioned TLV serialization of ControllerState.
Layout (all members context-tagged):
root: Structure { C0: version(u8), C1: Array[fabric] }
fabric: Structure {
C0: fabric_id(uint), C1: ipk(bytes16), C2: rcac_cert(bytes,TLV),
C3: rcac_pkcs8(bytes), C4: commissioner(struct), C5: Array[device],
C6: Array[group_key_set] (optional — absent in v1 snapshots written
before group-key support; defaults to empty on read),
C7: outbound_group_counter(uint, optional — same default rule),
C8: Array[icd_registration] (optional — same default rule),
C9: icac_cert(bytes,TLV, optional — present only when the fabric has
an ICAC), C10: icac_pkcs8(bytes, optional — present iff C9 is)
}
commissioner: Structure { C0: node_id(uint), C1: op_pkcs8(bytes), C2: noc(bytes,TLV) }
device: Structure {
C0: node_id(uint), C1: peer_noc_public_key(bytes65),
C2: resumption_record(bytes, optional), C3: last_known_addr(utf8, optional),
C4: vendor_id(uint, optional), C5: product_id(uint, optional),
C6: label(utf8, optional) — all three additive/ICAC-style, absent means
`None`
}
group_key_set: Structure {
C0: key_set_id(uint), C1: epoch_key(bytes16), C2: epoch_start_time(uint)
}§Backward compatibility
Fabric-struct C6, C7, C8, C9, and C10 are optional tags: a v1 snapshot
without them (written by an older binary) still deserializes cleanly —
group_keys defaults to Vec::new(), outbound_group_counter to 0,
icd_clients to Vec::new(), and icac to None. C9/C10 are
themselves only written when a fabric has an ICAC, so a fabric without
one round-trips to byte-identical output regardless of ICAC support
existing in the binary.
Device-struct C4, C5, and C6 (vendor_id/product_id/label) follow the same
rule: they’re only written when the corresponding field is Some, and a
device struct without them deserializes to vendor_id/product_id/
label all None.
No version bump is needed for any of the above because the tag-keyed deserializer simply treats absent tags as defaults.
Constants§
- SNAPSHOT_
VERSION - Current snapshot schema version.
Functions§
- deserialize
- Deserialize a snapshot blob into
ControllerState. - serialize
- Serialize controller state into an opaque TLV blob.