Re: MAC Address As Index

Krishna Chaitanya <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CABPxzYKy1+46qG+XKrDi1c_2i4rRziJJ=roAyiw6EfqNb0jnMg@mail.gmail.com>
On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner <[email protected]> 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),
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.

I guess it all boils down to using netsnmp_table_data_add_index (using
only types) Vs netsnmp_table_row_add_index (types and indexes).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.