TLS13: update pre_shared_key lengths for draft -19
[metze/wireshark/wip.git] / epan / frame_data.h
1 /* frame_data.h
2  * Definitions for frame_data structures and routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __FRAME_DATA_H__
24 #define __FRAME_DATA_H__
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 #include <ws_diag_control.h>
31 #include <ws_symbol_export.h>
32 #include <wsutil/nstime.h>
33
34 struct _packet_info;
35 struct epan_session;
36 struct wtap_pkthdr;
37
38 #define PINFO_FD_VISITED(pinfo)   ((pinfo)->fd->flags.visited)
39
40 /** @file
41  * Low-level frame data and metadata.
42  */
43
44 /** @defgroup framedata Frame Data
45  *
46  * @{
47  */
48
49 /** @todo XXX - some of this stuff is used only while a packet is being dissected;
50    should we keep that stuff in the "packet_info" structure, instead, to
51    save memory? */
52
53 /* Types of character encodings */
54 typedef enum {
55   PACKET_CHAR_ENC_CHAR_ASCII     = 0, /* ASCII */
56   PACKET_CHAR_ENC_CHAR_EBCDIC    = 1  /* EBCDIC */
57 } packet_char_enc;
58
59 /** The frame number is the ordinal number of the frame in the capture, so
60    it's 1-origin.  In various contexts, 0 as a frame number means "frame
61    number unknown". */
62 struct _color_filter; /* Forward */
63 DIAG_OFF(pedantic)
64 typedef struct _frame_data {
65   GSList      *pfd;          /**< Per frame proto data */
66   guint32      num;          /**< Frame number */
67   guint32      pkt_len;      /**< Packet length */
68   guint32      cap_len;      /**< Amount actually captured */
69   guint32      cum_bytes;    /**< Cumulative bytes into the capture */
70   gint64       file_off;     /**< File offset */
71   guint16      subnum;       /**< subframe number, for protocols that require this */
72   struct {
73     unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
74     unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
75     /* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
76     unsigned int encoding       : 1; /**< Character encoding (ASCII, EBCDIC...) */
77     unsigned int visited        : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
78     unsigned int marked         : 1; /**< 1 = marked by user, 0 = normal */
79     unsigned int ref_time       : 1; /**< 1 = marked as a reference time frame, 0 = normal */
80     unsigned int ignored        : 1; /**< 1 = ignore this frame, 0 = normal */
81     unsigned int has_ts         : 1; /**< 1 = has time stamp, 0 = no time stamp */
82     unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
83     unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
84     unsigned int need_colorize  : 1; /**< 1 = need to (re-)calculate packet color */
85   } flags;
86   gint16       tsprec;       /**< Time stamp precision */
87
88   const struct _color_filter *color_filter;  /**< Per-packet matching color_filter_t object */
89
90   nstime_t     abs_ts;       /**< Absolute timestamp */
91   nstime_t     shift_offset; /**< How much the abs_tm of the frame is shifted */
92   guint32      frame_ref_num; /**< Previous reference frame (0 if this is one) */
93   guint32      prev_dis_num; /**< Previous displayed frame (0 if first one) */
94 } frame_data;
95 DIAG_ON(pedantic)
96
97 /** compare two frame_datas */
98 WS_DLL_PUBLIC gint frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field);
99
100 WS_DLL_PUBLIC void frame_data_reset(frame_data *fdata);
101
102 WS_DLL_PUBLIC void frame_data_destroy(frame_data *fdata);
103
104 WS_DLL_PUBLIC void frame_data_init(frame_data *fdata, guint32 num,
105                 const struct wtap_pkthdr *phdr, gint64 offset,
106                 guint32 cum_bytes);
107
108 extern void frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata,
109                 guint32 prev_num, nstime_t *delta);
110 /**
111  * Sets the frame data struct values before dissection.
112  */
113 WS_DLL_PUBLIC void frame_data_set_before_dissect(frame_data *fdata,
114                 nstime_t *elapsed_time,
115                 const frame_data **frame_ref,
116                 const frame_data *prev_dis);
117
118 WS_DLL_PUBLIC void frame_data_set_after_dissect(frame_data *fdata,
119                 guint32 *cum_bytes);
120
121 /** @} */
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126
127 #endif  /* __FRAME_DATA__ */
128
129 /*
130  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
131  *
132  * Local variables:
133  * c-basic-offset: 2
134  * tab-width: 8
135  * indent-tabs-mode: nil
136  * End:
137  *
138  * vi: set shiftwidth=2 tabstop=8 expandtab:
139  * :indentSize=2:tabSize=8:noTabs=true:
140  */