ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

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: Fri, 10 Dec 1999 01:52:26 -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.

As per my recent mail, I came up with a way to do this, although it
wires into "asn1.h" the notion that UCD SNMP always uses "u_long" and
that CMU SNMP always uses "u_int" (if you defined EIGHTBIT_SUBIDS when
you built the library, you're screwed - but so is any other program that
uses the library, unless *it* defines EIGHTBIT_SUBIDS or one of the
library's header files does it).

It should also be possible to use "libsmi" rather than the MIB stuff
from the UCD or CMU SNMP libraries.

> 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?

...or use it in their "sprint_value()" routines?