Ethereal-dev: Re: [Ethereal-dev] OID name translation from MIB:s

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

From: Tomas Kukosa <tomas.kukosa@xxxxxxxxxxx>
Date: Tue, 06 Dec 2005 09:00:09 +0100

Looks good to me, other things to consider:
format_oid.h should go into oid_resolv.h?

I agree.

The functions in packet-snmp.c:
int oid_to_subid_buf() gchar * format_oid()
void new_format_oid()

I will start and you can continue. :)

Perhaps belongs there to?

And there is also
http://www.ethereal.com/lists/ethereal-dev/200510/msg00178.html

I think oid_resolv.c should contain only name resolution.
Relation between OIDs and dissectors is another big topic which we should think about. :)

But everything does not have to kome at once :)

Brg
Anders

-----Original Message-----
From: ethereal-dev-bounces@xxxxxxxxxxxx
[mailto:ethereal-dev-bounces@xxxxxxxxxxxx] On Behalf Of Tomas Kukosa
Sent: den 6 december 2005 08:23
To: Ethereal development
Subject: Re: [Ethereal-dev] OID name translation from MIB:s

Hi,

my idea for first step is following:

1) create oid_resolv.c/h with following functions
    const gchar *get_oid_name(const guint8 *oid, gint oid_len);
      it would look into oid_table as weel as into MIB database
    void add_oid_name(const guint8 *oid, gint oid_len, const gchar
*name);
    void add_oid_str_name(const gchar *oid_str, const gchar *name);
    gboolean oid_resolv_enabled(void)
      it would be TRUE and later we can inroduce preference

2) Move oid_table from packet-per/ber.c to oid_resolv.c
    use add_oid_str_name() in packet-per/ber.c

3) remove OID name resolution from packet-per/ber.c and call it from
proto.c
	case FT_OID:
		bytes = fvalue_get(&fi->value);
		name = (oid_resolv_enabled()) ? get_oid_name(bytes,
fvalue_length(&fi->value)) : NULL;
		if (name)
			ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
				"%s: %s (%s)", hfinfo->name,
				 oid_to_str(bytes,
fvalue_length(&fi->value)), name);
		else
			ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
				"%s: %s", hfinfo->name,
				 oid_to_str(bytes,
fvalue_length(&fi->value)));
		if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
			label_str[ITEM_LABEL_LENGTH - 1] = '\0';
		break;


Any other ideas?

Regards,
   Tom

Anders Broman wrote:

Hi,
I have checked in code to translate OID names from SNMP MIB:s if not found in the OID names data base (Should that code be included in oid_to_str() instead?).

This also raises the question on how to handle MIB:s.
Currently we include the ones from the SNMP library. How should we add other MIB:s to the distribution if we want to? Another option is to have a separate downloadable set of MIB:s.

Should we have our own "MIB" with translations we want? Should that replace the "names data base"? We could read that file if the SNMP library isn't available.

Brg
Anders