4 #ifndef _TABLE_HANDLER_H_
5 #define _TABLE_HANDLER_H_
12 * The table helper is designed to simplify the task of writing a
13 * * table handler for the net-snmp agent. You should create a normal
14 * * handler and register it using the netsnmp_register_table() function instead
15 * * of the netsnmp_register_handler() function.
21 * 1) illegal indexes automatically get handled for get/set cases.
22 * Simply check to make sure the value is type ASN_NULL before
23 * you answer a request.
27 * used as an index to parent_data lookups
29 #define TABLE_HANDLER_NAME "table"
32 * column info struct. OVERLAPPING RANGES ARE NOT SUPPORTED.
34 typedef struct netsnmp_column_info_t {
36 char list_count; /* only useful if isRange == 0 */
39 unsigned int range[2];
43 struct netsnmp_column_info_t *next;
45 } netsnmp_column_info;
47 typedef struct netsnmp_table_registration_info_s {
48 netsnmp_variable_list *indexes; /* list of varbinds with only 'type' set */
49 unsigned int number_indexes; /* calculated automatically */
52 * the minimum and maximum columns numbers. If there are columns
53 * * in-between which are not valid, use valid_columns to get
54 * * automatic column range checking.
56 unsigned int min_column;
57 unsigned int max_column;
59 netsnmp_column_info *valid_columns; /* more details on columns */
61 } netsnmp_table_registration_info;
63 typedef struct netsnmp_table_request_info_s {
64 unsigned int colnum; /* 0 if OID not long enough */
65 unsigned int number_indexes; /* 0 if failure to parse any */
66 netsnmp_variable_list *indexes; /* contents freed by helper upon exit */
67 oid index_oid[MAX_OID_LEN];
69 netsnmp_table_registration_info *reg_info;
70 } netsnmp_table_request_info;
73 *netsnmp_get_table_handler(netsnmp_table_registration_info
75 int netsnmp_register_table(netsnmp_handler_registration
77 netsnmp_table_registration_info
79 int netsnmp_table_build_oid(netsnmp_handler_registration
81 netsnmp_request_info *reqinfo,
82 netsnmp_table_request_info
85 netsnmp_table_build_oid_from_index(netsnmp_handler_registration
87 netsnmp_request_info *reqinfo,
88 netsnmp_table_request_info
90 int netsnmp_table_build_result(netsnmp_handler_registration
94 netsnmp_table_request_info
95 *table_info, u_char type,
99 netsnmp_update_variable_list_from_index(netsnmp_table_request_info
102 netsnmp_update_indexes_from_variable_list
103 (netsnmp_table_request_info *tri);
104 netsnmp_table_registration_info
105 *netsnmp_find_table_registration_info(netsnmp_handler_registration
108 unsigned int netsnmp_closest_column(unsigned int current,
112 Netsnmp_Node_Handler table_helper_handler;
114 #define netsnmp_table_helper_add_index(tinfo, type) snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (u_char)type, NULL, 0);
118 netsnmp_table_helper_add_indexes(netsnmp_table_registration_info
121 void netsnmp_table_helper_add_indexes(va_alist);
140 netsnmp_check_getnext_reply(netsnmp_request_info *request,
141 oid * prefix, size_t prefix_len,
142 netsnmp_variable_list * newvar,
143 netsnmp_variable_list ** outvar);
145 netsnmp_table_request_info
146 *netsnmp_extract_table_info(netsnmp_request_info *);
147 netsnmp_oid_stash_node
148 **netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info
157 #endif /* _TABLE_HANDLER_H_ */