Re: question about snmp trap receiver implementation

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Fri, 2005-11-25 at 16:36 +0800, 麻雪蛟(Anders Ma) wrote:   
>         Now I am developping a deamon that could receive snmp trap
> message. I 've learned snmptrapd program, but I couldn't get raw trap
> mesage clearly..  "snmptrapd" use function "snmp_read" do almost
> everything(read packet, parse packet , print packet)

Yes - that's correct.
There's usually no point in repeating the same low-level processing
for each application individually - it makes much more sense to have
it handled by a single library routine.


>  I could'nt have the chance to get raw snmp trap message and parse it
> freely.
>  so who can help me using net-snmp library to get the snmp trap
> message and parse it free?        

If you *really* want to parse the raw incoming message yourself,
then use 'snmp_open_ex' to open the listening session (instead of
'snmp_open'),  and supply your parsing routine as the second
parameter, leaving the other parameters as NULL.

Your parsing routine will need to conform to the same behaviour
as the standard 'snmp_parse()' routine - see "snmplib/snmp_api.c"
for details.

And good luck - there's a *lot* of work involved in parsing an
SNMP packet correctly.  I'm not at all convinced that it's
sensible to reinvent the wheel like this.  But it's your choice.

Dave


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.