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 08:22:32 +0100
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