generic linked-list data handling with a string as a key.(3)

NAME
generic linked-list data handling with a string as a key. -

  Functions
NETSNMP_INLINE void netsnmp_free_list_data (netsnmp_data_list *node)
frees the data and a name at a given data_list node.
NETSNMP_INLINE void netsnmp_free_all_list_data (netsnmp_data_list *head)
frees all data and nodes in a list.
NETSNMP_INLINE netsnmp_data_list * netsnmp_create_data_list (const char *name, void *data, Netsnmp_Free_List_Data *beer)
adds creates a data_list node given a name, data and a free function ptr.
NETSNMP_INLINE void netsnmp_add_list_data (netsnmp_data_list **head, netsnmp_data_list *node)
depreciated: use netsnmp_data_list_add_node()
NETSNMP_INLINE void netsnmp_data_list_add_node (netsnmp_data_list **head, netsnmp_data_list *node)
adds data to a datalist
NETSNMP_INLINE netsnmp_data_list * netsnmp_data_list_add_data (netsnmp_data_list **head, const char *name, void *data, Netsnmp_Free_List_Data *beer)
adds data to a datalist
NETSNMP_INLINE void * netsnmp_get_list_data (netsnmp_data_list *head, const char *name)
returns a data_list node's data for a given name within a data_list
NETSNMP_INLINE netsnmp_data_list * netsnmp_get_list_node (netsnmp_data_list *head, const char *name)
returns a data_list node for a given name within a data_list
int netsnmp_remove_list_node (netsnmp_data_list **realhead, const char *name)
Removes a named node from a data_list (and frees it).
void netsnmp_register_save_list (netsnmp_data_list **datalist, const char *type, const char *token, Netsnmp_Save_List_Data *data_list_save_ptr, Netsnmp_Read_List_Data *data_list_read_ptr, Netsnmp_Free_List_Data *data_list_free_ptr)
registers to store a data_list set of data at persistant storage time
int netsnmp_save_all_data_callback (int major, int minor, void *serverarg, void *clientarg)
intended to be registerd as a callback operation.
int netsnmp_save_all_data (netsnmp_data_list *head, const char *type, const char *token, Netsnmp_Save_List_Data *data_list_save_ptr)
intended to be called as a callback during persistent save operations.
void netsnmp_read_data_callback (const char *token, char *line)
intended to be registerd as a .conf parser It should be registered using:

Function Documentation

  NETSNMP_INLINE void netsnmp_add_list_data (netsnmp_data_list ** head, netsnmp_data_list * node)

depreciated: use netsnmp_data_list_add_node() Definition at line 83 of file data_list.c.

References netsnmp_data_list_add_node().

Referenced by netsnmp_data_list_add_data(), netsnmp_read_data_callback(), netsnmp_register_auto_data_table(), netsnmp_register_handler_by_name(), netsnmp_register_save_list(), and netsnmp_request_add_list_data().

  NETSNMP_INLINE netsnmp_data_list* netsnmp_create_data_list (const char * name, void * data, Netsnmp_Free_List_Data * beer)

adds creates a data_list node given a name, data and a free function ptr. Parameters:
    name the name of the node to cache the data.
    data the data to be stored under that name
    beer A function that can free the data pointer (in the future)

Returns:
    a newly created data_list node which can be given to the netsnmp_add_list_data function.

Definition at line 64 of file data_list.c.

References netsnmp_data_list_s::data, netsnmp_data_list_s::free_func, netsnmp_data_list_s::name, and SNMP_MALLOC_TYPEDEF.

Referenced by netsnmp_cache_reqinfo_insert(), netsnmp_data_list_add_data(), netsnmp_insert_iterator_context(), netsnmp_insert_table_row(), netsnmp_old_api_helper(), netsnmp_read_data_callback(), netsnmp_register_auto_data_table(), netsnmp_register_handler_by_name(), netsnmp_register_save_list(), netsnmp_stash_cache_update(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), netsnmp_table_iterator_helper_handler(), and table_helper_handler().

  NETSNMP_INLINE netsnmp_data_list* netsnmp_data_list_add_data (netsnmp_data_list ** head, const char * name, void * data, Netsnmp_Free_List_Data * beer)

adds data to a datalist Parameters:
    head a pointer to the head node of a data_list
    name the name of the node to cache the data.
    data the data to be stored under that name
    beer A function that can free the data pointer (in the future)

Returns:
    a newly created data_list node which was inserted in the list

Definition at line 137 of file data_list.c.

References netsnmp_add_list_data(), netsnmp_create_data_list(), and snmp_log().

  NETSNMP_INLINE void netsnmp_data_list_add_node (netsnmp_data_list ** head, netsnmp_data_list * node)

adds data to a datalist Parameters:
    head a pointer to the head node of a data_list
    node a node to stash in the data_list

Definition at line 93 of file data_list.c.

References netsnmp_data_list_s::name, netsnmp_data_list_add_node(), netsnmp_data_list_s::next, and snmp_log().

Referenced by netsnmp_add_list_data(), and netsnmp_data_list_add_node().

  NETSNMP_INLINE void netsnmp_free_all_list_data (netsnmp_data_list * head)

frees all data and nodes in a list. Parameters:
    head the top node of the list to be freed.

Definition at line 46 of file data_list.c.

References netsnmp_free_list_data(), netsnmp_data_list_s::next, and SNMP_FREE.

Referenced by netsnmp_clear_handler_list(), and netsnmp_free_request_data_sets().

  NETSNMP_INLINE void netsnmp_free_list_data (netsnmp_data_list * node)

frees the data and a name at a given data_list node. Note that this doesn't free the node itself.

Parameters:
    node the node for which the data should be freed

Definition at line 30 of file data_list.c.

References netsnmp_data_list_s::data, netsnmp_data_list_s::free_func, netsnmp_data_list_s::name, and SNMP_FREE.

Referenced by netsnmp_free_all_list_data(), netsnmp_free_request_data_set(), and netsnmp_remove_list_node().

  NETSNMP_INLINE void* netsnmp_get_list_data (netsnmp_data_list * head, const char * name)

returns a data_list node's data for a given name within a data_list Parameters:
    head the head node of a data_list
    name the name to find

Returns:
    a pointer to the data cached at that node

Definition at line 157 of file data_list.c.

References netsnmp_data_list_s::data, netsnmp_data_list_s::name, and netsnmp_data_list_s::next.

Referenced by netsnmp_read_data_callback(), and netsnmp_request_get_list_data().

  NETSNMP_INLINE netsnmp_data_list* netsnmp_get_list_node (netsnmp_data_list * head, const char * name)

returns a data_list node for a given name within a data_list Parameters:
    head the head node of a data_list
    name the name to find

Returns:
    a pointer to the data_list node

Definition at line 173 of file data_list.c.

References netsnmp_data_list_s::name, and netsnmp_data_list_s::next.

Referenced by netsnmp_table_iterator_helper_handler().

  void netsnmp_read_data_callback (const char * token, char * line)

intended to be registerd as a .conf parser It should be registered using: register_app_config_handler('token', netsnmp_read_data_callback, XXX)

where INFO_POINTER is a pointer to a netsnmp_data_list_saveinfo object containing apporpriate registration information Definition at line 321 of file data_list.c.

References netsnmp_add_list_data(), netsnmp_create_data_list(), netsnmp_get_list_data(), read_config_read_data(), and snmp_log().

Referenced by netsnmp_register_save_list().

  void netsnmp_register_save_list (netsnmp_data_list ** datalist, const char * type, const char * token, Netsnmp_Save_List_Data * data_list_save_ptr, Netsnmp_Read_List_Data * data_list_read_ptr, Netsnmp_Free_List_Data * data_list_free_ptr)

registers to store a data_list set of data at persistant storage time Parameters:
    datalist the data to be saved
    type the name of the application to save the data as. If left NULL the default application name that was registered during the init_snmp call will be used (recommended).
    token the unique token identifier string to use as the first word in the persistent file line.
    data_list_save_ptr a function pointer which will be called to save the rest of the data to a buffer.
    data_list_read_ptr a function pointer which can read the remainder of a saved line and return the application specific void * pointer.
    data_list_free_ptr a function pointer which will be passed to the data node for freeing it in the future when/if the list/node is cleaned up or destroyed.

Todo
    netsnmp_register_save_list should handle the same token name being saved from different types?

Definition at line 220 of file data_list.c.

References netsnmp_add_list_data(), netsnmp_create_data_list(), netsnmp_read_data_callback(), register_config_handler(), snmp_log(), SNMP_MALLOC_TYPEDEF, and snmp_register_callback().

  int netsnmp_remove_list_node (netsnmp_data_list ** realhead, const char * name)

Removes a named node from a data_list (and frees it). Parameters:
    realhead a pointer to the head node of a data_list
    name the name to find and remove

Returns:
    0 on successful find-and-delete, 1 otherwise.

Definition at line 189 of file data_list.c.

References netsnmp_free_list_data(), and netsnmp_data_list_s::next.

Referenced by netsnmp_request_remove_list_data().

  int netsnmp_save_all_data (netsnmp_data_list * head, const char * type, const char * token, Netsnmp_Save_List_Data * data_list_save_ptr)

intended to be called as a callback during persistent save operations. See the netsnmp_save_all_data_callback for where this is typically used. Definition at line 286 of file data_list.c.

References netsnmp_data_list_s::data, netsnmp_data_list_s::name, netsnmp_data_list_s::next, and read_config_store().

Referenced by netsnmp_save_all_data_callback().

  int netsnmp_save_all_data_callback (int major, int minor, void * serverarg, void * clientarg)

intended to be registerd as a callback operation. It should be registered using:

snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, netsnmp_save_all_data_callback, INFO_POINTER);

where INFO_POINTER is a pointer to a netsnmp_data_list_saveinfo object containing apporpriate registration information Definition at line 269 of file data_list.c.

References netsnmp_save_all_data(), and snmp_log().