Your hint was helpfull. Using "snmptrap -Ddump" I was able to recognize the trap received. But you are right on one point, to decode the packet is a real mess
thanks -----Messaggio originale----- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Dave Shield Inviato: marted́ 19 aprile 2005 10.31 A: [EMAIL PROTECTED] Cc: net-snmp-users@lists.sourceforge.net Oggetto: Re: How decode the trap fields on a windows machine On Mon, 2005-04-18 at 14:14, AESYS S.p.A. [Enzo Arlati] wrote: > I receive a trap but I can able to decode the fields meaning. > I try to find if there is a match with the layout specified inside the snmp > protocol but I didn't sucess. Note that SNMP doesn't used "fixed size" data structures, so you can't just look at a packet dump and say "that field starts here". It used variable length encodings, so it's basically necessary to decode the packet from the beginning. If you run "snmptrap -Ddump", this will dump the contents of the packet structure, as it's sent. > The socket ( I use the IDE bolrand with Piette TWSocket component ) read the > the trogger and show the data read like the one show below Note that *all* of these values should be considered as hex (with the possible exception of the community string). A quick-n-dirty translation is: > 0E > <02><01><01> SNNMPv2c (INTEGER 1) > <04><06>public Community "public" (STRING length 6) > <A7>8 Trap2 (length 56 (=Ascii '8')) > <02><04>f<DB><9E><D8> RequestID (0x66db9ed8) > <02><01> Error Status (INTEGER ??) The rest of the packet has been truncated. > Maybe there is some library which I should use The Net-SNMP library will encode and decode such packets for you. Any other SNMP toolkit would do this as well. I *strongly* suggest that you don't try to handle this yourself. It's not particularly difficult, but there are a number of unexpected characteristics, waiting to catch the unwary. Don't re-invent the wheel - use an existing SNMP toolkit. Dave ------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ 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 ------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ 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