aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-12-10 19:23:26 +0000
committerGerald Combs <gerald@wireshark.org>2013-12-10 19:23:26 +0000
commit17a67c3b5cb80619ab7e1260a05a28e888cee09e (patch)
tree538f734525e8a488e4fc60ad4eff509a80458c8f /epan/packet.c
parent5fa7d37e377abb89e317f4ebd47ebea69ebe0fd9 (diff)
Get the "Decode As" dialog working, albeit with a few warts. It differs
from the GTK flavor in two major ways: - The "Decode As" and "User Specified Decodes" dialog have been unified. - You can modify the decode as behavior at any time, not just when you have a packet selected. Revert part of 53498 so that we can move items marked /*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/ from epan/decode_as.h to ui/decode_as_utils.h. Move "save" code from decode_as_dlg.c to decode_as_utils.c as well. In packet-dcerpc.c don't register a table named "ethertype". We might want to add checks for duplicate table names. To do: - Add support for ranges? - Either add support for DCERPC or make DCERPC use a regular dissector table. - Fix string selectors (i.e. BER). svn path=/trunk/; revision=53910
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 9befce39d1..2a1da2a74a 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1070,6 +1070,19 @@ dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32
return NULL;
}
+dissector_handle_t
+dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
+{
+ dissector_table_t sub_dissectors = find_dissector_table(name);
+
+ if (sub_dissectors != NULL) {
+ dtbl_entry_t *dtbl_entry = find_uint_dtbl_entry(sub_dissectors, uint_val);
+ if (dtbl_entry != NULL)
+ return dtbl_entry->initial;
+ }
+ return NULL;
+}
+
/* Find an entry in a string dissector table. */
static dtbl_entry_t *
find_string_dtbl_entry(dissector_table_t const sub_dissectors, const gchar *pattern)
@@ -1323,6 +1336,19 @@ dissector_get_string_handle(dissector_table_t sub_dissectors,
}
dissector_handle_t
+dissector_get_default_string_handle(const char *name, const gchar *string)
+{
+ dissector_table_t sub_dissectors = find_dissector_table(name);
+
+ if (sub_dissectors != NULL) {
+ dtbl_entry_t *dtbl_entry = find_string_dtbl_entry(sub_dissectors, string);
+ if (dtbl_entry != NULL)
+ return dtbl_entry->initial;
+ }
+ return NULL;
+}
+
+dissector_handle_t
dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry)
{
return dtbl_entry->current;
@@ -1691,7 +1717,8 @@ register_dissector_table(const char *name, const char *ui_name, const ftenum_t t
const char *
get_dissector_table_ui_name(const char *name)
{
- dissector_table_t sub_dissectors = find_dissector_table( name);
+ dissector_table_t sub_dissectors = find_dissector_table(name);
+ if (!sub_dissectors) return NULL;
return sub_dissectors->ui_name;
}
@@ -1699,7 +1726,8 @@ get_dissector_table_ui_name(const char *name)
ftenum_t
get_dissector_table_selector_type(const char *name)
{
- dissector_table_t sub_dissectors = find_dissector_table( name);
+ dissector_table_t sub_dissectors = find_dissector_table(name);
+ if (!sub_dissectors) return FT_NONE;
return sub_dissectors->type;
}
@@ -1707,7 +1735,8 @@ get_dissector_table_selector_type(const char *name)
int
get_dissector_table_base(const char *name)
{
- dissector_table_t sub_dissectors = find_dissector_table( name);
+ dissector_table_t sub_dissectors = find_dissector_table(name);
+ if (!sub_dissectors) return 0;
return sub_dissectors->base;
}