typedef struct mib_entry { /* << SNMP-MIB Entry Info >> */ U8 Type; /* Object Type */ U8 OidLen; /* Object ID length */ U8 Oid[MIB_OIDSZ]; /* Object ID value */ U8 ValSz; /* Size of a Variable */ void *Val; /* Pointer to a variable */ void (*cb_func)(int mode); } MIB_ENTRY;
Why OID has type unsigned char? Numbers in OID can be more than 256.
Thanks. It is a pity there is no simple interface that most not to code it manual.
I'm sorry, that was wrong, here is a correct OID encoding:
12, {OID0(1,3), 6, 1, 4, 1, 129, 242, 60, 50, 1, 1, 0},
11, {OID0(1,3), 6, 1, 4, 1, 242, 60, 50, 1, 1, 0},
But the type is what the type of the value accessed by the OID. It doesn't tell if the OID (the address) should be stored as an ASCII string or in any other format.
Can you tell me how to fill structure with MIB variable which has OID "1.3.6.1.4.1.31036.50.1.1.0"?
mib_entry->Type is the type of a MIB object: MIB_INTEGER, MIB_OCTET_STR, MIB_OBJECT_ID, MIB_IP_ADDR, etc...
My guess is the array of U8's is supposed to hold an OID encoded in DER. By the way, DER is the encoding used to send them on the wire, so it would make a lot of sense to use it here.
View all questions in Keil forum