Ethereal-dev: Re: [ethereal-dev] faking dissect_snmp...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Sun, 5 Dec 1999 20:41:29 -0800
> You might consider changing the code to use your code to do the SNMP
> dissection, and then just use the SNMP libraries to do any MIB
> extraction/parsing.

I did consider that, until I discovered that, without more work than I
have time for right now, the UCD SNMP library doesn't appear to let you
do that easily.  "sprint_objid()", which turns an OID into a name,
takes, as the argument pointing to the OID, an "oid *" - unfortunately,
it appears that whether an "oid" is a "u_long" or a "u_char" depends on
whether EIGHTBIT_SUBIDS is defined, and, unless I can, *WITHOUT* using
an "oid" type defined by the header file for any of the SNMP libraries
(as I want to support dissecting SNMP packets *EVEN IF YOU DON'T HAVE AN
SNMP LIBRARY INSTALLED*, even if it won't turn OIDs into names if you
don't), arrange to declare the array into which the OID is read *in a
fashion that works with "sprint_objid()" with *any* version of the UCD
*or* CMU SNMP libraries, that may or may not work.

In addition, it appears that MIBs can contain a "display format" for
variables - and it'd be nice to be able to use that when dissecting
packets, so you can display values as something other than just an
integer, if that's appropriate.  Do any of the SNMP MIB parsers provide
that information?