From 9611e751aed1b1358d4f7028572004af11878469 Mon Sep 17 00:00:00 2001 From: AndersBroman Date: Thu, 20 Nov 2014 16:07:55 +0100 Subject: Replace tvb_length...() calls. Change-Id: Idda7cd56a12b36d18774a1fe324c69eb8f5e4330 Reviewed-on: https://code.wireshark.org/review/5412 Reviewed-by: Anders Broman --- epan/dissectors/packet-bssgp.c | 2 +- epan/dissectors/packet-dpnss-link.c | 2 +- epan/dissectors/packet-dpnss.c | 8 ++++---- epan/dissectors/packet-gsm_a_rr.c | 40 ++++++++++++++++++------------------- epan/dissectors/packet-gsm_bsslap.c | 18 ++++++++--------- epan/dissectors/packet-gsm_rlcmac.c | 20 +++++++++---------- epan/dissectors/packet-l2tp.c | 8 ++++---- epan/dissectors/packet-lapd.c | 8 ++++---- epan/dissectors/packet-lapdm.c | 4 ++-- 9 files changed, 55 insertions(+), 55 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 653ef8acb9..259a3d63bf 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -6395,7 +6395,7 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Save pinfo */ g_rim_application_identity = 0; gparent_tree = tree; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); col_set_str(pinfo->cinfo, COL_PROTOCOL, "BSSGP"); diff --git a/epan/dissectors/packet-dpnss-link.c b/epan/dissectors/packet-dpnss-link.c index 048f35e0dd..55746d4885 100644 --- a/epan/dissectors/packet-dpnss-link.c +++ b/epan/dissectors/packet-dpnss-link.c @@ -141,7 +141,7 @@ dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (octet){ case FRAME_TYPE_UI_EVEN: case FRAME_TYPE_UI_ODD: - protocol_data_length=tvb_length(tvb)-LINK_HEADER_SIZE; + protocol_data_length=tvb_reported_length(tvb)-LINK_HEADER_SIZE; protocol_data_tvb=tvb_new_subset_length(tvb, LINK_HEADER_SIZE, protocol_data_length); if (dpnss_handle && protocol_data_length>0) { diff --git a/epan/dissectors/packet-dpnss.c b/epan/dissectors/packet-dpnss.c index f7c8ec6983..8fa810190e 100644 --- a/epan/dissectors/packet-dpnss.c +++ b/epan/dissectors/packet-dpnss.c @@ -1087,7 +1087,7 @@ dissect_dpnss_sup_info_str(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr gboolean last_string = FALSE; gboolean has_par; - tvb_end_offset = tvb_length(tvb); + tvb_end_offset = tvb_reported_length(tvb); str_no = 1; while ((offset 0) + if(tvb_reported_length_remaining(tvb,curr_offset) > 0) ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IA_REST_OCT, NULL); } @@ -9452,7 +9452,7 @@ dtap_rr_imm_ass_ext(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui /* 7C Starting Time 10.5.2.38 O TV 3 */ ELEM_OPT_TV(0x7C,GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL); /* IAX Rest Octets 10.5.2.18 M V 0-4 */ - if(tvb_length_remaining(tvb,curr_offset) > 0) + if(tvb_reported_length_remaining(tvb,curr_offset) > 0) ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IAX_REST_OCT, NULL); } @@ -9491,7 +9491,7 @@ dtap_rr_imm_ass_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui /* Wait Indication 4 Wait Indication 10.5.2.43 M V 1 */ ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_WAIT_IND, " - Wait Indication 4"); /* IAR Rest Octets 10.5.2.19 M V 3 */ - if(tvb_length_remaining(tvb,curr_offset) > 0) + if(tvb_reported_length_remaining(tvb,curr_offset) > 0) ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IAR_REST_OCT, NULL); } @@ -10090,7 +10090,7 @@ sacch_rr_meas_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint32 curr_offset; gint bit_offset, bit_offset_sav, bit_offset_sav2; guint8 value, idx; - guint8 tvb_len = tvb_length(tvb); + guint8 tvb_len = tvb_reported_length(tvb); guint16 bit_len = tvb_len << 3; curr_offset = offset; @@ -10440,7 +10440,7 @@ sacch_rr_enh_meas_report(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ proto_item *item; guint32 curr_offset; guint bit_offset, bit_offset_sav; - guint8 tvb_len = tvb_length(tvb); + guint8 tvb_len = tvb_reported_length(tvb); guint16 bit_len = tvb_len << 3; guint8 idx; @@ -10686,7 +10686,7 @@ dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int hf_idx; gboolean nsd; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); if (len < 3){ /* @@ -10898,7 +10898,7 @@ dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint ett_tree; int hf_idx; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); col_append_str(pinfo->cinfo, COL_INFO, "(SACCH) "); diff --git a/epan/dissectors/packet-gsm_bsslap.c b/epan/dissectors/packet-gsm_bsslap.c index 2b0235be8f..535cd54fac 100644 --- a/epan/dissectors/packet-gsm_bsslap.c +++ b/epan/dissectors/packet-gsm_bsslap.c @@ -562,7 +562,7 @@ dissect_gsm_bsslap_ta_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, i guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Cell Identity IE / 5.4 M TV 3 */ ELEM_MAND_TV(BSSLAP_PARAM_CELL_IDENTITY, GSM_A_PDU_TYPE_COMMON, DE_CELL_ID, "Serving Cell Identity"); @@ -591,7 +591,7 @@ dissect_gsm_bsslap_reject(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, i guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Cause IE / 5.14 M TV 2 */ ELEM_MAND_TV(BSSLAP_PARAM_CAUSE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CAUSE,NULL); @@ -608,7 +608,7 @@ dissect_gsm_bsslap_reset(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, in guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Cell Identity IE / 5.4 M TV 3 */ ELEM_MAND_TV(BSSLAP_PARAM_CELL_IDENTITY, GSM_A_PDU_TYPE_COMMON, DE_CELL_ID, NULL); @@ -656,7 +656,7 @@ dissect_gsm_bsslap_abort(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, in guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Cause IE / 5.14 M TV 2 */ ELEM_MAND_TV(BSSLAP_PARAM_CAUSE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CAUSE,NULL); @@ -672,7 +672,7 @@ dissect_gsm_bsslap_ta_layer3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Timing Advance IE / 5.2 M TV 2 */ ELEM_MAND_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL); @@ -693,7 +693,7 @@ dissect_gsm_bsslap_ms_pos_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinf guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* RRLP flag IE / 5.15 M TV 2 */ ELEM_MAND_TV(BSSLAP_PARAM_RRLP_FLAG, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_FLG,"flag"); @@ -710,7 +710,7 @@ dissect_gsm_bsslap_ms_pos_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinf guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* flag RRLP flag IE / 5.15 M TV 2 */ ELEM_MAND_TV(BSSLAP_PARAM_RRLP_FLAG, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_FLG,"flag"); @@ -735,7 +735,7 @@ dissect_gsm_bsslap_u_tdoa_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinf guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Delta Timer IE 5.22 O (note 1) TV 2 */ ELEM_OPT_TV(BSSLAP_PARAM_DELTA_TIMER, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_DELTA_TIME, NULL); @@ -753,7 +753,7 @@ dissect_gsm_bsslap_u_tdoa_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinf guint curr_len; curr_offset = offset; - curr_len = tvb_length_remaining(tvb,offset); + curr_len = tvb_reported_length_remaining(tvb,offset); /* Channel Description IE 5.8 M TV 4 */ ELEM_MAND_TV(BSSLAP_PARAM_CHANNEL_DESCRIPTION,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, NULL); diff --git a/epan/dissectors/packet-gsm_rlcmac.c b/epan/dissectors/packet-gsm_rlcmac.c index bc9579669c..f1b9460704 100644 --- a/epan/dissectors/packet-gsm_rlcmac.c +++ b/epan/dissectors/packet-gsm_rlcmac.c @@ -7401,7 +7401,7 @@ dissect_dl_gprs_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, RlcMa proto_tree *rlcmac_tree = NULL; csnStream_t ar; gint bit_offset = 0; - guint16 bit_length = tvb_length(tvb) * 8; + guint16 bit_length = tvb_reported_length(tvb) * 8; guint8 payload_type = tvb_get_bits8(tvb, 0, 2); guint8 rbsn = tvb_get_bits8(tvb, 8, 1); @@ -7542,7 +7542,7 @@ dissect_egprs_dl_header_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree *rlcmac_tree; csnStream_t ar; - guint16 bit_length = tvb_length(tvb) * 8; + guint16 bit_length = tvb_reported_length(tvb) * 8; col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM RLC/MAC"); col_append_sep_str(pinfo->cinfo, COL_INFO, ":", "EGPRS DL:HEADER"); @@ -7587,7 +7587,7 @@ dissect_ul_pacch_access_burst(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item *ti; proto_tree *rlcmac_tree; csnStream_t ar; - guint16 bit_length = tvb_length(tvb) * 8; + guint16 bit_length = tvb_reported_length(tvb) * 8; col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM RLC/MAC"); col_append_sep_str(pinfo->cinfo, COL_INFO, ":", "PACCH ACCESS BURST"); @@ -7628,7 +7628,7 @@ dissect_ul_gprs_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, RlcMa { csnStream_t ar; guint8 payload_type = tvb_get_bits8(tvb, 0, 2); - guint16 bit_length = tvb_length(tvb) * 8; + guint16 bit_length = tvb_reported_length(tvb) * 8; guint16 bit_offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM RLC/MAC"); @@ -7716,7 +7716,7 @@ dissect_egprs_ul_header_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree *rlcmac_tree; csnStream_t ar; guint16 bit_offset = 0; - guint16 bit_length = tvb_length(tvb) * 8; + guint16 bit_length = tvb_reported_length(tvb) * 8; col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM RLC/MAC"); col_append_sep_str(pinfo->cinfo, COL_INFO, ":", "EGPRS UL:HEADER"); @@ -7805,7 +7805,7 @@ dissect_egprs_ul_data_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { /* dissect the data segments */ dissect_egprs_data_segments(tvb, pinfo, data_tree, offset, - tvb_length(tvb), li_count, li_array); + tvb_reported_length(tvb), li_count, li_array); } else { @@ -7852,7 +7852,7 @@ dissect_egprs_dl_data_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { /* dissect the data segments */ dissect_egprs_data_segments(tvb, pinfo, data_tree, offset, - tvb_length(tvb), li_count, li_array); + tvb_reported_length(tvb), li_count, li_array); } else { @@ -7908,7 +7908,7 @@ dissect_gsm_rlcmac_downlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; } - return tvb_length(tvb); + return tvb_reported_length(tvb); } @@ -7928,7 +7928,7 @@ dissect_gsm_rlcmac_uplink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v rlc_ul->block_format = rlc_mac->block_format; rlc_ul->flags = rlc_mac->flags; } - else if (tvb_length(tvb) < 3) + else if (tvb_reported_length(tvb) < 3) { /* assume that little packets are PACCH */ rlc_ul->block_format = RLCMAC_PRACH; @@ -7971,7 +7971,7 @@ dissect_gsm_rlcmac_uplink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v break; } - return tvb_length(tvb); + return tvb_reported_length(tvb); } void diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index de3009b944..97604e07b4 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -2468,7 +2468,7 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data * as they might not be L2TP packets even though they happen * to be coming from or going to the L2TP port. */ - if (tvb_length(tvb) < 2) + if (tvb_captured_length(tvb) < 2) return 0; /* not enough information to check */ control = tvb_get_ntohs(tvb, 0); switch (L2TP_VERSION(control)) { @@ -2520,7 +2520,7 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Call to process l2tp v3 data message */ process_l2tpv3_data_udp(tvb, pinfo, tree, l2tp_conv); } - return tvb_length(tvb); + return tvb_reported_length(tvb); } if (LENGTH_BIT(control)) { /* length field included ? */ @@ -2662,13 +2662,13 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data next_tvb = tvb_new_subset_remaining(tvb, idx); call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree); } - return tvb_length(tvb); + return tvb_reported_length(tvb); } if (LENGTH_BIT(control)) process_control_avps(tvb, pinfo, l2tp_tree, idx, length, -1, NULL); - return tvb_length(tvb); + return tvb_reported_length(tvb); } diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c index f62829e0bf..6de2aa410c 100644 --- a/epan/dissectors/packet-lapd.c +++ b/epan/dissectors/packet-lapd.c @@ -283,7 +283,7 @@ dissect_lapd_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Consume tvb bytes */ - available = tvb_length_remaining(tvb, offset); + available = tvb_reported_length_remaining(tvb, offset); while (offset < available) { byte = tvb_get_guint8(tvb,offset); offset++; @@ -539,11 +539,11 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean if (has_crc) { /* check checksum */ - checksum_offset = tvb_length(tvb) - 2; + checksum_offset = tvb_reported_length(tvb) - 2; checksum = tvb_get_guint8(tvb, checksum_offset); /* high byte */ checksum <<= 8; checksum |= tvb_get_guint8(tvb, checksum_offset+1) & 0x00FF; /* low byte */ - checksum_calculated = crc16_ccitt_tvb(tvb, tvb_length(tvb) - 2); + checksum_calculated = crc16_ccitt_tvb(tvb, tvb_reported_length(tvb) - 2); checksum_calculated = g_htons(checksum_calculated); /* Note: g_htons() macro may eval arg multiple times */ if (checksum == checksum_calculated) { @@ -560,7 +560,7 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean expert_add_info(pinfo, pi, &ei_lapd_checksum_bad); } - next_tvb = tvb_new_subset_length(tvb, lapd_header_len, tvb_length_remaining(tvb,lapd_header_len) - 2); + next_tvb = tvb_new_subset_length(tvb, lapd_header_len, tvb_reported_length_remaining(tvb,lapd_header_len) - 2); } else next_tvb = tvb_new_subset_remaining(tvb, lapd_header_len); diff --git a/epan/dissectors/packet-lapdm.c b/epan/dissectors/packet-lapdm.c index 8b418bccf4..8e20582b4e 100644 --- a/epan/dissectors/packet-lapdm.c +++ b/epan/dissectors/packet-lapdm.c @@ -224,7 +224,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean is_response = FALSE; /* Check that there's enough data */ - if (tvb_length(tvb) < LAPDM_HEADER_LEN) + if (tvb_captured_length(tvb) < LAPDM_HEADER_LEN) return; col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPDm"); @@ -275,7 +275,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len = (length & LAPDM_LEN) >> LAPDM_LEN_SHIFT; /*n_s = (control & XDLC_N_S_MASK) >> XDLC_N_S_SHIFT;*/ m = (length & LAPDM_M) >> LAPDM_M_SHIFT; - available_length = tvb_length(tvb) - LAPDM_HEADER_LEN; + available_length = tvb_reported_length(tvb) - LAPDM_HEADER_LEN; /* No point in doing anything if no payload */ -- cgit v1.2.3