diff options
-rw-r--r-- | epan/Makefile.common | 1 | ||||
-rw-r--r-- | epan/column-utils.c | 13 | ||||
-rw-r--r-- | epan/column-utils.h | 4 | ||||
-rw-r--r-- | epan/column_info.h | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-frame.c | 4 | ||||
-rw-r--r-- | epan/epan-int.h | 6 | ||||
-rw-r--r-- | epan/epan.c | 14 | ||||
-rw-r--r-- | epan/epan.h | 2 | ||||
-rw-r--r-- | epan/frame_data.c | 39 | ||||
-rw-r--r-- | epan/frame_data.h | 15 | ||||
-rw-r--r-- | epan/packet.c | 3 | ||||
-rw-r--r-- | epan/packet_info.h | 1 | ||||
-rw-r--r-- | epan/wslua/wslua_pinfo.c | 8 | ||||
-rw-r--r-- | file.c | 40 | ||||
-rw-r--r-- | rawshark.c | 28 | ||||
-rw-r--r-- | tshark.c | 41 | ||||
-rw-r--r-- | ui/gtk/graph_analysis.c | 6 | ||||
-rw-r--r-- | ui/gtk/packet_list_store.c | 6 |
18 files changed, 172 insertions, 60 deletions
diff --git a/epan/Makefile.common b/epan/Makefile.common index 480f16ce22..7ca9b04dd6 100644 --- a/epan/Makefile.common +++ b/epan/Makefile.common @@ -178,6 +178,7 @@ LIBWIRESHARK_INCLUDES = \ dtd_parse.h \ eap.h \ emem.h \ + epan-int.h \ epan.h \ epan_dissect.h \ etypes.h \ diff --git a/epan/column-utils.c b/epan/column-utils.c index 3e93858879..6b25b7e97c 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -104,7 +104,7 @@ col_cleanup(column_info *cinfo) /* Initialize the data structures for constructing column data. */ void -col_init(column_info *cinfo) +col_init(column_info *cinfo, const struct epan_session *epan) { int i; @@ -119,6 +119,7 @@ col_init(column_info *cinfo) cinfo->col_expr.col_expr_val[i][0] = '\0'; } cinfo->writable = TRUE; + cinfo->epan = epan; } #define COL_GET_WRITABLE(cinfo) (cinfo ? cinfo->writable : FALSE) @@ -996,7 +997,7 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col) { nstime_t del_cap_ts; - frame_delta_abs_time(fd, fd->prev_cap, &del_cap_ts); + frame_delta_abs_time(cinfo->epan, fd, fd->num - 1, &del_cap_ts); switch (timestamp_get_seconds_type()) { case TS_SECONDS_DEFAULT: @@ -1026,7 +1027,7 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col) return; } - frame_delta_abs_time(fd, fd->prev_dis, &del_dis_ts); + frame_delta_abs_time(cinfo->epan, fd, fd->prev_dis_num, &del_dis_ts); switch (timestamp_get_seconds_type()) { case TS_SECONDS_DEFAULT: @@ -1193,7 +1194,7 @@ col_set_epoch_time(const frame_data *fd, column_info *cinfo, const int col) } void -set_fd_time(frame_data *fd, gchar *buf) +set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf) { switch (timestamp_get_type()) { @@ -1226,7 +1227,7 @@ set_fd_time(frame_data *fd, gchar *buf) if (fd->flags.has_ts) { nstime_t del_cap_ts; - frame_delta_abs_time(fd, fd->prev_cap, &del_cap_ts); + frame_delta_abs_time(epan, fd, fd->num - 1, &del_cap_ts); switch (timestamp_get_seconds_type()) { case TS_SECONDS_DEFAULT: @@ -1247,7 +1248,7 @@ set_fd_time(frame_data *fd, gchar *buf) if (fd->flags.has_ts) { nstime_t del_dis_ts; - frame_delta_abs_time(fd, fd->prev_dis, &del_dis_ts); + frame_delta_abs_time(epan, fd, fd->prev_dis_num, &del_dis_ts); switch (timestamp_get_seconds_type()) { case TS_SECONDS_DEFAULT: diff --git a/epan/column-utils.h b/epan/column-utils.h index 2ede25f9ad..e903314691 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -58,7 +58,7 @@ WS_DLL_PUBLIC void col_cleanup(column_info *cinfo); * * Internal, don't use this in dissectors! */ -extern void col_init(column_info *cinfo); +extern void col_init(column_info *cinfo, const struct epan_session *epan); /** Fill in all columns of the given packet which are based on values from frame_data. * @@ -262,7 +262,7 @@ WS_DLL_PUBLIC void col_append_sep_fstr(column_info *cinfo, const gint col, const WS_DLL_PUBLIC void col_set_time(column_info *cinfo, const int col, const nstime_t *ts, const char *fieldname); -WS_DLL_PUBLIC void set_fd_time(frame_data *fd, gchar *buf); +WS_DLL_PUBLIC void set_fd_time(const struct epan_session *epan, frame_data *fd, gchar *buf); #ifdef __cplusplus } diff --git a/epan/column_info.h b/epan/column_info.h index c9e70b1554..5e5c151b9f 100644 --- a/epan/column_info.h +++ b/epan/column_info.h @@ -46,6 +46,7 @@ typedef struct { /** Column info */ typedef struct _column_info { + const struct epan_session *epan; gint num_cols; /**< Number of columns */ gint *col_fmt; /**< Format of column */ gboolean **fmt_matx; /**< Specifies which formats apply to a column */ diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 8064e12109..2cafc0d51e 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -334,7 +334,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (proto_field_is_referenced(tree, hf_frame_time_delta)) { nstime_t del_cap_ts; - frame_delta_abs_time(pinfo->fd, pinfo->fd->prev_cap, &del_cap_ts); + frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->fd->num - 1, &del_cap_ts); item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb, 0, 0, &(del_cap_ts)); @@ -344,7 +344,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (proto_field_is_referenced(tree, hf_frame_time_delta_displayed)) { nstime_t del_dis_ts; - frame_delta_abs_time(pinfo->fd, pinfo->fd->prev_dis, &del_dis_ts); + frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->fd->prev_dis_num, &del_dis_ts); item = proto_tree_add_time(fh_tree, hf_frame_time_delta_displayed, tvb, 0, 0, &(del_dis_ts)); diff --git a/epan/epan-int.h b/epan/epan-int.h index aa5aa16c5c..6580c55c26 100644 --- a/epan/epan-int.h +++ b/epan/epan-int.h @@ -24,8 +24,12 @@ #ifndef __EPAN_INT_H__ #define __EPAN_INT_H__ +#include <wsutil/nstime.h> + struct epan_session { - void *reserved; + void *data; + + const nstime_t *(*get_frame_ts)(void *data, guint32 frame_num); }; #endif diff --git a/epan/epan.c b/epan/epan.c index 276caf6a68..e3a0b2bb17 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -146,6 +146,20 @@ epan_new(void) return session; } +const nstime_t * +epan_get_frame_ts(const epan_t *session, guint32 frame_num) +{ + nstime_t *abs_ts = NULL; + + if (session->get_frame_ts) + abs_ts = session->get_frame_ts(session->data, frame_num); + + if (!abs_ts) + g_warning("!!! couldn't get frame ts for %u !!!\n", frame_num); + + return abs_ts; +} + void epan_free(epan_t *session) { diff --git a/epan/epan.h b/epan/epan.h index 263a80f353..252d748ee8 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -129,6 +129,8 @@ typedef struct epan_session epan_t; WS_DLL_PUBLIC epan_t *epan_new(void); +const nstime_t *epan_get_frame_ts(const epan_t *session, guint32 frame_num); + WS_DLL_PUBLIC void epan_free(epan_t *session); WS_DLL_PUBLIC const gchar* diff --git a/epan/frame_data.c b/epan/frame_data.c index 63d980592b..8dec16cd47 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -154,10 +154,12 @@ p_get_proto_name_and_key(frame_data *fd, guint pfd_index){ #define COMPARE_TS(ts) COMPARE_TS_REAL(fdata1->ts, fdata2->ts) void -frame_delta_abs_time(const frame_data *fdata, const frame_data *prev, nstime_t *delta) +frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata, guint32 prev_num, nstime_t *delta) { - if (prev) { - nstime_delta(delta, &fdata->abs_ts, &prev->abs_ts); + const nstime_t *prev_abs_ts = (prev_num) ? epan_get_frame_ts(epan, prev_num) : NULL; + + if (prev_abs_ts) { + nstime_delta(delta, &fdata->abs_ts, prev_abs_ts); } else { /* If we don't have the time stamp of the previous packet, it's because we have no displayed/captured packets prior to this. @@ -167,29 +169,29 @@ frame_delta_abs_time(const frame_data *fdata, const frame_data *prev, nstime_t * } static gint -frame_data_time_delta_compare(const frame_data *fdata1, const frame_data *fdata2) +frame_data_time_delta_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2) { nstime_t del_cap_ts1, del_cap_ts2; - frame_delta_abs_time(fdata1, fdata1->prev_cap, &del_cap_ts1); - frame_delta_abs_time(fdata2, fdata2->prev_cap, &del_cap_ts2); + frame_delta_abs_time(epan, fdata1, fdata1->num - 1, &del_cap_ts1); + frame_delta_abs_time(epan, fdata2, fdata2->num - 1, &del_cap_ts2); return COMPARE_TS_REAL(del_cap_ts1, del_cap_ts2); } static gint -frame_data_time_delta_dis_compare(const frame_data *fdata1, const frame_data *fdata2) +frame_data_time_delta_dis_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2) { nstime_t del_dis_ts1, del_dis_ts2; - frame_delta_abs_time(fdata1, fdata1->prev_dis, &del_dis_ts1); - frame_delta_abs_time(fdata2, fdata2->prev_dis, &del_dis_ts2); + frame_delta_abs_time(epan, fdata1, fdata1->prev_dis_num, &del_dis_ts1); + frame_delta_abs_time(epan, fdata2, fdata2->prev_dis_num, &del_dis_ts2); return COMPARE_TS_REAL(del_dis_ts1, del_dis_ts2); } gint -frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field) +frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field) { switch (field) { case COL_NUMBER: @@ -208,10 +210,10 @@ frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field return COMPARE_TS(rel_ts); case TS_DELTA: - return frame_data_time_delta_compare(fdata1, fdata2); + return frame_data_time_delta_compare(epan, fdata1, fdata2); case TS_DELTA_DIS: - return frame_data_time_delta_dis_compare(fdata1, fdata2); + return frame_data_time_delta_dis_compare(epan, fdata1, fdata2); case TS_NOT_SET: return 0; @@ -228,10 +230,10 @@ frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field return COMPARE_TS(rel_ts); case COL_DELTA_TIME: - return frame_data_time_delta_compare(fdata1, fdata2); + return frame_data_time_delta_compare(epan, fdata1, fdata2); case COL_DELTA_TIME_DIS: - return frame_data_time_delta_dis_compare(fdata1, fdata2); + return frame_data_time_delta_dis_compare(epan, fdata1, fdata2); case COL_PACKET_LENGTH: return COMPARE_NUM(pkt_len); @@ -277,8 +279,7 @@ frame_data_init(frame_data *fdata, guint32 num, fdata->shift_offset.nsecs = 0; fdata->rel_ts.secs = 0; fdata->rel_ts.nsecs = 0; - fdata->prev_dis = NULL; - fdata->prev_cap = NULL; + fdata->prev_dis_num = 0; fdata->opt_comment = phdr->opt_comment; } @@ -286,8 +287,7 @@ void frame_data_set_before_dissect(frame_data *fdata, nstime_t *elapsed_time, nstime_t *first_ts, - const frame_data *prev_dis, - const frame_data *prev_cap) + const frame_data *prev_dis) { /* If we don't have the time stamp of the first packet in the capture, it's because this is the first packet. Save the time @@ -311,8 +311,7 @@ frame_data_set_before_dissect(frame_data *fdata, *elapsed_time = fdata->rel_ts; } - fdata->prev_dis = prev_dis; - fdata->prev_cap = prev_cap; + fdata->prev_dis_num = (prev_dis) ? prev_dis->num : 0; } void diff --git a/epan/frame_data.h b/epan/frame_data.h index 2efdb39ab4..2328bb870b 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -84,8 +84,7 @@ typedef struct _frame_data { nstime_t abs_ts; /**< Absolute timestamp */ nstime_t shift_offset; /**< How much the abs_tm of the frame is shifted */ nstime_t rel_ts; /**< Relative timestamp (yes, it can be negative) */ - const struct _frame_data *prev_dis; /**< Previous displayed frame */ - const struct _frame_data *prev_cap; /**< Previous captured frame */ + guint32 prev_dis_num; /**< Previous displayed frame (0 if first one) */ gchar *opt_comment; /**< NULL if not available */ } frame_data; @@ -104,8 +103,11 @@ WS_DLL_PUBLIC void *p_get_proto_data(frame_data *fd, int proto, guint8 key); void p_remove_proto_data(frame_data *fd, int proto, guint8 key); gchar *p_get_proto_name_and_key(frame_data *fd, guint pfd_index); +/* no sense to include epan.h + dependencies for opaque epan session type */ +struct epan_session; + /** compare two frame_datas */ -WS_DLL_PUBLIC gint frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field); +WS_DLL_PUBLIC gint frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field); WS_DLL_PUBLIC void frame_data_reset(frame_data *fdata); @@ -115,16 +117,15 @@ WS_DLL_PUBLIC void frame_data_init(frame_data *fdata, guint32 num, const struct wtap_pkthdr *phdr, gint64 offset, guint32 cum_bytes); -extern void frame_delta_abs_time(const frame_data *fdata, - const frame_data *prev, nstime_t *delta); +extern void frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata, + guint32 prev_num, nstime_t *delta); /** * Sets the frame data struct values before dissection. */ WS_DLL_PUBLIC void frame_data_set_before_dissect(frame_data *fdata, nstime_t *elapsed_time, nstime_t *first_ts, - const frame_data *prev_dis, - const frame_data *prev_cap); + const frame_data *prev_dis); WS_DLL_PUBLIC void frame_data_set_after_dissect(frame_data *fdata, guint32 *cum_bytes); diff --git a/epan/packet.c b/epan/packet.c index 43f15d89e2..8e37c4a938 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -326,8 +326,9 @@ dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr, wmem_allocator_t *tmp = edt->pi.pool; if (cinfo != NULL) - col_init(cinfo); + col_init(cinfo, edt->session); memset(&edt->pi, 0, sizeof(edt->pi)); + edt->pi.epan = edt->session; edt->pi.pool = tmp; edt->pi.current_proto = "<Missing Protocol Name>"; edt->pi.cinfo = cinfo; diff --git a/epan/packet_info.h b/epan/packet_info.h index 178a2ad615..635aee0b38 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -225,6 +225,7 @@ typedef struct _packet_info { GSList *frame_end_routines; struct _wmem_allocator_t *pool; /**< Memory pool scoped to the pinfo struct */ + struct epan_session *epan; } packet_info; /**< For old code that hasn't yet been changed. */ diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index 6bea086517..f542e46047 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -1006,11 +1006,11 @@ lua_nstime_to_sec(const nstime_t *nstime) } static double -lua_delta_nstime_to_sec(const frame_data *fd, const frame_data *prev) +lua_delta_nstime_to_sec(const Pinfo pinfo, const frame_data *fd, guint32 prev_num) { nstime_t del; - frame_delta_abs_time(fd, prev, &del); + frame_delta_abs_time(pinfo->ws_pinfo->epan, fd, prev_num, &del); return lua_nstime_to_sec(&del); } @@ -1023,8 +1023,8 @@ PINFO_GET_NUMBER(Pinfo_len,pinfo->ws_pinfo->fd->pkt_len) PINFO_GET_NUMBER(Pinfo_caplen,pinfo->ws_pinfo->fd->cap_len) PINFO_GET_NUMBER(Pinfo_abs_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->abs_ts)) PINFO_GET_NUMBER(Pinfo_rel_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->rel_ts)) -PINFO_GET_NUMBER(Pinfo_delta_ts,lua_delta_nstime_to_sec(pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->prev_cap)) -PINFO_GET_NUMBER(Pinfo_delta_dis_ts,lua_delta_nstime_to_sec(pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->prev_dis)) +PINFO_GET_NUMBER(Pinfo_delta_ts,lua_delta_nstime_to_sec(pinfo, pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->num - 1)) +PINFO_GET_NUMBER(Pinfo_delta_dis_ts,lua_delta_nstime_to_sec(pinfo, pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->prev_dis_num)) PINFO_GET_NUMBER(Pinfo_ipproto,pinfo->ws_pinfo->ipproto) PINFO_GET_NUMBER(Pinfo_circuit_id,pinfo->ws_pinfo->circuit_id) PINFO_GET_NUMBER(Pinfo_desegment_len,pinfo->ws_pinfo->desegment_len) @@ -46,6 +46,7 @@ #include <wiretap/merge.h> +#include <epan/epan-int.h> #include <epan/epan.h> #include <epan/column.h> #include <epan/packet.h> @@ -302,6 +303,37 @@ static void compute_elapsed(GTimeVal *start_time) computed_elapsed = (gulong) (delta_time / 1000); /* ms */ } +const nstime_t * +ws_get_frame_ts(void *data, guint32 frame_num) +{ + capture_file *cf = (capture_file *) data; + + if (prev_dis && prev_dis->num == frame_num) + return &prev_dis->abs_ts; + + if (prev_cap && prev_cap->num == frame_num) + return &prev_cap->abs_ts; + + if (cf->frames) { + frame_data *fd = frame_data_sequence_find(cf->frames, frame_num); + + return (fd) ? &fd->abs_ts : NULL; + } + + return NULL; +} + +epan_t * +ws_epan_new(capture_file *cf) +{ + epan_t *epan = epan_new(); + + epan->data = cf; + epan->get_frame_ts = ws_get_frame_ts; + + return epan; +} + cf_status_t cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) { @@ -322,7 +354,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* Create new epan session for dissection. */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = ws_epan_new(cf); /* We're about to start reading the file. */ cf->state = FILE_READ_IN_PROGRESS; @@ -1123,7 +1155,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, gint row = -1; frame_data_set_before_dissect(fdata, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); prev_cap = fdata; /* Dissect the frame. */ @@ -1821,7 +1853,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb /* 'reset' dissection session */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = ws_epan_new(cf); /* We need to redissect the packets so we have to discard our old * packet list store. */ @@ -2125,7 +2157,7 @@ ref_time_packets(capture_file *cf) /* If this frame is displayed, get the time elapsed between the previous displayed packet and this packet. */ if ( fdata->flags.passed_dfilter ) { - fdata->prev_dis = prev_dis; + fdata->prev_dis_num = prev_dis->num; prev_dis = fdata; } diff --git a/rawshark.c b/rawshark.c index 01149007c0..b0de443f8e 100644 --- a/rawshark.c +++ b/rawshark.c @@ -64,6 +64,7 @@ #endif #include <glib.h> +#include <epan/epan-int.h> #include <epan/epan.h> #include <epan/filesystem.h> #include <wsutil/crash_info.h> @@ -1073,7 +1074,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr, printf("%lu", (unsigned long int) cf->count); frame_data_set_before_dissect(&fdata, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); /* 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 @@ -1565,6 +1566,29 @@ open_failure_message(const char *filename, int err, gboolean for_writing) fprintf(stderr, "\n"); } +const nstime_t * +raw_get_frame_ts(void *data _U_, guint32 frame_num) +{ + if (prev_dis && prev_dis->num == frame_num) + return &prev_dis->abs_ts; + + if (prev_cap && prev_cap->num == frame_num) + return &prev_cap->abs_ts; + + return NULL; +} + +epan_t * +raw_epan_new(capture_file *cf) +{ + epan_t *epan = epan_new(); + + epan->data = cf; + epan->get_frame_ts = raw_get_frame_ts; + + return epan; +} + cf_status_t raw_cf_open(capture_file *cf, const char *fname) { @@ -1575,7 +1599,7 @@ raw_cf_open(capture_file *cf, const char *fname) /* Create new epan session for dissection. */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = raw_epan_new(cf); cf->wth = NULL; cf->f_datalen = 0; /* not used, but set it anyway */ @@ -54,6 +54,7 @@ #endif #include <glib.h> +#include <epan/epan-int.h> #include <epan/epan.h> #include <epan/filesystem.h> #include <wsutil/crash_info.h> @@ -2157,6 +2158,36 @@ pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe #endif } +const nstime_t * +tshark_get_frame_ts(void *data, guint32 frame_num) +{ + capture_file *cf = (capture_file *) data; + + if (prev_dis && prev_dis->num == frame_num) + return &prev_dis->abs_ts; + + if (prev_cap && prev_cap->num == frame_num) + return &prev_cap->abs_ts; + + if (cf->frames) { + frame_data *fd = frame_data_sequence_find(cf->frames, frame_num); + + return (fd) ? &fd->abs_ts : NULL; + } + + return NULL; +} + +epan_t * +tshark_epan_new(capture_file *cf) +{ + epan_t *epan = epan_new(); + + epan->data = cf; + epan->get_frame_ts = tshark_get_frame_ts; + + return epan; +} #ifdef HAVE_LIBPCAP static gboolean @@ -2198,7 +2229,7 @@ capture(void) /* Create new dissection section. */ epan_free(cfile.epan); - cfile.epan = epan_new(); + cfile.epan = tshark_epan_new(&cfile); #ifdef _WIN32 /* Catch a CTRL+C event and, if we get it, clean up and exit. */ @@ -2694,7 +2725,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_prime_dfilter(&edt, cf->rfcode); frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); epan_dissect_run(&edt, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL); @@ -2783,7 +2814,7 @@ process_packet_second_pass(capture_file *cf, frame_data *fdata, cinfo = NULL; frame_data_set_before_dissect(fdata, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); epan_dissect_run_with_taps(&edt, phdr, frame_tvbuff_new_buffer(fdata, buf), fdata, cinfo); @@ -3245,7 +3276,7 @@ process_packet(capture_file *cf, gint64 offset, struct wtap_pkthdr *whdr, cinfo = NULL; frame_data_set_before_dissect(&fdata, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); epan_dissect_run_with_taps(&edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, cinfo); @@ -3707,7 +3738,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* Create new epan session for dissection. */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = tshark_epan_new(cf); cf->wth = wth; cf->f_datalen = 0; /* not used, but set it anyway */ diff --git a/ui/gtk/graph_analysis.c b/ui/gtk/graph_analysis.c index 9521803cb4..3665964fa5 100644 --- a/ui/gtk/graph_analysis.c +++ b/ui/gtk/graph_analysis.c @@ -450,7 +450,7 @@ dialog_graph_dump_to_file(char *pathname, graph_analysis_data_t *user_data) g_string_printf(label_string, "|%.3f", nstime_to_sec(&gai->fd->rel_ts)); #endif /* Write the time, using the same format as in the time col */ - set_fd_time(gai->fd, time_str); + set_fd_time(cfile.epan, gai->fd, time_str); g_string_printf(label_string, "|%s", time_str); enlarge_string(label_string, 10, ' '); fprintf(of, "%s", label_string->str); @@ -775,7 +775,7 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[display_items-1].fd->rel_ts)); #endif /* Write the time, using the same format as in th etime col */ - set_fd_time(user_data->dlg.items[display_items-1].fd, time_str); + set_fd_time(cfile.epan, user_data->dlg.items[display_items-1].fd, time_str); g_snprintf(label_string, MAX_LABEL, "%s", time_str); layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string); middle_layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string); @@ -968,7 +968,7 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[current_item].fd->rel_ts)); #endif /* Draw the time */ - set_fd_time(user_data->dlg.items[current_item].fd, time_str); + set_fd_time(cfile.epan, user_data->dlg.items[current_item].fd, time_str); g_snprintf(label_string, MAX_LABEL, "%s", time_str); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &label_width, &label_height); diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index e7cb64bef8..4aeca56045 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -935,7 +935,7 @@ packet_list_compare_custom(gint sort_id, gint text_sort_id, PacketListRecord *a, hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[sort_id]); if (hfi == NULL) { - return frame_data_compare(a->fdata, b->fdata, COL_NUMBER); + return frame_data_compare(cfile.epan, a->fdata, b->fdata, COL_NUMBER); } else if ((hfi->strings == NULL) && (((IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type)) && ((hfi->display == BASE_DEC) || (hfi->display == BASE_DEC_HEX) || @@ -982,11 +982,11 @@ packet_list_compare_records(gint sort_id, gint text_sort_id, PacketListRecord *a gint ret; if (text_sort_id == -1) /* based on frame_data ? */ - return frame_data_compare(a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]); + return frame_data_compare(cfile.epan, a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]); ret = _packet_list_compare_records(sort_id, text_sort_id, a, b); if (ret == 0) - ret = frame_data_compare(a->fdata, b->fdata, COL_NUMBER); + ret = frame_data_compare(cfile.epan, a->fdata, b->fdata, COL_NUMBER); return ret; } |