SnmpKit.SnmpLib.Types.Validation (snmpkit v2.0.1)
Range and shape validation for SNMP values (Counter32/64, Gauge32, TimeTicks, Unsigned32, INTEGER, OCTET STRING, OID, IpAddress, Opaque). SnmpKit.SnmpLib.Types delegates here.
Summary
Functions
Validates an SNMP integer value.
Validates an IP address value.
Validates an OCTET STRING value.
Validates an OBJECT IDENTIFIER value.
Validates an Opaque value.
@spec encode_value(term(), keyword()) :: {:ok, {snmp_type(), term()}} | {:error, atom()}
Functions
Validates an SNMP integer value.
SNMP INTEGER is a signed 32-bit integer.
Validates an IP address value.
IP address should be a 4-byte binary or a tuple of 4 integers.
Examples
:ok = SnmpKit.SnmpLib.Types.validate_ip_address(<<192, 168, 1, 1>>)
:ok = SnmpKit.SnmpLib.Types.validate_ip_address({192, 168, 1, 1})
{:error, :invalid_length} = SnmpKit.SnmpLib.Types.validate_ip_address(<<192, 168, 1>>)
Validates an OCTET STRING value.
OCTET STRING should be a binary with reasonable length limits.
Validates an OBJECT IDENTIFIER value.
OID should be a list of non-negative integers.
Validates an Opaque value.
Opaque is used for arbitrary binary data.
@spec encode_value(term(), keyword()) :: {:ok, {snmp_type(), term()}} | {:error, atom()}
@doc """ Validates a TimeTicks value.
TimeTicks represents time in hundredths of a second (centiseconds).