OS> should be left alone. I mostly packed and unpacked everything in
the
OS> netsnmp_pdu struct. Through trial and error (and memory leaks) I
found
OS> that some data was not really owned by the pdu, and didn't need to
be
OS> packed/unpacked.
RS> What did you end up leaving out?
Pointers to functions, tDomain, and tDomainLen. They all get set to
NULL
on the unpack end. I found that snmp_free_pdu didn't free tDomain so
when I
was unpacking it on the other side I would malloc space for it and
create a
memory leak. I think that mostly everything else was packed/unpacked
and if
it was packed from a pointer on the snmptrapd side, I would unpack it
into a
malloc()ed memory on the other. I think the snmp_free_pdu() freed the
rest
so it was safe to pack/unpack.
OS> I separated the PDU code into its own unit called snmp_pdu.c, but
when I
OS> asked about this to the coders list some time back they said it
should
OS> just be left in the snmp_api.c file for now awaiting major
restructuring of
OS> the file in the future.
RS> That's right. In general, patches should have as minimal an impact
as
possible.
OK, I will put the code in snmp_api unit.
OS> Right now, the they would need to do the select() and read() and
OS> netsnmp_unpack_snmp_pdu() which really isn't that much harder, but
is
OS> not as cool.
RS> True, but that assumes they are using the net-snmp event loop, which
they might not be if all they want is traps. The fd/handler should
be
available for those applications. The integrated method would be
nice,
but is secondary. (eg if you want to add it, go for it.)
OK, I agree. I will describe how one can connect to and receive traps
and leave the integrated method as a future project.
One last thing. Since the address and port of the trap publisher will
need to be configurable (snmpd.conf, etc...) I plan to make it read it
as
a ds (default store) configuration option in snmp_api.c's
register_default_handlers() function. Is planned to have it read in
like
trap_pubish_add 192.168.0.1
trap_pubish_port 6655
Is this fine or is there a different/preferred way to do this. Also,
Should I maybe not start the trap publishing service unless these values
are defined or should I default them? Right now I default them to
INADDR_ANY and 6695.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders