View Source snmpa_mib_storage behaviour (snmp v5.17)

Behaviour module for the SNMP agent mib storage.

This module defines the behaviour of the SNMP agent mib storage.

The mib storage is used by the agent to store internal mib- related information. The mib storage module is used by several entities, not just the mib-server.

A snmpa_mib_storage compliant module must export the following functions:

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

Summary

Callbacks: CALLBACK FUNCTIONS

Perform a backup of the mib-storage table.

Close the mib-storage table.

Delete an entire mib-storage table.

Delete a record from the mib-storage table.

Retrieve implementation dependent mib-storage table information.

Search the mib-storage table for record that match the specified pattern and then delete them. The records deleted are also returned.

Search the mib-storage table for record that match the specified pattern.

Create or open a mib storage table.

Read a record from the mib-storage table.

Synchronize the mib-storage table.

Return all records in the mib-storage table in the form of a list.

Write a record to the mib-storage table.

Types

Link to this type

mib_storage_fields()

View Source (since OTP R16B01)
-type mib_storage_fields() :: [atom()].
Link to this type

mib_storage_table_id()

View Source (since OTP R16B01)
-type mib_storage_table_id() :: term().
Link to this type

mib_storage_table_type()

View Source (since OTP R16B01)
-type mib_storage_table_type() :: set | bag.

Callbacks: CALLBACK FUNCTIONS

Link to this callback

backup(TabId, Dir)

View Source (since OTP R16B01)
-callback backup(TabId :: mib_storage_table_id(), Dir :: file:filename()) -> ok | {error, Reason :: term()}.

Perform a backup of the mib-storage table.

What this means, if anything, is implementation dependent.

Link to this callback

close(TabId)

View Source (since OTP R16B01)
-callback close(TabId :: mib_storage_table_id()) -> term().

Close the mib-storage table.

Link to this callback

delete(TabId)

View Source (since OTP R16B01)
-callback delete(TabId :: mib_storage_table_id()) -> snmp:void().

Delete an entire mib-storage table.

Link to this callback

delete(TabId, Key)

View Source (since OTP R16B01)
-callback delete(TabId :: mib_storage_table_id(), Key :: term()) -> ok | {error, Reason :: term()}.

Delete a record from the mib-storage table.

Link to this callback

info(TabId)

View Source (since OTP R16B01)
-callback info(TabId :: mib_storage_table_id()) -> Info :: term().

Retrieve implementation dependent mib-storage table information.

Link to this callback

info(TabId, Item)

View Source (since OTP R16B01)
-callback info(TabId :: mib_storage_table_id(), Item :: atom()) -> Info :: term().
Link to this callback

match_delete(TabId, Pattern)

View Source (since OTP R16B01)
-callback match_delete(TabId :: mib_storage_table_id(), Pattern :: ets:match_pattern()) ->
                          Recs :: [tuple()] | {error, Reason :: term()}.

Search the mib-storage table for record that match the specified pattern and then delete them. The records deleted are also returned.

Link to this callback

match_object(TabId, Pattern)

View Source (since OTP R16B01)
-callback match_object(TabId :: mib_storage_table_id(), Pattern :: ets:match_pattern()) ->
                          Recs :: [tuple()] | {error, Reason :: term()}.

Search the mib-storage table for record that match the specified pattern.

Link to this callback

open(Name, RecName, Fields, Type, Options)

View Source (since OTP R16B01)
-callback open(Name :: atom(),
               RecName :: atom(),
               Fields :: mib_storage_fields(),
               Type :: mib_storage_table_type(),
               Options :: list()) ->
                  {ok, TabId :: mib_storage_table_id()} | {error, Reason :: term()}.

Create or open a mib storage table.

Note that the RecordName and Fields arguments my not be used in all implementations (they are actually only needed for mnesia-based implementations).

Note also that the Options argument comes from the options config option of the mib-storage config option, and is passed on as is.

Link to this callback

read(TabId, Key)

View Source (since OTP R16B01)
-callback read(TabId :: mib_storage_table_id(), Key :: term()) -> false | {value, Record :: tuple()}.

Read a record from the mib-storage table.

Link to this callback

sync(TabId)

View Source (since OTP R16B01)
-callback sync(TabId :: mib_storage_table_id()) -> snmp:void().

Synchronize the mib-storage table.

What this means, if anything, is implementation dependent.

Link to this callback

tab2list(TabId)

View Source (since OTP R16B01)
-callback tab2list(TabId :: mib_storage_table_id()) -> [tuple()].

Return all records in the mib-storage table in the form of a list.

Link to this callback

write(TabId, Record)

View Source (since OTP R16B01)
-callback write(TabId :: mib_storage_table_id(), Record :: tuple()) -> ok | {error, Reason :: term()}.

Write a record to the mib-storage table.