net-snmp 5.7
|
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 */ 00016 #ifndef _TABLE_ITERATOR_HANDLER_H_ 00017 #define _TABLE_ITERATOR_HANDLER_H_ 00018 00019 #ifdef __cplusplus 00020 extern "C" { 00021 #endif 00022 00023 struct netsnmp_iterator_info_s; 00024 00025 typedef netsnmp_variable_list * 00026 (Netsnmp_First_Data_Point) (void **loop_context, 00027 void **data_context, 00028 netsnmp_variable_list *, 00029 struct netsnmp_iterator_info_s *); 00030 typedef netsnmp_variable_list * 00031 (Netsnmp_Next_Data_Point) (void **loop_context, 00032 void **data_context, 00033 netsnmp_variable_list *, 00034 struct netsnmp_iterator_info_s *); 00035 typedef void *(Netsnmp_Make_Data_Context) (void *loop_context, 00036 struct netsnmp_iterator_info_s *); 00037 typedef void (Netsnmp_Free_Loop_Context) (void *, 00038 struct netsnmp_iterator_info_s *); 00039 typedef void (Netsnmp_Free_Data_Context) (void *, 00040 struct netsnmp_iterator_info_s *); 00041 00053 typedef struct netsnmp_iterator_info_s { 00055 int refcnt; 00056 00060 Netsnmp_First_Data_Point *get_first_data_point; 00061 00065 Netsnmp_Next_Data_Point *get_next_data_point; 00066 00071 Netsnmp_Make_Data_Context *make_data_context; 00072 00078 Netsnmp_Free_Loop_Context *free_loop_context; 00079 00085 Netsnmp_Free_Data_Context *free_data_context; 00086 00093 Netsnmp_Free_Loop_Context *free_loop_context_at_end; 00094 00097 void *myvoid; 00098 int flags; 00099 #define NETSNMP_ITERATOR_FLAG_SORTED 0x01 00100 #define NETSNMP_HANDLER_OWNS_IINFO 0x02 00101 00104 netsnmp_table_registration_info *table_reginfo; 00105 00106 /* Experimental extension - Use At Your Own Risk 00107 (these two fields may change/disappear without warning) */ 00108 Netsnmp_First_Data_Point *get_row_indexes; 00109 netsnmp_variable_list *indexes; 00110 } netsnmp_iterator_info; 00111 00112 #define TABLE_ITERATOR_NAME "table_iterator" 00113 00114 /* ============================ 00115 * Iterator API: Table maintenance 00116 * ============================ */ 00117 /* N/A */ 00118 00119 /* ============================ 00120 * Iterator API: MIB maintenance 00121 * ============================ */ 00122 00123 void netsnmp_handler_owns_iterator_info(netsnmp_mib_handler *h); 00124 netsnmp_mib_handler 00125 *netsnmp_get_table_iterator_handler(netsnmp_iterator_info *iinfo); 00126 int netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo, 00127 netsnmp_iterator_info *iinfo); 00128 void netsnmp_iterator_delete_table(netsnmp_iterator_info *iinfo); 00129 00130 void *netsnmp_extract_iterator_context(netsnmp_request_info *); 00131 void netsnmp_insert_iterator_context(netsnmp_request_info *, void *); 00132 00133 Netsnmp_Node_Handler netsnmp_table_iterator_helper_handler; 00134 00135 #define netsnmp_register_table_iterator2(reginfo, iinfo) \ 00136 (((iinfo)->flags |= NETSNMP_HANDLER_OWNS_IINFO), \ 00137 netsnmp_register_table_iterator((reginfo), (iinfo))) 00138 00139 00140 /* ============================ 00141 * Iterator API: Row operations 00142 * ============================ */ 00143 00144 void *netsnmp_iterator_row_first( netsnmp_iterator_info *); 00145 void *netsnmp_iterator_row_get( netsnmp_iterator_info *, void *); 00146 void *netsnmp_iterator_row_next( netsnmp_iterator_info *, void *); 00147 void *netsnmp_iterator_row_get_byidx( netsnmp_iterator_info *, 00148 netsnmp_variable_list *); 00149 void *netsnmp_iterator_row_next_byidx( netsnmp_iterator_info *, 00150 netsnmp_variable_list *); 00151 void *netsnmp_iterator_row_get_byoid( netsnmp_iterator_info *, oid *, size_t); 00152 void *netsnmp_iterator_row_next_byoid( netsnmp_iterator_info *, oid *, size_t); 00153 int netsnmp_iterator_row_count( netsnmp_iterator_info *); 00154 00155 00156 /* ============================ 00157 * Iterator API: Index operations 00158 * ============================ */ 00159 00160 #ifdef __cplusplus 00161 } 00162 #endif 00163 00164 #endif /* _TABLE_ITERATOR_HANDLER_H_ */ 00165