SnmpKit.SnmpMgr.MIB (snmpkit v0.6.6)
MIB compilation and symbolic name resolution.
This module provides MIB compilation using Erlang's :snmpc when available, and includes a built-in registry of standard MIB objects for basic operations.
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets the children of an OID node.
Compiles a MIB file using SnmpKit.SnmpLib.MIB pure Elixir implementation.
Compiles all MIB files in a directory using enhanced SnmpKit.SnmpLib.MIB capabilities.
Loads a compiled MIB file using SnmpKit.SnmpLib.MIB.load_compiled with fallback.
Loads and parses a MIB file, integrating it into the name resolution system.
Loads standard MIBs that are built into the library.
Gets the parent of an OID node.
Parses MIB content string using SnmpKit.SnmpLib.MIB.Parser.
Parses a MIB file to extract object definitions using SnmpKit.SnmpLib.MIB.Parser.
Resolves a symbolic name to an OID.
Enhanced MIB object resolution with parsed MIB data integration.
Performs reverse lookup from OID to symbolic name.
Starts the MIB registry GenServer.
Walks the MIB tree starting from a root OID.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets the children of an OID node.
Compiles a MIB file using SnmpKit.SnmpLib.MIB pure Elixir implementation.
Enhanced to use SnmpKit.SnmpLib.MIB for improved compilation with better error handling.
Examples
iex> SnmpKit.SnmpMgr.MIB.compile("SNMPv2-MIB.mib")
{:ok, "SNMPv2-MIB.bin"}
iex> SnmpKit.SnmpMgr.MIB.compile("nonexistent.mib")
{:error, :file_not_found}
Compiles all MIB files in a directory using enhanced SnmpKit.SnmpLib.MIB capabilities.
Loads a compiled MIB file using SnmpKit.SnmpLib.MIB.load_compiled with fallback.
Loads and parses a MIB file, integrating it into the name resolution system.
This combines compilation/loading with parsing for comprehensive MIB support.
Loads standard MIBs that are built into the library.
Gets the parent of an OID node.
Parses MIB content string using SnmpKit.SnmpLib.MIB.Parser.
Examples
iex> content = "sysDescr OBJECT-TYPE SYNTAX DisplayString ACCESS read-only STATUS mandatory"
iex> SnmpKit.SnmpMgr.MIB.parse_mib_content(content)
{:ok, %{tokens: [...], parsed_objects: [...]}}
Parses a MIB file to extract object definitions using SnmpKit.SnmpLib.MIB.Parser.
This provides enhanced MIB analysis without requiring compilation.
Examples
iex> SnmpKit.SnmpMgr.MIB.parse_mib_file("SNMPv2-MIB.mib")
{:ok, %{objects: [...], imports: [...], exports: [...]}}
Resolves a symbolic name to an OID.
Examples
iex> SnmpKit.SnmpMgr.MIB.resolve("sysDescr.0")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1, 0]}
iex> SnmpKit.SnmpMgr.MIB.resolve("sysDescr")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1]}
iex> SnmpKit.SnmpMgr.MIB.resolve("unknownName")
{:error, :not_found}
Enhanced MIB object resolution with parsed MIB data integration.
Leverages both standard MIBs and any loaded/parsed MIB files for comprehensive name resolution.
Performs reverse lookup from OID to symbolic name.
Examples
iex> SnmpKit.SnmpMgr.MIB.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1, 0])
{:ok, "sysDescr.0"}
iex> SnmpKit.SnmpMgr.MIB.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1])
{:ok, "sysDescr"}
Starts the MIB registry GenServer.
Walks the MIB tree starting from a root OID.