summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSake Blok <sake@euronet.nl>2017-06-27 22:04:33 +0200
committerSake Blok <sake.blok@SYN-bit.nl>2017-07-03 16:41:37 +0000
commit3803e00367413260cbb543c3c4ed13ae2d8fd194 (patch)
treee96b7c81846caec9343201ea80e8afeee68dc80c
parent2c58ed569ed0c096d5640fd0da5825bcfef04aeb (diff)
downloadwireshark-3803e00367413260cbb543c3c4ed13ae2d8fd194.tar.gz
Add option to use wall-clock intervalsHEADmaster
Add the "interval" option to "-b". Each new capture starts at the exact start of a time interval. For instance, using -b interval:3600 will start a new capture file at each whole hour. Changed the duration option in the GUI interfaces to use the new interval option. Change-Id: I0180c43843f5d2f0c2f50153c9ce42ac7fa5aeae Reviewed-on: https://code.wireshark.org/review/22428 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Sake Blok <sake.blok@SYN-bit.nl>
-rw-r--r--capchild/capture_sync.c7
-rw-r--r--capture_opts.c6
-rw-r--r--capture_opts.h2
-rw-r--r--capture_stop_conditions.c92
-rw-r--r--capture_stop_conditions.h1
-rw-r--r--doc/dumpcap.pod11
-rw-r--r--doc/tshark.pod11
-rw-r--r--doc/wireshark.pod.template11
-rw-r--r--dumpcap.c49
-rw-r--r--tshark.c12
-rw-r--r--ui/commandline.c6
-rw-r--r--ui/gtk/capture_dlg.c104
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp24
13 files changed, 249 insertions, 87 deletions
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
index 6dc0fcb84a..96911bddae 100644
--- a/capchild/capture_sync.c
+++ b/capchild/capture_sync.c
@@ -205,6 +205,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, inf
char scount[ARGV_NUMBER_LEN];
char sfilesize[ARGV_NUMBER_LEN];
char sfile_duration[ARGV_NUMBER_LEN];
+ char sfile_interval[ARGV_NUMBER_LEN];
char sring_num_files[ARGV_NUMBER_LEN];
char sautostop_files[ARGV_NUMBER_LEN];
char sautostop_filesize[ARGV_NUMBER_LEN];
@@ -293,6 +294,12 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, inf
argv = sync_pipe_add_arg(argv, &argc, sfile_duration);
}
+ if (capture_opts->has_file_interval) {
+ argv = sync_pipe_add_arg(argv, &argc, "-b");
+ g_snprintf(sfile_interval, ARGV_NUMBER_LEN, "interval:%d",capture_opts->file_interval);
+ argv = sync_pipe_add_arg(argv, &argc, sfile_interval);
+ }
+
if (capture_opts->has_ring_num_files) {
argv = sync_pipe_add_arg(argv, &argc, "-b");
g_snprintf(sring_num_files, ARGV_NUMBER_LEN, "files:%d",capture_opts->ring_num_files);
diff --git a/capture_opts.c b/capture_opts.c
index ef3e659850..92175ff78b 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -106,6 +106,8 @@ capture_opts_init(capture_options *capture_opts)
capture_opts->multi_files_on = FALSE;
capture_opts->has_file_duration = FALSE;
capture_opts->file_duration = 60; /* 1 min */
+ capture_opts->has_file_interval = FALSE;
+ capture_opts->file_interval = 60; /* 1 min */
capture_opts->has_ring_num_files = FALSE;
capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
@@ -240,6 +242,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
g_log(log_domain, log_level, "MultiFilesOn : %u", capture_opts->multi_files_on);
g_log(log_domain, log_level, "FileDuration (%u) : %u", capture_opts->has_file_duration, capture_opts->file_duration);
+ g_log(log_domain, log_level, "FileInterval (%u) : %u", capture_opts->has_file_interval, capture_opts->file_interval);
g_log(log_domain, log_level, "RingNumFiles (%u) : %u", capture_opts->has_ring_num_files, capture_opts->ring_num_files);
g_log(log_domain, log_level, "AutostopFiles (%u) : %u", capture_opts->has_autostop_files, capture_opts->autostop_files);
@@ -397,6 +400,9 @@ get_ring_arguments(capture_options *capture_opts, const char *arg)
} else if (strcmp(arg,"duration") == 0) {
capture_opts->has_file_duration = TRUE;
capture_opts->file_duration = get_positive_int(p, "ring buffer duration");
+ } else if (strcmp(arg,"interval") == 0) {
+ capture_opts->has_file_interval = TRUE;
+ capture_opts->file_interval = get_positive_int(p, "ring buffer interval");
}
*colonp = ':'; /* put the colon back */
diff --git a/capture_opts.h b/capture_opts.h
index d9ab3d86ab..2fc04a339c 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -298,6 +298,8 @@ typedef struct capture_options_tag {
gboolean has_file_duration; /**< TRUE if ring duration specified */
gint32 file_duration; /**< Switch file after n seconds */
+ gboolean has_file_interval; /**< TRUE if ring interval specified */
+ gint32 file_interval; /**< Create time intervals of n seconds */
gboolean has_ring_num_files; /**< TRUE if ring num_files specified */
guint32 ring_num_files; /**< Number of multiple buffer files */
diff --git a/capture_stop_conditions.c b/capture_stop_conditions.c
index 4a2ccaed2a..415bbfedbd 100644
--- a/capture_stop_conditions.c
+++ b/capture_stop_conditions.c
@@ -40,6 +40,11 @@ static void _cnd_destr_capturesize(condition*);
static gboolean _cnd_eval_capturesize(condition*, va_list);
static void _cnd_reset_capturesize(condition*);
+static condition* _cnd_constr_interval(condition*, va_list);
+static void _cnd_destr_interval(condition*);
+static gboolean _cnd_eval_interval(condition*, va_list);
+static void _cnd_reset_interval(condition*);
+
void init_capture_stop_conditions(void){
cnd_register_class(CND_CLASS_TIMEOUT,
_cnd_constr_timeout,
@@ -51,11 +56,17 @@ void init_capture_stop_conditions(void){
_cnd_destr_capturesize,
_cnd_eval_capturesize,
_cnd_reset_capturesize);
+ cnd_register_class(CND_CLASS_INTERVAL,
+ _cnd_constr_interval,
+ _cnd_destr_interval,
+ _cnd_eval_interval,
+ _cnd_reset_interval);
} /* END init_capture_stop_conditions() */
void cleanup_capture_stop_conditions(void){
cnd_unregister_class(CND_CLASS_TIMEOUT);
cnd_unregister_class(CND_CLASS_CAPTURESIZE);
+ cnd_unregister_class(CND_CLASS_INTERVAL);
} /* END cleanup_capture_stop_conditions() */
/*****************************************************************************/
@@ -208,6 +219,87 @@ static gboolean _cnd_eval_capturesize(condition* cnd, va_list ap){
static void _cnd_reset_capturesize(condition *cnd _U_){
} /* END _cnd_reset_capturesize() */
+
+/*****************************************************************************/
+/* Predefined condition 'interval'. */
+
+/* class id */
+const char* CND_CLASS_INTERVAL = "cnd_class_interval";
+
+/* structure that contains user supplied data for this condition */
+typedef struct _cnd_interval_dat{
+ time_t start_time;
+ gint32 interval_s;
+}cnd_interval_dat;
+
+/*
+ * Constructs new condition for interval check. This function is invoked by
+ * 'cnd_new()' in order to perform class specific initialization.
+ *
+ * parameter: cnd - Pointer to condition passed by 'cnd_new()'.
+ * ap - Pointer to user supplied arguments list for this
+ * constructor.
+ * returns: Pointer to condition - Construction was successful.
+ * NULL - Construction failed.
+ */
+static condition* _cnd_constr_interval(condition* cnd, va_list ap){
+ cnd_interval_dat *data = NULL;
+ /* allocate memory */
+ if((data = (cnd_interval_dat*)g_malloc(sizeof(cnd_interval_dat))) == NULL)
+ return NULL;
+ /* initialize user data */
+ data->start_time = time(NULL);
+ data->interval_s = va_arg(ap, gint32);
+ data->start_time -= data->start_time % data->interval_s;
+ cnd_set_user_data(cnd, (void*)data);
+ return cnd;
+} /* END _cnd_constr_interval() */
+
+/*
+ * Destroys condition for interval check. This function is invoked by
+ * 'cnd_delete()' in order to perform class specific clean up.
+ *
+ * parameter: cnd - Pointer to condition passed by 'cnd_delete()'.
+ */
+static void _cnd_destr_interval(condition* cnd){
+ /* free memory */
+ g_free(cnd_get_user_data(cnd));
+} /* END _cnd_destr_interval() */
+
+/*
+ * Condition handler for interval condition. This function is invoked by
+ * 'cnd_eval()' in order to perform class specific condition checks.
+ *
+ * parameter: cnd - The inititalized interval condition.
+ * ap - Pointer to user supplied arguments list for this
+ * handler.
+ * returns: TRUE - Condition is true.
+ * FALSE - Condition is false.
+ */
+static gboolean _cnd_eval_interval(condition* cnd, va_list ap _U_){
+ cnd_interval_dat* data = (cnd_interval_dat*)cnd_get_user_data(cnd);
+ gint32 elapsed_time;
+ /* check interval here */
+ if(data->interval_s == 0) return FALSE; /* 0 == infinite */
+ elapsed_time = (gint32) (time(NULL) - data->start_time);
+ if(elapsed_time >= data->interval_s) return TRUE;
+ return FALSE;
+} /* END _cnd_eval_interval()*/
+
+/*
+ * Call this function to reset this condition to its initial state, i.e. the
+ * state it was in right after creation.
+ *
+ * parameter: cnd - Pointer to an initialized condition.
+ */
+static void _cnd_reset_interval(condition *cnd){
+ ((cnd_interval_dat*)cnd_get_user_data(cnd))->start_time = time(NULL);
+ ((cnd_interval_dat*)cnd_get_user_data(cnd))->start_time -=
+ ((cnd_interval_dat*)cnd_get_user_data(cnd))->start_time % ((cnd_interval_dat*)cnd_get_user_data(cnd))->interval_s;
+} /* END _cnd_reset_interval() */
+
+
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/capture_stop_conditions.h b/capture_stop_conditions.h
index 2cd21253f9..e21285b255 100644
--- a/capture_stop_conditions.h
+++ b/capture_stop_conditions.h
@@ -25,6 +25,7 @@ void cleanup_capture_stop_conditions(void);
extern const char *CND_CLASS_TIMEOUT;
extern const char *CND_CLASS_CAPTURESIZE;
+extern const char *CND_CLASS_INTERVAL;
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/doc/dumpcap.pod b/doc/dumpcap.pod
index 5753f99075..1c76aa8fc2 100644
--- a/doc/dumpcap.pod
+++ b/doc/dumpcap.pod
@@ -98,6 +98,9 @@ where I<key> is one of:
B<duration>:I<value> switch to the next file after I<value> seconds have
elapsed, even if the current file is not completely filled up.
+B<interval>:I<value> switch to the next file when the time is an exact
+multiple of I<value> seconds
+
B<filesize>:I<value> switch to the next file after it reaches a size of
I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB.
@@ -105,10 +108,10 @@ B<files>:I<value> begin again with the first file after I<value> number of
files were written (form a ring buffer). This value must be less than 100000.
Caution should be used when using large numbers of files: some filesystems do
not handle many files in a single directory well. The B<files> criterion
-requires either B<duration> or B<filesize> to be specified to control when to
-go to the next file. It should be noted that each B<-b> parameter takes exactly
-one criterion; to specify two criterion, each must be preceded by the B<-b>
-option.
+requires either B<duration>, B<interval> or B<filesize> to be specified to
+control when to go to the next file. It should be noted that each B<-b>
+parameter takes exactly one criterion; to specify two criterion, each must be
+preceded by the B<-b> option.
Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files
of size one megabyte each.
diff --git a/doc/tshark.pod b/doc/tshark.pod
index 9cde4e4fea..664851bafe 100644
--- a/doc/tshark.pod
+++ b/doc/tshark.pod
@@ -209,6 +209,9 @@ where I<key> is one of:
B<duration>:I<value> switch to the next file after I<value> seconds have
elapsed, even if the current file is not completely filled up.
+B<interval>:I<value> switch to the next file when the time is an exact
+multiple of I<value> seconds
+
B<filesize>:I<value> switch to the next file after it reaches a size of
I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB.
@@ -216,10 +219,10 @@ B<files>:I<value> begin again with the first file after I<value> number of
files were written (form a ring buffer). This value must be less than 100000.
Caution should be used when using large numbers of files: some filesystems do
not handle many files in a single directory well. The B<files> criterion
-requires either B<duration> or B<filesize> to be specified to control when to
-go to the next file. It should be noted that each B<-b> parameter takes exactly
-one criterion; to specify two criterion, each must be preceded by the B<-b>
-option.
+requires either B<duration>, B<interval> or B<filesize> to be specified to
+control when to go to the next file. It should be noted that each B<-b>
+parameter takes exactly one criterion; to specify two criterion, each must be
+preceded by the B<-b> option.
Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files
of size one megabyte each.
diff --git a/doc/wireshark.pod.template b/doc/wireshark.pod.template
index 1213c290bc..d89bf546fc 100644
--- a/doc/wireshark.pod.template
+++ b/doc/wireshark.pod.template
@@ -272,6 +272,9 @@ where I<key> is one of:
B<duration>:I<value> switch to the next file after I<value> seconds have
elapsed, even if the current file is not completely filled up.
+B<interval>:I<value> switch to the next file when the time is an exact
+multiple of I<value> seconds
+
B<filesize>:I<value> switch to the next file after it reaches a size of
I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB.
@@ -279,10 +282,10 @@ B<files>:I<value> begin again with the first file after I<value> number of
files were written (form a ring buffer). This value must be less than 100000.
Caution should be used when using large numbers of files: some filesystems do
not handle many files in a single directory well. The B<files> criterion
-requires either B<duration> or B<filesize> to be specified to control when to
-go to the next file. It should be noted that each B<-b> parameter takes exactly
-one criterion; to specify two criterion, each must be preceded by the B<-b>
-option.
+requires either B<duration>, B<interval> or B<filesize> to be specified to
+control when to go to the next file. It should be noted that each B<-b>
+parameter takes exactly one criterion; to specify two criterion, each must be
+preceded by the B<-b> option.
Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files
of size one megabyte each.
diff --git a/dumpcap.c b/dumpcap.c
index 6f28630b7f..cc248ff781 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -524,6 +524,7 @@ print_usage(FILE *output)
fprintf(output, " -w <filename> name of file to save (def: tempfile)\n");
fprintf(output, " -g enable group read access on the output file(s)\n");
fprintf(output, " -b <ringbuffer opt.> ... duration:NUM - switch to next file after NUM secs\n");
+ fprintf(output, " interval:NUM - create time intervals of NUM secs\n");
fprintf(output, " filesize:NUM - switch to next file after NUM KB\n");
fprintf(output, " files:NUM - ringbuffer: replace after NUM files\n");
fprintf(output, " -n use pcapng format instead of pcap (default)\n");
@@ -2970,7 +2971,8 @@ static gboolean
do_file_switch_or_stop(capture_options *capture_opts,
condition *cnd_autostop_files,
condition *cnd_autostop_size,
- condition *cnd_file_duration)
+ condition *cnd_file_duration,
+ condition *cnd_file_interval)
{
guint i;
capture_src *pcap_src;
@@ -3047,6 +3049,8 @@ do_file_switch_or_stop(capture_options *capture_opts,
cnd_reset(cnd_autostop_size);
if (cnd_file_duration)
cnd_reset(cnd_file_duration);
+ if (cnd_file_interval)
+ cnd_reset(cnd_file_interval);
fflush(global_ld.pdh);
if (!quiet)
report_packet_count(global_ld.inpkts_to_sync_pipe);
@@ -3099,6 +3103,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
int err_close;
int inpkts;
condition *cnd_file_duration = NULL;
+ condition *cnd_file_interval = NULL;
condition *cnd_autostop_files = NULL;
condition *cnd_autostop_size = NULL;
condition *cnd_autostop_duration = NULL;
@@ -3224,6 +3229,10 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
if (capture_opts->has_autostop_files)
cnd_autostop_files =
cnd_new(CND_CLASS_CAPTURESIZE, (guint64)capture_opts->autostop_files);
+
+ if (capture_opts->has_file_interval)
+ cnd_file_interval =
+ cnd_new(CND_CLASS_INTERVAL, capture_opts->file_interval);
}
/* init the time values */
@@ -3315,8 +3324,11 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
if (cnd_autostop_size != NULL &&
cnd_eval(cnd_autostop_size, global_ld.bytes_written)) {
/* Capture size limit reached, do we have another file? */
- if (!do_file_switch_or_stop(capture_opts, cnd_autostop_files,
- cnd_autostop_size, cnd_file_duration))
+ if (!do_file_switch_or_stop(capture_opts,
+ cnd_autostop_files,
+ cnd_autostop_size,
+ cnd_file_duration,
+ cnd_file_interval))
continue;
} /* cnd_autostop_size */
if (capture_opts->output_to_pipe) {
@@ -3369,10 +3381,24 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* check capture file duration condition */
if (cnd_file_duration != NULL && cnd_eval(cnd_file_duration)) {
/* duration limit reached, do we have another file? */
- if (!do_file_switch_or_stop(capture_opts, cnd_autostop_files,
- cnd_autostop_size, cnd_file_duration))
+ if (!do_file_switch_or_stop(capture_opts,
+ cnd_autostop_files,
+ cnd_autostop_size,
+ cnd_file_duration,
+ cnd_file_interval))
continue;
} /* cnd_file_duration */
+
+ /* check capture file interval condition */
+ if (cnd_file_interval != NULL && cnd_eval(cnd_file_interval)) {
+ /* end of interval reached, do we have another file? */
+ if (!do_file_switch_or_stop(capture_opts,
+ cnd_autostop_files,
+ cnd_autostop_size,
+ cnd_file_duration,
+ cnd_file_interval))
+ continue;
+ } /* cnd_file_interval */
}
}
@@ -3418,6 +3444,8 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* delete stop conditions */
if (cnd_file_duration != NULL)
cnd_delete(cnd_file_duration);
+ if (cnd_file_interval != NULL)
+ cnd_delete(cnd_file_interval);
if (cnd_autostop_files != NULL)
cnd_delete(cnd_autostop_files);
if (cnd_autostop_size != NULL)
@@ -4397,13 +4425,20 @@ main(int argc, char *argv[])
cmdarg_err("Ring buffer requested, but capture isn't being saved to a permanent file.");
global_capture_opts.multi_files_on = FALSE;
}
- if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
- cmdarg_err("Ring buffer requested, but no maximum capture file size or duration were specified.");
+ if (!global_capture_opts.has_autostop_filesize &&
+ !global_capture_opts.has_file_duration &&
+ !global_capture_opts.has_file_interval) {
+ cmdarg_err("Ring buffer requested, but no maximum capture file size, duration"
+ "or interval were specified.");
#if 0
/* XXX - this must be redesigned as the conditions changed */
global_capture_opts.multi_files_on = FALSE;
#endif
}
+ if (global_capture_opts.has_file_duration && global_capture_opts.has_file_interval) {
+ cmdarg_err("Ring buffer file duration and interval can't be used at the same time.");
+ exit_main(1);
+ }
}
}
diff --git a/tshark.c b/tshark.c
index 53871469ed..982c92bceb 100644
--- a/tshark.c
+++ b/tshark.c
@@ -364,6 +364,7 @@ print_usage(FILE *output)
/*fprintf(output, "\n");*/
fprintf(output, "Capture output:\n");
fprintf(output, " -b <ringbuffer opt.> ... duration:NUM - switch to next file after NUM secs\n");
+ fprintf(output, " interval:NUM - create time intervals of NUM secs\n");
fprintf(output, " filesize:NUM - switch to next file after NUM KB\n");
fprintf(output, " files:NUM - ringbuffer: replace after NUM files\n");
#endif /* HAVE_LIBPCAP */
@@ -1638,6 +1639,12 @@ main(int argc, char *argv[])
goto clean_exit;
}
if (global_capture_opts.has_file_duration) {
+ cmdarg_err("Switching capture files after a time period was specified, but "
+ "a capture isn't being done.");
+ exit_status = INVALID_OPTION;
+ goto clean_exit;
+ }
+ if (global_capture_opts.has_file_interval) {
cmdarg_err("Switching capture files after a time interval was specified, but "
"a capture isn't being done.");
exit_status = INVALID_OPTION;
@@ -1720,9 +1727,10 @@ main(int argc, char *argv[])
goto clean_exit;
}
if (!global_capture_opts.has_autostop_filesize &&
- !global_capture_opts.has_file_duration) {
+ !global_capture_opts.has_file_duration &&
+ !global_capture_opts.has_file_interval) {
cmdarg_err("Multiple capture files requested, but "
- "no maximum capture file size or duration was specified.");
+ "no maximum capture file size, duration or interval was specified.");
exit_status = INVALID_OPTION;
goto clean_exit;
}
diff --git a/ui/commandline.c b/ui/commandline.c
index b7c1ef7db4..dc20e1505b 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -672,8 +672,10 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
cmdarg_err("Ring buffer requested, but capture isn't being saved to a permanent file.");
global_capture_opts.multi_files_on = FALSE;
}
- if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
- cmdarg_err("Ring buffer requested, but no maximum capture file size or duration were specified.");
+ if (!global_capture_opts.has_autostop_filesize &&
+ !global_capture_opts.has_file_duration &&
+ !global_capture_opts.has_file_interval) {
+ cmdarg_err("Ring buffer requested, but no maximum capture file size, duration or interval were specified.");
/* XXX - this must be redesigned as the conditions changed */
}
}
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 719bcc81b9..c79ff4d4d0 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -148,9 +148,9 @@ enum
#define E_CAP_RING_FILESIZE_CB_KEY "cap_ring_filesize_cb"
#define E_CAP_RING_FILESIZE_SB_KEY "cap_ring_filesize_sb"
#define E_CAP_RING_FILESIZE_CBX_KEY "cap_ring_filesize_cbx"
-#define E_CAP_FILE_DURATION_CB_KEY "cap_file_duration_cb"
-#define E_CAP_FILE_DURATION_SB_KEY "cap_file_duration_sb"
-#define E_CAP_FILE_DURATION_CBX_KEY "cap_file_duration_cbx"
+#define E_CAP_FILE_INTERVAL_CB_KEY "cap_file_interval_cb"
+#define E_CAP_FILE_INTERVAL_SB_KEY "cap_file_interval_sb"
+#define E_CAP_FILE_INTERVAL_CBX_KEY "cap_file_interval_cbx"
#define E_CAP_RING_NBF_CB_KEY "cap_ring_nbf_cb"
#define E_CAP_RING_NBF_SB_KEY "cap_ring_nbf_sb"
#define E_CAP_RING_NBF_LB_KEY "cap_ring_nbf_lb"
@@ -4598,7 +4598,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
*file_hb, *file_bt, *file_lb, *file_te,
*multi_hb, *multi_grid, *multi_files_on_cb,
*ring_filesize_cb, *ring_filesize_sb, *ring_filesize_cbx,
- *file_duration_cb, *file_duration_sb, *file_duration_cbx,
+ *file_interval_cb, *file_interval_sb, *file_interval_cbx,
*ringbuffer_nbf_cb, *ringbuffer_nbf_sb, *ringbuffer_nbf_lb,
*stop_files_cb, *stop_files_sb, *stop_files_lb,
*limit_fr, *limit_vb, *limit_hb, *limit_grid,
@@ -4622,7 +4622,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
GtkAdjustment *ringbuffer_nbf_adj,
*stop_packets_adj, *stop_filesize_adj, *stop_duration_adj, *stop_files_adj,
- *ring_filesize_adj, *file_duration_adj;
+ *ring_filesize_adj, *file_interval_adj;
int row;
guint32 value;
gchar *cap_title;
@@ -5018,7 +5018,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
/* Ring buffer filesize row */
ring_filesize_cb = gtk_check_button_new_with_label("Next file every");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ring_filesize_cb),
- global_capture_opts.has_autostop_filesize || !global_capture_opts.has_file_duration);
+ global_capture_opts.has_autostop_filesize || !global_capture_opts.has_file_interval);
g_signal_connect(ring_filesize_cb, "toggled", G_CALLBACK(capture_prep_adjust_sensitivity), cap_open_w);
gtk_widget_set_tooltip_text(ring_filesize_cb,
"If the selected file size is exceeded, capturing switches to the next file.\n"
@@ -5044,31 +5044,31 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
row++;
/* Ring buffer duration row */
- file_duration_cb = gtk_check_button_new_with_label("Next file every");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(file_duration_cb),
- global_capture_opts.has_file_duration);
- g_signal_connect(file_duration_cb, "toggled",
+ file_interval_cb = gtk_check_button_new_with_label("Next file every");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(file_interval_cb),
+ global_capture_opts.has_file_interval);
+ g_signal_connect(file_interval_cb, "toggled",
G_CALLBACK(capture_prep_adjust_sensitivity), cap_open_w);
- gtk_widget_set_tooltip_text(file_duration_cb,
+ gtk_widget_set_tooltip_text(file_interval_cb,
"If the selected duration is exceeded, capturing switches to the next file.\n"
"PLEASE NOTE: at least one of the \"Next file every\" options MUST be selected.");
- ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_duration_cb, 0, row, 1, 1,
+ ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_interval_cb, 0, row, 1, 1,
(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, 0);
- file_duration_adj = (GtkAdjustment *)gtk_adjustment_new(0.0,
+ file_interval_adj = (GtkAdjustment *)gtk_adjustment_new(0.0,
1, (gfloat)INT_MAX, 1.0, 10.0, 0.0);
- file_duration_sb = gtk_spin_button_new (file_duration_adj, 0, 0);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (file_duration_sb), TRUE);
- gtk_widget_set_size_request(file_duration_sb, 80, -1);
- ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_duration_sb, 1, row, 1, 1,
+ file_interval_sb = gtk_spin_button_new (file_interval_adj, 0, 0);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (file_interval_sb), TRUE);
+ gtk_widget_set_size_request(file_interval_sb, 80, -1);
+ ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_interval_sb, 1, row, 1, 1,
(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, 0);
- file_duration_cbx = time_unit_combo_box_new(global_capture_opts.file_duration);
- ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_duration_cbx, 2, row, 1, 1,
+ file_interval_cbx = time_unit_combo_box_new(global_capture_opts.file_interval);
+ ws_gtk_grid_attach_extended(GTK_GRID (multi_grid), file_interval_cbx, 2, row, 1, 1,
(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, 0);
- value = time_unit_combo_box_convert_value(global_capture_opts.file_duration);
- gtk_adjustment_set_value(file_duration_adj, (gdouble) value);
+ value = time_unit_combo_box_convert_value(global_capture_opts.file_interval);
+ gtk_adjustment_set_value(file_interval_adj, (gdouble) value);
row++;
/* Ring buffer files row */
@@ -5318,9 +5318,9 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_RING_FILESIZE_CB_KEY, ring_filesize_cb);
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_RING_FILESIZE_SB_KEY, ring_filesize_sb);
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_RING_FILESIZE_CBX_KEY, ring_filesize_cbx);
- g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_DURATION_CB_KEY, file_duration_cb);
- g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_DURATION_SB_KEY, file_duration_sb);
- g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_DURATION_CBX_KEY, file_duration_cbx);
+ g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_INTERVAL_CB_KEY, file_interval_cb);
+ g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_INTERVAL_SB_KEY, file_interval_sb);
+ g_object_set_data(G_OBJECT(cap_open_w), E_CAP_FILE_INTERVAL_CBX_KEY, file_interval_cbx);
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SYNC_KEY, sync_cb);
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_AUTO_SCROLL_KEY, auto_scroll_cb);
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_HIDE_INFO_KEY, hide_info_cb);
@@ -5514,7 +5514,7 @@ capture_dlg_prep(gpointer parent_w) {
*stop_filesize_cb, *stop_filesize_sb, *stop_filesize_cbx,
*stop_duration_cb, *stop_duration_sb, *stop_duration_cbx,
*ring_filesize_cb, *ring_filesize_sb, *ring_filesize_cbx,
- *file_duration_cb, *file_duration_sb, *file_duration_cbx,
+ *file_interval_cb, *file_interval_sb, *file_interval_cbx,
*stop_files_cb, *stop_files_sb,
*m_resolv_cb, *n_resolv_cb, *t_resolv_cb, *e_resolv_cb;
const gchar *g_save_file;
@@ -5530,9 +5530,9 @@ capture_dlg_prep(gpointer parent_w) {
ring_filesize_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_CB_KEY);
ring_filesize_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_SB_KEY);
ring_filesize_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_CBX_KEY);
- file_duration_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_CB_KEY);
- file_duration_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_SB_KEY);
- file_duration_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_CBX_KEY);
+ file_interval_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_CB_KEY);
+ file_interval_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_SB_KEY);
+ file_interval_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_CBX_KEY);
sync_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SYNC_KEY);
auto_scroll_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_AUTO_SCROLL_KEY);
hide_info_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_HIDE_INFO_KEY);
@@ -5631,13 +5631,13 @@ capture_dlg_prep(gpointer parent_w) {
global_capture_opts.multi_files_on =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(multi_files_on_cb));
- global_capture_opts.has_file_duration =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_duration_cb));
- if (global_capture_opts.has_file_duration) {
- global_capture_opts.file_duration =
- gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(file_duration_sb));
- global_capture_opts.file_duration =
- time_unit_combo_box_get_value(file_duration_cbx, global_capture_opts.file_duration);
+ global_capture_opts.has_file_interval =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_interval_cb));
+ if (global_capture_opts.has_file_interval) {
+ global_capture_opts.file_interval =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(file_interval_sb));
+ global_capture_opts.file_interval =
+ time_unit_combo_box_get_value(file_interval_cbx, global_capture_opts.file_interval);
}
global_capture_opts.has_autostop_files =
@@ -5670,10 +5670,10 @@ capture_dlg_prep(gpointer parent_w) {
"You must specify a filename if you want to use multiple files.",
simple_dialog_primary_start(), simple_dialog_primary_end());
return FALSE;
- } else if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
+ } else if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_interval) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%sMultiple files: No file limit given.%s\n\n"
- "You must specify a file size or duration at which is switched to the next capture file\n"
+ "You must specify a file size or interval at which is switched to the next capture file\n"
"if you want to use multiple files.",
simple_dialog_primary_start(), simple_dialog_primary_end());
g_free(global_capture_opts.save_file);
@@ -6022,7 +6022,7 @@ capture_prep_adjust_sensitivity(GtkWidget *tb _U_, gpointer parent_w)
{
GtkWidget *multi_files_on_cb, *ringbuffer_nbf_cb, *ringbuffer_nbf_sb, *ringbuffer_nbf_lb,
*ring_filesize_cb, *ring_filesize_sb, *ring_filesize_cbx,
- *file_duration_cb, *file_duration_sb, *file_duration_cbx,
+ *file_interval_cb, *file_interval_sb, *file_interval_cbx,
*sync_cb, *auto_scroll_cb,
*stop_packets_cb, *stop_packets_sb, *stop_packets_lb,
*stop_filesize_cb, *stop_filesize_sb, *stop_filesize_cbx,
@@ -6036,9 +6036,9 @@ capture_prep_adjust_sensitivity(GtkWidget *tb _U_, gpointer parent_w)
ring_filesize_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_CB_KEY);
ring_filesize_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_SB_KEY);
ring_filesize_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_RING_FILESIZE_CBX_KEY);
- file_duration_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_CB_KEY);
- file_duration_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_SB_KEY);
- file_duration_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_DURATION_CBX_KEY);
+ file_interval_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_CB_KEY);
+ file_interval_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_SB_KEY);
+ file_interval_cbx = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_FILE_INTERVAL_CBX_KEY);
sync_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SYNC_KEY);
auto_scroll_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_AUTO_SCROLL_KEY);
stop_packets_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_STOP_PACKETS_CB_KEY);
@@ -6088,9 +6088,9 @@ capture_prep_adjust_sensitivity(GtkWidget *tb _U_, gpointer parent_w)
/* Force at least one of the "file switch" conditions (we need at least one) */
if ((gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ring_filesize_cb)) == FALSE) &&
- (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_duration_cb)) == FALSE)) {
+ (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_interval_cb)) == FALSE)) {
if (tb == ring_filesize_cb)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(file_duration_cb), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(file_interval_cb), TRUE);
else
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ring_filesize_cb), TRUE);
}
@@ -6109,13 +6109,13 @@ capture_prep_adjust_sensitivity(GtkWidget *tb _U_, gpointer parent_w)
gtk_widget_set_sensitive(GTK_WIDGET(ring_filesize_cbx),
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ring_filesize_cb)));
- /* The ring duration spinbox is sensitive if the "Next capture file
+ /* The ring interval spinbox is sensitive if the "Next capture file
after N seconds" checkbox is on. */
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_cb), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_sb),
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_duration_cb)));
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_cbx),
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_duration_cb)));
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_cb), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_sb),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_interval_cb)));
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_cbx),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(file_interval_cb)));
gtk_widget_set_sensitive(GTK_WIDGET(stop_filesize_cb), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(stop_filesize_sb), FALSE);
@@ -6136,9 +6136,9 @@ capture_prep_adjust_sensitivity(GtkWidget *tb _U_, gpointer parent_w)
gtk_widget_set_sensitive(GTK_WIDGET(ring_filesize_sb),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(ring_filesize_cbx),FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_cb), FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_sb),FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(file_duration_cbx),FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_cb), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_sb),FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(file_interval_cbx),FALSE);
/* The maximum file size spinbox is sensitive if the "Stop capture
after N kilobytes" checkbox is on. */
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index d2969c0df7..135941da5d 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -491,7 +491,7 @@ void CaptureInterfacesDialog::interfaceItemChanged(QTreeWidgetItem *item, int co
void CaptureInterfacesDialog::on_gbStopCaptureAuto_toggled(bool checked)
{
- global_capture_opts.has_file_duration = checked;
+ global_capture_opts.has_file_interval = checked;
}
void CaptureInterfacesDialog::on_gbNewFileAuto_toggled(bool checked)
@@ -569,7 +569,7 @@ void CaptureInterfacesDialog::updateInterfaces()
ui->gbNewFileAuto->setChecked(global_capture_opts.multi_files_on);
ui->MBCheckBox->setChecked(global_capture_opts.has_autostop_filesize);
- ui->SecsCheckBox->setChecked(global_capture_opts.has_file_duration);
+ ui->SecsCheckBox->setChecked(global_capture_opts.has_file_interval);
if (global_capture_opts.has_autostop_filesize) {
int value = global_capture_opts.autostop_filesize;
if (value > 1000000) {
@@ -601,8 +601,8 @@ void CaptureInterfacesDialog::updateInterfaces()
}
}
}
- if (global_capture_opts.has_file_duration) {
- int value = global_capture_opts.file_duration;
+ if (global_capture_opts.has_file_interval) {
+ int value = global_capture_opts.file_interval;
if (value > 3600 && value % 3600 == 0) {
ui->SecsSpinBox->setValue(value / 3600);
ui->SecsComboBox->setCurrentIndex(2);
@@ -622,7 +622,7 @@ void CaptureInterfacesDialog::updateInterfaces()
if (global_capture_opts.has_autostop_duration) {
ui->stopSecsCheckBox->setChecked(true);
- int value = global_capture_opts.file_duration;
+ int value = global_capture_opts.file_interval;
if (value > 3600 && value % 3600 == 0) {
ui->stopSecsSpinBox->setValue(value / 3600);
ui->stopSecsComboBox->setCurrentIndex(2);
@@ -858,14 +858,14 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
}
global_capture_opts.multi_files_on = ui->gbNewFileAuto->isChecked();
if (global_capture_opts.multi_files_on) {
- global_capture_opts.has_file_duration = ui->SecsCheckBox->isChecked();
- if (global_capture_opts.has_file_duration) {
- global_capture_opts.file_duration = ui->SecsSpinBox->value();
+ global_capture_opts.has_file_interval = ui->SecsCheckBox->isChecked();
+ if (global_capture_opts.has_file_interval) {
+ global_capture_opts.file_interval = ui->SecsSpinBox->value();
int index = ui->SecsComboBox->currentIndex();
switch (index) {
- case 1: global_capture_opts.file_duration *= 60;
+ case 1: global_capture_opts.file_interval *= 60;
break;
- case 2: global_capture_opts.file_duration *= 3600;
+ case 2: global_capture_opts.file_interval *= 3600;
break;
}
}
@@ -897,9 +897,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
QMessageBox::warning(this, tr("Error"),
tr("Multiple files: No capture file name given. You must specify a filename if you want to use multiple files."));
return false;
- } else if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
+ } else if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_interval) {
QMessageBox::warning(this, tr("Error"),
- tr("Multiple files: No file limit given. You must specify a file size or duration at which is switched to the next capture file\n if you want to use multiple files."));
+ tr("Multiple files: No file limit given. You must specify a file size or interval at which is switched to the next capture file\n if you want to use multiple files."));
g_free(global_capture_opts.save_file);
global_capture_opts.save_file = NULL;
return false;