I want to define a MIB containing integer-valued OIDs that are 1 or 2 octets long to keep down the size of my TRAP messages - they're going over a mobile data network so we pay by the byte, and transmission times go up with bigger data types as well.
The SNMPv2-SMI only defines Integer32 and Unsigned32, and SNMPv2-TC doesn't extend these to smaller packing sizes. Is there already a standard definition out there for Unsigned8, Integer16 etc? If so, where?
Alternatively, if I define my object type as something like "Integer32(-1..99)", will the MIB compiler etc do the right thing and pack the value into a single byte? We're using SNMP4J on the Agent and Net-SNMP on the Manager.
If you hadn't already guessed I'm a bit of a noob at this so please be tolerant if this is a dumb question :-)
I've done a bit of digging in the encoding rules used by SNMP (see en.wikipedia.org/wiki/X.690) and it looks like my question is irrelevant if the code packing the PDU has a bit of intelligence. The Basic Encoding Rules employed by SNMP record an integer value as a triple "tag-length-value" where the "tag" identifies the data type), the length gives the number of bytes holding the value and the value is, well, the value. So if the application is sending the value "1" from a 32-bit integer then there's no need to encode it in 32 bits, simply encode it as 0x02 0x01 0x01.
So it depends on whether the packing library has that intelligence.