aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2014-09-08 21:59:38 -0400
committerAnders Broman <a.broman58@gmail.com>2014-09-10 07:54:00 +0000
commitf9d4e0a815cf9c8f1fe5a5a106fcce3755daf8f2 (patch)
treef3abbec56de906935bd40771c4be791e6fb695ea
parent1bf82c3b64b798eb3df99d24819fc8a961d7dbe0 (diff)
Replace deprecated tvb_length calls
And a few other misc. cleanups while in the neighbourhood. Change-Id: Ic0d6836dec9c36d31ea244a6adc74d4713565090 Reviewed-on: https://code.wireshark.org/review/4047 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-adb_cs.c97
-rw-r--r--epan/dissectors/packet-adwin-config.c4
-rw-r--r--epan/dissectors/packet-adwin.c2
-rw-r--r--epan/dissectors/packet-afp.c8
-rw-r--r--epan/dissectors/packet-afs.c12
-rw-r--r--epan/dissectors/packet-agentx.c16
-rw-r--r--epan/dissectors/packet-mp2t.c4
-rw-r--r--epan/dissectors/packet-ses.c10
-rw-r--r--epan/dissectors/packet-zbee-zdp.c6
-rw-r--r--epan/dissectors/packet-zep.c2
-rw-r--r--epan/dissectors/packet-ziop.c6
11 files changed, 79 insertions, 88 deletions
diff --git a/epan/dissectors/packet-adb_cs.c b/epan/dissectors/packet-adb_cs.c
index fb0a5b6f26..27cb11f492 100644
--- a/epan/dissectors/packet-adb_cs.c
+++ b/epan/dissectors/packet-adb_cs.c
@@ -216,7 +216,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
/* heuristic to recognize type of (partial) packet */
- if (tvb_length_remaining(tvb, offset) >= 4) {
+ if (tvb_reported_length_remaining(tvb, offset) >= 4) {
guint8 hex_ascii_length[5];
hex_ascii_length[4] = 0;
@@ -237,13 +237,11 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (g_str_has_prefix(service, "shell:")) {
proto_tree_add_item(main_tree, hf_stdin, tvb, offset, -1, ENC_NA | ENC_ASCII);
- offset = tvb_length(tvb);
} else {
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
}
- return offset;
+ return tvb_captured_length(tvb);
}
if (!pinfo->fd->flags.visited && length > 0) { /* save Length to client_requests */
@@ -274,7 +272,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
wmem_tree_insert32_array(client_requests, key, client_request);
}
- if (!pinfo->fd->flags.visited && (length == -1 || (client_request && client_request->service_in == -1 && tvb_length_remaining(tvb, offset) > 0))) { /* save Service to client_requests */
+ if (!pinfo->fd->flags.visited && (length == -1 || (client_request && client_request->service_in == -1 && tvb_reported_length_remaining(tvb, offset) > 0))) { /* save Service to client_requests */
if (!client_request) {
if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID)
wireshark_interface_id = pinfo->phdr->interface_id;
@@ -300,21 +298,20 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
}
- if (!client_request_service && tvb_length_remaining(tvb, offset) > 0) {
+ if (!client_request_service && tvb_reported_length_remaining(tvb, offset) > 0) {
col_append_fstr(pinfo->cinfo, COL_INFO, " Unknown service");
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
- } else if (tvb_length_remaining(tvb, offset) > 0) {
+ } else if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_item(main_tree, hf_service, tvb, offset, -1, ENC_NA | ENC_ASCII);
- service = (guint8 *) wmem_alloc(wmem_packet_scope(), tvb_length_remaining(tvb, offset) + 1);
- tvb_memcpy(tvb, service, offset, tvb_length_remaining(tvb, offset));
- service[tvb_length_remaining(tvb, offset)] = '\0';
+ service = (guint8 *) wmem_alloc(wmem_packet_scope(), tvb_reported_length_remaining(tvb, offset) + 1);
+ tvb_memcpy(tvb, service, offset, tvb_reported_length_remaining(tvb, offset));
+ service[tvb_reported_length_remaining(tvb, offset)] = '\0';
col_append_fstr(pinfo->cinfo, COL_INFO, " Service=<%s>", service);
-
- offset += tvb_length_remaining(tvb, offset);
}
+ offset = tvb_captured_length(tvb);
+
} else if (pinfo->srcport == server_port) { /* Server sent to Client */
guint32 wireshark_interface_id = 0;
guint8 *service = SERVICE_NONE;
@@ -358,9 +355,8 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (!service) {
col_append_fstr(pinfo->cinfo, COL_INFO, " Unknown service");
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
- return offset;
+ return tvb_captured_length(tvb);
}
if (response_frame == -1 || response_frame == (gint64) pinfo->fd->num) {
@@ -387,7 +383,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
col_append_fstr(pinfo->cinfo, COL_INFO, " Service=<%s>", service);
- if (tvb_length_remaining(tvb, offset) <= 0) return offset;
+ if (tvb_reported_length_remaining(tvb, offset) <= 0) return offset;
if (!pinfo->fd->flags.visited && client_request && client_request->data_in == -1) {
client_request->data_in = pinfo->fd->num;
@@ -396,13 +392,12 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (status == STATUS_FAIL) {
sub_item = proto_tree_add_item(main_tree, hf_fail_reason, tvb, offset, -1, ENC_NA | ENC_ASCII);
- if (length < tvb_length_remaining(tvb, offset)) {
+ if (length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info(pinfo, sub_item, &ei_incomplete_message);
}
- col_append_fstr(pinfo->cinfo, COL_INFO, " Fail=<%s>", tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII));
- offset = tvb_length(tvb);
- return offset;
+ col_append_fstr(pinfo->cinfo, COL_INFO, " Fail=<%s>", tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII));
+ return tvb_captured_length(tvb);
}
if (g_strcmp0(service, "host:version") == 0) {
@@ -430,7 +425,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset = dissect_ascii_data_length(main_tree, tvb, offset, &data_length);
sub_item = proto_tree_add_item(main_tree, hf_devices, tvb, offset, -1, ENC_NA | ENC_ASCII);
- if (data_length < tvb_length_remaining(tvb, offset)) {
+ if (data_length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info(pinfo, sub_item, &ei_incomplete_message);
}
} else if (g_strcmp0(service, "host:get-state") == 0 ||
@@ -443,7 +438,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset = dissect_ascii_data_length(main_tree, tvb, offset, &data_length);
sub_item = proto_tree_add_item(main_tree, hf_result, tvb, offset, -1, ENC_NA | ENC_ASCII);
- if (data_length < tvb_length_remaining(tvb, offset)) {
+ if (data_length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info(pinfo, sub_item, &ei_incomplete_message);
}
} else if (g_str_has_prefix(service, "framebuffer:")) {
@@ -509,7 +504,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset += 4;
}
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_item *pixel_item;
proto_tree *pixel_tree;
@@ -524,8 +519,8 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
client_request->data.framebuffer_data->red_offset == 11 &&
client_request->data.framebuffer_data->green_offset == 5 &&
client_request->data.framebuffer_data->blue_offset == 0) {
- while (tvb_length_remaining(tvb, offset) > 0) {
- if (tvb_length_remaining(tvb, offset) < 2) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) < 2) {
proto_tree_add_item(main_tree, hf_fragment, tvb, offset, -1, ENC_NA);
offset += 1;
}
@@ -544,10 +539,10 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
client_request->data.framebuffer_data->blue_length == 8 &&
(client_request->data.framebuffer_data->alpha_length == 0 ||
client_request->data.framebuffer_data->alpha_length == 8)) {
- while (tvb_length_remaining(tvb, offset) > 0) {
- if (tvb_length_remaining(tvb, offset) < 3 || (tvb_length_remaining(tvb, offset) < 4 && client_request->data.framebuffer_data->alpha_offset > 0)) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) < 3 || (tvb_reported_length_remaining(tvb, offset) < 4 && client_request->data.framebuffer_data->alpha_offset > 0)) {
proto_tree_add_item(main_tree, hf_fragment, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
break;
}
@@ -569,10 +564,10 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset += 3;
}
} else {
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
}
} else {
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
}
}
} else if (g_strcmp0(service, "track-jdwp") == 0) {
@@ -580,13 +575,13 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset = dissect_ascii_data_length(main_tree, tvb, offset, &data_length);
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
sub_item = proto_tree_add_item(main_tree, hf_pids, tvb, offset, -1, ENC_NA | ENC_ASCII);
- if (data_length < tvb_length_remaining(tvb, offset)) {
+ if (data_length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info(pinfo, sub_item, &ei_incomplete_message);
}
}
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
} else if ((g_strcmp0(service, "shell:export ANDROID_LOG_TAGS=\"\" ; exec logcat -B") == 0) ||
(g_strcmp0(service, "shell:logcat -B") == 0)) {
tvbuff_t *next_tvb;
@@ -627,7 +622,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
}
- size += tvb_length_remaining(tvb, i_offset);
+ size += tvb_reported_length_remaining(tvb, i_offset);
if (size > 0) {
buffer = (guint8 *) wmem_alloc(pinfo->pool, size);
if (fragment && i_char > 0)
@@ -642,12 +637,12 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
i_offset += 1;
old_offset = i_offset;
- while (tvb_length_remaining(tvb, i_offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, i_offset) > 0) {
c2 = tvb_get_guint8(tvb, i_offset);
if (c1 == '\r' && c2 == '\n') {
buffer[i_char] = c2;
- if (tvb_length_remaining(tvb, i_offset) > 1) {
+ if (tvb_reported_length_remaining(tvb, i_offset) > 1) {
c1 = tvb_get_guint8(tvb, i_offset + 1);
i_offset += 2;
i_char += 1;
@@ -664,10 +659,10 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
i_offset += 1;
}
- if (tvb_length_remaining(tvb, old_offset) == 0) {
+ if (tvb_reported_length_remaining(tvb, old_offset) == 0) {
buffer[i_char] = c1;
i_char += 1;
- } else if (tvb_length_remaining(tvb, old_offset) > 0) {
+ } else if (tvb_reported_length_remaining(tvb, old_offset) > 0) {
buffer[i_char] = c2;
i_char += 1;
}
@@ -676,8 +671,8 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
add_new_data_source(pinfo, next_tvb, "Logcat");
i_offset = 0;
- while (tvb_length_remaining(next_tvb, i_offset) > 0) {
- if (tvb_length_remaining(next_tvb, i_offset) >= 4) {
+ while (tvb_reported_length_remaining(next_tvb, i_offset) > 0) {
+ if (tvb_reported_length_remaining(next_tvb, i_offset) >= 4) {
payload_length = tvb_get_letohs(next_tvb, i_offset);
try_header_size = tvb_get_letohs(next_tvb, i_offset + 2);
@@ -687,7 +682,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
logcat_length = payload_length + 24;
}
- if (tvb_length_remaining(next_tvb, i_offset) >= 4 && tvb_length_remaining(next_tvb, i_offset) >= logcat_length) {
+ if (tvb_reported_length_remaining(next_tvb, i_offset) >= 4 && tvb_reported_length_remaining(next_tvb, i_offset) >= logcat_length) {
new_tvb = tvb_new_subset_length(next_tvb, i_offset, logcat_length);
call_dissector(logcat_handle, new_tvb, pinfo, main_tree);
@@ -711,7 +706,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
fragment = wmem_new(wmem_file_scope(), fragment_t);
- fragment->length = tvb_length_remaining(next_tvb, i_offset);
+ fragment->length = tvb_captured_length_remaining(next_tvb, i_offset);
fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length);
tvb_memcpy(next_tvb, fragment->data, i_offset, fragment->length);
fragment->reassembled_in_frame = -1;
@@ -720,33 +715,33 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
proto_tree_add_item(main_tree, hf_fragment, next_tvb, i_offset, -1, ENC_NA);
- i_offset = tvb_length(next_tvb);
+ i_offset = tvb_captured_length(next_tvb);
}
}
}
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
} else if (g_str_has_prefix(service, "shell:")) {
proto_tree_add_item(main_tree, hf_stdout, tvb, offset, -1, ENC_NA | ENC_ASCII);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
} else if (g_str_has_prefix(service, "jdwp:")) {
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
} else if (g_str_has_prefix(service, "sync:")) {
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
} else if (g_strcmp0(service, "host:list-forward") == 0 ||
g_str_has_prefix(service, "root:") ||
g_str_has_prefix(service, "remount:") ||
g_str_has_prefix(service, "tcpip:") ||
g_str_has_prefix(service, "usb:")) {
- if (tvb_length_remaining(tvb, offset)) {
+ if (tvb_reported_length_remaining(tvb, offset)) {
proto_tree_add_item(main_tree, hf_result, tvb, offset, -1, ENC_NA | ENC_ASCII);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
}
} else {
proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
}
} else {
@@ -759,7 +754,7 @@ dissect_adb_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, next_tvb, pinfo, main_tree);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_captured_length_remaining(tvb, offset);
}
return offset;
diff --git a/epan/dissectors/packet-adwin-config.c b/epan/dissectors/packet-adwin-config.c
index 4230f8e9fe..a070dec911 100644
--- a/epan/dissectors/packet-adwin-config.c
+++ b/epan/dissectors/packet-adwin-config.c
@@ -362,10 +362,10 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
offset += 4;
proto_tree_add_item(adwin_tree, hf_adwin_config_unused, tvb, offset, 128, ENC_NA);
offset += 128;
- length = tvb_length(tvb) - offset;
+ length = tvb_captured_length_remaining(tvb, offset);
proto_tree_add_item(adwin_tree, hf_adwin_config_data, tvb, offset, length, ENC_NA);
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
/* 00:50:c2:0a:2*:** */
diff --git a/epan/dissectors/packet-adwin.c b/epan/dissectors/packet-adwin.c
index 194d8eb44b..7bb06b3429 100644
--- a/epan/dissectors/packet-adwin.c
+++ b/epan/dissectors/packet-adwin.c
@@ -439,7 +439,7 @@ static const value_string packet_type_mapping[] = {
static value_string_ext packet_type_mapping_ext = VALUE_STRING_EXT_INIT(packet_type_mapping);
#define SET_PACKET_TYPE(tree, type) \
- proto_tree_add_int(tree, hf_adwin_packet_type, tvb, 0, tvb_length(tvb), type);
+ proto_tree_add_int(tree, hf_adwin_packet_type, tvb, 0, tvb_captured_length(tvb), type);
/* Initialize the protocol and registered fields */
diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c
index 926eb2674c..a4a0615f09 100644
--- a/epan/dissectors/packet-afp.c
+++ b/epan/dissectors/packet-afp.c
@@ -5224,7 +5224,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (!request_val) { /* missing request */
col_set_str(pinfo->cinfo, COL_INFO, "[Reply without query?]");
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
afp_command = request_val->command;
@@ -5254,7 +5254,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
col_set_str(pinfo->cinfo, COL_INFO,
"[Error!IP port reused, you need to split the capture file]");
expert_add_info(pinfo, ti, &ei_afp_ip_port_reused);
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
/*
@@ -5496,7 +5496,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (!len) {
/* for some calls if the reply is an error there's no data
*/
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
switch (afp_command) {
@@ -5597,7 +5597,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
pinfo, afp_tree);
}
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
static void afp_reinit( void)
diff --git a/epan/dissectors/packet-afs.c b/epan/dissectors/packet-afs.c
index 0d332db4d7..b9aba67e96 100644
--- a/epan/dissectors/packet-afs.c
+++ b/epan/dissectors/packet-afs.c
@@ -916,7 +916,7 @@ static const fragment_items afs_frag_items = {
} else { \
if ( ! seen_null ) { \
proto_tree_add_text(tree, tvb, offset, \
- tvb_length_remaining(tvb, offset), \
+ tvb_captured_length_remaining(tvb, offset), \
"Null Interface Addresses"); \
seen_null = 1; \
} \
@@ -971,7 +971,7 @@ static const fragment_items afs_frag_items = {
offset += bytes;
/* Raw data - to end of frame */
-#define OUT_BYTES_ALL(field) OUT_BYTES(field, tvb_length_remaining(tvb,offset))
+#define OUT_BYTES_ALL(field) OUT_BYTES(field, tvb_captured_length_remaining(tvb,offset))
/* Raw data */
#define OUT_BYTES(field, bytes) \
@@ -1025,7 +1025,7 @@ static const fragment_items afs_frag_items = {
OUT_RXString(hf_afs_kauth_realm); \
}
-#define GETSTR (tvb_format_text(tvb,offset,tvb_length_remaining(tvb,offset)))
+#define GETSTR (tvb_format_text(tvb,offset,tvb_captured_length_remaining(tvb,offset)))
#define VALID_OPCODE(opcode) ((opcode >= OPCODE_LOW && opcode <= OPCODE_HIGH) || \
(opcode >= VOTE_LOW && opcode <= VOTE_HIGH) || \
@@ -1828,7 +1828,7 @@ dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
frag_msg = fragment_add_seq_check(&afs_reassembly_table,
tvb, offset, pinfo, afs_seqid, NULL,
- rxinfo->seq-1, tvb_length_remaining(tvb, offset),
+ rxinfo->seq-1, tvb_captured_length_remaining(tvb, offset),
! ( rxinfo->flags & RX_LAST_PACKET ) );
new_tvb = process_reassembled_data( tvb, offset, pinfo, "Reassembled RX", frag_msg,
@@ -1840,7 +1840,7 @@ dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
col_append_str(pinfo->cinfo, COL_INFO, " [AFS reassembled]");
} else {
col_set_str(pinfo->cinfo, COL_INFO, "[AFS segment of a reassembled PDU]");
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
}
@@ -1917,7 +1917,7 @@ dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
}
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
diff --git a/epan/dissectors/packet-agentx.c b/epan/dissectors/packet-agentx.c
index 7fadcb8c05..7982f5fa01 100644
--- a/epan/dissectors/packet-agentx.c
+++ b/epan/dissectors/packet-agentx.c
@@ -914,7 +914,7 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
break;
}
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
static int
@@ -922,13 +922,9 @@ dissect_agentx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 20, get_agentx_pdu_len,
dissect_agentx_pdu, data);
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
-static const true_false_string tfs_agentx_include = { "Yes", "No" };
-static const true_false_string tfs_agentx_register = { "Yes", "No" };
-static const true_false_string tfs_agentx_newindex = { "Yes", "No" };
-static const true_false_string tfs_agentx_anyindex = { "Yes", "No" };
static const true_false_string tfs_agentx_context = { "Provided", "None" };
static const true_false_string tfs_agentx_byteorder = { "MSB (network order)", "LSB" };
@@ -952,15 +948,15 @@ proto_register_agentx(void)
#endif
{ &hf_flags_register,
- { "Register", "agentx.flags.register", FT_BOOLEAN, 8, TFS(&tfs_agentx_register),
+ { "Register", "agentx.flags.register", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
INSTANCE_REGISTRATION, "Instance Registration", HFILL }},
{ &hf_flags_newindex,
- { "New Index", "agentx.flags.newindex", FT_BOOLEAN, 8, TFS(&tfs_agentx_newindex),
+ { "New Index", "agentx.flags.newindex", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
NEW_INDEX, "New Index Requested", HFILL }},
{ &hf_flags_anyindex,
- { "Any Index", "agentx.flags.anyindex", FT_BOOLEAN, 8, TFS(&tfs_agentx_anyindex),
+ { "Any Index", "agentx.flags.anyindex", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
ANY_INDEX, "Any Index Requested", HFILL }},
{ &hf_flags_context,
@@ -1004,7 +1000,7 @@ proto_register_agentx(void)
NULL, HFILL }},
{ &hf_oid_include,
- { "OID include", "agentx.oid_include", FT_BOOLEAN, 8, TFS(&tfs_agentx_include),
+ { "OID include", "agentx.oid_include", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
OID_IS_INCLUSIVE, NULL, HFILL }},
{ &hf_oid_str,
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index f1d83795a9..ed7b7f29b7 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -463,12 +463,12 @@ mp2t_get_packet_length(tvbuff_t *tvb, guint offset, packet_info *pinfo,
gint pkt_len = 0;
guint remaining_len;
- remaining_len = tvb_length_remaining(tvb, offset);
frag = fragment_get(&mp2t_reassembly_table, pinfo, frag_id, NULL);
if (frag)
frag = frag->next;
if (!frag) { /* First frame */
+ remaining_len = tvb_reported_length_remaining(tvb, offset);
if ( (pload_type == pid_pload_docsis && remaining_len < 4) ||
(pload_type == pid_pload_sect && remaining_len < 3) ||
(pload_type == pid_pload_pes && remaining_len < 5) ) {
@@ -1207,7 +1207,7 @@ heur_dissect_mp2t( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
gint length;
guint offset = 0;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length == 0) {
/* Nothing to check for */
return FALSE;
diff --git a/epan/dissectors/packet-ses.c b/epan/dissectors/packet-ses.c
index 3aa9005262..e39fb1abb1 100644
--- a/epan/dissectors/packet-ses.c
+++ b/epan/dissectors/packet-ses.c
@@ -1157,7 +1157,7 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
* No more SPDUs to dissect. Set the offset to the
* end of the tvbuff.
*/
- offset = tvb_length(tvb);
+ offset = tvb_captured_length(tvb);
if (session.rtse_reassemble && type == SES_DATA_TRANSFER) {
ses_pres_ctx_id = session.pres_ctx_id;
ses_rtse_reassemble = TRUE;
@@ -1937,7 +1937,7 @@ dissect_ses_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
guint16 len;
/* first, check do we have at least 4 bytes (type+length) */
- if (tvb_length(tvb) < 2)
+ if (tvb_captured_length(tvb) < 2)
return FALSE; /* no */
/* can we recognize session PDU ? Return FALSE if not */
@@ -1965,7 +1965,7 @@ dissect_ses_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
* misinterpreted as SES.
* the starter in this case is fixed to 0x32 (SES_MINOR_SYNC_ACK for SES),
* so if the parameter type is unknown, it's probably SIMATIC */
- if(type == 0x32 && tvb_length(tvb) >= 3) {
+ if(type == 0x32 && tvb_captured_length(tvb) >= 3) {
type = tvb_get_guint8(tvb, offset+2);
if (try_val_to_str(type, param_vals) == NULL) {
return FALSE; /* it's probably a SIMATIC protocol */
@@ -1979,11 +1979,11 @@ dissect_ses_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
/* add header length */
len+=len_len;
/* do we have enough bytes ? */
- if (tvb_length(tvb) < len)
+ if (tvb_reported_length(tvb) < len)
return FALSE; /* no */
/* final check to see if the next SPDU, if present, is also valid */
- if (tvb_length(tvb) > 1+(guint) len) {
+ if (tvb_captured_length(tvb) > 1+(guint) len) {
type = tvb_get_guint8(tvb, offset + len + 1);
/* check SPDU type */
if (try_val_to_str(type, ses_vals) == NULL) {
diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c
index 405ca6d188..85fa347623 100644
--- a/epan/dissectors/packet-zbee-zdp.c
+++ b/epan/dissectors/packet-zbee-zdp.c
@@ -381,7 +381,7 @@ void
zdp_dump_excess(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree)
{
proto_tree *root = proto_tree_get_root(tree);
- guint length = tvb_length_remaining(tvb, offset);
+ guint length = tvb_captured_length_remaining(tvb, offset);
tvbuff_t *excess;
if (length > 0) {
@@ -1029,7 +1029,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
nwk = (zbee_nwk_packet *)data;
/* Create the protocol tree. */
- proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_length(tvb), "ZigBee Device Profile");
+ proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_captured_length(tvb), "ZigBee Device Profile");
zdp_tree = proto_item_add_subtree(proto_root, ett_zbee_zdp);
#if 0
@@ -1314,7 +1314,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
break;
} /* switch */
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
} /* dissect_zbee_zdp */
/*FUNCTION:------------------------------------------------------
diff --git a/epan/dissectors/packet-zep.c b/epan/dissectors/packet-zep.c
index 59852b9d7a..7c2c793722 100644
--- a/epan/dissectors/packet-zep.c
+++ b/epan/dissectors/packet-zep.c
@@ -160,7 +160,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
#endif
- if(ieee_packet_len < tvb_length(tvb)-zep_header_len){
+ if(ieee_packet_len < tvb_reported_length(tvb)-zep_header_len){
/* Packet's length is mis-reported, abort dissection */
call_dissector(data_handle, tvb, pinfo, tree);
return;
diff --git a/epan/dissectors/packet-ziop.c b/epan/dissectors/packet-ziop.c
index f7e93f266e..abac667c69 100644
--- a/epan/dissectors/packet-ziop.c
+++ b/epan/dissectors/packet-ziop.c
@@ -215,14 +215,14 @@ dissect_ziop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void*
if (tvb_get_ntohl(tvb, 0) == GIOP_MAGIC_NUMBER)
{
dissect_giop(tvb, pinfo, tree);
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
return 0;
}
tcp_dissect_pdus(tvb, pinfo, tree, ziop_desegment, ZIOP_HEADER_SIZE,
get_ziop_pdu_len, dissect_ziop, data);
- return tvb_length(tvb);
+ return tvb_captured_length(tvb);
}
@@ -234,7 +234,7 @@ dissect_ziop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
conversation_t *conversation;
/* check magic number and version */
- tot_len = tvb_length(tvb);
+ tot_len = tvb_captured_length(tvb);
if (tot_len < ZIOP_HEADER_SIZE) /* tot_len < 12 */
{