00001
00063
00064
00065
00066 #include <net-snmp/net-snmp-config.h>
00067 #include <net-snmp/net-snmp-includes.h>
00068 #include <net-snmp/agent/net-snmp-agent-includes.h>
00069
00070
00071
00072
00073
00074
00075
00076 void
00077 init_data_set(void)
00078 {
00079 netsnmp_table_data_set *table_set;
00080 netsnmp_table_row *row;
00081
00082
00083
00084
00085
00086
00087 oid my_registration_oid[] =
00088 { 1, 3, 6, 1, 4, 1, 8072, 2, 2, 1 };
00089
00090
00091
00092
00093
00094 DEBUGMSGTL(("example_data_set",
00095 "Initalizing example dataset table\n"));
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 table_set = netsnmp_create_table_data_set("netSnmpIETFWGTable");
00107
00108
00109
00110
00111 table_set->allow_creation = 1;
00112
00113
00114
00115
00116 netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
00117
00118
00119
00120
00121 netsnmp_table_set_multi_add_default_row(table_set,
00122
00123
00124
00125
00126
00127
00128 2, ASN_OCTET_STR, 1, NULL, 0,
00129
00130
00131
00132 3, ASN_OCTET_STR, 1, NULL, 0,
00133 0 );
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 netsnmp_register_table_data_set(netsnmp_create_handler_registration
00145 ("netSnmpIETFWGTable", NULL,
00146 my_registration_oid,
00147 OID_LENGTH(my_registration_oid),
00148 HANDLER_CAN_RWRITE), table_set, NULL);
00149
00150
00151
00152
00153
00154 row = netsnmp_create_table_data_row();
00155
00156
00157
00158 netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpv3",
00159 strlen("snmpv3"));
00160
00161
00162
00163
00164
00165 netsnmp_set_row_column(row, 2, ASN_OCTET_STR,
00166 "Russ Mundy", strlen("Russ Mundy"));
00167 netsnmp_mark_row_column_writable(row, 2, 1);
00168
00169
00170
00171
00172 netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "David Harrington",
00173 strlen("David Harrington"));
00174 netsnmp_mark_row_column_writable(row, 3, 1);
00175
00176
00177
00178
00179 netsnmp_table_dataset_add_row(table_set, row);
00180
00181 #ifdef ADD_MORE_DATA
00182
00183
00184
00185 row = netsnmp_create_table_data_row();
00186 netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpconf",
00187 strlen("snmpconf"));
00188 netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "David Partain",
00189 strlen("David Partain"));
00190 netsnmp_mark_row_column_writable(row, 2, 1);
00191 netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "Jon Saperia",
00192 strlen("Jon Saperia"));
00193 netsnmp_mark_row_column_writable(row, 3, 1);
00194 netsnmp_table_dataset_add_row(table_set, row);
00195 #endif
00196
00197
00198
00199
00200
00201
00202
00203 netsnmp_register_auto_data_table(table_set, NULL);
00204
00205 DEBUGMSGTL(("example_data_set", "Done initializing.\n"));
00206 }