SnmpKit.SnmpLib.MIB.Registry (snmpkit v0.6.4)
Standard SNMP MIB registry with name/OID resolution functions.
Provides the standard SNMP MIB objects and core resolution functionality that can be used by any SNMP application (managers, simulators, etc.).
Summary
Functions
Find direct children of a parent OID.
Resolve a MIB name to an OID list. Handles instance notation like "sysDescr.0".
Reverse lookup an OID to get the MIB name. Handles partial matches and instances.
Get the standard MIB registry map.
Get the reverse lookup map (OID -> name).
Walk the MIB tree from a root OID.
Functions
Find direct children of a parent OID.
Examples
iex> SnmpKit.SnmpLib.MIB.Registry.children([1, 3, 6, 1, 2, 1, 1])
{:ok, ["sysContact", "sysDescr", "sysLocation", "sysName", "sysObjectID", "sysServices", "sysUpTime"]}
Resolve a MIB name to an OID list. Handles instance notation like "sysDescr.0".
Examples
iex> SnmpKit.SnmpLib.MIB.Registry.resolve_name("sysDescr.0")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1, 0]}
iex> SnmpKit.SnmpLib.MIB.Registry.resolve_name("sysDescr")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1]}
iex> SnmpKit.SnmpLib.MIB.Registry.resolve_name("unknownName")
{:error, :not_found}
Reverse lookup an OID to get the MIB name. Handles partial matches and instances.
Examples
iex> SnmpKit.SnmpLib.MIB.Registry.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1, 0])
{:ok, "sysDescr.0"}
iex> SnmpKit.SnmpLib.MIB.Registry.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1])
{:ok, "sysDescr"}
Get the standard MIB registry map.
Get the reverse lookup map (OID -> name).
Walk the MIB tree from a root OID.
Examples
iex> SnmpKit.SnmpLib.MIB.Registry.walk_tree([1, 3, 6, 1, 2, 1, 1])
{:ok, [{"sysDescr", [1, 3, 6, 1, 2, 1, 1, 1]}, {"sysObjectID", [1, 3, 6, 1, 2, 1, 1, 2]}, ...]}