packet dissection now takes pointer to tvb instead of guint8 data
authorJakub Zawadzki <darkjames-ws@darkjames.pl>
Thu, 11 Jul 2013 05:47:02 +0000 (05:47 -0000)
committerJakub Zawadzki <darkjames-ws@darkjames.pl>
Thu, 11 Jul 2013 05:47:02 +0000 (05:47 -0000)
implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497

24 files changed:
CMakeLists.txt
Makefile.common
epan/epan.c
epan/epan.h
epan/packet.c
epan/packet.h
epan/tvbuff.c
epan/tvbuff.h
file.c
frame_tvbuff.c [new file with mode: 0644]
frame_tvbuff.h [new file with mode: 0644]
proto_hier_stats.c
rawshark.c
tshark.c
ui/gtk/iax2_analysis.c
ui/gtk/main.c
ui/gtk/packet_list_store.c
ui/gtk/packet_win.c
ui/gtk/rlc_lte_graph.c
ui/gtk/rtp_analysis.c
ui/gtk/sctp_assoc_analyse.c
ui/gtk/tcp_graph.c
ui/qt/packet_list.cpp
ui/qt/packet_list_model.cpp

index 315e2f9c59dc5f797f46e3da90635d7bf3edfb52..4961d9fb77ec05fbb4737f6ae5e60998678221e8 100644 (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
index 447af8694fd52e9b3e6be59dfa6f5e096b9c08ed..ed439c26802935c296bce266fb09b3106b047ecc 100644 (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                 \
index 47cfada4bb4d5c89253fe943c9f840704243218d..554e86e2ea567d160cfc11c3691bd93b3fb5b96d 100644 (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 */
index e138362df4bea8d4b21780eaff62cc1389b5600b..6882947c17d9d01e914c425829802dc2479956a2 100644 (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
index ef62e803c2e839194206fdb33c6aa82af1a296e0..43f15d89e280eefdd3b4f9b45b8ee9d956c06c67 100644 (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");
 
index a1d3c5a6f6c4b5b3ccb3866c19503acaa086b0a4..2d1e231a753ad5ab6e5cedb15927e1abf56d15eb 100644 (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 */
index e504f0c8aa8a1b4dfbc5c54b02bf928f5fb45ffa..bd1b644bfdf5a8133280e6b5fa7973bad0de0c20 100644 (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;
index e8530d1e5345e3bfad88b58e8b0c7ee8de5092fb..a15f174b71a7624a609bdde633f17773ecd5e5d3 100644 (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.
diff --git a/file.c b/file.c
index 9874e3559d79f756b935963ba630334a3d28bfb7..bb09a9de929849163514f4b51bcae215eda5c1d5 100644 (file)
--- a/file.c
+++ b/file.c
@@ -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);
diff --git a/frame_tvbuff.c b/frame_tvbuff.c
new file mode 100644 (file)
index 0000000..5af5b3b
--- /dev/null
@@ -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));
+}
diff --git a/frame_tvbuff.h b/frame_tvbuff.h
new file mode 100644 (file)
index 0000000..5d2d981
--- /dev/null
@@ -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__ */
index 95b99aeac4b4cc243c9915f443b862dce4193d95..4ff34ba10b34dae1cd2e49db96575567984ffe7c 100644 (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);
index 3634d2317ad94c7970f4ac8722f2f9e67bf155f6..670b9addba7a95d1eae94b892f414fedd2f5783e 100644 (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;
index a6f59cbbffff3140118a9776a183b7601a8dbc49..0ad094900ca43c99b7fb6ddb0fe0dc99b61de117 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -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)
index d412eda5b518a539c3bd7811a45868531b728195..142727c6b3aa6df201e19187a8b66a9ef286f6f6 100644 (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 */
index 7028b6938026c9cbe0bc02a3844b3d61d8e1c8d0..ae5e03b82cd9a6ad338b740d30b6c4ac7cfa7d2d 100644 (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);
 
index 2ebc0949470bca919f6f8e973553b3f23fc76c7e..8a5a008e0eada462911fddfae8d086403a8fde1d 100644 (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);
index 1af6c767bfafb613c9691e2c5802dad3e098bc9f..5cb45dfff87ee58cb56f03cb26205aba8c7a4900 100644 (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);
 
index f6a2bffe942bf170cc309c10b4d80e6d0679fb03..1e28bd960d7803289b309456b09f80775ccdf158 100644 (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);
 
index 5bd3f49558cdea6b422548b1e7a9a28a04b9592e..647775e6d4cf696e14cc47650a76783bd6eb7a7b 100644 (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);
index aafc43ff889ec13996d87d0c6e20cb37f4adeece..952819b337d119f0967ddff32d6a90d5c577a632 100644 (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 */
index 7d5a7243b3e6ed175a656642fc62f251ffadf1fb..8aa97938562ae380c952b3365d2807cc8b83c815 100644 (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);
 
index 0eeb4a158813a23d8e7f6e498009aee5d3f1aa10..44bb090378c3747c6fdc7908d09273f564fe1f9b 100644 (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_]) ||
index 28d65c385ea460cf5f658def38d9420bf7b4e636..3f7d00221e9bc561fade4bc17272c2c8d54bb610 100644 (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);