aboutsummaryrefslogtreecommitdiffstats
path: root/sharkd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sharkd.c')
-rw-r--r--sharkd.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/sharkd.c b/sharkd.c
index 31b2c185cc..73a47504d4 100644
--- a/sharkd.c
+++ b/sharkd.c
@@ -70,11 +70,10 @@
#define INIT_FAILED 1
#define EPAN_INIT_FAIL 2
+capture_file cfile;
+
static guint32 cum_bytes;
-static const frame_data *ref;
static frame_data ref_frame;
-static frame_data *prev_dis;
-static frame_data *prev_cap;
static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
@@ -83,8 +82,6 @@ static void read_failure_message(const char *filename, int err);
static void write_failure_message(const char *filename, int err);
static void failure_message_cont(const char *msg_format, va_list ap);
-capture_file cfile;
-
static void
print_current_user(void) {
gchar *cur_user, *cur_group;
@@ -226,14 +223,14 @@ clean_exit:
static const nstime_t *
sharkd_get_frame_ts(capture_file *cf, guint32 frame_num)
{
- if (ref && ref->num == frame_num)
- return &ref->abs_ts;
+ if (cf->ref && cf->ref->num == frame_num)
+ return &cf->ref->abs_ts;
- if (prev_dis && prev_dis->num == frame_num)
- return &prev_dis->abs_ts;
+ if (cf->prev_dis && cf->prev_dis->num == frame_num)
+ return &cf->prev_dis->abs_ts;
- if (prev_cap && prev_cap->num == frame_num)
- return &prev_cap->abs_ts;
+ if (cf->prev_cap && cf->prev_cap->num == frame_num)
+ return &cf->prev_cap->abs_ts;
if (cf->frames) {
frame_data *fd = frame_data_sequence_find(cf->frames, frame_num);
@@ -300,10 +297,10 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
prime_epan_dissect_with_postdissector_wanted_hfids(edt);
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
- &ref, prev_dis);
- if (ref == &fdlocal) {
+ &cf->ref, cf->prev_dis);
+ if (cf->ref == &fdlocal) {
ref_frame = fdlocal;
- ref = &ref_frame;
+ cf->ref = &ref_frame;
}
epan_dissect_run(edt, cf->cd_t, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
@@ -315,7 +312,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
if (passed) {
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
- prev_cap = prev_dis = frame_data_sequence_add(cf->frames, &fdlocal);
+ cf->prev_cap = cf->prev_dis = frame_data_sequence_add(cf->frames, &fdlocal);
/* If we're not doing dissection then there won't be any dependent frames.
* More importantly, edt.pi.dependent_frames won't be initialized because
@@ -404,8 +401,8 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
- prev_dis = NULL;
- prev_cap = NULL;
+ cf->prev_dis = NULL;
+ cf->prev_cap = NULL;
}
if (err != 0) {
@@ -452,9 +449,9 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
cf->drops = 0;
cf->snap = wtap_snapshot_length(cf->wth);
nstime_set_zero(&cf->elapsed_time);
- ref = NULL;
- prev_dis = NULL;
- prev_cap = NULL;
+ cf->ref = NULL;
+ cf->prev_dis = NULL;
+ cf->prev_cap = NULL;
cf->state = FILE_READ_IN_PROGRESS;