Change the use of threads from "mostly always, depending on your
configure options and Gtk+ and GLib versions" to "always". svn path=/trunk/; revision=39751
This commit is contained in:
parent
60247a582b
commit
7d442f4c22
|
@ -227,9 +227,10 @@ endif()
|
|||
# - set HAVE_XXX
|
||||
|
||||
#The minimum package list
|
||||
set(PACKAGELIST GLIB2 GMODULE2 M LEX YACC Perl SH PythonInterp)
|
||||
set(PACKAGELIST GLIB2 GMODULE2 GTHREAD2 M LEX YACC Perl SH PythonInterp)
|
||||
set(GLIB2_FIND_REQUIRED)
|
||||
set(GLIB2_MIN_VERSION 2.14.0)
|
||||
set(GTHREAD2_REQUIRED)
|
||||
set(PCAP_REQUIRED)
|
||||
set(M_REQUIRED)
|
||||
|
||||
|
@ -249,14 +250,6 @@ if(BUILD_wireshark)
|
|||
set(GTK2_FIND_VERSION 2.12)
|
||||
set(GTK2_DEBUG false)
|
||||
endif()
|
||||
if(ENABLE_THREADS)
|
||||
set(PACKAGELIST ${PACKAGELIST} GTHREAD2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_dumpcap)
|
||||
set(PACKAGELIST ${PACKAGELIST} GTHREAD2)
|
||||
set(GHTREAD2_REQUIRED)
|
||||
endif()
|
||||
|
||||
# SMI SNMP
|
||||
|
|
|
@ -31,7 +31,6 @@ option(ENABLE_STATIC "Build a static version of Wireshark (not yet working)"
|
|||
option(ENABLE_PLUGINS "Build with plugins" ON)
|
||||
option(ENABLE_GUIDES "Build Guides" OFF)
|
||||
option(ENABLE_PCAP_NG_DEFAULT "Enable pcap-ng as default file format" ON)
|
||||
option(ENABLE_THREADS "Build with threads support" ON)
|
||||
|
||||
option(ENABLE_ADNS "Build with adns support" ON)
|
||||
option(ENABLE_PORTAUDIO "Build with portaudio support" ON)
|
||||
|
@ -46,4 +45,3 @@ option(ENABLE_CAP "Build with posix capabilities support" ON)
|
|||
option(ENABLE_CARES "Build with c_ares support" ON)
|
||||
# todo Mostly hardcoded
|
||||
option(ENABLE_KERBEROS "Build with Kerberos support" ON)
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
/* Directory where plugins reside */
|
||||
#define PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}"
|
||||
|
||||
/* Define to 1 if we want to use threads in wireshark and dumpcap */
|
||||
#cmakedefine USE_THREADS 1
|
||||
|
||||
/* Define to 1 if we want to use pcap-ng as our default file format */
|
||||
#cmakedefine PCAP_NG_DEFAULT 1
|
||||
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
#define UNICODE 1
|
||||
#define _UNICODE 1
|
||||
|
||||
/* Use threads */
|
||||
#define USE_THREADS 1
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
|
|
|
@ -746,14 +746,6 @@ if test x$enable_packet_editor = xyes; then
|
|||
AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(threads,
|
||||
AC_HELP_STRING( [--enable-threads],
|
||||
[use threads in Wireshark @<:@default=yes@:>@]),
|
||||
enable_threads=$enableval,enable_threads=yes)
|
||||
if test x$enable_threads = xyes; then
|
||||
AC_DEFINE(USE_THREADS, 1, [Support for threads])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(profile-build,
|
||||
AC_HELP_STRING( [--enable-profile-build],
|
||||
[build profile-ready binaries @<:@default=no@:>@]),
|
||||
|
@ -2140,7 +2132,6 @@ echo " Use plugins : $have_plugins"
|
|||
echo " Use Lua library : $lua_message"
|
||||
echo " Use Python binding : $python_message"
|
||||
echo " Build rtp_player : $portaudio_message"
|
||||
echo " Use threads : $enable_threads"
|
||||
echo " Build profile binaries : $enable_profile_build"
|
||||
echo " Use pcap library : $want_pcap"
|
||||
echo " Use zlib library : $zlib_message"
|
||||
|
|
52
dumpcap.c
52
dumpcap.c
|
@ -235,7 +235,7 @@ typedef struct _pcap_options {
|
|||
#endif
|
||||
gboolean cap_pipe_modified; /* TRUE if data in the pipe uses modified pcap headers */
|
||||
gboolean cap_pipe_byte_swapped; /* TRUE if data in the pipe is byte swapped */
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
char * cap_pipe_buf; /* Pointer to the data buffer we read into */
|
||||
#endif
|
||||
int cap_pipe_bytes_to_read;/* Used by cap_pipe_dispatch */
|
||||
|
@ -247,7 +247,7 @@ typedef struct _pcap_options {
|
|||
STATE_READ_DATA
|
||||
} cap_pipe_state;
|
||||
enum { PIPOK, PIPEOF, PIPERR, PIPNEXIST } cap_pipe_err;
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
GMutex *cap_pipe_read_mtx;
|
||||
GAsyncQueue *cap_pipe_pending_q, *cap_pipe_done_q;
|
||||
#endif
|
||||
|
@ -318,7 +318,7 @@ static gboolean need_timeout_workaround;
|
|||
* WaitForSingleObject. If it's less than 1000 WaitForSingleObject
|
||||
* will return immediately.
|
||||
*/
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
#define PIPE_READ_TIMEOUT 100000
|
||||
#else
|
||||
#define PIPE_READ_TIMEOUT 250000
|
||||
|
@ -415,9 +415,7 @@ print_usage(gboolean print_ver)
|
|||
fprintf(output, " -n use pcapng format instead of pcap\n");
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, "Miscellaneous:\n");
|
||||
#ifdef USE_THREADS
|
||||
fprintf(output, " -t use a separate thread per interface\n");
|
||||
#endif
|
||||
fprintf(output, " -q don't report packet capture counts\n");
|
||||
fprintf(output, " -v print version information and exit\n");
|
||||
fprintf(output, " -h display this help and exit\n");
|
||||
|
@ -1547,7 +1545,7 @@ cap_pipe_adjust_header(gboolean byte_swapped, struct pcap_hdr *hdr, struct pcapr
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* Thread function that reads from a pipe and pushes the data
|
||||
* to the main application thread.
|
||||
|
@ -1635,7 +1633,7 @@ static void *cap_pipe_read(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (!(defined(USE_THREADS) && defined(_WIN32))) || defined(MUST_DO_SELECT)
|
||||
#if !defined(_WIN32) || defined(MUST_DO_SELECT)
|
||||
/* Provide select() functionality for a single file descriptor
|
||||
* on UNIX/POSIX. Windows uses cap_pipe_read via a thread.
|
||||
*
|
||||
|
@ -1682,7 +1680,7 @@ cap_pipe_open_live(char *pipename,
|
|||
wchar_t *err_str;
|
||||
#endif
|
||||
#endif
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
int sel_ret;
|
||||
unsigned int bytes_read;
|
||||
#endif
|
||||
|
@ -1851,7 +1849,7 @@ cap_pipe_open_live(char *pipename,
|
|||
|
||||
pcap_opts->from_cap_pipe = TRUE;
|
||||
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
/* read the pcap header */
|
||||
bytes_read = 0;
|
||||
while (bytes_read < sizeof magic) {
|
||||
|
@ -1926,7 +1924,7 @@ cap_pipe_open_live(char *pipename,
|
|||
goto error;
|
||||
}
|
||||
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
/* Read the rest of the header */
|
||||
bytes_read = 0;
|
||||
while (bytes_read < sizeof(struct pcap_hdr)) {
|
||||
|
@ -2006,7 +2004,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
struct pcap_pkthdr phdr;
|
||||
enum { PD_REC_HDR_READ, PD_DATA_READ, PD_PIPE_EOF, PD_PIPE_ERR,
|
||||
PD_ERR } result;
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
GTimeVal wait_time;
|
||||
gpointer q_status;
|
||||
#else
|
||||
|
@ -2023,7 +2021,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
switch (pcap_opts->cap_pipe_state) {
|
||||
|
||||
case STATE_EXPECT_REC_HDR:
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
||||
#endif
|
||||
|
||||
|
@ -2032,7 +2030,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
sizeof(struct pcaprec_modified_hdr) : sizeof(struct pcaprec_hdr);
|
||||
pcap_opts->cap_pipe_bytes_read = 0;
|
||||
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
pcap_opts->cap_pipe_buf = (char *) &pcap_opts->cap_pipe_rechdr;
|
||||
g_async_queue_push(pcap_opts->cap_pipe_pending_q, pcap_opts->cap_pipe_buf);
|
||||
g_mutex_unlock(pcap_opts->cap_pipe_read_mtx);
|
||||
|
@ -2041,7 +2039,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
/* Fall through */
|
||||
|
||||
case STATE_READ_REC_HDR:
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
b = read(pcap_opts->cap_pipe_fd, ((char *)&pcap_opts->cap_pipe_rechdr)+pcap_opts->cap_pipe_bytes_read,
|
||||
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read);
|
||||
if (b <= 0) {
|
||||
|
@ -2073,7 +2071,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
break;
|
||||
|
||||
case STATE_EXPECT_DATA:
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
||||
#endif
|
||||
|
||||
|
@ -2081,7 +2079,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
pcap_opts->cap_pipe_bytes_to_read = pcap_opts->cap_pipe_rechdr.hdr.incl_len;
|
||||
pcap_opts->cap_pipe_bytes_read = 0;
|
||||
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
pcap_opts->cap_pipe_buf = (char *) data;
|
||||
g_async_queue_push(pcap_opts->cap_pipe_pending_q, pcap_opts->cap_pipe_buf);
|
||||
g_mutex_unlock(pcap_opts->cap_pipe_read_mtx);
|
||||
|
@ -2090,7 +2088,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
|||
/* Fall through */
|
||||
|
||||
case STATE_READ_DATA:
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
b = read(pcap_opts->cap_pipe_fd, data+pcap_opts->cap_pipe_bytes_read,
|
||||
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read);
|
||||
if (b <= 0) {
|
||||
|
@ -2292,14 +2290,14 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
|||
#endif
|
||||
pcap_opts->cap_pipe_modified = FALSE;
|
||||
pcap_opts->cap_pipe_byte_swapped = FALSE;
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
pcap_opts->cap_pipe_buf = NULL;
|
||||
#endif
|
||||
pcap_opts->cap_pipe_bytes_to_read = 0;
|
||||
pcap_opts->cap_pipe_bytes_read = 0;
|
||||
pcap_opts->cap_pipe_state = 0;
|
||||
pcap_opts->cap_pipe_err = PIPOK;
|
||||
#if defined(USE_THREADS) && defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
pcap_opts->cap_pipe_read_mtx = g_mutex_new();
|
||||
pcap_opts->cap_pipe_pending_q = g_async_queue_new();
|
||||
pcap_opts->cap_pipe_done_q = g_async_queue_new();
|
||||
|
@ -2636,7 +2634,7 @@ capture_loop_dispatch(loop_data *ld,
|
|||
int inpkts;
|
||||
gint packet_count_before;
|
||||
guchar pcap_data[WTAP_MAX_PACKET_SIZE];
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
int sel_ret;
|
||||
#endif
|
||||
|
||||
|
@ -2646,7 +2644,7 @@ capture_loop_dispatch(loop_data *ld,
|
|||
#ifdef LOG_CAPTURE_VERBOSE
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_dispatch: from capture pipe");
|
||||
#endif
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
sel_ret = cap_pipe_select(pcap_opts->cap_pipe_fd);
|
||||
if (sel_ret <= 0) {
|
||||
if (sel_ret < 0 && errno != EINTR) {
|
||||
|
@ -2664,7 +2662,7 @@ capture_loop_dispatch(loop_data *ld,
|
|||
if (inpkts < 0) {
|
||||
ld->go = FALSE;
|
||||
}
|
||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
||||
#ifndef _WIN32
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3856,10 +3854,8 @@ main(int argc, char *argv[])
|
|||
global_ld.pcaps = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
|
||||
|
||||
/* Initialize the thread system */
|
||||
#ifdef USE_THREADS
|
||||
if (!g_thread_supported())
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
g_thread_init(NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Load wpcap if possible. Do this before collecting the run-time version information */
|
||||
load_wpcap();
|
||||
|
@ -4076,11 +4072,9 @@ main(int argc, char *argv[])
|
|||
case 'q': /* Quiet */
|
||||
quiet = TRUE;
|
||||
break;
|
||||
#ifdef USE_THREADS
|
||||
case 't':
|
||||
use_threads = TRUE;
|
||||
break;
|
||||
#endif
|
||||
/*** all non capture option specific ***/
|
||||
case 'D': /* Print a list of capture devices and exit */
|
||||
list_interfaces = TRUE;
|
||||
|
@ -4148,12 +4142,10 @@ main(int argc, char *argv[])
|
|||
} else {
|
||||
/* We're supposed to capture traffic; */
|
||||
/* Are we capturing on multiple interface? If so, use threads and pcapng. */
|
||||
#ifdef USE_THREADS
|
||||
if (global_capture_opts.ifaces->len > 1) {
|
||||
use_threads = TRUE;
|
||||
global_capture_opts.use_pcapng = TRUE;
|
||||
}
|
||||
#endif
|
||||
/* Was the ring buffer option specified and, if so, does it make sense? */
|
||||
if (global_capture_opts.multi_files_on) {
|
||||
/* Ring buffer works only under certain conditions:
|
||||
|
|
10
epan/prefs.c
10
epan/prefs.c
|
@ -2410,9 +2410,6 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_,
|
|||
} else if (strcmp(pref_name, PRS_CAP_SHOW_INFO) == 0) {
|
||||
prefs.capture_show_info = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||
} else if (strcmp(pref_name, PRS_CAP_SYNTAX_CHECK_FILTER) == 0) {
|
||||
#ifndef USE_THREADS
|
||||
prefs.capture_syntax_check_filter = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||
#endif
|
||||
/* handle the global options */
|
||||
} else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 ||
|
||||
strcmp(pref_name, PRS_CAP_NAME_RESOLVE) == 0) {
|
||||
|
@ -3359,13 +3356,6 @@ write_prefs(char **pf_path_return)
|
|||
fprintf(pf, PRS_CAP_SHOW_INFO ": %s\n",
|
||||
prefs.capture_show_info == TRUE ? "TRUE" : "FALSE");
|
||||
|
||||
#ifndef USE_THREADS
|
||||
fprintf(pf, "\n# Syntax check capture filter?\n");
|
||||
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
|
||||
fprintf(pf, PRS_CAP_SYNTAX_CHECK_FILTER ": %s\n",
|
||||
prefs.capture_syntax_check_filter == TRUE ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
|
||||
fprintf (pf, "\n######## Printing ########\n");
|
||||
|
||||
fprintf (pf, "\n# Can be one of \"text\" or \"postscript\".\n"
|
||||
|
|
|
@ -293,12 +293,10 @@ typedef struct capture_filter_check {
|
|||
/* We could make this smarter by caching results */
|
||||
capture_filter_check_t cfc_data;
|
||||
|
||||
#ifdef USE_THREADS
|
||||
GMutex *pcap_compile_mtx = NULL;
|
||||
GCond *cfc_data_cond = NULL;
|
||||
GMutex *cfc_data_mtx = NULL;
|
||||
GThread *cfc_thread = NULL;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define DEBUG_SYNTAX_CHECK(state1, state2) g_warning("CF state %s -> %s : %s", state1, state2, cfc_data.filter_text)
|
||||
|
@ -311,28 +309,25 @@ check_capture_filter_syntax(void *data _U_) {
|
|||
struct bpf_program fcode;
|
||||
int pc_err;
|
||||
|
||||
#ifdef USE_THREADS
|
||||
while (1) {
|
||||
g_mutex_lock(cfc_data_mtx);
|
||||
while (!cfc_data.filter_text || cfc_data.state != CFC_PENDING) {
|
||||
/* Do we really need to use a mutex here? We only have one thread... */
|
||||
g_cond_wait(cfc_data_cond, cfc_data_mtx);
|
||||
}
|
||||
#endif
|
||||
cfc_data.state = CFC_UNKNOWN;
|
||||
DEBUG_SYNTAX_CHECK("pending", "unknown");
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(cfc_data_mtx);
|
||||
g_mutex_lock(pcap_compile_mtx);
|
||||
#endif
|
||||
|
||||
/* pcap_compile_nopcap will not alter the filter string, so the (char *) cast is "safe" */
|
||||
pc_err = pcap_compile_nopcap(DUMMY_SNAPLENGTH /* use a dummy snaplength for syntax-checking */,
|
||||
cfc_data.dlt, &fcode, cfc_data.filter_text, 1 /* Do optimize */,
|
||||
DUMMY_NETMASK /* use a dummy netmask for syntax-checking */);
|
||||
#ifdef USE_THREADS
|
||||
|
||||
g_mutex_unlock(pcap_compile_mtx);
|
||||
g_mutex_lock(cfc_data_mtx);
|
||||
#endif
|
||||
|
||||
if (cfc_data.state == CFC_UNKNOWN) { /* No more input came in */
|
||||
if (pc_err) {
|
||||
DEBUG_SYNTAX_CHECK("unknown", "known bad");
|
||||
|
@ -342,10 +337,8 @@ check_capture_filter_syntax(void *data _U_) {
|
|||
cfc_data.state = CFC_VALID;
|
||||
}
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(cfc_data_mtx);
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -355,9 +348,8 @@ update_capture_filter_te(gpointer data _U_) {
|
|||
if (!prefs.capture_syntax_check_filter)
|
||||
return TRUE;
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(cfc_data_mtx);
|
||||
#endif
|
||||
|
||||
if (cfc_data.filter_text && cfc_data.filter_te) {
|
||||
if (cfc_data.state == CFC_VALID) {
|
||||
colorize_filter_te_as_valid(cfc_data.filter_te);
|
||||
|
@ -377,9 +369,7 @@ update_capture_filter_te(gpointer data _U_) {
|
|||
cfc_data.state = CFC_PENDING;
|
||||
}
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(cfc_data_mtx);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -389,13 +379,11 @@ void capture_filter_init(void) {
|
|||
cfc_data.filter_text = NULL;
|
||||
cfc_data.filter_te = NULL;
|
||||
cfc_data.state = CFC_PENDING;
|
||||
#ifdef USE_THREADS
|
||||
pcap_compile_mtx = g_mutex_new();
|
||||
cfc_data_cond = g_cond_new();
|
||||
cfc_data_mtx = g_mutex_new();
|
||||
g_timeout_add(200, update_capture_filter_te, NULL);
|
||||
g_thread_create(check_capture_filter_syntax, NULL, FALSE, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -431,9 +419,7 @@ capture_filter_check_syntax_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(cfc_data_mtx);
|
||||
#endif
|
||||
/* Ruthlessly clobber the current state. */
|
||||
if (cfc_data.filter_text != NULL) {
|
||||
g_free(cfc_data.filter_text);
|
||||
|
@ -442,21 +428,14 @@ capture_filter_check_syntax_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|||
cfc_data.filter_te = filter_te;
|
||||
cfc_data.state = CFC_PENDING;
|
||||
DEBUG_SYNTAX_CHECK("?", "pending");
|
||||
#ifdef USE_THREADS
|
||||
g_cond_signal(cfc_data_cond);
|
||||
g_mutex_unlock(cfc_data_mtx);
|
||||
#else
|
||||
check_capture_filter_syntax(NULL);
|
||||
update_capture_filter_te(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
capture_filter_destroy_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
||||
{
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(cfc_data_mtx);
|
||||
#endif
|
||||
/* Reset the current state to idle. */
|
||||
if (cfc_data.filter_text != NULL) {
|
||||
g_free(cfc_data.filter_text);
|
||||
|
@ -464,9 +443,7 @@ capture_filter_destroy_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|||
cfc_data.filter_text = NULL;
|
||||
cfc_data.filter_te = NULL;
|
||||
cfc_data.state = CFC_PENDING;
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(cfc_data_mtx);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define TIME_UNIT_SECOND 0
|
||||
|
@ -1638,18 +1615,14 @@ capture_filter_compile_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|||
pd = pcap_open_dead(dlt, DUMMY_SNAPLENGTH);
|
||||
filter_cm = g_object_get_data(G_OBJECT(opt_edit_w), E_CFILTER_CM_KEY);
|
||||
filter_text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(filter_cm));
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(pcap_compile_mtx);
|
||||
#endif
|
||||
/* pcap_compile will not alter the filter string, so the (char *) cast is "safe" */
|
||||
#ifdef PCAP_NETMASK_UNKNOWN
|
||||
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, PCAP_NETMASK_UNKNOWN) < 0) {
|
||||
#else
|
||||
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, 0) < 0) {
|
||||
#endif
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(pcap_compile_mtx);
|
||||
#endif
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", pcap_geterr(pd));
|
||||
} else {
|
||||
GString *bpf_code_dump = g_string_new("");
|
||||
|
@ -1799,11 +1772,7 @@ update_options_table(gint index)
|
|||
#else
|
||||
gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, TRUE, INTERFACE, temp,LINK, link->name, PMODE, row.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, row.cfilter, -1);
|
||||
#endif
|
||||
#ifdef USE_THREADS
|
||||
if (num_selected > 0) {
|
||||
#else
|
||||
if (num_selected == 1) {
|
||||
#endif
|
||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||
|
@ -2362,11 +2331,7 @@ static void toggle_callback(GtkCellRendererToggle *cell _U_,
|
|||
} else {
|
||||
gtk_widget_set_sensitive(pcap_ng_cb, TRUE);
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
if (num_selected > 0) {
|
||||
#else
|
||||
if (num_selected == 1) {
|
||||
#endif
|
||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||
|
@ -2526,11 +2491,7 @@ void enable_selected_interface(gchar *name, gboolean enable)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
if (num_selected > 0) {
|
||||
#else
|
||||
if (num_selected == 1) {
|
||||
#endif
|
||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||
|
@ -2574,11 +2535,7 @@ static void capture_all_cb(GtkToggleButton *button, gpointer d _U_)
|
|||
if (get_welcome_window() != NULL) {
|
||||
change_selection_for_all(enabled);
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
if (num_selected > 0) {
|
||||
#else
|
||||
if (num_selected == 1) {
|
||||
#endif
|
||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||
|
@ -3234,11 +3191,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
ok_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_CAPTURE_START);
|
||||
g_signal_connect(ok_bt, "clicked", G_CALLBACK(capture_start_cb), NULL);
|
||||
gtk_widget_set_tooltip_text(ok_bt, "Start the capture process.");
|
||||
#ifdef USE_THREADS
|
||||
if (num_selected > 0) {
|
||||
#else
|
||||
if (num_selected == 1) {
|
||||
#endif
|
||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||
|
|
|
@ -186,7 +186,7 @@ store_selected(GtkWidget *choose_bt, gpointer if_data)
|
|||
temp->selected ^=1;
|
||||
if_data_list = g_list_remove(if_data_list, curr->data);
|
||||
if_data_list = g_list_insert(if_data_list, temp, ifs);
|
||||
|
||||
|
||||
for (i = 0; i < global_capture_opts.ifaces->len; i++) {
|
||||
if (strcmp(g_array_index(global_capture_opts.ifaces, interface_options, i).name, temp->if_info.name) == 0) {
|
||||
found = TRUE;
|
||||
|
@ -210,8 +210,8 @@ store_selected(GtkWidget *choose_bt, gpointer if_data)
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found && temp->selected) {
|
||||
interface_opts.name = g_strdup(temp->if_info.name);
|
||||
interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
|
||||
|
@ -248,7 +248,7 @@ store_selected(GtkWidget *choose_bt, gpointer if_data)
|
|||
enable_selected_interface(interface_opts.name, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (temp->selected)
|
||||
currently_selected += 1;
|
||||
else
|
||||
|
@ -257,11 +257,7 @@ store_selected(GtkWidget *choose_bt, gpointer if_data)
|
|||
}
|
||||
}
|
||||
if (cap_if_w) {
|
||||
#ifdef USE_THREADS
|
||||
gtk_widget_set_sensitive(capture_bt, !gbl_capture_in_progress && (currently_selected > 0));
|
||||
#else
|
||||
gtk_widget_set_sensitive(capture_bt, !gbl_capture_in_progress && (currently_selected == 1));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,11 +389,7 @@ set_capture_if_dialog_for_capture_in_progress(gboolean capture_in_progress)
|
|||
gbl_capture_in_progress = capture_in_progress;
|
||||
if (cap_if_w) {
|
||||
gtk_widget_set_sensitive(stop_bt, capture_in_progress);
|
||||
#ifdef USE_THREADS
|
||||
gtk_widget_set_sensitive(capture_bt, !capture_in_progress && (currently_selected > 0));
|
||||
#else
|
||||
gtk_widget_set_sensitive(capture_bt, !capture_in_progress && (currently_selected == 1));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -993,13 +985,13 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
#endif
|
||||
|
||||
if_data_list = g_list_append(if_data_list, if_dlg_data);
|
||||
|
||||
|
||||
row++;
|
||||
if (row <= 10) {
|
||||
/* Lets add up 10 rows of interfaces, otherwise the window may become too high */
|
||||
gtk_widget_get_preferred_size(GTK_WIDGET(if_dlg_data->choose_bt), &requisition, NULL);
|
||||
height += requisition.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_string_free(if_tool_str, TRUE);
|
||||
|
@ -1060,7 +1052,7 @@ void select_all_interfaces(gboolean enable)
|
|||
curr = g_list_nth(if_data_list, ifs);
|
||||
temp = (if_dlg_data_t *)(curr->data);
|
||||
update_selected_interface(temp->if_info.name, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void destroy_if_window(void)
|
||||
|
|
|
@ -2316,9 +2316,7 @@ main(int argc, char *argv[])
|
|||
optind = optind_initial;
|
||||
opterr = 1;
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
|
||||
/* Set the current locale according to the program environment.
|
||||
* We haven't localized anything, but some GTK widgets are localized
|
||||
|
@ -2781,12 +2779,6 @@ main(int argc, char *argv[])
|
|||
prefs_apply_all();
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
#ifndef USE_THREADS
|
||||
if ((global_capture_opts.ifaces->len > 1) && start_capture) {
|
||||
cmdarg_err("You specified multiple interfaces for capturing which this version of Wireshark doesn't support.");
|
||||
exit(2);
|
||||
}
|
||||
#endif
|
||||
if ((global_capture_opts.ifaces->len == 0) &&
|
||||
(prefs.capture_device != NULL)) {
|
||||
GList *curr, *combo_list;
|
||||
|
|
|
@ -144,7 +144,7 @@ typedef enum {
|
|||
*/
|
||||
extern void copy_selected_plist_cb(GtkWidget *w _U_, gpointer data, COPY_SELECTED_E action);
|
||||
|
||||
/** Set or remove a time reference on this frame
|
||||
/** Set or remove a time reference on this frame
|
||||
*
|
||||
* @param set TRUE = set time ref, FALSE=unset time ref
|
||||
* @param frame pointer to frame
|
||||
|
@ -346,7 +346,7 @@ extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
|
|||
extern void create_console(void);
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || ! defined USE_THREADS
|
||||
#if defined(_WIN32)
|
||||
/** Restart the tap update display timer with new configured interval */
|
||||
extern void reset_tap_update_timer(void);
|
||||
#endif
|
||||
|
|
|
@ -111,9 +111,7 @@ static GArray *interfaces = NULL;
|
|||
|
||||
static GSList *status_messages = NULL;
|
||||
|
||||
#ifdef USE_THREADS
|
||||
static GMutex *recent_mtx = NULL;
|
||||
#endif
|
||||
|
||||
/* The "scroll box dynamic" is a (complicated) pseudo widget to */
|
||||
/* place a vertically list of widgets in (currently the interfaces and recent files). */
|
||||
|
@ -503,9 +501,7 @@ static void *get_recent_item_status(void *data)
|
|||
* most OSes use.
|
||||
*/
|
||||
err = ws_stat64(ri_stat->filename, &stat_buf);
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(recent_mtx);
|
||||
#endif
|
||||
ri_stat->err = err;
|
||||
if(err == 0) {
|
||||
if (stat_buf.st_size/1024/1024/1024 > 10) {
|
||||
|
@ -531,9 +527,7 @@ static void *get_recent_item_status(void *data)
|
|||
} else {
|
||||
ri_stat->stat_done = TRUE;
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(recent_mtx);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -549,9 +543,7 @@ update_recent_items(gpointer data)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(recent_mtx);
|
||||
#endif
|
||||
if (ri_stat->stat_done) {
|
||||
again = FALSE;
|
||||
gtk_label_set_markup(GTK_LABEL(ri_stat->label), ri_stat->str->str);
|
||||
|
@ -562,9 +554,7 @@ update_recent_items(gpointer data)
|
|||
ri_stat->timer = 0;
|
||||
}
|
||||
/* Else append some sort of Unicode or ASCII animation to the label? */
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(recent_mtx);
|
||||
#endif
|
||||
return again;
|
||||
}
|
||||
|
||||
|
@ -575,9 +565,7 @@ static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_lock(recent_mtx);
|
||||
#endif
|
||||
if (ri_stat->timer) {
|
||||
g_source_remove(ri_stat->timer);
|
||||
ri_stat->timer = 0;
|
||||
|
@ -592,9 +580,7 @@ static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
|
|||
} else {
|
||||
ri_stat->label = NULL;
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
g_mutex_unlock(recent_mtx);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* create a "file link widget" */
|
||||
|
@ -644,13 +630,8 @@ welcome_filename_link_new(const gchar *filename, GtkWidget **label, GObject *men
|
|||
g_signal_connect(w, "destroy", G_CALLBACK(welcome_filename_destroy_cb), ri_stat);
|
||||
g_free(str_escaped);
|
||||
|
||||
#ifdef USE_THREADS
|
||||
g_thread_create(get_recent_item_status, ri_stat, FALSE, NULL);
|
||||
ri_stat->timer = g_timeout_add(200, update_recent_items, ri_stat);
|
||||
#else
|
||||
get_recent_item_status(ri_stat);
|
||||
update_recent_items(ri_stat);
|
||||
#endif
|
||||
|
||||
/* event box */
|
||||
eb = gtk_event_box_new();
|
||||
|
@ -1022,14 +1003,14 @@ welcome_if_tree_load(void)
|
|||
g_free (comment);
|
||||
#endif
|
||||
gtk_list_store_set(store, &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(icon)), IFACE_DESCR, user_descr, IFACE_NAME, if_info->name, -1);
|
||||
d_interface.descr = g_strdup(user_descr);
|
||||
d_interface.descr = g_strdup(user_descr);
|
||||
g_free (user_descr);
|
||||
} else if (if_info->description) {
|
||||
gtk_list_store_set (store, &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(icon)), IFACE_DESCR, if_info->description, IFACE_NAME, if_info->name, -1);
|
||||
d_interface.descr = g_strdup(if_info->description);
|
||||
} else {
|
||||
gtk_list_store_set (store, &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(icon)), IFACE_DESCR, if_info->name, IFACE_NAME, if_info->name, -1);
|
||||
d_interface.descr = g_strdup(if_info->name);
|
||||
d_interface.descr = g_strdup(if_info->name);
|
||||
}
|
||||
g_array_append_val(interfaces, d_interface);
|
||||
}
|
||||
|
@ -1084,13 +1065,6 @@ static void capture_if_start(GtkWidget *w _U_, gpointer data _U_)
|
|||
"You didn't specify an interface on which to capture packets.");
|
||||
return;
|
||||
}
|
||||
#ifndef USE_THREADS
|
||||
if (global_capture_opts.ifaces->len > 1) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"You specified multiple interfaces for capturing which this version of Wireshark doesn't support.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX - remove this? */
|
||||
if (global_capture_opts.save_file) {
|
||||
|
@ -1237,19 +1211,11 @@ welcome_new(void)
|
|||
gtk_tree_view_column_set_visible(column, FALSE);
|
||||
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
|
||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
||||
#ifdef USE_THREADS
|
||||
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
|
||||
"Start",
|
||||
"Choose one or more interfaces to capture from, then <b>Start</b>",
|
||||
"Same as Capture/Interfaces with default options",
|
||||
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
|
||||
#else
|
||||
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
|
||||
"Start",
|
||||
"Choose exactly one interface to capture from, then <b>Start</b>",
|
||||
"Same as Capture/Interfaces with default options",
|
||||
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
|
||||
#endif
|
||||
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
||||
welcome_if_tree_load();
|
||||
gtk_container_add (GTK_CONTAINER (swindow), if_view);
|
||||
|
@ -1416,9 +1382,7 @@ welcome_new(void)
|
|||
welcome_eb);
|
||||
gtk_widget_show_all(welcome_scrollw);
|
||||
|
||||
#ifdef USE_THREADS
|
||||
recent_mtx = g_mutex_new();
|
||||
#endif
|
||||
|
||||
return welcome_scrollw;
|
||||
}
|
||||
|
|
|
@ -101,9 +101,6 @@ capture_prefs_show(void)
|
|||
{
|
||||
GtkWidget *main_tb, *main_vb;
|
||||
GtkWidget *if_cbxe, *if_lb, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
|
||||
#ifndef USE_THREADS
|
||||
GtkWidget *syntax_check_filter_cb;
|
||||
#endif
|
||||
GtkWidget *ifopts_lb, *ifopts_bt;
|
||||
GList *if_list, *combo_list;
|
||||
int err;
|
||||
|
@ -209,15 +206,6 @@ capture_prefs_show(void)
|
|||
!prefs.capture_show_info);
|
||||
g_object_set_data(G_OBJECT(main_vb), SHOW_INFO_KEY, show_info_cb);
|
||||
|
||||
#ifndef USE_THREADS
|
||||
/* Syntax check capture filter */
|
||||
syntax_check_filter_cb = create_preference_check_button(main_tb, row++,
|
||||
"Syntax check capture filter:",
|
||||
"Syntax check capture filter. Turn this off if you experience delay when writing capture filters.",
|
||||
prefs.capture_syntax_check_filter);
|
||||
g_object_set_data(G_OBJECT(main_vb), SYNTAX_CHECK_FILTER_KEY, syntax_check_filter_cb);
|
||||
#endif
|
||||
|
||||
/* Show 'em what we got */
|
||||
gtk_widget_show_all(main_vb);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ stats_prefs_show(void)
|
|||
|
||||
/* Tap update gap in ms */
|
||||
tap_update_interval_te = create_preference_entry(main_tb, pos++,
|
||||
"Tap update interval in ms:",
|
||||
"Tap update interval in ms:",
|
||||
"Determines time between tap updates.", max_visible_str);
|
||||
g_snprintf(update_interval_str, sizeof(update_interval_str), "%d", prefs.tap_update_interval);
|
||||
gtk_entry_set_text(GTK_ENTRY(tap_update_interval_te), update_interval_str);
|
||||
|
@ -77,7 +77,7 @@ stats_prefs_show(void)
|
|||
#ifdef HAVE_LIBPORTAUDIO
|
||||
/* Max visible channels in RTP Player */
|
||||
rtp_player_max_visible_te = create_preference_entry(main_tb, pos++,
|
||||
"Max visible channels in RTP Player:",
|
||||
"Max visible channels in RTP Player:",
|
||||
"Determines maximum height of RTP Player window.", max_visible_str);
|
||||
g_snprintf(max_visible_str, sizeof(max_visible_str), "%d", prefs.rtp_player_max_visible);
|
||||
gtk_entry_set_text(GTK_ENTRY(rtp_player_max_visible_te), max_visible_str);
|
||||
|
@ -124,7 +124,7 @@ stats_prefs_fetch(GtkWidget *w _U_)
|
|||
void
|
||||
stats_prefs_apply(GtkWidget *w _U_)
|
||||
{
|
||||
#if defined(_WIN32) || ! defined USE_THREADS
|
||||
#if defined(_WIN32)
|
||||
reset_tap_update_timer();
|
||||
#endif
|
||||
}
|
||||
|
@ -133,4 +133,3 @@ void
|
|||
stats_prefs_destroy(GtkWidget *w _U_)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -153,11 +153,6 @@ get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
|
|||
#else /* HAVE_LIBCAP */
|
||||
g_string_append(str, "without POSIX capabilities");
|
||||
#endif /* HAVE_LIBCAP */
|
||||
#ifdef USE_THREADS
|
||||
g_string_append_printf(str, ", with threads support");
|
||||
#else
|
||||
g_string_append_printf(str, ", without threads support");
|
||||
#endif
|
||||
|
||||
/* Additional application-dependent information */
|
||||
if (append_info)
|
||||
|
|
Loading…
Reference in New Issue