Remove more deprecated tvb_length calls

Change-Id: I56260a82b19001ab2f87f4be34a9510f127f841f
Reviewed-on: https://code.wireshark.org/review/9050
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Evan Huus 2015-06-22 20:53:46 -07:00
parent 46e5fd833e
commit 6fd7e5ba33
21 changed files with 92 additions and 92 deletions

View File

@ -2859,7 +2859,7 @@ static int dissect_kademlia_udp_compressed_message(guint8 msg_type,
if (tvbraw) {
guint32 raw_length;
raw_length = tvb_length( tvbraw );
raw_length = tvb_captured_length( tvbraw );
add_new_data_source(pinfo, tvbraw, "Decompressed Data");
dissect_kademlia_udp_message( msg_type, tvbraw, pinfo, 0, raw_length, tree );
@ -2971,12 +2971,12 @@ static int dissect_edonkey_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree
offset+1, msg_len-1, ENC_NA);
emule_zlib_tree = proto_item_add_subtree(ti, ett_emule_zlib);
add_new_data_source(pinfo, tvbraw, "Decompressed Data");
(*dissector)(msg_type, tvbraw, pinfo, 0, tvb_length(tvbraw), emule_zlib_tree);
(*dissector)(msg_type, tvbraw, pinfo, 0, tvb_captured_length(tvbraw), emule_zlib_tree);
}
}
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static int dissect_edonkey_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
@ -3046,7 +3046,7 @@ static int dissect_edonkey_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
"%s (0x%02x)", message_name, msg_type);
offset += EDONKEY_UDP_HEADER_LENGTH;
remainingLength = tvb_length_remaining( tvb, offset );
remainingLength = tvb_captured_length_remaining( tvb, offset );
if (remainingLength > 0) {
switch (protocol) {

View File

@ -1103,7 +1103,7 @@ dissect_eigrp_ipv4_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
proto_item *ti_prefixlen, *ti_dst;
int first = TRUE;
for (; tvb_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
for (; tvb_reported_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
length = tvb_get_guint8(tvb, offset);
addr_len = ipv4_addr_and_mask(tvb, offset + 1, ip_addr, length);
@ -1160,7 +1160,7 @@ dissect_eigrp_ipv6_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
proto_item *ti_prefixlen, *ti_dst;
int first = TRUE;
for (; tvb_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
for (; tvb_reported_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
length = tvb_get_guint8(tvb, offset);
addr_len = ipv6_addr_and_mask(tvb, offset + 1, &addr, length);
@ -1286,12 +1286,12 @@ dissect_eigrp_service (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
tvbuff_t *sub_tvb, *reach_tvb;
guint16 service, sub_service;
remaining = tvb_length_remaining(tvb, offset);
remaining = tvb_captured_length_remaining(tvb, offset);
sub_tree = proto_tree_add_subtree(tree, tvb, offset, remaining, ett_eigrp_tlv_metric, &sub_ti, "SAF Service ");
sub_tvb = tvb_new_subset(tvb, offset, remaining, -1);
sub_offset = 0;
for (; tvb_length_remaining(sub_tvb, sub_offset) > 0; ) {
for (; tvb_reported_length_remaining(sub_tvb, sub_offset) > 0; ) {
service = tvb_get_ntohs(sub_tvb, sub_offset);
proto_item_append_text(sub_ti, "%c %s", (sub_offset == 0 ? '=':','),
val_to_str_const(service, eigrp_saf_srv2string, ""));
@ -2476,7 +2476,7 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
proto_tree_add_item(eigrp_tree, hf_eigrp_opcode, tvb, 1, 1,
ENC_BIG_ENDIAN);
size = tvb_length(tvb);
size = tvb_captured_length(tvb);
checksum = tvb_get_ntohs(tvb, 2);
cacl_checksum = ip_checksum_tvb(tvb, 0, size);
@ -2528,7 +2528,7 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
size = tvb_get_ntohs(tvb, offset + 2);
if (size == 0) {
proto_tree_add_expert(eigrp_tree, pinfo, &ei_eigrp_tlv_len, tvb, offset, -1);
return(tvb_length(tvb));
return(tvb_captured_length(tvb));
}
tlv_tree = proto_tree_add_subtree(eigrp_tree, tvb, offset, size, ett_eigrp_tlv, &ti,
@ -2580,7 +2580,7 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
/* Return the amount of data this dissector was able to dissect */
return(tvb_length(tvb));
return(tvb_captured_length(tvb));
}
static void

View File

@ -184,10 +184,10 @@ dissect_lower_address(proto_item *ti_arg, gint ett_arg,
* ELCOM-90 TRA3825.02 User Element conventions, p. 5-2 and Appendix G
*/
len1 = tvb_get_guint8(tvb, offset);
if (tvb_length_remaining(tvb, offset+len1+1) <= 0)
if (tvb_captured_length_remaining(tvb, offset+len1+1) <= 0)
return offset;
len2 = tvb_get_guint8(tvb, offset+len1+1);
if (tvb_length_remaining(tvb, offset+len1+len2+2) <= 0)
if (tvb_reported_length_remaining(tvb, offset+len1+len2+2) <= 0)
return offset;
if ((len1 != LOWADR_LEN) || (len2 != SUFFIX_LEN)) {
proto_item_append_text(tree, " Invalid structure");
@ -262,20 +262,20 @@ dissect_userdata(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_offse
proto_item_append_text(ti, " (2 bytes, should be 1 byte)");
}
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_userdata_pduid, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_userdata_version, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_userdata_result, tvb, offset, 1, ENC_BIG_ENDIAN);
@ -284,13 +284,13 @@ dissect_userdata(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_offse
/* show the rest */
/* tree2 = proto_tree_add_subtree(tree, tvb, offset, -1, "User Data"); */
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
ti = proto_tree_add_item(tree, hf_elcom_userdata_restmark, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_item_append_text(ti, " <-- '0' = no restart etc.");
offset +=1;
if (tvb_length_remaining(tvb, offset+8) <= 0)
if (tvb_reported_length_remaining(tvb, offset+8) <= 0)
return offset;
year = tvb_get_guint8(tvb, offset);
month = tvb_get_guint8(tvb, offset+1);
@ -305,11 +305,11 @@ dissect_userdata(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_offse
year+1900, month, day, hour, min, sec, msec);
offset += 12;
if (tvb_length_remaining(tvb, offset+12) > 0) {
if (tvb_reported_length_remaining(tvb, offset+12) > 0) {
proto_item_append_text(ti, " Security info: ");
}
/* security info field, if present */
while (tvb_length_remaining(tvb, offset) > 0) {
while (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_item_append_text(ti, elcom_show_hex ? " %02x" : " %03o",
tvb_get_guint8(tvb, offset));
offset++;
@ -327,7 +327,7 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of
proto_item *ti;
tree = proto_item_add_subtree(ti_arg, ett_arg);
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
gtype = tvb_get_guint8(tvb, offset);
@ -353,45 +353,45 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of
proto_item_append_text(ti, " <<--- meaning WHAT?");
return offset;
}
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_groupnumber, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_grouppriority, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_groupsize, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_groupindex1, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_groupindex2, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
while (1) {
oidlen = tvb_get_guint8(tvb, offset);
if (oidlen == 0) /* normal termination */
break;
if (tvb_length_remaining(tvb, offset+oidlen+1) <= 0)
if (tvb_reported_length_remaining(tvb, offset+oidlen+1) <= 0)
return offset;
proto_tree_add_item(tree, hf_elcom_datarequest_oid, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
offset += oidlen+1;
}
offset += 1; /* the loop exited at the 0 length byte */
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return offset;
/* show the rest */
@ -399,7 +399,7 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of
return offset;
}
/* XXX: Are all the tests against tvb_length() really the right way to handle invalid fields ?
/* XXX: Are all the tests against tvb_reported_length() really the right way to handle invalid fields ?
* It seems to me that invalid fields should just add an expert item
* or cause a "Malformed" exception.
*/
@ -415,7 +415,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 *suffix;
/* Check that there's enough data */
if (tvb_length(tvb) < 3)
if (tvb_captured_length(tvb) < 3)
return;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ELCOM");
@ -437,7 +437,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* starting after elcom_len and elcom_msg_type,
initiator + responder + userdata fields must be there */
if (tvb_length_remaining(tvb, 3+TOTAL_LEN+TOTAL_LEN+3) < 0) return;
if (tvb_captured_length_remaining(tvb, 3+TOTAL_LEN+TOTAL_LEN+3) < 0) return;
/* check also that those field lengths are valid */
if (tvb_get_guint8(tvb, 3) != LOWADR_LEN) return;
if (tvb_get_guint8(tvb, 3+1+LOWADR_LEN) != SUFFIX_LEN) return;
@ -495,7 +495,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_append_text(elcom_tree, " ( %s)", val_to_str(elcom_msg_type, type_vals, "Unknown %d"));
offset++;
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return;
switch (elcom_msg_type) {
@ -513,7 +513,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hf_elcom_initiator_ip,
hf_elcom_initiator_port,
hf_elcom_initiator_suff);
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return;
ti = proto_tree_add_item(elcom_tree, hf_elcom_responder, tvb, offset, TOTAL_LEN, ENC_NA);
@ -522,7 +522,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hf_elcom_responder_ip,
hf_elcom_responder_port,
hf_elcom_responder_suff);
if (tvb_length_remaining(tvb, offset) <= 0)
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return;
/* Rest of the payload is USER-DATA, 0..82 bytes */
@ -555,7 +555,7 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
if (tvb_length_remaining(tvb, offset) > 0)
if (tvb_reported_length_remaining(tvb, offset) > 0)
{
/* We should not get here, but if we do, show what is left over: */
proto_tree_add_item(elcom_tree, hf_elcom_strangeleftover, tvb, offset, -1, ENC_NA);

View File

@ -1829,10 +1829,10 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
/* Call dissector for interface */
next_tvb = tvb_new_subset_length( tvb, offset+6, item_length);
p_add_proto_data(wmem_file_scope(), pinfo, proto_enip, ENIP_REQUEST_INFO, request_info);
if ( tvb_length_remaining(next_tvb, 0) <= 0 || !dissector_try_uint(subdissector_srrd_table, ifacehndl, next_tvb, pinfo, dissector_tree) )
if ( tvb_reported_length_remaining(next_tvb, 0) <= 0 || !dissector_try_uint(subdissector_srrd_table, ifacehndl, next_tvb, pinfo, dissector_tree) )
{
/* Show the undissected payload */
if ( tvb_length_remaining(tvb, offset) > 0 )
if ( tvb_reported_length_remaining(tvb, offset) > 0 )
call_dissector( data_handle, next_tvb, pinfo, dissector_tree);
}
@ -1888,10 +1888,10 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
/* Call dissector for interface */
next_tvb = tvb_new_subset_length (tvb, offset+8, item_length-2);
p_add_proto_data(wmem_file_scope(), pinfo, proto_enip, ENIP_REQUEST_INFO, request_info);
if ( tvb_length_remaining(next_tvb, 0) <= 0 || !dissector_try_uint(subdissector_sud_table, ifacehndl, next_tvb, pinfo, dissector_tree) )
if ( tvb_reported_length_remaining(next_tvb, 0) <= 0 || !dissector_try_uint(subdissector_sud_table, ifacehndl, next_tvb, pinfo, dissector_tree) )
{
/* Show the undissected payload */
if ( tvb_length_remaining(tvb, offset) > 0 )
if ( tvb_reported_length_remaining(tvb, offset) > 0 )
call_dissector( data_handle, next_tvb, pinfo, dissector_tree );
}
p_remove_proto_data(wmem_file_scope(), pinfo, proto_enip, ENIP_REQUEST_INFO);
@ -1899,7 +1899,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
else
{
/* Display data */
if (tvb_length_remaining(tvb, offset+6) > 0)
if (tvb_reported_length_remaining(tvb, offset+6) > 0)
{
next_tvb = tvb_new_subset_length(tvb, offset+6, item_length);
if (conn_info != NULL)
@ -2343,7 +2343,7 @@ dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
} /* end of if ( encapsulated data ) */
return tvb_length(tvb);
return tvb_captured_length(tvb);
} /* end of dissect_enip_pdu() */
static int
@ -2378,7 +2378,7 @@ dissect_enip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0; /* not a known command */
tcp_dissect_pdus(tvb, pinfo, tree, enip_desegment, 4, get_enip_pdu_len, dissect_enip_pdu, data);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/* Code to actually dissect the io packets*/
@ -2542,7 +2542,7 @@ dissect_dlr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Unknown Frame type */
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
} /* end of dissect_dlr() */

View File

@ -176,7 +176,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
code = tvb_get_ntohs(cause_tvb, CAUSE_CODE_OFFSET);
length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET);
padding_length = tvb_length(cause_tvb) - length;
padding_length = tvb_captured_length(cause_tvb) - length;
cause_tree = proto_tree_add_subtree(parameter_tree, cause_tvb, CAUSE_HEADER_OFFSET, -1,
ett_enrp_cause, &cause_item, val_to_str_const(code, cause_code_values, "Unknown error cause"));
@ -475,7 +475,7 @@ dissect_pool_member_selection_policy_parameter(tvbuff_t *parameter_tvb, proto_tr
proto_tree_add_item(parameter_tree, hf_policy_distance, parameter_tvb, POLICY_WRANDDPF_DISTANCE_OFFSET, POLICY_WRANDDPF_DISTANCE_LENGTH, ENC_BIG_ENDIAN);
break;
default:
length = tvb_length(parameter_tvb) - POLICY_VALUE_OFFSET;
length = tvb_reported_length(parameter_tvb) - POLICY_VALUE_OFFSET;
if (length > 0) {
proto_tree_add_item(parameter_tree, hf_policy_value, parameter_tvb, POLICY_VALUE_OFFSET, length, ENC_NA);
}
@ -641,7 +641,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *enrp_tree)
/* extract tag and length from the parameter */
type = tvb_get_ntohs(parameter_tvb, PARAMETER_TYPE_OFFSET);
length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
padding_length = tvb_length(parameter_tvb) - length;
padding_length = tvb_captured_length(parameter_tvb) - length;
/* create proto_tree stuff */
parameter_tree = proto_tree_add_subtree(enrp_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
@ -713,7 +713,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, proto_tree *tree)
tvbuff_t *parameter_tvb;
offset = 0;
while((remaining_length = tvb_length_remaining(parameters_tvb, offset)) > 0) {
while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset)) > 0) {
length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
total_length = ADD_PADDING(length);
if (remaining_length >= length)
@ -904,7 +904,7 @@ dissect_enrp_error_message(tvbuff_t *message_tvb, proto_tree *message_tree, prot
static void
dissect_unknown_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
proto_tree_add_item(message_tree, hf_message_value, message_tvb, MESSAGE_VALUE_OFFSET, tvb_length(message_tvb) - MESSAGE_HEADER_LENGTH, ENC_NA);
proto_tree_add_item(message_tree, hf_message_value, message_tvb, MESSAGE_VALUE_OFFSET, tvb_captured_length(message_tvb) - MESSAGE_HEADER_LENGTH, ENC_NA);
}
#define ENRP_PRESENCE_MESSAGE_TYPE 0x01

View File

@ -343,7 +343,7 @@ dissect_epl_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
proto_tree *epl_v1_tree=NULL;
if(tvb_length(tvb) < 3){
if(tvb_captured_length(tvb) < 3){
/* Not enough data for an EPL_V1 header; don't try to interpret it */
return FALSE;
}

View File

@ -147,7 +147,7 @@ dissect_epmd_request(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree
proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, name_length, ENC_ASCII);
offset += 2 + name_length;
if (tvb_length_remaining(tvb, offset) >= 2) {
if (tvb_reported_length_remaining(tvb, offset) >= 2) {
guint16 elen=0;
elen = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
@ -159,7 +159,7 @@ dissect_epmd_request(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree
case EPMD_PORT_REQ:
case EPMD_PORT2_REQ:
name_length = tvb_length_remaining(tvb, offset);
name_length = tvb_captured_length_remaining(tvb, offset);
proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, name_length, ENC_ASCII);
break;
@ -167,7 +167,7 @@ dissect_epmd_request(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree
case EPMD_ALIVE_REQ:
proto_tree_add_item(tree, hf_epmd_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
name_length = tvb_length_remaining(tvb, offset);
name_length = tvb_captured_length_remaining(tvb, offset);
proto_tree_add_item(tree, hf_epmd_name, tvb, offset, name_length, ENC_ASCII|ENC_NA);
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, name_length, ENC_ASCII);
break;
@ -250,7 +250,7 @@ dissect_epmd_response(packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree
proto_tree_add_item(tree, hf_epmd_name, tvb, offset + 2, name_length, ENC_ASCII|ENC_NA);
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, name_length, ENC_ASCII);
offset += 2 + name_length;
if (tvb_length_remaining(tvb, offset) >= 2) {
if (tvb_reported_length_remaining(tvb, offset) >= 2) {
guint16 elen=0;
elen = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_epmd_elen, tvb, offset, 2, ENC_BIG_ENDIAN);
@ -280,7 +280,7 @@ check_epmd(tvbuff_t *tvb) {
* It's possible to start checking lengths but imho that
* doesn't bring very much.
*/
if (tvb_length(tvb) < 3)
if (tvb_captured_length(tvb) < 3)
return (FALSE);
type = tvb_get_guint8(tvb, 0);
@ -327,7 +327,7 @@ dissect_epmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
dissect_epmd_response(pinfo, tvb, 0, epmd_tree);
}
return (tvb_length(tvb));
return (tvb_captured_length(tvb));
}
void

View File

@ -400,7 +400,7 @@ static gint dissect_etf_type(const gchar *label, packet_info *pinfo, tvbuff_t *t
static gboolean is_handshake(tvbuff_t *tvb, int offset) {
guint32 len = tvb_get_ntohs(tvb, offset);
guint8 tag = tvb_get_guint8(tvb, offset + 2);
return ((len > 0) && strchr("nras", tag) && (len == (guint32)tvb_length_remaining(tvb, offset + 2)));
return ((len > 0) && strchr("nras", tag) && (len == (guint32)tvb_captured_length_remaining(tvb, offset + 2)));
}
/*--- dissect_erldp_handshake -------------------------------------------------*/
@ -435,7 +435,7 @@ static void dissect_erldp_handshake(tvbuff_t *tvb, packet_info *pinfo, proto_tre
proto_tree_add_item(tree, hf_erldp_challenge, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
str_len = tvb_length_remaining(tvb, offset);
str_len = tvb_captured_length_remaining(tvb, offset);
str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, str_len, ENC_ASCII);
proto_tree_add_item(tree, hf_erldp_name, tvb, offset, str_len, ENC_ASCII|ENC_NA);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", (is_challenge) ? "SEND_CHALLENGE" : "SEND_NAME", str);
@ -456,7 +456,7 @@ static void dissect_erldp_handshake(tvbuff_t *tvb, packet_info *pinfo, proto_tre
break;
case 's' :
str_len = tvb_length_remaining(tvb, offset);
str_len = tvb_captured_length_remaining(tvb, offset);
str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, str_len, ENC_ASCII);
proto_tree_add_item(tree, hf_erldp_status, tvb, offset, str_len, ENC_ASCII|ENC_NA);
col_add_fstr(pinfo->cinfo, COL_INFO, "SEND_STATUS %s", str);
@ -480,7 +480,7 @@ static int dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
if (is_handshake(tvb, 0)) {
dissect_erldp_handshake(tvb, pinfo, erldp_tree);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
offset = 0;
@ -509,7 +509,7 @@ static int dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ctl_op, VALS(erldp_ctlmsg_vals), "unknown ControlMessage operation (%d)"));
}
offset = dissect_etf_type("ControlMessage", pinfo, tvb, offset, erldp_tree);
if (tvb_length_remaining(tvb, offset) > 0)
if (tvb_reported_length_remaining(tvb, offset) > 0)
dissect_etf_type("Message", pinfo, tvb, offset, erldp_tree);
break;
@ -519,7 +519,7 @@ static int dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
col_set_str(pinfo->cinfo, COL_INFO, "unknown header format");
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/*--- get_erldp_pdu_len -------------------------------------------------*/
@ -540,7 +540,7 @@ dissect_erldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
4, /* fixed-length part of the PDU */
get_erldp_pdu_len, /* routine to get the length of the PDU */
dissect_erldp_pdu, data); /* routine to dissect a PDU */
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/*--- proto_register_erldp ----------------------------------------------*/

View File

@ -86,7 +86,7 @@ is_esio_pdu(tvbuff_t *tvb)
/* we need at least 8 bytes to determine whether this is
Ether-S-I/O or not*/
/* minimal length is 20 bytes*/
if (tvb_length(tvb) < 20) {
if (tvb_captured_length(tvb) < 20) {
return FALSE;
}
/* First four bytes must be "ESIO"*/
@ -268,7 +268,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
} /* switch() */
return tvb_length(tvb);
return tvb_captured_length(tvb);
/*End of dissect_sbus*/
}

View File

@ -616,7 +616,7 @@ read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
int i;
ti = proto_tree_add_item(etch_tree, hf_etch_struct, tvb, *offset,
tvb_length(tvb) - *offset, ENC_NA);
tvb_captured_length(tvb) - *offset, ENC_NA);
new_tree = proto_item_add_subtree(ti, ett_etch_struct);
if (add_type_field) {
@ -753,7 +753,7 @@ dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
read_struct(&offset, tvb, etch_tree, 0);
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/*
@ -774,7 +774,7 @@ get_etch_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
static int
dissect_etch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (tvb_length(tvb) < 4) {
if (tvb_captured_length(tvb) < 4) {
/* Too small for an etch packet. */
return 0;
}

View File

@ -266,7 +266,7 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* Get the captured length and reported length of the data
after the Ethernet type. */
captured_length = tvb_length_remaining(tvb, ethertype_data->offset_after_ethertype);
captured_length = tvb_captured_length_remaining(tvb, ethertype_data->offset_after_ethertype);
reported_length = tvb_reported_length_remaining(tvb,
ethertype_data->offset_after_ethertype);
@ -336,7 +336,7 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
add_dix_trailer(pinfo, tree, ethertype_data->fh_tree, ethertype_data->trailer_id, tvb, next_tvb, ethertype_data->offset_after_ethertype,
length_before, ethertype_data->fcs_len);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static void

View File

@ -217,12 +217,12 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* then it must be session data only and we can skip looking
* for the other fields.
*/
if(tvb_find_guint8(tvb, tvb_length(tvb)-1, 1, '\0') == -1){
if(tvb_find_guint8(tvb, tvb_captured_length(tvb)-1, 1, '\0') == -1){
hash_info->state = WAIT_FOR_DATA;
}
if(hash_info->state == WAIT_FOR_STDERR_PORT
&& tvb_length_remaining(tvb, offset)){
&& tvb_reported_length_remaining(tvb, offset)){
field_stringz = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
/* Check if this looks like the stderr_port field.
@ -245,7 +245,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(hash_info->state == WAIT_FOR_USERNAME
&& tvb_length_remaining(tvb, offset)){
&& tvb_reported_length_remaining(tvb, offset)){
field_stringz = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
/* Check if this looks like the username field */
@ -273,7 +273,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(hash_info->state == WAIT_FOR_PASSWORD
&& tvb_length_remaining(tvb, offset)){
&& tvb_reported_length_remaining(tvb, offset)){
field_stringz = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
/* Check if this looks like the password field */
@ -296,7 +296,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(hash_info->state == WAIT_FOR_COMMAND
&& tvb_length_remaining(tvb, offset)){
&& tvb_reported_length_remaining(tvb, offset)){
field_stringz = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
/* Check if this looks like the command field */
@ -319,7 +319,7 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(hash_info->state == WAIT_FOR_DATA
&& tvb_length_remaining(tvb, offset)){
&& tvb_reported_length_remaining(tvb, offset)){
if(pinfo->destport == EXEC_PORT){
/* Packet going to the server */
/* offset = 0 since the whole packet is data */

View File

@ -989,7 +989,7 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* If we have the entire ESP packet available, check the checksum.
*/
if (tvb_length(tvb) >= data_length) {
if (tvb_captured_length(tvb) >= data_length) {
/* Checksum from version to null tlv */
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length);
computed_checksum = in_cksum(&cksum_vec[0], 1);

View File

@ -1230,7 +1230,7 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
return 0;
dissect_fc_helper (tvb, pinfo, tree, FALSE, fc_data);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static int
@ -1242,7 +1242,7 @@ dissect_fc_wtap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
fc_data.sof_eof = 0;
dissect_fc_helper (tvb, pinfo, tree, FALSE, &fc_data);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static int
@ -1254,7 +1254,7 @@ dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
return 0;
dissect_fc_helper (tvb, pinfo, tree, TRUE, fc_data);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static void

View File

@ -214,7 +214,7 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
call_dissector (data_handle, next_tvb, pinfo, tree);
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */

View File

@ -1751,7 +1751,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
break;
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */

View File

@ -904,7 +904,7 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
break;
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */

View File

@ -440,7 +440,7 @@ dissect_fcfzs_arzm(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, gboolean
len, ENC_ASCII|ENC_NA);
len += (len % 4);
plen = tvb_length(tvb) - offset - len;
plen = tvb_reported_length(tvb) - offset - len;
numrec = plen/12; /* each mbr rec is 12 bytes long */
@ -540,7 +540,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_fcfzs, tvb, 0,
tvb_length(tvb),
tvb_captured_length(tvb),
"Zone Server");
fcfzs_tree = proto_item_add_subtree(ti, ett_fcfzs);
proto_tree_add_item(fcfzs_tree, hf_fcfzs_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
@ -688,7 +688,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
break;
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */

View File

@ -315,7 +315,7 @@ dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
}
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
static guint
@ -328,7 +328,7 @@ static int
dissect_fcgi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_fcgi_record_len, dissect_fcgi_record, data);
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
void

View File

@ -142,7 +142,7 @@ static dissector_handle_t fc_handle;
static guint
get_next_fcip_header_offset (tvbuff_t *tvb, packet_info *pinfo, gint offset)
{
gint bytes_remaining = tvb_length_remaining (tvb, offset);
gint bytes_remaining = tvb_reported_length_remaining (tvb, offset);
gint frame_len;
guint16 flen, flen1;
fcip_eof_t eof, eofc;
@ -369,7 +369,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset = 0,
start = 0,
frame_len = 0;
gint bytes_remaining = tvb_length (tvb);
gint bytes_remaining = tvb_captured_length (tvb);
guint8 pflags, sof = 0, eof = 0;
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;

View File

@ -164,7 +164,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FCoE");
crc_offset = header_len + frame_len;
eof_offset = crc_offset + 4;
bytes_remaining = tvb_length_remaining(tvb, header_len);
bytes_remaining = tvb_captured_length_remaining(tvb, header_len);
if (bytes_remaining > frame_len)
bytes_remaining = frame_len; /* backing length */
next_tvb = tvb_new_subset(tvb, header_len, bytes_remaining, frame_len);
@ -228,7 +228,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
crc, crc_computed);
}
proto_tree_set_appendix(fcoe_tree, tvb, crc_offset,
tvb_length_remaining (tvb, crc_offset));
tvb_captured_length_remaining (tvb, crc_offset));
} else {
item = proto_tree_add_uint_format_value(fcoe_tree, hf_fcoe_crc, tvb, crc_offset, 0,
0, "CRC: [missing]");