2 * Definitions for frame_data structures and routines
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
11 #ifndef __FRAME_DATA_H__
12 #define __FRAME_DATA_H__
14 #include <ws_diag_control.h>
15 #include <ws_symbol_export.h>
16 #include <wsutil/nstime.h>
20 #endif /* __cplusplus */
22 typedef struct wtap_rec wtap_rec
;
26 #define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->visited)
29 * Low-level frame data and metadata.
32 /** @defgroup framedata Frame Data
37 /** @todo XXX - some of this stuff is used only while a packet is being dissected;
38 should we keep that stuff in the "packet_info" structure, instead, to
41 /* Types of character encodings */
43 PACKET_CHAR_ENC_CHAR_ASCII
= 0, /* ASCII */
44 PACKET_CHAR_ENC_CHAR_EBCDIC
= 1 /* EBCDIC */
47 /** The frame number is the ordinal number of the frame in the capture, so
48 it's 1-origin. In various contexts, 0 as a frame number means "frame
51 There is one of these structures for every frame in the capture.
52 That means a lot of memory if we have a lot of frames.
53 They are packed into power-of-2 chunks, so their size is effectively
54 rounded up to a power of 2.
55 Try to keep it close to, and less than or equal to, a power of 2.
56 "Smaller than a power of 2" is OK for ILP32 platforms.
58 XXX - shuffle the fields to try to keep the most commonly-accessed
59 fields within the first 16 or 32 bytes, so they all fit in a cache
61 struct _color_filter
; /* Forward */
63 typedef struct _frame_data
{
64 uint32_t num
; /**< Frame number */
65 uint32_t dis_num
; /**< Displayed frame number */
66 uint32_t pkt_len
; /**< Packet length */
67 uint32_t cap_len
; /**< Amount actually captured */
68 uint32_t cum_bytes
; /**< Cumulative bytes into the capture */
69 int64_t file_off
; /**< File offset */
70 /* These two are pointers, meaning 64-bit on LP64 (64-bit UN*X) and
71 LLP64 (64-bit Windows) platforms. Put them here, one after the
72 other, so they don't require padding between them. */
73 GSList
*pfd
; /**< Per frame proto data */
74 GHashTable
*dependent_frames
; /**< A hash table of frames which this one depends on */
75 const struct _color_filter
*color_filter
; /**< Per-packet matching color_filter_t object */
76 uint8_t tcp_snd_manual_analysis
; /**< TCP SEQ Analysis Overriding, 0 = none, 1 = OOO, 2 = RET , 3 = Fast RET, 4 = Spurious RET */
77 /* Keep the bitfields below to 24 bits, so this plus the previous field
78 are 32 bits. (XXX - The previous field could be a bitfield too.) */
79 unsigned int passed_dfilter
: 1; /**< 1 = display, 0 = no display */
80 unsigned int dependent_of_displayed
: 1; /**< 1 if a displayed frame depends on this frame */
81 /* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
82 unsigned int encoding
: 1; /**< Character encoding (ASCII, EBCDIC...) */
83 unsigned int visited
: 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
84 unsigned int marked
: 1; /**< 1 = marked by user, 0 = normal */
85 unsigned int ref_time
: 1; /**< 1 = marked as a reference time frame, 0 = normal */
86 unsigned int ignored
: 1; /**< 1 = ignore this frame, 0 = normal */
87 unsigned int has_ts
: 1; /**< 1 = has time stamp, 0 = no time stamp */
88 unsigned int has_modified_block
: 1; /** 1 = block for this packet has been modified */
89 unsigned int need_colorize
: 1; /**< 1 = need to (re-)calculate packet color */
90 unsigned int tsprec
: 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */
91 nstime_t abs_ts
; /**< Absolute timestamp */
92 nstime_t shift_offset
; /**< How much the abs_tm of the frame is shifted */
93 uint32_t frame_ref_num
; /**< Previous reference frame (0 if this is one) */
94 uint32_t prev_dis_num
; /**< Previous displayed frame (0 if first one) */
98 /** compare two frame_datas */
99 WS_DLL_PUBLIC
int frame_data_compare(const struct epan_session
*epan
, const frame_data
*fdata1
, const frame_data
*fdata2
, int field
);
101 WS_DLL_PUBLIC
void frame_data_reset(frame_data
*fdata
);
103 WS_DLL_PUBLIC
void frame_data_destroy(frame_data
*fdata
);
105 WS_DLL_PUBLIC
void frame_data_init(frame_data
*fdata
, uint32_t num
,
106 const wtap_rec
*rec
, int64_t offset
,
109 extern void frame_delta_abs_time(const struct epan_session
*epan
, const frame_data
*fdata
,
110 uint32_t prev_num
, nstime_t
*delta
);
112 * Sets the frame data struct values before dissection.
114 WS_DLL_PUBLIC
void frame_data_set_before_dissect(frame_data
*fdata
,
115 nstime_t
*elapsed_time
,
116 const frame_data
**frame_ref
,
117 const frame_data
*prev_dis
);
119 WS_DLL_PUBLIC
void frame_data_set_after_dissect(frame_data
*fdata
,
120 uint32_t *cum_bytes
);
126 #endif /* __cplusplus */
128 #endif /* __FRAME_DATA__ */
131 * Editor modelines - https://www.wireshark.org/tools/modelines.html
136 * indent-tabs-mode: nil
139 * vi: set shiftwidth=2 tabstop=8 expandtab:
140 * :indentSize=2:tabSize=8:noTabs=true: