1table_dataset(3) net-snmp table_dataset(3)
2
3
4
6 table_dataset - Helps you implement a table with automatted storage.
7
8
9 Functions
10 void netsnmp_init_table_dataset (void)
11 netsnmp_table_data_set * netsnmp_create_table_data_set (const char
12 *table_name)
13 Create a netsnmp_table_data_set structure given a table_data
14 definition.
15 netsnmp_table_row * netsnmp_table_data_set_clone_row (netsnmp_table_row
16 *row)
17 clones a dataset row, including all data.
18 NETSNMP_INLINE netsnmp_table_data_set_storage *
19 netsnmp_table_dataset_delete_data (netsnmp_table_data_set_storage
20 *data)
21 deletes a single dataset table data.
22 NETSNMP_INLINE void netsnmp_table_dataset_delete_all_data
23 (netsnmp_table_data_set_storage *data)
24 deletes all the data from this node and beyond in the linked list
25 NETSNMP_INLINE void netsnmp_table_dataset_delete_row (netsnmp_table_row
26 *row)
27 deletes all the data from this node and beyond in the linked list
28 NETSNMP_INLINE void netsnmp_table_dataset_add_row
29 (netsnmp_table_data_set *table, netsnmp_table_row *row)
30 adds a new row to a dataset table
31 NETSNMP_INLINE void netsnmp_table_dataset_replace_row
32 (netsnmp_table_data_set *table, netsnmp_table_row *origrow,
33 netsnmp_table_row *newrow)
34 adds a new row to a dataset table
35 NETSNMP_INLINE void netsnmp_table_dataset_remove_row
36 (netsnmp_table_data_set *table, netsnmp_table_row *row)
37 removes a row from the table, but doesn't delete/free the column
38 values
39 NETSNMP_INLINE void netsnmp_table_dataset_remove_and_delete_row
40 (netsnmp_table_data_set *table, netsnmp_table_row *row)
41 removes a row from the table and then deletes it (and all its data)
42 netsnmp_table_row * netsnmp_table_data_set_create_row_from_defaults
43 (netsnmp_table_data_set_storage *defrow)
44 creates a new row from an existing defined default set
45 int netsnmp_table_set_add_default_row (netsnmp_table_data_set
46 *table_set, unsigned int column, int type, int writable, void
47 *default_value, size_t default_value_len)
48 adds a new default row to a table_set.
49 void netsnmp_table_set_multi_add_default_row (netsnmp_table_data_set
50 *tset,...)
51 adds multiple data column definitions to each row.
52 netsnmp_mib_handler * netsnmp_get_table_data_set_handler
53 (netsnmp_table_data_set *data_set)
54 Given a netsnmp_table_data_set definition, create a handler for it.
55 int netsnmp_register_table_data_set (netsnmp_handler_registration
56 *reginfo, netsnmp_table_data_set *data_set,
57 netsnmp_table_registration_info *table_info)
58 register a given data_set at a given oid (specified in the
59 netsnmp_handler_registration pointer).
60 newrow_stash * netsnmp_table_data_set_create_newrowstash
61 (netsnmp_table_data_set *datatable, netsnmp_table_request_info
62 *table_info)
63 int netsnmp_table_data_set_helper_handler (netsnmp_mib_handler
64 *handler, netsnmp_handler_registration *reginfo,
65 netsnmp_agent_request_info *reqinfo, netsnmp_request_info
66 *requests)
67 NETSNMP_INLINE netsnmp_table_data_set * netsnmp_extract_table_data_set
68 (netsnmp_request_info *request)
69 extracts a netsnmp_table_data_set pointer from a given request
70 netsnmp_table_data_set_storage * netsnmp_extract_table_data_set_column
71 (netsnmp_request_info *request, unsigned int column)
72 extracts a netsnmp_table_data_set pointer from a given request
73 void netsnmp_register_auto_data_table (netsnmp_table_data_set
74 *table_set, char *registration_name)
75 registers a table_dataset so that the 'add_row' snmpd.conf token
76 can be used to add data to this table.
77 void netsnmp_config_parse_table_set (const char *token, char *line)
78 void netsnmp_config_parse_add_row (const char *token, char *line)
79 netsnmp_table_row * netsnmp_table_data_set_get_first_row
80 (netsnmp_table_data_set *table)
81 returns the first row in the table
82 netsnmp_table_row * netsnmp_table_data_set_get_next_row
83 (netsnmp_table_data_set *table, netsnmp_table_row *row)
84 returns the next row in the table
85 int netsnmp_table_set_num_rows (netsnmp_table_data_set *table)
86 netsnmp_table_data_set_storage * netsnmp_table_data_set_find_column
87 (netsnmp_table_data_set_storage *start, unsigned int column)
88 Finds a column within a given storage set, given the pointer to the
89 start of the storage set list.
90 int netsnmp_mark_row_column_writable (netsnmp_table_row *row, int
91 column, int writable)
92 marks a given column in a row as writable or not.
93 int netsnmp_set_row_column (netsnmp_table_row *row, unsigned int
94 column, int type, const char *value, size_t value_len)
95 sets a given column in a row with data given a type, value, and
96 length.
97 NETSNMP_INLINE void netsnmp_table_dataset_add_index
98 (netsnmp_table_data_set *table, u_char type)
99 adds an index to the table.
100 void netsnmp_table_set_add_indexes (netsnmp_table_data_set *tset,...)
101 adds multiple indexes to a table_dataset helper object.
102
104 Helps you implement a table with automatted storage.
105
106 This helper is obsolete. If you are writing a new module, please
107 consider using the table_dataset2 helper instead.
108
109 This handler helps you implement a table where all the data is expected
110 to be stored within the agent itself and not in some external storage
111 location. It handles all MIB requests including GETs, GETNEXTs and
112 SETs. It's possible to simply create a table without actually ever
113 defining a handler to be called when SNMP requests come in. To use the
114 data, you can either attach a sub-handler that merely uses/manipulates
115 the data further when requests come in, or you can loop through it
116 externally when it's actually needed. This handler is most useful in
117 cases where a table is holding configuration data for something which
118 gets triggered via another event.
119
120 NOTE NOTE NOTE: This helper isn't complete and is likely to change
121 somewhat over time. Specifically, the way it stores data internally may
122 change drastically.
123
125 netsnmp_table_data_set* netsnmp_create_table_data_set (const char *
126 table_name)
127 Create a netsnmp_table_data_set structure given a table_data
128 definition.
129
130 Examples:
131 data_set.c.
132
133 Definition at line 80 of file table_dataset.c.
134
135 References netsnmp_create_table_data(), NULL, SNMP_MALLOC_TYPEDEF, and
136 netsnmp_table_data_set_s::table.
137
138 Referenced by netsnmp_config_parse_table_set().
139
140 NETSNMP_INLINE netsnmp_table_data_set* netsnmp_extract_table_data_set
141 (netsnmp_request_info * request)
142 extracts a netsnmp_table_data_set pointer from a given request
143
144 Definition at line 796 of file table_dataset.c.
145
146 References netsnmp_request_get_list_data().
147
148 netsnmp_table_data_set_storage* netsnmp_extract_table_data_set_column
149 (netsnmp_request_info * request, unsigned int column)
150 extracts a netsnmp_table_data_set pointer from a given request
151
152 Definition at line 806 of file table_dataset.c.
153
154 References netsnmp_extract_table_row_data(), and
155 netsnmp_table_data_set_find_column().
156
157 netsnmp_mib_handler* netsnmp_get_table_data_set_handler
158 (netsnmp_table_data_set * data_set)
159 Given a netsnmp_table_data_set definition, create a handler for it.
160
161 Definition at line 356 of file table_dataset.c.
162
163 References netsnmp_mib_handler_s::flags, MIB_HANDLER_AUTO_NEXT,
164 netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(),
165 netsnmp_table_data_set_helper_handler(), NULL, and snmp_log().
166
167 Referenced by netsnmp_register_table_data_set().
168
169 int netsnmp_mark_row_column_writable (netsnmp_table_row * row, int column,
170 int writable)
171 marks a given column in a row as writable or not.
172
173 Examples:
174 data_set.c.
175
176 Definition at line 1167 of file table_dataset.c.
177
178 References netsnmp_table_data_set_storage_s::column,
179 netsnmp_table_row_s::data, netsnmp_table_data_set_find_column(),
180 netsnmp_table_data_set_storage_s::next, snmp_log(),
181 SNMP_MALLOC_TYPEDEF, and netsnmp_table_data_set_storage_s::writable.
182
183 Referenced by netsnmp_config_parse_add_row(), and
184 netsnmp_table_data_set_create_row_from_defaults().
185
186 void netsnmp_register_auto_data_table (netsnmp_table_data_set * table_set,
187 char * registration_name)
188 registers a table_dataset so that the 'add_row' snmpd.conf token can be
189 used to add data to this table.
190
191 If registration_name is NULL then the name used when the table was
192 created will be used instead.
193
194 Todo
195 create a properly free'ing registeration pointer for the datalist,
196 and get the datalist freed at shutdown.
197
198 Examples:
199 data_set.c.
200
201 Definition at line 833 of file table_dataset.c.
202
203 References netsnmp_table_data_s::name, netsnmp_add_list_data(),
204 netsnmp_create_data_list(), NULL, SNMP_MALLOC_TYPEDEF,
205 netsnmp_table_data_set_s::table, and data_set_tables_s::table_set.
206
207 Referenced by netsnmp_config_parse_table_set().
208
209 int netsnmp_register_table_data_set (netsnmp_handler_registration *
210 reginfo, netsnmp_table_data_set * data_set,
211 netsnmp_table_registration_info * table_info)
212 register a given data_set at a given oid (specified in the
213 netsnmp_handler_registration pointer).
214
215 The reginfo->handler->access_method *may* be null if the call doesn't
216 ever want to be called for SNMP operations.
217
218 Examples:
219 data_set.c.
220
221 Definition at line 382 of file table_dataset.c.
222
223 References netsnmp_table_data_set_storage_s::column,
224 netsnmp_table_data_set_s::default_row,
225 netsnmp_table_registration_info_s::indexes,
226 netsnmp_table_data_s::indexes_template,
227 netsnmp_table_registration_info_s::max_column,
228 netsnmp_table_registration_info_s::min_column,
229 netsnmp_get_table_data_set_handler(), netsnmp_inject_handler(),
230 netsnmp_register_table_data(), netsnmp_table_data_set_storage_s::next,
231 NULL, snmp_clone_varbind(), SNMP_MALLOC_TYPEDEF, SNMP_MAX, SNMP_MIN,
232 and netsnmp_table_data_set_s::table.
233
234 Referenced by netsnmp_config_parse_table_set().
235
236 int netsnmp_set_row_column (netsnmp_table_row * row, unsigned int column,
237 int type, const char * value, size_t value_len)
238 sets a given column in a row with data given a type, value, and length.
239
240 Data is memdup'ed by the function.
241
242 Examples:
243 data_set.c.
244
245 Definition at line 1202 of file table_dataset.c.
246
247 References netsnmp_table_data_set_storage_s::column,
248 netsnmp_table_row_s::data, netsnmp_table_data_set_storage_s::data,
249 netsnmp_table_data_set_storage_s::data_len, memdup(),
250 netsnmp_table_data_set_find_column(),
251 netsnmp_table_data_set_storage_s::next, SNMP_FREE, snmp_log(),
252 SNMP_MALLOC_TYPEDEF, netsnmp_table_data_set_storage_s::string,
253 netsnmp_table_data_set_storage_s::type, and
254 netsnmp_table_data_set_storage_s::voidp.
255
256 Referenced by netsnmp_config_parse_add_row(), and
257 netsnmp_table_data_set_create_row_from_defaults().
258
259 netsnmp_table_row* netsnmp_table_data_set_clone_row (netsnmp_table_row *
260 row)
261 clones a dataset row, including all data.
262
263 Definition at line 92 of file table_dataset.c.
264
265 References netsnmp_table_row_s::data, memdup(),
266 netsnmp_table_data_clone_row(), netsnmp_table_dataset_delete_row(),
267 netsnmp_table_data_set_storage_s::next, and NULL.
268
269 Referenced by netsnmp_table_data_set_helper_handler().
270
271 netsnmp_table_row* netsnmp_table_data_set_create_row_from_defaults
272 (netsnmp_table_data_set_storage * defrow)
273 creates a new row from an existing defined default set
274
275 Definition at line 226 of file table_dataset.c.
276
277 References netsnmp_table_data_set_storage_s::column,
278 netsnmp_table_data_set_storage_s::data,
279 netsnmp_table_data_set_storage_s::data_len,
280 netsnmp_create_table_data_row(), netsnmp_mark_row_column_writable(),
281 netsnmp_set_row_column(), netsnmp_table_data_set_storage_s::next, NULL,
282 netsnmp_table_data_set_storage_s::type,
283 netsnmp_table_data_set_storage_s::voidp, and
284 netsnmp_table_data_set_storage_s::writable.
285
286 Referenced by netsnmp_table_data_set_create_newrowstash().
287
288 netsnmp_table_data_set_storage* netsnmp_table_data_set_find_column
289 (netsnmp_table_data_set_storage * start, unsigned int column)
290 Finds a column within a given storage set, given the pointer to the
291 start of the storage set list.
292
293 Definition at line 1155 of file table_dataset.c.
294
295 References netsnmp_table_data_set_storage_s::column, and
296 netsnmp_table_data_set_storage_s::next.
297
298 Referenced by netsnmp_extract_table_data_set_column(),
299 netsnmp_mark_row_column_writable(), netsnmp_set_row_column(),
300 netsnmp_table_data_set_helper_handler(), and
301 netsnmp_table_set_add_default_row().
302
303 netsnmp_table_row* netsnmp_table_data_set_get_first_row
304 (netsnmp_table_data_set * table)
305 returns the first row in the table
306
307 Definition at line 1124 of file table_dataset.c.
308
309 References netsnmp_table_data_get_first_row(), and
310 netsnmp_table_data_set_s::table.
311
312 netsnmp_table_row* netsnmp_table_data_set_get_next_row
313 (netsnmp_table_data_set * table, netsnmp_table_row * row)
314 returns the next row in the table
315
316 Definition at line 1131 of file table_dataset.c.
317
318 References netsnmp_table_data_get_next_row(), and
319 netsnmp_table_data_set_s::table.
320
321 NETSNMP_INLINE void netsnmp_table_dataset_add_index (netsnmp_table_data_set
322 * table, u_char type)
323 adds an index to the table.
324
325 Call this repeatly for each index.
326
327 Examples:
328 data_set.c.
329
330 Definition at line 1256 of file table_dataset.c.
331
332 References netsnmp_table_data_set_s::table.
333
334 Referenced by netsnmp_table_set_add_indexes().
335
336 NETSNMP_INLINE void netsnmp_table_dataset_add_row (netsnmp_table_data_set *
337 table, netsnmp_table_row * row)
338 adds a new row to a dataset table
339
340 Examples:
341 data_set.c.
342
343 Definition at line 171 of file table_dataset.c.
344
345 References netsnmp_table_data_add_row(), and
346 netsnmp_table_data_set_s::table.
347
348 Referenced by netsnmp_table_data_set_helper_handler().
349
350 NETSNMP_INLINE void netsnmp_table_dataset_delete_all_data
351 (netsnmp_table_data_set_storage * data)
352 deletes all the data from this node and beyond in the linked list
353
354 Definition at line 148 of file table_dataset.c.
355
356 References netsnmp_table_dataset_delete_data().
357
358 Referenced by netsnmp_table_dataset_delete_row(), and
359 netsnmp_table_dataset_remove_and_delete_row().
360
361 NETSNMP_INLINE netsnmp_table_data_set_storage*
362 netsnmp_table_dataset_delete_data (netsnmp_table_data_set_storage *
363 data)
364 deletes a single dataset table data.
365
366 returns the (possibly still good) next pointer of the deleted data
367 object.
368
369 Definition at line 135 of file table_dataset.c.
370
371 References netsnmp_table_data_set_storage_s::data,
372 netsnmp_table_data_set_storage_s::next, NULL, SNMP_FREE, and
373 netsnmp_table_data_set_storage_s::voidp.
374
375 Referenced by netsnmp_table_dataset_delete_all_data().
376
377 NETSNMP_INLINE void netsnmp_table_dataset_delete_row (netsnmp_table_row *
378 row)
379 deletes all the data from this node and beyond in the linked list
380
381 Definition at line 158 of file table_dataset.c.
382
383 References netsnmp_table_data_delete_row(), and
384 netsnmp_table_dataset_delete_all_data().
385
386 Referenced by netsnmp_table_data_set_clone_row(), and
387 netsnmp_table_data_set_helper_handler().
388
389 NETSNMP_INLINE void netsnmp_table_dataset_remove_and_delete_row
390 (netsnmp_table_data_set * table, netsnmp_table_row * row)
391 removes a row from the table and then deletes it (and all its data)
392
393 Definition at line 203 of file table_dataset.c.
394
395 References netsnmp_table_data_remove_and_delete_row(),
396 netsnmp_table_dataset_delete_all_data(), and
397 netsnmp_table_data_set_s::table.
398
399 Referenced by netsnmp_table_data_set_helper_handler().
400
401 NETSNMP_INLINE void netsnmp_table_dataset_remove_row
402 (netsnmp_table_data_set * table, netsnmp_table_row * row)
403 removes a row from the table, but doesn't delete/free the column values
404
405 Definition at line 192 of file table_dataset.c.
406
407 References netsnmp_table_data_remove_and_delete_row(), and
408 netsnmp_table_data_set_s::table.
409
410 NETSNMP_INLINE void netsnmp_table_dataset_replace_row
411 (netsnmp_table_data_set * table, netsnmp_table_row * origrow,
412 netsnmp_table_row * newrow)
413 adds a new row to a dataset table
414
415 Definition at line 181 of file table_dataset.c.
416
417 References netsnmp_table_data_replace_row(), and
418 netsnmp_table_data_set_s::table.
419
420 Referenced by netsnmp_table_data_set_helper_handler().
421
422 int netsnmp_table_set_add_default_row (netsnmp_table_data_set * table_set,
423 unsigned int column, int type, int writable, void * default_value,
424 size_t default_value_len)
425 adds a new default row to a table_set.
426
427 Arguments should be the table_set, column number, variable type and
428 finally a 1 if it is allowed to be writable, or a 0 if not. If the
429 default_value field is not NULL, it will be used to populate new valuse
430 in that column fro newly created rows. It is copied into the storage
431 template (free your calling argument).
432
433 returns SNMPERR_SUCCESS or SNMPERR_FAILURE
434
435 Definition at line 252 of file table_dataset.c.
436
437 References netsnmp_table_data_set_storage_s::column,
438 netsnmp_table_data_set_storage_s::data,
439 netsnmp_table_data_set_storage_s::data_len,
440 netsnmp_table_data_set_s::default_row, memdup(),
441 netsnmp_table_data_set_find_column(),
442 netsnmp_table_data_set_storage_s::next, NULL, snmp_log(),
443 SNMP_MALLOC_TYPEDEF, netsnmp_table_data_set_storage_s::type,
444 netsnmp_table_data_set_storage_s::voidp, and
445 netsnmp_table_data_set_storage_s::writable.
446
447 Referenced by netsnmp_config_parse_table_set(), and
448 netsnmp_table_set_multi_add_default_row().
449
450 void netsnmp_table_set_add_indexes (netsnmp_table_data_set * tset, ...)
451 adds multiple indexes to a table_dataset helper object.
452
453 To end the list, use a 0 after the list of ASN index types.
454
455 Definition at line 1267 of file table_dataset.c.
456
457 References netsnmp_table_dataset_add_index().
458
459 void netsnmp_table_set_multi_add_default_row (netsnmp_table_data_set *
460 tset, ...)
461 adds multiple data column definitions to each row.
462
463 Functionally, this is a wrapper around calling
464 netsnmp_table_set_add_default_row repeatedly for you.
465
466 Examples:
467 data_set.c.
468
469 Definition at line 313 of file table_dataset.c.
470
471 References netsnmp_table_set_add_default_row().
472
473
474
475Version 5.4 24 Nov 2006 table_dataset(3)