On 01/03/07, Adam Bell wrote:
> 2. Using mib2c =96c mib2c.table.conf :

The Net-SNMP project does not include a mib2c template
called "mib2c.table.conf". Do you mean "table_data"?

> What is missing are the get first and next support routines
> found under the next two options. (for GET_NEXT operations)

The table_data framework holds the rows of the table within
the helper itself. That means that the table_data helper handler
knows which rows are valid, so can determine the appropriate
row for a given request automatically. There's no need to call
user-provided code for this.

The helper will automatically turn a GETNEXT request into
the appropriate GET request. All of this is handled transparently.

> Question 1: Can I simply lift the first and next routines from the other 2
> mib2c runs and use them in the table style code?

The iterate and iterate_access frameworks work with an "external"
(i.e. user-provided) table. The get_{first,next} hook routines are
used to step through this in whatever way seems easiest.
The "internal-data" frameworks (table_data, container) hold the
table within the helper, so don't need these hook routines at all.
They are also likely to be more efficient, since they can go
directly to the relevant row data structure.

> MFD seems to have done
> away with the huge switch statement in the generated code.

Sort of - it's still there, but hidden away in one of the files
that you wouldn't normally need to look at.

> Question 2: The code comments around the table and iterate styles have
> MODE_GET: and state these handle GET_NEXT and GET_BULK when
> in fact they do not.

Yes - they do.

The helper routine decides which row of the table is relevant for
a given request. This uses either the internal knowledge about
the valid rows of the table, or the information provided by the
get_{first,next} loop respectively.

But in either case, the main handler routine is called with the data
structure the row that it needs to work with. The GETNEXT request
is converted into a GET request automatically. This is a deliberate
design decision.

Try debugging one of the existing MIB modules that use one of
these helpers. You'll see that both GETNEXT and GET requests
get turned into GET requests before they reach the MIB-specific
handler routine. But things work as expected.


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
Net-snmp-coders mailing list