static guint dissect_nack_data(proto_tree *tree, tvbuff_t *tvb, guint offset, packet_info *pinfo) { proto_item *ti, *tif; proto_tree *nack_tree, *flag_tree; guint16 len; ti = proto_tree_add_text(tree, tvb, offset, -1, "NACK Data"); nack_tree = proto_item_add_subtree(ti, ett_nackdata); proto_tree_add_item(nack_tree, hf_nack_form, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; tif = proto_tree_add_item(nack_tree, hf_nack_flags, tvb, offset, 1, ENC_BIG_ENDIAN); flag_tree = proto_item_add_subtree(tif, ett_flags); proto_tree_add_item(flag_tree, hf_nack_flags_segment, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_block, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_info, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_object, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; len = tvb_get_ntohs(tvb, offset); proto_tree_add_item(nack_tree, hf_nack_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_item_set_len(ti, 4+len); if (len > 4) { dissect_feccode(nack_tree, tvb, offset, pinfo, 1); } offset += len; return offset; }
/* code to dissect NORM cmd(flush) packets */ static guint dissect_norm_cmd_flush(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint8 hlen) { offset = dissect_feccode(tree, tvb, offset, pinfo, 0); if (offset < hdrlen2bytes(hlen)) { offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen); } return offset; }
/* code to dissect NORM cmd(squelch) packets */ static guint dissect_norm_cmd_squelch(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset) { offset = dissect_feccode(tree, tvb, offset, pinfo, 0); while (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_item(tree, hf_cc_transport_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 2; } return offset; }
/* code to dissect NORM data packets */ static void dissect_norm_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint8 hlen) { guint8 flags; proto_item *ti; proto_tree *flag_tree; offset = dissect_grrtetc(tree, tvb, offset); ti = proto_tree_add_item(tree, hf_flags, tvb, offset, 1, ENC_BIG_ENDIAN); flags = tvb_get_guint8(tvb, offset); flag_tree = proto_item_add_subtree(ti, ett_flags); proto_tree_add_item(flag_tree, hf_flag_repair, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_norm_explicit, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_info, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_unreliable, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_file, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_stream, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_flag_msgstart, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; offset = dissect_feccode(tree, tvb, offset, pinfo, 0); if (offset < hdrlen2bytes(hlen)) { offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen); } if (flags & NORM_FLAG_STREAM) { flag_tree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_streampayload, NULL, "Stream Data"); proto_tree_add_item(flag_tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(flag_tree, hf_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(flag_tree, hf_payload_offset, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } if (tvb_reported_length_remaining(tvb, offset) > 0) proto_tree_add_item(tree, hf_payload, tvb, offset, -1, ENC_NA); }