stash_cache: automatically caches data for certain handlers.(3)

NAME
stash_cache: automatically caches data for certain handlers. - This handler caches data in an optimized way which may aleviate the need for the lower level handlers to perform as much optimization.

  Functions
netsnmp_stash_cache_info * netsnmp_get_new_stash_cache (void)
netsnmp_mib_handler * netsnmp_get_stash_cache_handler (void)
returns a stash_cache handler that can be injected into a given handler chain.
netsnmp_oid_stash_node ** netsnmp_extract_stash_cache (netsnmp_agent_request_info *reqinfo)
extracts a pointer to the stash_cache info from the reqinfo structure.
int netsnmp_stash_cache_helper (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
int netsnmp_stash_cache_update (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, netsnmp_stash_cache_info *cinfo)
updates a given cache depending on whether it needs to or not.
void netsnmp_init_stash_cache_helper (void)
initializes the stash_cache helper which then registers a stash_cache handler as a run-time injectable handler for configuration file use.

Detailed Description

This handler caches data in an optimized way which may aleviate the need for the lower level handlers to perform as much optimization.

Specifically, somewhere in the lower level handlers must be a handler that supports the MODE_GET_STASH operation. Note that the table_iterator helper supports this.

Function Documentation

  netsnmp_oid_stash_node** netsnmp_extract_stash_cache (netsnmp_agent_request_info * reqinfo)

extracts a pointer to the stash_cache info from the reqinfo structure.

Definition at line 64 of file stash_cache.c.

References netsnmp_agent_get_list_data().

Referenced by netsnmp_table_iterator_helper_handler().

  netsnmp_mib_handler* netsnmp_get_stash_cache_handler (void)

returns a stash_cache handler that can be injected into a given handler chain.

Definition at line 42 of file stash_cache.c.

References netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_get_new_stash_cache(), netsnmp_stash_cache_helper(), and NULL.

Referenced by netsnmp_init_stash_cache_helper().

  void netsnmp_init_stash_cache_helper (void)

initializes the stash_cache helper which then registers a stash_cache handler as a run-time injectable handler for configuration file use.

Definition at line 188 of file stash_cache.c.

References netsnmp_get_stash_cache_handler(), and netsnmp_register_handler_by_name().

Referenced by netsnmp_init_helpers().

  int netsnmp_stash_cache_update (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests, netsnmp_stash_cache_info * cinfo)

updates a given cache depending on whether it needs to or not.

Definition at line 143 of file stash_cache.c.

References atime_newMarker(), atime_ready(), atime_setMarker(), netsnmp_stash_cache_info_s::cache, netsnmp_stash_cache_info_s::cache_length, netsnmp_stash_cache_info_s::cache_time, netsnmp_agent_request_info_s::mode, netsnmp_agent_add_list_data(), netsnmp_call_next_handler(), netsnmp_create_data_list(), netsnmp_oid_stash_free(), NULL, and snmp_free_var().

Referenced by netsnmp_stash_cache_helper().