From Didier Gautheron:

Dissectors using call_dissector() function inside a 'if (tree) {}' block.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4107

svn path=/trunk/; revision=30415
This commit is contained in:
Anders Broman 2009-10-09 07:24:33 +00:00
parent 46aa5c44de
commit 4d2e653901
35 changed files with 278 additions and 298 deletions

View File

@ -1651,20 +1651,18 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
break;
case ARTNET_OP_RDM:
if (tree) {
hi = proto_tree_add_item(artnet_tree,
hi = proto_tree_add_item(artnet_tree,
hf_artnet_rdm,
tvb,
offset,
0,
FALSE);
si = proto_item_add_subtree(hi,ett_artnet);
si = proto_item_add_subtree(hi,ett_artnet);
size = dissect_artnet_rdm( tvb, offset, si, pinfo );
size -= offset;
size = dissect_artnet_rdm( tvb, offset, si, pinfo );
size -= offset;
proto_item_set_len( si, size );
}
proto_item_set_len( si, size );
break;
case ARTNET_OP_IP_PROG:

View File

@ -128,10 +128,13 @@ dissect_erspan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(erspan_tree, hf_erspan_unknown4, tvb, offset, 4,
FALSE);
offset += 4;
eth_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(ethnofcs_handle, eth_tvb, pinfo, tree);
}
else {
offset += 8;
}
eth_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(ethnofcs_handle, eth_tvb, pinfo, tree);
}
void

View File

@ -511,9 +511,8 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect it as a CLNP PDU. */
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string);
if (tree) {
next_length = tvb_length_remaining(tvb, offset);
if (next_length != 0) {
next_length = tvb_length_remaining(tvb, offset);
if (next_length != 0) {
/* We have payload; dissect it. */
ti = proto_tree_add_text(clnp_tree, tvb, offset, next_length,
"Discarded PDU");
@ -530,7 +529,6 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Restore the "we're inside an error packet" flag. */
pinfo->in_error_pkt = save_in_error_pkt;
}
}
pinfo->fragmented = save_fragmented;
return; /* we're done with this PDU */

View File

@ -1066,113 +1066,110 @@ dissect_ehs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EHS");
col_set_str(pinfo->cinfo, COL_INFO, "EHS");
if ( tree )
ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, FALSE );
ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs );
/* build the ehs primary header tree */
ehs_primary_header = proto_tree_add_text ( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE, "Primary EHS Header" );
ehs_primary_header_tree = proto_item_add_subtree ( ehs_primary_header, ett_ehs_primary_header );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, FALSE );
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, FALSE );
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, FALSE );
++offset;
/* save protocol for use later on */
protocol = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, FALSE );
++offset;
year = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_year, tvb, offset, 1, FALSE );
++offset;
jday = tvb_get_ntohs ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_jday, tvb, offset, 2, FALSE );
offset += 2;
hour = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hour, tvb, offset, 1, FALSE );
++offset;
minute = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_minute, tvb, offset, 1, FALSE );
++offset;
second = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_second, tvb, offset, 1, FALSE );
++offset;
tenths = tvb_get_guint8 ( tvb, offset ) >> 4;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_tenths, tvb, offset, 1, FALSE );
/* format a more readable ground receipt time string */
proto_tree_add_text ( ehs_primary_header_tree, tvb, offset-7, 7,
"%04d/%03d:%02d:%02d:%02d.%1d = EHS Ground Receipt Time", year + 1900, jday, hour, minute, second, tenths );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, FALSE );
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, FALSE ); */
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, FALSE );
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, FALSE ); */
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, FALSE ); */
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, FALSE ); */
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, FALSE );
offset += 2;
/* build the ehs secondary header tree */
ehs_secondary_header = proto_tree_add_text ( ehs_tree, tvb, offset,
ehs_secondary_header_size ( protocol, tvb, offset ), "Secondary EHS Header" );
ehs_secondary_header_tree = proto_item_add_subtree ( ehs_secondary_header, ett_ehs_secondary_header );
/* since each protocol can have a different ehs secondary header structure, we will offload
* this processing to lower levels of code so we don't have to insert all of that complexity
* directly inline here, which would no doubt make this difficult to read at best.
*/
ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset );
/* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */
switch ( protocol )
{
ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, FALSE );
ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs );
case EHS_PROTOCOL__TDM_TELEMETRY:
case EHS_PROTOCOL__PSEUDO_TELEMETRY:
case EHS_PROTOCOL__AOS_LOS:
case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
case EHS_PROTOCOL__PDSS_UDSM:
new_tvb = tvb_new_subset_remaining ( tvb, offset);
call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree );
/* build the ehs primary header tree */
ehs_primary_header = proto_tree_add_text ( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE, "Primary EHS Header" );
ehs_primary_header_tree = proto_item_add_subtree ( ehs_primary_header, ett_ehs_primary_header );
/* bump the offset to the data zone area */
first_word = tvb_get_ntohs ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, FALSE );
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, FALSE );
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, FALSE );
++offset;
/* save protocol for use later on */
protocol = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, FALSE );
++offset;
year = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_year, tvb, offset, 1, FALSE );
++offset;
jday = tvb_get_ntohs ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_jday, tvb, offset, 2, FALSE );
offset += 2;
hour = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hour, tvb, offset, 1, FALSE );
++offset;
minute = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_minute, tvb, offset, 1, FALSE );
++offset;
second = tvb_get_guint8 ( tvb, offset );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_second, tvb, offset, 1, FALSE );
++offset;
tenths = tvb_get_guint8 ( tvb, offset ) >> 4;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_tenths, tvb, offset, 1, FALSE );
/* format a more readable ground receipt time string */
proto_tree_add_text ( ehs_primary_header_tree, tvb, offset-7, 7,
"%04d/%03d:%02d:%02d:%02d.%1d = EHS Ground Receipt Time", year + 1900, jday, hour, minute, second, tenths );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, FALSE );
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, FALSE ); */
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, FALSE );
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, FALSE );
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, FALSE ); */
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, FALSE ); */
++offset;
/* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, FALSE ); */
++offset;
proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, FALSE );
offset += 2;
/* build the ehs secondary header tree */
ehs_secondary_header = proto_tree_add_text ( ehs_tree, tvb, offset,
ehs_secondary_header_size ( protocol, tvb, offset ), "Secondary EHS Header" );
ehs_secondary_header_tree = proto_item_add_subtree ( ehs_secondary_header, ett_ehs_secondary_header );
/* since each protocol can have a different ehs secondary header structure, we will offload
* this processing to lower levels of code so we don't have to insert all of that complexity
* directly inline here, which would no doubt make this difficult to read at best.
*/
ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset );
/* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */
switch ( protocol )
{
case EHS_PROTOCOL__TDM_TELEMETRY:
case EHS_PROTOCOL__PSEUDO_TELEMETRY:
case EHS_PROTOCOL__AOS_LOS:
case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
case EHS_PROTOCOL__PDSS_UDSM:
new_tvb = tvb_new_subset_remaining ( tvb, offset);
call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree );
/* bump the offset to the data zone area */
first_word = tvb_get_ntohs ( tvb, offset );
offset += CCSDS_PRIMARY_HEADER_LENGTH;
if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH;
break;
offset += CCSDS_PRIMARY_HEADER_LENGTH;
if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH;
break;
default:
break;
}
/* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */
ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo );
default:
break;
}
/* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */
ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo );
}

View File

@ -352,7 +352,7 @@ static void dissect_eigrp_ip6_ext(tvbuff_t *tvb, proto_tree *tree, proto_item *t
static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *eigrp_tree, *tlv_tree, *eigrp_flags_tree;
proto_tree *eigrp_tree = NULL, *tlv_tree, *eigrp_flags_tree;
proto_item *ti;
guint opcode, opcode_tmp;
@ -378,7 +378,6 @@ static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree_add_item(eigrp_tree, hf_eigrp_version, tvb, 0, 1, FALSE);
proto_tree_add_item(eigrp_tree, hf_eigrp_opcode, tvb, 1, 1, FALSE);
proto_tree_add_item(eigrp_tree, hf_eigrp_checksum, tvb, 2, 2, FALSE);
/* Decode the EIGRP Flags Field */
ti = proto_tree_add_item(eigrp_tree, hf_eigrp_flags, tvb, 4, 4, FALSE);
@ -392,12 +391,14 @@ static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree_add_item(eigrp_tree, hf_eigrp_sequence, tvb, 8, 4, FALSE);
proto_tree_add_item(eigrp_tree, hf_eigrp_acknowledge, tvb, 12, 4, FALSE);
proto_tree_add_item(eigrp_tree, hf_eigrp_as, tvb, 16, 4, FALSE);
}
if (opcode == EIGRP_SAP) {
call_dissector(ipxsap_handle, tvb_new_subset(tvb, EIGRP_HEADER_LENGTH, -1, -1), pinfo, eigrp_tree);
return;
}
if (opcode == EIGRP_SAP) {
call_dissector(ipxsap_handle, tvb_new_subset(tvb, EIGRP_HEADER_LENGTH, -1, -1), pinfo, eigrp_tree);
return;
}
if (tree) {
while (tvb_reported_length_remaining(tvb, offset) > 0) {
tlv = tvb_get_ntohs(tvb, offset);

View File

@ -363,9 +363,6 @@ dissect_icmpv6ndopt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
guint32 no_of_pars;
guint32 i;
if (!tree)
return;
again:
if ((int)tvb_reported_length(tvb) <= offset)
return; /* No more options left */

View File

@ -148,8 +148,6 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str(message_code, message_code_vals,
TEXT_UNDEFINED));
if (!tree)
return;
ti = proto_tree_add_item(tree, proto_ipdc, tvb, 0, -1, FALSE);
ipdc_tree = proto_item_add_subtree(ti, ett_ipdc);

View File

@ -52,7 +52,7 @@ static void
dissect_jabber(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gboolean is_request;
proto_tree *jabber_tree;
proto_tree *jabber_tree = NULL;
proto_item *ti, *hidden_item;
gint offset = 0;
const guchar *line;
@ -100,10 +100,10 @@ dissect_jabber(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hf_jabber_response, tvb, 0, 0, TRUE);
}
PROTO_ITEM_SET_HIDDEN(hidden_item);
xmltvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(xml_handle, xmltvb, pinfo, jabber_tree);
}
xmltvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(xml_handle, xmltvb, pinfo, jabber_tree);
}
void

View File

@ -477,7 +477,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA");
if (tree) {
{
guint tree_offset = 0;
proto_item *jxta_tree_item =
proto_tree_add_protocol_format(tree, proto_jxta, tvb, offset, -1, "JXTA" );
@ -1609,7 +1609,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
}
/* Second (optional) pass : build the proto tree */
if (tree) {
{
guint tree_offset = 0;
proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, FALSE);
proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem);
@ -1867,7 +1867,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
}
/* Second (optional) pass : build the proto tree */
if (tree) {
{
guint tree_offset = 0;
proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, FALSE);
proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem);

View File

@ -601,7 +601,6 @@ static void process_control_avps(tvbuff_t *tvb,
guint32 bits;
guint16 firmware_rev;
if (l2tp_tree) {
while (index < length) { /* Process AVP's */
ver_len_hidden = tvb_get_ntohs(tvb, index);
avp_len = AVP_LENGTH(ver_len_hidden);
@ -1345,7 +1344,6 @@ static void process_control_avps(tvbuff_t *tvb,
index += avp_len;
}
}
}
/*

View File

@ -696,12 +696,14 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* reserved */
proto_tree_add_item(mip_tree, hf_mip_nattt_reserved, tvb, offset, 2, FALSE);
offset += 2;
/* encapsulated payload */
next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector(ip_handle, next_tvb, pinfo, mip_tree);
offset += tvb_reported_length_remaining(tvb, offset);
} /* if tree */
else {
offset += 4;
}
/* encapsulated payload */
next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector(ip_handle, next_tvb, pinfo, mip_tree);
offset += tvb_reported_length_remaining(tvb, offset);
break;
case REGISTRATION_REVOCATION:
if (check_col(pinfo->cinfo, COL_INFO))

View File

@ -208,7 +208,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 3; /* skip reserved stuff */
if (tree) {
if (tvb_reported_length_remaining(tvb, offset) > 0) {
tiopt = proto_tree_add_text(pim_tree, tvb, offset, -1,
"PIM parameters");
@ -469,7 +468,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
default:
break;
}
}
done:;
return offset+tvb_length_remaining(tvb, offset);

View File

@ -201,115 +201,116 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
format_text(line, linelen));
}
if (tree) {
ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1, FALSE);
pop_tree = proto_item_add_subtree(ti, ett_pop);
ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1, FALSE);
pop_tree = proto_item_add_subtree(ti, ett_pop);
if (is_continuation) {
if (is_continuation) {
if (pop_data_desegment) {
if (pop_data_desegment) {
if (!frame_data) {
if (!frame_data) {
data_val->msg_read_len += tvb_length(tvb);
data_val->msg_read_len += tvb_length(tvb);
frame_data = se_alloc(sizeof(struct pop_proto_data));
frame_data = se_alloc(sizeof(struct pop_proto_data));
frame_data->conversation_id = conversation->index;
frame_data->more_frags = data_val->msg_read_len < data_val->msg_tot_len;
frame_data->conversation_id = conversation->index;
frame_data->more_frags = data_val->msg_read_len < data_val->msg_tot_len;
p_add_proto_data(pinfo->fd, proto_pop, frame_data);
p_add_proto_data(pinfo->fd, proto_pop, frame_data);
}
frag_msg = fragment_add_seq_next(tvb, 0, pinfo,
frame_data->conversation_id,
pop_data_segment_table,
pop_data_reassembled_table,
tvb_length(tvb),
frame_data->more_frags);
next_tvb = process_reassembled_data(tvb, offset, pinfo,
"Reassembled DATA",
frag_msg, &pop_data_frag_items,
NULL, pop_tree);
if (next_tvb) {
if (imf_handle)
call_dissector(imf_handle, next_tvb, pinfo, tree);
if (data_val) {
/* we have read everything - reset */
data_val->msg_read_len = 0;
data_val->msg_tot_len = 0;
}
frag_msg = fragment_add_seq_next(tvb, 0, pinfo,
frame_data->conversation_id,
pop_data_segment_table,
pop_data_reassembled_table,
tvb_length(tvb),
frame_data->more_frags);
next_tvb = process_reassembled_data(tvb, offset, pinfo,
"Reassembled DATA",
frag_msg, &pop_data_frag_items,
NULL, pop_tree);
if (next_tvb) {
if (imf_handle)
call_dissector(imf_handle, next_tvb, pinfo, tree);
if (data_val) {
/* we have read everything - reset */
data_val->msg_read_len = 0;
data_val->msg_tot_len = 0;
}
pinfo->fragmented = FALSE;
} else {
pinfo->fragmented = TRUE;
}
pinfo->fragmented = FALSE;
} else {
/*
* Put the whole packet into the tree as data.
*/
call_dissector(data_handle,tvb, pinfo, pop_tree);
pinfo->fragmented = TRUE;
}
return;
} else {
/*
* Put the whole packet into the tree as data.
*/
call_dissector(data_handle,tvb, pinfo, pop_tree);
}
return;
}
/*
* Put the line into the protocol tree.
*/
ti = proto_tree_add_string_format(pop_tree,
(is_request) ?
hf_pop_request :
hf_pop_response,
tvb, offset,
next_offset - offset,
"", "%s",
tvb_format_text(tvb, offset, next_offset - offset));
reqresp_tree = proto_item_add_subtree(ti, ett_pop_reqresp);
/*
* Put the line into the protocol tree.
*/
ti = proto_tree_add_string_format(pop_tree,
(is_request) ?
hf_pop_request :
hf_pop_response,
tvb, offset,
next_offset - offset,
"", "%s",
tvb_format_text(tvb, offset, next_offset - offset));
reqresp_tree = proto_item_add_subtree(ti, ett_pop_reqresp);
/*
* Extract the first token, and, if there is a first
* token, add it as the request or reply code.
*/
tokenlen = get_token_len(line, line + linelen, &next_token);
if (tokenlen != 0) {
proto_tree_add_item(reqresp_tree,
(is_request) ?
hf_pop_request_command :
hf_pop_response_indicator,
tvb, offset, tokenlen, FALSE);
/*
* Extract the first token, and, if there is a first
* token, add it as the request or reply code.
*/
tokenlen = get_token_len(line, line + linelen, &next_token);
if (tokenlen != 0) {
proto_tree_add_item(reqresp_tree,
(is_request) ?
hf_pop_request_command :
hf_pop_response_indicator,
tvb, offset, tokenlen, FALSE);
if (data_val) {
if (is_request) {
/* see if this is RETR or TOP command */
if (g_ascii_strncasecmp(line, "RETR", 4) == 0 ||
g_ascii_strncasecmp(line, "TOP", 3) == 0)
/* the next response will tell us how many bytes */
data_val->msg_request = TRUE;
} else {
if (data_val->msg_request) {
/* this is a response to a RETR or TOP command */
if (data_val) {
if (is_request) {
/* see if this is RETR or TOP command */
if (g_ascii_strncasecmp(line, "RETR", 4) == 0 ||
g_ascii_strncasecmp(line, "TOP", 3) == 0)
/* the next response will tell us how many bytes */
data_val->msg_request = TRUE;
} else {
if (data_val->msg_request) {
/* this is a response to a RETR or TOP command */
if (g_ascii_strncasecmp(line, "+OK ", 4) == 0) {
/* the message will be sent - work out how many bytes */
data_val->msg_read_len = 0;
data_val->msg_tot_len = atoi(line + 4);
}
data_val->msg_request = FALSE;
if (g_ascii_strncasecmp(line, "+OK ", 4) == 0) {
/* the message will be sent - work out how many bytes */
data_val->msg_read_len = 0;
data_val->msg_tot_len = atoi(line + 4);
}
data_val->msg_request = FALSE;
}
}
offset += (gint) (next_token - line);
linelen -= (int) (next_token - line);
}
offset += (gint) (next_token - line);
linelen -= (int) (next_token - line);
}
if (tree) {
/*
* Add the rest of the first line as request or
* reply param/description.

View File

@ -259,7 +259,6 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
}
}
if (tree)
{
proto_item* item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, FALSE);

View File

@ -566,9 +566,6 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
msg_method_str, msg_class_str);
}
if (!tree)
return tvb_length(tvb);
ti = proto_tree_add_item(tree, proto_stun, tvb, 0, -1, FALSE);
stun_tree = proto_item_add_subtree(ti, ett_stun);

View File

@ -122,12 +122,13 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
{
proto_item *ti, *name_item;
proto_tree *turbocell_tree, *network_tree;
proto_tree *turbocell_tree = NULL, *network_tree;
tvbuff_t *next_tvb;
int i=0;
guint8 packet_type;
guint8 * str_name;
guint str_len;
gint remaining_length;
packet_type = tvb_get_guint8(tvb, 0);
@ -146,7 +147,6 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
if (tree) {
gint remaining_length;
ti = proto_tree_add_item(tree, proto_turbocell, tvb, 0, 20, FALSE);
turbocell_tree = proto_item_add_subtree(ti, ett_turbocell);
@ -171,6 +171,7 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item(turbocell_tree, hf_turbocell_unknown, tvb, 0x0E, 2, FALSE);
proto_tree_add_item(turbocell_tree, hf_turbocell_ip, tvb, 0x10, 4, FALSE);
}
remaining_length=tvb_length_remaining(tvb, 0x14);
@ -245,7 +246,6 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
}
}
}
}
/* Register the protocol with Wireshark */

View File

@ -95,9 +95,6 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo,
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "Channel Id 0x%x", channel_id);
if (!tree)
return tvb_length(tvb);
ti = proto_tree_add_item(tree, proto_turnchannel, tvb, 0, -1, FALSE);
turnchannel_tree = proto_item_add_subtree(ti, ett_turnchannel);

View File

@ -299,7 +299,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VCDU");
col_set_str(pinfo->cinfo, COL_INFO, "Virtual Channel Data Unit");
if (tree) {
{
/* build the smex header tree */
smex_header=proto_tree_add_text(tree, tvb, offset, SMEX_HEADER_LENGTH, "SMEX Header");
smex_tree=proto_item_add_subtree(smex_header, ett_smex);

View File

@ -48,7 +48,7 @@ dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dsaack_tree;
proto_tree *dsaack_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
@ -74,11 +74,11 @@ dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
FALSE);
proto_tree_add_item (dsaack_tree, hf_docsis_dsaack_response, tvb, 2, 1,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_tree);
}

View File

@ -45,7 +45,7 @@ dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dsareq_tree;
proto_tree *dsareq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
@ -67,10 +67,10 @@ dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (dsareq_tree, hf_docsis_dsareq_tranid, tvb, 0, 2,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_tree);
}

View File

@ -48,7 +48,7 @@ dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dsarsp_tree;
proto_tree *dsarsp_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
@ -75,10 +75,10 @@ dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (dsarsp_tree, hf_docsis_dsarsp_response, tvb, 2, 1,
FALSE);
/* Call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_tree);
}
/* Call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_tree);

View File

@ -48,7 +48,7 @@ dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dscack_tree;
proto_tree *dscack_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
@ -74,10 +74,10 @@ dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
FALSE);
proto_tree_add_item (dscack_tree, hf_docsis_dscack_response, tvb, 2, 1,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_tree);

View File

@ -45,7 +45,7 @@ dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dscreq_tree;
proto_tree *dscreq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
@ -68,10 +68,10 @@ dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (dscreq_tree, hf_docsis_dscreq_tranid, tvb, 0, 2,
FALSE);
/* Call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_tree);
}
/* Call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_tree);
}

View File

@ -48,7 +48,7 @@ dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dscrsp_tree;
proto_tree *dscrsp_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
@ -76,10 +76,10 @@ dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (dscrsp_tree, hf_docsis_dscrsp_response, tvb, 2, 1,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_tree);
}

View File

@ -48,7 +48,7 @@ dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *dsdreq_tree;
proto_tree *dsdreq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
@ -73,10 +73,10 @@ dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_sfid, tvb, 4, 4,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 8);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 8);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_tree);
}

View File

@ -48,7 +48,7 @@ dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *regack_tree;
proto_tree *regack_tree = NULL;
guint16 sid;
guint8 response;
tvbuff_t *next_tvb;
@ -74,10 +74,10 @@ dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (regack_tree, hf_docsis_regack_response, tvb, 2, 1,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_tree);
}

View File

@ -46,7 +46,7 @@ dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *regreq_tree;
proto_tree *regreq_tree = NULL;
guint16 sid;
tvbuff_t *next_tvb;
@ -67,10 +67,10 @@ dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
regreq_tree = proto_item_add_subtree (it, ett_docsis_regreq);
proto_tree_add_item (regreq_tree, hf_docsis_regreq_sid, tvb, 0, 2,
FALSE);
/* Call Dissector for Appendix C TlV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_tree);
}
/* Call Dissector for Appendix C TlV's */
next_tvb = tvb_new_subset_remaining (tvb, 2);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_tree);

View File

@ -52,7 +52,7 @@ dissect_regreqmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *regreqmp_tree;
proto_tree *regreqmp_tree = NULL;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_INFO, "REG-REQ-MP Message:");
@ -66,10 +66,10 @@ dissect_regreqmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_number_of_fragments, tvb, 2, 1, FALSE);
proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_fragment_sequence_number, tvb, 3, 1, FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 4);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreqmp_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 4);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreqmp_tree);
}

View File

@ -49,7 +49,7 @@ dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *regrsp_tree;
proto_tree *regrsp_tree = NULL;
guint16 sid;
guint8 response;
tvbuff_t *next_tvb;
@ -75,10 +75,10 @@ dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
FALSE);
proto_tree_add_item (regrsp_tree, hf_docsis_regrsp_response, tvb, 2, 1,
FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 3);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_tree);
}

View File

@ -54,7 +54,7 @@ static void
dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *regrspmp_tree;
proto_tree *regrspmp_tree = NULL;
tvbuff_t *next_tvb;
@ -72,10 +72,10 @@ dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_number_of_fragments, tvb, 3, 1, FALSE);
proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_fragment_sequence_number, tvb, 4, 1, FALSE);
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 5);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree);
}
/* Call Dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 5);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree);
}

View File

@ -1780,7 +1780,6 @@ dissect_tlv (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
total_len = tvb_reported_length_remaining (tvb, 0);
if (tree)
{
it =
proto_tree_add_protocol_format (tree, proto_docsis_tlv, tvb, 0,

View File

@ -45,7 +45,7 @@ dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *uccreq_tree;
proto_tree *uccreq_tree = NULL;
guint8 chid;
tvbuff_t *next_tvb;
@ -68,10 +68,10 @@ dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
proto_tree_add_item (uccreq_tree, hf_docsis_uccreq_upchid, tvb, 0, 1,
FALSE);
/* call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 1);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_tree);
}
/* call dissector for Appendix C TLV's */
next_tvb = tvb_new_subset_remaining (tvb, 1);
call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_tree);
}

View File

@ -1043,7 +1043,6 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
col_append_str(pinfo->cinfo, COL_INFO, szText);
}
if( tree )
{
ecat_eoe_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe);

View File

@ -195,7 +195,6 @@ void dissect_mac_mgmt_msg_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_item *message_item = NULL;
proto_tree *message_tree = NULL;
if (tree)
{ /* we are being asked for details */
/* Get the tvb reported length */
tvb_len = tvb_reported_length(tvb);

View File

@ -1474,7 +1474,6 @@ static void wimaxasncp_dissect_tlv_value(
}
if (tree)
{
proto_tree *eap_tree;
proto_item *item;