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:49:26 +0100
BTW should not be new_format_oid() changed to return decoded name in 'ep' buffer?

	oid_string_len = 256;
	oid_string = malloc(oid_string_len);
	if (oid_string != NULL) {
		*oid_string = '\0';
		oid_out_len = 0;
		sprint_realloc_objid(&oid_string, &oid_string_len, &oid_out_len, 1,
				     oid, oid_length);
	}
	*decoded = ep_strdup(oid_string);
	free(oid_string);


Anders Broman (AL/EAB) wrote:

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

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

Perhaps belongs there to?

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

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




_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev

_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev


--
_________________________________________________

ANF DATA              ANF DATA spol. s r. o.
a SIEMENS Company     MediaHall, Bidláky 20
                      639 00 Brno
                      Czech Republic
Tomáš Kukosa          Tel.: +420 - 533 337 227
PSE ECT PSS 2         Fax : +420 - 533 337 252
Room: 2.64            mailto:tomas.kukosa@xxxxxxxxxxx
_________________________________________________
Mailcode : O0knp7ex