diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-11 05:47:02 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-11 05:47:02 +0000 |
commit | ce81449ed9294f0104598762ce293c3521820987 (patch) | |
tree | 26efdeea2934c6e99869fc3e5761451043dc3e05 | |
parent | 19d2d0dc765cd2417d693746226472207190434a (diff) | |
download | wireshark-ce81449ed9294f0104598762ce293c3521820987.tar.gz wireshark-ce81449ed9294f0104598762ce293c3521820987.tar.bz2 wireshark-ce81449ed9294f0104598762ce293c3521820987.zip |
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
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | Makefile.common | 2 | ||||
-rw-r--r-- | epan/epan.c | 8 | ||||
-rw-r--r-- | epan/epan.h | 4 | ||||
-rw-r--r-- | epan/packet.c | 29 | ||||
-rw-r--r-- | epan/packet.h | 2 | ||||
-rw-r--r-- | epan/tvbuff.c | 2 | ||||
-rw-r--r-- | epan/tvbuff.h | 2 | ||||
-rw-r--r-- | file.c | 27 | ||||
-rw-r--r-- | frame_tvbuff.c | 114 | ||||
-rw-r--r-- | frame_tvbuff.h | 40 | ||||
-rw-r--r-- | proto_hier_stats.c | 3 | ||||
-rw-r--r-- | rawshark.c | 3 | ||||
-rw-r--r-- | tshark.c | 7 | ||||
-rw-r--r-- | ui/gtk/iax2_analysis.c | 4 | ||||
-rw-r--r-- | ui/gtk/main.c | 5 | ||||
-rw-r--r-- | ui/gtk/packet_list_store.c | 3 | ||||
-rw-r--r-- | ui/gtk/packet_win.c | 10 | ||||
-rw-r--r-- | ui/gtk/rlc_lte_graph.c | 3 | ||||
-rw-r--r-- | ui/gtk/rtp_analysis.c | 4 | ||||
-rw-r--r-- | ui/gtk/sctp_assoc_analyse.c | 4 | ||||
-rw-r--r-- | ui/gtk/tcp_graph.c | 4 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 4 | ||||
-rw-r--r-- | ui/qt/packet_list_model.cpp | 3 |
24 files changed, 221 insertions, 67 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 315e2f9c59..4961d9fb77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Makefile.common b/Makefile.common index 447af8694f..ed439c2680 100644 --- a/Makefile.common +++ b/Makefile.common @@ -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 \ diff --git a/epan/epan.c b/epan/epan.c index 47cfada4bb..554e86e2ea 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -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 */ diff --git a/epan/epan.h b/epan/epan.h index e138362df4..6882947c17 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -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 diff --git a/epan/packet.c b/epan/packet.c index ef62e803c2..43f15d89e2 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -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"); diff --git a/epan/packet.h b/epan/packet.h index a1d3c5a6f6..2d1e231a75 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -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 */ diff --git a/epan/tvbuff.c b/epan/tvbuff.c index e504f0c8aa..bd1b644bfd 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -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; diff --git a/epan/tvbuff.h b/epan/tvbuff.h index e8530d1e53..a15f174b71 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -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. @@ -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 index 0000000000..5af5b3bc23 --- /dev/null +++ b/frame_tvbuff.c @@ -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 index 0000000000..5d2d98112f --- /dev/null +++ b/frame_tvbuff.h @@ -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__ */ diff --git a/proto_hier_stats.c b/proto_hier_stats.c index 95b99aeac4..4ff34ba10b 100644 --- a/proto_hier_stats.c +++ b/proto_hier_stats.c @@ -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); diff --git a/rawshark.c b/rawshark.c index 3634d2317a..670b9addba 100644 --- a/rawshark.c +++ b/rawshark.c @@ -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; @@ -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) diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index d412eda5b5..142727c6b3 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -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 */ diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 7028b69380..ae5e03b82c 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -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); diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index 2ebc094947..8a5a008e0e 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -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); diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index 1af6c767bf..5cb45dfff8 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -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); diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c index f6a2bffe94..1e28bd960d 100644 --- a/ui/gtk/rlc_lte_graph.c +++ b/ui/gtk/rlc_lte_graph.c @@ -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); diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index 5bd3f49558..647775e6d4 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -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); diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c index aafc43ff88..952819b337 100644 --- a/ui/gtk/sctp_assoc_analyse.c +++ b/ui/gtk/sctp_assoc_analyse.c @@ -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 */ diff --git a/ui/gtk/tcp_graph.c b/ui/gtk/tcp_graph.c index 7d5a7243b3..8aa9793856 100644 --- a/ui/gtk/tcp_graph.c +++ b/ui/gtk/tcp_graph.c @@ -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); diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 0eeb4a1588..44bb090378 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -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_]) || diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index 28d65c385e..3f7d00221e 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -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); |