aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-12-08 06:41:48 +0000
committerGuy Harris <guy@alum.mit.edu>2001-12-08 06:41:48 +0000
commit75cc056222900115ffab82bd5e976cd359582dea (patch)
tree2553b2a2b59a716626785e76b2f2782370b8199a /epan/packet.c
parent421e391953575a91959ba2323a735958b45d80fe (diff)
Attach a descriptive name field type and base to dissector tables; that
specifies how the selector values used as keys in those tables are to be displayed, and the title to use when displaying the table. Use that information in the code to display the initial and current entries of various dissector tables. Have the dissector for BACnet APDUs register itself by name, and have the BACnet NPDU dissector call it iff the BAC_CONTROL_NET bit isn't set, rather than doing it with a dissector table. svn path=/trunk/; revision=4358
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 5e95994c4a..53b33f840b 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.51 2001/12/03 09:00:25 guy Exp $
+ * $Id: packet.c,v 1.52 2001/12/08 06:41:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -230,15 +230,26 @@ struct dtbl_entry {
* "dissector_handles" is a list of all dissectors that *could* be
* used in that table; not all of them are necessarily in the table,
* as they may be for protocols that don't have a fixed port number.
+ *
+ * "ui_name" is the name the dissector table has in the user interface.
+ *
+ * "type" is a field type giving the width of the port number for that
+ * dissector table.
+ *
+ * "base" is the base in which to display the port number for that
+ * dissector table.
*/
struct dissector_table {
- GHashTable *hash_table;
- GSList *dissector_handles;
+ GHashTable *hash_table;
+ GSList *dissector_handles;
+ char *ui_name;
+ ftenum_t type;
+ int base;
};
static GHashTable *dissector_tables = NULL;
-/* Finds a dissector table by field name. */
+/* Finds a dissector table by table name. */
static dissector_table_t
find_dissector_table(const char *name)
{
@@ -665,7 +676,8 @@ dissector_table_foreach_changed (char *name,
}
dissector_table_t
-register_dissector_table(const char *name)
+register_dissector_table(const char *name, char *ui_name, ftenum_t type,
+ int base)
{
dissector_table_t sub_dissectors;
@@ -684,10 +696,37 @@ register_dissector_table(const char *name)
sub_dissectors->hash_table = g_hash_table_new( g_direct_hash,
g_direct_equal );
sub_dissectors->dissector_handles = NULL;
+ sub_dissectors->ui_name = ui_name;
+ sub_dissectors->type = type;
+ sub_dissectors->base = base;
g_hash_table_insert( dissector_tables, (gpointer)name, (gpointer) sub_dissectors );
return sub_dissectors;
}
+char *
+get_dissector_table_ui_name(const char *name)
+{
+ dissector_table_t sub_dissectors = find_dissector_table( name);
+
+ return sub_dissectors->ui_name;
+}
+
+ftenum_t
+get_dissector_table_type(const char *name)
+{
+ dissector_table_t sub_dissectors = find_dissector_table( name);
+
+ return sub_dissectors->type;
+}
+
+int
+get_dissector_table_base(const char *name)
+{
+ dissector_table_t sub_dissectors = find_dissector_table( name);
+
+ return sub_dissectors->base;
+}
+
static GHashTable *heur_dissector_lists = NULL;
typedef struct {