snmpa_mib_data(3)

NAME
snmpa_mib_data - Behaviour module for the SNMP agent mib-server data module.

DESCRIPTION

This module defines the behaviour of the SNMP agent mib-server data module. A snmpa_mib_data compliant module must export the following functions:

    • new/1

    • close/1

    • sync/1

    • load_mib/4

    • unload_mib/4

    • lookup/2

    • next/3

    • register_subagent/3

    • unregister_subagent/2

    • which_mib/2

    • which_mibs/1

    • whereis_mib/2

    • dump/2

    • info/1

    • backup/2

    • code_change/4

The semantics of them and their exact signatures are explained below.

Note that the data extracted from the imported (loaded) mibs are stored partly by the mib-server and partly by the symbolic-store server. See the default mib-server data module, snmpa_mib_data_tttn for details.

DATA TYPES

filename() :: file:filename().
mib_view() :: [mib_view_elem()].
mib_view_elem() :: {SubTree :: snmp:oid(), Mask :: [non_neg_integer()], Inclusion :: mib_view_inclusion()}.
mib_view_inclusion() :: 1 | 2.
mib_view_mask() :: [non_neg_integer()].

CALLBACKS

backup(State, BackupDir)

    Perform a backup of the mib-server data.

    Note that its implementation dependent (and also dependent on mib-storage is used) if a backup is possible.
close(State)

    Close the mib-storage.
code_change(Direction, Vsn, Extra, State)

    Perform a code-change (upgrade or downgrade).

    See gen_server for more info regarding the Vsn and Extra arguments.
dump(State, Destination)

    Dump the mib-server data to stdio (Destination = io) or the specified file.
info(State)

    Retrieve misc info for the mib data.

    This is a utility function used to inspect, for instance, memory usage, in a simple way.
load_mib(State, FileName, MeOverride, TeOverride)

    Load the mib specified by the Filename argument into the mib-server. The MeOverride and TeOverride arguments specifies how the mib-server shall handle duplicate mib- and trap- entries.
lookup(State, Oid)

    Find the mib-entry corresponding to the Oid. If it is a variable, the Oid must be <Oid for var>.0 and if it is a table, Oid must be
new(MibStorage)

    Create a new mib-server data instance.
next(State, Oid, MibView)

    Finds the lexicographically next oid.
register_subagent(State, Oid, Pid)

    Register the subagent, process, handling part of the mib-tree.
sync(State)

    Synchronize (write to disc, if possible) the mib-server data. This depends on the mib_storage option, and will only have an effect if the mib-storage option has an actual disc component (such as dets, or ets with a file).
unload_mib(State, FileName, MeOverride, TeOverride)

    Unload the mib specified by the Filename argument from the mib-server. The MeOverride and TeOverride arguments specifies how the mib-server shall handle duplicate mib- and trap- entries.
unregister_subagent(State, PidOrOid)

    Unregister the subagent, handling part of the mib-tree, as specified by the oid() or pid/0 (PidOrOid).

    When unregister the subagent using an oid(), the pid/0 of the process handling the sub-tree is also returned.
whereis_mib(State, MibName)

    Retrieve the mib file for the mib.
which_mib(State, Oid)

    Retrieve the mib-file to which an given oid() belongs.
which_mibs(State)

    Retrieve all loaded mib-files.