21
22
.RI "void \fBnetsnmp_table_data_generate_index_oid\fP (netsnmp_table_row *row)"
23
.RI "\fIgenerates the index portion of an table oid from a varlist.\fP"
24
.RI "\fIgenerates the index portion of an table oid from a varlist. \fP"
25
26
.RI "int \fBnetsnmp_table_data_add_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
27
.RI "\fIAdds a row of data to a given table (stored in proper lexographical order).\fP"
28
.RI "\fIAdds a row of data to a given table (stored in proper lexographical order). \fP"
29
30
.RI "netsnmp_table_row * \fBnetsnmp_table_data_remove_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
31
.RI "\fIremoves a row of data to a given table and returns it (no free's called)\fP"
32
.RI "\fIremoves a row of data to a given table and returns it (no free's called) \fP"
33
34
.RI "void * \fBnetsnmp_table_data_delete_row\fP (netsnmp_table_row *row)"
35
.RI "\fIdeletes a row's memory.\fP"
36
.RI "\fIdeletes a row's memory. \fP"
37
38
.RI "void * \fBnetsnmp_table_data_remove_and_delete_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
39
.RI "\fIremoves and frees a row of data to a given table and returns the void *\fP"
40
.RI "\fIremoves and frees a row of data to a given table and returns the void * \fP"
41
42
.RI "NETSNMP_INLINE void \fBnetsnmp_table_data_replace_row\fP (netsnmp_table_data *table, netsnmp_table_row *origrow, netsnmp_table_row *newrow)"
43
.RI "\fIswaps out origrow with newrow.\fP"
44
.RI "\fIswaps out origrow with newrow. \fP"
45
.RI "netsnmp_table_row * \fBnetsnmp_table_data_get\fP (netsnmp_table_data *table, netsnmp_variable_list *indexes)"
46
.RI "netsnmp_table_row * \fBnetsnmp_table_data_get\fP (netsnmp_table_data *table, \fBnetsnmp_variable_list\fP *indexes)"
47
.RI "\fIfinds the data in 'datalist' stored at 'indexes'\fP"
48
.RI "\fIfinds the data in 'datalist' stored at 'indexes' \fP"
49
50
.RI "netsnmp_table_row * \fBnetsnmp_table_data_get_from_oid\fP (netsnmp_table_data *table, oid *searchfor, size_t searchfor_len)"
51
.RI "\fIfinds the data in 'datalist' stored at the searchfor oid\fP"
52
.RI "\fIfinds the data in 'datalist' stored at the searchfor oid \fP"
53
54
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_get_table_data_handler\fP (netsnmp_table_data *table)"
55
.RI "\fICreates a table_data handler and returns it.\fP"
57
.RI "int \fBnetsnmp_register_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)"
59
.RI "\fIregisters a handler as a data table.\fP"
61
.RI "int \fBnetsnmp_register_read_only_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)"
63
.RI "\fIregisters a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.\fP"
65
.RI "int \fBnetsnmp_table_data_helper_handler\fP (\fBnetsnmp_mib_handler\fP *handler, \fBnetsnmp_handler_registration\fP *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
67
.RI "\fIThe helper handler that takes care of passing a specific row of data down to the lower handler(s).\fP"
56
.RI "\fICreates a table_data handler and returns it. \fP"
58
.RI "int \fBnetsnmp_register_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_table_data *table, \fBnetsnmp_table_registration_info\fP *table_info)"
60
.RI "\fIregisters a handler as a data table. \fP"
62
.RI "int \fBnetsnmp_register_read_only_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_table_data *table, \fBnetsnmp_table_registration_info\fP *table_info)"
64
.RI "\fIregisters a handler as a read-only data table If table_info != NULL, it registers it as a normal table too. \fP"
66
.RI "int \fBnetsnmp_table_data_helper_handler\fP (\fBnetsnmp_mib_handler\fP *handler, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
68
.RI "\fIThe helper handler that takes care of passing a specific row of data down to the lower handler(s). \fP"
69
70
.RI "netsnmp_table_data * \fBnetsnmp_create_table_data\fP (const char *name)"
71
.RI "\fIcreates and returns a pointer to table data set\fP"
72
.RI "\fIcreates and returns a pointer to table data set \fP"
73
74
.RI "netsnmp_table_row * \fBnetsnmp_create_table_data_row\fP (void)"
75
.RI "\fIcreates and returns a pointer to table data set\fP"
77
.RI "netsnmp_table_row * \fBnetsnmp_extract_table_row\fP (netsnmp_request_info *request)"
79
.RI "\fIextracts the row being accessed passed from the table_data helper\fP"
81
.RI "void * \fBnetsnmp_extract_table_row_data\fP (netsnmp_request_info *request)"
83
.RI "\fIextracts the data from the row being accessed passed from the table_data helper\fP"
85
.RI "int \fBnetsnmp_table_data_build_result\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *request, netsnmp_table_row *row, int column, u_char type, u_char *result_data, size_t result_data_len)"
87
.RI "\fIbuilds a result given a row, a varbind to set and the data\fP"
76
.RI "\fIcreates and returns a pointer to table data set \fP"
78
.RI "netsnmp_table_row * \fBnetsnmp_extract_table_row\fP (\fBnetsnmp_request_info\fP *request)"
80
.RI "\fIextracts the row being accessed passed from the table_data helper \fP"
82
.RI "void * \fBnetsnmp_extract_table_row_data\fP (\fBnetsnmp_request_info\fP *request)"
84
.RI "\fIextracts the data from the row being accessed passed from the table_data helper \fP"
86
.RI "int \fBnetsnmp_table_data_build_result\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *request, netsnmp_table_row *row, int column, u_char type, u_char *result_data, size_t result_data_len)"
88
.RI "\fIbuilds a result given a row, a varbind to set and the data \fP"
89
90
.RI "netsnmp_table_row * \fBnetsnmp_table_data_clone_row\fP (netsnmp_table_row *row)"
91
.RI "\fIclones a data row.\fP"
92
.RI "\fIclones a data row. \fP"
94
.RI "int \fBnetsnmp_table_data_num_rows\fP (netsnmp_table_data *table)"
93
.SH "DETAILED DESCRIPTION"
97
.SH "Detailed Description"
95
This helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location.
97
It can be used to store a list of rows, where a row consists of the indexes to the table and a generic data pointer. You can then implement a subhandler which is passed the exact row definition and data it must return data for or accept data for. Complex GETNEXT handling is greatly simplified in this case.
98
.SH "FUNCTION DOCUMENTATION"
99
This helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location. It can be used to store a list of rows, where a row consists of the indexes to the table and a generic data pointer. You can then implement a subhandler which is passed the exact row definition and data it must return data for or accept data for. Complex GETNEXT handling is greatly simplified in this case.
100
.SH "Function Documentation"
100
102
.SS "netsnmp_table_data* netsnmp_create_table_data (const char * name)"
102
creates and returns a pointer to table data set
104
Definition at line 529 of file table_data.c.
104
creates and returns a pointer to table data set Definition at line 529 of file table_data.c.
106
106
References SNMP_MALLOC_TYPEDEF.
108
108
Referenced by netsnmp_create_table_data_set().
109
109
.SS "netsnmp_table_row* netsnmp_create_table_data_row (void)"
111
creates and returns a pointer to table data set
111
creates and returns a pointer to table data set
119
119
References SNMP_MALLOC_TYPEDEF.
121
121
Referenced by netsnmp_table_data_set_create_row_from_defaults().
122
.SS "netsnmp_table_row* netsnmp_extract_table_row (netsnmp_request_info * request)"
124
extracts the row being accessed passed from the table_data helper
126
Definition at line 547 of file table_data.c.
122
.SS "netsnmp_table_row* netsnmp_extract_table_row (\fBnetsnmp_request_info\fP * request)"
124
extracts the row being accessed passed from the table_data helper Definition at line 547 of file table_data.c.
128
126
References netsnmp_request_get_list_data().
130
128
Referenced by netsnmp_extract_table_row_data(), and netsnmp_table_data_set_helper_handler().
131
.SS "void* netsnmp_extract_table_row_data (netsnmp_request_info * request)"
133
extracts the data from the row being accessed passed from the table_data helper
135
Definition at line 556 of file table_data.c.
129
.SS "void* netsnmp_extract_table_row_data (\fBnetsnmp_request_info\fP * request)"
131
extracts the data from the row being accessed passed from the table_data helper Definition at line 556 of file table_data.c.
137
133
References netsnmp_extract_table_row().
139
135
Referenced by netsnmp_extract_table_data_set_column().
140
136
.SS "\fBnetsnmp_mib_handler\fP* netsnmp_get_table_data_handler (netsnmp_table_data * table)"
142
Creates a table_data handler and returns it.
144
Definition at line 236 of file table_data.c.
146
References netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_table_data_helper_handler(), and snmp_log().
138
Creates a table_data handler and returns it. Definition at line 236 of file table_data.c.
140
References netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_mib_handler, and snmp_log().
148
142
Referenced by netsnmp_register_table_data().
149
.SS "int netsnmp_register_read_only_table_data (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)"
151
registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.
153
Definition at line 269 of file table_data.c.
155
References netsnmp_get_read_only_handler(), netsnmp_inject_handler(), and netsnmp_register_table_data().
156
.SS "int netsnmp_register_table_data (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)"
158
registers a handler as a data table.
160
If table_info != NULL, it registers it as a normal table too.
162
Definition at line 258 of file table_data.c.
164
References netsnmp_get_table_data_handler(), netsnmp_inject_handler(), and netsnmp_register_table().
143
.SS "int netsnmp_register_read_only_table_data (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_table_data * table, \fBnetsnmp_table_registration_info\fP * table_info)"
145
registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too. Definition at line 269 of file table_data.c.
147
References netsnmp_get_read_only_handler(), netsnmp_handler_registration, netsnmp_inject_handler(), and netsnmp_register_table_data().
148
.SS "int netsnmp_register_table_data (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_table_data * table, \fBnetsnmp_table_registration_info\fP * table_info)"
150
registers a handler as a data table. If table_info != NULL, it registers it as a normal table too. Definition at line 258 of file table_data.c.
152
References netsnmp_get_table_data_handler(), netsnmp_handler_registration, netsnmp_inject_handler(), and netsnmp_register_table().
166
154
Referenced by netsnmp_register_read_only_table_data(), and netsnmp_register_table_data_set().
167
155
.SS "int netsnmp_table_data_add_row (netsnmp_table_data * table, netsnmp_table_row * row)"
169
Adds a row of data to a given table (stored in proper lexographical order).
171
returns SNMPERR_SUCCESS on successful addition. or SNMPERR_GENERR on failure (E.G., indexes already existed)
173
Definition at line 51 of file table_data.c.
157
Adds a row of data to a given table (stored in proper lexographical order). returns SNMPERR_SUCCESS on successful addition. or SNMPERR_GENERR on failure (E.G., indexes already existed) Definition at line 51 of file table_data.c.
175
159
References netsnmp_table_data_generate_index_oid(), snmp_log(), and snmp_oid_compare().
177
161
Referenced by netsnmp_table_data_replace_row(), and netsnmp_table_dataset_add_row().
178
.SS "int netsnmp_table_data_build_result (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * request, netsnmp_table_row * row, int column, u_char type, u_char * result_data, size_t result_data_len)"
180
builds a result given a row, a varbind to set and the data
182
Definition at line 568 of file table_data.c.
184
References netsnmp_agent_request_info_s::mode, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and snmp_set_var_typed_value().
162
.SS "int netsnmp_table_data_build_result (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * request, netsnmp_table_row * row, int column, u_char type, u_char * result_data, size_t result_data_len)"
164
builds a result given a row, a varbind to set and the data Definition at line 568 of file table_data.c.
166
References netsnmp_agent_request_info_s::mode, netsnmp_handler_registration, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and snmp_set_var_typed_value().
186
168
Referenced by netsnmp_table_data_helper_handler(), and netsnmp_table_data_set_helper_handler().
187
169
.SS "netsnmp_table_row* netsnmp_table_data_clone_row (netsnmp_table_row * row)"
191
DOES NOT CLONE THE CONTAINED DATA.
193
Definition at line 602 of file table_data.c.
171
clones a data row. DOES NOT CLONE THE CONTAINED DATA. Definition at line 602 of file table_data.c.
195
173
References memdup().
197
175
Referenced by netsnmp_table_data_set_clone_row().
198
176
.SS "void* netsnmp_table_data_delete_row (netsnmp_table_row * row)"
200
deletes a row's memory.
202
returns the void data that it doesn't know how to delete.
204
Definition at line 150 of file table_data.c.
178
deletes a row's memory. returns the void data that it doesn't know how to delete. Definition at line 150 of file table_data.c.
206
180
References SNMP_FREE.
208
182
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_dataset_delete_row().
209
183
.SS "void netsnmp_table_data_generate_index_oid (netsnmp_table_row * row)"
211
generates the index portion of an table oid from a varlist.
185
generates the index portion of an table oid from a varlist. Definition at line 39 of file table_data.c.
213
Definition at line 39 of file table_data.c.
187
References build_oid().
215
189
Referenced by netsnmp_table_data_add_row().
216
.SS "netsnmp_table_row* netsnmp_table_data_get (netsnmp_table_data * table, netsnmp_variable_list * indexes)"
218
finds the data in 'datalist' stored at 'indexes'
220
Definition at line 204 of file table_data.c.
190
.SS "netsnmp_table_row* netsnmp_table_data_get (netsnmp_table_data * table, \fBnetsnmp_variable_list\fP * indexes)"
192
finds the data in 'datalist' stored at 'indexes' Definition at line 204 of file table_data.c.
222
194
References netsnmp_table_data_get_from_oid().
223
195
.SS "netsnmp_table_row* netsnmp_table_data_get_from_oid (netsnmp_table_data * table, oid * searchfor, size_t searchfor_len)"
225
finds the data in 'datalist' stored at the searchfor oid
227
Definition at line 218 of file table_data.c.
197
finds the data in 'datalist' stored at the searchfor oid Definition at line 218 of file table_data.c.
229
199
References snmp_oid_compare().
231
201
Referenced by netsnmp_table_data_get(), and netsnmp_table_data_helper_handler().
232
.SS "int netsnmp_table_data_helper_handler (\fBnetsnmp_mib_handler\fP * handler, \fBnetsnmp_handler_registration\fP * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
234
The helper handler that takes care of passing a specific row of data down to the lower handler(s).
236
It sets request->processed if the request should not be handled.
238
Definition at line 285 of file table_data.c.
240
References netsnmp_table_request_info_s::colnum, netsnmp_table_registration_info_s::max_column, netsnmp_table_registration_info_s::min_column, netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid, variable_list::name, variable_list::name_length, netsnmp_call_next_handler(), netsnmp_extract_table_info(), netsnmp_find_table_registration_info(), netsnmp_request_add_list_data(), netsnmp_set_request_error(), netsnmp_table_data_build_result(), netsnmp_table_data_get_from_oid(), netsnmp_request_info_s::next, netsnmp_request_info_s::processed, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, SNMP_MIN, snmp_oid_compare(), and variable_list::type.
242
Referenced by netsnmp_get_table_data_handler().
202
.SS "int netsnmp_table_data_helper_handler (\fBnetsnmp_mib_handler\fP * handler, \fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests)"
204
The helper handler that takes care of passing a specific row of data down to the lower handler(s). It sets request->processed if the request should not be handled. Definition at line 285 of file table_data.c.
206
References netsnmp_table_request_info_s::colnum, netsnmp_table_registration_info_s::max_column, netsnmp_table_registration_info_s::min_column, netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid, variable_list::name, variable_list::name_length, netsnmp_call_next_handler(), netsnmp_create_data_list(), netsnmp_extract_table_info(), netsnmp_find_table_registration_info(), netsnmp_handler_registration, netsnmp_mib_handler, netsnmp_request_add_list_data(), netsnmp_set_request_error(), netsnmp_table_data_build_result(), netsnmp_table_data_get_from_oid(), netsnmp_request_info_s::next, netsnmp_request_info_s::processed, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, SNMP_MIN, snmp_oid_compare(), and variable_list::type.
243
207
.SS "void* netsnmp_table_data_remove_and_delete_row (netsnmp_table_data * table, netsnmp_table_row * row)"
245
removes and frees a row of data to a given table and returns the void *
247
returns the void * data on successful deletion. or NULL on failure (bad arguments)
249
Definition at line 179 of file table_data.c.
209
removes and frees a row of data to a given table and returns the void * returns the void * data on successful deletion. or NULL on failure (bad arguments) Definition at line 179 of file table_data.c.
251
211
References netsnmp_table_data_delete_row(), and netsnmp_table_data_remove_row().
253
213
Referenced by netsnmp_table_dataset_remove_and_delete_row(), and netsnmp_table_dataset_remove_row().
254
214
.SS "netsnmp_table_row* netsnmp_table_data_remove_row (netsnmp_table_data * table, netsnmp_table_row * row)"
256
removes a row of data to a given table and returns it (no free's called)
258
returns the row pointer itself on successful removing. or NULL on failure (bad arguments)
260
Definition at line 130 of file table_data.c.
216
removes a row of data to a given table and returns it (no free's called) returns the row pointer itself on successful removing. or NULL on failure (bad arguments) Definition at line 130 of file table_data.c.
262
218
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_data_replace_row().
263
219
.SS "NETSNMP_INLINE void netsnmp_table_data_replace_row (netsnmp_table_data * table, netsnmp_table_row * origrow, netsnmp_table_row * newrow)"
265
swaps out origrow with newrow.
267
This does *not* delete/free anything!
269
Definition at line 194 of file table_data.c.
221
swaps out origrow with newrow. This does *not* delete/free anything! Definition at line 194 of file table_data.c.
271
223
References netsnmp_table_data_add_row(), and netsnmp_table_data_remove_row().