4 #ifndef _TABLE_DATA_SET_HANDLER_H_
5 #define _TABLE_DATA_SET_HANDLER_H_
12 * This helper is designed to completely automate the task of storing
13 * tables of data within the agent that are not tied to external data
14 * sources (like the kernel, hardware, or other processes, etc). IE,
15 * all rows within a table are expected to be added manually using
16 * functions found below.
19 #define TABLE_DATA_SET_NAME "netsnmp_table_data_set"
22 * return SNMP_ERR_NOERROR or some SNMP specific protocol error id
24 typedef int (Netsnmp_Value_Change_Ok) (char *old_value,
31 * stored within a given row
33 typedef struct netsnmp_table_data_set_storage_s {
40 Netsnmp_Value_Change_Ok *change_ok_fn;
44 * data actually stored
47 union { /* value of variable */
53 struct counter64 *counter64;
54 #ifdef OPAQUE_SPECIAL_TYPES
57 #endif /* OPAQUE_SPECIAL_TYPES */
61 struct netsnmp_table_data_set_storage_s *next;
62 } netsnmp_table_data_set_storage;
64 typedef struct netsnmp_table_data_set_s {
65 netsnmp_table_data *table;
66 netsnmp_table_data_set_storage *default_row;
67 int allow_creation; /* set to 1 to allow creation of new rows */
68 unsigned int rowstatus_column;
69 } netsnmp_table_data_set;
71 Netsnmp_Node_Handler netsnmp_table_data_set_helper_handler;
74 * to set, add column, type, (writable) ? 1 : 0
77 * default value, if not NULL, is the default value used in row
78 * creation. It is copied into the storage template (free your
82 netsnmp_table_set_add_default_row(netsnmp_table_data_set *,
83 unsigned int, int, int,
85 size_t default_value_len);
88 * to set, add column, type, (writable) ? 1 : 0, ...
92 netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *,
95 void netsnmp_table_set_multi_add_default_row(va_alist);
97 int netsnmp_set_row_column(netsnmp_table_row *,
98 unsigned int, int, const char *,
100 netsnmp_table_data_set_storage
101 *netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage
103 netsnmp_table_data_set_storage
104 *netsnmp_extract_table_data_set_column(netsnmp_request_info *,
107 netsnmp_register_table_data_set(netsnmp_handler_registration *,
108 netsnmp_table_data_set *,
109 netsnmp_table_registration_info *);
111 *netsnmp_get_table_data_set_handler(netsnmp_table_data_set *);
112 netsnmp_table_data_set *netsnmp_create_table_data_set(const char *);
113 int netsnmp_mark_row_column_writable(netsnmp_table_row
116 NETSNMP_INLINE netsnmp_table_data_set
117 *netsnmp_extract_table_data_set(netsnmp_request_info *request);
118 void netsnmp_config_parse_table_set(const char *token,
120 void netsnmp_config_parse_add_row(const char *token,
122 NETSNMP_INLINE void netsnmp_table_dataset_add_index(netsnmp_table_data_set
123 *table, u_char type);
124 NETSNMP_INLINE void netsnmp_table_dataset_add_row(netsnmp_table_data_set
126 netsnmp_table_row *row);
127 NETSNMP_INLINE void netsnmp_table_dataset_remove_row(netsnmp_table_data_set
131 NETSNMP_INLINE void netsnmp_table_dataset_delete_row(netsnmp_table_row
134 netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set
139 netsnmp_table_dataset_delete_all_data
140 (netsnmp_table_data_set_storage *data);
142 netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
143 netsnmp_table_row *origrow,
144 netsnmp_table_row *newrow);
145 netsnmp_table_row *netsnmp_table_data_set_clone_row(netsnmp_table_row
147 void netsnmp_register_auto_data_table(netsnmp_table_data_set
154 netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset, ...);
156 void netsnmp_table_helper_add_indexes(va_alist);
163 #define netsnmp_table_row_add_column(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (u_char *) value, value_len)
165 #endif /* _TABLE_DATA_SET_HANDLER_H_ */