Hello there,
I stumbled upon some problems using net-snmp for creating a sub-agent. I
was able to figure out most of the stuff, but there are still some
questions left.
I) What is the difference between
netsnmp_register_watched_scalar()
and
netsnmp_register_watched_instance()
?
Besides *_instance mostly seems to work as I want it to and *_scalar
doesn't. ;)
II) Why does net-snmp behave different with the following code:
1)
netsnmp_register_watched_instance(
netsnmp_create_handler_registration(
"one",
NULL,
my_oid1,
OID_LENGTH(my_oid1),
HANDLER_CAN_RWRITE),
netsnmp_create_watcher_info(
(void *)&string,
sizeof(string),
ASN_OCTET_STR,
WATCHER_MAX_SIZE)
);
snmpget/-set works fine
2)
netsnmp_register_watched_instance(
netsnmp_create_handler_registration(
"two",
NULL,
my_oid2,
OID_LENGTH(my_oid2),
HANDLER_CAN_RWRITE),
netsnmp_create_watcher_info(
(void *)&integer,
sizeof(integer),
ASN_INTEGER,
WATCHER_FIXED_SIZE)
);
snmpget works fine / snmpset doesn't work (wrong type or length)
3)
netsnmp_register_int_instance(
"two",
my_oid2,
OID_LENGTH(my_oid2),
&integer,
NULL
);
snmpget/-set works fine
Is it safe to use the netsnmp_register_int_instance rather than the
netsnmp_register_watched_instance?
III) How do I correctly add an OID in a table?
I tried
netsnmp_set_row_column(netsnmp_row, 2, ASN_OBJECT_ID, "\0",
sizeof("\0")); /* OID 0.0 */
which should be fine to my understanding of OID-encoding. But the agent
refuses to generate a paket because of a bad sub-identifier, so the
request times out. I also tried to add a more complex OID (i.e. 2.100.3)
accordingly to the above example with "\x81\x34\x03" but I may be
totally wrong with that.
Perhaps I only need a point to the right direction.
Thanks in advance
* * *
Hirschmann Automation and Control GmbH, Neckartenzlingen
Register court: Stuttgart, Trade register No.: HRB 225927
VAT No.: DE 814 212 604
Managing Director: Dr. Wolfgang Babel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders