As the term is used in XLattice, a protocol is a set of message types and a set of rules governing the sequencing of the messages. We want to be able to describe protocols in abstract terms and to be able to register handlers for specific types or messages or groups of message types within a protocol.
Type-Length-Value Fields (Attributes)
A TLV is a common structure in messages consisting of a numeric type followed by the length of the value in bytes and then a byte array of that length. We shall implement two subtypes:
- a TLV8 in which the type and length are both unsigned bytes, 8-bit integers
- a TLV16 in which the type and length are both unsigned 16-bit integers