.TH snmpa_mib_data 3erl "snmp 5.13.5" "Ericsson AB" "Erlang Module Definition" .SH NAME snmpa_mib_data \- Behaviour module for the SNMP agent mib-server data module. .SH DESCRIPTION .LP This module defines the behaviour of the SNMP agent mib-server data module\&. A \fIsnmpa_mib_data\fR\& compliant module must export the following functions: .RS 2 .TP 2 * new/1 .LP .TP 2 * close/1 .LP .TP 2 * sync/1 .LP .TP 2 * load_mib/4 .LP .TP 2 * unload_mib/4 .LP .TP 2 * lookup/2 .LP .TP 2 * next/3 .LP .TP 2 * register_subagent/3 .LP .TP 2 * unregister_subagent/2 .LP .TP 2 * which_mib/2 .LP .TP 2 * which_mibs/1 .LP .TP 2 * whereis_mib/2 .LP .TP 2 * dump/2 .LP .TP 2 * info/1 .LP .TP 2 * backup/2 .LP .TP 2 * code_change/4 .LP .RE .LP The semantics of them and their exact signatures are explained below\&. .LP 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, \fIsnmpa_mib_data_tttn\fR\& for details\&. .SH "CALLBACK FUNCTIONS" .LP The following functions must be exported from a \fImib-server\fR\& data callback module: .SH EXPORTS .LP .B Module:new(Storage) -> State .br .RS .LP Types: .RS 3 Storage = mib_storage() .br State = term() .br .RE .RE .RS .LP Create a new mib-server data instance\&. .RE .LP .B Module:close(State) -> void() .br .RS .LP Types: .RS 3 State = term() .br .RE .RE .RS .LP Close the mib-storage\&. .RE .LP .B Module:sync(State) -> void() .br .RS .LP Types: .RS 3 State = term() .br .RE .RE .RS .LP Synchronize (write to disc, if possible) the mib-server data\&. This depends on the \fImib_storage\fR\& 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)\&. .RE .LP .B Module:load_mib(State, Filename, MeOverride, TeOverride) -> {ok, NewState} | {error, Reason} .br .RS .LP Types: .RS 3 State = NewState = term() .br Filename = filename() .br MeOverride = boolean() .br TeOverride = boolean() .br Reason = already_loaded | term() .br .RE .RE .RS .LP Load the mib specified by the \fIFilename\fR\& argument into the mib-server\&. The \fIMeOverride\fR\& and \fITeOverride\fR\& arguments specifies how the mib-server shall handle duplicate mib- and trap- entries\&. .RE .LP .B Module:unload_mib(State, Filename) -> {ok, NewState} | {error, Reason} .br .RS .LP Types: .RS 3 State = NewState = term() .br Filename = filename() .br Reason = not_loaded | term() .br .RE .RE .RS .LP Unload the mib specified by the \fIFilename\fR\& argument from the mib-server\&. .RE .LP .B Module:lookup(State, Oid) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = {variable, ME} | {table_column, ME, TEOid} | {subagent, SAPid, SAOid} | {false, Reason} .br Oid = TEOid = SAOid = oid() .br SAPid = pid() .br ME = me() .br Reason = term() .br .RE .RE .RS .LP Find the mib-entry corresponding to the \fIOid\fR\&\&. If it is a variable, the \fIOid\fR\& must be \&.0 and if it is a table, \fIOid\fR\& must be \&.\&.\&.\&. .RE .LP .B Module:next(State, Oid, MibView) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = false | endOfTable | {subagent, SAPid, SAOid} | {variable, ME, VarOid} | {table, TableOid, TableRestOid, ME} .br Oid = SAOid = VarOid = TableOid = TableRestOid = oid() .br SAPid = pid() .br ME = me() .br .RE .RE .RS .LP Finds the lexicographically next oid\&. .RE .LP .B Module:register_subagent(State, Oid, Pid) -> Reply .br .RS .LP Types: .RS 3 State = NewState = term() .br Reply = {ok, NewState} | {error, Reason} .br Oid = oid() .br Pid = pid() .br Reason = term() .br .RE .RE .RS .LP Register the subagent, process, handling part of the mib-tree\&. .RE .LP .B Module:unregister_subagent(State, PidOrOid) -> Reply .br .RS .LP Types: .RS 3 State = NewState = term() .br Reply = {ok, NewState} | {ok, NewState, Pid} | {error, Reason} .br PidOrOid = pid() | oid() .br Pid = pid() .br Reason = term() .br .RE .RE .RS .LP Unregister the subagent, handling part of the mib-tree, as specified by the \fIoid()\fR\& or \fIpid()\fR\& (\fIPidOrOid\fR\&)\&. .LP When unregister the subagent using an \fIoid()\fR\&, the \fIpid()\fR\& of the process handling the sub-tree is also returned\&. .RE .LP .B Module:dump(State, Destination) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = ok | {error, Reason} .br Destination = io | filename() .br Pid = pid() .br Reason = term() .br .RE .RE .RS .LP Dump the mib-server data to \fIstdio\fR\& (Destination = \fIio\fR\&) or the specified file\&. .RE .LP .B Module:which_mib(State, Oid) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = {ok, MibFile} | {error, Reason} .br Oid = oid() .br MibFile = string() .br Reason = term() .br .RE .RE .RS .LP Retrieve the mib-file to which an given \fIoid()\fR\& belongs\&. .RE .LP .B Module:which_mibs(State) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = [{MibName, Filename}] .br MibName = atom() .br Filename = string() .br .RE .RE .RS .LP Retrieve all loaded mib-files\&. .RE .LP .B Module:whereis_mib(State, MibName) -> Reply .br .RS .LP Types: .RS 3 State = term() .br MibName = atom() .br Reply = {ok, Filename} | {error, Reason} .br Filename = string() .br Reason = term() .br .RE .RE .RS .LP Retrieve the mib file for the mib\&. .RE .LP .B Module:info(State) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = {ok, Filename} | {error, Reason} .br Filename = string() .br Reason = term() .br .RE .RE .RS .LP Retrieve misc info for the mib data\&. .LP This is a utility function used to inspect, for instance, memory usage, in a simple way\&. .RE .LP .B Module:backup(State, BackupDir) -> Reply .br .RS .LP Types: .RS 3 State = term() .br Reply = ok | {error, Reason} .br BackupDir = string() .br Reason = term() .br .RE .RE .RS .LP Perform a backup of the mib-server data\&. .LP Note that its implementation dependent (and also dependent on mib-storage is used) if a backup is possible\&. .RE .LP .B Module:code_change(Destination, Vsn, Extra, State) -> NewState .br .RS .LP Types: .RS 3 Destination = up | down .br Vsn = term() .br Extra = term() .br State = NewState = term() .br .RE .RE .RS .LP Perform a code-change (upgrade or downgrade)\&. .LP See gen_server for more info regarding the \fIVsn\fR\& and \fIExtra\fR\& arguments\&. .RE