1table_array(3) net-snmp table_array(3)
2
3
4
6 table_array - Helps you implement a table when data can be stored
7 locally.
8
9
10 Functions
11 int netsnmp_table_container_register (netsnmp_handler_registration
12 *reginfo, netsnmp_table_registration_info *tabreg,
13 netsnmp_table_array_callbacks *cb, netsnmp_container *container,
14 int group_rows)
15 register specified callbacks for the specified table/oid.
16 int netsnmp_table_array_register (netsnmp_handler_registration
17 *reginfo, netsnmp_table_registration_info *tabreg,
18 netsnmp_table_array_callbacks *cb, netsnmp_container *container,
19 int group_rows)
20 netsnmp_mib_handler * netsnmp_find_table_array_handler
21 (netsnmp_handler_registration *reginfo)
22 find the handler for the table_array helper.
23 netsnmp_container * netsnmp_extract_array_context (netsnmp_request_info
24 *request)
25 find the context data used by the table_array helper
26 int netsnmp_table_array_check_row_status (netsnmp_table_array_callbacks
27 *cb, netsnmp_request_group *ag, long *rs_new, long *rs_old)
28 this function is called to validate RowStatus transitions.
29
31 Helps you implement a table when data can be stored locally.
32
33 The data is stored in a sorted array, using a binary search for
34 lookups.
35
36 The table_array handler is used (automatically) in conjuntion with the
37 table handler. It is primarily intended to be used with the mib2c
38 configuration file mib2c.array-user.conf.
39
40 The code generated by mib2c is useful when you have control of the data
41 for each row. If you cannot control when rows are added and deleted (or
42 at least be notified of changes to row data), then this handler is
43 probably not for you.
44
45 This handler makes use of callbacks (function pointers) to handle
46 various tasks. Code is generated for each callback, but will need to be
47 reviewed and flushed out by the user.
48
49 NOTE NOTE NOTE: Once place where mib2c is somewhat lacking is with
50 regards to tables with external indices. If your table makes use of one
51 or more external indices, please review the generated code very
52 carefully for comments regarding external indices.
53
54 NOTE NOTE NOTE: This helper, the API and callbacks are still being
55 tested and may change.
56
57 The generated code will define a structure for storage of table related
58 data. This structure must be used, as it contains the index OID for the
59 row, which is used for keeping the array sorted. You can add addition
60 fields or data to the structure for your own use.
61
62 The generated code will also have code to handle SNMP-SET processing.
63 If your table does not support any SET operations, simply comment out
64 the #define <PREFIX>_SET_HANDLING (where <PREFIX> is your table name)
65 in the header file.
66
67 SET processing modifies the row in-place. The duplicate_row callback
68 will be called to save a copy of the original row. In the event of a
69 failure before the commite phase, the row_copy callback will be called
70 to restore the original row from the copy.
71
72 Code will be generated to handle row creation. This code may be
73 disabled by commenting out the #define <PREFIX>_ROW_CREATION in the
74 header file.
75
76 If your table contains a RowStatus object, by default the code will not
77 allow object in an active row to be modified. To allow active rows to
78 be modified, remove the comment block around the #define
79 <PREFIX>_CAN_MODIFY_ACTIVE_ROW in the header file.
80
81 Code will be generated to maintain a secondary index for all rows,
82 stored in a binary tree. This is very useful for finding rows by a key
83 other than the OID index. By default, the functions for maintaining
84 this tree will be based on a character string. NOTE: this will likely
85 be made into a more generic mechanism, using new callback methods, in
86 the near future.
87
88 The generated code contains many TODO comments. Make sure you check
89 each one to see if it applies to your code. Examples include checking
90 indices for syntax (ranges, etc), initializing default values in newly
91 created rows, checking for row activation and deactivation
92 requirements, etc.
93
95 netsnmp_container* netsnmp_extract_array_context (netsnmp_request_info *
96 request)
97 find the context data used by the table_array helper
98
99 Definition at line 229 of file table_array.c.
100
101 References netsnmp_request_get_list_data().
102
103 netsnmp_mib_handler* netsnmp_find_table_array_handler
104 (netsnmp_handler_registration * reginfo)
105 find the handler for the table_array helper.
106
107 Definition at line 212 of file table_array.c.
108
109 References netsnmp_mib_handler_s::access_method,
110 netsnmp_handler_registration_s::handler, netsnmp_mib_handler_s::next,
111 and NULL.
112
113 int netsnmp_table_array_check_row_status (netsnmp_table_array_callbacks *
114 cb, netsnmp_request_group * ag, long * rs_new, long * rs_old)
115 this function is called to validate RowStatus transitions.
116
117 Definition at line 236 of file table_array.c.
118
119 References netsnmp_table_array_callbacks_s::can_activate,
120 netsnmp_table_array_callbacks_s::can_deactivate,
121 netsnmp_table_array_callbacks_s::can_delete,
122 netsnmp_request_group_s::existing_row, NULL,
123 netsnmp_request_group_s::row_deleted, and
124 netsnmp_request_group_s::undo_info.
125
126 int netsnmp_table_container_register (netsnmp_handler_registration *
127 reginfo, netsnmp_table_registration_info * tabreg,
128 netsnmp_table_array_callbacks * cb, netsnmp_container * container, int
129 group_rows)
130 register specified callbacks for the specified table/oid.
131
132 If the group_rows parameter is set, the row related callbacks will be
133 called once for each unique row index. Otherwise, each callback will be
134 called only once, for all objects.
135
136 Definition at line 149 of file table_array.c.
137
138 References netsnmp_table_array_callbacks_s::can_set,
139 table_container_data_s::cb, netsnmp_container_s::compare,
140 netsnmp_table_array_callbacks_s::delete_row,
141 netsnmp_table_array_callbacks_s::duplicate_row,
142 netsnmp_handler_registration_s::handler, netsnmp_mib_handler_s::myvoid,
143 netsnmp_container_s::ncompare, netsnmp_register_table(), NULL,
144 netsnmp_table_array_callbacks_s::row_copy, snmp_log(),
145 SNMP_MALLOC_TYPEDEF, table_container_data_s::table, and
146 table_container_data_s::tblreg_info.
147
148 Referenced by netsnmp_table_array_register().
149
150
151
152Version 5.4 24 Nov 2006 table_array(3)