Ethereal-dev: [Ethereal-dev] [Patch] to packet-diameter.c
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Martin Mathieson <martin.mathieson@xxxxxxxxxxxx>
Date: Tue, 14 Mar 2006 14:03:03 +0000
Hi, This patch:- makes it possible to turn off use of the XML AVP dictionary (which relies upon the XML lib being installed). A failed load results in 3 annoying dialogs popping up the first time a diameter packet is read. Default is previous behaviour. - fixes an error % specifier to show the (Application Identifier) string properly
Regards, Martin Mathieson
Index: epan/dissectors/packet-diameter.c =================================================================== --- epan/dissectors/packet-diameter.c (revision 17626) +++ epan/dissectors/packet-diameter.c (working copy) @@ -246,6 +246,7 @@ /* Suppress console output at unknown AVP:s,Flags etc */ static gboolean suppress_console_output = TRUE; +static gboolean gbl_use_xml_dictionary = TRUE; #define DICT_FN "diameter/dictionary.xml" static const gchar *gbl_diameterDictionary; @@ -665,7 +666,7 @@ ApplicationId *entry; if (!name || (id == 0 && !allow_zero_as_app_id)) { - report_failure( "Diameter Error: Invalid application (name=%p, id=%d)", + report_failure( "Diameter Error: Invalid application (name=%s, id=%d)", name, id); return (-1); } /* Sanity Checks */ @@ -918,9 +919,9 @@ } /* initializeDictionaryDefaults */ /* - * This routine will attempt to load the XML dictionary, and on - * failure, will call initializeDictionaryDefaults to load in - * our static dictionary. + * This routine will attempt to load the XML dictionary if configured to. + * Otherwise, or if load fails, it will call initializeDictionaryDefaults + * to load in our static dictionary instead. */ static void initializeDictionary(void) @@ -930,12 +931,17 @@ * loadXMLDictionary will be called. This is one of the few times when * I think this is prettier than the nested if alternative. */ - if (loadLibXML() || - (loadXMLDictionary() != 0)) { - /* Something failed. Use the static dictionary */ - report_failure("Diameter: Using static dictionary! (Unable to use XML)"); - initializeDictionaryDefaults(); - } + if (gbl_use_xml_dictionary) { + if (loadLibXML() || (loadXMLDictionary() != 0)) { + /* Something failed. Use the static dictionary */ + report_failure("Diameter: Using static dictionary! (Unable to use XML)"); + initializeDictionaryDefaults(); + } + } + else { + initializeDictionaryDefaults(); + } + } /* initializeDictionary */ @@ -2224,7 +2230,7 @@ diameter_module = prefs_register_protocol(proto_diameter, proto_reg_handoff_diameter); /* Register a configuration option for Diameter version */ - prefs_register_enum_preference(diameter_module, "version", "Diameter version", "Standard version used for decoding", (gint *)&gbl_version, options, FALSE); + prefs_register_enum_preference(diameter_module, "version", "Diameter version", "Standard version used for decoding", (gint *)&gbl_version, options, FALSE); prefs_register_uint_preference(diameter_module, "tcp.port", "Diameter TCP Port", @@ -2258,6 +2264,16 @@ */ g_free(default_diameterDictionary); + /* + * Make use of the dictionary optional. Avoids error popups if xml library + * or dictionary file aren't available. + */ + prefs_register_bool_preference(diameter_module, "dictionary.use", + "Attempt to load/use Diameter XML Dictionary", + "Only attempt to load and use the Diameter XML\n" + "Dictionary when this option is selected", + &gbl_use_xml_dictionary); + /* Desegmentation */ prefs_register_bool_preference(diameter_module, "desegment", "Reassemble Diameter messages\nspanning multiple TCP segments",
- Follow-Ups:
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- From: Joerg Mayer
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- Prev by Date: Re: [Ethereal-dev] How are ethernet frames carried over HDLC frame
- Next by Date: Re: [Ethereal-dev] [Patch] to packet-diameter.c
- Previous by thread: Re: [Ethereal-dev] How are ethernet frames carried over HDLC frame
- Next by thread: Re: [Ethereal-dev] [Patch] to packet-diameter.c
- Index(es):