aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-ncp2222.inc68
-rw-r--r--epan/tvbuff.h6
-rwxr-xr-xtools/checkAPIs.pl1
-rw-r--r--ui/gtk/packet_panes.c2
-rw-r--r--ui/tap_export_pdu.c4
5 files changed, 37 insertions, 44 deletions
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc
index 1e02147afb..848e94326f 100644
--- a/epan/dissectors/packet-ncp2222.inc
+++ b/epan/dissectors/packet-ncp2222.inc
@@ -2421,7 +2421,7 @@ static void free_proto_tree(void *tree)
static guint32
align_4(tvbuff_t *tvb, guint32 aoffset)
{
- if(tvb_length_remaining(tvb, aoffset) > 4 )
+ if(tvb_captured_length_remaining(tvb, aoffset) > 4 )
{
return (aoffset%4);
}
@@ -2437,7 +2437,7 @@ get_string(tvbuff_t* tvb, guint offset, guint str_length)
gint length_remaining = 0;
gint max_length = (str_length < NW_UNI_MAX) ? str_length : NW_UNI_MAX;
- length_remaining = tvb_length_remaining(tvb, offset);
+ length_remaining = tvb_captured_length_remaining(tvb, offset);
if((gint)str_length > length_remaining)
{
THROW(ReportedBoundsError);
@@ -3062,7 +3062,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val
break;
case 0x00000009: /* Binary String */
value1 = tvb_get_letohl(tvb, voffset); /* length of field */
- length_remaining = tvb_length_remaining(tvb, voffset);
+ length_remaining = tvb_captured_length_remaining(tvb, voffset);
if(length_remaining == -1 || value1 > (guint32) length_remaining)
{
break;
@@ -3075,7 +3075,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val
break;
case 0x0000000d: /* Binary String List */
value1 = tvb_get_letohl(tvb, voffset); /* Overall length of field list */
- length_remaining = tvb_length_remaining(tvb, voffset);
+ length_remaining = tvb_captured_length_remaining(tvb, voffset);
if(length_remaining == -1 || value1 > (guint32) length_remaining)
{
break;
@@ -3087,7 +3087,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val
for (r=1; r<=number_of_items; r++)
{
value1 = tvb_get_letohl(tvb, voffset); /* length of field */
- length_remaining = tvb_length_remaining(tvb, voffset);
+ length_remaining = tvb_captured_length_remaining(tvb, voffset);
if(length_remaining == -1 || value1 > (guint32) length_remaining)
{
break;
@@ -3101,7 +3101,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val
break;
case 0x00000015: /* Stream */
value1 = tvb_get_letohl(tvb, voffset); /* length of field */
- length_remaining = tvb_length_remaining(tvb, voffset);
+ length_remaining = tvb_captured_length_remaining(tvb, voffset);
if(length_remaining == -1 || value1 > (guint32) length_remaining)
{
break;
@@ -3251,7 +3251,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val
for (r=1; r <= number_of_items; r++)
{
/* Trap for end of packet */
- if(tvb_length_remaining(tvb, voffset)<12)
+ if(tvb_captured_length_remaining(tvb, voffset)<12)
{
THROW(ReportedBoundsError);
}
@@ -4166,7 +4166,7 @@ process_search_expression(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values)
break;
default: /* Unknown Iteration search Item type */
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
}
break;
@@ -4198,7 +4198,7 @@ process_search_subexpression(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pi
process_set_filter(it_subtree1, tvb, pinfo, values);
ioffset = values->voffset;
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
break;
}
@@ -4294,7 +4294,7 @@ process_set_filter(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, nds_v
process_search_subexpression(it_tree, tvb, pinfo, values);
break;
default: /* Unknown Iteration search type */
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
}
break;
@@ -4778,7 +4778,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui
#if 0
ioffset += align_4(tvb, ioffset);
#endif
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
return;
}
@@ -4820,7 +4820,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui
ioffset += align_4(tvb, ioffset);
break;
default:
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
}
return;
@@ -4895,7 +4895,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui
/* For now we will just skip this offset. NEED TO ADD LOGIC TO HANDLE */
ioffset += 8;
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
break;
}
}
@@ -4925,7 +4925,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui
ioffset += 4;
break;
default:
- if (tvb_length_remaining(tvb, ioffset) < 4) {
+ if (tvb_captured_length_remaining(tvb, ioffset) < 4) {
THROW(ReportedBoundsError);
}
return;
@@ -4933,7 +4933,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui
}
it_verb = tvb_get_letohl(tvb, ioffset);
ioffset += 4;
- if (it_verb == IT_DONE || tvb_length_remaining(tvb, ioffset) < 4) {
+ if (it_verb == IT_DONE || tvb_captured_length_remaining(tvb, ioffset) < 4) {
verb_string = val_to_str_const(it_verb, iterator_subverbs, "Internal error processing NDS iteration verbs");
proto_tree_add_uint_format(it_tree, hf_ncp_nds_iterverb, tvb, ioffset-4, 4,
it_verb, "Iterator Verb: %d, (0x%04x), %s",
@@ -5160,7 +5160,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
2, event_num);
ioffset = ioffset + 2;
value5 = tvb_get_letohl(tvb, ioffset); /* length of field */
- if(value5 > tvb_length_remaining(tvb, ioffset))
+ if(value5 > tvb_captured_length_remaining(tvb, ioffset))
{
break;
}
@@ -5431,12 +5431,12 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
}
bvalue = bvalue*2;
ioffset += align_4(tvb, ioffset);
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -5946,12 +5946,12 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
if (bvalue==0) {
break;
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6016,7 +6016,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
if(values->vflags != 5)
{
value1 = tvb_get_letohl(tvb, ioffset); /* length of field */
- length_remaining = tvb_length_remaining(tvb, ioffset);
+ length_remaining = tvb_captured_length_remaining(tvb, ioffset);
if(length_remaining == -1 || value1 > (guint32) length_remaining)
{
break;
@@ -6103,7 +6103,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
value2, temp_values.vstring);
ioffset = ioffset + value2;
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6178,7 +6178,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
4, value1, "Default ACL %08x", value1);
ioffset = ioffset + 4;
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6293,7 +6293,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
4, value1, "Default ACL %08x", value1);
ioffset = ioffset + 4;
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6313,7 +6313,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
value1, values->vstring);
ioffset = ioffset + value1;
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6332,7 +6332,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
value2, values->vstring);
ioffset = ioffset + value2;
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6363,7 +6363,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
4, value1, "Privileges 0x%08x", value1);
ioffset = ioffset + 4;
}
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6602,7 +6602,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
value3, values->vstring);
ioffset = ioffset + value3;
- if(tvb_length_remaining(tvb, ioffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, ioffset) < 4 )
{
break;
}
@@ -6645,7 +6645,7 @@ dissect_ncp_89_6_request(tvbuff_t *tvb, proto_tree *volatile ncp_tree, guint32 o
proto_tree_add_item(ncp_tree, hf_ncp_directory_path, tvb, offset+2, string_len-2, TRUE);
}
offset += string_len;
- if(tvb_length_remaining(tvb, offset) < 4 )
+ if(tvb_captured_length_remaining(tvb, offset) < 4 )
{
break;
}
@@ -6723,7 +6723,7 @@ dissect_ncp_123_17_reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree)
break;
}
proto_item_set_end(aitem, tvb, loffset);
- if(tvb_length_remaining(tvb, loffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, loffset) < 4 )
{
break;
}
@@ -7079,7 +7079,7 @@ dissect_ncp_8x20reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree,
proto_item_set_end(aitem, tvb, loffset);
- if(tvb_length_remaining(tvb, loffset) < 4 )
+ if(tvb_captured_length_remaining(tvb, loffset) < 4 )
{
break;
}
@@ -7456,7 +7456,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
/* Determine which ncp_record to use. */
switch (type) {
case NCP_ALLOCATE_SLOT:
- length_remaining = tvb_length_remaining(tvb, 4);
+ length_remaining = tvb_captured_length_remaining(tvb, 4);
if (length_remaining > 4)
{
testvar = tvb_get_ntohl(tvb, 4);
@@ -9124,7 +9124,7 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
* is 0, as we checked it above. Is there any
* reason why we'd want to do a full dissection
* if the completion code isn't 0? */
- if (completion_code != 0 && tvb_length(tvb) == 8) {
+ if (completion_code != 0 && tvb_captured_length(tvb) == 8) {
return;
}
@@ -9176,7 +9176,7 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
/* Check to see if we need to report to the expert table */
trap_for_expert_event(ncp_tree, pinfo, ncp_rec, 1);
} else {
- if (tvb_length(tvb) > 8) {
+ if (tvb_reported_length(tvb) > 8) {
expert_item = proto_tree_add_text(ncp_tree, tvb, 8, -1,
"No request record found. Parsing is impossible.");
if (ncp_echo_err) {
diff --git a/epan/tvbuff.h b/epan/tvbuff.h
index cb931d0362..74e0a7e2fc 100644
--- a/epan/tvbuff.h
+++ b/epan/tvbuff.h
@@ -225,18 +225,12 @@ WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb);
* length of the packet). You probably want tvb_reported_length instead. */
WS_DLL_PUBLIC guint tvb_captured_length(const tvbuff_t *tvb);
-/* DEPRECATED, do not use in new code, call tvb_captured_length directly! */
-#define tvb_length tvb_captured_length
-
/** Computes bytes to end of buffer, from offset (which can be negative,
* to indicate bytes from end of buffer). Function returns 0 if offset is
* either at the end of the buffer or out of bounds. No exception is thrown.
* You probably want tvb_reported_length_remaining instead. */
WS_DLL_PUBLIC gint tvb_captured_length_remaining(const tvbuff_t *tvb, const gint offset);
-/* DEPRECATED, do not use in new code, call tvb_captured_length_remaining directly! */
-#define tvb_length_remaining tvb_captured_length_remaining
-
/** Same as above, but throws an exception if the offset is out of bounds. */
WS_DLL_PUBLIC guint tvb_ensure_captured_length_remaining(const tvbuff_t *tvb,
const gint offset);
diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl
index 79471c563f..7527141817 100755
--- a/tools/checkAPIs.pl
+++ b/tools/checkAPIs.pl
@@ -143,7 +143,6 @@ my %APIs = (
# have not been entirely removed from old code. These will become errors
# once they've been removed from all existing code.
'soft-deprecated' => { 'count_errors' => 0, 'functions' => [
- 'tvb_length', # replaced with tvb_captured_length
'tvb_length_remaining', # replaced with tvb_captured_length_remaining
'tvb_ensure_length_remaining', # replaced with tvb_ensure_captured_length_remaining
'tvb_get_string', # replaced with tvb_get_string_enc
diff --git a/ui/gtk/packet_panes.c b/ui/gtk/packet_panes.c
index 93caff2cad..71de45a3b6 100644
--- a/ui/gtk/packet_panes.c
+++ b/ui/gtk/packet_panes.c
@@ -121,7 +121,7 @@ get_byte_view_data_and_length(GtkWidget *byte_view, guint *data_len)
if (byte_view_tvb == NULL)
return NULL;
- if ((*data_len = tvb_length(byte_view_tvb))) {
+ if ((*data_len = tvb_captured_length(byte_view_tvb))) {
data_ptr = tvb_get_ptr(byte_view_tvb, 0, -1);
return data_ptr;
} else
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index a08f78f260..c47f15367b 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -57,8 +57,8 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
memcpy(packet_buf, exp_pdu_data->tlv_buffer, exp_pdu_data->tlv_buffer_len);
g_free(exp_pdu_data->tlv_buffer);
}
- if(exp_pdu_data->tvb_length > 0){
- tvb_memcpy(exp_pdu_data->pdu_tvb, packet_buf+exp_pdu_data->tlv_buffer_len, 0, exp_pdu_data->tvb_length);
+ if(exp_pdu_data->tvb_captured_length > 0){
+ tvb_memcpy(exp_pdu_data->pdu_tvb, packet_buf+exp_pdu_data->tlv_buffer_len, 0, exp_pdu_data->tvb_captured_length);
}
pkthdr.rec_type = REC_TYPE_PACKET;
pkthdr.ts.secs = pinfo->fd->abs_ts.secs;