Commit 08d67854 authored by Michael Tüxen's avatar Michael Tüxen

Second try. This time pipes and stdin are supported.

Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.


svn path=/trunk/; revision=40693
parent 73cefbad
This diff is collapsed.
......@@ -114,7 +114,7 @@ typedef struct if_stat_cache_s if_stat_cache_t;
* @param if_list A GList of if_info_t items
* @return A pointer to the statistics state data.
*/
extern if_stat_cache_t * capture_stat_start(GList *if_list);
extern if_stat_cache_t * capture_stat_start(capture_options *capture_opts);
/**
* Fetch capture statistics, similar to pcap_stats().
......
This diff is collapsed.
......@@ -77,6 +77,73 @@ 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 {
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 */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
};
typedef struct remote_options_tag {
capture_source src_type;
struct remote_host remote_host_opts;
#ifdef HAVE_PCAP_SETSAMPLING
capture_sampling sampling_method;
int sampling_param;
#endif
} remote_options;
#endif /* HAVE_PCAP_REMOTE */
typedef struct interface_tag {
gchar *name;
gchar *display_name;
guint type;
gchar *addresses;
gint no_addresses;
gchar *cfilter;
GList *links;
gint active_dlt;
gboolean pmode;
gboolean has_snaplen;
guint snaplen;
gboolean local;
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
gint buffer;
gboolean monitor_mode_enabled;
gboolean monitor_mode_supported;
#endif
#ifdef HAVE_PCAP_REMOTE
remote_options remote_opts;
#endif
guint32 last_packets;
if_info_t if_info;
gboolean selected;
gboolean hidden;
gboolean locked;
} interface_t;
typedef struct link_row_tag {
gchar *name;
gint dlt;
} link_row;
typedef struct interface_options_tag {
gchar *name;
gchar *descr;
......@@ -112,6 +179,8 @@ typedef struct capture_options_tag {
void *cf; /**< handle to cfile (note: untyped handle) */
GArray *ifaces; /**< array of interfaces.
Currently only used by dumpcap. */
GArray *all_ifaces;
guint num_selected;
interface_options default_options;
gboolean saving_to_file; /**< TRUE if capture is writing to a file */
gchar *save_file; /**< the capture file name */
......@@ -194,6 +263,27 @@ capture_opts_trim_ring_num_files(capture_options *capture_opts);
extern gboolean
capture_opts_trim_iface(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);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -463,9 +463,11 @@ sync_pipe_start(capture_options *capture_opts) {
}
#endif
#ifdef HAVE_PCAP_CREATE
if (interface_opts.monitor_mode) {
argv = sync_pipe_add_arg(argv, &argc, "-I");
}
#endif
#ifdef HAVE_PCAP_REMOTE
if (interface_opts.datatx_udp)
......
......@@ -38,6 +38,9 @@
#include "epan/ex-opt.h"
#include "capture_ifinfo.h"
#include "capture_ui_utils.h"
#include "ui/simple_dialog.h"
#include "wiretap/wtap.h"
#include "epan/to_str.h"
/*
* Find user-specified capture device description that matches interface
......
......@@ -95,6 +95,7 @@
#endif /* HAVE_LIBPCAP */
#include "log.h"
#include <epan/funnel.h>
#include "capture_opts.h"
/*
* This is the template for the decode as option; it is shared between the
......
This diff is collapsed.
......@@ -32,60 +32,12 @@
* @ingroup dialog_group
*/
#include "capture_opts.h"
#ifdef HAVE_PCAP_REMOTE
struct remote_host {
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 */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
};
typedef struct remote_options_tag {
capture_source src_type;
struct remote_host remote_host_opts;
#ifdef HAVE_PCAP_SETSAMPLING
capture_sampling sampling_method;
int sampling_param;
#endif
} remote_options;
#endif /* HAVE_PCAP_REMOTE */
typedef struct row_options_tag {
gchar *name;
gchar *display_name;
gchar *addresses;
gint no_addresses;
gchar *cfilter;
GList *links;
gint active_dlt;
gboolean pmode;
#ifdef HAVE_PCAP_CREATE
gboolean monitor_mode_enabled;
gboolean monitor_mode_supported;
#endif
gboolean has_snaplen;
guint snaplen;
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
gint buffer;
#endif
#ifdef HAVE_PCAP_REMOTE
remote_options remote_opts;
#endif
} interface_row;
typedef struct link_row_tag {
gchar *name;
gint dlt;
} link_row;
#include <gtk/gtk.h>
enum
{
CAPTURE = 0,
IFACE_HIDDEN_NAME,
INTERFACE,
LINK,
PMODE,
......@@ -143,6 +95,7 @@ void capture_start_confirmed(void);
void
capture_air_cb(GtkWidget *widget, gpointer data);
#if 0
/*
* We remember the capture settings for each interface when a capture
* is started on it; the next time we select that interface we start
......@@ -163,6 +116,7 @@ typedef struct {
*/
cap_settings_t
capture_get_cap_settings (gchar *if_name);
#endif
GtkTreeModel*
create_and_fill_model (GtkTreeView *view);
......@@ -183,9 +137,12 @@ gboolean
dlg_window_present(void);
void
enable_selected_interface(gchar *name, gboolean enable);
enable_selected_interface(gchar *name, gboolean selected);
void
options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column _U_, gpointer userdata);
void
update_all_rows(void);
#endif /* capture_dlg.h */
This diff is collapsed.
......@@ -48,10 +48,10 @@ capture_if_cb(GtkWidget *widget, gpointer data);
* Used to retrieve the interface icon
*/
GtkWidget *
capture_get_if_icon(const if_info_t* if_info);
capture_get_if_icon(interface_t *device);
void
update_selected_interface(gchar *name, gboolean activate);
update_selected_interface(gchar *name);
gboolean
interfaces_dialog_window_present(void);
......@@ -65,6 +65,9 @@ select_all_interfaces(gboolean enable);
void
destroy_if_window(void);
gint
if_list_comparator_alph (const void *first_arg, const void *second_arg);
#endif /* HAVE_LIBPCAP */
#endif /* capture_if_dlg.h */
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#define __MAIN_H__
#include "globals.h"
#include "capture_opts.h"
/** @defgroup main_window_group Main window
* The main window has the following submodules:
......@@ -332,10 +333,10 @@ extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
#ifdef _WIN32
/** Win32 only: Create a console. Beware: cannot be closed again. */
extern void create_console(void);
#endif
/** Restart the tap update display timer with new configured interval */
extern void reset_tap_update_timer(void);
#endif
/** Fill in capture options with values from the preferences */
extern void prefs_to_capture_opts(void);
......@@ -351,4 +352,7 @@ extern GList *get_ip_address_list_from_packet_list_row(gpointer data);
extern GtkWidget *pkt_scrollw;
void hide_interface(gchar* new_hide);
#endif /* __MAIN_H__ */
This diff is collapsed.
......@@ -40,15 +40,6 @@ typedef struct selected_name_s {
gboolean activate;
} selected_name_t;
typedef struct displayed_interface_s {
gchar *name;
gchar *descr;
GtkWidget *icon;
#ifdef HAVE_PCAP_REMOTE
remote_options remote_opts;
#endif
} displayed_interface;
GtkWidget *welcome_new(void);
/* reset the list of recently used files */
......@@ -60,6 +51,8 @@ void main_welcome_add_recent_capture_file(const char *widget_cf_name, GObject *m
/* reload the list of interfaces */
void welcome_if_panel_reload(void);
void welcome_if_tree_load(void);
/** Push a status message into the welcome screen header similar to
* statusbar_push_*_msg(). This hides everything under the header.
* If msg is dynamically allocated, it is up to the caller to free
......@@ -85,10 +78,10 @@ void change_interface_selection(gchar* name, gboolean activate);
void change_selection_for_all(gboolean enable);
void update_welcome_list(void);
#ifdef HAVE_PCAP_REMOTE
void add_interface_to_list(gchar *name, gchar *descr, remote_options *remote_opts);
void add_interface_to_list(guint index);
#endif
displayed_interface get_interface_data(gint index);
#endif /* __MAIN_WELCOME_H__ */
......@@ -1424,6 +1424,7 @@ ifopts_write_new_hide(void)
g_free(new_hide);
prefs.capture_devices_hide = NULL;
}
hide_interface(g_strdup(new_hide));
}
}
......
......@@ -124,7 +124,9 @@ stats_prefs_fetch(GtkWidget *w _U_)
void
stats_prefs_apply(GtkWidget *w _U_)
{
#if defined(_WIN32)
reset_tap_update_timer();
#endif
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment