Logo
Home page Net-SNMP

Archive Search:

Require all words?

Site Search:
Google
Main Page | Modules | Data Structures | File List | Data Fields | Related Pages | Examples

table_container: Helps you implement a table when data can be found via a netsnmp_container.
[table: Helps you implement a table.]

The table_container handler is used (automatically) in conjuntion with the table handler. More...

Functions

container_table_data *  netsnmp_tcontainer_create_table (const char *name, netsnmp_container *container, long flags)
void  netsnmp_tcontainer_delete_table (container_table_data *table)
int  netsnmp_tcontainer_add_row (container_table_data *table, netsnmp_index *row)
netsnmp_index *  netsnmp_tcontainer_remove_row (container_table_data *table, netsnmp_index *row)
int  netsnmp_tcontainer_replace_row (container_table_data *table, netsnmp_index *old_row, netsnmp_index *new_row)
netsnmp_mib_handler netsnmp_container_table_handler_get (netsnmp_table_registration_info *tabreg, netsnmp_container *container, char key_type)
  returns a netsnmp_mib_handler object for the table_container helper
int  netsnmp_container_table_register (netsnmp_handler_registration *reginfo, netsnmp_table_registration_info *tabreg, netsnmp_container *container, char key_type)
netsnmp_container *  netsnmp_container_table_container_extract (netsnmp_request_info *request)
  retrieve the container used by the table_container helper
void *  netsnmp_container_table_row_extract (netsnmp_request_info *request)
  find the context data used by the table_container helper
void *  netsnmp_container_table_extract_context (netsnmp_request_info *request)
  find the context data used by the table_container helper
void  netsnmp_container_table_row_insert (netsnmp_request_info *request, netsnmp_index *row)
  inserts a newly created table_container entry into a request list
NETSNMP_STATIC_INLINE void  _set_key (container_table_data *tad, netsnmp_request_info *request, netsnmp_table_request_info *tblreq_info, void **key, netsnmp_index *index)
NETSNMP_STATIC_INLINE void  _data_lookup (netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *request, container_table_data *tad)
netsnmp_index *  netsnmp_table_index_find_next_row (netsnmp_container *c, netsnmp_table_request_info *tblreq)
  deprecated, backwards compatability only

Detailed Description

The table_container handler is used (automatically) in conjuntion with the table handler.

This handler will use the index information provided by the handler to find the row needed to process the request.

The container must use one of 3 key types. It is the sub-handler's responsibility to ensure that the container and key type match (unless neither is specified, in which case a default will be used.)

The current key types are:

TABLE_CONTAINER_KEY_NETSNMP_INDEX The container should do comparisons based on a key that may be cast to a netsnmp index (netsnmp_index *). This index contains only the index portion of the OID, not the entire OID.

TABLE_CONTAINER_KEY_VARBIND_INDEX The container should do comparisons based on a key that may be cast to a netsnmp variable list (netsnmp_variable_list *). This variable list will contain one varbind for each index component.

TABLE_CONTAINER_KEY_VARBIND_RAW (NOTE: unimplemented) While not yet implemented, future plans include passing the request varbind with the full OID to a container.

If a key type is not specified at registration time, the default key type of TABLE_CONTAINER_KEY_NETSNMP_INDEX will be used. If a container is provided, or the handler name is aliased to a container type, the container must use a netsnmp index.

If no container is provided, a lookup will be made based on the sub-handler's name, or if that isn't found, "table_container". The table_container key type will be netsnmp_index.

The container must, at a minimum, implement find and find_next. If a NULL key is passed to the container, it must return the first item, if any. All containers provided by net-snmp fulfil this requirement.

This handler will only register to process 'data lookup' modes. In traditional net-snmp modes, that is any GET-like mode (GET, GET-NEXT, GET-BULK) or the first phase of a SET (RESERVE1). In the new baby-steps mode, DATA_LOOKUP is it's own mode, and is a pre-cursor to other modes.

When called, the handler will call the appropriate container method with the appropriate key type. If a row was not found, the result depends on the mode.

GET Processing An exact match must be found. If one is not, the error NOSUCHINSTANCE is set.

GET-NEXT / GET-BULK If no row is found, the column number will be increased (using any valid_columns structure that may have been provided), and the first row will be retrieved. If no first row is found, the processed flag will be set, so that the sub-handler can skip any processing related to the request. The agent will notice this unsatisfied request, and attempt to pass it to the next appropriate handler.

SET If the hander did not register with the HANDLER_CAN_NOT_CREATE flag set in the registration modes, it is assumed that this is a row creation request and a NULL row is added to the request's data list. The sub-handler is responsbile for dealing with any row creation contraints and inserting any newly created rows into the container and the request's data list.

If a row is found, it will be inserted into the request's data list. The sub-handler may retrieve it by calling netsnmp_container_table_extract_context(request); * NOTE NOTE NOTE:

This helper and it's API are still being tested and are subject to change.


Function Documentation

NETSNMP_STATIC_INLINE void _data_lookup netsnmp_handler_registration reginfo,
netsnmp_agent_request_info agtreq_info,
netsnmp_request_info request,
container_table_data *  tad
 

the table_helper_handler should enforce column boundaries.

xxx-rks: shouldn't tblreq_info->indexes be updated before we call this??

GETNEXT/GETBULK

GET/SET

Definition at line 450 of file table_container.c.

References netsnmp_table_request_info_s::index_oid_len, netsnmp_agent_request_info_s::mode, netsnmp_handler_registration_s::modes, variable_list::name, variable_list::name_length, netsnmp_create_data_list(), netsnmp_extract_table_info(), netsnmp_handler_registration, netsnmp_request_add_list_data(), netsnmp_set_request_error(), netsnmp_table_build_oid_from_index(), netsnmp_update_indexes_from_variable_list(), netsnmp_update_variable_list_from_index(), netsnmp_request_info_s::requestvb, and variable_list::type.

netsnmp_container* netsnmp_container_table_container_extract netsnmp_request_info request  ) 
 

retrieve the container used by the table_container helper

Definition at line 319 of file table_container.c.

References netsnmp_request_get_list_data().

void* netsnmp_container_table_extract_context netsnmp_request_info request  ) 
 

find the context data used by the table_container helper

Definition at line 338 of file table_container.c.

References netsnmp_request_get_list_data().

netsnmp_mib_handler* netsnmp_container_table_handler_get netsnmp_table_registration_info tabreg,
netsnmp_container *  container,
char  key_type
 

returns a netsnmp_mib_handler object for the table_container helper

Definition at line 253 of file table_container.c.

References netsnmp_mib_handler_s::flags, netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_mib_handler, snmp_log(), and SNMP_MALLOC_TYPEDEF.

void* netsnmp_container_table_row_extract netsnmp_request_info request  ) 
 

find the context data used by the table_container helper

Definition at line 328 of file table_container.c.

References netsnmp_request_get_list_data().

Referenced by netsnmp_tdata_extract_row().

void netsnmp_container_table_row_insert netsnmp_request_info request,
netsnmp_index *  row
 

inserts a newly created table_container entry into a request list

Definition at line 350 of file table_container.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, netsnmp_request_info_s::processed, and snmp_oid_compare().

Referenced by netsnmp_insert_tdata_row().

netsnmp_index* netsnmp_table_index_find_next_row netsnmp_container *  c,
netsnmp_table_request_info tblreq
 

deprecated, backwards compatability only

expected impact to remove: none

  • used between helpers, shouldn't have been used by end users

replacement: none

  • never should have been a public method in the first place

Definition at line 720 of file table_container.c.


Generated on Fri Dec 30 13:48:00 2005 for net-snmp by  doxygen 1.3.9.1

Valid CSS!


Last modified: Thursday, 01-Mar-2007 16:20:03 PST
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.