ddeham
Programmer
- Sep 30, 2005
- 11
Hi,
I need a routine that performs this SNMPGET request, and parses the result. It needs to be written in C or C++.
C:\>snmpget -c public 66.181.37.233 .1.3.6.1.4.1.3192.2.1.4.0
.1.3.6.1.4.1.3192.2.1.12.0 .1.3.6.1.4.1.3192.2.1.8.0
.1.3.6.1.4.1.3192.2.1.10.0
I already wrote the function to send the UDP packet with the request (I sniffed my DOS command and sent out the same PDU). I also am able to receive the response and store it in a buffer. Here is an example the response from Ethereal. I am using the development environment from Netburner and running the code on an embedded device. Netburner has no library support for SNMP client functions. I don't want a full ASN.1 parser. I only want to get the 4 values in this specific response. I don't care about OIDs in the response. How do I easily parse the PDU to extract the 4 data values?
Thanks,
Dan
I need a routine that performs this SNMPGET request, and parses the result. It needs to be written in C or C++.
C:\>snmpget -c public 66.181.37.233 .1.3.6.1.4.1.3192.2.1.4.0
.1.3.6.1.4.1.3192.2.1.12.0 .1.3.6.1.4.1.3192.2.1.8.0
.1.3.6.1.4.1.3192.2.1.10.0
I already wrote the function to send the UDP packet with the request (I sniffed my DOS command and sent out the same PDU). I also am able to receive the response and store it in a buffer. Here is an example the response from Ethereal. I am using the development environment from Netburner and running the code on an embedded device. Netburner has no library support for SNMP client functions. I don't want a full ASN.1 parser. I only want to get the 4 values in this specific response. I don't care about OIDs in the response. How do I easily parse the PDU to extract the 4 data values?
Code:
0000 00 13 10 14 90 db 00 03 f4 02 9a 46 08 00 45 00 ...........F..E.
0010 00 7d 08 4f 00 00 3c 11 4b d9 c0 a8 01 02 42 b5 .}.O..<.K.....B.
0020 25 e9 05 ec 00 a1 00 69 8a 72 30 5f 02 01 00 04 %......i.r0_....
0030 06 70 75 62 6c 69 63 a0 52 02 04 2a 54 dc 86 02 .public.R..*T...
0040 01 00 02 01 00 30 44 30 0f 06 0b 2b 06 01 04 01 .....0D0...+....
0050 98 78 02 01 04 00 05 00 30 0f 06 0b 2b 06 01 04 .x......0...+...
0060 01 98 78 02 01 0c 00 05 00 30 0f 06 0b 2b 06 01 ..x......0...+..
0070 04 01 98 78 02 01 08 00 05 00 30 0f 06 0b 2b 06 ...x......0...+.
0080 01 04 01 98 78 02 01 0a 00 05 00 ....x......
Thanks,
Dan