Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
reassemble.h
Go to the documentation of this file.
1
11/* make sure that all flags that are set in a fragment entry is also set for
12 * the flags field of fd_head !!!
13 */
14
15#ifndef REASSEMBLE_H
16#define REASSEMBLE_H
17
18#include "ws_symbol_export.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/* only in fd_head: packet is defragmented */
25#define FD_DEFRAGMENTED 0x0001
26
27/* there are overlapping fragments */
28#define FD_OVERLAP 0x0002
29
30/* overlapping fragments contain different data */
31#define FD_OVERLAPCONFLICT 0x0004
32
33/* more than one fragment which indicates end-of data */
34#define FD_MULTIPLETAILS 0x0008
35
36/* fragment starts before the end of the datagram but extends
37 past the end of the datagram */
38#define FD_TOOLONGFRAGMENT 0x0010
39
40/* fragment tvb is subset, don't tvb_free() it */
41#define FD_SUBSET_TVB 0x0020
42
43/* this flag is used to request fragment_add to continue the reassembly process */
44#define FD_PARTIAL_REASSEMBLY 0x0040
45
46/* fragment offset is indicated by sequence number and not byte offset
47 into the defragmented packet */
48#define FD_BLOCKSEQUENCE 0x0100
49
50/* This flag is set in (only) fd_head to denote that datalen has been set to a valid value.
51 * It's implied by FD_DEFRAGMENTED (we must know the total length of the
52 * datagram if we have defragmented it...)
53 */
54#define FD_DATALEN_SET 0x0400
55
56typedef struct _fragment_item {
57 struct _fragment_item *next;
58 uint32_t frame;
59 uint32_t offset;
61 uint32_t len;
62 uint32_t flags;
65 tvbuff_t *tvb_data;
67
68typedef struct _fragment_head {
69 struct _fragment_item *next;
72 unsigned ref_count;
73 uint32_t contiguous_len;
74 uint32_t frame;
75 uint32_t len;
81 uint32_t datalen;
87 uint32_t reassembled_in;
93 uint32_t flags;
96 tvbuff_t *tvb_data;
101 const char *error;
103
104/*
105 * Flags for fragment_add_seq_*
106 */
107
108/* we don't have any sequence numbers - fragments are assumed to appear in
109 * order */
110#define REASSEMBLE_FLAGS_NO_FRAG_NUMBER 0x0001
111
112/* a special fudge for the 802.11 dissector */
113#define REASSEMBLE_FLAGS_802_11_HACK 0x0002
114
115/*
116 * Flags for fragment_add_seq_single_*
117 */
118
119/* we want to age off old packets */
120#define REASSEMBLE_FLAGS_AGING 0x0001
121
122/*
123 * Generates a fragment identifier based on the given parameters. "data" is an
124 * opaque type whose interpretation is up to the caller of fragment_add*
125 * functions and the fragment key function (possibly NULL if you do not care).
126 *
127 * Keys returned by this function are only used within this packet scope.
128 */
129typedef void * (*fragment_temporary_key)(const packet_info *pinfo,
130 const uint32_t id, const void *data);
131
132/*
133 * Like fragment_temporary_key, but used for identifying reassembled fragments
134 * which may persist through multiple packets.
135 */
136typedef void * (*fragment_persistent_key)(const packet_info *pinfo,
137 const uint32_t id, const void *data);
138
139/*
140 * Data structure to keep track of fragments and reassemblies.
141 */
142typedef struct {
143 GHashTable *fragment_table;
144 GHashTable *reassembled_table;
145 fragment_temporary_key temporary_key_func;
146 fragment_persistent_key persistent_key_func;
147 GDestroyNotify free_temporary_key_func; /* temporary key destruction function */
149
150/*
151 * Table of functions for a reassembly table.
152 */
153typedef struct {
154 /* Functions for fragment table */
155 GHashFunc hash_func; /* hash function */
156 GEqualFunc equal_func; /* comparison function */
157 fragment_temporary_key temporary_key_func; /* temporary key creation function */
158 fragment_persistent_key persistent_key_func; /* persistent key creation function */
159 GDestroyNotify free_temporary_key_func; /* temporary key destruction function */
160 GDestroyNotify free_persistent_key_func; /* persistent key destruction function */
162
163/*
164 * Tables of functions exported for the benefit of dissectors that
165 * don't need special items in their keys.
166 */
167WS_DLL_PUBLIC const reassembly_table_functions
168 addresses_reassembly_table_functions; /* keys have endpoint addresses and an ID */
169WS_DLL_PUBLIC const reassembly_table_functions
170 addresses_ports_reassembly_table_functions; /* keys have endpoint addresses and ports and an ID */
171
172/*
173 * Register a reassembly table. By registering the table with epan, the creation and
174 * destruction of the table can be managed by epan and not the dissector.
175 */
176WS_DLL_PUBLIC void
177reassembly_table_register(reassembly_table *table,
178 const reassembly_table_functions *funcs);
179
180/*
181 * Initialize/destroy a reassembly table.
182 *
183 * init: If table doesn't exist: create table;
184 * else: just remove any entries;
185 * destroy: remove entries and destroy table;
186 */
187WS_DLL_PUBLIC void
188reassembly_table_init(reassembly_table *table,
189 const reassembly_table_functions *funcs);
190WS_DLL_PUBLIC void
191reassembly_table_destroy(reassembly_table *table);
192
193/*
194 * This function adds a new fragment to the reassembly table
195 * If this is the first fragment seen for this datagram, a new entry
196 * is created in the table, otherwise this fragment is just added
197 * to the linked list of fragments for this packet.
198 * The list of fragments for a specific datagram is kept sorted for
199 * easier handling.
200 *
201 * Datagrams (messages) are identified by a key generated by
202 * fragment_temporary_key or fragment_persistent_key, based on the "pinfo", "id"
203 * and "data" pairs. (This is the sole purpose of "data".)
204 *
205 * Fragments are identified by "frag_offset".
206 *
207 * Returns a pointer to the head of the fragment data list if we have all the
208 * fragments, NULL otherwise. Note that the reassembled fragments list may have
209 * a non-zero fragment offset, the only guarantee is that no gaps exist within
210 * the list.
211 *
212 * @note Reused keys are assumed to refer to the same reassembled message
213 * (i.e., retransmission). If the same "id" is used more than once on a
214 * connection, then "data" and custom reassembly_table_functions should be
215 * used so that the keys hash differently.
216 */
217WS_DLL_PUBLIC fragment_head *
218fragment_add(reassembly_table *table, tvbuff_t *tvb, const int offset,
219 const packet_info *pinfo, const uint32_t id, const void *data,
220 const uint32_t frag_offset, const uint32_t frag_data_len,
221 const bool more_frags);
222/*
223 * Like fragment_add, except that the fragment may be added to multiple
224 * reassembly tables. This is needed when multiple protocol layers try
225 * to add the same packet to the reassembly table.
226 */
227WS_DLL_PUBLIC fragment_head *
228fragment_add_multiple_ok(reassembly_table *table, tvbuff_t *tvb,
229 const int offset, const packet_info *pinfo,
230 const uint32_t id, const void *data,
231 const uint32_t frag_offset,
232 const uint32_t frag_data_len,
233 const bool more_frags);
234
235/*
236 * Like fragment_add, except that the fragment may originate from a frame
237 * other than pinfo->num. For use when you are adding an out of order segment
238 * that arrived in an earlier frame, so that show_fragment_tree will display
239 * the correct fragment numbers.
240 *
241 * This is for protocols like TCP, where the correct reassembly to add a
242 * segment to cannot be determined without processing previous segments
243 * in sequence order, including handing them to subdissectors.
244 *
245 * Note that pinfo is still used to set reassembled_in if we have all the
246 * fragments, so that results on subsequent passes can be the same as the
247 * first pass.
248 */
249WS_DLL_PUBLIC fragment_head *
250fragment_add_out_of_order(reassembly_table *table, tvbuff_t *tvb,
251 const int offset, const packet_info *pinfo,
252 const uint32_t id, const void *data,
253 const uint32_t frag_offset,
254 const uint32_t frag_data_len,
255 const bool more_frags, const uint32_t frag_frame);
256/*
257 * Like fragment_add, but maintains a table for completed reassemblies.
258 *
259 * If the packet was seen before, return the head of the fully reassembled
260 * fragments list (NULL if there was none).
261 *
262 * Otherwise (if reassembly was not possible before), try to add the new
263 * fragment to the fragments table. If reassembly is now possible, remove all
264 * (reassembled) fragments from the fragments table and store it as a completed
265 * reassembly. The head of this reassembled fragments list is returned.
266 *
267 * Otherwise (if reassembly is still not possible after adding this fragment),
268 * return NULL.
269 *
270 * @note Completed reassemblies are removed from the in-progress table, so
271 * key can be reused to begin a new reassembled message. Conversely,
272 * dissectors SHOULD NOT call this with a retransmitted fragment of a
273 * completed reassembly. Dissectors atop a reliable protocol like TCP
274 * may assume that the lower layer dissector handles retransmission,
275 * but other dissectors (e.g., atop UDP or Ethernet) will have to handle
276 * that situation themselves.
277 */
278WS_DLL_PUBLIC fragment_head *
279fragment_add_check(reassembly_table *table, tvbuff_t *tvb, const int offset,
280 const packet_info *pinfo, const uint32_t id,
281 const void *data, const uint32_t frag_offset,
282 const uint32_t frag_data_len, const bool more_frags);
283
284/*
285 * Like fragment_add_check, but handles retransmissions after reassembly.
286 *
287 * Start new reassembly only if there is no reassembly in progress and there
288 * is no completed reassembly reachable from fallback_frame. If there is
289 * completed reassembly (reachable from fallback_frame), simply links this
290 * packet into the list, updating the flags if necessary (however actual data
291 * and reassembled in frame won't be modified).
292 */
293WS_DLL_PUBLIC fragment_head *
294fragment_add_check_with_fallback(reassembly_table *table, tvbuff_t *tvb, const int offset,
295 const packet_info *pinfo, const uint32_t id,
296 const void *data, const uint32_t frag_offset,
297 const uint32_t frag_data_len, const bool more_frags,
298 const uint32_t fallback_frame);
299
300/*
301 * Like fragment_add, but fragments have a block sequence number starting from
302 * zero (for the first fragment of each datagram). This differs from
303 * fragment_add for which the fragment may start at any offset.
304 *
305 * If this is the first fragment seen for this datagram, a new
306 * "fragment_head" structure is allocated to refer to the reassembled
307 * packet, and:
308 *
309 * if "more_frags" is false, and either we have no sequence numbers, or
310 * are using the 802.11 hack (via fragment_add_seq_802_11), it is assumed that
311 * this is the only fragment in the datagram. The structure is not added to the
312 * hash table, and not given any fragments to refer to, but is just returned.
313 *
314 * In this latter case reassembly wasn't done (since there was only one
315 * fragment in the packet); dissectors can check the 'next' pointer on the
316 * returned list to see if this case was hit or not.
317 *
318 * Otherwise, this fragment is just added to the linked list of fragments
319 * for this packet; the fragment_item is also added to the fragment hash if
320 * necessary.
321 *
322 * If this packet completes assembly, these functions return the head of the
323 * fragment data; otherwise, they return null.
324 *
325 * @note Reused keys are assumed to refer to the same reassembled message
326 * (i.e., retransmission). If the same "id" is used more than once on a
327 * connection, then "data" and custom reassembly_table_functions should be
328 * used so that the keys hash differently.
329 */
330WS_DLL_PUBLIC fragment_head *
331fragment_add_seq(reassembly_table *table, tvbuff_t *tvb, const int offset,
332 const packet_info *pinfo, const uint32_t id, const void *data,
333 const uint32_t frag_number, const uint32_t frag_data_len,
334 const bool more_frags, const uint32_t flags);
335
336/*
337 * Like fragment_add_seq, but maintains a table for completed reassemblies
338 * just like fragment_add_check.
339 *
340 * @note Completed reassemblies are removed from the in-progress table, so
341 * key can be reused to begin a new reassembled message. Conversely,
342 * dissectors SHOULD NOT call this with a retransmitted fragment of a
343 * completed reassembly. Dissectors atop a reliable protocol like TCP
344 * may assume that the lower layer dissector handles retransmission,
345 * but other dissectors (e.g., atop UDP or Ethernet) will have to handle
346 * that situation themselves.
347 */
348WS_DLL_PUBLIC fragment_head *
349fragment_add_seq_check(reassembly_table *table, tvbuff_t *tvb, const int offset,
350 const packet_info *pinfo, const uint32_t id,
351 const void *data,
352 const uint32_t frag_number, const uint32_t frag_data_len,
353 const bool more_frags);
354
355/*
356 * Like fragment_add_seq_check, but immediately returns a fragment list for a
357 * new fragment. This is a workaround specific for the 802.11 dissector, do not
358 * use it elsewhere.
359 */
360WS_DLL_PUBLIC fragment_head *
361fragment_add_seq_802_11(reassembly_table *table, tvbuff_t *tvb,
362 const int offset, const packet_info *pinfo,
363 const uint32_t id, const void *data,
364 const uint32_t frag_number, const uint32_t frag_data_len,
365 const bool more_frags);
366
367/*
368 * Like fragment_add_seq_check, but without explicit fragment number. Fragments
369 * are simply appended until no "more_frags" is false.
370 *
371 * @note Out of order fragments will not be reassembled correctly.
372 * Dissectors atop a reliable protocol like TCP may rely on the lower
373 * level dissector reordering out or order segments (if the appropriate
374 * out of order reassembly preference is enabled), but other dissectors
375 * will have to handle out of order fragments themselves, if possible.
376 */
377WS_DLL_PUBLIC fragment_head *
378fragment_add_seq_next(reassembly_table *table, tvbuff_t *tvb, const int offset,
379 const packet_info *pinfo, const uint32_t id,
380 const void *data, const uint32_t frag_data_len,
381 const bool more_frags);
382
383/*
384 * Like fragment_add_seq_check, but for protocols like PPP MP with a single
385 * sequence number that increments for each fragment, thus acting like the sum
386 * of the PDU sequence number and explicit fragment number in other protocols.
387 * See Appendix A of RFC 4623 (PWE3 Fragmentation and Reassembly) for a list
388 * of protocols that use this style, including PPP MP (RFC 1990), PWE3 MPLS
389 * (RFC 4385), L2TPv2 (RFC 2661), L2TPv3 (RFC 3931), ATM, and Frame Relay.
390 * It is guaranteed to reassemble a packet split up to "max_frags" in size,
391 * but may manage to reassemble more in certain cases.
392 */
393WS_DLL_PUBLIC fragment_head *
394fragment_add_seq_single(reassembly_table *table, tvbuff_t *tvb,
395 const int offset, const packet_info *pinfo, const uint32_t id,
396 const void* data, const uint32_t frag_data_len,
397 const bool first, const bool last,
398 const uint32_t max_frags);
399
400/*
401 * A variation on the above that ages off fragments that have not been
402 * reassembled. Useful if the sequence number loops to deal with leftover
403 * fragments from the beginning of the capture or missing fragments.
404 */
405WS_DLL_PUBLIC fragment_head *
406fragment_add_seq_single_aging(reassembly_table *table, tvbuff_t *tvb,
407 const int offset, const packet_info *pinfo, const uint32_t id,
408 const void* data, const uint32_t frag_data_len,
409 const bool first, const bool last,
410 const uint32_t max_frags, const uint32_t max_age);
411
412/*
413 * Start a reassembly, expecting "tot_len" as the number of given fragments (not
414 * the number of bytes). Data can be added later using fragment_add_seq_check.
415 */
416WS_DLL_PUBLIC void
417fragment_start_seq_check(reassembly_table *table, const packet_info *pinfo,
418 const uint32_t id, const void *data,
419 const uint32_t tot_len);
420
421/*
422 * Mark end of reassembly and returns the reassembled fragment (if completed).
423 * Use it when fragments were added with "more_flags" set while you discovered
424 * that no more fragments have to be added.
425 * This is for fragments added with add_seq_next; it doesn't check for gaps,
426 * and doesn't set datalen correctly for the fragment_add family.
427 */
428WS_DLL_PUBLIC fragment_head *
429fragment_end_seq_next(reassembly_table *table, const packet_info *pinfo,
430 const uint32_t id, const void *data);
431
432/* To specify the offset for the fragment numbering, the first fragment is added with 0, and
433 * afterwards this offset is set. All additional calls to off_seq_check will calculate
434 * the number in sequence in regards to the offset */
435WS_DLL_PUBLIC void
436fragment_add_seq_offset(reassembly_table *table, const packet_info *pinfo, const uint32_t id,
437 const void *data, const uint32_t fragment_offset);
438
439/*
440 * Sets the expected index for the last block (for fragment_add_seq functions)
441 * or the expected number of bytes (for fragment_add functions). A reassembly
442 * must already have started.
443 *
444 * Note that for FD_BLOCKSEQUENCE tot_len is the index for the tail fragment.
445 * i.e. since the block numbers start at 0, if we specify tot_len==2, that
446 * actually means we want to defragment 3 blocks, block 0, 1 and 2.
447 */
448WS_DLL_PUBLIC void
449fragment_set_tot_len(reassembly_table *table, const packet_info *pinfo,
450 const uint32_t id, const void *data, const uint32_t tot_len);
451
452/*
453 * Similar to fragment_set_tot_len, it sets the expected number of bytes (for
454 * fragment_add functions) for a previously started reassembly. If the specified
455 * length already matches the reassembled length, then nothing will be done.
456 *
457 * If the fragments were previously reassembled, then this state will be
458 * cleared, allowing new fragments to extend the reassembled result again.
459 */
460WS_DLL_PUBLIC void
461fragment_reset_tot_len(reassembly_table *table, const packet_info *pinfo,
462 const uint32_t id, const void *data, const uint32_t tot_len);
463
464/*
465 * Truncates the size of an already defragmented reassembly to tot_len,
466 * discarding past that point, including splitting any fragments in the
467 * middle as necessary. The specified length must be less than or equal
468 * to the reassembled length. (If it already matches the reassembled length,
469 * then nothing will be done.)
470 *
471 * Used for continuous streams like TCP, where the length of a segment cannot
472 * be determined without first reassembling and handing to a subdissector.
473 */
474WS_DLL_PUBLIC void
475fragment_truncate(reassembly_table *table, const packet_info *pinfo,
476 const uint32_t id, const void *data, const uint32_t tot_len);
477
478/*
479 * Return the expected index for the last block (for fragment_add_seq functions)
480 * or the expected number of bytes (for fragment_add functions).
481 */
482WS_DLL_PUBLIC uint32_t
483fragment_get_tot_len(reassembly_table *table, const packet_info *pinfo,
484 const uint32_t id, const void *data);
485
486/*
487 * This function will set the partial reassembly flag(FD_PARTIAL_REASSEMBLY) for a fh.
488 * When this function is called, the fh MUST already exist, i.e.
489 * the fh MUST be created by the initial call to fragment_add() before
490 * this function is called. Also note that this function MUST be called to indicate
491 * a fh will be extended (increase the already stored data). After calling this function,
492 * and if FD_DEFRAGMENTED is set, the reassembly process will be continued.
493 */
494WS_DLL_PUBLIC void
495fragment_set_partial_reassembly(reassembly_table *table,
496 const packet_info *pinfo, const uint32_t id,
497 const void *data);
498
499/* This function is used to check if there is partial or completed reassembly state
500 * matching this packet. I.e. Are there reassembly going on or not for this packet?
501 */
502WS_DLL_PUBLIC fragment_head *
503fragment_get(reassembly_table *table, const packet_info *pinfo,
504 const uint32_t id, const void *data);
505
506/* The same for the reassemble table */
507WS_DLL_PUBLIC fragment_head *
508fragment_get_reassembled_id(reassembly_table *table, const packet_info *pinfo,
509 const uint32_t id);
510
511/* This will free up all resources and delete reassembly state for this PDU.
512 * Except if the PDU is completely reassembled, then it would NOT deallocate the
513 * buffer holding the reassembled data but instead return the TVB
514 *
515 * So, if you call fragment_delete and it returns non-NULL, YOU are responsible to
516 * tvb_free() .
517 */
518WS_DLL_PUBLIC tvbuff_t *
519fragment_delete(reassembly_table *table, const packet_info *pinfo,
520 const uint32_t id, const void *data);
521
522/* This struct holds references to all the tree and field handles used when
523 * displaying the reassembled fragment tree in the packet details view. A
524 * dissector will populate this structure with its own tree and field handles
525 * and then invoke show_fragment_tree to have those items added to the packet
526 * details tree.
527 */
528typedef struct _fragment_items {
529 int *ett_fragment;
530 int *ett_fragments;
531
532 int *hf_fragments; /* FT_NONE */
533 int *hf_fragment; /* FT_FRAMENUM */
534 int *hf_fragment_overlap; /* FT_BOOLEAN */
535 int *hf_fragment_overlap_conflict; /* FT_BOOLEAN */
536 int *hf_fragment_multiple_tails; /* FT_BOOLEAN */
537 int *hf_fragment_too_long_fragment; /* FT_BOOLEAN */
538 int *hf_fragment_error; /* FT_FRAMENUM */
539 int *hf_fragment_count; /* FT_UINT32 */
540 int *hf_reassembled_in; /* FT_FRAMENUM */
541 int *hf_reassembled_length; /* FT_UINT32 */
542 int *hf_reassembled_data; /* FT_BYTES */
543
544 const char *tag;
546
547WS_DLL_PUBLIC tvbuff_t *
548process_reassembled_data(tvbuff_t *tvb, const int offset, packet_info *pinfo,
549 const char *name, fragment_head *fd_head, const fragment_items *fit,
550 bool *update_col_infop, proto_tree *tree);
551
552WS_DLL_PUBLIC bool
553show_fragment_tree(fragment_head *ipfd_head, const fragment_items *fit,
554 proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, proto_item **fi);
555
556WS_DLL_PUBLIC bool
557show_fragment_seq_tree(fragment_head *ipfd_head, const fragment_items *fit,
558 proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, proto_item **fi);
559
560/* Initialize internal structures
561 */
562extern void reassembly_tables_init(void);
563
564/* Cleanup internal structures
565 */
566extern void
567reassembly_table_cleanup(void);
568
569/* ===================== Streaming data reassembly helper ===================== */
596#define REASSEMBLE_ITEMS_DEFINE(var_prefix, name_prefix) \
597 static int ett_##var_prefix##_fragment; \
598 static int ett_##var_prefix##_fragments; \
599 static int hf_##var_prefix##_fragments; \
600 static int hf_##var_prefix##_fragment; \
601 static int hf_##var_prefix##_fragment_overlap; \
602 static int hf_##var_prefix##_fragment_overlap_conflicts; \
603 static int hf_##var_prefix##_fragment_multiple_tails; \
604 static int hf_##var_prefix##_fragment_too_long_fragment; \
605 static int hf_##var_prefix##_fragment_error; \
606 static int hf_##var_prefix##_fragment_count; \
607 static int hf_##var_prefix##_reassembled_in; \
608 static int hf_##var_prefix##_reassembled_length; \
609 static int hf_##var_prefix##_reassembled_data; \
610 static int hf_##var_prefix##_segment; \
611 static const fragment_items var_prefix##_fragment_items = { \
612 &ett_##var_prefix##_fragment, \
613 &ett_##var_prefix##_fragments, \
614 &hf_##var_prefix##_fragments, \
615 &hf_##var_prefix##_fragment, \
616 &hf_##var_prefix##_fragment_overlap, \
617 &hf_##var_prefix##_fragment_overlap_conflicts, \
618 &hf_##var_prefix##_fragment_multiple_tails, \
619 &hf_##var_prefix##_fragment_too_long_fragment, \
620 &hf_##var_prefix##_fragment_error, \
621 &hf_##var_prefix##_fragment_count, \
622 &hf_##var_prefix##_reassembled_in, \
623 &hf_##var_prefix##_reassembled_length, \
624 &hf_##var_prefix##_reassembled_data, \
625 name_prefix " fragments" \
626 }
627
675#define REASSEMBLE_INIT_HF_ITEMS(var_prefix, name_prefix, abbrev_prefix) \
676 { &hf_##var_prefix##_fragments, \
677 { "Reassembled " name_prefix " fragments", abbrev_prefix ".fragments", \
678 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } \
679 }, \
680 { &hf_##var_prefix##_fragment, \
681 { name_prefix " fragment", abbrev_prefix ".fragment", \
682 FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL } \
683 }, \
684 { &hf_##var_prefix##_fragment_overlap, \
685 { name_prefix " fragment overlap", abbrev_prefix ".fragment.overlap", \
686 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } \
687 }, \
688 { &hf_##var_prefix##_fragment_overlap_conflicts, \
689 { name_prefix " fragment overlapping with conflicting data", abbrev_prefix ".fragment.overlap.conflicts", \
690 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } \
691 }, \
692 { &hf_##var_prefix##_fragment_multiple_tails, \
693 { name_prefix " has multiple tail fragments", abbrev_prefix ".fragment.multiple_tails", \
694 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } \
695 }, \
696 { &hf_##var_prefix##_fragment_too_long_fragment, \
697 { name_prefix " fragment too long", abbrev_prefix ".fragment.too_long_fragment", \
698 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } \
699 }, \
700 { &hf_##var_prefix##_fragment_error, \
701 { name_prefix " defragment error", abbrev_prefix ".fragment.error", \
702 FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL } \
703 }, \
704 { &hf_##var_prefix##_fragment_count, \
705 { name_prefix " fragment count", abbrev_prefix ".fragment.count", \
706 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } \
707 }, \
708 { &hf_##var_prefix##_reassembled_in, \
709 { "Reassembled in", abbrev_prefix ".reassembled.in", \
710 FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL } \
711 }, \
712 { &hf_##var_prefix##_reassembled_length, \
713 { "Reassembled length", abbrev_prefix ".reassembled.length", \
714 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } \
715 }, \
716 { &hf_##var_prefix##_reassembled_data, \
717 { "Reassembled data", abbrev_prefix ".reassembled.data", \
718 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } \
719 }, \
720 { &hf_##var_prefix##_segment, \
721 { name_prefix " segment", abbrev_prefix ".segment", \
722 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} \
723 }
724
756#define REASSEMBLE_INIT_ETT_ITEMS(var_prefix) \
757 &ett_##var_prefix##_fragment, \
758 &ett_##var_prefix##_fragments
759
762
766WS_DLL_PUBLIC streaming_reassembly_info_t*
768
1134WS_DLL_PUBLIC int
1136 tvbuff_t* tvb, packet_info* pinfo, unsigned offset, int length,
1137 proto_tree* segment_tree, proto_tree* reassembled_tree, reassembly_table streaming_reassembly_table,
1138 streaming_reassembly_info_t* reassembly_info, uint64_t cur_frame_num,
1139 dissector_handle_t subdissector_handle, proto_tree* subdissector_tree, void* subdissector_data,
1140 const char* label, const fragment_items* frag_hf_items, int hf_segment_data
1141);
1142
1156static inline uint64_t
1157get_virtual_frame_num64(tvbuff_t* tvb, packet_info* pinfo, int offset)
1158{
1159 return (((uint64_t)pinfo->num) << 32) + (((uint64_t)pinfo->curr_layer_num) << 24)
1160 + ((uint64_t)tvb_raw_offset(tvb) + offset);
1161}
1162
1170WS_DLL_PUBLIC int
1172
1173/* ========================================================================= */
1174
1175#ifdef __cplusplus
1176}
1177#endif
1178
1179#endif
int tvb_raw_offset(tvbuff_t *tvb)
Returns the offset from the first byte of real data.
Definition tvbuff.c:4776
WS_DLL_PUBLIC streaming_reassembly_info_t * streaming_reassembly_info_new(void)
Definition reassemble.c:3232
WS_DLL_PUBLIC int additional_bytes_expected_to_complete_reassembly(streaming_reassembly_info_t *reassembly_info)
Definition reassemble.c:3556
WS_DLL_PUBLIC int reassemble_streaming_data_and_call_subdissector(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, int length, proto_tree *segment_tree, proto_tree *reassembled_tree, reassembly_table streaming_reassembly_table, streaming_reassembly_info_t *reassembly_info, uint64_t cur_frame_num, dissector_handle_t subdissector_handle, proto_tree *subdissector_tree, void *subdissector_data, const char *label, const fragment_items *frag_hf_items, int hf_segment_data)
Definition reassemble.c:3282
Definition reassemble.h:68
unsigned ref_count
Definition reassemble.h:72
uint32_t flags
Definition reassemble.h:93
const char * error
Definition reassemble.h:101
struct _fragment_item * first_gap
Definition reassemble.h:70
uint32_t len
Definition reassemble.h:75
uint32_t contiguous_len
Definition reassemble.h:73
uint32_t datalen
Definition reassemble.h:81
uint32_t reassembled_in
Definition reassemble.h:87
uint32_t fragment_nr_offset
Definition reassemble.h:78
uint8_t reas_in_layer_num
Definition reassemble.h:89
uint32_t frame
Definition reassemble.h:74
Definition reassemble.h:56
uint32_t frame
Definition reassemble.h:58
uint32_t flags
Definition reassemble.h:62
uint32_t len
Definition reassemble.h:61
uint32_t offset
Definition reassemble.h:59
Definition reassemble.h:528
Definition packet_info.h:43
Definition proto.h:907
Definition packet.c:848
Definition reassemble.h:153
Definition reassemble.h:142
Definition reassemble.c:3209
Definition tvbuff-int.h:35