00001
00002
00003
00004 #ifndef _TABLE_TDATA_HANDLER_H_
00005 #define _TABLE_TDATA_HANDLER_H_
00006
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #define TABLE_TDATA_NAME "table_tdata"
00020 #define TABLE_TDATA_ROW "table_tdata"
00021 #define TABLE_TDATA_TABLE "table_tdata_table"
00022
00023 #define TDATA_FLAG_NO_STORE_INDEXES 0x01
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 typedef struct netsnmp_tdata_row_s {
00034 netsnmp_index oid_index;
00035 netsnmp_variable_list *indexes;
00036 void *data;
00037 } netsnmp_tdata_row;
00038
00039
00040
00041
00042
00043
00044
00045 typedef struct netsnmp_tdata_s {
00046 netsnmp_variable_list *indexes_template;
00047 char *name;
00048 int flags;
00049 netsnmp_container *container;
00050 } netsnmp_tdata;
00051
00052
00053 typedef struct netsnmp_tdata_row_s netsnmp_table_data2row;
00054 typedef struct netsnmp_tdata_s netsnmp_table_data2;
00055
00056
00057
00058
00059
00060
00061 netsnmp_tdata *netsnmp_tdata_create_table(const char *name, long flags);
00062 void netsnmp_tdata_delete_table(netsnmp_tdata *table);
00063 netsnmp_tdata_row *netsnmp_tdata_create_row(void);
00064 netsnmp_tdata_row *netsnmp_tdata_clone_row( netsnmp_tdata_row *row);
00065 int netsnmp_tdata_copy_row( netsnmp_tdata_row *dst_row,
00066 netsnmp_tdata_row *src_row);
00067 void *netsnmp_tdata_delete_row( netsnmp_tdata_row *row);
00068
00069 int netsnmp_tdata_add_row( netsnmp_tdata *table,
00070 netsnmp_tdata_row *row);
00071 void netsnmp_tdata_replace_row( netsnmp_tdata *table,
00072 netsnmp_tdata_row *origrow,
00073 netsnmp_tdata_row *newrow);
00074 netsnmp_tdata_row *netsnmp_tdata_remove_row(netsnmp_tdata *table,
00075 netsnmp_tdata_row *row);
00076 void *netsnmp_tdata_remove_and_delete_row(netsnmp_tdata *table,
00077 netsnmp_tdata_row *row);
00078
00079
00080
00081
00082
00083
00084 netsnmp_mib_handler *netsnmp_get_tdata_handler(netsnmp_tdata *table);
00085
00086 int netsnmp_tdata_register(netsnmp_handler_registration *reginfo,
00087 netsnmp_tdata *table,
00088 netsnmp_table_registration_info *table_info);
00089
00090 netsnmp_tdata *netsnmp_tdata_extract_table( netsnmp_request_info *);
00091 netsnmp_container *netsnmp_tdata_extract_container(netsnmp_request_info *);
00092 netsnmp_tdata_row *netsnmp_tdata_extract_row( netsnmp_request_info *);
00093 void *netsnmp_tdata_extract_entry( netsnmp_request_info *);
00094
00095 void netsnmp_insert_tdata_row(netsnmp_request_info *, netsnmp_tdata_row *);
00096
00097
00098
00099
00100
00101
00102 void * netsnmp_tdata_row_entry( netsnmp_tdata_row *row );
00103 netsnmp_tdata_row *netsnmp_tdata_row_first(netsnmp_tdata *table);
00104 netsnmp_tdata_row *netsnmp_tdata_row_get( netsnmp_tdata *table,
00105 netsnmp_tdata_row *row);
00106 netsnmp_tdata_row *netsnmp_tdata_row_next( netsnmp_tdata *table,
00107 netsnmp_tdata_row *row);
00108
00109 netsnmp_tdata_row *netsnmp_tdata_row_get_byidx(netsnmp_tdata *table,
00110 netsnmp_variable_list *indexes);
00111 netsnmp_tdata_row *netsnmp_tdata_row_get_byoid(netsnmp_tdata *table,
00112 oid *searchfor,
00113 size_t searchfor_len);
00114 netsnmp_tdata_row *netsnmp_tdata_row_next_byidx(netsnmp_tdata *table,
00115 netsnmp_variable_list *indexes);
00116 netsnmp_tdata_row *netsnmp_tdata_row_next_byoid(netsnmp_tdata *table,
00117 oid *searchfor,
00118 size_t searchfor_len);
00119
00120 int netsnmp_tdata_row_count(netsnmp_tdata *table);
00121
00122
00123
00124
00125
00126
00127 #define netsnmp_tdata_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
00128 #define netsnmp_tdata_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)
00129
00130 int netsnmp_tdata_compare_idx( netsnmp_tdata_row *row,
00131 netsnmp_variable_list *indexes);
00132 int netsnmp_tdata_compare_oid( netsnmp_tdata_row *row,
00133 oid *compareto, size_t compareto_len);
00134 int netsnmp_tdata_compare_subtree_idx(netsnmp_tdata_row *row,
00135 netsnmp_variable_list *indexes);
00136 int netsnmp_tdata_compare_subtree_oid(netsnmp_tdata_row *row,
00137 oid *compareto, size_t compareto_len);
00138
00139
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143
00144 #endif