SnmpKit.SnmpSim.OIDTree (snmpkit v0.6.3)
Optimized OID tree for fast lookups and lexicographic traversal. Supports GETNEXT operations and GETBULK bulk retrieval.
Uses a radix tree structure optimized for OID operations with:
- Fast O(log n) lookups and insertions
- Efficient lexicographic traversal for GETNEXT
- Memory-efficient storage for 10K+ OIDs
- Optimized bulk operations
Summary
Functions
Perform a bulk walk operation starting from the given OID. Used for GETBULK operations with proper handling of non-repeaters and max-repetitions.
Check if the tree is empty.
Get the value for an exact OID match.
Get the next OID in lexicographic order (GETNEXT operation). Returns the next OID after the given OID, or :end_of_mib if no more OIDs exist.
Insert an OID with its value and behavior information into the tree. Maintains lexicographic ordering for efficient GETNEXT operations.
Get all OIDs in the tree in lexicographic order. Useful for debugging and full tree traversal.
Create a new empty OID tree.
Get the size of the tree (number of OIDs).
Functions
Perform a bulk walk operation starting from the given OID. Used for GETBULK operations with proper handling of non-repeaters and max-repetitions.
Examples
results = SnmpKit.SnmpSim.OIDTree.bulk_walk(tree, "1.3.6.1.2.1.2.2.1", 10, 0)
Check if the tree is empty.
Examples
empty? = SnmpKit.SnmpSim.OIDTree.empty?(tree)
Get the value for an exact OID match.
Examples
{:ok, value, behavior} = SnmpKit.SnmpSim.OIDTree.get(tree, "1.3.6.1.2.1.1.1.0")
:not_found = SnmpKit.SnmpSim.OIDTree.get(tree, "1.3.6.1.2.1.1.1.999")
Get the next OID in lexicographic order (GETNEXT operation). Returns the next OID after the given OID, or :end_of_mib if no more OIDs exist.
Examples
{:ok, next_oid, value, behavior} = SnmpKit.SnmpSim.OIDTree.get_next(tree, "1.3.6.1.2.1.1.1.0")
:end_of_mib = SnmpKit.SnmpSim.OIDTree.get_next(tree, "1.3.6.1.9.9.9.9.9")
Insert an OID with its value and behavior information into the tree. Maintains lexicographic ordering for efficient GETNEXT operations.
Examples
tree = SnmpKit.SnmpSim.OIDTree.new()
tree = SnmpKit.SnmpSim.OIDTree.insert(tree, "1.3.6.1.2.1.1.1.0", "System Description", nil)
Get all OIDs in the tree in lexicographic order. Useful for debugging and full tree traversal.
Examples
oids = SnmpKit.SnmpSim.OIDTree.list_oids(tree)
Create a new empty OID tree.
Examples
tree = SnmpKit.SnmpSim.OIDTree.new()
Get the size of the tree (number of OIDs).
Examples
size = SnmpKit.SnmpSim.OIDTree.size(tree)