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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __FRAME_DATA_H__
26 #define __FRAME_DATA_H__
28 #include <epan/column_info.h>
29 #include <epan/tvbuff.h>
30 #include <epan/nstime.h>
32 #define PINFO_FD_NUM(pinfo) ((pinfo)->fd->num)
33 #define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->flags.visited)
35 /** @todo XXX - some of this stuff is used only while a packet is being dissected;
36 should we keep that stuff in the "packet_info" structure, instead, to
39 /** The frame number is the ordinal number of the frame in the capture, so
40 it's 1-origin. In various contexts, 0 as a frame number means "frame
42 typedef struct _frame_data {
43 GSList *pfd; /**< Per frame proto data */
44 guint32 num; /**< Frame number */
45 guint32 pkt_len; /**< Packet length */
46 guint32 cap_len; /**< Amount actually captured */
47 guint32 cum_bytes; /**< Cumulative bytes into the capture */
48 gint64 file_off; /**< File offset */
49 guint16 subnum; /**< subframe number, for protocols that require this */
50 gint16 lnk_t; /**< Per-packet encapsulation/data-link type */
52 unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
53 unsigned int encoding : 2; /**< Character encoding (ASCII, EBCDIC...) */
54 unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
55 unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */
56 unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */
57 unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
60 const void *color_filter; /**< Per-packet matching color_filter_t object */
62 nstime_t abs_ts; /**< Absolute timestamp */
63 nstime_t shift_offset;/**< How much the abs_tm of the frame is shifted */
64 nstime_t rel_ts; /**< Relative timestamp (yes, it can be negative) */
65 nstime_t del_dis_ts; /**< Delta timestamp to previous displayed frame (yes, it can be negative) */
66 nstime_t del_cap_ts; /**< Delta timestamp to previous captured frame (yes, it can be negative) */
69 #ifdef WANT_PACKET_EDITOR
70 /* XXX, where this struct should go? */
72 union wtap_pseudo_header ph; /**< Modified pseudo header */
73 char *pd; /**< Modified packet data */
74 } modified_frame_data;
79 * Has a tvbuff and a name.
83 gboolean name_initialized;
87 /* Utility routines used by packet*.c */
89 extern void p_add_proto_data(frame_data *fd, int proto, void *proto_data);
90 extern void *p_get_proto_data(frame_data *fd, int proto);
91 extern void p_remove_proto_data(frame_data *fd, int proto);
93 /** compare two frame_datas */
94 extern gint frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field);
96 extern void frame_data_cleanup(frame_data *fdata);
98 extern void frame_data_init(frame_data *fdata, guint32 num,
99 const struct wtap_pkthdr *phdr, gint64 offset,
102 * Sets the frame data struct values before dissection.
104 extern void frame_data_set_before_dissect(frame_data *fdata,
105 nstime_t *elapsed_time,
107 nstime_t *prev_dis_ts,
108 nstime_t *prev_cap_ts);
110 extern void frame_data_set_after_dissect(frame_data *fdata,
112 nstime_t *prev_dis_ts);
114 #endif /* __FRAME_DATA__ */