Some work on multi file dissection
authorJakub Zawadzki <darkjames-ws@darkjames.pl>
Sun, 21 Jul 2013 18:38:03 +0000 (18:38 -0000)
committerJakub Zawadzki <darkjames-ws@darkjames.pl>
Sun, 21 Jul 2013 18:38:03 +0000 (18:38 -0000)
- make init_dissection/cleanup_dissection private for libwireshark
- implement epan_new(), epan_free()
- pass epan_t to epan_dissect*

svn path=/trunk/; revision=50761

19 files changed:
cfile.h
epan/epan.c
epan/epan.h
epan/epan_dissect.h
epan/packet.h
file.c
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

diff --git a/cfile.h b/cfile.h
index f4f0890637f3d06fe47d4d6ea56c0d26d6e8eef4..e9fb2afb999271ff4e40c74a26cf1ccd5c9baff5 100644 (file)
--- a/cfile.h
+++ b/cfile.h
@@ -68,6 +68,7 @@ typedef enum {
 #define NODES_PER_LEVEL                (1<<LOG2_NODES_PER_LEVEL)
 
 typedef struct _capture_file {
+  epan_t      *epan;
   file_state   state;           /* Current state of capture file */
   gchar       *filename;        /* Name of capture file */
   gchar       *source;          /* Temp file source, e.g. "Pipe from elsewhere" */
index 023d580436f61ac90ef95cd29fac1409ac850975..6382f79703027226d937150f9bb7ffc71c67b195 100644 (file)
@@ -40,6 +40,7 @@
 #include "epan_dissect.h"
 #include "wsutil/report_err.h"
 
+#include "epan-int.h"
 #include "conversation.h"
 #include "circuit.h"
 #include "except.h"
@@ -134,6 +135,26 @@ epan_cleanup(void)
        wmem_cleanup();
 }
 
+epan_t *
+epan_new(void)
+{
+       epan_t *session = g_slice_new(epan_t);
+
+       /* XXX, it should take session as param */
+       init_dissection();
+
+       return session;
+}
+
+void
+epan_free(epan_t *session)
+{
+       /* XXX, it should take session as param */
+       cleanup_dissection();
+
+       g_slice_free(epan_t, session);
+}
+
 void
 epan_conversation_init(void)
 {
@@ -159,10 +180,11 @@ epan_circuit_cleanup(void)
 }
 
 epan_dissect_t*
-epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible)
+epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible)
 {
        g_assert(edt);
 
+       edt->session = session;
        edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);
 
        if (create_proto_tree) {
@@ -179,13 +201,13 @@ epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const g
 }
 
 epan_dissect_t*
-epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible)
+epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible)
 {
        epan_dissect_t *edt;
 
        edt = g_new0(epan_dissect_t, 1);
 
-       return epan_dissect_init(edt, create_proto_tree, proto_tree_visible);
+       return epan_dissect_init(edt, session, create_proto_tree, proto_tree_visible);
 }
 
 void
index 6882947c17d9d01e914c425829802dc2479956a2..263a80f353fdfbbab9ba252b1b6d144f8c662396 100644 (file)
@@ -125,14 +125,11 @@ void epan_circuit_cleanup(void);
  * some protocols cannot be decoded without knowledge of previous packets.
  * This inter-packet "state" is stored in the epan_t.
  */
-/* XXX - NOTE: epan_t, epan_new and epan_free are currently unused! */
 typedef struct epan_session epan_t;
 
-epan_t*
-epan_new(void);
+WS_DLL_PUBLIC epan_t *epan_new(void);
 
-void
-epan_free(epan_t*);
+WS_DLL_PUBLIC void epan_free(epan_t *session);
 
 WS_DLL_PUBLIC const gchar*
 epan_get_version(void);
@@ -140,14 +137,14 @@ epan_get_version(void);
 /** initialize an existing single packet dissection */
 WS_DLL_PUBLIC
 epan_dissect_t*
-epan_dissect_init(epan_dissect_t       *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible);
+epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
 
 /** get a new single packet dissection
  * should be freed using epan_dissect_free() after packet dissection completed
  */
 WS_DLL_PUBLIC
 epan_dissect_t*
-epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible);
+epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
 
 /** Indicate whether we should fake protocols or not */
 WS_DLL_PUBLIC
index ff48107a5d5e1f492f0ebcf829e4306ce68beec2..98e4a0b8e94c837cb0872acffcab3c2791cec818 100644 (file)
@@ -39,6 +39,7 @@ extern "C" {
  * to addresses in your byte array.
  */
 struct _epan_dissect_t {
+       struct epan_session *session;
        tvbuff_t        *tvb;
        proto_tree      *tree;
        packet_info     pi;
index 2d1e231a753ad5ab6e5cedb15927e1abf56d15eb..107eab3a5db043da59c7fab2306b15b44d3aceb8 100644 (file)
@@ -382,10 +382,10 @@ WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
 
 /* Initialize all data structures used for dissection. */
-WS_DLL_PUBLIC void init_dissection(void);
+void init_dissection(void);
 
 /* Free data structures allocated for dissection. */
-WS_DLL_PUBLIC void cleanup_dissection(void);
+void cleanup_dissection(void);
 
 /* Allow protocols to register a "cleanup" routine to be
  * run after the initial sequential run through the packets.
diff --git a/file.c b/file.c
index dfb1d1b0ce441b51a8b302e387ffc07cc7dfa12b..c230326d3302c5b737b5bed9daaa3a3c8b3d736a 100644 (file)
--- a/file.c
+++ b/file.c
@@ -320,10 +320,9 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
      the packets, so we know how much we'll ultimately need. */
   buffer_init(&cf->buf, 1500);
 
-  /* Cleanup all data structures used for dissection. */
-  cleanup_dissection();
-  /* Initialize all data structures used for dissection. */
-  init_dissection();
+  /* Create new epan session for dissection. */
+  epan_free(cf->epan);
+  cf->epan = epan_new();
 
   /* We're about to start reading the file. */
   cf->state = FILE_READ_IN_PROGRESS;
@@ -492,7 +491,8 @@ cf_close(capture_file *cf)
   /* close things, if not already closed before */
     color_filters_cleanup();
     cf_reset_state(cf);
-    cleanup_dissection();
+    epan_free(cf->epan);
+    cf->epan = NULL;
 
     cf_callback_invoke(cf_cb_file_closed, cf);
   }
@@ -1127,7 +1127,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
   prev_cap = fdata;
 
   /* Dissect the frame. */
-  epan_dissect_init(&edt, create_proto_tree, FALSE);
+  epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
 
   if (dfcode != NULL) {
       epan_dissect_prime_dfilter(&edt, dfcode);
@@ -1217,7 +1217,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
   passed = TRUE;
   if (cf->rfcode) {
     epan_dissect_t edt;
-    epan_dissect_init(&edt, TRUE, FALSE);
+    epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
     epan_dissect_prime_dfilter(&edt, cf->rfcode);
     epan_dissect_run(&edt, phdr, frame_tvbuff_new(&fdlocal, buf), &fdlocal, NULL);
     passed = dfilter_apply_edt(cf->rfcode, &edt);
@@ -1819,10 +1819,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
        want to dissect those before their time. */
     cf->redissecting = TRUE;
 
-    /* Cleanup all data structures used for dissection. */
-    cleanup_dissection();
-    /* Initialize all data structures used for dissection. */
-    init_dissection();
+    /* 'reset' dissection session */
+    epan_free(cf->epan);
+    cf->epan = epan_new();
 
     /* We need to redissect the packets so we have to discard our old
      * packet list store. */
@@ -2293,7 +2292,7 @@ retap_packet(capture_file *cf _U_, frame_data *fdata,
   retap_callback_args_t *args = (retap_callback_args_t *)argsp;
   epan_dissect_t         edt;
 
-  epan_dissect_init(&edt, args->construct_protocol_tree, FALSE);
+  epan_dissect_init(&edt, cf->epan, args->construct_protocol_tree, FALSE);
   epan_dissect_run_with_taps(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, args->cinfo);
   epan_dissect_cleanup(&edt);
 
@@ -2384,7 +2383,7 @@ print_packet(capture_file *cf, frame_data *fdata,
      XXX - do we need it if we're just printing the hex data? */
   proto_tree_needed =
       args->print_args->print_dissections != print_dissections_none || args->print_args->print_hex || have_custom_cols(&cf->cinfo);
-  epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
+  epan_dissect_init(&edt, cf->epan, proto_tree_needed, proto_tree_needed);
 
   /* Fill in the column information if we're printing the summary
      information. */
@@ -2690,7 +2689,7 @@ write_pdml_packet(capture_file *cf _U_, frame_data *fdata,
   epan_dissect_t  edt;
 
   /* Create the protocol tree, but don't fill in the column information. */
-  epan_dissect_init(&edt, TRUE, TRUE);
+  epan_dissect_init(&edt, cf->epan, TRUE, TRUE);
   epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, NULL);
 
   /* Write out the information in that tree. */
@@ -2763,7 +2762,7 @@ write_psml_packet(capture_file *cf, frame_data *fdata,
   /* Fill in the column information, only create the protocol tree
      if having custom columns. */
   proto_tree_needed = have_custom_cols(&cf->cinfo);
-  epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
+  epan_dissect_init(&edt, cf->epan, proto_tree_needed, proto_tree_needed);
   col_custom_prime_edt(&edt, &cf->cinfo);
   epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, &cf->cinfo);
   epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
@@ -2838,7 +2837,7 @@ write_csv_packet(capture_file *cf, frame_data *fdata,
   /* Fill in the column information, only create the protocol tree
      if having custom columns. */
   proto_tree_needed = have_custom_cols(&cf->cinfo);
-  epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
+  epan_dissect_init(&edt, cf->epan, proto_tree_needed, proto_tree_needed);
   col_custom_prime_edt(&edt, &cf->cinfo);
   epan_dissect_run(&edt, phdr, frame_tvbuff_new(fdata, pd), fdata, &cf->cinfo);
   epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
@@ -2902,14 +2901,14 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
 }
 
 static gboolean
-write_carrays_packet(capture_file *cf _U_, frame_data *fdata,
+write_carrays_packet(capture_file *cf, frame_data *fdata,
              struct wtap_pkthdr *phdr,
              const guint8 *pd, void *argsp)
 {
   FILE           *fh = (FILE *)argsp;
   epan_dissect_t  edt;
 
-  epan_dissect_init(&edt, TRUE, TRUE);
+  epan_dissect_init(&edt, cf->epan, TRUE, TRUE);
   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 +3000,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);
+  epan_dissect_init(&edt, cf->epan, TRUE, TRUE);
   /* We don't need the column information */
   epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
 
@@ -3105,7 +3104,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);
+  epan_dissect_init(&edt, cf->epan, FALSE, FALSE);
   /* Get the column information */
   epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata,
                    &cf->cinfo);
@@ -3413,7 +3412,7 @@ match_dfilter(capture_file *cf, frame_data *fdata, void *criterion)
     return MR_ERROR;
   }
 
-  epan_dissect_init(&edt, TRUE, FALSE);
+  epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
   epan_dissect_prime_dfilter(&edt, sfcode);
   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;
@@ -3745,7 +3744,7 @@ cf_select_packet(capture_file *cf, int row)
   old_edt = cf->edt;
   /* Create the logical protocol tree. */
   /* We don't need the columns here. */
-  cf->edt = epan_dissect_new(TRUE, TRUE);
+  cf->edt = epan_dissect_new(cf->epan, TRUE, TRUE);
 
   tap_build_interesting(cf->edt);
   epan_dissect_run(cf->edt, &cf->phdr, frame_tvbuff_new_buffer(cf->current_frame, &cf->buf),
index 4ff34ba10b34dae1cd2e49db96575567984ffe7c..d1ac0232b6872e4c2aa806dbd12fa80a75d47e12 100644 (file)
@@ -151,7 +151,7 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
                return FALSE;   /* failure */
 
        /* Dissect the frame   tree  not visible */
-       epan_dissect_init(&edt, TRUE, FALSE);
+       epan_dissect_init(&edt, cfile.epan, TRUE, FALSE);
        /* Don't fake protocols. We need them for the protocol hierarchy */
        epan_dissect_fake_protocols(&edt, FALSE);
        epan_dissect_run(&edt, &phdr, frame_tvbuff_new_buffer(frame, &buf), frame, cinfo);
index cb1d70f26f9775beee126bfc91ee6f7426ef2c55..01149007c0e77490d6b0b3f1ba982758de69eb6d 100644 (file)
@@ -1060,7 +1060,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr,
     /* The protocol tree will be "visible", i.e., printed, only if we're
        printing packet details, which is true if we're in verbose mode ("verbose"
        is true). */
-    epan_dissect_init(&edt, create_proto_tree, FALSE);
+    epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
 
     /* If we're running a read filter, prime the epan_dissect_t with that
        filter. */
@@ -1573,10 +1573,9 @@ raw_cf_open(capture_file *cf, const char *fname)
 
     /* The open succeeded.  Fill in the information for this file. */
 
-    /* Cleanup all data structures used for dissection. */
-    cleanup_dissection();
-    /* Initialize all data structures used for dissection. */
-    init_dissection();
+    /* Create new epan session for dissection. */
+    epan_free(cf->epan);
+    cf->epan = epan_new();
 
     cf->wth = NULL;
     cf->f_datalen = 0; /* not used, but set it anyway */
index 17b84e088a5c090a4f738c7692b47cfc05ea9a39..a9cff874852407d73f11c09d64ca162bfa8dc19e 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -2196,10 +2196,9 @@ capture(void)
   relinquish_special_privs_perm();
   print_current_user();
 
-  /* Cleanup all data structures used for dissection. */
-  cleanup_dissection();
-  /* Initialize all data structures used for dissection. */
-  init_dissection();
+  /* Create new dissection section. */
+  epan_free(cfile.epan);
+  cfile.epan = epan_new();
 
 #ifdef _WIN32
   /* Catch a CTRL+C event and, if we get it, clean up and exit. */
@@ -2687,7 +2686,7 @@ process_packet_first_pass(capture_file *cf,
 
     /* We're not going to display the protocol tree on this pass,
        so it's not going to be "visible". */
-    epan_dissect_init(&edt, create_proto_tree, FALSE);
+    epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
 
     /* If we're running a read filter, prime the epan_dissect_t with that
        filter. */
@@ -2763,7 +2762,7 @@ process_packet_second_pass(capture_file *cf, frame_data *fdata,
        printing packet details, which is true if we're printing stuff
        ("print_packet_info" is true) and we're in verbose mode
        ("packet_details" is true). */
-    epan_dissect_init(&edt, create_proto_tree, print_packet_info && print_details);
+    epan_dissect_init(&edt, cf->epan, create_proto_tree, print_packet_info && print_details);
 
     /* If we're running a display filter, prime the epan_dissect_t with that
        filter. */
@@ -3222,7 +3221,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr,
        printing packet details, which is true if we're printing stuff
        ("print_packet_info" is true) and we're in verbose mode
        ("packet_details" is true). */
-    epan_dissect_init(&edt, create_proto_tree, print_packet_info && print_details);
+    epan_dissect_init(&edt, cf->epan, create_proto_tree, print_packet_info && print_details);
 
     /* If we're running a filter, prime the epan_dissect_t with that
        filter. */
@@ -3706,10 +3705,9 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
 
   /* The open succeeded.  Fill in the information for this file. */
 
-  /* Cleanup all data structures used for dissection. */
-  cleanup_dissection();
-  /* Initialize all data structures used for dissection. */
-  init_dissection();
+  /* Create new epan session for dissection. */
+  epan_free(cf->epan);
+  cf->epan = epan_new();
 
   cf->wth = wth;
   cf->f_datalen = 0; /* not used, but set it anyway */
index fe8de8db34bb3db8edffefafe1ce927249c4e634..aa00b352792b3ddb7f1855897efa549e745cc9e7 100644 (file)
@@ -3712,7 +3712,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
        /* dissect the current frame */
        if (!cf_read_frame(cf, fdata))
                return; /* error reading the frame */
-       epan_dissect_init(&edt, TRUE, FALSE);
+       epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
        epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
            fdata, NULL);
index ab137a2d974327ee8ff6fa858105795582dff507..4835b50da0147b827ee6b1cff78723b15962ead4 100644 (file)
@@ -547,7 +547,7 @@ get_ip_address_list_from_packet_list_row(gpointer data)
         if (!cf_read_frame (&cfile, fdata))
             return NULL; /* error reading the frame */
 
-        epan_dissect_init(&edt, FALSE, FALSE);
+        epan_dissect_init(&edt, cfile.epan, FALSE, FALSE);
         col_custom_prime_edt(&edt, &cfile.cinfo);
 
         epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
@@ -588,7 +588,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
         if (!cf_read_frame(&cfile, fdata))
             return NULL; /* error reading the frame */
         /* proto tree, visible. We need a proto tree if there's custom columns */
-        epan_dissect_init(&edt, have_custom_cols(&cfile.cinfo), FALSE);
+        epan_dissect_init(&edt, cfile.epan, have_custom_cols(&cfile.cinfo), FALSE);
         col_custom_prime_edt(&edt, &cfile.cinfo);
 
         epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
index 8a5a008e0eada462911fddfae8d086403a8fde1d..e7cb64bef827802ab33f6db665b792bcdac97f91 100644 (file)
@@ -1142,7 +1142,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
        create_proto_tree = (dissect_color && color_filters_used()) ||
                                                (dissect_columns && have_custom_cols(cinfo));
 
-       epan_dissect_init(&edt,
+       epan_dissect_init(&edt, cfile.epan,
                                          create_proto_tree,
                                          FALSE /* proto_tree_visible */);
 
index 541e9c1a6845b340a2db2c8847a04ff3c430aaf4..32535eeee1473a21957cb583daeacf65fdfca8f3 100644 (file)
@@ -75,6 +75,7 @@
 
 /* Data structure holding information about a packet-detail window. */
 struct PacketWinData {
+       epan_t *epan;
        frame_data *frame;         /* The frame being displayed */
        struct wtap_pkthdr phdr;   /* Packet header */
        guint8     *pd;            /* Packet data */
@@ -194,7 +195,7 @@ redissect_packet_window(gpointer object, gpointer user_data _U_)
        /* XXX, can be optimized? */
        proto_tree_draw(NULL, DataPtr->tree_view);
        epan_dissect_cleanup(&(DataPtr->edt));
-       epan_dissect_init(&(DataPtr->edt), TRUE, TRUE);
+       epan_dissect_init(&(DataPtr->edt), DataPtr->epan, TRUE, TRUE);
        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);
@@ -265,7 +266,7 @@ finfo_window_refresh(struct FieldinfoWinData *DataPtr)
        }
 
        /* redisect */
-       epan_dissect_init(&edt, TRUE, TRUE);
+       epan_dissect_init(&edt, DataPtr->epan, TRUE, TRUE);
        /* Makes any sense?
        if (old_finfo->hfinfo)
                proto_tree_prime_hfid(edt.tree, old_finfo->hfinfo->id);
@@ -732,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_init(&(DataPtr->edt), DataPtr->epan, TRUE, TRUE);
                        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);
@@ -959,12 +960,14 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
        /* Allocate data structure to represent this window. */
        DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData));
 
+       /* XXX, protect cfile.epan from closing (ref counting?) */
+       DataPtr->epan  = cfile.epan;
        DataPtr->frame = fd;
        DataPtr->phdr  = cfile.phdr;
        DataPtr->pd = (guint8 *)g_malloc(DataPtr->frame->cap_len);
        memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
 
-       epan_dissect_init(&(DataPtr->edt), TRUE, TRUE);
+       epan_dissect_init(&(DataPtr->edt), DataPtr->epan, TRUE, TRUE);
        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 1e28bd960d7803289b309456b09f80775ccdf158..79039d14b37f17146fa324bb03ca56e616fe7647 100644 (file)
@@ -914,7 +914,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment
         exit(1);
     }
 
-    epan_dissect_init(&edt, TRUE, FALSE);
+    epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
     epan_dissect_prime_dfilter(&edt, sfcode);
     epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
     epan_dissect_cleanup(&edt);
index b3d9778b7361236812627c030463fecdc7821189..312edefd6a206c20c3e63bce455c2b207619df30 100644 (file)
@@ -3947,7 +3947,7 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
        /* dissect the current frame */
        if (!cf_read_frame(cf, fdata))
                return; /* error reading the frame */
-       epan_dissect_init(&edt, TRUE, FALSE);
+       epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
        epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
 
index 952819b337d119f0967ddff32d6a90d5c577a632..7844bc0a89ad29f84fb2d37e6006afffd6f71da7 100644 (file)
@@ -977,7 +977,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
        if (!cf_read_frame(cf, fdata))
                return; /* error reading the frame */
 
-       epan_dissect_init(&edt, TRUE, FALSE);
+       epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
        epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
        frame_matched = dfilter_apply_edt(sfcode, &edt);
index 8aa97938562ae380c952b3365d2807cc8b83c815..c7d715702f5c535fc732ae4837fd551f85742894 100644 (file)
@@ -1987,7 +1987,7 @@ static struct tcpheader *select_tcpip_session(capture_file *cf, struct segment *
         exit(1);
     }
 
-    epan_dissect_init(&edt, TRUE, FALSE);
+    epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
     epan_dissect_prime_dfilter(&edt, sfcode);
     epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
     epan_dissect_cleanup(&edt);
index 44bb090378c3747c6fdc7908d09273f564fe1f9b..39fae251596cb755636c937f963878e067e3a270 100644 (file)
@@ -577,7 +577,7 @@ QString &PacketList::getFilterFromRowAndColumn()
         if (!cf_read_frame(cap_file_, fdata))
             return filter; /* error reading the frame */
         /* proto tree, visible. We need a proto tree if there's custom columns */
-        epan_dissect_init(&edt, have_custom_cols(&cap_file_->cinfo), FALSE);
+        epan_dissect_init(&edt, cap_file_->epan, have_custom_cols(&cap_file_->cinfo), FALSE);
         col_custom_prime_edt(&edt, &cap_file_->cinfo);
 
         epan_dissect_run(&edt, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
index 3f7d00221e9bc561fade4bc17272c2c8d54bb610..96fd7eba4ffffec78f68d44a276f54c27c1f9389 100644 (file)
@@ -239,7 +239,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const
     create_proto_tree = (color_filters_used() && enable_color_) ||
                         (have_custom_cols(cinfo) && dissect_columns);
 
-    epan_dissect_init(&edt,
+    epan_dissect_init(&edt, cap_file_->epan,
                       create_proto_tree,
                       FALSE /* proto_tree_visible */);