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
|
|
|
*
|
2001-04-01 04:11:51 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 04:11:51 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 04:11:51 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-04-01 04:11:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FRAME_DATA_H__
|
|
|
|
#define __FRAME_DATA_H__
|
|
|
|
|
2009-09-21 17:12:46 +00:00
|
|
|
#include <epan/tvbuff.h>
|
2013-06-25 22:02:20 +00:00
|
|
|
#include <wsutil/nstime.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2001-04-01 04:11:51 +00:00
|
|
|
|
2013-11-29 20:53:00 +00:00
|
|
|
struct _packet_info;
|
|
|
|
struct epan_session;
|
|
|
|
struct wtap_pkthdr;
|
|
|
|
|
2009-11-29 22:51:28 +00:00
|
|
|
#define PINFO_FD_NUM(pinfo) ((pinfo)->fd->num)
|
|
|
|
#define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->flags.visited)
|
|
|
|
|
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 {
|
|
|
|
PACKET_CHAR_ENC_CHAR_ASCII = 0, /* ASCII */
|
|
|
|
PACKET_CHAR_ENC_CHAR_EBCDIC = 1 /* EBCDIC */
|
|
|
|
} 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
|
|
|
|
number unknown". */
|
2001-04-01 04:11:51 +00:00
|
|
|
typedef struct _frame_data {
|
2012-02-11 12:34:39 +00:00
|
|
|
GSList *pfd; /**< Per frame proto data */
|
|
|
|
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 */
|
|
|
|
guint16 subnum; /**< subframe number, for protocols that require this */
|
|
|
|
gint16 lnk_t; /**< Per-packet encapsulation/data-link type */
|
2001-04-01 04:11:51 +00:00
|
|
|
struct {
|
2010-08-29 10:47:38 +00:00
|
|
|
unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
|
2012-02-28 03:19:49 +00:00
|
|
|
unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
|
2012-12-26 05:57:06 +00:00
|
|
|
unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */
|
2010-08-29 10:47:38 +00:00
|
|
|
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 */
|
2012-02-25 23:24:34 +00:00
|
|
|
unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
|
2013-08-01 20:59:38 +00:00
|
|
|
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 */
|
2001-04-01 04:11:51 +00:00
|
|
|
} flags;
|
2009-09-07 13:54:46 +00:00
|
|
|
|
2012-02-11 12:34:39 +00:00
|
|
|
const void *color_filter; /**< Per-packet matching color_filter_t object */
|
2009-09-07 13:54:46 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* Utility routines used by packet*.c */
|
2013-11-23 22:29:31 +00:00
|
|
|
WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data);
|
|
|
|
WS_DLL_PUBLIC void *p_get_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key);
|
|
|
|
void p_remove_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key);
|
2013-11-23 02:20:13 +00:00
|
|
|
gchar *p_get_proto_name_and_key(wmem_allocator_t *scope, struct _packet_info* pinfo, guint pfd_index);
|
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,
|
2009-09-21 11:26:23 +00:00
|
|
|
const struct wtap_pkthdr *phdr, 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
|
|
|
/** @} */
|
|
|
|
|
2001-04-01 04:11:51 +00:00
|
|
|
#endif /* __FRAME_DATA__ */
|