diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-10-31 10:03:04 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-11-09 05:55:11 +0000 |
commit | 11a9a501fb004bd3259f457714670ffb6d3d21e9 (patch) | |
tree | cf1a39471dff0d4e9b8a8da493d243eb53588954 /capture_opts.c | |
parent | 9b6b36beaeb2f58a209943d95c05486b72c6907f (diff) |
Dumpcap+Qt: Add support for `-a packets:NUM` and `-b packets:NUM`.
Add the ability to rotate files after a specified number of packets (`-b
packets:NUM`). Move some condition checks to capture_loop_write_packet_cb.
Add `-a packets:NUM` in order to be consistent. It is functionally
equivalent to the `-c` flag.
Add a corresponding "packets" option to the Capture Interfaces dialog
Output tab.
Add initial tests for autostop and ringbuffer conditions.
Change-Id: I66eb968927ed287deb8edb96db96d7c73526c257
Reviewed-on: https://code.wireshark.org/review/30534
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c index 1a81b7fc32..4750cddd19 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -101,6 +101,8 @@ capture_opts_init(capture_options *capture_opts) capture_opts->file_duration = 60.0; /* 1 min */ capture_opts->has_file_interval = FALSE; capture_opts->file_interval = 60; /* 1 min */ + capture_opts->has_file_packets = FALSE; + capture_opts->file_packets = 0; capture_opts->has_ring_num_files = FALSE; capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES; @@ -243,6 +245,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) : %.3f", 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, "FilePackets (%u) : %u", capture_opts->has_file_packets, capture_opts->file_packets); 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); @@ -295,6 +298,9 @@ set_autostop_criterion(capture_options *capture_opts, const char *autostoparg) capture_opts->multi_files_on = TRUE; capture_opts->has_autostop_files = TRUE; capture_opts->autostop_files = get_positive_int(p,"autostop files"); + } else if (strcmp(autostoparg,"packets") == 0) { + capture_opts->has_autostop_packets = TRUE; + capture_opts->autostop_packets = get_positive_int(p,"packet count"); } else { return FALSE; } @@ -401,6 +407,9 @@ get_ring_arguments(capture_options *capture_opts, const char *arg) } else if (strcmp(arg,"interval") == 0) { capture_opts->has_file_interval = TRUE; capture_opts->file_interval = get_positive_int(p, "ring buffer interval"); + } else if (strcmp(arg,"packets") == 0) { + capture_opts->has_file_packets = TRUE; + capture_opts->file_packets = get_positive_int(p, "ring buffer packet count"); } *colonp = ':'; /* put the colon back */ @@ -805,6 +814,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_ break; #endif case 'c': /* Capture n packets */ + /* XXX Use set_autostop_criterion instead? */ capture_opts->has_autostop_packets = TRUE; capture_opts->autostop_packets = get_positive_int(optarg_str_p, "packet count"); break; |