SnmpKit.MIB.Syntax (snmpkit v2.0.1)

Turns the syntax terms produced by the MIB grammar into a small description: base type, textual convention, DISPLAY-HINT and enumeration labels.

%{
  base: :integer,
  textual_convention: "RowStatus",
  display_hint: nil,
  enumerations: %{1 => "active", 2 => "notInService", ...}
}

The registry and the formatter use these descriptions to render values the way snmpwalk does: enumeration labels instead of numbers, MAC addresses from 1x: hints, dates from DateAndTime.

Summary

Functions

The SNMPv2-TC textual conventions built into the parser, by name.

Describes a syntax term. tc_map maps textual-convention names to descriptions (as built by textual_conventions/1) so references resolve.

Builds the textual-convention map for a parsed MIB: the built-in SNMPv2-TC conventions plus every TEXTUAL-CONVENTION and type assignment in definitions, each resolved through the conventions it derives from.

Types

description()

@type description() :: %{
  base: atom() | nil,
  textual_convention: String.t() | nil,
  display_hint: String.t() | nil,
  enumerations: %{required(integer()) => String.t()} | nil,
  size: {non_neg_integer(), non_neg_integer()} | nil
}

Functions

builtin_textual_conventions()

@spec builtin_textual_conventions() :: %{required(String.t()) => map()}

The SNMPv2-TC textual conventions built into the parser, by name.

describe(syntax, tc_map \\ %{})

@spec describe(term(), %{required(String.t()) => map()}) :: description()

Describes a syntax term. tc_map maps textual-convention names to descriptions (as built by textual_conventions/1) so references resolve.

textual_conventions(definitions)

@spec textual_conventions([map()]) :: %{required(String.t()) => map()}

Builds the textual-convention map for a parsed MIB: the built-in SNMPv2-TC conventions plus every TEXTUAL-CONVENTION and type assignment in definitions, each resolved through the conventions it derives from.