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:
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
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");
/* 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 */
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 );
-
- /* 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 )
- {
- 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;
-
-
- 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 );
+ 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;
+
+
+ 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 );
+
}
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;
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);
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);
guint32 no_of_pars;
guint32 i;
- if (!tree)
- return;
-
again:
if ((int)tvb_reported_length(tvb) <= offset)
return; /* No more options left */
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);
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;
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
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" );
}
/* 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);
}
/* 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);
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);
index += avp_len;
}
- }
}
/*
/* 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))
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");
default:
break;
}
- }
done:;
return offset+tvb_length_remaining(tvb, offset);
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);
+ 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);
+ next_tvb = process_reassembled_data(tvb, offset, pinfo,
+ "Reassembled DATA",
+ frag_msg, &pop_data_frag_items,
+ NULL, pop_tree);
- if (next_tvb) {
+ if (next_tvb) {
- if (imf_handle)
- call_dissector(imf_handle, next_tvb, pinfo, tree);
+ 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;
+ if (data_val) {
+ /* we have read everything - reset */
+
+ data_val->msg_read_len = 0;
+ data_val->msg_tot_len = 0;
}
-
+ 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);
-
- 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;
+ /*
+ * 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 (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.
}
}
- if (tree)
{
proto_item* item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, FALSE);
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);
{
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);
}
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);
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);
}
}
}
- }
}
/* Register the protocol with Wireshark */
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);
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);
{
proto_item *it;
- proto_tree *dsaack_tree;
+ proto_tree *dsaack_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *dsareq_tree;
+ proto_tree *dsareq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *dsarsp_tree;
+ proto_tree *dsarsp_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
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);
{
proto_item *it;
- proto_tree *dscack_tree;
+ proto_tree *dscack_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
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);
{
proto_item *it;
- proto_tree *dscreq_tree;
+ proto_tree *dscreq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *dscrsp_tree;
+ proto_tree *dscrsp_tree = NULL;
guint16 transid;
guint8 response;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *dsdreq_tree;
+ proto_tree *dsdreq_tree = NULL;
guint16 transid;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *regack_tree;
+ proto_tree *regack_tree = NULL;
guint16 sid;
guint8 response;
tvbuff_t *next_tvb;
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);
}
{
proto_item *it;
- proto_tree *regreq_tree;
+ proto_tree *regreq_tree = NULL;
guint16 sid;
tvbuff_t *next_tvb;
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);
{
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:");
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);
}
{
proto_item *it;
- proto_tree *regrsp_tree;
+ proto_tree *regrsp_tree = NULL;
guint16 sid;
guint8 response;
tvbuff_t *next_tvb;
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);
}
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;
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);
}
total_len = tvb_reported_length_remaining (tvb, 0);
- if (tree)
{
it =
proto_tree_add_protocol_format (tree, proto_docsis_tlv, tvb, 0,
{
proto_item *it;
- proto_tree *uccreq_tree;
+ proto_tree *uccreq_tree = NULL;
guint8 chid;
tvbuff_t *next_tvb;
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);
}
col_append_str(pinfo->cinfo, COL_INFO, szText);
}
- if( tree )
{
ecat_eoe_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe);
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);
}
- if (tree)
{
proto_tree *eap_tree;
proto_item *item;