2005-12-03 19:32:54 +00:00
|
|
|
/* capture_opts.h
|
|
|
|
* Capture options (all parameters needed to do the actual capture)
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-12-03 19:32:54 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 12:26:45 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2005-12-03 19:32:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** @file
|
2007-06-11 03:58:58 +00:00
|
|
|
*
|
2005-12-03 19:32:54 +00:00
|
|
|
* Capture options (all parameters needed to do the actual capture)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CAPTURE_OPTS_H__
|
|
|
|
#define __CAPTURE_OPTS_H__
|
|
|
|
|
2018-05-16 12:51:45 -07:00
|
|
|
#include <sys/types.h> /* for gid_t */
|
2008-06-24 03:38:15 +00:00
|
|
|
|
2021-03-24 22:09:19 +00:00
|
|
|
#include <capture/capture_ifinfo.h>
|
2021-06-08 02:46:52 +01:00
|
|
|
#include <wsutil/wslog.h>
|
2023-11-07 19:09:01 +00:00
|
|
|
#include <wsutil/filter_files.h>
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2017-08-19 23:39:21 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2014-06-20 12:18:48 -07:00
|
|
|
/*
|
|
|
|
* Long options.
|
|
|
|
* We do not currently have long options corresponding to all short
|
|
|
|
* options; we should probably pick appropriate option names for them.
|
|
|
|
*
|
|
|
|
* NOTE:
|
|
|
|
* for tshark, we're using a leading - in the optstring to prevent getopt()
|
|
|
|
* from permuting the argv[] entries, in this case, unknown argv[] entries
|
|
|
|
* will be returned as parameters to a dummy-option 1.
|
|
|
|
* In short: we must not use 1 here, which is another reason to use
|
|
|
|
* values outside the range of ASCII graphic characters.
|
|
|
|
*/
|
Clean up handling of --capture-comment.
Don't store the comments in a capture_options structure, because that's
available only if we're being built with capture support, and
--capture-comment can be used in TShark when reading a capture file and
writing another capture file, with no live capture taking place.
This means we don't handle that option in capture_opts_add_opt(); handle
it in the programs that support it.
Support writing multiple comments in dumpcap when capturing.
These changes also fix builds without pcap, and makes --capture-comment
work in Wireshark when a capture is started from the command line with
-k.
Update the help messages to indicate that --capture-comment adds a
capture comment, it doesn't change any comment (much less "the" comment,
as there isn't necessarily a single comment).
Update the man pages:
- not to presume that only pcapng files support file comments (even if
that's true now, it might not be true in the future);
- to note that multiple instances of --capture-comment are supported,
and that multiple comments will be written, whether capturing or reading
one file and writing another;
- clarify that Wireshark doesn't *discard* SHB comments other than the
first one, even though it only displays the first one;
2021-07-14 22:16:30 -07:00
|
|
|
#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
|
2022-02-09 14:32:28 +00:00
|
|
|
#define LONGOPT_CAPTURE_TMPDIR LONGOPT_BASE_CAPTURE+4
|
2023-03-08 22:15:21 -05:00
|
|
|
#define LONGOPT_UPDATE_INTERVAL LONGOPT_BASE_CAPTURE+5
|
2013-08-01 20:57:47 +00:00
|
|
|
|
2014-06-20 13:59:45 -07:00
|
|
|
/*
|
2014-06-20 14:38:39 -07:00
|
|
|
* Options for capturing common to all capturing programs.
|
2014-06-20 13:59:45 -07:00
|
|
|
*/
|
2014-06-20 14:38:39 -07:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
|
|
|
#define OPTSTRING_A "A:"
|
|
|
|
#else
|
2019-12-13 13:13:32 +01:00
|
|
|
#define OPTSTRING_A
|
2014-06-20 14:38:39 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define OPTSTRING_B "B:"
|
2014-06-20 13:59:45 -07:00
|
|
|
|
2014-06-20 14:38:39 -07:00
|
|
|
#define OPTSTRING_I "I"
|
2014-06-20 13:59:45 -07:00
|
|
|
|
2025-02-18 13:21:59 -08:00
|
|
|
// "interface" and "source" work for both Wireshark and Stratoshark flavors
|
|
|
|
// but we only advertise the appropriate one in each application.
|
2014-06-20 13:59:45 -07:00
|
|
|
#define LONGOPT_CAPTURE_COMMON \
|
2021-09-29 18:32:28 +01:00
|
|
|
{"autostop", ws_required_argument, NULL, 'a'}, \
|
|
|
|
{"ring-buffer", ws_required_argument, NULL, 'b'}, \
|
2025-01-02 17:24:03 -05:00
|
|
|
{"buffer-size", ws_required_argument, NULL, 'B'}, \
|
2021-09-29 18:32:28 +01:00
|
|
|
{"list-interfaces", ws_no_argument, NULL, 'D'}, \
|
2025-02-18 13:21:59 -08:00
|
|
|
{"list-sources", ws_no_argument, NULL, 'D'}, \
|
2021-09-29 18:32:28 +01:00
|
|
|
{"interface", ws_required_argument, NULL, 'i'}, \
|
2025-02-18 13:21:59 -08:00
|
|
|
{"source", ws_required_argument, NULL, 'i'}, \
|
2025-01-02 17:24:03 -05:00
|
|
|
{"monitor-mode", ws_no_argument, NULL, 'I'}, \
|
2021-09-29 18:32:28 +01:00
|
|
|
{"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}, \
|
2022-02-09 14:32:28 +00:00
|
|
|
{"compress-type", ws_required_argument, NULL, LONGOPT_COMPRESS_TYPE}, \
|
2023-03-08 22:15:21 -05:00
|
|
|
{"temp-dir", ws_required_argument, NULL, LONGOPT_CAPTURE_TMPDIR},\
|
|
|
|
{"update-interval", ws_required_argument, NULL, LONGOPT_UPDATE_INTERVAL},
|
2017-08-07 16:38:52 +02:00
|
|
|
|
2014-06-20 13:59:45 -07:00
|
|
|
|
|
|
|
#define OPTSTRING_CAPTURE_COMMON \
|
2024-06-06 10:56:10 -04:00
|
|
|
"a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:F:i:" OPTSTRING_I "Lps:y:"
|
2014-06-20 13:59:45 -07:00
|
|
|
|
2007-12-04 11:19:29 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
|
|
|
/* Type of capture source */
|
|
|
|
typedef enum {
|
|
|
|
CAPTURE_IFLOCAL, /**< Local network interface */
|
|
|
|
CAPTURE_IFREMOTE /**< Remote network interface */
|
|
|
|
} capture_source;
|
|
|
|
|
|
|
|
/* Type of RPCAPD Authentication */
|
|
|
|
typedef enum {
|
|
|
|
CAPTURE_AUTH_NULL, /**< No authentication */
|
|
|
|
CAPTURE_AUTH_PWD /**< User/password authentication */
|
|
|
|
} capture_auth;
|
2011-03-01 17:29:09 +00:00
|
|
|
#endif
|
2007-12-04 11:19:29 +00:00
|
|
|
#ifdef HAVE_PCAP_SETSAMPLING
|
|
|
|
/**
|
|
|
|
* Method of packet sampling (dropping some captured packets),
|
|
|
|
* may require additional integer parameter, marked here as N
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
CAPTURE_SAMP_NONE, /**< No sampling - capture all packets */
|
|
|
|
CAPTURE_SAMP_BY_COUNT, /**< Counter-based sampling -
|
|
|
|
capture 1 packet from every N */
|
|
|
|
CAPTURE_SAMP_BY_TIMER /**< Timer-based sampling -
|
|
|
|
capture no more than 1 packet
|
|
|
|
in N milliseconds */
|
|
|
|
} capture_sampling;
|
|
|
|
#endif
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2012-01-25 13:04:32 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
2012-01-25 18:03:50 +00:00
|
|
|
struct remote_host_info {
|
2024-07-07 19:05:04 -04:00
|
|
|
char *remote_host; /**< Host name or network address for remote capturing */
|
|
|
|
char *remote_port; /**< TCP port of remote RPCAP server */
|
2017-03-19 12:26:28 +01:00
|
|
|
capture_auth auth_type; /**< Authentication type */
|
2024-07-07 19:05:04 -04:00
|
|
|
char *auth_username; /**< Remote authentication parameters */
|
|
|
|
char *auth_password; /**< Remote authentication parameters */
|
|
|
|
bool datatx_udp;
|
|
|
|
bool nocap_rpcap;
|
|
|
|
bool nocap_local;
|
2012-01-25 13:04:32 +00:00
|
|
|
};
|
|
|
|
|
2014-07-09 13:50:11 +02:00
|
|
|
struct remote_host {
|
2024-07-07 19:05:04 -04:00
|
|
|
char *r_host; /**< Host name or network address for remote capturing */
|
|
|
|
char *remote_port; /**< TCP port of remote RPCAP server */
|
2017-03-19 12:26:28 +01:00
|
|
|
capture_auth auth_type; /**< Authentication type */
|
2024-07-07 19:05:04 -04:00
|
|
|
char *auth_username; /**< Remote authentication parameters */
|
|
|
|
char *auth_password; /**< Remote authentication parameters */
|
2014-07-09 13:50:11 +02:00
|
|
|
};
|
|
|
|
|
2012-01-25 13:04:32 +00:00
|
|
|
typedef struct remote_options_tag {
|
|
|
|
capture_source src_type;
|
2012-01-25 18:03:50 +00:00
|
|
|
struct remote_host_info remote_host_opts;
|
2012-01-25 13:04:32 +00:00
|
|
|
#ifdef HAVE_PCAP_SETSAMPLING
|
|
|
|
capture_sampling sampling_method;
|
|
|
|
int sampling_param;
|
|
|
|
#endif
|
|
|
|
} remote_options;
|
|
|
|
#endif /* HAVE_PCAP_REMOTE */
|
|
|
|
|
|
|
|
typedef struct interface_tag {
|
2024-07-07 19:05:04 -04:00
|
|
|
char *name;
|
|
|
|
char *display_name;
|
|
|
|
char *addresses;
|
|
|
|
int no_addresses;
|
|
|
|
char *cfilter;
|
2014-10-12 14:56:12 -04:00
|
|
|
GList *links;
|
2024-07-07 19:05:04 -04:00
|
|
|
int active_dlt;
|
2024-03-29 17:36:35 -07:00
|
|
|
bool pmode;
|
|
|
|
bool has_snaplen;
|
2015-03-18 23:38:12 -07:00
|
|
|
int snaplen;
|
2024-07-07 19:05:04 -04:00
|
|
|
bool local;
|
|
|
|
int buffer;
|
|
|
|
bool monitor_mode_enabled;
|
|
|
|
bool monitor_mode_supported;
|
2012-01-25 13:04:32 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
2014-10-12 14:56:12 -04:00
|
|
|
remote_options remote_opts;
|
2012-01-25 13:04:32 +00:00
|
|
|
#endif
|
2024-07-07 19:05:04 -04:00
|
|
|
uint32_t last_packets;
|
|
|
|
uint32_t packet_diff;
|
2014-10-12 14:56:12 -04:00
|
|
|
if_info_t if_info;
|
2024-07-07 19:05:04 -04:00
|
|
|
bool selected;
|
|
|
|
bool hidden;
|
2014-02-25 14:05:11 +01:00
|
|
|
/* External capture cached data */
|
2014-10-12 14:56:12 -04:00
|
|
|
GHashTable *external_cap_args_settings;
|
2024-07-07 19:05:04 -04:00
|
|
|
char *timestamp_type;
|
2012-01-25 13:04:32 +00:00
|
|
|
} interface_t;
|
|
|
|
|
|
|
|
typedef struct link_row_tag {
|
2024-07-07 19:05:04 -04:00
|
|
|
char *name;
|
|
|
|
int dlt;
|
2012-01-25 13:04:32 +00:00
|
|
|
} link_row;
|
|
|
|
|
2011-05-12 16:54:16 +00:00
|
|
|
typedef struct interface_options_tag {
|
2024-07-07 19:05:04 -04:00
|
|
|
char *name; /* the name of the interface supplied to libpcap/WinPcap/Npcap to specify the interface */
|
|
|
|
char *descr; /* a more user-friendly description of the interface; may be NULL if none */
|
|
|
|
char *hardware; /* description of the hardware */
|
|
|
|
char *display_name; /* the name displayed in the console and title bar */
|
|
|
|
char *ifname; /* if not null, name to use instead of the interface naem in IDBs */
|
|
|
|
char *cfilter;
|
|
|
|
bool has_snaplen;
|
2014-10-12 14:56:12 -04:00
|
|
|
int snaplen;
|
|
|
|
int linktype;
|
2024-07-07 19:05:04 -04:00
|
|
|
bool promisc_mode;
|
2014-10-12 14:56:12 -04:00
|
|
|
interface_type if_type;
|
2024-07-07 19:05:04 -04:00
|
|
|
char *extcap;
|
|
|
|
char *extcap_fifo;
|
2014-10-12 14:56:12 -04:00
|
|
|
GHashTable *extcap_args;
|
2018-03-02 09:11:31 -08:00
|
|
|
GPid extcap_pid; /* pid of running process or WS_INVALID_PID */
|
2024-07-07 19:05:04 -04:00
|
|
|
void * extcap_pipedata;
|
2022-08-07 18:40:56 +02:00
|
|
|
GString *extcap_stderr;
|
2024-07-07 19:05:04 -04:00
|
|
|
unsigned extcap_stdout_watch;
|
|
|
|
unsigned extcap_stderr_watch;
|
2017-08-19 23:39:21 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE extcap_pipe_h;
|
2017-08-25 11:28:34 +02:00
|
|
|
HANDLE extcap_control_in_h;
|
|
|
|
HANDLE extcap_control_out_h;
|
2017-08-19 23:39:21 +02:00
|
|
|
#endif
|
2024-07-07 19:05:04 -04:00
|
|
|
char *extcap_control_in;
|
|
|
|
char *extcap_control_out;
|
2014-10-12 14:56:12 -04:00
|
|
|
int buffer_size;
|
2024-07-07 19:05:04 -04:00
|
|
|
bool monitor_mode;
|
2011-05-16 15:19:54 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
2014-10-12 14:56:12 -04:00
|
|
|
capture_source src_type;
|
2024-07-07 19:05:04 -04:00
|
|
|
char *remote_host;
|
|
|
|
char *remote_port;
|
2014-10-12 14:56:12 -04:00
|
|
|
capture_auth auth_type;
|
2024-07-07 19:05:04 -04:00
|
|
|
char *auth_username;
|
|
|
|
char *auth_password;
|
|
|
|
bool datatx_udp;
|
|
|
|
bool nocap_rpcap;
|
|
|
|
bool nocap_local;
|
2011-05-16 15:19:54 +00:00
|
|
|
#endif
|
2011-05-16 14:12:35 +00:00
|
|
|
#ifdef HAVE_PCAP_SETSAMPLING
|
2014-10-12 14:56:12 -04:00
|
|
|
capture_sampling sampling_method;
|
|
|
|
int sampling_param;
|
2011-05-16 14:12:35 +00:00
|
|
|
#endif
|
2024-07-07 19:05:04 -04:00
|
|
|
char *timestamp_type; /* requested timestamp as string */
|
2017-08-07 16:38:52 +02:00
|
|
|
int timestamp_type_id; /* Timestamp type to pass to pcap_set_tstamp_type.
|
|
|
|
only valid if timestamp_type != NULL */
|
2011-05-12 16:54:16 +00:00
|
|
|
} interface_options;
|
|
|
|
|
2005-12-03 19:32:54 +00:00
|
|
|
/** Capture options coming from user interface */
|
|
|
|
typedef struct capture_options_tag {
|
|
|
|
/* general */
|
2024-07-07 19:05:04 -04:00
|
|
|
GList *(*get_iface_list)(int *, char **);
|
2023-08-27 23:44:14 -07:00
|
|
|
/**< routine to call to get the interface list */
|
2014-10-12 14:56:12 -04:00
|
|
|
GArray *ifaces; /**< the interfaces to use for the
|
|
|
|
next capture, entries are of
|
|
|
|
type interface_options */
|
|
|
|
GArray *all_ifaces; /**< all interfaces, entries are
|
|
|
|
of type interface_t */
|
|
|
|
int ifaces_err; /**< if all_ifaces is null, the error
|
|
|
|
when it was fetched, if any */
|
2024-07-07 19:05:04 -04:00
|
|
|
char *ifaces_err_info; /**< error string for that error */
|
|
|
|
unsigned num_selected;
|
2013-11-26 02:25:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Options to be applied to all interfaces.
|
|
|
|
*
|
|
|
|
* Some of these can be set from the GUI, others can't; setting
|
|
|
|
* the link-layer header type, for example, doesn't necessarily
|
|
|
|
* make sense, as different interfaces may support different sets
|
|
|
|
* of link-layer header types.
|
|
|
|
*
|
|
|
|
* Some that can't be set from the GUI can be set from the command
|
|
|
|
* line, by specifying them before any interface is specified.
|
|
|
|
* This includes the link-layer header type, so if somebody asks
|
|
|
|
* for a link-layer header type that an interface on which they're
|
|
|
|
* capturing doesn't support, we should report an error and fail
|
|
|
|
* to capture.
|
|
|
|
*
|
|
|
|
* These can be overridden per-interface.
|
|
|
|
*/
|
2014-10-12 14:56:12 -04:00
|
|
|
interface_options default_options;
|
2013-11-26 02:25:20 +00:00
|
|
|
|
2024-07-07 19:05:04 -04:00
|
|
|
bool saving_to_file; /**< true if capture is writing to a file */
|
|
|
|
char *save_file; /**< the capture file name */
|
|
|
|
bool group_read_access; /**< true is group read permission needs to be set */
|
|
|
|
bool use_pcapng; /**< true if file format is pcapng */
|
|
|
|
unsigned update_interval; /**< Time in milliseconds. How often to notify parent of new packet counts, check file duration, etc. */
|
2005-12-03 19:32:54 +00:00
|
|
|
|
|
|
|
/* GUI related */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool real_time_mode; /**< Update list of packets in real time */
|
|
|
|
bool show_info; /**< show the info dialog. */
|
|
|
|
bool restart; /**< restart after closing is done */
|
|
|
|
char *orig_save_file; /**< the original capture file name (saved for a restart) */
|
2005-12-03 19:32:54 +00:00
|
|
|
|
|
|
|
/* multiple files (and ringbuffer) */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool multi_files_on; /**< true if ring buffer in use */
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_file_duration; /**< true if ring duration specified */
|
|
|
|
double file_duration; /**< Switch file after n seconds */
|
|
|
|
bool has_file_interval; /**< true if ring interval specified */
|
|
|
|
int32_t file_interval; /**< Create time intervals of n seconds */
|
|
|
|
bool has_file_packets; /**< true if ring packet count is
|
2018-10-31 10:03:04 +01:00
|
|
|
specified */
|
|
|
|
int file_packets; /**< Switch file after n packets */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_ring_num_files; /**< true if ring num_files specified */
|
|
|
|
uint32_t ring_num_files; /**< Number of multiple buffer files */
|
|
|
|
bool has_nametimenum; /**< true if file name has date part before num part */
|
2005-12-03 19:32:54 +00:00
|
|
|
|
|
|
|
/* autostop conditions */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_autostop_files; /**< true if maximum number of capture files
|
2014-10-12 14:56:12 -04:00
|
|
|
are specified */
|
2018-10-31 10:03:04 +01:00
|
|
|
int autostop_files; /**< Maximum number of capture files */
|
2014-10-12 14:56:12 -04:00
|
|
|
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_autostop_packets; /**< true if maximum packet count is
|
2014-10-12 14:56:12 -04:00
|
|
|
specified */
|
|
|
|
int autostop_packets; /**< Maximum packet count */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_autostop_written_packets; /**< true if maximum packet count is
|
2022-02-11 01:54:53 +00:00
|
|
|
specified */
|
|
|
|
int autostop_written_packets; /**< Maximum packet count */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool has_autostop_filesize; /**< true if maximum capture file size
|
2014-10-12 14:56:12 -04:00
|
|
|
is specified */
|
2024-07-07 19:05:04 -04:00
|
|
|
uint32_t autostop_filesize; /**< Maximum capture file size in kB */
|
|
|
|
bool has_autostop_duration; /**< true if maximum capture duration
|
2014-10-12 14:56:12 -04:00
|
|
|
is specified */
|
2024-07-07 19:05:04 -04:00
|
|
|
double autostop_duration; /**< Maximum capture duration */
|
2014-10-12 14:56:12 -04:00
|
|
|
|
2024-07-07 19:05:04 -04:00
|
|
|
bool print_file_names; /**< true if printing names of completed
|
2020-07-29 09:36:19 -04:00
|
|
|
files as we close them */
|
2024-07-07 19:05:04 -04:00
|
|
|
char *print_name_to; /**< output file name */
|
|
|
|
char *temp_dir; /**< temporary directory path */
|
2013-08-29 18:15:13 +00:00
|
|
|
|
2005-12-03 19:32:54 +00:00
|
|
|
/* internally used (don't touch from outside) */
|
2024-07-07 19:05:04 -04:00
|
|
|
bool output_to_pipe; /**< save_file is a pipe (named or stdout) */
|
|
|
|
bool capture_child; /**< hidden option: Wireshark child mode */
|
|
|
|
bool stop_after_extcaps; /**< request dumpcap stop after last extcap */
|
|
|
|
bool wait_for_extcap_cbs; /**< extcaps terminated, waiting for callbacks */
|
|
|
|
char *compress_type; /**< compress type */
|
|
|
|
char *closed_msg; /**< Dumpcap capture closed message */
|
|
|
|
unsigned extcap_terminate_id; /**< extcap process termination source ID */
|
2023-11-07 19:09:01 +00:00
|
|
|
filter_list_t *capture_filters_list; /**< list of saved capture filters */
|
2005-12-03 19:32:54 +00:00
|
|
|
} capture_options;
|
|
|
|
|
2023-08-27 23:44:14 -07:00
|
|
|
/*
|
|
|
|
* Initialize the capture_options with some reasonable values, and
|
|
|
|
* provide a routine it can use to fetch a list of capture options
|
|
|
|
* if it needs it.
|
|
|
|
*
|
|
|
|
* (Getting that list might involve running dumpcap, so we don't want
|
|
|
|
* to waste time doing that if we don't have to.)
|
|
|
|
*/
|
2005-12-03 19:32:54 +00:00
|
|
|
extern void
|
2024-07-07 19:05:04 -04:00
|
|
|
capture_opts_init(capture_options *capture_opts, GList *(*get_iface_list)(int *, char **));
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2017-01-25 10:16:35 +01:00
|
|
|
/* clean internal structures */
|
|
|
|
extern void
|
|
|
|
capture_opts_cleanup(capture_options *capture_opts);
|
|
|
|
|
2005-12-05 21:26:01 +00:00
|
|
|
/* set a command line option value */
|
2006-02-10 02:05:30 +00:00
|
|
|
extern int
|
2021-07-26 17:22:36 +01:00
|
|
|
capture_opts_add_opt(capture_options *capture_opts, int opt, const char *ws_optarg);
|
2005-12-03 19:32:54 +00:00
|
|
|
|
|
|
|
/* log content of capture_opts */
|
|
|
|
extern void
|
2021-06-11 13:39:16 +01:00
|
|
|
capture_opts_log(const char *domain, enum ws_log_level level, capture_options *capture_opts);
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2024-06-06 10:56:10 -04:00
|
|
|
/* List supported file types for capturing. This is intentionally smaller
|
|
|
|
* than the list supported by libwiretap (and dumpcap isn't linked with
|
|
|
|
* libwiretap.) */
|
|
|
|
extern void
|
|
|
|
capture_opts_list_file_types(void);
|
|
|
|
|
2017-08-07 16:38:52 +02:00
|
|
|
enum caps_query {
|
2021-04-13 23:14:09 -07:00
|
|
|
CAPS_QUERY_LINK_TYPES = 0x1,
|
|
|
|
CAPS_QUERY_TIMESTAMP_TYPES = 0x2
|
2017-08-07 16:38:52 +02:00
|
|
|
};
|
|
|
|
|
2010-05-13 17:37:39 +00:00
|
|
|
/* print interface capabilities, including link layer types */
|
2021-04-13 23:14:09 -07:00
|
|
|
extern int
|
|
|
|
capture_opts_print_if_capabilities(if_capabilities_t *caps,
|
2023-12-15 06:18:39 -05:00
|
|
|
const interface_options *interface_opts,
|
2021-04-13 23:14:09 -07:00
|
|
|
int queries);
|
2005-12-13 22:48:58 +00:00
|
|
|
|
2010-05-07 19:24:32 +00:00
|
|
|
/* print list of interfaces */
|
|
|
|
extern void
|
|
|
|
capture_opts_print_interfaces(GList *if_list);
|
2005-12-13 22:48:58 +00:00
|
|
|
|
|
|
|
/* trim the snaplen entry */
|
2007-06-11 03:58:58 +00:00
|
|
|
extern void
|
2005-12-13 22:48:58 +00:00
|
|
|
capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min);
|
|
|
|
|
|
|
|
/* trim the ring_num_files entry */
|
2007-06-11 03:58:58 +00:00
|
|
|
extern void
|
2005-12-13 22:48:58 +00:00
|
|
|
capture_opts_trim_ring_num_files(capture_options *capture_opts);
|
|
|
|
|
2013-05-22 04:49:31 +00:00
|
|
|
/* pick default interface if none was specified */
|
2012-11-21 17:14:54 +00:00
|
|
|
extern int
|
2013-05-22 04:49:31 +00:00
|
|
|
capture_opts_default_iface_if_necessary(capture_options *capture_opts,
|
|
|
|
const char *capture_device);
|
2005-12-03 19:32:54 +00:00
|
|
|
|
2014-07-04 18:18:07 -04:00
|
|
|
extern void
|
2024-07-07 19:05:04 -04:00
|
|
|
capture_opts_del_iface(capture_options *capture_opts, unsigned if_index);
|
2014-07-04 18:18:07 -04:00
|
|
|
|
2023-12-15 06:18:39 -05:00
|
|
|
extern void
|
|
|
|
interface_opts_free(interface_options *interface_opts);
|
|
|
|
|
|
|
|
extern interface_options*
|
|
|
|
interface_opts_from_if_info(capture_options *capture_opts, const if_info_t *if_info);
|
|
|
|
|
2012-01-25 13:04:32 +00:00
|
|
|
extern void
|
|
|
|
collect_ifaces(capture_options *capture_opts);
|
|
|
|
|
iface_lists: Do not reset capture options when refreshing interface list
When rescanning the interface list (e.g. when manually refreshing
or a new device is added or removed), do not destroy old devices
but instead reuse it and preserve the user-set options.
Do check the monitor mode and active dlt setting against the
retrieved values to make sure that they are still supported.
In particular this means that the capture filter is not reset.
For many of the options, the value when creating a new device is
taken from the prefs, and the prefs are updated when the Capture
Options Dialog is closed (monitor mode, promiscuous mode, link layer
type, snapshot length, buffer size), or when the Manage Interfaces
Dialog is closed (hidden, user description), which mostly worked,
unless a refresh occurred when those dialogs were open and changes
had not been saved to prefs.
Fix #16418
2024-01-10 09:38:35 -05:00
|
|
|
extern void
|
2024-07-07 19:05:04 -04:00
|
|
|
capture_opts_free_link_row(void *elem);
|
iface_lists: Do not reset capture options when refreshing interface list
When rescanning the interface list (e.g. when manually refreshing
or a new device is added or removed), do not destroy old devices
but instead reuse it and preserve the user-set options.
Do check the monitor mode and active dlt setting against the
retrieved values to make sure that they are still supported.
In particular this means that the capture filter is not reset.
For many of the options, the value when creating a new device is
taken from the prefs, and the prefs are updated when the Capture
Options Dialog is closed (monitor mode, promiscuous mode, link layer
type, snapshot length, buffer size), or when the Manage Interfaces
Dialog is closed (hidden, user description), which mostly worked,
unless a refresh occurred when those dialogs were open and changes
had not been saved to prefs.
Fix #16418
2024-01-10 09:38:35 -05:00
|
|
|
|
2015-11-26 09:27:51 +01:00
|
|
|
extern void
|
|
|
|
capture_opts_free_interface_t(interface_t *device);
|
|
|
|
|
2013-02-28 15:27:56 +00:00
|
|
|
/* Default capture buffer size in Mbytes. */
|
|
|
|
#define DEFAULT_CAPTURE_BUFFER_SIZE 2
|
|
|
|
|
2023-03-08 22:15:21 -05:00
|
|
|
/* Default update interval in milliseconds */
|
|
|
|
#define DEFAULT_UPDATE_INTERVAL 100
|
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2019-12-13 13:13:32 +01:00
|
|
|
#endif /* __CAPTURE_OPTS_H__ */
|
2014-10-14 15:58:21 -04:00
|
|
|
|
2014-10-12 14:56:12 -04:00
|
|
|
/*
|
2019-07-26 11:43:17 -07:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-10-12 14:56:12 -04:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|