title: Decode SNMP PDUs - Where to Start?
body: <p>Hello my first ever question on here, in need of bit of guidance. </p>
  
  <p>I'm working on a packet sniffer mainly to decode SNMP PDUs, however I am not entirely sure where to go with it.</p>
  
  <p>Simply put my packet sniffer can extract information from packets however I am interested in the data payload field. It is written in C++ and I am using winsock.</p>
  
  <p>What way should I go about this? Are the SNMP fields encoded in basic encoding rules or will I have to delve into ASN.1? </p>
  
  <p>I am only looking to decode those SNMP fields within the data payload field into human readable form. They are going to be dumped into a text file. So I will be looking at decoding OIDs also. I am verifying everything as I go along with Wireshark and using GETIF to query my SNMP node. </p>
  
  <p>Any guidance is appreciated. </p>
  
  <p>EDIT:</p>
  
  <p>Thanks user1793963 very well explained. Sorry to all who have marked this as too broad.</p>
  
  <p>To elaborate on my original question could anyone explain the initial part of the PDU itself.</p>
  
  <p>Example: My program outputs these hex values 30 82 <strong>00 A3</strong> 02 01 00, which is SEQUENCE (30), LENGTH (82) and two other values. This is from a GetRequest PDU.</p>
  
  <p>The GetResponse PDU shows these values 30 81 <strong>B7</strong> 02 01 00, SEQUENCE, 81 in LENGTH and another value.</p>
  
  <p><strong>Could someone explain the values marked in bold. If it uses the simple TLV structure what are the values representing? What I know is the start of the sequence (30) and the total PDU length (which is 82 and 81) and I know 02 01 00 are INTEGER 1 in LENGTH and VERSION 0 however I do not understand 00 A3 (GetRequest) and B7 (GetResponse). What do these values represent?
  Many thanks.</strong></p>
  
  <p><em>I am also using Wireshark to check values, however they do not state the start of the PDU sequence</em></p>