SnmpKit.SnmpSim.Device.OidHandler (snmpkit v2.0.0)
OID handling and value generation for SNMP device simulation. Handles dynamic OID value generation, interface statistics, and MIB walking.
Summary
Functions
Extracts OID from SNMP PDU variable binding.
Extracts type and value from SNMP variable binding.
Gets dynamic OID value based on device state and OID.
Finds the next OID in lexicographic order for SNMP GetNext operations.
Gets OID value based on device state and OID.
Converts OID list to string representation.
Converts string OID to list of integers.
Walks OID values for SNMP MIB walking.
Functions
Extracts OID from SNMP PDU variable binding.
Parameters
varbind- SNMP variable binding containing OID and value
Returns
oid- Successfully extracted OID
Extracts type and value from SNMP variable binding.
Parameters
varbind- SNMP variable binding
Returns
{type, value}- Tuple containing SNMP type and value
Gets dynamic OID value based on device state and OID.
Parameters
oid- OID as stringstate- Device state containing configuration and counters
Returns
{:ok, {type, value}}- Successfully retrieved OID value with type{:error, reason}- Failed to retrieve OID value
Finds the next OID in lexicographic order for SNMP GetNext operations.
Parameters
oid- Starting OID as list of integersstate- Device state
Returns
{:ok, {next_oid, type, value}}- Next OID with its type and value{:error, :end_of_mib}- No more OIDs available
Gets OID value based on device state and OID.
Parameters
oid- OID as list of integers or binary stringstate- Device state containing configuration and counters or device type
Returns
{:ok, value}- Successfully retrieved OID value{:error, reason}- Failed to retrieve OID value
Converts OID list to string representation.
Parameters
oid- List of integers representing OID
Returns
- String representation of OID (e.g., "1.3.6.1.2.1.1.1.0")
Converts string OID to list of integers.
Parameters
oid_string- String representation of OID
Returns
- List of integers representing OID
Walks OID values for SNMP MIB walking.
Parameters
oid- Starting OID as list of integersstate- Device state
Returns
{:ok, oid_values}- List of OID values