
I'm trying to map libsmi BASETYPE values to SNMP base types. RFC 2578 defines the base types as:
Integer32 <=> INTEGER OctetString <=> OCTET STRING ObjectIdentifier <=> OBJECT IDENTIFIER IpAddress Counter32 Gauge32 Unsigned32 TimeTicks Opaque Counter64
And that's it. These all map to unique BER encodings, and are thus the only real types that can be conveyed across the wire. Yet, the libsmi constants are these:
typedef enum SmiBasetype { SMI_BASETYPE_UNKNOWN = 0, SMI_BASETYPE_INTEGER32 = 1, SMI_BASETYPE_OCTETSTRING = 2, SMI_BASETYPE_OBJECTIDENTIFIER = 3, SMI_BASETYPE_UNSIGNED32 = 4, SMI_BASETYPE_INTEGER64 = 5, SMI_BASETYPE_UNSIGNED64 = 6, SMI_BASETYPE_FLOAT32 = 7, SMI_BASETYPE_FLOAT64 = 8, SMI_BASETYPE_FLOAT128 = 9, SMI_BASETYPE_ENUM = 10, SMI_BASETYPE_BITS = 11 } SmiBasetype;
Libsmi adds some extra ones, and omits others. Here's my problem (by way of example).
In RFC1271 (RMON MIB) there is a node like so:
bufferControlTurnOnTime OBJECT-TYPE SYNTAX TimeTicks ACCESS read-only STATUS mandatory DESCRIPTION "The value of sysUpTime when this capture buffer was first turned on." ::= { bufferControlEntry 11 }
Note that the SYNTAX clause is TimeTicks, which is an SNMP base type with encoding [APPLICATION 3].
But libsmi returns this (using my Python wrapper): Python> import SMI Python> m =SMI.getModule("RFC1271-MIB") Python> n = m.getNode("bufferControlTurnOnTime") Python> print n.syntax Type: namednumbers = [] name = TimeTicks units = None enumeration = None ranges = None value = <unknown> basetype = 4 format = None reference = None description = None decl = 2 status = 0
The name is correctly shown as "TimeTicks", but the basetype is 4, which means SMI_BASETYPE_UNSIGNED32, which implies a basetype of Unsigned32 which has an encoding of [APPLICATION 2] (different from the canonical TimeTicks). But then, the SmiBasetype C enumeration does not even list TIMETICKS at all.
Or am I not using this libsmi correctly?
Could someone please explain this to me, and possibly give me a clue as to how to map libsmi SYNTAX/SmiType values to canonical SNMP/RFC2578 types? Thank you.
\|// (O O) -- --------------------oOOo~(_)~oOOo---------------------------------------- Keith Dart mailto:kdart@kdart.com http://www.kdart.com/ ---------------------------------------------------------------------------- Ever since my brain transplant I ... ============================================================================
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.