18#ifndef __CAPTURE_OPTS_H__
19#define __CAPTURE_OPTS_H__
47#define LONGOPT_LIST_TSTAMP_TYPES LONGOPT_BASE_CAPTURE+1
48#define LONGOPT_SET_TSTAMP_TYPE LONGOPT_BASE_CAPTURE+2
49#define LONGOPT_COMPRESS_TYPE LONGOPT_BASE_CAPTURE+3
50#define LONGOPT_CAPTURE_TMPDIR LONGOPT_BASE_CAPTURE+4
51#define LONGOPT_UPDATE_INTERVAL LONGOPT_BASE_CAPTURE+5
52#define LONGOPT_NO_OPTIMIZE LONGOPT_BASE_CAPTURE+6
57#ifdef HAVE_PCAP_REMOTE
58#define OPTSTRING_A "A:"
63#define OPTSTRING_B "B:"
65#define OPTSTRING_I "I"
69#define LONGOPT_CAPTURE_COMMON \
70 {"autostop", ws_required_argument, NULL, 'a'}, \
71 {"ring-buffer", ws_required_argument, NULL, 'b'}, \
72 {"buffer-size", ws_required_argument, NULL, 'B'}, \
73 {"list-interfaces", ws_no_argument, NULL, 'D'}, \
74 {"list-sources", ws_no_argument, NULL, 'D'}, \
75 {"interface", ws_required_argument, NULL, 'i'}, \
76 {"source", ws_required_argument, NULL, 'i'}, \
77 {"monitor-mode", ws_no_argument, NULL, 'I'}, \
78 {"list-data-link-types", ws_no_argument, NULL, 'L'}, \
79 {"no-promiscuous-mode", ws_no_argument, NULL, 'p'}, \
80 {"snapshot-length", ws_required_argument, NULL, 's'}, \
81 {"linktype", ws_required_argument, NULL, 'y'}, \
82 {"list-time-stamp-types", ws_no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
83 {"no-optimize", ws_no_argument, NULL, LONGOPT_NO_OPTIMIZE}, \
84 {"time-stamp-type", ws_required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE}, \
85 {"compress-type", ws_required_argument, NULL, LONGOPT_COMPRESS_TYPE}, \
86 {"temp-dir", ws_required_argument, NULL, LONGOPT_CAPTURE_TMPDIR},\
87 {"update-interval", ws_required_argument, NULL, LONGOPT_UPDATE_INTERVAL},
90#define OPTSTRING_CAPTURE_COMMON \
91 "a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:F:i:" OPTSTRING_I "Lps:y:"
93#ifdef HAVE_PCAP_REMOTE
106#ifdef HAVE_PCAP_SETSAMPLING
113 CAPTURE_SAMP_BY_COUNT,
115 CAPTURE_SAMP_BY_TIMER
121#ifdef HAVE_PCAP_REMOTE
122struct remote_host_info {
125 capture_auth auth_type;
136 capture_auth auth_type;
141typedef struct remote_options_tag {
142 capture_source src_type;
143 struct remote_host_info remote_host_opts;
144#ifdef HAVE_PCAP_SETSAMPLING
145 capture_sampling sampling_method;
165 bool monitor_mode_enabled;
166 bool monitor_mode_supported;
167#ifdef HAVE_PCAP_REMOTE
168 remote_options remote_opts;
170 uint32_t last_packets;
171 uint32_t packet_diff;
176 GHashTable *external_cap_args_settings;
177 char *timestamp_type;
197 interface_type if_type;
200 GHashTable *extcap_args;
202 void * extcap_pipedata;
203 GString *extcap_stderr;
204 unsigned extcap_stdout_watch;
205 unsigned extcap_stderr_watch;
207 HANDLE extcap_pipe_h;
208 HANDLE extcap_control_in_h;
209 HANDLE extcap_control_out_h;
211 char *extcap_control_in;
212 char *extcap_control_out;
215#ifdef HAVE_PCAP_REMOTE
216 capture_source src_type;
219 capture_auth auth_type;
226#ifdef HAVE_PCAP_SETSAMPLING
227 capture_sampling sampling_method;
230 char *timestamp_type;
231 int timestamp_type_id;
238 GList *(*get_iface_list)(
int *,
char **);
248 unsigned num_selected;
339capture_opts_init(
capture_options *capture_opts,
const char* app_name, GList *(*get_iface_list)(
int *,
char **));
385 CAPS_QUERY_LINK_TYPES = 0x1,
386 CAPS_QUERY_TIMESTAMP_TYPES = 0x2
439 const char *capture_device);
491#define DEFAULT_CAPTURE_BUFFER_SIZE 2
int capture_opts_add_opt(const char *app_env_var_prefix, capture_options *capture_opts, int opt, const char *ws_optarg)
Set a command line option value.
void collect_ifaces(capture_options *capture_opts)
Collects network interfaces based on the provided capture options.
int capture_opts_print_if_capabilities(if_capabilities_t *caps, const interface_options *interface_opts, int queries)
Prints the capabilities of a network interface.
void capture_opts_log(const char *domain, enum ws_log_level level, capture_options *capture_opts)
Log the content of capture_opts.
interface_options * interface_opts_from_if_info(capture_options *capture_opts, const if_info_t *if_info)
Collects network interfaces based on the provided capture options.
void capture_opts_trim_ring_num_files(capture_options *capture_opts)
Trims the number of ring buffer files to a valid range.
void capture_opts_list_file_types(void)
Lists available file types for capture options.
struct capture_options_tag capture_options
int capture_opts_default_iface_if_necessary(capture_options *capture_opts, const char *capture_device)
Set the default capture interface if necessary.
void capture_opts_free_interface_t(interface_t *device)
Frees an interface_t element.
void capture_opts_cleanup(capture_options *capture_opts)
Clean up capture options.
void capture_opts_del_iface(capture_options *capture_opts, unsigned if_index)
Deletes an interface from the capture options.
void capture_opts_free_link_row(void *elem)
Frees a link row element.
void interface_opts_free(interface_options *interface_opts)
Free memory allocated for interface options.
void capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min)
Trims the snapshot length of a capture options structure to ensure it meets a minimum value.
void capture_opts_print_interfaces(GList *if_list)
Prints a list of available network interfaces.
Definition mcast_stream.h:30
Definition capture_opts.h:236
bool saving_to_file
Definition capture_opts.h:270
bool stop_after_extcaps
Definition capture_opts.h:322
bool group_read_access
Definition capture_opts.h:272
int32_t file_interval
Definition capture_opts.h:288
bool has_file_interval
Definition capture_opts.h:287
bool multi_files_on
Definition capture_opts.h:283
bool real_time_mode
Definition capture_opts.h:277
bool restart
Definition capture_opts.h:279
double autostop_duration
Definition capture_opts.h:312
int ifaces_err
Definition capture_opts.h:245
bool has_file_duration
Definition capture_opts.h:285
bool has_autostop_files
Definition capture_opts.h:297
bool show_info
Definition capture_opts.h:278
bool has_autostop_filesize
Definition capture_opts.h:307
char * orig_save_file
Definition capture_opts.h:280
char * print_name_to
Definition capture_opts.h:316
GArray * ifaces
Definition capture_opts.h:240
bool has_autostop_duration
Definition capture_opts.h:310
bool use_pcapng
Definition capture_opts.h:273
GArray * all_ifaces
Definition capture_opts.h:243
bool wait_for_extcap_cbs
Definition capture_opts.h:323
int autostop_packets
Definition capture_opts.h:303
int autostop_files
Definition capture_opts.h:299
char * closed_msg
Definition capture_opts.h:325
bool has_autostop_packets
Definition capture_opts.h:301
bool capture_child
Definition capture_opts.h:321
bool has_nametimenum
Definition capture_opts.h:294
bool has_autostop_written_packets
Definition capture_opts.h:304
bool print_file_names
Definition capture_opts.h:314
bool has_file_packets
Definition capture_opts.h:289
unsigned update_interval
Definition capture_opts.h:274
unsigned extcap_terminate_id
Definition capture_opts.h:326
char * temp_dir
Definition capture_opts.h:317
bool output_to_pipe
Definition capture_opts.h:320
filter_list_t * capture_filters_list
Definition capture_opts.h:327
uint32_t ring_num_files
Definition capture_opts.h:293
int file_packets
Definition capture_opts.h:291
char * compress_type
Definition capture_opts.h:324
int autostop_written_packets
Definition capture_opts.h:306
uint32_t autostop_filesize
Definition capture_opts.h:309
bool has_ring_num_files
Definition capture_opts.h:292
char * ifaces_err_info
Definition capture_opts.h:247
char * save_file
Definition capture_opts.h:271
double file_duration
Definition capture_opts.h:286
const char * app_name
Definition capture_opts.h:249
Represents a list of filters of a specific type.
Definition filter_files.h:65
Definition capture_ifinfo.h:45
Definition capture_ifinfo.h:59
Definition capture_opts.h:185
Definition androiddump.c:219
Definition capture_opts.h:151
Definition capture_opts.h:180