2 * Definitions for frame_data structures and routines
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __FRAME_DATA_H__
26 #define __FRAME_DATA_H__
28 #include <epan/column-info.h>
29 #include <epan/tvbuff.h>
30 #include <wsutil/nstime.h>
31 #include <wiretap/wtap.h>
32 #include "ws_symbol_export.h"
34 #define PINFO_FD_NUM(pinfo) ((pinfo)->fd->num)
35 #define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->flags.visited)
38 * Low-level frame data and metadata.
41 /** @defgroup framedata Frame Data
46 /** @todo XXX - some of this stuff is used only while a packet is being dissected;
47 should we keep that stuff in the "packet_info" structure, instead, to
50 /* Types of character encodings */
52 PACKET_CHAR_ENC_CHAR_ASCII
= 0, /* ASCII */
53 PACKET_CHAR_ENC_CHAR_EBCDIC
= 1 /* EBCDIC */
56 /** The frame number is the ordinal number of the frame in the capture, so
57 it's 1-origin. In various contexts, 0 as a frame number means "frame
59 typedef struct _frame_data
{
60 GSList
*pfd
; /**< Per frame proto data */
61 guint32 num
; /**< Frame number */
62 guint32 pkt_len
; /**< Packet length */
63 guint32 cap_len
; /**< Amount actually captured */
64 guint32 cum_bytes
; /**< Cumulative bytes into the capture */
65 gint64 file_off
; /**< File offset */
66 guint16 subnum
; /**< subframe number, for protocols that require this */
67 gint16 lnk_t
; /**< Per-packet encapsulation/data-link type */
69 unsigned int passed_dfilter
: 1; /**< 1 = display, 0 = no display */
70 unsigned int dependent_of_displayed
: 1; /**< 1 if a displayed frame depends on this frame */
71 unsigned int encoding
: 1; /**< Character encoding (ASCII, EBCDIC...) */
72 unsigned int visited
: 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
73 unsigned int marked
: 1; /**< 1 = marked by user, 0 = normal */
74 unsigned int ref_time
: 1; /**< 1 = marked as a reference time frame, 0 = normal */
75 unsigned int ignored
: 1; /**< 1 = ignore this frame, 0 = normal */
76 unsigned int has_ts
: 1; /**< 1 = has time stamp, 0 = no time stamp */
77 unsigned int has_phdr_comment
: 1; /** 1 = there's comment for this packet */
78 unsigned int has_user_comment
: 1; /** 1 = user set (also deleted) comment for this packet */
81 const void *color_filter
; /**< Per-packet matching color_filter_t object */
83 nstime_t abs_ts
; /**< Absolute timestamp */
84 nstime_t shift_offset
; /**< How much the abs_tm of the frame is shifted */
85 guint32 frame_ref_num
; /**< Previous reference frame (0 if this is one) */
86 guint32 prev_dis_num
; /**< Previous displayed frame (0 if first one) */
89 #ifdef WANT_PACKET_EDITOR
90 /* XXX, where this struct should go? */
92 struct wtap_pkthdr phdr
; /**< Modified packet header */
93 char *pd
; /**< Modified packet data */
94 } modified_frame_data
;
97 /* Utility routines used by packet*.c */
99 WS_DLL_PUBLIC
void p_add_proto_data(frame_data
*fd
, int proto
, guint8 key
, void *proto_data
);
100 WS_DLL_PUBLIC
void *p_get_proto_data(frame_data
*fd
, int proto
, guint8 key
);
101 void p_remove_proto_data(frame_data
*fd
, int proto
, guint8 key
);
102 gchar
*p_get_proto_name_and_key(frame_data
*fd
, guint pfd_index
);
104 /* no sense to include epan.h + dependencies for opaque epan session type */
107 /** compare two frame_datas */
108 WS_DLL_PUBLIC gint
frame_data_compare(const struct epan_session
*epan
, const frame_data
*fdata1
, const frame_data
*fdata2
, int field
);
110 WS_DLL_PUBLIC
void frame_data_reset(frame_data
*fdata
);
112 WS_DLL_PUBLIC
void frame_data_destroy(frame_data
*fdata
);
114 WS_DLL_PUBLIC
void frame_data_init(frame_data
*fdata
, guint32 num
,
115 const struct wtap_pkthdr
*phdr
, gint64 offset
,
118 extern void frame_delta_abs_time(const struct epan_session
*epan
, const frame_data
*fdata
,
119 guint32 prev_num
, nstime_t
*delta
);
121 * Sets the frame data struct values before dissection.
123 WS_DLL_PUBLIC
void frame_data_set_before_dissect(frame_data
*fdata
,
124 nstime_t
*elapsed_time
,
125 const frame_data
**frame_ref
,
126 const frame_data
*prev_dis
);
128 WS_DLL_PUBLIC
void frame_data_set_after_dissect(frame_data
*fdata
,
133 #endif /* __FRAME_DATA__ */