diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2015-03-08 14:59:32 +0100 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2015-03-14 14:26:17 +0000 |
commit | 77d9a059fe2d125a8cfe2193a09804a3e48caf06 (patch) | |
tree | 8ac172942c3af4fa689c39275d4ddbee942d25d9 /epan | |
parent | 32a815be20ad0e535ef7a172017b86624f70f907 (diff) |
Qt: Fix DecodeAs
Previously DecodeAs neither save its changes nor changes dissector tables.
Do that and redissect packets to refresh view.
Bug: 10553
Change-Id: Icd8453c9650f0265852f6b6b58bc483b35570a15
Reviewed-on: https://code.wireshark.org/review/7676
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/decode_as.c | 41 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 10 |
2 files changed, 46 insertions, 5 deletions
diff --git a/epan/decode_as.c b/epan/decode_as.c index e54802f10f..f66f17ca19 100644 --- a/epan/decode_as.c +++ b/epan/decode_as.c @@ -77,15 +77,50 @@ void decode_as_default_populate_list(const gchar *table_name, decode_as_add_to_l gboolean decode_as_default_reset(const char *name, const gpointer pattern) { - dissector_reset_uint(name, GPOINTER_TO_UINT(pattern)); + switch (get_dissector_table_selector_type(name)) { + case FT_UINT8: + case FT_UINT16: + case FT_UINT24: + case FT_UINT32: + dissector_reset_uint(name, GPOINTER_TO_UINT(pattern)); + return TRUE; + case FT_STRING: + case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: + dissector_reset_string(name, (!pattern)?"":(gchar *) pattern); + return TRUE; + default: + return FALSE; + }; + return TRUE; } gboolean decode_as_default_change(const char *name, const gpointer pattern, gpointer handle, gchar* list_name _U_) { dissector_handle_t* dissector = (dissector_handle_t*)handle; - if (dissector != NULL) - dissector_change_uint(name, GPOINTER_TO_UINT(pattern), *dissector); + if (dissector != NULL) { + switch (get_dissector_table_selector_type(name)) { + case FT_UINT8: + case FT_UINT16: + case FT_UINT24: + case FT_UINT32: + dissector_change_uint(name, GPOINTER_TO_UINT(pattern), *dissector); + return TRUE; + case FT_STRING: + case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: + dissector_change_string(name, (!pattern)?"":(gchar *) pattern, *dissector); + return TRUE; + default: + return FALSE; + }; + + return FALSE; + } + return TRUE; } diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index 096ee667a4..43e0aca27b 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -2421,7 +2421,10 @@ static void ieee802154_da_prompt(packet_info *pinfo _U_, gchar* result) ieee802154_hints_t *hints; hints = (ieee802154_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_get_id_by_filter_name(IEEE802154_PROTOABBREV_WPAN), 0); - g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IEEE 802.15.4 PAN 0x%04x as", hints->src_pan); + if (hints) + g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IEEE 802.15.4 PAN 0x%04x as", hints->src_pan); + else + g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IEEE 802.15.4 PAN Unknown"); } /* iee802154_da_prompt */ /* Returns the value to index the panid decode table with (source PAN)*/ @@ -2430,7 +2433,10 @@ static gpointer ieee802154_da_value(packet_info *pinfo _U_) ieee802154_hints_t *hints; hints = (ieee802154_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_get_id_by_filter_name(IEEE802154_PROTOABBREV_WPAN), 0); - return GUINT_TO_POINTER((guint)(hints->src_pan)); + if (hints) + return GUINT_TO_POINTER((guint)(hints->src_pan)); + else + return NULL; } /* iee802154_da_value */ /*FUNCTION:------------------------------------------------------ |