1table(3) net-snmp table(3)
2
3
4
6 table - Helps you implement a table.
7
8
9 Modules
10 table_array
11 Helps you implement a table when data can be stored locally.
12
13 table_container
14 Helps you implement a table when data can be found via a
15 netsnmp_container.
16
17 table_data
18 Helps you implement a table with datamatted storage.
19
20 generic_table_API
21 General requirements for a table helper.
22
23 table_iterator
24 The table iterator helper is designed to simplify the task of
25 writing a table handler for the net-snmp agent when the data being
26 accessed is not in an oid sorted form and must be accessed
27 externally.
28
29 table_row
30 Helps you implement a table shared across two or more subagents, or
31 otherwise split into individual row slices.
32
33 tdata
34 Implement a table with datamatted storage.
35
36 Defines
37 #define SPARSE_TABLE_HANDLER_NAME 'sparse_table'
38
39 Functions
40 netsnmp_mib_handler * netsnmp_get_table_handler
41 (netsnmp_table_registration_info *tabreq)
42 Given a netsnmp_table_registration_info object, creates a table
43 handler.
44 int netsnmp_register_table (netsnmp_handler_registration *reginfo,
45 netsnmp_table_registration_info *tabreq)
46 creates a table handler given the netsnmp_table_registration_info
47 object, inserts it into the request chain and then calls
48 netsnmp_register_handler() to register the table into the agent.
49 NETSNMP_INLINE netsnmp_table_request_info * netsnmp_extract_table_info
50 (netsnmp_request_info *request)
51 Extracts the processed table information from a given request.
52 netsnmp_table_registration_info * netsnmp_find_table_registration_info
53 (netsnmp_handler_registration *reginfo)
54 extracts the registered netsnmp_table_registration_info object from
55 a netsnmp_handler_registration object
56 int table_helper_handler (netsnmp_mib_handler *handler,
57 netsnmp_handler_registration *reginfo, netsnmp_agent_request_info
58 *reqinfo, netsnmp_request_info *requests)
59 implements the table helper handler
60 netsnmp_mib_handler * netsnmp_sparse_table_handler_get (void)
61 create sparse table handler
62 int netsnmp_sparse_table_register (netsnmp_handler_registration
63 *reginfo, netsnmp_table_registration_info *tabreq)
64 creates a table handler given the netsnmp_table_registration_info
65 object, inserts it into the request chain and then calls
66 netsnmp_register_handler() to register the table into the agent.
67 int netsnmp_table_build_result (netsnmp_handler_registration *reginfo,
68 netsnmp_request_info *reqinfo, netsnmp_table_request_info
69 *table_info, u_char type, u_char *result, size_t result_len)
70 Builds the result to be returned to the agent given the table
71 information.
72 int netsnmp_table_build_oid (netsnmp_handler_registration *reginfo,
73 netsnmp_request_info *reqinfo, netsnmp_table_request_info
74 *table_info)
75 given a registration info object, a request object and the table
76 info object it builds the request->requestvb->name oid from the
77 index values and column information found in the table_info object.
78 int netsnmp_table_build_oid_from_index (netsnmp_handler_registration
79 *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info
80 *table_info)
81 given a registration info object, a request object and the table
82 info object it builds the request->requestvb->name oid from the
83 index values and column information found in the table_info object.
84 int netsnmp_update_variable_list_from_index (netsnmp_table_request_info
85 *tri)
86 parses an OID into table indexses
87 int netsnmp_update_indexes_from_variable_list
88 (netsnmp_table_request_info *tri)
89 builds an oid given a set of indexes.
90 int netsnmp_check_getnext_reply (netsnmp_request_info *request, oid
91 *prefix, size_t prefix_len, netsnmp_variable_list *newvar,
92 netsnmp_variable_list **outvar)
93 checks the original request against the current data being passed
94 in if its greater than the request oid but less than the current
95 valid return, set the current valid return to the new value.
96
98 Helps you implement a table.
99
100 This handler helps you implement a table by doing some of the
101 processing for you.
102
103 This handler truly shows the power of the new handler mechanism. By
104 creating a table handler and injecting it into your calling chain, or
105 by using the netsnmp_register_table() function to register your table,
106 you get access to some pre-parsed information. Specifically, the table
107 handler pulls out the column number and indexes from the request oid so
108 that you don't have to do the complex work to do that parsing within
109 your own code.
110
111 To do this, the table handler needs to know up front how your table is
112 structured. To inform it about this, you fill in a
113 table_registeration_info structure that is passed to the table handler.
114 It contains the asn index types for the table as well as the minimum
115 and maximum column that should be used.
116
118 int netsnmp_check_getnext_reply (netsnmp_request_info * request, oid *
119 prefix, size_t prefix_len, netsnmp_variable_list * newvar,
120 netsnmp_variable_list ** outvar)
121 checks the original request against the current data being passed in if
122 its greater than the request oid but less than the current valid
123 return, set the current valid return to the new value.
124
125 returns 1 if outvar was replaced with the oid from newvar (success).
126 returns 0 if not.
127
128 Definition at line 884 of file table.c.
129
130 References build_oid_noalloc(), variable_list::name,
131 variable_list::name_length, netsnmp_request_info_s::requestvb,
132 snmp_clone_varbind(), snmp_free_varbind(), snmp_oid_compare(),
133 snmp_set_var_objid(), snmp_set_var_typed_value(),
134 netsnmp_vardata::string, variable_list::type, variable_list::val, and
135 variable_list::val_len.
136
137 NETSNMP_INLINE netsnmp_table_request_info* netsnmp_extract_table_info
138 (netsnmp_request_info * request)
139 Extracts the processed table information from a given request.
140
141 Call this from subhandlers on a request to extract the processed
142 netsnmp_request_info information. The resulting information includes
143 the index values and the column number.
144
145 Parameters:
146 request populated netsnmp request structure
147
148 Returns:
149 populated netsnmp_table_request_info structure
150
151 Definition at line 125 of file table.c.
152
153 References netsnmp_request_get_list_data().
154
155 Referenced by _netsnmp_tdata_helper_handler(),
156 netsnmp_container_table_row_insert(),
157 netsnmp_insert_iterator_context(), netsnmp_insert_table_row(),
158 netsnmp_table_data_helper_handler(),
159 netsnmp_table_data_set_helper_handler(),
160 netsnmp_table_iterator_helper_handler(), and table_helper_handler().
161
162 netsnmp_table_registration_info* netsnmp_find_table_registration_info
163 (netsnmp_handler_registration * reginfo)
164 extracts the registered netsnmp_table_registration_info object from a
165 netsnmp_handler_registration object
166
167 Definition at line 134 of file table.c.
168
169 References netsnmp_find_handler_data_by_name().
170
171 Referenced by netsnmp_table_data_helper_handler(), and
172 netsnmp_table_iterator_helper_handler().
173
174 netsnmp_mib_handler* netsnmp_get_table_handler
175 (netsnmp_table_registration_info * tabreq)
176 Given a netsnmp_table_registration_info object, creates a table
177 handler.
178
179 You can use this table handler by injecting it into a calling chain.
180 When the handler gets called, it'll do processing and store it's
181 information into the request->parent_data structure.
182
183 The table helper handler pulls out the column number and indexes from
184 the request oid so that you don't have to do the complex work of
185 parsing within your own code.
186
187 Parameters:
188 tabreq is a pointer to a netsnmp_table_registration_info struct.
189 The table handler needs to know up front how your table is
190 structured. A netsnmp_table_registeration_info structure that is
191 passed to the table handler should contain the asn index types for
192 the table as well as the minimum and maximum column that should be
193 used.
194
195 Returns:
196 Returns a pointer to a netsnmp_mib_handler struct which contains
197 the handler's name and the access method
198
199 Definition at line 85 of file table.c.
200
201 References count_varbinds(),
202 netsnmp_table_registration_info_s::indexes,
203 netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), NULL,
204 netsnmp_table_registration_info_s::number_indexes, snmp_log(), and
205 table_helper_handler().
206
207 Referenced by netsnmp_register_table(), and
208 netsnmp_sparse_table_register().
209
210 int netsnmp_register_table (netsnmp_handler_registration * reginfo,
211 netsnmp_table_registration_info * tabreq)
212 creates a table handler given the netsnmp_table_registration_info
213 object, inserts it into the request chain and then calls
214 netsnmp_register_handler() to register the table into the agent.
215
216 Definition at line 108 of file table.c.
217
218 References netsnmp_get_table_handler(), netsnmp_inject_handler(), and
219 netsnmp_register_handler().
220
221 Referenced by netsnmp_container_table_register(),
222 netsnmp_register_table_data(), netsnmp_register_table_iterator(),
223 netsnmp_table_container_register(), and netsnmp_table_row_register().
224
225 netsnmp_mib_handler* netsnmp_sparse_table_handler_get (void)
226 create sparse table handler
227
228 Definition at line 722 of file table.c.
229
230 References netsnmp_create_handler(), and SPARSE_TABLE_HANDLER_NAME.
231
232 int netsnmp_sparse_table_register (netsnmp_handler_registration * reginfo,
233 netsnmp_table_registration_info * tabreq)
234 creates a table handler given the netsnmp_table_registration_info
235 object, inserts it into the request chain and then calls
236 netsnmp_register_handler() to register the table into the agent.
237
238 Definition at line 733 of file table.c.
239
240 References netsnmp_create_handler(), netsnmp_get_table_handler(),
241 netsnmp_inject_handler(), netsnmp_register_handler(), and
242 SPARSE_TABLE_HANDLER_NAME.
243
244 int netsnmp_table_build_oid (netsnmp_handler_registration * reginfo,
245 netsnmp_request_info * reqinfo, netsnmp_table_request_info *
246 table_info)
247 given a registration info object, a request object and the table info
248 object it builds the request->requestvb->name oid from the index values
249 and column information found in the table_info object.
250
251 Index values are extracted from the table_info varbinds.
252
253 Definition at line 784 of file table.c.
254
255 References build_oid(), netsnmp_table_request_info_s::colnum,
256 netsnmp_table_request_info_s::indexes, variable_list::name,
257 variable_list::name_length, netsnmp_request_info_s::requestvb,
258 netsnmp_handler_registration_s::rootoid, and
259 netsnmp_handler_registration_s::rootoid_len.
260
261 Referenced by netsnmp_table_build_result().
262
263 int netsnmp_table_build_oid_from_index (netsnmp_handler_registration *
264 reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info *
265 table_info)
266 given a registration info object, a request object and the table info
267 object it builds the request->requestvb->name oid from the index values
268 and column information found in the table_info object.
269
270 Index values are extracted from the table_info index oid.
271
272 Definition at line 821 of file table.c.
273
274 References netsnmp_table_request_info_s::colnum,
275 netsnmp_table_request_info_s::index_oid,
276 netsnmp_table_request_info_s::index_oid_len, variable_list::name,
277 variable_list::name_length, variable_list::name_loc,
278 netsnmp_request_info_s::requestvb,
279 netsnmp_handler_registration_s::rootoid,
280 netsnmp_handler_registration_s::rootoid_len, snmp_clone_mem(), and
281 SNMP_FREE.
282
283 int netsnmp_table_build_result (netsnmp_handler_registration * reginfo,
284 netsnmp_request_info * reqinfo, netsnmp_table_request_info *
285 table_info, u_char type, u_char * result, size_t result_len)
286 Builds the result to be returned to the agent given the table
287 information.
288
289 Use this function to return results from lowel level handlers to the
290 agent. It takes care of building the proper resulting oid (containing
291 proper indexing) and inserts the result value into the returning
292 varbind.
293
294 Definition at line 751 of file table.c.
295
296 References variable_list::name, variable_list::name_loc,
297 netsnmp_table_build_oid(), NULL, netsnmp_request_info_s::requestvb, and
298 snmp_set_var_typed_value().
299
300 int netsnmp_update_indexes_from_variable_list (netsnmp_table_request_info *
301 tri)
302 builds an oid given a set of indexes.
303
304 Definition at line 866 of file table.c.
305
306 References build_oid_noalloc(),
307 netsnmp_table_request_info_s::index_oid,
308 netsnmp_table_request_info_s::index_oid_len,
309 netsnmp_table_request_info_s::indexes, and NULL.
310
311 int netsnmp_update_variable_list_from_index (netsnmp_table_request_info *
312 tri)
313 parses an OID into table indexses
314
315 Definition at line 850 of file table.c.
316
317 References netsnmp_table_request_info_s::index_oid,
318 netsnmp_table_request_info_s::index_oid_len,
319 netsnmp_table_request_info_s::indexes, parse_oid_indexes(), and
320 snmp_reset_var_buffers().
321
322 int table_helper_handler (netsnmp_mib_handler * handler,
323 netsnmp_handler_registration * reginfo, netsnmp_agent_request_info *
324 reqinfo, netsnmp_request_info * requests)
325 implements the table helper handler
326
327 XXX-rks: memory leak. add cleanup handler?
328
329 none available
330
331 got one ok
332
333 for loop
334
335 Definition at line 142 of file table.c.
336
337 References netsnmp_table_request_info_s::colnum,
338 netsnmp_mib_handler_s::handler_name,
339 netsnmp_table_request_info_s::index_oid,
340 netsnmp_table_request_info_s::index_oid_len,
341 netsnmp_table_request_info_s::indexes,
342 netsnmp_table_registration_info_s::indexes,
343 netsnmp_table_registration_info_s::max_column,
344 netsnmp_table_registration_info_s::min_column,
345 netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid,
346 netsnmp_agent_get_list_data(), netsnmp_call_next_handler(),
347 netsnmp_create_data_list(), netsnmp_extract_table_info(),
348 netsnmp_free_agent_data_sets(), netsnmp_request_add_list_data(),
349 netsnmp_set_request_error(), netsnmp_request_info_s::next,
350 netsnmp_mib_handler_s::next, variable_list::next_variable, NULL,
351 netsnmp_table_registration_info_s::number_indexes,
352 netsnmp_table_request_info_s::number_indexes, parse_one_oid_index(),
353 netsnmp_request_info_s::processed,
354 netsnmp_table_request_info_s::reg_info,
355 netsnmp_request_info_s::requestvb,
356 netsnmp_handler_registration_s::rootoid,
357 netsnmp_handler_registration_s::rootoid_len, snmp_clone_varbind(),
358 SNMP_FREE, snmp_log(), SNMP_MALLOC_TYPEDEF, snmp_oid_compare(),
359 snmp_set_var_objid(), sprint_realloc_by_type(),
360 netsnmp_request_info_s::status, variable_list::type, and
361 netsnmp_table_registration_info_s::valid_columns.
362
363 Referenced by netsnmp_get_table_handler().
364
365
366
367Version 5.4 24 Nov 2006 table(3)