command line option --capture-comment for dumpcap
svn path=/trunk/; revision=50945
This commit is contained in:
parent
a585b45343
commit
82ea635aa6
|
@ -627,6 +627,9 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
|
||||||
int status, snaplen;
|
int status, snaplen;
|
||||||
|
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
|
case LONGOPT_NUM_CAP_COMMENT: /* capture comment */
|
||||||
|
capture_opts->capture_comment = g_strdup(optarg_str_p);
|
||||||
|
break;
|
||||||
case 'a': /* autostop criteria */
|
case 'a': /* autostop criteria */
|
||||||
if (set_autostop_criterion(capture_opts, optarg_str_p) == FALSE) {
|
if (set_autostop_criterion(capture_opts, optarg_str_p) == FALSE) {
|
||||||
cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg_str_p);
|
cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg_str_p);
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define LONGOPT_NUM_CAP_COMMENT 0
|
||||||
|
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
/* Type of capture source */
|
/* Type of capture source */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
11
dumpcap.c
11
dumpcap.c
|
@ -505,6 +505,9 @@ print_usage(gboolean print_ver)
|
||||||
fprintf(output, " files:NUM - ringbuffer: replace after NUM files\n");
|
fprintf(output, " files:NUM - ringbuffer: replace after NUM files\n");
|
||||||
fprintf(output, " -n use pcapng format instead of pcap (default)\n");
|
fprintf(output, " -n use pcapng format instead of pcap (default)\n");
|
||||||
fprintf(output, " -P use libpcap format instead of pcapng\n");
|
fprintf(output, " -P use libpcap format instead of pcapng\n");
|
||||||
|
fprintf(output, " --capture-comment <comment>\n");
|
||||||
|
fprintf(output, " add a capture comment to the output file\n");
|
||||||
|
fprintf(output, " (only for pcapng)\n");
|
||||||
fprintf(output, "\n");
|
fprintf(output, "\n");
|
||||||
fprintf(output, "Miscellaneous:\n");
|
fprintf(output, "Miscellaneous:\n");
|
||||||
fprintf(output, " -N <packet_limit> maximum number of packets buffered within dumpcap\n");
|
fprintf(output, " -N <packet_limit> maximum number of packets buffered within dumpcap\n");
|
||||||
|
@ -4126,6 +4129,11 @@ main(int argc, char *argv[])
|
||||||
GString *comp_info_str;
|
GString *comp_info_str;
|
||||||
GString *runtime_info_str;
|
GString *runtime_info_str;
|
||||||
int opt;
|
int opt;
|
||||||
|
struct option long_options[] = {
|
||||||
|
{"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT },
|
||||||
|
{0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
gboolean arg_error = FALSE;
|
gboolean arg_error = FALSE;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -4470,7 +4478,7 @@ main(int argc, char *argv[])
|
||||||
global_capture_opts.capture_child = capture_child;
|
global_capture_opts.capture_child = capture_child;
|
||||||
|
|
||||||
/* Now get our args */
|
/* Now get our args */
|
||||||
while ((opt = getopt_long(argc, argv, OPTSTRING, NULL, NULL)) != -1) {
|
while ((opt = getopt_long(argc, argv, OPTSTRING, long_options, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'h': /* Print help and exit */
|
case 'h': /* Print help and exit */
|
||||||
print_usage(TRUE);
|
print_usage(TRUE);
|
||||||
|
@ -4497,6 +4505,7 @@ main(int argc, char *argv[])
|
||||||
case 's': /* Set the snapshot (capture) length */
|
case 's': /* Set the snapshot (capture) length */
|
||||||
case 'w': /* Write to capture file x */
|
case 'w': /* Write to capture file x */
|
||||||
case 'y': /* Set the pcap data link type */
|
case 'y': /* Set the pcap data link type */
|
||||||
|
case LONGOPT_NUM_CAP_COMMENT: /* add a capture comment */
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
case 'u': /* Use UDP for data transfer */
|
case 'u': /* Use UDP for data transfer */
|
||||||
case 'r': /* Capture own RPCAP traffic too */
|
case 'r': /* Capture own RPCAP traffic too */
|
||||||
|
|
Loading…
Reference in New Issue