2 * Capture options (all parameters needed to do the actual capture)
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 * Capture options (all parameters needed to do the actual capture)
32 #ifndef __CAPTURE_OPTS_H__
33 #define __CAPTURE_OPTS_H__
36 /* Current state of capture engine. XXX - differentiate states */
38 CAPTURE_STOPPED, /**< stopped */
39 CAPTURE_PREPARING, /**< preparing, but still no response from capture child */
40 CAPTURE_RUNNING /**< capture child signalled ok, capture is running now */
44 /** Capture options coming from user interface */
45 typedef struct capture_options_tag {
47 void *cf; /**< handle to cfile (note: untyped handle) */
48 gchar *cfilter; /**< Capture filter string */
49 gchar *iface; /**< the network interface to capture from */
52 int buffer_size; /**< the capture buffer size (MB) */
54 gboolean has_snaplen; /**< TRUE if maximum capture packet length
56 int snaplen; /**< Maximum captured packet length */
57 gboolean promisc_mode; /**< Capture in promiscuous mode */
58 int linktype; /**< Data link type to use, or -1 for
60 gchar *save_file; /**< the capture file name */
63 gboolean real_time_mode; /**< Update list of packets in real time */
64 gboolean show_info; /**< show the info dialog */
65 gboolean quit_after_cap; /** Makes a "capture only mode". Implies -k */
66 gboolean restart; /**< restart after closing is done */
68 /* multiple files (and ringbuffer) */
69 gboolean multi_files_on; /**< TRUE if ring buffer in use */
71 gboolean has_file_duration; /**< TRUE if ring duration specified */
72 gint32 file_duration; /* Switch file after n seconds */
73 gboolean has_ring_num_files;/**< TRUE if ring num_files specified */
74 guint32 ring_num_files; /**< Number of multiple buffer files */
76 /* autostop conditions */
77 gboolean has_autostop_files;/**< TRUE if maximum number of capture files
79 gint32 autostop_files; /**< Maximum number of capture files */
81 gboolean has_autostop_packets; /**< TRUE if maximum packet count is
83 int autostop_packets; /**< Maximum packet count */
84 gboolean has_autostop_filesize; /**< TRUE if maximum capture file size
86 gint32 autostop_filesize; /**< Maximum capture file size */
87 gboolean has_autostop_duration; /**< TRUE if maximum capture duration
89 gint32 autostop_duration; /**< Maximum capture duration */
91 /* internally used (don't touch from outside) */
92 int fork_child; /**< If not -1, in parent, process ID of child */
94 int signal_pipe_fd; /**< the pipe to signal the child */
96 capture_state state; /**< current state of the capture engine */
100 /* initialize the capture_options with some reasonable values */
102 capture_opts_init(capture_options *capture_opts, void *cfile);
104 /* set a command line option value */
106 capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, gboolean *start_capture);
108 /* log content of capture_opts */
110 capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_options *capture_opts);
112 /* list link layer types */
114 capture_opts_list_link_layer_types(capture_options *capture_opts);
116 /* list interfaces */
118 capture_opts_list_interfaces(void);
120 /* trim the snaplen entry */
122 capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min);
124 /* trim the ring_num_files entry */
126 capture_opts_trim_ring_num_files(capture_options *capture_opts);
128 /* trim the interface entry */
130 capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device);
132 #endif /* capture_opts.h */