1snmpa_mib_data(3) Erlang Module Definition snmpa_mib_data(3)
2
3
4
6 snmpa_mib_data - Behaviour module for the SNMP agent mib-server
7 data module.
8
10 This module defines the behaviour of the SNMP agent mib-server data
11 module. A snmpa_mib_data compliant module must export the following
12 functions:
13
14 * new/1
15
16 * close/1
17
18 * sync/1
19
20 * load_mib/4
21
22 * unload_mib/4
23
24 * lookup/2
25
26 * next/3
27
28 * register_subagent/3
29
30 * unregister_subagent/2
31
32 * which_mib/2
33
34 * which_mibs/1
35
36 * whereis_mib/2
37
38 * dump/2
39
40 * info/1
41
42 * backup/2
43
44 * code_change/4
45
46 The semantics of them and their exact signatures are explained below.
47
48 Note that the data extracted from the imported (loaded) mibs are stored
49 partly by the mib-server and partly by the symbolic-store server. See
50 the default mib-server data module, snmpa_mib_data_tttn for details.
51
53 The following functions must be exported from a mib-server data call‐
54 back module:
55
57 Module:new(Storage) -> State
58
59 Types:
60
61 Storage = mib_storage()
62 State = term()
63
64 Create a new mib-server data instance.
65
66 Module:close(State) -> void()
67
68 Types:
69
70 State = term()
71
72 Close the mib-storage.
73
74 Module:sync(State) -> void()
75
76 Types:
77
78 State = term()
79
80 Synchronize (write to disc, if possible) the mib-server data.
81 This depends on the mib_storage option, and will only have an
82 effect if the mib-storage option has an actual disc component
83 (such as dets, or ets with a file).
84
85 Module:load_mib(State, Filename, MeOverride, TeOverride) -> {ok, New‐
86 State} | {error, Reason}
87
88 Types:
89
90 State = NewState = term()
91 Filename = filename()
92 MeOverride = boolean()
93 TeOverride = boolean()
94 Reason = already_loaded | term()
95
96 Load the mib specified by the Filename argument into the mib-
97 server. The MeOverride and TeOverride arguments specifies how
98 the mib-server shall handle duplicate mib- and trap- entries.
99
100 Module:unload_mib(State, Filename) -> {ok, NewState} | {error, Reason}
101
102 Types:
103
104 State = NewState = term()
105 Filename = filename()
106 Reason = not_loaded | term()
107
108 Unload the mib specified by the Filename argument from the mib-
109 server.
110
111 Module:lookup(State, Oid) -> Reply
112
113 Types:
114
115 State = term()
116 Reply = {variable, ME} | {table_column, ME, TEOid} | {sub‐
117 agent, SAPid, SAOid} | {false, Reason}
118 Oid = TEOid = SAOid = oid()
119 SAPid = pid()
120 ME = me()
121 Reason = term()
122
123 Find the mib-entry corresponding to the Oid. If it is a vari‐
124 able, the Oid must be <Oid for var>.0 and if it is a table, Oid
125 must be <table>.<entry>.<col>.<any>.
126
127 Module:next(State, Oid, MibView) -> Reply
128
129 Types:
130
131 State = term()
132 Reply = false | endOfTable | {subagent, SAPid, SAOid} |
133 {variable, ME, VarOid} | {table, TableOid, TableRestOid, ME}
134 Oid = SAOid = VarOid = TableOid = TableRestOid = oid()
135 SAPid = pid()
136 ME = me()
137
138 Finds the lexicographically next oid.
139
140 Module:register_subagent(State, Oid, Pid) -> Reply
141
142 Types:
143
144 State = NewState = term()
145 Reply = {ok, NewState} | {error, Reason}
146 Oid = oid()
147 Pid = pid()
148 Reason = term()
149
150 Register the subagent, process, handling part of the mib-tree.
151
152 Module:unregister_subagent(State, PidOrOid) -> Reply
153
154 Types:
155
156 State = NewState = term()
157 Reply = {ok, NewState} | {ok, NewState, Pid} | {error, Rea‐
158 son}
159 PidOrOid = pid() | oid()
160 Pid = pid()
161 Reason = term()
162
163 Unregister the subagent, handling part of the mib-tree, as spec‐
164 ified by the oid() or pid() (PidOrOid).
165
166 When unregister the subagent using an oid(), the pid() of the
167 process handling the sub-tree is also returned.
168
169 Module:dump(State, Destination) -> Reply
170
171 Types:
172
173 State = term()
174 Reply = ok | {error, Reason}
175 Destination = io | filename()
176 Pid = pid()
177 Reason = term()
178
179 Dump the mib-server data to stdio (Destination = io) or the
180 specified file.
181
182 Module:which_mib(State, Oid) -> Reply
183
184 Types:
185
186 State = term()
187 Reply = {ok, MibFile} | {error, Reason}
188 Oid = oid()
189 MibFile = string()
190 Reason = term()
191
192 Retrieve the mib-file to which an given oid() belongs.
193
194 Module:which_mibs(State) -> Reply
195
196 Types:
197
198 State = term()
199 Reply = [{MibName, Filename}]
200 MibName = atom()
201 Filename = string()
202
203 Retrieve all loaded mib-files.
204
205 Module:whereis_mib(State, MibName) -> Reply
206
207 Types:
208
209 State = term()
210 MibName = atom()
211 Reply = {ok, Filename} | {error, Reason}
212 Filename = string()
213 Reason = term()
214
215 Retrieve the mib file for the mib.
216
217 Module:info(State) -> Reply
218
219 Types:
220
221 State = term()
222 Reply = {ok, Filename} | {error, Reason}
223 Filename = string()
224 Reason = term()
225
226 Retrieve misc info for the mib data.
227
228 This is a utility function used to inspect, for instance, memory
229 usage, in a simple way.
230
231 Module:backup(State, BackupDir) -> Reply
232
233 Types:
234
235 State = term()
236 Reply = ok | {error, Reason}
237 BackupDir = string()
238 Reason = term()
239
240 Perform a backup of the mib-server data.
241
242 Note that its implementation dependant (and also dependent on
243 mib-storage is used) if a backup is possible.
244
245 Module:code_change(Destination, Vsn, Extra, State) -> NewState
246
247 Types:
248
249 Destination = up | down
250 Vsn = term()
251 Extra = term()
252 State = NewState = term()
253
254 Perform a code-change (upgrade or downgrade).
255
256 See gen_server for more info regarding the Vsn and Extra argu‐
257 ments.
258
259
260
261Ericsson AB snmp 5.10.1 snmpa_mib_data(3)