Re: mib2c usage on tables (bad tables!)

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 06/03/07, Joao Miguel Ferreira <[email protected]> wrote:
> what is the best approach when trying to implement the agent extension
> for tables with complex indexes like multi-valued indexes.

It doesn't matter.
Almost all of the table helpers can handle complex indexing requirements.
If you look at the initialization code for most handler-based MIB modules,
you'll see a line of the form:

    netsnmp_table_helper_add_indexes(table_info,
                       ASN_{SOMETHING}, 0);

(The same code is also present in MfD-based tables, though it's
not quite as obvious).  This call specifies the indexing for that table,
and can handle multiple indexes quite easily,


> For example this table has an index of 3 values (one number, one string
> and one number)....

    netsnmp_table_helper_add_indexes(table_info,
                       ASN_INTEGER,
                       ASN_OCTET_STR,
                       ASN_INTEGER, 0);


In fact, you should find that the mib2c template will include this
registration for you automatically.

There's no real difference between a single-indexed table,
and one with multiple indexes.   Referencing an individual
row is a little more complex perhaps, but the basic operation
is exactly the same as "simple" tables.   That's one of the
advantages of the v5 handler-based API.

Which helper to use depends purely on the characteristics
of the table, and where the information will be stored, etc.
See the FAQ for details.


Dave

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.