diff options
author | David Perry <boolean263@protonmail.com> | 2020-07-29 09:36:19 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-08-08 08:04:13 +0000 |
commit | e4379f0ea1ae75045cd7969b18bd40c9f3fefa6c (patch) | |
tree | ea24bdac5d74a6897e6c842e0ae32f4e6f7fa656 /capture_opts.h | |
parent | a9f39a29fe57fd7b1531f243fa278fd8c0fdab3e (diff) |
Dumpcap: print closed ring-buffer file names
This proposal adds a new option '-b printname:<filename>' to dumpcap. If
used, dumpcap will print the name of each ring buffer file it creates
after it is closed. Allows the use of '-'/'stdout' and 'stderr'.
Use case: Since the file name is printed after the file is closed for
writing, an automated capture process can do something like the
following with the guarantee that the file in question will not be
changed.
dumpcap -i eth0 -b files:2 -b printname:stdout [-b ...] | \
while read cap_file_name ; do
# Do something with $cap_file_name
done
This sort of scripting is difficult in dumpcap's current form. Dumpcap
prints the names of new files to stderr as it *opens* them, so a script
attempting to use this must sleep for "-b duration:value" seconds plus
some fudge time to be sure it's getting a closed, unchanging file.
Change-Id: Idb288cc7c8c30443256d35c8cd4460a2e3f0861c
Reviewed-on: https://code.wireshark.org/review/37994
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'capture_opts.h')
-rw-r--r-- | capture_opts.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/capture_opts.h b/capture_opts.h index e81aa72d40..82029b8eea 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -310,6 +310,9 @@ typedef struct capture_options_tag { gchar *capture_comment; /** capture comment to write to the output file */ + gboolean print_file_names; /**< TRUE if printing names of completed + files as we close them */ + gchar *print_name_to; /**< output file name */ /* internally used (don't touch from outside) */ gboolean output_to_pipe; /**< save_file is a pipe (named or stdout) */ |