man netsnmp_table_data () -
NAME
table_data: Helps you implement a table with datamatted storage. -
Modules
table_dataset: Helps you implement a table with automatted storage.
Functions
void netsnmp_table_data_generate_index_oid (netsnmp_table_row *row)
generates the index portion of an table oid from a varlist.
int netsnmp_table_data_add_row (netsnmp_table_data *table, netsnmp_table_row *row)
Adds a row of data to a given table (stored in proper lexographical order).
netsnmp_table_row * netsnmp_table_data_remove_row (netsnmp_table_data *table, netsnmp_table_row *row)
removes a row of data to a given table and returns it (no free's called)
void * netsnmp_table_data_delete_row (netsnmp_table_row *row)
deletes a row's memory.
void * netsnmp_table_data_remove_and_delete_row (netsnmp_table_data *table, netsnmp_table_row *row)
removes and frees a row of data to a given table and returns the void *
NETSNMP_INLINE void netsnmp_table_data_replace_row (netsnmp_table_data *table, netsnmp_table_row *origrow, netsnmp_table_row *newrow)
swaps out origrow with newrow.
netsnmp_table_row * netsnmp_table_data_get (netsnmp_table_data *table, netsnmp_variable_list *indexes)
finds the data in 'datalist' stored at 'indexes'
netsnmp_table_row * netsnmp_table_data_get_from_oid (netsnmp_table_data *table, oid *searchfor, size_t searchfor_len)
finds the data in 'datalist' stored at the searchfor oid
netsnmp_mib_handler * netsnmp_get_table_data_handler (netsnmp_table_data *table)
Creates a table_data handler and returns it.
int netsnmp_register_table_data (netsnmp_handler_registration *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)
registers a handler as a data table.
int netsnmp_register_read_only_table_data (netsnmp_handler_registration *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)
registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.
int netsnmp_table_data_helper_handler (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
The helper handler that takes care of passing a specific row of data down to the lower handler(s).
netsnmp_table_data * netsnmp_create_table_data (const char *name)
creates and returns a pointer to table data set
netsnmp_table_row * netsnmp_create_table_data_row (void)
creates and returns a pointer to table data set
NETSNMP_INLINE void netsnmp_insert_table_row (netsnmp_request_info *request, netsnmp_table_row *row)
inserts a newly created table_data row into a request
netsnmp_table_row * netsnmp_extract_table_row (netsnmp_request_info *request)
extracts the row being accessed passed from the table_data helper
netsnmp_table_data * netsnmp_extract_table (netsnmp_request_info *request)
extracts the table being accessed passed from the table_data helper
void * netsnmp_extract_table_row_data (netsnmp_request_info *request)
extracts the data from the row being accessed passed from the table_data helper
int netsnmp_table_data_build_result (netsnmp_handler_registration *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)
builds a result given a row, a varbind to set and the data
netsnmp_table_row * netsnmp_table_data_clone_row (netsnmp_table_row *row)
clones a data row.
int netsnmp_table_data_num_rows (netsnmp_table_data *table)
Detailed Description
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.
Function Documentation
netsnmp_table_data* netsnmp_create_table_data (const char * name)
creates and returns a pointer to table data set
Definition at line 544 of file table_data.c.
Referenced by netsnmp_create_table_data_set().
netsnmp_table_row* netsnmp_create_table_data_row (void)
creates and returns a pointer to table data set
Examples: data_set.c.
Definition at line 554 of file table_data.c.
Referenced by netsnmp_table_data_set_create_row_from_defaults().
netsnmp_table_data* netsnmp_extract_table (netsnmp_request_info * request)
extracts the table being accessed passed from the table_data helper
Definition at line 635 of file table_data.c.
References netsnmp_request_get_list_data().
netsnmp_table_row* netsnmp_extract_table_row (netsnmp_request_info * request)
extracts the row being accessed passed from the table_data helper
Definition at line 627 of file table_data.c.
References netsnmp_request_get_list_data().
Referenced by netsnmp_extract_table_row_data(), and netsnmp_table_data_set_helper_handler().
void* netsnmp_extract_table_row_data (netsnmp_request_info * request)
extracts the data from the row being accessed passed from the table_data helper
Definition at line 644 of file table_data.c.
References netsnmp_extract_table_row().
Referenced by netsnmp_extract_table_data_set_column().
netsnmp_mib_handler* netsnmp_get_table_data_handler (netsnmp_table_data * table)
Creates a table_data handler and returns it.
Definition at line 263 of file table_data.c.
References netsnmp_mib_handler_s::flags, netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_table_data_helper_handler(), and snmp_log().
Referenced by netsnmp_register_table_data().
NETSNMP_INLINE void netsnmp_insert_table_row (netsnmp_request_info * request, netsnmp_table_row * row)
inserts a newly created table_data row into a request
Definition at line 562 of file table_data.c.
References netsnmp_table_request_info_s::indexes, netsnmp_create_data_list(), netsnmp_extract_table_info(), netsnmp_request_add_list_data(), netsnmp_request_info_s::next, netsnmp_request_info_s::prev, and snmp_oid_compare().
int netsnmp_register_read_only_table_data (netsnmp_handler_registration * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)
registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.
Definition at line 297 of file table_data.c.
References netsnmp_get_read_only_handler(), netsnmp_inject_handler(), and netsnmp_register_table_data().
int netsnmp_register_table_data (netsnmp_handler_registration * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)
registers a handler as a data table.
If table_info != NULL, it registers it as a normal table too.
Definition at line 286 of file table_data.c.
References netsnmp_get_table_data_handler(), netsnmp_inject_handler(), and netsnmp_register_table().
Referenced by netsnmp_register_read_only_table_data(), and netsnmp_register_table_data_set().
int netsnmp_table_data_add_row (netsnmp_table_data * table, netsnmp_table_row * row)
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)
xxx-rks: remove invalid row?
Definition at line 51 of file table_data.c.
References netsnmp_table_data_generate_index_oid(), snmp_log(), and snmp_oid_compare().
Referenced by netsnmp_table_data_replace_row(), and netsnmp_table_dataset_add_row().
int netsnmp_table_data_build_result (netsnmp_handler_registration * 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)
builds a result given a row, a varbind to set and the data
Definition at line 656 of file table_data.c.
References netsnmp_agent_request_info_s::mode, netsnmp_request_info_s::requestvb, and snmp_set_var_typed_value().
Referenced by netsnmp_table_data_helper_handler(), and netsnmp_table_data_set_helper_handler().
netsnmp_table_row* netsnmp_table_data_clone_row (netsnmp_table_row * row)
clones a data row.
DOES NOT CLONE THE CONTAINED DATA.
Definition at line 690 of file table_data.c.
Referenced by netsnmp_table_data_set_clone_row().
void* netsnmp_table_data_delete_row (netsnmp_table_row * row)
deletes a row's memory.
returns the void data that it doesn't know how to delete.
Definition at line 177 of file table_data.c.
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_dataset_delete_row().
void netsnmp_table_data_generate_index_oid (netsnmp_table_row * row)
generates the index portion of an table oid from a varlist.
Definition at line 39 of file table_data.c.
References build_oid().
Referenced by netsnmp_table_data_add_row().
netsnmp_table_row* netsnmp_table_data_get (netsnmp_table_data * table, netsnmp_variable_list * indexes)
finds the data in 'datalist' stored at 'indexes'
Definition at line 231 of file table_data.c.
References netsnmp_table_data_get_from_oid().
netsnmp_table_row* netsnmp_table_data_get_from_oid (netsnmp_table_data * table, oid * searchfor, size_t searchfor_len)
finds the data in 'datalist' stored at the searchfor oid
Definition at line 245 of file table_data.c.
References snmp_oid_compare().
Referenced by netsnmp_table_data_get(), and netsnmp_table_data_helper_handler().
int netsnmp_table_data_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)
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 313 of file table_data.c.
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_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_oid_compare(), and variable_list::type.
Referenced by netsnmp_get_table_data_handler().
void* netsnmp_table_data_remove_and_delete_row (netsnmp_table_data * table, netsnmp_table_row * row)
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 206 of file table_data.c.
References netsnmp_table_data_delete_row(), and netsnmp_table_data_remove_row().
Referenced by netsnmp_table_dataset_remove_and_delete_row(), and netsnmp_table_dataset_remove_row().
netsnmp_table_row* netsnmp_table_data_remove_row (netsnmp_table_data * table, netsnmp_table_row * row)
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 155 of file table_data.c.
Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_data_replace_row().
NETSNMP_INLINE void netsnmp_table_data_replace_row (netsnmp_table_data * table, netsnmp_table_row * origrow, netsnmp_table_row * newrow)
swaps out origrow with newrow.
This does *not* delete/free anything!
Definition at line 221 of file table_data.c.
References netsnmp_table_data_add_row(), and netsnmp_table_data_remove_row().
Referenced by netsnmp_table_dataset_replace_row().