net-snmp
5.4.1
|
00001 /* Portions of this file are subject to the following copyright(s). See 00002 * the Net-SNMP's COPYING file for more details and other copyrights 00003 * that may apply: 00004 */ 00005 /* 00006 * Portions of this file are copyrighted by: 00007 * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. 00008 * Use is subject to license terms specified in the COPYING file 00009 * distributed with the Net-SNMP package. 00010 */ 00011 /* 00012 * @file table.h 00013 * 00014 * @addtogroup table 00015 * 00016 * @{ 00017 */ 00018 #ifndef _TABLE_HANDLER_H_ 00019 #define _TABLE_HANDLER_H_ 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00043 #define TABLE_HANDLER_NAME "table" 00044 00052 typedef struct netsnmp_column_info_t { 00053 char isRange; 00055 char list_count; 00056 00057 union { 00058 unsigned int range[2]; 00059 unsigned int *list; 00060 } details; 00061 00062 struct netsnmp_column_info_t *next; 00063 00064 } netsnmp_column_info; 00065 00074 typedef struct netsnmp_table_registration_info_s { 00076 netsnmp_variable_list *indexes; 00078 unsigned int number_indexes; 00079 00085 unsigned int min_column; 00087 unsigned int max_column; 00088 00090 netsnmp_column_info *valid_columns; 00091 00092 } netsnmp_table_registration_info; 00093 00102 typedef struct netsnmp_table_request_info_s { 00104 unsigned int colnum; 00106 unsigned int number_indexes; 00108 netsnmp_variable_list *indexes; 00109 00110 oid index_oid[MAX_OID_LEN]; 00111 size_t index_oid_len; 00112 netsnmp_table_registration_info *reg_info; 00113 } netsnmp_table_request_info; 00114 00115 netsnmp_mib_handler 00116 *netsnmp_get_table_handler(netsnmp_table_registration_info 00117 *tabreq); 00118 int netsnmp_register_table(netsnmp_handler_registration 00119 *reginfo, 00120 netsnmp_table_registration_info 00121 *tabreq); 00122 int netsnmp_table_build_oid(netsnmp_handler_registration 00123 *reginfo, 00124 netsnmp_request_info *reqinfo, 00125 netsnmp_table_request_info 00126 *table_info); 00127 int 00128 netsnmp_table_build_oid_from_index(netsnmp_handler_registration 00129 *reginfo, 00130 netsnmp_request_info *reqinfo, 00131 netsnmp_table_request_info 00132 *table_info); 00133 int netsnmp_table_build_result(netsnmp_handler_registration 00134 *reginfo, 00135 netsnmp_request_info 00136 *reqinfo, 00137 netsnmp_table_request_info 00138 *table_info, u_char type, 00139 u_char * result, 00140 size_t result_len); 00141 int 00142 netsnmp_update_variable_list_from_index(netsnmp_table_request_info 00143 *); 00144 int 00145 netsnmp_update_indexes_from_variable_list 00146 (netsnmp_table_request_info *tri); 00147 netsnmp_table_registration_info 00148 *netsnmp_find_table_registration_info(netsnmp_handler_registration 00149 *reginfo); 00150 netsnmp_index * netsnmp_table_index_find_next_row(netsnmp_container *c, 00151 netsnmp_table_request_info *tblreq); 00152 00153 unsigned int netsnmp_closest_column(unsigned int current, 00154 netsnmp_column_info 00155 *valid_columns); 00156 00157 Netsnmp_Node_Handler table_helper_handler; 00158 00159 #define netsnmp_table_helper_add_index(tinfo, type) snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (u_char)type, NULL, 0); 00160 00161 #if HAVE_STDARG_H 00162 void 00163 netsnmp_table_helper_add_indexes(netsnmp_table_registration_info 00164 *tinfo, ...); 00165 #else 00166 void netsnmp_table_helper_add_indexes(va_alist); 00167 #endif 00168 00169 int netsnmp_check_getnext_reply(netsnmp_request_info *request, 00170 oid * prefix, size_t prefix_len, 00171 netsnmp_variable_list * newvar, 00172 netsnmp_variable_list ** outvar); 00173 00174 netsnmp_table_request_info 00175 *netsnmp_extract_table_info(netsnmp_request_info *); 00176 netsnmp_oid_stash_node 00177 **netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info 00178 *reqinfo, 00179 const u_char * 00180 storage_name); 00181 unsigned int 00182 netsnmp_table_next_column(netsnmp_table_request_info *table_info); 00183 00184 00185 int netsnmp_sparse_table_register(netsnmp_handler_registration *reginfo, 00186 netsnmp_table_registration_info *tabreq); 00187 00188 netsnmp_mib_handler *netsnmp_sparse_table_handler_get(void); 00189 00190 #ifdef __cplusplus 00191 } 00192 #endif 00193 00194 #endif /* _TABLE_HANDLER_H_ */ 00195