SnmpKit.SnmpSim.ValueSimulator.Counters (snmpkit v2.0.1)

Counter32/Counter64 wrap arithmetic (exact modulo 2^32 / 2^64), wrap prediction, device-specific wrap behaviour and discontinuity handling.

Summary

Functions

Simulate realistic counter wrap behavior with device-specific patterns. Different device types may handle wrap differently.

Check if a counter value is approaching its maximum and likely to wrap soon. Used to predict and prepare for counter wrap events.

Generate counter discontinuity events that occur during counter wraps. Some devices increment discontinuity counters when main counters wrap.

Calculate the time until counter wrap based on current increment rate. Returns estimated seconds until wrap occurs.

Functions

apply_counter_wrapping(value, type)

apply_device_specific_counter_behavior(value, type, device_type, config \\ %{})

Simulate realistic counter wrap behavior with device-specific patterns. Different device types may handle wrap differently.

counter_approaching_wrap?(value, type, threshold_percent \\ 0.95)

Check if a counter value is approaching its maximum and likely to wrap soon. Used to predict and prepare for counter wrap events.

handle_counter_discontinuity(old_value, new_value, discontinuity_counter)

Generate counter discontinuity events that occur during counter wraps. Some devices increment discontinuity counters when main counters wrap.

time_until_counter_wrap(current_value, increment_rate, type)

Calculate the time until counter wrap based on current increment rate. Returns estimated seconds until wrap occurs.