aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff-int.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-20 02:53:57 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-20 02:53:57 +0000
commit0efcd0632b5635d420652497d70063a0688ce1b1 (patch)
treee3101bf7dcc6871ceba878e70f34de8539eebe6b /epan/tvbuff-int.h
parent5524d0f8011145803d7b469e72f51214e2719c0e (diff)
When we're dissecting the beginning of a fragmented packet that we
haven't reassembled, we're probably moving sequentially through the packet, which means that we'll run past the end of the fragment rather than past the end of what would have been the reassembled packet had we reassembled it. I.e., there's little reason to care whether we're past the end of the fragment but not past the end of the packet, or whether we're past the end of the packet; in either case, we're past the end of the fragment, and if somebody wants to know whether the packet is malformed by stopping short of certain fields, they should enable reassembly. So we get rid of the explicit fragment length in tvbuffs and, instead, have a "this is a fragment" flag; if that flag is set, we throw FragmentBoundsError rather than ReportedBoundsError if we run past the end of the reported data. (This also means we could flag the tvbuff even if we don't know how large the reassembled packet will be, e.g. when doing IP reassembly.) Replace tvb_new_subset_length_fragment() with tvb_new_subset_length() and a new "set the "this is a fragment flag"" routine. svn path=/trunk/; revision=48940
Diffstat (limited to 'epan/tvbuff-int.h')
-rw-r--r--epan/tvbuff-int.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/tvbuff-int.h b/epan/tvbuff-int.h
index 33057bdd87..6f7e9818a0 100644
--- a/epan/tvbuff-int.h
+++ b/epan/tvbuff-int.h
@@ -48,6 +48,11 @@ typedef struct {
} tvb_comp_t;
+/*
+ * Tvbuff flags.
+ */
+#define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
+
struct tvbuff {
/* Doubly linked list pointers */
tvbuff_t *next;
@@ -56,6 +61,7 @@ struct tvbuff {
/* Record-keeping */
tvbuff_type type;
gboolean initialized;
+ guint flags;
struct tvbuff *ds_tvb; /**< data source top-level tvbuff */
/** TVBUFF_SUBSET and TVBUFF_COMPOSITE keep track
@@ -79,12 +85,6 @@ struct tvbuff {
/** Reported length. */
guint reported_length;
- /* If this tvbuff represents the first fragment of a larger packet
- * that was not reassembled, this is the length of the fragment
- * ("reported_length" will be the length of the full packet).
- */
- guint fragment_length;
-
/* Offset from beginning of first TVBUFF_REAL. */
gint raw_offset;