diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-04-29 21:27:19 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-04-29 21:27:19 +0000 |
commit | 1025817e84e329d32ab0ffb0b81488db1c326103 (patch) | |
tree | 023697e5009882c563216935eee4b494e4f46c9f /epan/proto.c | |
parent | 925a9396fb9fb84ad449236e5ab5e29268a108e7 (diff) |
Add a "proto_item_set_end()" routine that sets the length of an item
given a tvbuff/offset pair referring to the byte past the end of the
item. Use it in one place in the SMB dissector (there are plenty of
other places where it could be used as well).
svn path=/trunk/; revision=7603
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c index 874d929130..5a455ef889 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.82 2003/02/08 04:22:30 gram Exp $ + * $Id: proto.c,v 1.83 2003/04/29 21:27:14 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1945,6 +1945,25 @@ proto_item_set_len(proto_item *pi, gint length) fi->length = length; } +/* + * Sets the length of the item based on its start and on the specified + * offset, which is the offset past the end of the item; as the start + * in the item is relative to the beginning of the data source tvbuff, + * we need to pass in a tvbuff - the end offset is relative to the beginning + * of that tvbuff. + */ +void +proto_item_set_end(proto_item *pi, tvbuff_t *tvb, gint end) +{ + field_info *fi; + + if (pi == NULL) + return; + fi = PITEM_FINFO(pi); + end += tvb_raw_offset(tvb); + fi->length = end - fi->start; +} + int proto_item_get_len(proto_item *pi) { |