Re: Please help with table registration in netsnmp.

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <[email protected]>
On 11/05/07, cpnr Reddy <[email protected]> wrote:
> Tables are registered as follows:
>
>   1.my_handler = netsnmp_create_handler_registration(buf,
>                                                      my_table_handler,
>                                                      my_table_oid,
>                                                      table_oid_len,
>                                                      HANDLER_CAN_RWRITE);
>  snmp_varlist_add_variable(&table_info->indexes,
>                                    table_oid, table_oid_len,
>                                    ASN_UNSIGNED,        /* index: someTable */
>                                    (char * ) &index1, 4 );

That looks unusual.
I would expect this to be simply:

     netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, 0);

And what is the value of 'table_oid'?

>        table_info->min_column = range_subid;
>        table_info->max_column = upperbound;
>
> netsnmp_register_table(my_handler, table_info)




> Example for the above scenario is:
>
>  The following example snmpget is quering  one object from
> "RFC1213-MIB:ifTable" and another from "RFC1213-MIB:ifRouteTable"
>
>  snmpget -v3 -u tester -a MD5 -A user1  -l authNopriv   localhost
> 1.3.6.1.2.1.2.2.1.1.101  1.3.6.1.2.1.4.21.1.1.172.20.3.0

And how does this relate to your registration code?
Which table(s) are registered in this way, and which are handled by
other MIB modules?



> Case 2: When registered the tables with OID upto table position:
>
> The APIs are as above only, except for the table_oid_len in
> netsnmp_create_handler_registration() which is less 1 than the above.

But you haven't said what the first registration OID was,
so that doesn't really help us.

If you are registering a table using one of the netsnmp_register_table*()
routines, then you must supply the OID of the 'xxxTable' MIB object - not
the 'xxxEntry' object or one of the column objects.

So for the two tables you mention above, the registrations should use
the OIDs  .1.3.6.1.2.1.2.2   and  .1.3.6.1.2.1.4.21  respectively.

Dave

PS: Please do *not* send the same query to both mailing lists.
       Choose one or the other.   Thanks

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
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.