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 "ws_symbol_export.h"
33 #define PINFO_FD_NUM(pinfo) ((pinfo)->fd->num)
34 #define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->flags.visited)
37 * Low-level frame data and metadata.
40 /** @defgroup framedata Frame Data
45 /** @todo XXX - some of this stuff is used only while a packet is being dissected;
46 should we keep that stuff in the "packet_info" structure, instead, to
49 /* Types of character encodings */
51 PACKET_CHAR_ENC_CHAR_ASCII = 0, /* ASCII */
52 PACKET_CHAR_ENC_CHAR_EBCDIC = 1 /* EBCDIC */
55 /** The frame number is the ordinal number of the frame in the capture, so
56 it's 1-origin. In various contexts, 0 as a frame number means "frame
58 typedef struct _frame_data {
59 GSList *pfd; /**< Per frame proto data */
60 guint32 num; /**< Frame number */
61 guint32 pkt_len; /**< Packet length */
62 guint32 cap_len; /**< Amount actually captured */
63 guint32 cum_bytes; /**< Cumulative bytes into the capture */
64 gint64 file_off; /**< File offset */
65 guint16 subnum; /**< subframe number, for protocols that require this */
66 gint16 lnk_t; /**< Per-packet encapsulation/data-link type */
68 unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
69 unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
70 unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */
71 unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
72 unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */
73 unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */
74 unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
75 unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
76 unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
77 unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
80 const void *color_filter; /**< Per-packet matching color_filter_t object */
82 nstime_t abs_ts; /**< Absolute timestamp */
83 nstime_t shift_offset; /**< How much the abs_tm of the frame is shifted */
84 guint32 frame_ref_num; /**< Previous reference frame (0 if this is one) */
85 guint32 prev_dis_num; /**< Previous displayed frame (0 if first one) */
88 #ifdef WANT_PACKET_EDITOR
89 /* XXX, where this struct should go? */
91 struct wtap_pkthdr phdr; /**< Modified packet header */
92 char *pd; /**< Modified packet data */
93 } modified_frame_data;
96 /* Utility routines used by packet*.c */
98 WS_DLL_PUBLIC void p_add_proto_data(frame_data *fd, int proto, guint8 key, void *proto_data);
99 WS_DLL_PUBLIC void *p_get_proto_data(frame_data *fd, int proto, guint8 key);
100 void p_remove_proto_data(frame_data *fd, int proto, guint8 key);
101 gchar *p_get_proto_name_and_key(frame_data *fd, guint pfd_index);
103 /* no sense to include epan.h + dependencies for opaque epan session type */
106 /** compare two frame_datas */
107 WS_DLL_PUBLIC gint frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field);
109 WS_DLL_PUBLIC void frame_data_reset(frame_data *fdata);
111 WS_DLL_PUBLIC void frame_data_destroy(frame_data *fdata);
113 WS_DLL_PUBLIC void frame_data_init(frame_data *fdata, guint32 num,
114 const struct wtap_pkthdr *phdr, gint64 offset,
117 extern void frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata,
118 guint32 prev_num, nstime_t *delta);
120 * Sets the frame data struct values before dissection.
122 WS_DLL_PUBLIC void frame_data_set_before_dissect(frame_data *fdata,
123 nstime_t *elapsed_time,
124 const frame_data **frame_ref,
125 const frame_data *prev_dis);
127 WS_DLL_PUBLIC void frame_data_set_after_dissect(frame_data *fdata,
132 #endif /* __FRAME_DATA__ */