Expand description
The EN 50221 length_field — the ASN.1-style length used by every PDU at
the Transport, Session and Application layers — ETSI EN 50221 §7, Table 1
(PDF p. 11).
Coding:
- the first (MSB) bit is the
size_indicator; size_indicator == 0: the data-field length is the remaining 7 bits — any length0..=127fits in one byte;size_indicator == 1: the remaining 7 bits (length_field_size) code how many subsequent bytes carry the length, MSB-first. The spec caps any length at 65535, i.e. at most three length bytes.
The indefinite-length ASN.1 form is NOT used.
Constants§
- SIZE_
INDICATOR_ MASK - The
size_indicatorbit (the MSB of the firstlength_fieldbyte): set when the field is the multi-byte form.
Functions§
- decode
- Decode a
length_fieldfrom the front ofbytes. - encode_
into - Encode
valueas alength_fieldintobuf, returning the bytes written. - encoded_
len - Number of bytes
encode_intowill write forvalue.