I have OID of 1.3.6.1.2.1.2.2.1.8.4096 (ifOperStatus)
In my code I have:
MIB[0]=0x2b
MIB[1]=0x06
MIB[2]=0x01
MIB[3]=0x02
MIB[4]=0x01
MIB[5]=0x02
MIB[6]=0x02
MIB[7]=0x01
MIB[8]=0x08
MIB[9]=0xA0
MIB[10]=0x00
where A0 00 represents 4096.
4096 in HEX is 1000. Breaking this in 2 bytes will give me 10 00. SNMP data should be sent in single byte format. Therefore, a special rule is required for large numbers because one byte (eight bits) can only represent a number from 0-255. The rule is the highest order bit is used as a flag to let the recipient know that this number spans more than one byte.
I have shifted the bits to the left and added 1 to the 8th bit.
Shift left: 20 00
Bit 8 becomes 1: A0 00
Reference: [OID Encoding] (http://www.rane.com/note161.html)
Have I encoded the 4096 correctly?
What about decoding string of data to the original OID ?
Examples would be good for me to understand the concept.