Expand description
BACnet ASN.1 tag encoding and decoding per ASHRAE 135-2020 Clause 20.2.1.
BACnet uses a tag-length-value (TLV) encoding with two tag classes:
- Application tags identify the datatype (Null=0, Boolean=1, …, ObjectIdentifier=12)
- Context tags identify a field within a constructed type (tag number = field index)
Tags also support opening/closing markers for constructed (nested) values.
Modules§
- app_tag
- Application tag numbers.
Structs§
- Tag
- A decoded BACnet tag header.
Enums§
- TagClass
- Tag class: application (datatype) or context (field identifier).
Constants§
- MAX_
CONTEXT_ NESTING_ DEPTH - Maximum nesting depth for context tags to prevent stack overflow from crafted packets.
Functions§
- decode_
tag - Decode a tag from
datastarting atoffset. - encode_
closing_ tag - Encode a context-specific closing tag into a growable buffer.
- encode_
closing_ tag_ to_ sink - Append a context closing marker and return its one- or two-byte length.
- encode_
opening_ tag - Encode a context-specific opening tag into a growable buffer.
- encode_
opening_ tag_ to_ sink - Append a context opening marker and return its one- or two-byte length.
- encode_
tag - Encode a tag header into the buffer.
- encode_
tag_ to_ sink - Append one tag header and return its byte count.
- extract_
context_ value - Extract raw bytes enclosed by a context opening/closing tag pair.
- extract_
raw_ context - Extract raw bytes enclosed by a context opening/closing tag pair WITHOUT parsing the enclosed content as BACnet tags.