Search documentation of snmpkit

# SnmpKit.SnmpLib.PDU.Constants (snmpkit v1.2.0)

Constants and type definitions for SNMP PDU operations.

This module contains all ASN.1 tags, error codes, type definitions, and utility functions used throughout the SNMP PDU system.

# Summary

## Types

base_pdu()
bulk_pdu()
error_status()
message()
msg_flags()
oid()
pdu()
pdu_type()
scoped_pdu()
snmp_type()
snmp_value()
snmp_version()
v1v2c_message()
v3_message()
varbind()

## Functions

bad_value()
counter32()
counter64()
data_type_to_tag(atom)
decode_msg_flags(arg)

Decodes SNMPv3 message flags from binary format.

default_max_message_size()
default_msg_flags(atom)

Creates default SNMPv3 message flags for a security level.

encode_msg_flags(map)

Encodes SNMPv3 message flags to binary format.

end_of_mib_view()
error_status_to_atom(code)

Converts an error status code to its atom representation.

error_status_to_code(code)

Converts an error status atom to its numeric code.

gauge32()
gen_err()
get_request()
get_response()
getbulk_request()
getnext_request()
integer()
ip_address()
no_error()
no_such_instance()
no_such_name()
no_such_object()
normalize_oid(oid)
normalize_type(type)

Normalizes an SNMP type atom.

normalize_version(v)
null()
object_identifier()
octet_string()
opaque_type()
pdu_type_to_tag(atom)
read_only()
set_request()
tag_to_data_type(arg1)
tag_to_pdu_type(arg1)
timeticks()
too_big()
usm_security_model()

# Types

# base_pdu()

    @type base_pdu() :: %{
      type: pdu_type(),
      request_id: non_neg_integer(),
      error_status: error_status(),
      error_index: non_neg_integer(),
      varbinds: [varbind()]
    }

# bulk_pdu()

    @type bulk_pdu() :: %{
      type: :get_bulk_request,
      request_id: non_neg_integer(),
      error_status: error_status(),
      error_index: non_neg_integer(),
      varbinds: [varbind()],
      non_repeaters: non_neg_integer(),
      max_repetitions: non_neg_integer()
    }

# error_status()

    @type error_status() :: 0..5

# message()

    @type message() :: v1v2c_message() | v3_message()

# msg_flags()

    @type msg_flags() :: %{auth: boolean(), priv: boolean(), reportable: boolean()}

# oid()

    @type oid() :: [non_neg_integer()] | binary()

# pdu()

    @type pdu() :: base_pdu() | bulk_pdu()

# pdu_type()

    @type pdu_type() ::
      :get_request
      | :get_next_request
      | :get_response
      | :set_request
      | :get_bulk_request

# scoped_pdu()

    @type scoped_pdu() :: %{
      context_engine_id: binary(),
      context_name: binary(),
      pdu: pdu()
    }

# snmp_type()

    @type snmp_type() ::
      :integer
      | :octet_string
      | :null
      | :object_identifier
      | :counter32
      | :gauge32
      | :timeticks
      | :counter64
      | :ip_address
      | :opaque_type
      | :no_such_object
      | :no_such_instance
      | :end_of_mib_view

# snmp_value()

    @type snmp_value() :: any()

# snmp_version()

    @type snmp_version() :: :v1 | :v2c | :v2 | :v3 | 0 | 1 | 3

# v1v2c_message()

    @type v1v2c_message() :: %{
      version: snmp_version() | non_neg_integer(),
      community: binary(),
      pdu: pdu()
    }

# v3_message()

    @type v3_message() :: %{
      version: 3,
      msg_id: non_neg_integer(),
      msg_max_size: non_neg_integer(),
      msg_flags: binary(),
      msg_security_model: non_neg_integer(),
      msg_security_parameters: binary(),
      msg_data: scoped_pdu()
    }

# varbind()

    @type varbind() :: {oid(), atom(), snmp_value()}

# Functions

# bad_value()

# counter32()

# counter64()

# data_type_to_tag(atom)

# decode_msg_flags(arg)

    @spec decode_msg_flags(binary()) :: msg_flags()

Decodes SNMPv3 message flags from binary format.

# default_max_message_size()

# default_msg_flags(atom)

    @spec default_msg_flags(atom()) :: msg_flags()

Creates default SNMPv3 message flags for a security level.

# encode_msg_flags(map)

    @spec encode_msg_flags(msg_flags()) :: binary()

Encodes SNMPv3 message flags to binary format.

# end_of_mib_view()

# error_status_to_atom(code)

    @spec error_status_to_atom(non_neg_integer()) :: atom()

Converts an error status code to its atom representation.

# error_status_to_code(code)

    @spec error_status_to_code(atom()) :: non_neg_integer()

Converts an error status atom to its numeric code.

# gauge32()

# gen_err()

# get_request()

# get_response()

# getbulk_request()

# getnext_request()

# integer()

# ip_address()

# no_error()

# no_such_instance()

# no_such_name()

# no_such_object()

# normalize_oid(oid)

# normalize_type(type)

    @spec normalize_type(atom()) :: snmp_type()

Normalizes an SNMP type atom.

# normalize_version(v)

# null()

# object_identifier()

# octet_string()

# opaque_type()

# pdu_type_to_tag(atom)

# read_only()

# set_request()

# tag_to_data_type(arg1)

# tag_to_pdu_type(arg1)

# timeticks()

# too_big()

# usm_security_model()