On Fri, 2005-12-02 at 13:50 +0000, gilles B wrote: > I'am trying to develop a snmp trap daemon in c++. SNMP seems to be a > "simple" protocole, but snmptrapd.c file seems so complicated to me.
Well, most of that complexity is concerned with providing flexibility in how traps are processed. The core of snmptrapd is fairly simple. Concentrate on the routine 'main' - strip out all of the signal handling, config stuff, command line parsing, "traphandler" stuff, agentX, perl, fork handling, etc That basically leaves you with 'init_snmp', opening a session and the 'while(running)' loop. The core of this is the 'snmp_read()' call, which triggers 'snmp_input' (see snmptrapd_add_session()) That's the routine that actually handles the incoming trap. It's passed the PDU, and then you can do what you like. > I use Win NT OS, and i thought that with opening an udp socket on port 162, > i could get bytes that were sent by snmptrap. But ... no. Any idea ? I wouldn't try to parse the incoming trap yourself - there's a lot of really ugly stuff going on under the surface. Let 'snmp_read()' look after that for you - take the PDU structure and be thankful :-) 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_id=7637&alloc_id=16865&op=click _______________________________________________ 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