diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2014-10-06 15:17:46 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2014-10-07 20:27:35 +0000 |
commit | d89cc1cf9ada0d91a6819a7d6677f48ddcc54adc (patch) | |
tree | 2ed8caa7404d463bdf8e93cbc52e5fe1593ee6a1 /epan/packet.c | |
parent | 47a1735ca1c824eec9590660c54a00c50b939bd3 (diff) | |
download | wireshark-d89cc1cf9ada0d91a6819a7d6677f48ddcc54adc.tar.gz |
ASN1: Added support for using #.REGISTER_NEW
This will register BER PDU-dissectors as "new".
Return number of bytes dissected from dissector_try_* functions.
Return number of bytes dissected in DissectorTable:try()
This will make it possible to get dissected length when using
dissector_try_*() and dissected ASN.1 length in Lua when using
DissectorTable:try() (as we already have for Dissector:call).
Change-Id: Iee17a68dc214fa0fb50b25fc927026ad7c1cbce4
Reviewed-on: https://code.wireshark.org/review/4531
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/packet.c')
-rw-r--r-- | epan/packet.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/epan/packet.c b/epan/packet.c index e938884126..c95fea633d 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1110,7 +1110,7 @@ dissector_reset_uint(const char *name, const guint32 pattern) call the dissector with the arguments supplied, and return TRUE, otherwise return FALSE. */ -gboolean +int dissector_try_uint_new(dissector_table_t sub_dissectors, const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data) @@ -1118,7 +1118,7 @@ dissector_try_uint_new(dissector_table_t sub_dissectors, const guint32 uint_val, dtbl_entry_t *dtbl_entry; struct dissector_handle *handle; guint32 saved_match_uint; - int ret; + int len; dtbl_entry = find_uint_dtbl_entry(sub_dissectors, uint_val); if (dtbl_entry != NULL) { @@ -1132,7 +1132,7 @@ dissector_try_uint_new(dissector_table_t sub_dissectors, const guint32 uint_val, * so that other dissectors might have a chance * to dissect this packet. */ - return FALSE; + return 0; } /* @@ -1142,7 +1142,7 @@ dissector_try_uint_new(dissector_table_t sub_dissectors, const guint32 uint_val, */ saved_match_uint = pinfo->match_uint; pinfo->match_uint = uint_val; - ret = call_dissector_work(handle, tvb, pinfo, tree, add_proto_name, data); + len = call_dissector_work(handle, tvb, pinfo, tree, add_proto_name, data); pinfo->match_uint = saved_match_uint; /* @@ -1154,16 +1154,16 @@ dissector_try_uint_new(dissector_table_t sub_dissectors, const guint32 uint_val, * * 0 is also returned if the protocol wasn't enabled. * - * If the packet was rejected, we return FALSE, so that + * If the packet was rejected, we return 0, so that * other dissectors might have a chance to dissect this - * packet, otherwise we return TRUE. + * packet, otherwise we return the dissected length. */ - return ret != 0; + return len; } - return FALSE; + return 0; } -gboolean +int dissector_try_uint(dissector_table_t sub_dissectors, const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -1384,17 +1384,17 @@ dissector_reset_string(const char *name, const gchar *pattern) /* Look for a given string in a given dissector table and, if found, call the dissector with the arguments supplied, and return TRUE, otherwise return FALSE. */ -gboolean +int dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dtbl_entry_t *dtbl_entry; struct dissector_handle *handle; - int ret; + int len; const gchar *saved_match_string; /* XXX ASSERT instead ? */ - if (!string) return FALSE; + if (!string) return 0; dtbl_entry = find_string_dtbl_entry(sub_dissectors, string); if (dtbl_entry != NULL) { /* @@ -1407,7 +1407,7 @@ dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, * so that other dissectors might have a chance * to dissect this packet. */ - return FALSE; + return 0; } /* @@ -1417,7 +1417,7 @@ dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, */ saved_match_string = pinfo->match_string; pinfo->match_string = string; - ret = call_dissector_work(handle, tvb, pinfo, tree, TRUE, data); + len = call_dissector_work(handle, tvb, pinfo, tree, TRUE, data); pinfo->match_string = saved_match_string; /* @@ -1429,13 +1429,13 @@ dissector_try_string(dissector_table_t sub_dissectors, const gchar *string, * * 0 is also returned if the protocol wasn't enabled. * - * If the packet was rejected, we return FALSE, so that + * If the packet was rejected, we return 0, so that * other dissectors might have a chance to dissect this - * packet, otherwise we return TRUE. + * packet, otherwise we return the dissected length. */ - return ret != 0; + return len; } - return FALSE; + return 0; } /* Look for a given value in a given string dissector table and, if found, |