diff options
author | John Thacker <johnthacker@gmail.com> | 2022-11-12 10:23:01 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2022-11-14 01:18:11 +0000 |
commit | 4f3b028d941d7270710841f19800c33301baf18e (patch) | |
tree | 13ba8ec9882845aee1510eb22da2db797505802b /epan/reassemble.h | |
parent | 0bfdd0d954f0ad3ab57af99d09f3dee55f4cf851 (diff) |
epan: Separate fragment_head and fragment_item
Separate fragment_head and fragment_item into two
different types of structs.
Remove "offset" from fragment_head, which was unused,
making fragment heads 4 bytes smaller.
Remove fragment_nr_offset, datalen, reassembled_in,
reas_in_layer_num, and error from fragment_item,
making them 24 bytes smaller.
Change a few dissectors which were using fragment_head
and fragment_item indistinguishably.
Ping #17311
Diffstat (limited to 'epan/reassemble.h')
-rw-r--r-- | epan/reassemble.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/epan/reassemble.h b/epan/reassemble.h index 14a41ebff5..9e97d9bc07 100644 --- a/epan/reassemble.h +++ b/epan/reassemble.h @@ -51,13 +51,25 @@ typedef struct _fragment_item { struct _fragment_item *next; - guint32 frame; /* XXX - does this apply to reassembly heads? */ - guint32 offset; /* XXX - does this apply to reassembly heads? */ - guint32 len; /* XXX - does this apply to reassembly heads? */ + guint32 frame; /**< frame number where the fragment is from */ + guint32 offset; /**< fragment number for FD_BLOCKSEQUENCE, byte + * offset otherwise */ + guint32 len; /**< fragment length */ + guint32 flags; /**< XXX - do some of these apply only to reassembly + * heads and others only to fragments within + * a reassembly? */ + tvbuff_t *tvb_data; +} fragment_item; + +typedef struct _fragment_head { + struct _fragment_item *next; + guint32 frame; /**< maximum of all frame numbers added to reassembly */ + guint32 len; /**< When flags&FD_BLOCKSEQUENCE and FD_DEFRAGMENTED + * are set, the number of bytes of the full datagram. + * Otherwise not valid. */ guint32 fragment_nr_offset; /**< offset for frame numbering, for sequences, where the * provided fragment number of the first fragment does - * not start with 0 - * XXX - does this apply only to reassembly heads? */ + * not start with 0 */ guint32 datalen; /**< When flags&FD_BLOCKSEQUENCE is set, the * index of the last block (segments in * datagram + 1); otherwise the number of @@ -65,11 +77,11 @@ typedef struct _fragment_item { * the first item of the fragments list when * flags&FD_DATALEN is set.*/ guint32 reassembled_in; /**< frame where this PDU was reassembled, - * only valid in the first item of the list - * and when FD_DEFRAGMENTED is set*/ - guint8 reas_in_layer_num; /**< The current "depth" or layer number in the current frame where reassembly was completed. - * Example: in SCTP there can be several data chunks and we want the reassemblied tvb for the final - * segment only. */ + * only valid when FD_DEFRAGMENTED is set */ + guint8 reas_in_layer_num; /**< The current "depth" or layer number in the current + * frame where reassembly was completed. + * Example: in SCTP there can be several data chunks and + * we want the reassemblied tvb for the final segment only. */ guint32 flags; /**< XXX - do some of these apply only to reassembly * heads and others only to fragments within * a reassembly? */ @@ -77,14 +89,9 @@ typedef struct _fragment_item { /** * Null if the reassembly had no error; non-null if it had * an error, in which case it's the string for the error. - * - * XXX - this is wasted in all but the reassembly head; we - * should probably have separate data structures for a - * reassembly and for the fragments in a reassembly. */ const char *error; -} fragment_item, fragment_head; - +} fragment_head; /* * Flags for fragment_add_seq_* @@ -359,7 +366,8 @@ fragment_start_seq_check(reassembly_table *table, const packet_info *pinfo, * Mark end of reassembly and returns the reassembled fragment (if completed). * Use it when fragments were added with "more_flags" set while you discovered * that no more fragments have to be added. - * XXX rename to fragment_finish as it works also for fragment_add? + * This is for fragments added with add_seq_next; it doesn't check for gaps, + * and doesn't set datalen correctly for the fragment_add family. */ WS_DLL_PUBLIC fragment_head * fragment_end_seq_next(reassembly_table *table, const packet_info *pinfo, |