|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
The SNMP serialization: ASN.1 Basic Encoding Rules over a caller buffer. More...
#include "protocore_config.h"Go to the source code of this file.
The SNMP serialization: ASN.1 Basic Encoding Rules over a caller buffer.
RFC 3417 sec 3.1: "Each instance of a message is serialized (i.e., encoded according to the convention of [BER]) onto a single UDP over IPv4 datagram, using the algorithm specified in Section 8." The encoding rules themselves are not an IETF RFC: they are ITU-T Recommendation X.690 (ISO/IEC 8825-1), which RFC 3417 cites as [BER].
RFC 3417 sec 8 states the two limits this codec is built to. Item (1): "When encoding the length field, only the definite form is used; use of the indefinite form encoding is prohibited. Note that when using the definite-long form, it is permissible to use more than the minimum number of length octets necessary to encode the length field." A constructed type therefore opens with a reserved 3-octet definite-long length that is back-patched at close, so no value is buffered and no octet is shifted. Item (2): simple types are encoded primitive, and the constructed form is used only for SEQUENCE.
The tags cover exactly what SNMP puts on the wire: the ASN.1 simple types, the SMIv2 application-wide types (RFC 2578 sec 7.1.5 through 7.1.10), the variable-binding exception markers and the context-specific PDU tags of the RFC 3416 sec 3 ASN.1.
Encoder and decoder both run over caller-provided fixed buffers, so the module holds nothing between calls and is unit-testable with no network stack under it.
Definition in file snmp_ber.h.