SnmpKit.MIB.Registry (snmpkit v2.0.1)

Static name/OID resolution over the built-in MIB table.

A process-free view of SnmpKit.MIB.Builtin.name_to_oid/0 — the same table that seeds SnmpKit.SnmpMgr.MIB — for callers that run without the registry process (SnmpLib on its own, compile-time tooling). It never sees MIBs loaded at runtime; use SnmpKit.SnmpMgr.MIB for those.

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.

The built-in name -> OID map (SnmpKit.MIB.Builtin.name_to_oid/0).

The reverse lookup map (OID -> name).

Walk the MIB tree from a root OID. The root itself is included when it is a named node.

Functions

children(parent_oid)

Find direct children of a parent OID.

Examples

iex> SnmpKit.MIB.Registry.children([1, 3, 6, 1, 2, 1, 1])
{:ok, ["sysContact", "sysDescr", "sysLocation", "sysName", "sysObjectID", "sysServices", "sysUpTime"]}

resolve_name(name)

Resolve a MIB name to an OID list. Handles instance notation like "sysDescr.0".

Examples

iex> SnmpKit.MIB.Registry.resolve_name("sysDescr.0")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1, 0]}

iex> SnmpKit.MIB.Registry.resolve_name("sysDescr")
{:ok, [1, 3, 6, 1, 2, 1, 1, 1]}

iex> SnmpKit.MIB.Registry.resolve_name("unknownName")
{:error, :not_found}

reverse_lookup(oid)

Reverse lookup an OID to get the MIB name. Handles partial matches and instances.

Examples

iex> SnmpKit.MIB.Registry.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1, 0])
{:ok, "sysDescr.0"}

iex> SnmpKit.MIB.Registry.reverse_lookup([1, 3, 6, 1, 2, 1, 1, 1])
{:ok, "sysDescr"}

standard_mibs()

The built-in name -> OID map (SnmpKit.MIB.Builtin.name_to_oid/0).

standard_mibs_reverse()

The reverse lookup map (OID -> name).

walk_tree(root_oid)

Walk the MIB tree from a root OID. The root itself is included when it is a named node.

Examples

iex> {:ok, [{"system", [1, 3, 6, 1, 2, 1, 1]}, {"sysDescr", [1, 3, 6, 1, 2, 1, 1, 1]} | _]} =
...>   SnmpKit.MIB.Registry.walk_tree([1, 3, 6, 1, 2, 1, 1])