Remove deprecated tvb_lengt APIs

Change-Id: Ic3c364384dcc1d87089d646665f5900081de13df
Reviewed-on: https://code.wireshark.org/review/8089
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AndersBroman 2015-04-16 15:58:53 +02:00 committed by Anders Broman
parent 4171f5590b
commit 338f3a5eb1
13 changed files with 42 additions and 42 deletions

View File

@ -846,7 +846,7 @@ dissect_cimd_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
int etxp;
guint8 opcode = 0; /* Operation code */
if (tvb_length(tvb) < CIMD_MIN_LENGTH)
if (tvb_captured_length(tvb) < CIMD_MIN_LENGTH)
return FALSE;
if (tvb_get_guint8(tvb, 0) != CIMD_STX)

View File

@ -547,7 +547,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
const gchar *command_str; /* Header command string */
/* Get the length of the PDU */
tvb_len = tvb_length(tvb);
tvb_len = tvb_captured_length(tvb);
/* if the length of the tvb is shorder then the cmpp header length exit */
if (tvb_len < CMPP_FIX_HEADER_LENGTH)
return 0;
@ -617,7 +617,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
}
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
@ -634,7 +634,7 @@ dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint total_length, command_id, tvb_len;
/* Check that there's enough data */
tvb_len = tvb_length(tvb);
tvb_len = tvb_captured_length(tvb);
if (tvb_len < CMPP_FIX_HEADER_LENGTH)
return 0;
@ -658,7 +658,7 @@ dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
get_cmpp_pdu_len, dissect_cmpp_tcp_pdu, data);
/* Return the amount of data this dissector was able to dissect */
return tvb_length(tvb);
return tvb_reported_length(tvb);
}

View File

@ -112,7 +112,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
proto_tree_add_item (db_lsp_tree, hf_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (magic != 0x0301 || length > tvb_length_remaining (tvb, offset)) {
if (magic != 0x0301 || length > tvb_reported_length_remaining (tvb, offset)) {
/* Probably an unknown packet */
/* expert_add_info_format (pinfo, db_lsp_item, PI_UNDECODED, PI_WARN, "Unknown packet"); */
return 0;
@ -138,7 +138,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
proto_item_append_text (db_lsp_item, ", Type: %d, Length: %d", type, length);
proto_item_set_len (db_lsp_item, length + 5);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
static guint
@ -147,7 +147,7 @@ get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb,
{
if (tvb_get_ntohs (tvb, offset + 1) != 0x0301) {
/* Unknown data, eat remaining data for this frame */
return tvb_length_remaining (tvb, offset);
return tvb_reported_length_remaining (tvb, offset);
}
return tvb_get_ntohs (tvb, offset + 3) + 5;
@ -158,7 +158,7 @@ dissect_db_lsp_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
{
tcp_dissect_pdus (tvb, pinfo, tree, db_lsp_desegment, 5,
get_db_lsp_pdu_len, dissect_db_lsp_pdu, data);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
static void

View File

@ -622,7 +622,7 @@ static int
dissect_dbus_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dbus_desegment, DBUS_HEADER_LEN, get_dbus_message_len, dissect_dbus_pdu, data);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
void

View File

@ -99,7 +99,7 @@ static expert_field ei_dcc_len = EI_INIT;
#define D_TEXT(hf_label, endpad) { \
int next_offset,left; \
while (tvb_offset_exists(tvb, offset+endpad)) { \
left = tvb_length_remaining(tvb,offset) - endpad; \
left = tvb_reported_length_remaining(tvb,offset) - endpad; \
tvb_find_line_end(tvb, offset, left, &next_offset, \
FALSE); \
proto_tree_add_item(dcc_optree, hf_label, tvb, offset, \
@ -326,7 +326,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
case DCC_OP_ADMN:
if ( is_response )
{
int left_local = tvb_length_remaining(tvb, offset) -
int left_local = tvb_reported_length_remaining(tvb, offset) -
(int)sizeof(DCC_SIGNATURE);
if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) )
{

View File

@ -712,7 +712,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* checksums in DCCP)
*/
reported_len = tvb_reported_length(tvb);
len = tvb_length(tvb);
len = tvb_captured_length(tvb);
csum_coverage_len = dccp_csum_coverage(dccph, reported_len);
if (dccp_check_checksum && !pinfo->fragmented && len >= csum_coverage_len) {
@ -797,7 +797,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
expert_add_info_format(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u)",
advertised_dccp_header_len, DCCP_GEN_HDR_LEN_X);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->reserved2 = tvb_get_guint8(tvb, offset);
hidden_item =
@ -815,7 +815,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
expert_add_info_format(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u)",
advertised_dccp_header_len, DCCP_GEN_HDR_LEN_NO_X);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->seq = tvb_get_ntoh24(tvb, offset);
proto_tree_add_uint64(dccp_tree, hf_dccp_seq, tvb, offset, 3,
@ -839,7 +839,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 4,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->service_code = tvb_get_ntohl(tvb, offset);
if (tree)
@ -854,7 +854,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
expert_add_info_format(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for Response",
advertised_dccp_header_len, offset + 12);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->ack_reserved = tvb_get_ntohs(tvb, offset);
if (tree) {
@ -895,7 +895,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 8,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->ack_reserved = tvb_get_ntohs(tvb, offset);
if (tree) {
@ -920,7 +920,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 4,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->ack_reserved = tvb_get_guint8(tvb, offset);
if (tree) {
@ -945,7 +945,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
expert_add_info_format(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for Reset",
advertised_dccp_header_len, offset + 4);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->ack_reserved = tvb_get_ntohs(tvb, offset);
@ -997,7 +997,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 8,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
dccph->ack_reserved = tvb_get_ntohs(tvb, offset);
if (tree) {
@ -1018,7 +1018,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
default:
expert_add_info(pinfo, dccp_item, &ei_dccp_packet_type_reserved);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
/*
@ -1029,7 +1029,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
expert_add_info_format(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is larger than the maximum (%u)",
advertised_dccp_header_len, DCCP_HDR_LEN_MAX);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
/*
@ -1065,7 +1065,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
if (!pinfo->flags.in_error_pkt || tvb_reported_length_remaining(tvb, offset) > 0)
decode_dccp_ports(tvb, offset, pinfo, tree, dccph->sport, dccph->dport);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
void

View File

@ -6703,7 +6703,7 @@ dissect_dcm_pdv_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += pdv_body_len;
}
else {
guint next_tvb_length = tvb_length(next_tvb);
guint next_tvb_length = tvb_captured_length(next_tvb);
/* Decode reassembled data */
if (tree || have_tap_listener(dicom_eo_tap)) {

View File

@ -169,7 +169,7 @@ dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
} else {
col_set_str(pinfo->cinfo, COL_INFO, "Encrypted payload");
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
void

View File

@ -623,7 +623,7 @@ do_hello_test_msg(
proto_tree_add_item(tree, hf_dec_rt_src_node, tvb,
my_offset, 2, ENC_LITTLE_ENDIAN);
my_offset += 2;
remainder_count = tvb_length_remaining(tvb, my_offset);
remainder_count = tvb_reported_length_remaining(tvb, my_offset);
if (remainder_count != 0) {
proto_tree_add_item(tree, hf_dec_rt_test_data, tvb,
my_offset, remainder_count, ENC_NA);
@ -650,7 +650,7 @@ do_routing_msg(
my_offset, 2, ENC_LITTLE_ENDIAN);
/* Skip the 1-byte reserved field */
my_offset += 3;
remainder_count = tvb_length_remaining(tvb, my_offset);
remainder_count = tvb_reported_length_remaining(tvb, my_offset);
do {
/* if the remainder_count == 1, only the checksum remains */
count = tvb_get_letohs(tvb, my_offset);
@ -1027,7 +1027,7 @@ handle_nsp_msg(
(ack_num & 0x1000) ? "NAK" : "ACK",
ack_num & 0xfff);
if (tvb_length_remaining(tvb, my_offset) > 0) {
if (tvb_reported_length_remaining(tvb, my_offset) > 0) {
ack_oth = tvb_get_letohs(tvb, my_offset);
if (ack_oth & 0x8000) {
/* There is an ack_oth field */
@ -1051,7 +1051,7 @@ handle_nsp_msg(
ack_num & 0xfff);
my_offset += 2;
/* There may be an optional ack_dat field */
if (tvb_length_remaining(tvb, my_offset) > 0) {
if (tvb_reported_length_remaining(tvb, my_offset) > 0) {
ack_dat = tvb_get_letohs(tvb, my_offset);
if (ack_dat & 0x8000) {
/* There is an ack_dat field */

View File

@ -1267,7 +1267,7 @@ dissect_bfield(gboolean dect_packet_type _U_, guint8 ba,
proto_tree *BFDescrData = NULL;
guint8 bfield_data[DECT_BFIELD_DATA_SIZE];
guint bfield_length = tvb_length_remaining(tvb, offset);
guint bfield_length = tvb_reported_length_remaining(tvb, offset);
if (bfield_length > DECT_BFIELD_DATA_SIZE)
bfield_length = DECT_BFIELD_DATA_SIZE;
@ -1964,7 +1964,7 @@ dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT");
pkt_len=tvb_length(tvb);
pkt_len=tvb_reported_length(tvb);
if(pkt_len<=DECT_PACKET_INFO_LEN)
{

View File

@ -468,7 +468,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
return offset; /* payload offset was bogus */
if (!tree)
return tvb_length(tvb);
return tvb_reported_length(tvb);
/* if there are any additional header bytes */
if (poffset != offset) {
@ -870,7 +870,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
offset += option_length;
}
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
static int
@ -878,7 +878,7 @@ dissect_dhcpfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dhcpfo_desegment, 2,
get_dhcpfo_pdu_len, dissect_dhcpfo_pdu, data);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
/* Register the protocol with Wireshark */

View File

@ -2051,7 +2051,7 @@ dissect_dhcpv6_bulk_leasequery_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree
offset += dhcpv6_option(tvb, pinfo, option_tree, FALSE, offset,
end, &at_end, proto_dhcpv6_bulk_leasequery, hpi);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
static int
@ -2059,7 +2059,7 @@ dissect_dhcpv6_bulk_leasequery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
{
tcp_dissect_pdus(tvb, pinfo, tree, dhcpv6_bulk_leasequery_desegment, 2,
get_dhcpv6_bulk_leasequery_pdu_len, dissect_dhcpv6_bulk_leasequery_pdu, data);
return tvb_length(tvb);
return tvb_reported_length(tvb);
}
void

View File

@ -61,8 +61,8 @@ void proto_register_distcc(void);
extern void proto_reg_handoff_distcc(void);
#define CHECK_PDU_LEN(x) \
if(parameter>tvb_length_remaining(tvb, offset) || parameter < 1){\
len=tvb_length_remaining(tvb, offset);\
if(parameter>tvb_captured_length_remaining(tvb, offset) || parameter < 1){\
len=tvb_captured_length_remaining(tvb, offset);\
col_append_str(pinfo->cinfo, COL_INFO, "[Short" x " PDU]");\
} \
tvb_ensure_bytes_exist(tvb, offset, len);
@ -71,11 +71,11 @@ extern void proto_reg_handoff_distcc(void);
#define DESEGMENT_TCP(x) \
if(distcc_desegment && pinfo->can_desegment){\
/* only attempt reassembly if whe have the full segment */\
if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){\
if(parameter>tvb_length_remaining(tvb, offset)){\
if(tvb_captured_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){\
if(parameter>tvb_captured_length_remaining(tvb, offset)){\
proto_tree_add_expert_format(tree, pinfo, &ei_distcc_short_pdu, tvb, offset-12, -1, "[Short " x " PDU]");\
pinfo->desegment_offset=offset-12;\
pinfo->desegment_len=parameter-tvb_length_remaining(tvb, offset);\
pinfo->desegment_len=parameter-tvb_captured_length_remaining(tvb, offset);\
return offset+len;\
}\
}\