diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 1abf510e8c..bcfa58efb4 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -4843,6 +4843,12 @@ static int hf_BACnetRestartReason = -1; static int hf_bacapp_tag_IPV4 = -1; static int hf_bacapp_tag_IPV6 = -1; static int hf_bacapp_tag_PORT = -1; +static int hf_bacapp_tag_mac_address_broadcast = -1; +static int hf_bacapp_reserved_ashrea = -1; +static int hf_bacapp_unused_bits = -1; +static int hf_bacapp_bit = -1; +static int hf_bacapp_complete_bitstring = -1; + /* some more variables for segmented messages */ static int hf_msg_fragments = -1; static int hf_msg_fragment = -1; @@ -4866,6 +4872,7 @@ static gint ett_bacapp_value = -1; static expert_field ei_bacapp_bad_length = EI_INIT; static expert_field ei_bacapp_bad_tag = EI_INIT; +static expert_field ei_bacapp_opening_tag = EI_INIT; static gint32 propertyIdentifier = -1; static gint32 propertyArrayIndex = -1; @@ -5946,7 +5953,7 @@ fAddress(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) offset = fUnsignedTag(tvb, pinfo, tree, offset, "network-number"); offs = fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt); if (lvt == 0) { - proto_tree_add_text(tree, tvb, offset, offs, "MAC-address: broadcast"); + proto_tree_add_item(tree, hf_bacapp_tag_mac_address_broadcast, tvb, offset, offs, ENC_NA); offset += offs; } else offset = fMacAddress(tvb, pinfo, tree, offset, "MAC-address: ", lvt); @@ -6398,8 +6405,7 @@ fBitStringTagVS(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offse "%s(Bit String)", label); fTagHeaderTree(tvb, pinfo, subtree, start, &tag_no, &tag_info, &lvt); - proto_tree_add_text(subtree, tvb, offset, 1, - "Unused bits: %u", unused); + proto_tree_add_item(subtree, hf_bacapp_unused_bits, tvb, offset, 1, ENC_NA); memset(bf_arr, 0, 256); skip = 0; for (i = 0; i < numberOfBytes; i++) { @@ -6407,20 +6413,10 @@ fBitStringTagVS(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offse if (i == numberOfBytes-1) { skip = unused; } for (j = 0; j < 8-skip; j++) { if (src != NULL) { - if (tmp & (1 << (7 - j))) - proto_tree_add_text(subtree, tvb, - offset+i+1, 1, - "%s = TRUE", - val_to_str((guint) (i*8 +j), - src, - ASHRAE_Reserved_Fmt)); - else - proto_tree_add_text(subtree, tvb, - offset+i+1, 1, - "%s = FALSE", - val_to_str((guint) (i*8 +j), - src, - ASHRAE_Reserved_Fmt)); + proto_tree_add_boolean_format(subtree, hf_bacapp_bit, tvb, offset+i+1, 1, + (tmp & (1 << (7 - j))), "%s = %s", + val_to_str((guint) (i*8 +j), src, ASHRAE_Reserved_Fmt), + (tmp & (1 << (7 - j))) ? "TRUE" : "FALSE"); } else { bf_arr[MIN(255, (i*8)+j)] = tmp & (1 << (7 - j)) ? '1' : '0'; } @@ -6429,7 +6425,7 @@ fBitStringTagVS(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offse if (src == NULL) { bf_arr[MIN(255, numberOfBytes*8-unused)] = 0; - proto_tree_add_text(subtree, tvb, offset, lvt, "B'%s'", bf_arr); + proto_tree_add_bytes_format(subtree, hf_bacapp_complete_bitstring, tvb, offset, lvt, NULL, "B'%s'", bf_arr); } offset += lvt; @@ -6500,7 +6496,7 @@ fApplicationTypesEnumeratedSplit(tvbuff_t *tvb, packet_info *pinfo, proto_tree * case 13: /* reserved for ASHRAE */ case 14: case 15: - proto_tree_add_text(tree, tvb, offset, lvt+tag_len, "%s'reserved for ASHRAE'", label); + proto_tree_add_bytes_format(tree, hf_bacapp_reserved_ashrea, tvb, offset, lvt+tag_len, NULL, "%s'reserved for ASHRAE'", label); offset += lvt + tag_len; break; default: @@ -7039,8 +7035,7 @@ fPropertyValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset &tag_no, &tag_info, &lvt); } } else { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length(tvb) - offset, - "expected Opening Tag!"); + proto_tree_add_expert(tree, pinfo, &ei_bacapp_opening_tag, tvb, offset, -1); offset = tvb_reported_length(tvb); } @@ -11238,6 +11233,26 @@ proto_register_bacapp(void) { "Port", "bacapp.Port", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_bacapp_tag_mac_address_broadcast, + { "MAC-address: broadcast", "bacapp.mac_address_broadcast", + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } + }, + { &hf_bacapp_reserved_ashrea, + { "reserved for ASHRAE", "bacapp.reserved_ashrea", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL } + }, + { &hf_bacapp_unused_bits, + { "Unused bits", "bacapp.unused_bits", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_bacapp_bit, + { "bit", "bacapp.bit", + FT_BOOLEAN, 8, NULL, 0, NULL, HFILL } + }, + { &hf_bacapp_complete_bitstring, + { "Complete bitstring", "bacapp.complete_bitstring", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL } + }, {&hf_msg_fragments, {"Message fragments", "bacapp.fragments", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, @@ -11285,6 +11300,7 @@ proto_register_bacapp(void) static ei_register_info ei[] = { { &ei_bacapp_bad_length, { "bacapp.bad_length", PI_MALFORMED, PI_ERROR, "Wrong length indicated", EXPFILL }}, { &ei_bacapp_bad_tag, { "bacapp.bad_tag", PI_MALFORMED, PI_ERROR, "Wrong tag found", EXPFILL }}, + { &ei_bacapp_opening_tag, { "bacapp.bad_opening_tag", PI_MALFORMED, PI_ERROR, "Expected Opening Tag!", EXPFILL }}, }; expert_module_t* expert_bacapp; diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 9974b96236..0bfc1c8b46 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -189,6 +189,13 @@ static int hf_bssgp_pdu_data = -1; static int hf_bssgp_rrlp_apdu = -1; static int hf_bssgp_dtm_handover_command_data = -1; static int hf_bssgp_message_elements = -1; +static int hf_bssgp_spare = -1; +static int hf_bssgp_si = -1; +static int hf_bssgp_psi = -1; +static int hf_bssgp_peak_bit_rate = -1; +static int hf_bssgp_sys_info_type3_msg = -1; +static int hf_bssgp_trace_type_data = -1; +static int hf_bssgp_si_item = -1; /* Initialize the subtree pointers */ static gint ett_bssgp = -1; @@ -206,6 +213,12 @@ static expert_field ei_bssgp_extraneous_data = EI_INIT; static expert_field ei_bssgp_missing_mandatory_element = EI_INIT; static expert_field ei_bssgp_not_dissected_yet = EI_INIT; static expert_field ei_bssgp_erroneous_app_container = EI_INIT; +static expert_field ei_bssgp_si_item = EI_INIT; +static expert_field ei_bssgp_unknown_rim_app_id_data = EI_INIT; +static expert_field ei_bssgp_unknown_app_container = EI_INIT; +static expert_field ei_bssgp_ra_discriminator = EI_INIT; +static expert_field ei_bssgp_unknown_rim_app_id = EI_INIT; +static expert_field ei_bssgp_msg_type = EI_INIT; /* PDU type coding, v6.5.0, table 11.3.26, p 80 */ #define BSSGP_PDU_DL_UNITDATA 0x00 @@ -591,7 +604,7 @@ de_bssgp_aligment_octets(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ curr_offset = offset; - proto_tree_add_text(tree, tvb, curr_offset, len, "%u Spare octet(s)",len); + proto_tree_add_item(tree, hf_bssgp_spare, tvb, curr_offset, len, ENC_NA); return(len); } @@ -1117,7 +1130,7 @@ static const value_string bssgp_precedence_dl[] = { static guint16 de_bssgp_qos_profile(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - proto_item *pi, *pre_item; + proto_item *pre_item; guint32 curr_offset; guint16 peak_bit_rate; guint8 rate_gran, precedence; @@ -1131,27 +1144,30 @@ de_bssgp_qos_profile(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3 link_dir = pinfo->link_dir; peak_bit_rate = tvb_get_ntohs(tvb, curr_offset); - pi = proto_tree_add_text(tree, tvb, curr_offset, 1, "Peak bit rate: "); if (peak_bit_rate == 0) { - proto_item_append_text(pi, "Best effort"); + proto_tree_add_uint_format_value(tree, hf_bssgp_peak_bit_rate, tvb, curr_offset, 2, peak_bit_rate, "Best effort"); }else{ rate_gran = tvb_get_guint8(tvb, curr_offset+2)&0xc0; switch(rate_gran){ case 0: /* 100 bits/s increments */ - proto_item_append_text(pi, "%u bits/s", peak_bit_rate * 100); + proto_tree_add_uint_format_value(tree, hf_bssgp_peak_bit_rate, tvb, curr_offset, 2, peak_bit_rate, + "%u bits/s", peak_bit_rate * 100); break; case 1: /* 1000 bits/s increments */ - proto_item_append_text(pi, "%u kbits/s", peak_bit_rate); + proto_tree_add_uint_format_value(tree, hf_bssgp_peak_bit_rate, tvb, curr_offset, 2, peak_bit_rate, + "%u kbits/s", peak_bit_rate); break; case 2: /* 10000 bits/s increments */ - proto_item_append_text(pi, "%u kbits/s", peak_bit_rate * 10); + proto_tree_add_uint_format_value(tree, hf_bssgp_peak_bit_rate, tvb, curr_offset, 2, peak_bit_rate, + "%u kbits/s", peak_bit_rate * 10); break; case 3: /* 100000 bits/s increments */ - proto_item_append_text(pi, "%u kbits/s", peak_bit_rate * 100); + proto_tree_add_uint_format_value(tree, hf_bssgp_peak_bit_rate, tvb, curr_offset, 2, peak_bit_rate, + "%u kbits/s", peak_bit_rate * 100); break; default: break; @@ -1333,12 +1349,9 @@ de_bssgp_trace_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static guint16 de_bssgp_trace_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - guint32 curr_offset; + guint32 curr_offset = offset; - curr_offset = offset; - - - proto_tree_add_text(tree, tvb, curr_offset, len, "Trace Type data ( Coding unknown (Specification withdrawn) 3GPP TS 32.008)"); + proto_tree_add_item(tree, hf_bssgp_trace_type_data, tvb, curr_offset, len, ENC_NA); return(len); } @@ -1783,7 +1796,7 @@ de_bssgp_ran_information_request_app_cont(tvbuff_t *tvb, proto_tree *tree, packe curr_offset = curr_offset + dissect_ranap_SourceCellID_PDU(new_tvb, pinfo, tree, NULL); break; default : - proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown RIM Application Identity"); + proto_tree_add_expert(tree, pinfo, &ei_bssgp_unknown_rim_app_id, tvb, curr_offset, len); curr_offset+=len; break; } @@ -1850,17 +1863,17 @@ de_bssgp_ran_information_app_cont_unit(tvbuff_t *tvb, proto_tree *tree, packet_i gint ett_tree; int hf_idx; const gchar *msg_str; - proto_item *si_item; + proto_item *si_item, *si_item2; proto_tree *si_tree; for (i=0; i < num_items; i++){ oct = tvb_get_guint8(tvb,curr_offset); get_rr_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p); - proto_tree_add_text(tree, tvb, curr_offset, 21, "SI item %u ",i+1); + si_item2 = proto_tree_add_bytes_format(tree, hf_bssgp_si_item, tvb, curr_offset, 21, NULL, "SI item %u ",i+1); si_item = proto_tree_add_item(tree, hf_idx, tvb, curr_offset, 1, ENC_BIG_ENDIAN); si_tree = proto_item_add_subtree(si_item, ett_tree); if (msg_fcn_p == NULL){ - proto_tree_add_text(si_tree, tvb, curr_offset, 21, "Unknown SI message"); + expert_add_info(pinfo, si_item2, &ei_bssgp_si_item); }else{ (*msg_fcn_p)(tvb, si_tree, pinfo, curr_offset+1, 20); } @@ -1881,7 +1894,7 @@ de_bssgp_ran_information_app_cont_unit(tvbuff_t *tvb, proto_tree *tree, packet_i * The message is 21 octets long. * dtap_rr_sys_info_3(tvb, tree, curr_offset, len-7) */ - proto_tree_add_text(tree, tvb, curr_offset, 1, "SYSTEM INFORMATION type 3 message"); + proto_tree_add_item(tree, hf_bssgp_sys_info_type3_msg, tvb, curr_offset, 1, ENC_NA); curr_offset++; break; case 3: @@ -1940,7 +1953,7 @@ de_bssgp_ran_information_app_cont_unit(tvbuff_t *tvb, proto_tree *tree, packet_i break; default : - proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown RIM Application Identitys Data"); + proto_tree_add_expert(tree, pinfo, &ei_bssgp_unknown_rim_app_id_data, tvb, curr_offset, len); curr_offset+=len; break; } @@ -2043,7 +2056,7 @@ de_bssgp_ran_app_error_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, proto_tree_add_item(tree, hf_bssgp_utra_si_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN); break; default : - proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown Application Error Container"); + proto_tree_add_expert(tree, pinfo, &ei_bssgp_unknown_app_container, tvb, curr_offset, len); break; } return(len); @@ -2228,6 +2241,7 @@ de_bssgp_rim_routing_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu guint16 rnc_id; tvbuff_t *new_tvb = NULL; guint32 curr_offset; + proto_item* ti; curr_offset = offset; @@ -2237,7 +2251,7 @@ de_bssgp_rim_routing_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu /* RIM Routing Address discriminator */ oct = tvb_get_guint8(tvb,curr_offset); - proto_tree_add_item(tree, hf_bssgp_ra_discriminator, tvb, curr_offset, 1, ENC_BIG_ENDIAN); + ti = proto_tree_add_item(tree, hf_bssgp_ra_discriminator, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; switch(oct){ case 0: @@ -2274,7 +2288,7 @@ de_bssgp_rim_routing_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu dissect_s1ap_Global_ENB_ID_PDU(new_tvb, pinfo, tree, NULL); break; default: - proto_tree_add_text(tree, tvb, curr_offset, 3, "Unknown RIM Routing Address discriminator"); + expert_add_info(pinfo, ti, &ei_bssgp_ra_discriminator); return len; } @@ -2912,8 +2926,7 @@ de_bssgp_sipsi_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ oct = tvb_get_guint8(tvb, curr_offset); num = oct >>1; type = oct & 1; - proto_tree_add_text(tree, tvb, curr_offset, 1, - "Number of SI/PSI: %u",num); + proto_tree_add_item(tree, hf_bssgp_num_si_psi, tvb, curr_offset, 1, ENC_NA); /* Type */ proto_tree_add_item(tree, hf_bssgp_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN); @@ -2921,13 +2934,13 @@ de_bssgp_sipsi_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ if (type==0){ /* BCCH (3GPP TS 44.018) */ for (i = 0; i < num; i++) { - proto_tree_add_text(tree, tvb, curr_offset, 21, "SI (%u)", i + 1); + proto_tree_add_bytes_format(tree, hf_bssgp_si, tvb, curr_offset, 21, NULL, "SI (%u)", i + 1); curr_offset+=21; } }else{ /* PBCCH (3GPP TS 44.060) */ for (i = 0; i < num; i++) { - proto_tree_add_text(tree, tvb, curr_offset, 22, "PSI (%u)", i + 1); + proto_tree_add_bytes_format(tree, hf_bssgp_psi, tvb, curr_offset, 22, NULL, "PSI (%u)", i + 1); curr_offset+=22; } } @@ -3238,7 +3251,7 @@ de_bssgp_redir_attempt_flg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _ curr_offset = offset; - proto_tree_add_text(tree, tvb, curr_offset, 1,"Spare"); + proto_tree_add_item(tree, hf_bssgp_spare, tvb, curr_offset, 1, ENC_NA); curr_offset += 1; return(curr_offset-offset); @@ -6394,10 +6407,8 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_pdu_type = tvb_get_guint8(tvb,offset); - if (tree) { - ti = proto_tree_add_item(tree, proto_bssgp, tvb, 0, -1, ENC_NA); - bssgp_tree = proto_item_add_subtree(ti, ett_bssgp); - } + ti = proto_tree_add_item(tree, proto_bssgp, tvb, 0, -1, ENC_NA); + bssgp_tree = proto_item_add_subtree(ti, ett_bssgp); /* Messge type IE*/ msg_fcn_p = NULL; @@ -6410,7 +6421,7 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(msg_str){ col_add_fstr(pinfo->cinfo, COL_INFO, "%s", msg_str); }else{ - proto_tree_add_text(bssgp_tree, tvb, offset, 1,"Unknown message 0x%x",g_pdu_type); + expert_add_info_format(pinfo, ti, &ei_bssgp_msg_type, "Unknown message 0x%x", g_pdu_type); return; } @@ -6941,6 +6952,41 @@ proto_register_bssgp(void) { "Message Elements", "bssgp.message_elements", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, + + { &hf_bssgp_spare, + { "Spare octet(s)", "bssgp.spare", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_si, + { "SI", "bssgp.si", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_psi, + { "PSI", "bssgp.psi", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_peak_bit_rate, + { "Peak bit rate", "bssgp.peak_bit_rate", + FT_UINT16, BASE_DEC, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_sys_info_type3_msg, + { "SYSTEM INFORMATION type 3 message", "bssgp.sys_info_type3_msg", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_trace_type_data, + { "Trace Type data ( Coding unknown (Specification withdrawn) 3GPP TS 32.008)", "bssgp.trace_type_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_bssgp_si_item, + { "SI item", "bssgp.si_item", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, }; /* Setup protocol subtree array */ @@ -6954,6 +7000,12 @@ proto_register_bssgp(void) { &ei_bssgp_missing_mandatory_element, { "bssgp.missing_mandatory_element", PI_PROTOCOL, PI_WARN, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }}, { &ei_bssgp_not_dissected_yet, { "bssgp.not_dissected_yet", PI_UNDECODED, PI_WARN, "Not dissected yet", EXPFILL }}, { &ei_bssgp_erroneous_app_container, { "bssgp.erroneous_app_container", PI_PROTOCOL, PI_WARN, "Erroneous Application Container including IEI and LI", EXPFILL }}, + { &ei_bssgp_si_item, { "bssgp.erroneous_app_container", PI_PROTOCOL, PI_WARN, "Unknown SI message", EXPFILL }}, + { &ei_bssgp_unknown_rim_app_id_data, { "bssgp.rim_app_id_data.unknown", PI_PROTOCOL, PI_WARN, "Unknown RIM Application Identitys Data", EXPFILL }}, + { &ei_bssgp_unknown_app_container, { "bssgp.unknown_app_container", PI_PROTOCOL, PI_WARN, "Unknown Application Error Container", EXPFILL }}, + { &ei_bssgp_ra_discriminator, { "bssgp.ra_discriminator.unknown", PI_PROTOCOL, PI_WARN, "Unknown RIM Routing Address discriminator", EXPFILL }}, + { &ei_bssgp_unknown_rim_app_id, { "bssgp.rim_app_id.unknown", PI_PROTOCOL, PI_WARN, "Unknown RIM Application Identity", EXPFILL }}, + { &ei_bssgp_msg_type, { "bssgp.msg_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown message", EXPFILL }}, }; expert_module_t* expert_bssgp; diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c index 04e042f3ce..9c7210bd19 100644 --- a/epan/dissectors/packet-rlc.c +++ b/epan/dissectors/packet-rlc.c @@ -43,10 +43,6 @@ * - use sub_num in fragment identification? */ -#define DEBUG_FRAME(number, msg) {if (pinfo->fd->num == number) printf("%u: %s\n", number, msg);} - -#define ROL16(a,b) (guint16)((a<>(16-b))) - void proto_register_rlc(void); void proto_reg_handoff_rlc(void); @@ -119,6 +115,9 @@ static int hf_rlc_channel = -1; static int hf_rlc_channel_rbid = -1; static int hf_rlc_channel_dir = -1; static int hf_rlc_channel_ueid = -1; +static int hf_rlc_sequence_number = -1; +static int hf_rlc_length = -1; +static int hf_rlc_bitmap_string = -1; /* subtrees */ static int ett_rlc = -1; @@ -148,6 +147,7 @@ static expert_field ei_rlc_li_too_many = EI_INIT; static expert_field ei_rlc_header_only = EI_INIT; static expert_field ei_rlc_ciphered_data = EI_INIT; static expert_field ei_rlc_no_per_frame_data = EI_INIT; +static expert_field ei_rlc_incomplete_sequence = EI_INIT; static dissector_handle_t ip_handle; static dissector_handle_t rrc_handle; @@ -1211,19 +1211,16 @@ get_reassembled_data(enum rlc_mode mode, tvbuff_t *tvb, packet_info *pinfo, if (!rlc_frag_equal(&lookup, sdu->reassembled_in)) return NULL; #endif - if (tree) { - frag = sdu->frags; - while (frag->next) { - if (frag->next->seq - frag->seq > 1) { - proto_item *pi = proto_tree_add_text(tree, tvb, 0, 0, - "Error: Incomplete sequence"); - PROTO_ITEM_SET_GENERATED(pi); - tree_add_fragment_list_incomplete(sdu, tvb, tree); - return NULL; - } - frag = frag->next; + frag = sdu->frags; + while (frag->next) { + if (frag->next->seq - frag->seq > 1) { + proto_tree_add_expert(tree, pinfo, &ei_rlc_incomplete_sequence, tvb, 0, 0); + tree_add_fragment_list_incomplete(sdu, tvb, tree); + return NULL; } + frag = frag->next; } + sdu->tvb = tvb_new_child_real_data(tvb, sdu->data, sdu->len, sdu->len); add_new_data_source(pinfo, sdu->tvb, "Reassembled RLC Message"); @@ -1854,8 +1851,7 @@ dissect_rlc_um(enum rlc_channel_type channel, tvbuff_t *tvb, packet_info *pinfo, } if (!fpinf || !rlcinf) { - proto_tree_add_text(tree, tvb, 0, -1, - "Cannot dissect RLC frame because per-frame info is missing"); + proto_tree_add_expert(tree, pinfo, &ei_rlc_no_per_frame_data, tvb, 0, -1); return; } @@ -2004,7 +2000,7 @@ dissect_rlc_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guin j += g_snprintf(&buff[j], BUFF_SIZE-j, " ,"); } } - proto_tree_add_text(bitmap_tree, tvb, bit_offset/8, 1, "%s", buff); + proto_tree_add_string_format(bitmap_tree, hf_rlc_bitmap_string, tvb, bit_offset/8, 1, buff, "%s", buff); bit_offset += 8; } proto_item_append_text(ti, " (%u SNs)", number_of_bitmap_entries); @@ -2030,8 +2026,7 @@ dissect_rlc_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guin expert_add_info(pinfo, tree, &ei_rlc_sufi_cw); } else { rlist_tree = proto_tree_add_subtree(sufi_tree, tvb, previous_bit_offset/8, (bit_offset-previous_bit_offset)/8, ett_rlc_rlist, NULL, "Decoded list:"); - proto_tree_add_text(rlist_tree, tvb, (previous_bit_offset+4)/8, 12/8, - "Sequence Number = %u (AMD PDU not correctly received)",(unsigned)sn); + proto_tree_add_uint_format_value(rlist_tree, hf_rlc_sequence_number, tvb, (previous_bit_offset+4)/8, 12/8, (guint32)sn, "%u (AMD PDU not correctly received)", (unsigned)sn); col_append_fstr(pinfo->cinfo, COL_INFO, " RLIST=(%u", (unsigned)sn); for (i=0, isErrorBurstInd=FALSE, j=0, previous_sn=(guint16)sn, value=0; icinfo, COL_INFO, " ->%u", previous_sn); @@ -2051,7 +2046,7 @@ dissect_rlc_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guin isErrorBurstInd = FALSE; } else { value = (value + previous_sn) & 0xfff; - proto_tree_add_text(rlist_tree, tvb, (previous_bit_offset+16+4*i)/8, 1, "Sequence Number = %u (AMD PDU not correctly received)",value); + proto_tree_add_uint_format_value(rlist_tree, hf_rlc_sequence_number, tvb, (previous_bit_offset+16+4*i)/8, 1, value, "%u (AMD PDU not correctly received)",value); col_append_fstr(pinfo->cinfo, COL_INFO, " %u", value); previous_sn = value; } @@ -2889,8 +2884,21 @@ proto_register_rlc(void) { &hf_rlc_channel_ueid, { "User Equipment ID", "rlc.channel.ueid", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - } + }, + { &hf_rlc_sequence_number, + { "Sequence Number", "rlc.sequence_number", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rlc_length, + { "Length", "rlc.length", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rlc_bitmap_string, + { "Bitmap string", "rlc.bitmap_string", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } + }, }; + static gint *ett[] = { &ett_rlc, &ett_rlc_frag, @@ -2920,6 +2928,7 @@ proto_register_rlc(void) { &ei_rlc_he, { "rlc.he.invalid", PI_PROTOCOL, PI_WARN, "Incorrect HE value", EXPFILL }}, { &ei_rlc_ciphered_data, { "rlc.ciphered_data", PI_UNDECODED, PI_WARN, "Cannot dissect RLC frame because it is ciphered", EXPFILL }}, { &ei_rlc_no_per_frame_data, { "rlc.no_per_frame_data", PI_PROTOCOL, PI_WARN, "Can't dissect RLC frame because no per-frame info was attached!", EXPFILL }}, + { &ei_rlc_incomplete_sequence, { "rlc.incomplete_sequence", PI_MALFORMED, PI_ERROR, "Error: Incomplete sequence", EXPFILL }}, }; proto_rlc = proto_register_protocol("Radio Link Control", "RLC", "rlc");