More constification.
[metze/wireshark/wip.git] / capture_opts.h
index c3805d1a93dc8e3d791aed6e77847e98607c9f12..7d966bc559a8cc4d585b3c22b7a79d9811b1de62 100644 (file)
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
 extern "C" {
 #endif /* __cplusplus */
 
-/* Current state of capture engine. XXX - differentiate states */
-typedef enum {
-    CAPTURE_STOPPED,        /**< stopped */
-    CAPTURE_PREPARING,      /**< preparing, but still no response from capture child */
-    CAPTURE_RUNNING         /**< capture child signalled ok, capture is running now */
-} capture_state;
-
 #ifdef HAVE_PCAP_REMOTE
 /* Type of capture source */
 typedef enum {
@@ -77,20 +70,8 @@ typedef enum {
 } capture_sampling;
 #endif
 
-typedef enum {
-    IF_WIRED,
-    IF_AIRPCAP,
-    IF_PIPE,
-    IF_STDIN,
-    IF_BLUETOOTH,
-    IF_WIRELESS,
-    IF_DIALUP,
-    IF_USB,
-    IF_VIRTUAL
-} interface_type;
-
 #ifdef HAVE_PCAP_REMOTE
-struct remote_host {
+struct remote_host_info {
     gchar *remote_host;          /**< Host name or network address for remote capturing */
     gchar *remote_port;          /**< TCP port of remote RPCAP server */
     gint auth_type;              /**< Authentication type */
@@ -103,7 +84,7 @@ struct remote_host {
 
 typedef struct remote_options_tag {
     capture_source src_type;
-    struct remote_host remote_host_opts;
+    struct remote_host_info remote_host_opts;
 #ifdef HAVE_PCAP_SETSAMPLING
     capture_sampling sampling_method;
     int sampling_param;
@@ -114,6 +95,7 @@ typedef struct remote_options_tag {
 typedef struct interface_tag {
     gchar *name;
     gchar *display_name;
+    gchar *friendly_name;
     guint type;
     gchar *addresses;
     gint no_addresses;
@@ -126,6 +108,8 @@ typedef struct interface_tag {
     gboolean local;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     gint buffer;
+#endif
+#ifdef HAVE_PCAP_CREATE
     gboolean monitor_mode_enabled;
     gboolean monitor_mode_supported;
 #endif
@@ -145,8 +129,9 @@ typedef struct link_row_tag {
 } link_row;
 
 typedef struct interface_options_tag {
-    gchar *name;
+    gchar *name; /* the name of the interface provided to winpcap/libpcap to specify the interface */
     gchar *descr;
+    gchar *console_display_name; /* the name displayed in the console, also the basis for autonamed pcap filenames */
     gchar *cfilter;
     gboolean has_snaplen;
     int snaplen;
@@ -176,7 +161,6 @@ typedef struct interface_options_tag {
 /** Capture options coming from user interface */
 typedef struct capture_options_tag {
     /* general */
-    void     *cf;                   /**< handle to cfile (note: untyped handle) */
     GArray   *ifaces;               /**< array of interfaces.
                                          Currently only used by dumpcap. */
     GArray   *all_ifaces;
@@ -217,22 +201,12 @@ typedef struct capture_options_tag {
     gint32 autostop_duration;       /**< Maximum capture duration */
 
     /* internally used (don't touch from outside) */
-    int fork_child;                 /**< If not -1, in parent, process ID of child */
-    int fork_child_status;          /**< Child exit status */
-#ifdef _WIN32
-    int signal_pipe_write_fd;       /**< the pipe to signal the child */
-#endif
-    capture_state state;            /**< current state of the capture engine */
     gboolean output_to_pipe;        /**< save_file is a pipe (named or stdout) */
-#ifndef _WIN32
-    uid_t owner;                    /**< owner of the cfile */
-    gid_t group;                    /**< group of the cfile */
-#endif
 } capture_options;
 
 /* initialize the capture_options with some reasonable values */
 extern void
-capture_opts_init(capture_options *capture_opts, void *cf);
+capture_opts_init(capture_options *capture_opts);
 
 /* set a command line option value */
 extern int
@@ -259,30 +233,16 @@ capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min);
 extern void
 capture_opts_trim_ring_num_files(capture_options *capture_opts);
 
-/* trim the interface entry */
-extern gboolean
-capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device);
+/* pick default interface if none was specified */
+extern int
+capture_opts_default_iface_if_necessary(capture_options *capture_opts,
+                                        const char *capture_device);
 
 extern void
 collect_ifaces(capture_options *capture_opts);
 
-typedef struct {
-    gboolean monitor_mode;
-    int linktype;
-} cap_settings_t;
-
-/** Get capture settings for interface
- *
- * @param if_name interface name
- */
-cap_settings_t
-capture_get_cap_settings (gchar *if_name);
-
-extern void 
-scan_local_interfaces(capture_options* capture_opts, int *error);
-
-int
-capture_opts_select_iface(capture_options *capture_opts, const char *optarg_str_p);
+/* Default capture buffer size in Mbytes. */
+#define DEFAULT_CAPTURE_BUFFER_SIZE 2
 
 #ifdef __cplusplus
 }