dissector_try_uint(_new) and dissector_try_string now return the number of bytes consumed
Change-Id: I528ad736caee1f29e2f0abfc0afcca6587d74eca Reviewed-on: https://code.wireshark.org/review/5743 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
cc12c726b8
commit
80d44af6b2
|
@ -251,7 +251,7 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
|
|||
tvbuff_t *volatile next_tvb;
|
||||
guint length_before;
|
||||
gint captured_length, reported_length;
|
||||
volatile gboolean dissector_found = FALSE;
|
||||
volatile int dissector_found = 0;
|
||||
const char *volatile saved_proto;
|
||||
ethertype_data_t *ethertype_data;
|
||||
|
||||
|
@ -314,7 +314,7 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
|
|||
before we called the subdissector. */
|
||||
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
|
||||
|
||||
dissector_found = TRUE;
|
||||
dissector_found = 1;
|
||||
pinfo->current_proto = saved_proto;
|
||||
}
|
||||
ENDTRY;
|
||||
|
|
|
@ -480,7 +480,7 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
guint8 bos;
|
||||
guint8 ttl;
|
||||
tvbuff_t *next_tvb;
|
||||
gboolean found;
|
||||
int found;
|
||||
guint8 first_nibble;
|
||||
struct mplsinfo mplsinfo;
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
gint value_len;
|
||||
char *value;
|
||||
gboolean have_body = FALSE;
|
||||
gboolean found_match = FALSE;
|
||||
int found_match = 0;
|
||||
gint content_type_len, content_type_parameter_str_len;
|
||||
gchar *media_type_str_lower_case = NULL;
|
||||
char *content_type_parameter_str = NULL;
|
||||
|
@ -695,7 +695,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
msrp_data_tree, content_type_parameter_str);
|
||||
/* If no match dump as text */
|
||||
}
|
||||
if ( found_match != TRUE )
|
||||
if ( found_match == 0 )
|
||||
{
|
||||
offset = 0;
|
||||
while (tvb_offset_exists(next_tvb, offset)) {
|
||||
|
|
|
@ -730,7 +730,7 @@ static void dissect_nhrp_mand(tvbuff_t *tvb,
|
|||
gboolean save_in_error_pkt;
|
||||
gint pkt_len = mandEnd - offset;
|
||||
proto_tree *ind_tree = proto_tree_add_subtree(tree, tvb, offset, pkt_len, ett_nhrp_indication, NULL, "Packet Causing Indication");
|
||||
gboolean dissected;
|
||||
int dissected;
|
||||
tvbuff_t *sub_tvb;
|
||||
|
||||
save_in_error_pkt = pinfo->flags.in_error_pkt;
|
||||
|
@ -770,7 +770,7 @@ static void dissect_nhrp_mand(tvbuff_t *tvb,
|
|||
sub_tvb, pinfo,
|
||||
ind_tree);
|
||||
} else
|
||||
dissected = FALSE;
|
||||
dissected = 0;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -787,13 +787,13 @@ static void dissect_nhrp_mand(tvbuff_t *tvb,
|
|||
}
|
||||
} else if (hdr->ar_pro_type <= 0x3FF) {
|
||||
/* Reserved for future use by the IETF */
|
||||
dissected = FALSE;
|
||||
dissected = 0;
|
||||
} else if (hdr->ar_pro_type <= 0x04FF) {
|
||||
/* Allocated for use by the ATM Forum */
|
||||
dissected = FALSE;
|
||||
dissected = 0;
|
||||
} else if (hdr->ar_pro_type <= 0x05FF) {
|
||||
/* Experimental/Local use */
|
||||
dissected = FALSE;
|
||||
dissected = 0;
|
||||
} else {
|
||||
dissected = dissector_try_uint(
|
||||
ethertype_subdissector_table,
|
||||
|
|
|
@ -1442,7 +1442,8 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
|
|||
if (p_conv_data && p_conv_data->rtp_dyn_payload) {
|
||||
const gchar *payload_type_str = rtp_dyn_payload_get_name(p_conv_data->rtp_dyn_payload, payload_type);
|
||||
if (payload_type_str) {
|
||||
found_match = dissector_try_string(rtp_dyn_pt_dissector_table,
|
||||
int len;
|
||||
len = dissector_try_string(rtp_dyn_pt_dissector_table,
|
||||
payload_type_str, newtvb, pinfo, tree, NULL);
|
||||
/* If payload type string set from conversation and
|
||||
* no matching dissector found it's probably because no subdissector
|
||||
|
@ -1450,7 +1451,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree,
|
|||
* as that'd probably be the wrong dissector in this case.
|
||||
* Just add it as data.
|
||||
*/
|
||||
if(found_match==FALSE)
|
||||
if(len==0)
|
||||
proto_tree_add_item( rtp_tree, hf_rtp_data, newtvb, 0, -1, ENC_NA );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -755,7 +755,7 @@ static void dissect_key_mgmt(tvbuff_t *tvb, packet_info * pinfo, proto_item * ti
|
|||
gchar *prtcl_id = NULL;
|
||||
gint len;
|
||||
tvbuff_t *keymgmt_tvb;
|
||||
gboolean found_match = FALSE;
|
||||
int found_match = 0;
|
||||
proto_tree *key_tree;
|
||||
gint next_offset;
|
||||
gint offset = 0;
|
||||
|
|
|
@ -2516,7 +2516,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
|
|||
line_type_t line_type;
|
||||
tvbuff_t *next_tvb;
|
||||
gboolean is_known_request;
|
||||
gboolean found_match = FALSE;
|
||||
int found_match = 0;
|
||||
const char *descr;
|
||||
guint token_1_len = 0;
|
||||
guint current_method_idx = SIP_METHOD_INVALID;
|
||||
|
@ -3808,8 +3808,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
|
|||
next_tvb, pinfo,
|
||||
message_body_tree, content_type_parameter_str);
|
||||
DENDENT();
|
||||
DPRINT(("done calling dissector_try_string() with found_match=%s",
|
||||
found_match?"TRUE":"FALSE"));
|
||||
DPRINT(("done calling dissector_try_string() with found_match=%u", found_match));
|
||||
|
||||
if (!found_match &&
|
||||
!strncmp(media_type_str_lower_case, "multipart/", sizeof("multipart/")-1)) {
|
||||
|
@ -3821,15 +3820,13 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
|
|||
next_tvb, pinfo,
|
||||
message_body_tree, content_type_parameter_str);
|
||||
DENDENT();
|
||||
DPRINT(("done calling dissector_try_string() with found_match=%s",
|
||||
found_match?"TRUE":"FALSE"));
|
||||
DPRINT(("done calling dissector_try_string() with found_match=%u", found_match));
|
||||
}
|
||||
/* If no match dump as text */
|
||||
}
|
||||
if ( found_match != TRUE )
|
||||
if ( found_match == 0 )
|
||||
{
|
||||
DPRINT(("calling dissector_try_heuristic() with found_match=%s",
|
||||
found_match?"TRUE":"FALSE"));
|
||||
DPRINT(("calling dissector_try_heuristic() with found_match=0"));
|
||||
DINDENT();
|
||||
if (!(dissector_try_heuristic(heur_subdissector_list,
|
||||
next_tvb, pinfo, message_body_tree, &hdtbl_entry, NULL))) {
|
||||
|
|
|
@ -2639,7 +2639,7 @@ static gint
|
|||
try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pinfo,
|
||||
usb_conv_info_t *usb_conv_info, guint8 urb_type)
|
||||
{
|
||||
gboolean ret;
|
||||
int ret;
|
||||
wmem_tree_key_t key[4];
|
||||
guint32 k_frame_number;
|
||||
guint32 k_device_address;
|
||||
|
|
|
@ -4770,7 +4770,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
guint contentType = 0;
|
||||
const char *contentTypeStr;
|
||||
tvbuff_t *tmp_tvb;
|
||||
gboolean found_match;
|
||||
int found_match;
|
||||
heur_dtbl_entry_t *hdtbl_entry;
|
||||
|
||||
/* Set up structures we will need to add the protocol subtree and manage it */
|
||||
|
@ -5001,7 +5001,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
* Try finding a dissector for the content
|
||||
* first, then fallback.
|
||||
*/
|
||||
found_match = FALSE;
|
||||
found_match = 0;
|
||||
if (contentTypeStr) {
|
||||
/*
|
||||
* Content type is a string.
|
||||
|
@ -5091,7 +5091,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
* Try finding a dissector for the content
|
||||
* first, then fallback.
|
||||
*/
|
||||
found_match = FALSE;
|
||||
found_match = 0;
|
||||
if (contentTypeStr) {
|
||||
/*
|
||||
* Content type is a string.
|
||||
|
@ -5167,7 +5167,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
* Try finding a dissector for the content
|
||||
* first, then fallback.
|
||||
*/
|
||||
found_match = FALSE;
|
||||
found_match = 0;
|
||||
if (contentTypeStr) {
|
||||
/*
|
||||
* Content type is a string.
|
||||
|
@ -5702,7 +5702,7 @@ add_multipart_data (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo)
|
|||
tvbuff_t *tmp_tvb;
|
||||
int partnr = 1;
|
||||
int part_start;
|
||||
gboolean found_match = FALSE;
|
||||
int found_match = 0;
|
||||
|
||||
proto_item *sub_tree = NULL;
|
||||
proto_item *ti = NULL;
|
||||
|
@ -5766,7 +5766,7 @@ add_multipart_data (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo)
|
|||
* Try finding a dissector for the content
|
||||
* first, then fallback.
|
||||
*/
|
||||
found_match = FALSE;
|
||||
found_match = 0;
|
||||
if (contentTypeStr) {
|
||||
/*
|
||||
* Content type is a string.
|
||||
|
|
|
@ -243,14 +243,14 @@ WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const guint32 patte
|
|||
WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const guint32 pattern);
|
||||
|
||||
/* Look for a given value in a given uint dissector table and, if found,
|
||||
call the dissector with the arguments supplied, and return TRUE,
|
||||
otherwise return FALSE. */
|
||||
call the dissector with the arguments supplied, and return the number
|
||||
of bytes consumed, otherwise return 0. */
|
||||
WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
|
||||
const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
||||
|
||||
/* Look for a given value in a given uint dissector table and, if found,
|
||||
call the dissector with the arguments supplied, and return TRUE,
|
||||
otherwise return FALSE. */
|
||||
call the dissector with the arguments supplied, and return the number
|
||||
of bytes consumed, otherwise return 0. */
|
||||
WS_DLL_PUBLIC 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);
|
||||
|
||||
|
@ -292,8 +292,8 @@ WS_DLL_PUBLIC void dissector_change_string(const char *name, const gchar *patter
|
|||
WS_DLL_PUBLIC void 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. */
|
||||
the dissector with the arguments supplied, and return the number of
|
||||
bytes consumed, otherwise return 0. */
|
||||
WS_DLL_PUBLIC int dissector_try_string(dissector_table_t sub_dissectors,
|
||||
const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue