1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
|
.TH "table_data" 3 "14 Jul 2006" "Version 5.2.3" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
table_data \- Helps you implement a table with datamatted storage.
.PP
.SS "Modules"
.in +1c
.ti -1c
.RI "\fBtable_dataset\fP"
.br
.RI "\fIHelps you implement a table with automatted storage. \fP"
.PP
.in -1c
.SS "Functions"
.in +1c
.ti -1c
.RI "void \fBnetsnmp_table_data_generate_index_oid\fP (\fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIgenerates the index portion of an table oid from a varlist. \fP"
.ti -1c
.RI "int \fBnetsnmp_table_data_add_row\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIAdds a row of data to a given table (stored in proper lexographical order). \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_remove_row\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIremoves a row of data to a given table and returns it (no free's called) \fP"
.ti -1c
.RI "void * \fBnetsnmp_table_data_delete_row\fP (\fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIdeletes a row's memory. \fP"
.ti -1c
.RI "void * \fBnetsnmp_table_data_remove_and_delete_row\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIremoves and frees a row of data to a given table and returns the void * \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_table_data_replace_row\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_row\fP *origrow, \fBnetsnmp_table_row\fP *newrow)"
.br
.RI "\fIswaps out origrow with newrow. \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_get\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_variable_list\fP *indexes)"
.br
.RI "\fIfinds the data in 'datalist' stored at 'indexes' \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_get_from_oid\fP (\fBnetsnmp_table_data\fP *table, oid *searchfor, size_t searchfor_len)"
.br
.RI "\fIfinds the data in 'datalist' stored at the searchfor oid \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_get_first_row\fP (\fBnetsnmp_table_data\fP *table)"
.br
.RI "\fIreturns the first row in the table \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_get_next_row\fP (\fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIreturns the next row in the table \fP"
.ti -1c
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_get_table_data_handler\fP (\fBnetsnmp_table_data\fP *table)"
.br
.RI "\fICreates a table_data handler and returns it. \fP"
.ti -1c
.RI "int \fBnetsnmp_register_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_registration_info\fP *table_info)"
.br
.RI "\fIregisters a handler as a data table. \fP"
.ti -1c
.RI "int \fBnetsnmp_register_read_only_table_data\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_table_data\fP *table, \fBnetsnmp_table_registration_info\fP *table_info)"
.br
.RI "\fIregisters a handler as a read-only data table If table_info != NULL, it registers it as a normal table too. \fP"
.ti -1c
.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)"
.br
.RI "\fIThe helper handler that takes care of passing a specific row of data down to the lower handler(s). \fP"
.ti -1c
.RI "\fBnetsnmp_table_data\fP * \fBnetsnmp_create_table_data\fP (const char *name)"
.br
.RI "\fIcreates and returns a pointer to table data set \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_create_table_data_row\fP (void)"
.br
.RI "\fIcreates and returns a pointer to table data set \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_insert_table_row\fP (\fBnetsnmp_request_info\fP *request, \fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIinserts a newly created table_data row into a request \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_extract_table_row\fP (\fBnetsnmp_request_info\fP *request)"
.br
.RI "\fIextracts the row being accessed passed from the table_data helper \fP"
.ti -1c
.RI "\fBnetsnmp_table_data\fP * \fBnetsnmp_extract_table\fP (\fBnetsnmp_request_info\fP *request)"
.br
.RI "\fIextracts the table being accessed passed from the table_data helper \fP"
.ti -1c
.RI "void * \fBnetsnmp_extract_table_row_data\fP (\fBnetsnmp_request_info\fP *request)"
.br
.RI "\fIextracts the data from the row being accessed passed from the table_data helper \fP"
.ti -1c
.RI "int \fBnetsnmp_table_data_build_result\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *request, \fBnetsnmp_table_row\fP *row, int column, u_char type, u_char *result_data, size_t result_data_len)"
.br
.RI "\fIbuilds a result given a row, a varbind to set and the data \fP"
.ti -1c
.RI "\fBnetsnmp_table_row\fP * \fBnetsnmp_table_data_clone_row\fP (\fBnetsnmp_table_row\fP *row)"
.br
.RI "\fIclones a data row. \fP"
.ti -1c
.RI "int \fBnetsnmp_table_data_num_rows\fP (\fBnetsnmp_table_data\fP *table)"
.br
.in -1c
.SH "Detailed Description"
.PP
Helps you implement a table with datamatted storage.
.PP
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.
.SH "Function Documentation"
.PP
.SS "\fBnetsnmp_table_data\fP* netsnmp_create_table_data (const char * name)"
.PP
creates and returns a pointer to table data set
.PP
Definition at line 564 of file table_data.c.
.PP
References netsnmp_table_data_s::name, and SNMP_MALLOC_TYPEDEF.
.PP
Referenced by netsnmp_create_table_data_set().
.SS "\fBnetsnmp_table_row\fP* netsnmp_create_table_data_row (void)"
.PP
creates and returns a pointer to table data set
.PP
\fBExamples: \fP
.in +1c
\fBdata_set.c\fP.
.PP
Definition at line 574 of file table_data.c.
.PP
References SNMP_MALLOC_TYPEDEF.
.PP
Referenced by netsnmp_config_parse_add_row(), and netsnmp_table_data_set_create_row_from_defaults().
.SS "\fBnetsnmp_table_data\fP* netsnmp_extract_table (\fBnetsnmp_request_info\fP * request)"
.PP
extracts the table being accessed passed from the table_data helper
.PP
Definition at line 655 of file table_data.c.
.PP
References netsnmp_request_get_list_data().
.SS "\fBnetsnmp_table_row\fP* netsnmp_extract_table_row (\fBnetsnmp_request_info\fP * request)"
.PP
extracts the row being accessed passed from the table_data helper
.PP
Definition at line 647 of file table_data.c.
.PP
References netsnmp_request_get_list_data().
.PP
Referenced by netsnmp_extract_table_row_data(), and netsnmp_table_data_set_helper_handler().
.SS "void* netsnmp_extract_table_row_data (\fBnetsnmp_request_info\fP * request)"
.PP
extracts the data from the row being accessed passed from the table_data helper
.PP
Definition at line 664 of file table_data.c.
.PP
References netsnmp_table_row_s::data, netsnmp_extract_table_row(), and NULL.
.PP
Referenced by netsnmp_extract_table_data_set_column().
.SS "\fBnetsnmp_mib_handler\fP* netsnmp_get_table_data_handler (\fBnetsnmp_table_data\fP * table)"
.PP
Creates a table_data handler and returns it.
.PP
Definition at line 283 of file table_data.c.
.PP
References netsnmp_mib_handler_s::flags, MIB_HANDLER_AUTO_NEXT, netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_table_data_helper_handler(), NULL, and snmp_log().
.PP
Referenced by netsnmp_register_table_data().
.SS "NETSNMP_INLINE void netsnmp_insert_table_row (\fBnetsnmp_request_info\fP * request, \fBnetsnmp_table_row\fP * row)"
.PP
inserts a newly created table_data row into a request
.PP
Definition at line 582 of file table_data.c.
.PP
References build_oid_noalloc(), netsnmp_table_request_info_s::indexes, netsnmp_create_data_list(), netsnmp_extract_table_info(), netsnmp_request_add_list_data(), netsnmp_request_info_s::next, NULL, netsnmp_request_info_s::prev, and snmp_oid_compare().
.SS "int netsnmp_register_read_only_table_data (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_registration_info\fP * table_info)"
.PP
registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.
.PP
Definition at line 317 of file table_data.c.
.PP
References netsnmp_get_read_only_handler(), netsnmp_inject_handler(), and netsnmp_register_table_data().
.SS "int netsnmp_register_table_data (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_registration_info\fP * table_info)"
.PP
registers a handler as a data table.
.PP
If table_info != NULL, it registers it as a normal table too.
.PP
Definition at line 306 of file table_data.c.
.PP
References netsnmp_get_table_data_handler(), netsnmp_inject_handler(), and netsnmp_register_table().
.PP
Referenced by netsnmp_register_read_only_table_data(), and netsnmp_register_table_data_set().
.SS "int netsnmp_table_data_add_row (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_row\fP * row)"
.PP
Adds a row of data to a given table (stored in proper lexographical order).
.PP
returns SNMPERR_SUCCESS on successful addition. or SNMPERR_GENERR on failure (E.G., indexes already existed)
.PP
xxx-rks: remove invalid row?
.PP
Definition at line 52 of file table_data.c.
.PP
References netsnmp_table_data_s::first_row, netsnmp_table_row_s::index_oid, netsnmp_table_row_s::index_oid_len, netsnmp_table_row_s::indexes, netsnmp_table_data_s::last_row, netsnmp_table_data_s::name, netsnmp_table_data_generate_index_oid(), netsnmp_table_row_s::next, NULL, netsnmp_table_row_s::prev, snmp_free_varbind(), snmp_log(), snmp_oid_compare(), and netsnmp_table_data_s::store_indexes.
.PP
Referenced by netsnmp_config_parse_add_row(), netsnmp_table_data_replace_row(), and netsnmp_table_dataset_add_row().
.SS "int netsnmp_table_data_build_result (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * request, \fBnetsnmp_table_row\fP * row, int column, u_char type, u_char * result_data, size_t result_data_len)"
.PP
builds a result given a row, a varbind to set and the data
.PP
Definition at line 676 of file table_data.c.
.PP
References netsnmp_table_row_s::index_oid, netsnmp_table_row_s::index_oid_len, netsnmp_agent_request_info_s::mode, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_set_var_objid(), and snmp_set_var_typed_value().
.PP
Referenced by netsnmp_table_data_set_helper_handler().
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_clone_row (\fBnetsnmp_table_row\fP * row)"
.PP
clones a data row.
.PP
DOES NOT CLONE THE CONTAINED DATA.
.PP
Definition at line 710 of file table_data.c.
.PP
References memdup(), NULL, and snmp_clone_varbind().
.PP
Referenced by netsnmp_table_data_set_clone_row().
.SS "void* netsnmp_table_data_delete_row (\fBnetsnmp_table_row\fP * row)"
.PP
deletes a row's memory.
.PP
returns the void data that it doesn't know how to delete.
.PP
Definition at line 178 of file table_data.c.
.PP
References netsnmp_table_row_s::data, netsnmp_table_row_s::index_oid, netsnmp_table_row_s::indexes, NULL, SNMP_FREE, and snmp_free_varbind().
.PP
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_dataset_delete_row().
.SS "void netsnmp_table_data_generate_index_oid (\fBnetsnmp_table_row\fP * row)"
.PP
generates the index portion of an table oid from a varlist.
.PP
Definition at line 40 of file table_data.c.
.PP
References build_oid(), netsnmp_table_row_s::index_oid, netsnmp_table_row_s::index_oid_len, netsnmp_table_row_s::indexes, and NULL.
.PP
Referenced by netsnmp_table_data_add_row().
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_get (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_variable_list\fP * indexes)"
.PP
finds the data in 'datalist' stored at 'indexes'
.PP
Definition at line 232 of file table_data.c.
.PP
References build_oid_noalloc(), netsnmp_table_data_get_from_oid(), and NULL.
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_get_first_row (\fBnetsnmp_table_data\fP * table)"
.PP
returns the first row in the table
.PP
Definition at line 264 of file table_data.c.
.PP
References netsnmp_table_data_s::first_row, and NULL.
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_get_from_oid (\fBnetsnmp_table_data\fP * table, oid * searchfor, size_t searchfor_len)"
.PP
finds the data in 'datalist' stored at the searchfor oid
.PP
Definition at line 246 of file table_data.c.
.PP
References netsnmp_table_data_s::first_row, netsnmp_table_row_s::index_oid, netsnmp_table_row_s::index_oid_len, netsnmp_table_row_s::next, NULL, and snmp_oid_compare().
.PP
Referenced by netsnmp_table_data_get().
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_get_next_row (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_row\fP * row)"
.PP
returns the next row in the table
.PP
Definition at line 273 of file table_data.c.
.PP
References netsnmp_table_row_s::next, and NULL.
.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)"
.PP
The helper handler that takes care of passing a specific row of data down to the lower handler(s).
.PP
It sets request->processed if the request should not be handled.
.PP
Definition at line 333 of file table_data.c.
.PP
References netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid, netsnmp_create_data_list(), netsnmp_extract_table_info(), netsnmp_find_table_registration_info(), netsnmp_request_add_list_data(), netsnmp_request_info_s::next, and NULL.
.PP
Referenced by netsnmp_get_table_data_handler().
.SS "void* netsnmp_table_data_remove_and_delete_row (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_row\fP * row)"
.PP
removes and frees a row of data to a given table and returns the void *
.PP
returns the void * data on successful deletion. or NULL on failure (bad arguments)
.PP
Definition at line 207 of file table_data.c.
.PP
References netsnmp_table_data_delete_row(), netsnmp_table_data_remove_row(), and NULL.
.PP
Referenced by netsnmp_table_dataset_remove_and_delete_row(), and netsnmp_table_dataset_remove_row().
.SS "\fBnetsnmp_table_row\fP* netsnmp_table_data_remove_row (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_row\fP * row)"
.PP
removes a row of data to a given table and returns it (no free's called)
.PP
returns the row pointer itself on successful removing. or NULL on failure (bad arguments)
.PP
Definition at line 156 of file table_data.c.
.PP
References netsnmp_table_data_s::first_row, netsnmp_table_data_s::last_row, netsnmp_table_row_s::next, NULL, and netsnmp_table_row_s::prev.
.PP
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_data_replace_row().
.SS "NETSNMP_INLINE void netsnmp_table_data_replace_row (\fBnetsnmp_table_data\fP * table, \fBnetsnmp_table_row\fP * origrow, \fBnetsnmp_table_row\fP * newrow)"
.PP
swaps out origrow with newrow.
.PP
This does *not* delete/free anything!
.PP
Definition at line 222 of file table_data.c.
.PP
References netsnmp_table_data_add_row(), and netsnmp_table_data_remove_row().
.PP
Referenced by netsnmp_table_dataset_replace_row().
|