Hi,

I'v a question concerning table registration and their OIDs.

I register a table using the following snippet:

------------------------------------------------------------
reg = netsnmp_create_handler_registration( "my_table",
                   my_table_handler,
                   oid_, oidlen_,
                   HANDLER_CAN_RONLY);

table_info_ = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
table_info_->min_column = 1;
table_info_->max_column = 3;
netsnmp_table_helper_add_indexes( table_info_, ASN_INTEGER, 0 );

netsnmp_register_table(reg, table_info_);
------------------------------------------------------------

The root OID is "1.3.6.1.3.79.5", my table has 3 columns and uses an 
integer as index.
The correct OIDs thus would be (x being the index):

1.3.6.1.3.79.5          Table
1.3.6.1.3.79.5.1        TableEntry
1.3.6.1.3.79.5.1.1.x    Column 1, Row x
1.3.6.1.3.79.5.1.2.x    Column 2, Row x
1.3.6.1.3.79.5.1.3.x    Column 3, Row x

This works fine for me; when my_table_handler gets called, I fetch row 
"x" from an STL map and then fetch the "request_info->colnum"'th column 
from my row. Finally I call snmp_set_var_objid() and 
snmp_set_var_typed_value() to set the value and the next OID.

Now my question: Is it possible to register a table *without* the table 
entry? I.e.:

1.3.6.1.3.79.5        Table
1.3.6.1.3.79.5.1.x    Column 1, Row x
1.3.6.1.3.79.5.2.x    Column 2, Row x
1.3.6.1.3.79.5.3.x    Column 3, Row x

When I try, the first column gets displayed correctly when asking with 
snmpwalk. In the answer I set snmp_set_var_objid("1.3.6.1.3.79.5.2.x"). 
I would expect that my_table_handler then gets called with that OID and 
I can answer with 1.3.6.1.3.79.5.3.x and so on.
But actually it never gets called again. Obviuosly netsnmp "thinks" my 
table has finished. If I register a second table with OID 
1.3.6.1.3.79.6, then the handler for that table gets called.
My guess is: When I call snmp_set_var_objid("1.3.6.1.3.79.5.2.x"), then 
netsnmp somehow knows that this cannot be any longer in the ...79.5 
table because ...79.5 tables have their first "real" counter at OID 
...79.5.1.x (according to the RFCs). As a result, my_table_handler gets 
called for the next table, which is ...79.6. Is that true?

The background for my question is: For some reason someone in our 
project has defined a table without that TableEntry. He thought that 
wouldn't be neccessary as it carries no real information. And now I'm 
stuck with implementing that. As I tried, debugged and read, I finnaly 
came to the conclusion that it's not possible. Am I right?

-- Dirk

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to