On Tue, Sep 17, 2019 at 4:27 AM Krishna Chaitanya <chaitanya.m...@gmail.com> wrote:
> On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner <fen...@gmail.com> wrote: > > > > You can do this if you use snmp_varlist_add_variable() to create the > index info (you can't use netsnmp_table_helper_add_indexes). The code > would be something like > > > > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); > > snmp_varlist_add_variable(&table_info->indexes, > > NULL, > > 0, > > ASN_TYPE_OF_IFACE_NAME, > > NULL, > > 0); > > snmp_varlist_add_variable(&table_info->indexes, > > NULL, > > 0, > > ASN_IMPLIED_OCTET_STR, > > "XXXXXX", > > 6); > > snmp_varlist_add_variable(&table_info->indexes, > > NULL, > > 0, > > ASN_TYPE_OF_HIST_CLASS, > > NULL, > > 0); > > snmp_varlist_add_variable(&table_info->indexes, > > NULL, > > 0, > > ASN_TYPE_OF_HISTBIN_INDEX, > > NULL, > > 0); > > > Thanks, Bill. I was using "netsnmp_table_set_add_indexes" for the > initial addition (don't have access to index_data but only type), > You should be able to replace "table_info" above by "tset->table" and add the 4 calls to snmp_varlist_add_variable in place of the call to "netsnmp_table_set_add_indexes". and then when the data is available I either use > "netsnmp_table_dataset_replace_row/netsnmp_table_dataset_add_row" > using the API "netsnmp_table_row_add_index" for index. > This will continue to work. The real difference is setting vp->val_len in the indexes that you supply when you're registering the table. For most types this is not relevant but for the ASN_PRIV_IMPLIED types if you do not set the length, as you saw it will consume the whole rest of the data and not parse the indexes from the OID after that. Bill
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders