packet dissection now takes pointer to tvb instead of guint8 data

implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497
This commit is contained in:
Jakub Zawadzki 2013-07-11 05:47:02 +00:00
parent 19d2d0dc76
commit ce81449ed9
24 changed files with 221 additions and 67 deletions

View File

@ -654,6 +654,7 @@ set(WIRESHARK_COMMON_SRC
clopts_common.c
disabled_protos.c
frame_data_sequence.c
frame_tvbuff.c
packet-range.c
print.c
ps.c

View File

@ -52,6 +52,7 @@ SHARK_COMMON_SRC = \
clopts_common.c \
disabled_protos.c \
frame_data_sequence.c \
frame_tvbuff.c \
packet-range.c \
print.c \
ps.c \
@ -72,6 +73,7 @@ SHARK_COMMON_INCLUDES = \
file.h \
fileset.h \
frame_data_sequence.h \
frame_tvbuff.h \
isprint.h \
packet-range.h \
print.h \

View File

@ -197,13 +197,13 @@ epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
void
epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
const guint8* data, frame_data *fd, column_info *cinfo)
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
{
#ifdef HAVE_LUA
wslua_prime_dfilter(edt); /* done before entering wmem scope */
#endif
wmem_enter_packet_scope();
dissect_packet(edt, phdr, data, fd, cinfo);
dissect_packet(edt, phdr, tvb, fd, cinfo);
/* free all memory allocated */
ep_free_all();
@ -212,11 +212,11 @@ epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
void
epan_dissect_run_with_taps(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
const guint8* data, frame_data *fd, column_info *cinfo)
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
{
wmem_enter_packet_scope();
tap_queue_init(edt);
dissect_packet(edt, phdr, data, fd, cinfo);
dissect_packet(edt, phdr, tvb, fd, cinfo);
tap_push_tapped_queue(edt);
/* free all memory allocated */

View File

@ -158,12 +158,12 @@ epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols);
WS_DLL_PUBLIC
void
epan_dissect_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
const guint8* data, frame_data *fd, column_info *cinfo);
tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
WS_DLL_PUBLIC
void
epan_dissect_run_with_taps(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
const guint8* data, frame_data *fd, column_info *cinfo);
tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
/** Prime a proto_tree using the fields/protocols used in a dfilter. */
WS_DLL_PUBLIC

View File

@ -320,7 +320,7 @@ final_registration_all_protocols(void)
/* Creates the top-most tvbuff and calls dissect_frame() */
void
dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
const guchar *pd, frame_data *fd, column_info *cinfo)
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
{
/* We have to preserve the pool pointer across the memzeroing */
wmem_allocator_t *tmp = edt->pi.pool;
@ -348,7 +348,7 @@ dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
edt->pi.annex_a_used = MTP2_ANNEX_A_USED_UNKNOWN;
edt->pi.dcerpc_procedure_name="";
edt->pi.link_dir = LINK_DIR_UNKNOWN;
edt->tvb = NULL;
edt->tvb = tvb;
/* to enable decode as for ethertype=0x0000 (fix for bug 4721) */
edt->pi.ethertype = G_MAXINT;
@ -356,31 +356,6 @@ dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
EP_CHECK_CANARY(("before dissecting frame %d",fd->num));
TRY {
/*
* XXX - currently, the length arguments to
* tvb_new_real_data() are signed, but the captured
* and reported length values are unsigned; this means
* that length values > 2^31 - 1 will appear as
* negative lengths in tvb_new_real_data().
*
* Captured length values that large will already
* have been filtered out by the Wiretap modules
* (the file will be reported as corrupted), to
* avoid trying to allocate large chunks of data.
*
* Reported length values will not have been
* filtered out, and should not be filtered out,
* as those lengths are not necessarily invalid.
*
* For now, we clip the reported length at G_MAXINT,
* so that tvb_new_real_data() doesn't fail. It
* would throw an exception, which we'd catch, but
* that would mean we would have no tvbuffs
* associated with edt, which would upset much of
* the rest of the application.
*/
edt->tvb = tvb_new_real_data(pd, fd->cap_len,
fd->pkt_len > G_MAXINT ? G_MAXINT : fd->pkt_len);
/* Add this tvbuffer into the data_src list */
add_new_data_source(&edt->pi, edt->tvb, "Frame");

View File

@ -442,7 +442,7 @@ WS_DLL_PUBLIC void mark_frame_as_depended_upon(packet_info *pinfo, guint32 frame
* Dissectors should never modify the packet data.
*/
extern void dissect_packet(epan_dissect_t *edt,
struct wtap_pkthdr *phdr, const guchar *pd,
struct wtap_pkthdr *phdr, tvbuff_t *tvb,
frame_data *fd, column_info *cinfo);
/* These functions are in packet-ethertype.c */

View File

@ -62,7 +62,7 @@ ensure_contiguous_no_exception(tvbuff_t *tvb, const gint offset, const gint leng
static guint64
_tvb_get_bits64(tvbuff_t *tvb, guint bit_offset, const gint total_no_of_bits);
static tvbuff_t *
tvbuff_t *
tvb_new(const struct tvb_ops *ops)
{
tvbuff_t *tvb;

View File

@ -113,6 +113,8 @@ typedef struct tvbuff tvbuff_t;
typedef void (*tvbuff_free_cb_t)(void*);
WS_DLL_PUBLIC tvbuff_t *tvb_new(const struct tvb_ops *ops)
/** Extracts 'number of bits' starting at 'bit offset'.
* Returns a pointer to a newly initialized ep_alloc'd REAL_DATA
* tvbuff with the bits octet aligned.

27
file.c
View File

@ -55,6 +55,7 @@
#include "print.h"
#include "file.h"
#include "fileset.h"
#include "frame_tvbuff.h"
#include "wsutil/tempfile.h"
#include "merge.h"
@ -1131,7 +1132,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
epan_dissect_prime_dfilter(&edt, dfcode);
}
epan_dissect_run_with_taps(&edt, phdr, buf, fdata, cinfo);
epan_dissect_run_with_taps(&edt, phdr, frame_tvbuff_new(fdata, buf), fdata, cinfo);
/* If we don't have a display filter, set "passed_dfilter" to 1. */
if (dfcode != NULL) {
@ -1217,7 +1218,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
epan_dissect_t edt;
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, cf->rfcode);
epan_dissect_run(&edt, phdr, buf, &fdlocal, NULL);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(&fdlocal, buf), &fdlocal, NULL);
passed = dfilter_apply_edt(cf->rfcode, &edt);
epan_dissect_cleanup(&edt);
}
@ -2292,7 +2293,7 @@ retap_packet(capture_file *cf _U_, frame_data *fdata,
epan_dissect_t edt;
epan_dissect_init(&edt, args->construct_protocol_tree, FALSE);
epan_dissect_run_with_taps(&edt, phdr, pd, fdata, args->cinfo);
epan_dissect_run_with_taps(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, args->cinfo);
epan_dissect_cleanup(&edt);
return TRUE;
@ -2388,10 +2389,10 @@ print_packet(capture_file *cf, frame_data *fdata,
information. */
if (args->print_args->print_summary) {
col_custom_prime_edt(&edt, &cf->cinfo);
epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, &cf->cinfo);
epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
} else
epan_dissect_run(&edt, phdr, pd, fdata, NULL);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, NULL);
if (args->print_formfeed) {
if (!new_page(args->print_args->stream))
@ -2689,7 +2690,7 @@ write_pdml_packet(capture_file *cf _U_, frame_data *fdata,
/* Create the protocol tree, but don't fill in the column information. */
epan_dissect_init(&edt, TRUE, TRUE);
epan_dissect_run(&edt, phdr, pd, fdata, NULL);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, NULL);
/* Write out the information in that tree. */
proto_tree_write_pdml(&edt, fh);
@ -2763,7 +2764,7 @@ write_psml_packet(capture_file *cf, frame_data *fdata,
proto_tree_needed = have_custom_cols(&cf->cinfo);
epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
col_custom_prime_edt(&edt, &cf->cinfo);
epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, &cf->cinfo);
epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
/* Write out the information in that tree. */
@ -2838,7 +2839,7 @@ write_csv_packet(capture_file *cf, frame_data *fdata,
proto_tree_needed = have_custom_cols(&cf->cinfo);
epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
col_custom_prime_edt(&edt, &cf->cinfo);
epan_dissect_run(&edt, phdr, pd, fdata, &cf->cinfo);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, &cf->cinfo);
epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
/* Write out the information in that tree. */
@ -2908,7 +2909,7 @@ write_carrays_packet(capture_file *cf _U_, frame_data *fdata,
epan_dissect_t edt;
epan_dissect_init(&edt, TRUE, TRUE);
epan_dissect_run(&edt, phdr, pd, fdata, NULL);
epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, NULL);
proto_tree_write_carrays(fdata->num, fh, &edt);
epan_dissect_cleanup(&edt);
@ -3001,7 +3002,7 @@ match_protocol_tree(capture_file *cf, frame_data *fdata, void *criterion)
/* Construct the protocol tree, including the displayed text */
epan_dissect_init(&edt, TRUE, TRUE);
/* We don't need the column information */
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
/* Iterate through all the nodes, seeing if they have text that matches. */
mdata->cf = cf;
@ -3105,7 +3106,7 @@ match_summary_line(capture_file *cf, frame_data *fdata, void *criterion)
/* Don't bother constructing the protocol tree */
epan_dissect_init(&edt, FALSE, FALSE);
/* Get the column information */
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata,
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata,
&cf->cinfo);
/* Find the Info column */
@ -3413,7 +3414,7 @@ match_dfilter(capture_file *cf, frame_data *fdata, void *criterion)
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
result = dfilter_apply_edt(sfcode, &edt) ? MR_MATCHED : MR_NOTMATCHED;
epan_dissect_cleanup(&edt);
return result;
@ -3746,7 +3747,7 @@ cf_select_packet(capture_file *cf, int row)
cf->edt = epan_dissect_new(TRUE, TRUE);
tap_build_interesting(cf->edt);
epan_dissect_run(cf->edt, &cf->phdr, buffer_start_ptr(&cf->buf),
epan_dissect_run(cf->edt, &cf->phdr, frame_tvbuff_new_buffer(cf->current_frame, &cf->buf),
cf->current_frame, NULL);
dfilter_macro_build_ftv_cache(cf->edt->tree);

114
frame_tvbuff.c Normal file
View File

@ -0,0 +1,114 @@
/* frame_tvbuff.c
* Implements a tvbuff for frame
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include <epan/tvbuff-int.h>
#include <epan/tvbuff.h>
#include "frame_tvbuff.h"
/* XXX, to read data with wtap_seek_read() we need:
* cf->wth, fdata->file_off, fdata->cap_len
* add when ready to structure below
*/
struct tvb_frame {
struct tvbuff tvb;
};
static gsize
frame_sizeof(void)
{
return sizeof(struct tvb_frame);
}
static guint
frame_offset(const tvbuff_t *tvb _U_, const guint counter)
{
return counter;
}
static const struct tvb_ops tvb_frame_ops = {
frame_sizeof, /* size */
NULL, /* free */
frame_offset, /* offset */
NULL, /* get_ptr */
NULL, /* memcpy */
NULL, /* find_guint8 */
NULL, /* pbrk_guint8 */
};
/* based on tvb_new_real_data() */
tvbuff_t *
frame_tvbuff_new(const frame_data *fd, const guint8 *buf)
{
tvbuff_t *tvb;
tvb = tvb_new(&tvb_frame_ops);
/*
* XXX - currently, the length arguments in
* tvbuff structure are signed, but the captured
* and reported length values are unsigned; this means
* that length values > 2^31 - 1 will appear as
* negative lengths
*
* Captured length values that large will already
* have been filtered out by the Wiretap modules
* (the file will be reported as corrupted), to
* avoid trying to allocate large chunks of data.
*
* Reported length values will not have been
* filtered out, and should not be filtered out,
* as those lengths are not necessarily invalid.
*
* For now, we clip the reported length at G_MAXINT
*
* (XXX, is this still a problem?) There was an exception when we call
* tvb_new_real_data() now there's no one
*/
tvb->real_data = buf;
tvb->length = fd->cap_len;
tvb->reported_length = fd->pkt_len > G_MAXINT ? G_MAXINT : fd->pkt_len;
tvb->initialized = TRUE;
/*
* This is the top-level real tvbuff for this data source,
* so its data source tvbuff is itself.
*/
tvb->ds_tvb = tvb;
return tvb;
}
tvbuff_t *
frame_tvbuff_new_buffer(const frame_data *fd, Buffer *buf)
{
return frame_tvbuff_new(fd, buffer_start_ptr(buf));
}

40
frame_tvbuff.h Normal file
View File

@ -0,0 +1,40 @@
/* frame_tvbuff.h
* Implements a tvbuff for frame
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __FRAME_TVBUFF__
#define __FRAME_TVBUFF_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern tvbuff_t *frame_tvbuff_new(const frame_data *fd, const guint8 *buf);
extern tvbuff_t *frame_tvbuff_new_buffer(const frame_data *fd, Buffer *buf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __FRAME_TVBUFF_H__ */

View File

@ -28,6 +28,7 @@
#include "globals.h"
#include "proto_hier_stats.h"
#include "frame_tvbuff.h"
#include "ui/progress_dlg.h"
#include <epan/epan_dissect.h>
#include <wtap.h>
@ -153,7 +154,7 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
epan_dissect_init(&edt, TRUE, FALSE);
/* Don't fake protocols. We need them for the protocol hierarchy */
epan_dissect_fake_protocols(&edt, FALSE);
epan_dissect_run(&edt, &phdr, buffer_start_ptr(&buf), frame, cinfo);
epan_dissect_run(&edt, &phdr, frame_tvbuff_new_buffer(frame, &buf), frame, cinfo);
/* Get stats from this protocol tree */
process_tree(edt.tree, ps, frame->pkt_len);

View File

@ -73,6 +73,7 @@
#include "globals.h"
#include <epan/packet.h>
#include "file.h"
#include "frame_tvbuff.h"
#include "disabled_protos.h"
#include <epan/prefs.h>
#include <epan/column.h>
@ -1077,7 +1078,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr,
/* We only need the columns if we're printing packet info but we're
*not* verbose; in verbose mode, we print the protocol tree, not
the protocol summary. */
epan_dissect_run_with_taps(&edt, whdr, pd, &fdata, &cf->cinfo);
epan_dissect_run_with_taps(&edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, &cf->cinfo);
frame_data_set_after_dissect(&fdata, &cum_bytes);
prev_dis_frame = fdata;

View File

@ -64,6 +64,7 @@
#include <epan/timestamp.h>
#include <epan/packet.h>
#include "file.h"
#include "frame_tvbuff.h"
#include "disabled_protos.h"
#include <epan/prefs.h>
#include <epan/column.h>
@ -2696,7 +2697,7 @@ process_packet_first_pass(capture_file *cf,
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
&first_ts, prev_dis, prev_cap);
epan_dissect_run(&edt, whdr, pd, &fdlocal, NULL);
epan_dissect_run(&edt, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
/* Run the read filter if we have one. */
if (cf->rfcode)
@ -2785,7 +2786,7 @@ process_packet_second_pass(capture_file *cf, frame_data *fdata,
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
&first_ts, prev_dis, prev_cap);
epan_dissect_run_with_taps(&edt, phdr, buffer_start_ptr(buf), fdata, cinfo);
epan_dissect_run_with_taps(&edt, phdr, frame_tvbuff_new_buffer(fdata, buf), fdata, cinfo);
/* Run the read/display filter if we have one. */
if (cf->dfcode)
@ -3247,7 +3248,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr,
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
&first_ts, prev_dis, prev_cap);
epan_dissect_run_with_taps(&edt, whdr, pd, &fdata, cinfo);
epan_dissect_run_with_taps(&edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, cinfo);
/* Run the filters if we have them. */
if (cf->rfcode)

View File

@ -89,6 +89,8 @@
#include "ui/gtk/old-gtk-compat.h"
#include "ui/gtk/gui_utils.h"
#include "frame_tvbuff.h"
enum
{
PACKET_COLUMN,
@ -3713,7 +3715,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
return; /* error reading the frame */
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf),
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
fdata, NULL);
/* if it is not an iax2 frame, show an error dialog */

View File

@ -88,6 +88,7 @@
/* general (not GTK specific) */
#include "../file.h"
#include "../frame_tvbuff.h"
#include "../summary.h"
#include "../filters.h"
#include "../disabled_protos.h"
@ -549,7 +550,7 @@ get_ip_address_list_from_packet_list_row(gpointer data)
epan_dissect_init(&edt, FALSE, FALSE);
col_custom_prime_edt(&edt, &cfile.cinfo);
epan_dissect_run(&edt, &cfile.phdr, buffer_start_ptr(&cfile.buf),
epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
fdata, &cfile.cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
@ -590,7 +591,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
epan_dissect_init(&edt, have_custom_cols(&cfile.cinfo), FALSE);
col_custom_prime_edt(&edt, &cfile.cinfo);
epan_dissect_run(&edt, &cfile.phdr, buffer_start_ptr(&cfile.buf),
epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
fdata, &cfile.cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);

View File

@ -48,6 +48,7 @@
#include "color.h"
#include "color_filters.h"
#include "frame_tvbuff.h"
#include "globals.h"
@ -1154,7 +1155,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
* XXX - need to catch an OutOfMemoryError exception and
* attempt to recover from it.
*/
epan_dissect_run(&edt, &phdr, buffer_start_ptr(&buf), fdata, cinfo);
epan_dissect_run(&edt, &phdr, frame_tvbuff_new_buffer(fdata, &buf), fdata, cinfo);
if (dissect_color)
fdata->color_filter = color_filters_colorize_packet(&edt);

View File

@ -68,6 +68,8 @@
#include "ui/gtk/gtkglobals.h"
#include "ui/gtk/gui_utils.h"
#include "frame_tvbuff.h"
#define BV_SIZE 75
#define TV_SIZE 95
@ -193,7 +195,7 @@ redissect_packet_window(gpointer object, gpointer user_data _U_)
proto_tree_draw(NULL, DataPtr->tree_view);
epan_dissect_cleanup(&(DataPtr->edt));
epan_dissect_init(&(DataPtr->edt), TRUE, TRUE);
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL);
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, frame_tvbuff_new(DataPtr->frame, DataPtr->pd), DataPtr->frame, NULL);
add_byte_views(&(DataPtr->edt), DataPtr->tree_view, DataPtr->bv_nb_ptr);
proto_tree_draw(DataPtr->edt.tree, DataPtr->tree_view);
@ -268,7 +270,7 @@ finfo_window_refresh(struct FieldinfoWinData *DataPtr)
if (old_finfo->hfinfo)
proto_tree_prime_hfid(edt.tree, old_finfo->hfinfo->id);
*/
epan_dissect_run(&edt, &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL);
epan_dissect_run(&edt, &DataPtr->phdr, frame_tvbuff_new(DataPtr->frame, DataPtr->pd), DataPtr->frame, NULL);
/* Try to find finfo which looks like old_finfo.
* We might not found one, if protocol requires specific magic values, etc... */
@ -731,7 +733,7 @@ edit_pkt_tree_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, GtkTre
proto_tree_draw(NULL, DataPtr->tree_view);
epan_dissect_cleanup(&(DataPtr->edt));
epan_dissect_init(&(DataPtr->edt), TRUE, TRUE);
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd, DataPtr->frame, NULL);
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, frame_tvbuff_new(DataPtr->frame, DataPtr->pd), DataPtr->frame, NULL);
add_byte_views(&(DataPtr->edt), DataPtr->tree_view, DataPtr->bv_nb_ptr);
proto_tree_draw(DataPtr->edt.tree, DataPtr->tree_view);
}
@ -963,7 +965,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
epan_dissect_init(&(DataPtr->edt), TRUE, TRUE);
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, DataPtr->pd,
epan_dissect_run(&(DataPtr->edt), &DataPtr->phdr, frame_tvbuff_new(DataPtr->frame, DataPtr->pd),
DataPtr->frame, &cfile.cinfo);
epan_dissect_fill_in_columns(&(DataPtr->edt), FALSE, TRUE);

View File

@ -39,6 +39,7 @@
#include <epan/tap.h>
#include "../globals.h"
#include "../frame_tvbuff.h"
#include "ui/simple_dialog.h"
#include "../stat_menu.h"
@ -915,7 +916,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run_with_taps(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
epan_dissect_cleanup(&edt);
remove_tap_listener(&th);

View File

@ -93,6 +93,8 @@
#include "ui/gtk/old-gtk-compat.h"
#include "frame_tvbuff.h"
enum
{
PACKET_COLUMN,
@ -3946,7 +3948,7 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
return; /* error reading the frame */
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
/* if it is not an rtp frame, show the rtpstream dialog */
frame_matched = dfilter_apply_edt(sfcode, &edt);

View File

@ -41,6 +41,8 @@
#include "ui/gtk/sctp_stat.h"
#include "ui/gtk/gtkglobals.h"
#include "frame_tvbuff.h"
static sctp_assoc_info_t static_assoc;
void
@ -977,7 +979,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
frame_matched = dfilter_apply_edt(sfcode, &edt);
/* if it is not an sctp frame, show the dialog */

View File

@ -55,6 +55,8 @@
#include "ui/gtk/old-gtk-compat.h"
#include "frame_tvbuff.h"
#define TCP_SYN(flags) ( flags & TH_SYN )
#define TCP_ACK(flags) ( flags & TH_ACK )
#define TCP_FIN(flags) ( flags & TH_FIN )
@ -1987,7 +1989,7 @@ static struct tcpheader *select_tcpip_session(capture_file *cf, struct segment *
epan_dissect_init(&edt, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run_with_taps(&edt, &cf->phdr, buffer_start_ptr(&cf->buf), fdata, NULL);
epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
epan_dissect_cleanup(&edt);
remove_tap_listener(&th);

View File

@ -45,6 +45,8 @@
#include "wsutil/str_util.h"
#include "frame_tvbuff.h"
#include <QTreeWidget>
#include <QTabWidget>
#include <QTextEdit>
@ -578,7 +580,7 @@ QString &PacketList::getFilterFromRowAndColumn()
epan_dissect_init(&edt, have_custom_cols(&cap_file_->cinfo), FALSE);
col_custom_prime_edt(&edt, &cap_file_->cinfo);
epan_dissect_run(&edt, &cap_file_->phdr, buffer_start_ptr(&cap_file_->buf), fdata, &cap_file_->cinfo);
epan_dissect_run(&edt, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) ||

View File

@ -34,6 +34,7 @@
#include "color.h"
#include "color_filters.h"
#include "frame_tvbuff.h"
#include "wireshark_application.h"
#include <QColor>
@ -247,7 +248,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const
if (dissect_columns)
col_custom_prime_edt(&edt, cinfo);
epan_dissect_run(&edt, &phdr, buffer_start_ptr(&buf), fdata, cinfo);
epan_dissect_run(&edt, &phdr, frame_tvbuff_new_buffer(fdata, &buf), fdata, cinfo);
if (enable_color_)
fdata->color_filter = color_filters_colorize_packet(&edt);