get next implementation question

Chen Lihua <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAFTs4sFvS8Z+pEHYR90Gv0L6ar5g1+M85ssU-0pBwLxr1g+=mA@mail.gmail.com>
Hi

I'm using net-snmp-5.8 agent code to implement my own MIB table.
My table will have 10000+ rows stored in external database.

I used  mib2c.iterate.conf to create skeleton code for my table, which
generated two functions:
xxx_get_first_data_point and xxx_get_next_data_point. Below is my current
implementation:

1. I created a linked list to store the 10000+ records;
2. In xxx_get_first_data_point(), I set "my_loop_context" to the header of
the linked list, and call the xxx_get_next_data_point();
3. In xxx_get_next_data_point(), set "my_loop_context" to next item of the
linked list, and return the "my_context_data", or NULL if the
"my_loop_context" is NULL.

It worked, however, it seems not too efficient:  each time  when call the
xxx_get_first_data_point(), it will loop from the header of the linked list;

My question is:
1. Can I know the MIB table index from xxx_get_first_data_point() or
xxx_get_next_data_point(), so that I needn't loop from the header of the
linked list?
2. Can I not to create linked list firstly, just query from data base every
time when there is snmp get next request comes in?

Thanks
Spark

Thanks
Spark

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
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.