2001-04-01 04:11:51 +00:00
|
|
|
/* frame_data.h
|
|
|
|
* Definitions for frame_data structures and routines
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-04-01 04:11:51 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2001-04-01 04:11:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FRAME_DATA_H__
|
|
|
|
#define __FRAME_DATA_H__
|
|
|
|
|
2014-10-05 19:23:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2016-03-14 19:03:11 +00:00
|
|
|
#include <ws_diag_control.h>
|
|
|
|
#include <ws_symbol_export.h>
|
2013-06-25 22:02:20 +00:00
|
|
|
#include <wsutil/nstime.h>
|
2001-04-01 04:11:51 +00:00
|
|
|
|
2017-12-03 18:53:58 +00:00
|
|
|
#include <wiretap/wtap.h>
|
|
|
|
|
2013-11-29 20:53:00 +00:00
|
|
|
struct _packet_info;
|
|
|
|
struct epan_session;
|
|
|
|
|
2018-12-27 02:26:24 +00:00
|
|
|
#define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->visited)
|
2009-11-29 22:51:28 +00:00
|
|
|
|
2013-05-30 22:20:21 +00:00
|
|
|
/** @file
|
|
|
|
* Low-level frame data and metadata.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @defgroup framedata Frame Data
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** @todo XXX - some of this stuff is used only while a packet is being dissected;
|
2001-04-01 04:11:51 +00:00
|
|
|
should we keep that stuff in the "packet_info" structure, instead, to
|
|
|
|
save memory? */
|
2009-09-21 17:12:46 +00:00
|
|
|
|
2012-10-30 19:21:24 +00:00
|
|
|
/* Types of character encodings */
|
|
|
|
typedef enum {
|
2014-04-06 17:28:39 +00:00
|
|
|
PACKET_CHAR_ENC_CHAR_ASCII = 0, /* ASCII */
|
|
|
|
PACKET_CHAR_ENC_CHAR_EBCDIC = 1 /* EBCDIC */
|
2012-10-30 19:21:24 +00:00
|
|
|
} packet_char_enc;
|
|
|
|
|
2010-08-28 19:27:19 +00:00
|
|
|
/** The frame number is the ordinal number of the frame in the capture, so
|
2005-09-11 22:25:33 +00:00
|
|
|
it's 1-origin. In various contexts, 0 as a frame number means "frame
|
2018-12-27 02:26:24 +00:00
|
|
|
number unknown".
|
|
|
|
|
|
|
|
There is one of these structures for every frame in the capture.
|
|
|
|
That means a lot of memory if we have a lot of frames.
|
|
|
|
They are packed into power-of-2 chunks, so their size is effectively
|
|
|
|
rounded up to a power of 2.
|
|
|
|
Try to keep it close to, and less than or equal to, a power of 2.
|
|
|
|
"Smaller than a power of 2" is OK for ILP32 platforms.
|
|
|
|
|
|
|
|
XXX - shuffle the fields to try to keep the most commonly-accessed
|
|
|
|
fields within the first 16 or 32 bytes, so they all fit in a cache
|
|
|
|
line? */
|
2015-10-09 18:45:35 +00:00
|
|
|
struct _color_filter; /* Forward */
|
2018-05-18 21:41:26 +00:00
|
|
|
DIAG_OFF_PEDANTIC
|
2001-04-01 04:11:51 +00:00
|
|
|
typedef struct _frame_data {
|
2012-02-11 12:34:39 +00:00
|
|
|
guint32 num; /**< Frame number */
|
|
|
|
guint32 pkt_len; /**< Packet length */
|
|
|
|
guint32 cap_len; /**< Amount actually captured */
|
|
|
|
guint32 cum_bytes; /**< Cumulative bytes into the capture */
|
|
|
|
gint64 file_off; /**< File offset */
|
2018-12-27 02:26:24 +00:00
|
|
|
/* These two are pointers, meaning 64-bit on LP64 (64-bit UN*X) and
|
|
|
|
LLP64 (64-bit Windows) platforms. Put them here, one after the
|
|
|
|
other, so they don't require padding between them. */
|
|
|
|
GSList *pfd; /**< Per frame proto data */
|
2015-10-09 18:45:35 +00:00
|
|
|
const struct _color_filter *color_filter; /**< Per-packet matching color_filter_t object */
|
2018-12-27 02:26:24 +00:00
|
|
|
guint16 subnum; /**< subframe number, for protocols that require this */
|
|
|
|
/* Keep the bitfields below to 16 bits, so this plus the previous field
|
|
|
|
are 32 bits. */
|
|
|
|
unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
|
|
|
|
unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
|
|
|
|
/* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
|
|
|
|
unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */
|
|
|
|
unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
|
|
|
|
unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */
|
|
|
|
unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */
|
|
|
|
unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
|
|
|
|
unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
|
|
|
|
unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
|
|
|
|
unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
|
|
|
|
unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */
|
|
|
|
unsigned int tsprec : 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */
|
2012-02-11 12:34:39 +00:00
|
|
|
nstime_t abs_ts; /**< Absolute timestamp */
|
|
|
|
nstime_t shift_offset; /**< How much the abs_tm of the frame is shifted */
|
2013-07-21 23:07:33 +00:00
|
|
|
guint32 frame_ref_num; /**< Previous reference frame (0 if this is one) */
|
2013-07-21 20:48:30 +00:00
|
|
|
guint32 prev_dis_num; /**< Previous displayed frame (0 if first one) */
|
2001-04-01 04:11:51 +00:00
|
|
|
} frame_data;
|
2018-05-18 21:41:26 +00:00
|
|
|
DIAG_ON_PEDANTIC
|
2001-04-01 04:11:51 +00:00
|
|
|
|
2010-08-28 19:27:19 +00:00
|
|
|
/** compare two frame_datas */
|
2013-07-21 20:48:30 +00:00
|
|
|
WS_DLL_PUBLIC gint frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field);
|
2009-07-22 08:09:22 +00:00
|
|
|
|
2013-03-15 18:04:50 +00:00
|
|
|
WS_DLL_PUBLIC void frame_data_reset(frame_data *fdata);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC void frame_data_destroy(frame_data *fdata);
|
2009-09-20 18:18:29 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void frame_data_init(frame_data *fdata, guint32 num,
|
2018-02-09 00:19:12 +00:00
|
|
|
const wtap_rec *rec, gint64 offset,
|
2009-09-22 14:23:20 +00:00
|
|
|
guint32 cum_bytes);
|
2012-09-23 16:25:28 +00:00
|
|
|
|
2013-07-21 20:48:30 +00:00
|
|
|
extern void frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata,
|
|
|
|
guint32 prev_num, nstime_t *delta);
|
2010-08-28 19:27:19 +00:00
|
|
|
/**
|
|
|
|
* Sets the frame data struct values before dissection.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void frame_data_set_before_dissect(frame_data *fdata,
|
2009-09-22 14:23:20 +00:00
|
|
|
nstime_t *elapsed_time,
|
2013-07-21 23:07:33 +00:00
|
|
|
const frame_data **frame_ref,
|
2013-07-21 20:48:30 +00:00
|
|
|
const frame_data *prev_dis);
|
2009-09-21 11:26:23 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void frame_data_set_after_dissect(frame_data *fdata,
|
2012-09-23 16:25:28 +00:00
|
|
|
guint32 *cum_bytes);
|
2009-09-22 14:23:20 +00:00
|
|
|
|
2013-05-30 22:20:21 +00:00
|
|
|
/** @} */
|
|
|
|
|
2014-10-05 19:23:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2001-04-01 04:11:51 +00:00
|
|
|
#endif /* __FRAME_DATA__ */
|
2014-04-06 17:28:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|