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
|
# - set HAVE_XXX
|
||||||
|
|
||||||
#The minimum package list
|
#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_FIND_REQUIRED)
|
||||||
set(GLIB2_MIN_VERSION 2.14.0)
|
set(GLIB2_MIN_VERSION 2.14.0)
|
||||||
|
set(GTHREAD2_REQUIRED)
|
||||||
set(PCAP_REQUIRED)
|
set(PCAP_REQUIRED)
|
||||||
set(M_REQUIRED)
|
set(M_REQUIRED)
|
||||||
|
|
||||||
|
@ -249,14 +250,6 @@ if(BUILD_wireshark)
|
||||||
set(GTK2_FIND_VERSION 2.12)
|
set(GTK2_FIND_VERSION 2.12)
|
||||||
set(GTK2_DEBUG false)
|
set(GTK2_DEBUG false)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_THREADS)
|
|
||||||
set(PACKAGELIST ${PACKAGELIST} GTHREAD2)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(BUILD_dumpcap)
|
|
||||||
set(PACKAGELIST ${PACKAGELIST} GTHREAD2)
|
|
||||||
set(GHTREAD2_REQUIRED)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# SMI SNMP
|
# 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_PLUGINS "Build with plugins" ON)
|
||||||
option(ENABLE_GUIDES "Build Guides" OFF)
|
option(ENABLE_GUIDES "Build Guides" OFF)
|
||||||
option(ENABLE_PCAP_NG_DEFAULT "Enable pcap-ng as default file format" ON)
|
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_ADNS "Build with adns support" ON)
|
||||||
option(ENABLE_PORTAUDIO "Build with portaudio 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)
|
option(ENABLE_CARES "Build with c_ares support" ON)
|
||||||
# todo Mostly hardcoded
|
# todo Mostly hardcoded
|
||||||
option(ENABLE_KERBEROS "Build with Kerberos support" ON)
|
option(ENABLE_KERBEROS "Build with Kerberos support" ON)
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
/* Directory where plugins reside */
|
/* Directory where plugins reside */
|
||||||
#define PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}"
|
#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 */
|
/* Define to 1 if we want to use pcap-ng as our default file format */
|
||||||
#cmakedefine PCAP_NG_DEFAULT 1
|
#cmakedefine PCAP_NG_DEFAULT 1
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
#define UNICODE 1
|
#define UNICODE 1
|
||||||
#define _UNICODE 1
|
#define _UNICODE 1
|
||||||
|
|
||||||
/* Use threads */
|
|
||||||
#define USE_THREADS 1
|
|
||||||
|
|
||||||
/* Define if you have the ANSI C header files. */
|
/* Define if you have the ANSI C header files. */
|
||||||
#define STDC_HEADERS 1
|
#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])
|
AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor])
|
||||||
fi
|
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_ARG_ENABLE(profile-build,
|
||||||
AC_HELP_STRING( [--enable-profile-build],
|
AC_HELP_STRING( [--enable-profile-build],
|
||||||
[build profile-ready binaries @<:@default=no@:>@]),
|
[build profile-ready binaries @<:@default=no@:>@]),
|
||||||
|
@ -2140,7 +2132,6 @@ echo " Use plugins : $have_plugins"
|
||||||
echo " Use Lua library : $lua_message"
|
echo " Use Lua library : $lua_message"
|
||||||
echo " Use Python binding : $python_message"
|
echo " Use Python binding : $python_message"
|
||||||
echo " Build rtp_player : $portaudio_message"
|
echo " Build rtp_player : $portaudio_message"
|
||||||
echo " Use threads : $enable_threads"
|
|
||||||
echo " Build profile binaries : $enable_profile_build"
|
echo " Build profile binaries : $enable_profile_build"
|
||||||
echo " Use pcap library : $want_pcap"
|
echo " Use pcap library : $want_pcap"
|
||||||
echo " Use zlib library : $zlib_message"
|
echo " Use zlib library : $zlib_message"
|
||||||
|
|
52
dumpcap.c
52
dumpcap.c
|
@ -235,7 +235,7 @@ typedef struct _pcap_options {
|
||||||
#endif
|
#endif
|
||||||
gboolean cap_pipe_modified; /* TRUE if data in the pipe uses modified pcap headers */
|
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 */
|
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 */
|
char * cap_pipe_buf; /* Pointer to the data buffer we read into */
|
||||||
#endif
|
#endif
|
||||||
int cap_pipe_bytes_to_read;/* Used by cap_pipe_dispatch */
|
int cap_pipe_bytes_to_read;/* Used by cap_pipe_dispatch */
|
||||||
|
@ -247,7 +247,7 @@ typedef struct _pcap_options {
|
||||||
STATE_READ_DATA
|
STATE_READ_DATA
|
||||||
} cap_pipe_state;
|
} cap_pipe_state;
|
||||||
enum { PIPOK, PIPEOF, PIPERR, PIPNEXIST } cap_pipe_err;
|
enum { PIPOK, PIPEOF, PIPERR, PIPNEXIST } cap_pipe_err;
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
GMutex *cap_pipe_read_mtx;
|
GMutex *cap_pipe_read_mtx;
|
||||||
GAsyncQueue *cap_pipe_pending_q, *cap_pipe_done_q;
|
GAsyncQueue *cap_pipe_pending_q, *cap_pipe_done_q;
|
||||||
#endif
|
#endif
|
||||||
|
@ -318,7 +318,7 @@ static gboolean need_timeout_workaround;
|
||||||
* WaitForSingleObject. If it's less than 1000 WaitForSingleObject
|
* WaitForSingleObject. If it's less than 1000 WaitForSingleObject
|
||||||
* will return immediately.
|
* will return immediately.
|
||||||
*/
|
*/
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define PIPE_READ_TIMEOUT 100000
|
#define PIPE_READ_TIMEOUT 100000
|
||||||
#else
|
#else
|
||||||
#define PIPE_READ_TIMEOUT 250000
|
#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 use pcapng format instead of pcap\n");
|
||||||
fprintf(output, "\n");
|
fprintf(output, "\n");
|
||||||
fprintf(output, "Miscellaneous:\n");
|
fprintf(output, "Miscellaneous:\n");
|
||||||
#ifdef USE_THREADS
|
|
||||||
fprintf(output, " -t use a separate thread per interface\n");
|
fprintf(output, " -t use a separate thread per interface\n");
|
||||||
#endif
|
|
||||||
fprintf(output, " -q don't report packet capture counts\n");
|
fprintf(output, " -q don't report packet capture counts\n");
|
||||||
fprintf(output, " -v print version information and exit\n");
|
fprintf(output, " -v print version information and exit\n");
|
||||||
fprintf(output, " -h display this help 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
|
* Thread function that reads from a pipe and pushes the data
|
||||||
* to the main application thread.
|
* to the main application thread.
|
||||||
|
@ -1635,7 +1633,7 @@ static void *cap_pipe_read(void *arg)
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
/* Provide select() functionality for a single file descriptor
|
||||||
* on UNIX/POSIX. Windows uses cap_pipe_read via a thread.
|
* 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;
|
wchar_t *err_str;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
int sel_ret;
|
int sel_ret;
|
||||||
unsigned int bytes_read;
|
unsigned int bytes_read;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1851,7 +1849,7 @@ cap_pipe_open_live(char *pipename,
|
||||||
|
|
||||||
pcap_opts->from_cap_pipe = TRUE;
|
pcap_opts->from_cap_pipe = TRUE;
|
||||||
|
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
/* read the pcap header */
|
/* read the pcap header */
|
||||||
bytes_read = 0;
|
bytes_read = 0;
|
||||||
while (bytes_read < sizeof magic) {
|
while (bytes_read < sizeof magic) {
|
||||||
|
@ -1926,7 +1924,7 @@ cap_pipe_open_live(char *pipename,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
/* Read the rest of the header */
|
/* Read the rest of the header */
|
||||||
bytes_read = 0;
|
bytes_read = 0;
|
||||||
while (bytes_read < sizeof(struct pcap_hdr)) {
|
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;
|
struct pcap_pkthdr phdr;
|
||||||
enum { PD_REC_HDR_READ, PD_DATA_READ, PD_PIPE_EOF, PD_PIPE_ERR,
|
enum { PD_REC_HDR_READ, PD_DATA_READ, PD_PIPE_EOF, PD_PIPE_ERR,
|
||||||
PD_ERR } result;
|
PD_ERR } result;
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#ifdef _WIN32
|
||||||
GTimeVal wait_time;
|
GTimeVal wait_time;
|
||||||
gpointer q_status;
|
gpointer q_status;
|
||||||
#else
|
#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) {
|
switch (pcap_opts->cap_pipe_state) {
|
||||||
|
|
||||||
case STATE_EXPECT_REC_HDR:
|
case STATE_EXPECT_REC_HDR:
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#ifdef _WIN32
|
||||||
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
||||||
#endif
|
#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);
|
sizeof(struct pcaprec_modified_hdr) : sizeof(struct pcaprec_hdr);
|
||||||
pcap_opts->cap_pipe_bytes_read = 0;
|
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;
|
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_async_queue_push(pcap_opts->cap_pipe_pending_q, pcap_opts->cap_pipe_buf);
|
||||||
g_mutex_unlock(pcap_opts->cap_pipe_read_mtx);
|
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 */
|
/* Fall through */
|
||||||
|
|
||||||
case STATE_READ_REC_HDR:
|
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,
|
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);
|
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read);
|
||||||
if (b <= 0) {
|
if (b <= 0) {
|
||||||
|
@ -2073,7 +2071,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_EXPECT_DATA:
|
case STATE_EXPECT_DATA:
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#ifdef _WIN32
|
||||||
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
if (g_mutex_trylock(pcap_opts->cap_pipe_read_mtx)) {
|
||||||
#endif
|
#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_to_read = pcap_opts->cap_pipe_rechdr.hdr.incl_len;
|
||||||
pcap_opts->cap_pipe_bytes_read = 0;
|
pcap_opts->cap_pipe_bytes_read = 0;
|
||||||
|
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#ifdef _WIN32
|
||||||
pcap_opts->cap_pipe_buf = (char *) data;
|
pcap_opts->cap_pipe_buf = (char *) data;
|
||||||
g_async_queue_push(pcap_opts->cap_pipe_pending_q, pcap_opts->cap_pipe_buf);
|
g_async_queue_push(pcap_opts->cap_pipe_pending_q, pcap_opts->cap_pipe_buf);
|
||||||
g_mutex_unlock(pcap_opts->cap_pipe_read_mtx);
|
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 */
|
/* Fall through */
|
||||||
|
|
||||||
case STATE_READ_DATA:
|
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,
|
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);
|
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read);
|
||||||
if (b <= 0) {
|
if (b <= 0) {
|
||||||
|
@ -2292,14 +2290,14 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
||||||
#endif
|
#endif
|
||||||
pcap_opts->cap_pipe_modified = FALSE;
|
pcap_opts->cap_pipe_modified = FALSE;
|
||||||
pcap_opts->cap_pipe_byte_swapped = FALSE;
|
pcap_opts->cap_pipe_byte_swapped = FALSE;
|
||||||
#if defined(USE_THREADS) && defined(_WIN32)
|
#ifdef _WIN32
|
||||||
pcap_opts->cap_pipe_buf = NULL;
|
pcap_opts->cap_pipe_buf = NULL;
|
||||||
#endif
|
#endif
|
||||||
pcap_opts->cap_pipe_bytes_to_read = 0;
|
pcap_opts->cap_pipe_bytes_to_read = 0;
|
||||||
pcap_opts->cap_pipe_bytes_read = 0;
|
pcap_opts->cap_pipe_bytes_read = 0;
|
||||||
pcap_opts->cap_pipe_state = 0;
|
pcap_opts->cap_pipe_state = 0;
|
||||||
pcap_opts->cap_pipe_err = PIPOK;
|
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_read_mtx = g_mutex_new();
|
||||||
pcap_opts->cap_pipe_pending_q = g_async_queue_new();
|
pcap_opts->cap_pipe_pending_q = g_async_queue_new();
|
||||||
pcap_opts->cap_pipe_done_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;
|
int inpkts;
|
||||||
gint packet_count_before;
|
gint packet_count_before;
|
||||||
guchar pcap_data[WTAP_MAX_PACKET_SIZE];
|
guchar pcap_data[WTAP_MAX_PACKET_SIZE];
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
int sel_ret;
|
int sel_ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2646,7 +2644,7 @@ capture_loop_dispatch(loop_data *ld,
|
||||||
#ifdef LOG_CAPTURE_VERBOSE
|
#ifdef LOG_CAPTURE_VERBOSE
|
||||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_dispatch: from capture pipe");
|
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_dispatch: from capture pipe");
|
||||||
#endif
|
#endif
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
sel_ret = cap_pipe_select(pcap_opts->cap_pipe_fd);
|
sel_ret = cap_pipe_select(pcap_opts->cap_pipe_fd);
|
||||||
if (sel_ret <= 0) {
|
if (sel_ret <= 0) {
|
||||||
if (sel_ret < 0 && errno != EINTR) {
|
if (sel_ret < 0 && errno != EINTR) {
|
||||||
|
@ -2664,7 +2662,7 @@ capture_loop_dispatch(loop_data *ld,
|
||||||
if (inpkts < 0) {
|
if (inpkts < 0) {
|
||||||
ld->go = FALSE;
|
ld->go = FALSE;
|
||||||
}
|
}
|
||||||
#if !(defined(USE_THREADS) && defined(_WIN32))
|
#ifndef _WIN32
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3856,10 +3854,8 @@ main(int argc, char *argv[])
|
||||||
global_ld.pcaps = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
|
global_ld.pcaps = g_array_new(FALSE, FALSE, sizeof(pcap_options *));
|
||||||
|
|
||||||
/* Initialize the thread system */
|
/* Initialize the thread system */
|
||||||
#ifdef USE_THREADS
|
g_thread_init(NULL);
|
||||||
if (!g_thread_supported())
|
|
||||||
g_thread_init(NULL);
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* Load wpcap if possible. Do this before collecting the run-time version information */
|
/* Load wpcap if possible. Do this before collecting the run-time version information */
|
||||||
load_wpcap();
|
load_wpcap();
|
||||||
|
@ -4076,11 +4072,9 @@ main(int argc, char *argv[])
|
||||||
case 'q': /* Quiet */
|
case 'q': /* Quiet */
|
||||||
quiet = TRUE;
|
quiet = TRUE;
|
||||||
break;
|
break;
|
||||||
#ifdef USE_THREADS
|
|
||||||
case 't':
|
case 't':
|
||||||
use_threads = TRUE;
|
use_threads = TRUE;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
/*** all non capture option specific ***/
|
/*** all non capture option specific ***/
|
||||||
case 'D': /* Print a list of capture devices and exit */
|
case 'D': /* Print a list of capture devices and exit */
|
||||||
list_interfaces = TRUE;
|
list_interfaces = TRUE;
|
||||||
|
@ -4148,12 +4142,10 @@ main(int argc, char *argv[])
|
||||||
} else {
|
} else {
|
||||||
/* We're supposed to capture traffic; */
|
/* We're supposed to capture traffic; */
|
||||||
/* Are we capturing on multiple interface? If so, use threads and pcapng. */
|
/* Are we capturing on multiple interface? If so, use threads and pcapng. */
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (global_capture_opts.ifaces->len > 1) {
|
if (global_capture_opts.ifaces->len > 1) {
|
||||||
use_threads = TRUE;
|
use_threads = TRUE;
|
||||||
global_capture_opts.use_pcapng = TRUE;
|
global_capture_opts.use_pcapng = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Was the ring buffer option specified and, if so, does it make sense? */
|
/* Was the ring buffer option specified and, if so, does it make sense? */
|
||||||
if (global_capture_opts.multi_files_on) {
|
if (global_capture_opts.multi_files_on) {
|
||||||
/* Ring buffer works only under certain conditions:
|
/* 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) {
|
} else if (strcmp(pref_name, PRS_CAP_SHOW_INFO) == 0) {
|
||||||
prefs.capture_show_info = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
prefs.capture_show_info = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||||
} else if (strcmp(pref_name, PRS_CAP_SYNTAX_CHECK_FILTER) == 0) {
|
} 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 */
|
/* handle the global options */
|
||||||
} else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 ||
|
} else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 ||
|
||||||
strcmp(pref_name, PRS_CAP_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",
|
fprintf(pf, PRS_CAP_SHOW_INFO ": %s\n",
|
||||||
prefs.capture_show_info == TRUE ? "TRUE" : "FALSE");
|
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######## Printing ########\n");
|
||||||
|
|
||||||
fprintf (pf, "\n# Can be one of \"text\" or \"postscript\".\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 */
|
/* We could make this smarter by caching results */
|
||||||
capture_filter_check_t cfc_data;
|
capture_filter_check_t cfc_data;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
GMutex *pcap_compile_mtx = NULL;
|
GMutex *pcap_compile_mtx = NULL;
|
||||||
GCond *cfc_data_cond = NULL;
|
GCond *cfc_data_cond = NULL;
|
||||||
GMutex *cfc_data_mtx = NULL;
|
GMutex *cfc_data_mtx = NULL;
|
||||||
GThread *cfc_thread = NULL;
|
GThread *cfc_thread = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define DEBUG_SYNTAX_CHECK(state1, state2) g_warning("CF state %s -> %s : %s", state1, state2, cfc_data.filter_text)
|
#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;
|
struct bpf_program fcode;
|
||||||
int pc_err;
|
int pc_err;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
while (1) {
|
while (1) {
|
||||||
g_mutex_lock(cfc_data_mtx);
|
g_mutex_lock(cfc_data_mtx);
|
||||||
while (!cfc_data.filter_text || cfc_data.state != CFC_PENDING) {
|
while (!cfc_data.filter_text || cfc_data.state != CFC_PENDING) {
|
||||||
/* Do we really need to use a mutex here? We only have one thread... */
|
/* Do we really need to use a mutex here? We only have one thread... */
|
||||||
g_cond_wait(cfc_data_cond, cfc_data_mtx);
|
g_cond_wait(cfc_data_cond, cfc_data_mtx);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
cfc_data.state = CFC_UNKNOWN;
|
cfc_data.state = CFC_UNKNOWN;
|
||||||
DEBUG_SYNTAX_CHECK("pending", "unknown");
|
DEBUG_SYNTAX_CHECK("pending", "unknown");
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(cfc_data_mtx);
|
g_mutex_unlock(cfc_data_mtx);
|
||||||
g_mutex_lock(pcap_compile_mtx);
|
g_mutex_lock(pcap_compile_mtx);
|
||||||
#endif
|
|
||||||
/* pcap_compile_nopcap will not alter the filter string, so the (char *) cast is "safe" */
|
/* 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 */,
|
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 */,
|
cfc_data.dlt, &fcode, cfc_data.filter_text, 1 /* Do optimize */,
|
||||||
DUMMY_NETMASK /* use a dummy netmask for syntax-checking */);
|
DUMMY_NETMASK /* use a dummy netmask for syntax-checking */);
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(pcap_compile_mtx);
|
g_mutex_unlock(pcap_compile_mtx);
|
||||||
g_mutex_lock(cfc_data_mtx);
|
g_mutex_lock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
if (cfc_data.state == CFC_UNKNOWN) { /* No more input came in */
|
if (cfc_data.state == CFC_UNKNOWN) { /* No more input came in */
|
||||||
if (pc_err) {
|
if (pc_err) {
|
||||||
DEBUG_SYNTAX_CHECK("unknown", "known bad");
|
DEBUG_SYNTAX_CHECK("unknown", "known bad");
|
||||||
|
@ -342,10 +337,8 @@ check_capture_filter_syntax(void *data _U_) {
|
||||||
cfc_data.state = CFC_VALID;
|
cfc_data.state = CFC_VALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(cfc_data_mtx);
|
g_mutex_unlock(cfc_data_mtx);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,9 +348,8 @@ update_capture_filter_te(gpointer data _U_) {
|
||||||
if (!prefs.capture_syntax_check_filter)
|
if (!prefs.capture_syntax_check_filter)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(cfc_data_mtx);
|
g_mutex_lock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
if (cfc_data.filter_text && cfc_data.filter_te) {
|
if (cfc_data.filter_text && cfc_data.filter_te) {
|
||||||
if (cfc_data.state == CFC_VALID) {
|
if (cfc_data.state == CFC_VALID) {
|
||||||
colorize_filter_te_as_valid(cfc_data.filter_te);
|
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;
|
cfc_data.state = CFC_PENDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(cfc_data_mtx);
|
g_mutex_unlock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,13 +379,11 @@ void capture_filter_init(void) {
|
||||||
cfc_data.filter_text = NULL;
|
cfc_data.filter_text = NULL;
|
||||||
cfc_data.filter_te = NULL;
|
cfc_data.filter_te = NULL;
|
||||||
cfc_data.state = CFC_PENDING;
|
cfc_data.state = CFC_PENDING;
|
||||||
#ifdef USE_THREADS
|
|
||||||
pcap_compile_mtx = g_mutex_new();
|
pcap_compile_mtx = g_mutex_new();
|
||||||
cfc_data_cond = g_cond_new();
|
cfc_data_cond = g_cond_new();
|
||||||
cfc_data_mtx = g_mutex_new();
|
cfc_data_mtx = g_mutex_new();
|
||||||
g_timeout_add(200, update_capture_filter_te, NULL);
|
g_timeout_add(200, update_capture_filter_te, NULL);
|
||||||
g_thread_create(check_capture_filter_syntax, NULL, FALSE, NULL);
|
g_thread_create(check_capture_filter_syntax, NULL, FALSE, NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -431,9 +419,7 @@ capture_filter_check_syntax_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(cfc_data_mtx);
|
g_mutex_lock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
/* Ruthlessly clobber the current state. */
|
/* Ruthlessly clobber the current state. */
|
||||||
if (cfc_data.filter_text != NULL) {
|
if (cfc_data.filter_text != NULL) {
|
||||||
g_free(cfc_data.filter_text);
|
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.filter_te = filter_te;
|
||||||
cfc_data.state = CFC_PENDING;
|
cfc_data.state = CFC_PENDING;
|
||||||
DEBUG_SYNTAX_CHECK("?", "pending");
|
DEBUG_SYNTAX_CHECK("?", "pending");
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_cond_signal(cfc_data_cond);
|
g_cond_signal(cfc_data_cond);
|
||||||
g_mutex_unlock(cfc_data_mtx);
|
g_mutex_unlock(cfc_data_mtx);
|
||||||
#else
|
|
||||||
check_capture_filter_syntax(NULL);
|
|
||||||
update_capture_filter_te(NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
capture_filter_destroy_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
capture_filter_destroy_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
||||||
{
|
{
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(cfc_data_mtx);
|
g_mutex_lock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
/* Reset the current state to idle. */
|
/* Reset the current state to idle. */
|
||||||
if (cfc_data.filter_text != NULL) {
|
if (cfc_data.filter_text != NULL) {
|
||||||
g_free(cfc_data.filter_text);
|
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_text = NULL;
|
||||||
cfc_data.filter_te = NULL;
|
cfc_data.filter_te = NULL;
|
||||||
cfc_data.state = CFC_PENDING;
|
cfc_data.state = CFC_PENDING;
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(cfc_data_mtx);
|
g_mutex_unlock(cfc_data_mtx);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIME_UNIT_SECOND 0
|
#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);
|
pd = pcap_open_dead(dlt, DUMMY_SNAPLENGTH);
|
||||||
filter_cm = g_object_get_data(G_OBJECT(opt_edit_w), E_CFILTER_CM_KEY);
|
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));
|
filter_text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(filter_cm));
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(pcap_compile_mtx);
|
g_mutex_lock(pcap_compile_mtx);
|
||||||
#endif
|
|
||||||
/* pcap_compile will not alter the filter string, so the (char *) cast is "safe" */
|
/* pcap_compile will not alter the filter string, so the (char *) cast is "safe" */
|
||||||
#ifdef PCAP_NETMASK_UNKNOWN
|
#ifdef PCAP_NETMASK_UNKNOWN
|
||||||
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, PCAP_NETMASK_UNKNOWN) < 0) {
|
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, PCAP_NETMASK_UNKNOWN) < 0) {
|
||||||
#else
|
#else
|
||||||
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, 0) < 0) {
|
if (pcap_compile(pd, &fcode, (char *)filter_text, 1 /* Do optimize */, 0) < 0) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(pcap_compile_mtx);
|
g_mutex_unlock(pcap_compile_mtx);
|
||||||
#endif
|
|
||||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", pcap_geterr(pd));
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", pcap_geterr(pd));
|
||||||
} else {
|
} else {
|
||||||
GString *bpf_code_dump = g_string_new("");
|
GString *bpf_code_dump = g_string_new("");
|
||||||
|
@ -1799,11 +1772,7 @@ update_options_table(gint index)
|
||||||
#else
|
#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);
|
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
|
#endif
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (num_selected > 0) {
|
if (num_selected > 0) {
|
||||||
#else
|
|
||||||
if (num_selected == 1) {
|
|
||||||
#endif
|
|
||||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||||
|
@ -2362,11 +2331,7 @@ static void toggle_callback(GtkCellRendererToggle *cell _U_,
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(pcap_ng_cb, TRUE);
|
gtk_widget_set_sensitive(pcap_ng_cb, TRUE);
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (num_selected > 0) {
|
if (num_selected > 0) {
|
||||||
#else
|
|
||||||
if (num_selected == 1) {
|
|
||||||
#endif
|
|
||||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||||
|
@ -2526,11 +2491,7 @@ void enable_selected_interface(gchar *name, gboolean enable)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (num_selected > 0) {
|
if (num_selected > 0) {
|
||||||
#else
|
|
||||||
if (num_selected == 1) {
|
|
||||||
#endif
|
|
||||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
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) {
|
if (get_welcome_window() != NULL) {
|
||||||
change_selection_for_all(enabled);
|
change_selection_for_all(enabled);
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (num_selected > 0) {
|
if (num_selected > 0) {
|
||||||
#else
|
|
||||||
if (num_selected == 1) {
|
|
||||||
#endif
|
|
||||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
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);
|
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);
|
g_signal_connect(ok_bt, "clicked", G_CALLBACK(capture_start_cb), NULL);
|
||||||
gtk_widget_set_tooltip_text(ok_bt, "Start the capture process.");
|
gtk_widget_set_tooltip_text(ok_bt, "Start the capture process.");
|
||||||
#ifdef USE_THREADS
|
|
||||||
if (num_selected > 0) {
|
if (num_selected > 0) {
|
||||||
#else
|
|
||||||
if (num_selected == 1) {
|
|
||||||
#endif
|
|
||||||
gtk_widget_set_sensitive(ok_bt, TRUE);
|
gtk_widget_set_sensitive(ok_bt, TRUE);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(ok_bt, FALSE);
|
gtk_widget_set_sensitive(ok_bt, FALSE);
|
||||||
|
|
|
@ -257,11 +257,7 @@ store_selected(GtkWidget *choose_bt, gpointer if_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cap_if_w) {
|
if (cap_if_w) {
|
||||||
#ifdef USE_THREADS
|
|
||||||
gtk_widget_set_sensitive(capture_bt, !gbl_capture_in_progress && (currently_selected > 0));
|
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;
|
gbl_capture_in_progress = capture_in_progress;
|
||||||
if (cap_if_w) {
|
if (cap_if_w) {
|
||||||
gtk_widget_set_sensitive(stop_bt, capture_in_progress);
|
gtk_widget_set_sensitive(stop_bt, capture_in_progress);
|
||||||
#ifdef USE_THREADS
|
|
||||||
gtk_widget_set_sensitive(capture_bt, !capture_in_progress && (currently_selected > 0));
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2316,9 +2316,7 @@ main(int argc, char *argv[])
|
||||||
optind = optind_initial;
|
optind = optind_initial;
|
||||||
opterr = 1;
|
opterr = 1;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_thread_init(NULL);
|
g_thread_init(NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set the current locale according to the program environment.
|
/* Set the current locale according to the program environment.
|
||||||
* We haven't localized anything, but some GTK widgets are localized
|
* We haven't localized anything, but some GTK widgets are localized
|
||||||
|
@ -2781,12 +2779,6 @@ main(int argc, char *argv[])
|
||||||
prefs_apply_all();
|
prefs_apply_all();
|
||||||
|
|
||||||
#ifdef HAVE_LIBPCAP
|
#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) &&
|
if ((global_capture_opts.ifaces->len == 0) &&
|
||||||
(prefs.capture_device != NULL)) {
|
(prefs.capture_device != NULL)) {
|
||||||
GList *curr, *combo_list;
|
GList *curr, *combo_list;
|
||||||
|
|
|
@ -346,7 +346,7 @@ extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
|
||||||
extern void create_console(void);
|
extern void create_console(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || ! defined USE_THREADS
|
#if defined(_WIN32)
|
||||||
/** Restart the tap update display timer with new configured interval */
|
/** Restart the tap update display timer with new configured interval */
|
||||||
extern void reset_tap_update_timer(void);
|
extern void reset_tap_update_timer(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -111,9 +111,7 @@ static GArray *interfaces = NULL;
|
||||||
|
|
||||||
static GSList *status_messages = NULL;
|
static GSList *status_messages = NULL;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
static GMutex *recent_mtx = NULL;
|
static GMutex *recent_mtx = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The "scroll box dynamic" is a (complicated) pseudo widget to */
|
/* The "scroll box dynamic" is a (complicated) pseudo widget to */
|
||||||
/* place a vertically list of widgets in (currently the interfaces and recent files). */
|
/* 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.
|
* most OSes use.
|
||||||
*/
|
*/
|
||||||
err = ws_stat64(ri_stat->filename, &stat_buf);
|
err = ws_stat64(ri_stat->filename, &stat_buf);
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(recent_mtx);
|
g_mutex_lock(recent_mtx);
|
||||||
#endif
|
|
||||||
ri_stat->err = err;
|
ri_stat->err = err;
|
||||||
if(err == 0) {
|
if(err == 0) {
|
||||||
if (stat_buf.st_size/1024/1024/1024 > 10) {
|
if (stat_buf.st_size/1024/1024/1024 > 10) {
|
||||||
|
@ -531,9 +527,7 @@ static void *get_recent_item_status(void *data)
|
||||||
} else {
|
} else {
|
||||||
ri_stat->stat_done = TRUE;
|
ri_stat->stat_done = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(recent_mtx);
|
g_mutex_unlock(recent_mtx);
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -549,9 +543,7 @@ update_recent_items(gpointer data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(recent_mtx);
|
g_mutex_lock(recent_mtx);
|
||||||
#endif
|
|
||||||
if (ri_stat->stat_done) {
|
if (ri_stat->stat_done) {
|
||||||
again = FALSE;
|
again = FALSE;
|
||||||
gtk_label_set_markup(GTK_LABEL(ri_stat->label), ri_stat->str->str);
|
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;
|
ri_stat->timer = 0;
|
||||||
}
|
}
|
||||||
/* Else append some sort of Unicode or ASCII animation to the label? */
|
/* Else append some sort of Unicode or ASCII animation to the label? */
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(recent_mtx);
|
g_mutex_unlock(recent_mtx);
|
||||||
#endif
|
|
||||||
return again;
|
return again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,9 +565,7 @@ static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_lock(recent_mtx);
|
g_mutex_lock(recent_mtx);
|
||||||
#endif
|
|
||||||
if (ri_stat->timer) {
|
if (ri_stat->timer) {
|
||||||
g_source_remove(ri_stat->timer);
|
g_source_remove(ri_stat->timer);
|
||||||
ri_stat->timer = 0;
|
ri_stat->timer = 0;
|
||||||
|
@ -592,9 +580,7 @@ static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
|
||||||
} else {
|
} else {
|
||||||
ri_stat->label = NULL;
|
ri_stat->label = NULL;
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_mutex_unlock(recent_mtx);
|
g_mutex_unlock(recent_mtx);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a "file link widget" */
|
/* 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_signal_connect(w, "destroy", G_CALLBACK(welcome_filename_destroy_cb), ri_stat);
|
||||||
g_free(str_escaped);
|
g_free(str_escaped);
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
g_thread_create(get_recent_item_status, ri_stat, FALSE, NULL);
|
g_thread_create(get_recent_item_status, ri_stat, FALSE, NULL);
|
||||||
ri_stat->timer = g_timeout_add(200, update_recent_items, ri_stat);
|
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 */
|
/* event box */
|
||||||
eb = gtk_event_box_new();
|
eb = gtk_event_box_new();
|
||||||
|
@ -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.");
|
"You didn't specify an interface on which to capture packets.");
|
||||||
return;
|
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? */
|
/* XXX - remove this? */
|
||||||
if (global_capture_opts.save_file) {
|
if (global_capture_opts.save_file) {
|
||||||
|
@ -1237,19 +1211,11 @@ welcome_new(void)
|
||||||
gtk_tree_view_column_set_visible(column, FALSE);
|
gtk_tree_view_column_set_visible(column, FALSE);
|
||||||
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
|
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
|
||||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
||||||
#ifdef USE_THREADS
|
|
||||||
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
|
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
|
||||||
"Start",
|
"Start",
|
||||||
"Choose one or more interfaces to capture from, then <b>Start</b>",
|
"Choose one or more interfaces to capture from, then <b>Start</b>",
|
||||||
"Same as Capture/Interfaces with default options",
|
"Same as Capture/Interfaces with default options",
|
||||||
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
|
(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);
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
||||||
welcome_if_tree_load();
|
welcome_if_tree_load();
|
||||||
gtk_container_add (GTK_CONTAINER (swindow), if_view);
|
gtk_container_add (GTK_CONTAINER (swindow), if_view);
|
||||||
|
@ -1416,9 +1382,7 @@ welcome_new(void)
|
||||||
welcome_eb);
|
welcome_eb);
|
||||||
gtk_widget_show_all(welcome_scrollw);
|
gtk_widget_show_all(welcome_scrollw);
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
|
||||||
recent_mtx = g_mutex_new();
|
recent_mtx = g_mutex_new();
|
||||||
#endif
|
|
||||||
|
|
||||||
return welcome_scrollw;
|
return welcome_scrollw;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,6 @@ capture_prefs_show(void)
|
||||||
{
|
{
|
||||||
GtkWidget *main_tb, *main_vb;
|
GtkWidget *main_tb, *main_vb;
|
||||||
GtkWidget *if_cbxe, *if_lb, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
|
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;
|
GtkWidget *ifopts_lb, *ifopts_bt;
|
||||||
GList *if_list, *combo_list;
|
GList *if_list, *combo_list;
|
||||||
int err;
|
int err;
|
||||||
|
@ -209,15 +206,6 @@ capture_prefs_show(void)
|
||||||
!prefs.capture_show_info);
|
!prefs.capture_show_info);
|
||||||
g_object_set_data(G_OBJECT(main_vb), SHOW_INFO_KEY, show_info_cb);
|
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 */
|
/* Show 'em what we got */
|
||||||
gtk_widget_show_all(main_vb);
|
gtk_widget_show_all(main_vb);
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ stats_prefs_fetch(GtkWidget *w _U_)
|
||||||
void
|
void
|
||||||
stats_prefs_apply(GtkWidget *w _U_)
|
stats_prefs_apply(GtkWidget *w _U_)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || ! defined USE_THREADS
|
#if defined(_WIN32)
|
||||||
reset_tap_update_timer();
|
reset_tap_update_timer();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -133,4 +133,3 @@ void
|
||||||
stats_prefs_destroy(GtkWidget *w _U_)
|
stats_prefs_destroy(GtkWidget *w _U_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,11 +153,6 @@ get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
|
||||||
#else /* HAVE_LIBCAP */
|
#else /* HAVE_LIBCAP */
|
||||||
g_string_append(str, "without POSIX capabilities");
|
g_string_append(str, "without POSIX capabilities");
|
||||||
#endif /* HAVE_LIBCAP */
|
#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 */
|
/* Additional application-dependent information */
|
||||||
if (append_info)
|
if (append_info)
|
||||||
|
|
Loading…
Reference in New Issue