aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.h
diff options
context:
space:
mode:
Diffstat (limited to 'capture_opts.h')
-rw-r--r--capture_opts.h56
1 files changed, 30 insertions, 26 deletions
diff --git a/capture_opts.h b/capture_opts.h
index 82029b8eea..dd5850d2c7 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -20,7 +20,9 @@
#include <sys/types.h> /* for gid_t */
-#include <caputils/capture_ifinfo.h>
+#include <capture/capture_ifinfo.h>
+#include "ringbuffer.h"
+#include <wsutil/wslog.h>
#ifdef _WIN32
#include <windows.h>
@@ -42,9 +44,9 @@ extern "C" {
* In short: we must not use 1 here, which is another reason to use
* values outside the range of ASCII graphic characters.
*/
-#define LONGOPT_NUM_CAP_COMMENT LONGOPT_BASE_CAPTURE+1
-#define LONGOPT_LIST_TSTAMP_TYPES LONGOPT_BASE_CAPTURE+2
-#define LONGOPT_SET_TSTAMP_TYPE LONGOPT_BASE_CAPTURE+3
+#define LONGOPT_LIST_TSTAMP_TYPES LONGOPT_BASE_CAPTURE+1
+#define LONGOPT_SET_TSTAMP_TYPE LONGOPT_BASE_CAPTURE+2
+#define LONGOPT_COMPRESS_TYPE LONGOPT_BASE_CAPTURE+3
/*
* Options for capturing common to all capturing programs.
@@ -57,7 +59,7 @@ extern "C" {
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
#define LONGOPT_BUFFER_SIZE \
- {"buffer-size", required_argument, NULL, 'B'},
+ {"buffer-size", ws_required_argument, NULL, 'B'},
#define OPTSTRING_B "B:"
#else
#define LONGOPT_BUFFER_SIZE
@@ -65,7 +67,7 @@ extern "C" {
#endif
#ifdef HAVE_PCAP_CREATE
-#define LONGOPT_MONITOR_MODE {"monitor-mode", no_argument, NULL, 'I'},
+#define LONGOPT_MONITOR_MODE {"monitor-mode", ws_no_argument, NULL, 'I'},
#define OPTSTRING_I "I"
#else
#define LONGOPT_MONITOR_MODE
@@ -73,19 +75,19 @@ extern "C" {
#endif
#define LONGOPT_CAPTURE_COMMON \
- {"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
- {"autostop", required_argument, NULL, 'a'}, \
- {"ring-buffer", required_argument, NULL, 'b'}, \
+ {"autostop", ws_required_argument, NULL, 'a'}, \
+ {"ring-buffer", ws_required_argument, NULL, 'b'}, \
LONGOPT_BUFFER_SIZE \
- {"list-interfaces", no_argument, NULL, 'D'}, \
- {"interface", required_argument, NULL, 'i'}, \
+ {"list-interfaces", ws_no_argument, NULL, 'D'}, \
+ {"interface", ws_required_argument, NULL, 'i'}, \
LONGOPT_MONITOR_MODE \
- {"list-data-link-types", no_argument, NULL, 'L'}, \
- {"no-promiscuous-mode", no_argument, NULL, 'p'}, \
- {"snapshot-length", required_argument, NULL, 's'}, \
- {"linktype", required_argument, NULL, 'y'}, \
- {"list-time-stamp-types", no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
- {"time-stamp-type", required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE},
+ {"list-data-link-types", ws_no_argument, NULL, 'L'}, \
+ {"no-promiscuous-mode", ws_no_argument, NULL, 'p'}, \
+ {"snapshot-length", ws_required_argument, NULL, 's'}, \
+ {"linktype", ws_required_argument, NULL, 'y'}, \
+ {"list-time-stamp-types", ws_no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
+ {"time-stamp-type", ws_required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE}, \
+ {"compress-type", ws_required_argument, NULL, LONGOPT_COMPRESS_TYPE},
#define OPTSTRING_CAPTURE_COMMON \
@@ -194,6 +196,7 @@ typedef struct interface_options_tag {
gchar *descr; /* a more user-friendly description of the interface; may be NULL if none */
gchar *hardware; /* description of the hardware */
gchar *display_name; /* the name displayed in the console and title bar */
+ gchar *ifname; /* if not null, name to use instead of the interface naem in IDBs */
gchar *cfilter;
gboolean has_snaplen;
int snaplen;
@@ -292,6 +295,7 @@ typedef struct capture_options_tag {
int file_packets; /**< Switch file after n packets */
gboolean has_ring_num_files; /**< TRUE if ring num_files specified */
guint32 ring_num_files; /**< Number of multiple buffer files */
+ gboolean has_nametimenum; /**< TRUE if file name has date part before num part */
/* autostop conditions */
gboolean has_autostop_files; /**< TRUE if maximum number of capture files
@@ -308,8 +312,6 @@ typedef struct capture_options_tag {
is specified */
gdouble autostop_duration; /**< Maximum capture duration */
- 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 */
@@ -317,6 +319,7 @@ typedef struct capture_options_tag {
/* internally used (don't touch from outside) */
gboolean output_to_pipe; /**< save_file is a pipe (named or stdout) */
gboolean capture_child; /**< hidden option: Wireshark child mode */
+ gchar *compress_type; /**< compress type */
} capture_options;
/* initialize the capture_options with some reasonable values */
@@ -329,21 +332,22 @@ capture_opts_cleanup(capture_options *capture_opts);
/* set a command line option value */
extern int
-capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, gboolean *start_capture);
+capture_opts_add_opt(capture_options *capture_opts, int opt, const char *ws_optarg);
/* log content of capture_opts */
extern void
-capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_options *capture_opts);
+capture_opts_log(const char *domain, enum ws_log_level level, capture_options *capture_opts);
enum caps_query {
- CAPS_MONITOR_MODE = 0x1,
- CAPS_QUERY_LINK_TYPES = 0x2,
- CAPS_QUERY_TIMESTAMP_TYPES = 0x4
+ CAPS_QUERY_LINK_TYPES = 0x1,
+ CAPS_QUERY_TIMESTAMP_TYPES = 0x2
};
/* print interface capabilities, including link layer types */
-extern void
-capture_opts_print_if_capabilities(if_capabilities_t *caps, char *name, int queries);
+extern int
+capture_opts_print_if_capabilities(if_capabilities_t *caps,
+ interface_options *interface_opts,
+ int queries);
/* print list of interfaces */
extern void