Fix building without extcap enabled

Using cmake -DENABLE_EXTCAP=no or ./configure --without-extcap.

Some documentation fixes too.

Change-Id: Iebf9c843d67e10a32de1a62904de8f88b872ec99
Reviewed-on: https://code.wireshark.org/review/14522
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
João Valverde 2016-03-18 17:31:09 +00:00 committed by João Valverde
parent 69d348c12a
commit 52dd4fb633
23 changed files with 170 additions and 119 deletions

View File

@ -2328,7 +2328,7 @@ if (WIN32)
endif()
endif()
if(BUILD_androiddump)
if(ENABLE_EXTCAP AND BUILD_androiddump)
if(EXTCAP_ANDROIDDUMP_LIBPCAP)
if(HAVE_LIBPCAP)
set(androiddump_LIBS
@ -2357,7 +2357,7 @@ if(BUILD_androiddump)
install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
endif()
if(BUILD_sshdump AND LIBSSH_FOUND)
if(ENABLE_EXTCAP AND BUILD_sshdump AND LIBSSH_FOUND)
set(sshdump_LIBS
wsutil
${GLIB2_LIBRARIES}
@ -2382,7 +2382,7 @@ elseif (BUILD_sshdump)
#message( WARNING "Cannot find libssh, cannot build sshdump" )
endif()
if(BUILD_randpktdump)
if(ENABLE_EXTCAP AND BUILD_randpktdump)
set(randpktdump_LIBS
randpkt_core
wiretap

View File

@ -362,6 +362,10 @@ endif # HAVE_PLUGINS
include Makefile.common
if HAVE_EXTCAP
SHARK_COMMON_SRC += $(EXTCAP_COMMON_SRC)
endif
if ENABLE_STATIC
EXTRALINKFLAGS = -Wl,-static -all-static
else
@ -1391,7 +1395,7 @@ SUBDIRS = \
@wireshark_SUBDIRS@ \
ui/cli \
randpkt_core \
extcap \
@extcap_subdir@ \
. \
doc

View File

@ -40,19 +40,23 @@ GENERATED_C_FILES =
# All the generated files.
GENERATED_FILES = $(GENERATED_C_FILES) $(GENERATED_HEADER_FILES)
EXTCAP_COMMON_SRC = \
extcap.c \
extcap_parser.c
EXTCAP_COMMON_INCLUDES = \
extcap.h \
extcap_parser.h
# sources common for wireshark, tshark, and rawshark
SHARK_COMMON_SRC = \
cfile.c \
frame_tvbuff.c \
sync_pipe_write.c \
extcap.c \
extcap_parser.c
sync_pipe_write.c
# corresponding headers
SHARK_COMMON_INCLUDES = \
cfile.h \
extcap.h \
extcap_parser.h \
file.h \
fileset.h \
frame_tvbuff.h \
@ -166,5 +170,6 @@ dumpcap_INCLUDES = \
# this target needed for distribution only
noinst_HEADERS = \
$(SHARK_COMMON_INCLUDES) \
$(EXTCAP_COMMON_INCLUDES) \
$(WIRESHARK_COMMON_INCLUDES) \
$(dumpcap_INCLUDES)

View File

@ -51,7 +51,7 @@ CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
include Makefile.common
wireshark_gtk_OBJECTS = $(WIRESHARK_COMMON_SRC:.c=.obj)
wireshark_gtk_OBJECTS = $(WIRESHARK_COMMON_SRC:.c=.obj) $(EXTCAP_COMMON_SRC:.c=.obj)
tshark_OBJECTS = $(tshark_SOURCES:.c=.obj)
tfshark_OBJECTS = $(tfshark_SOURCES:.c=.obj)
rawshark_OBJECTS = $(rawshark_SOURCES:.c=.obj)
@ -1502,6 +1502,7 @@ install-all: install-generated-files
checkapi_local:
$(PERL) tools/checkAPIs.pl -build \
$(WIRESHARK_COMMON_SRC) \
$(EXTCAP_COMMON_SRC) \
$(TSHARK_TAP_SRC) \
# $(EXTRA_wireshark_SOURCES)

View File

@ -2300,77 +2300,6 @@ fi
AC_SUBST(rawshark_bin)
AC_SUBST(rawshark_man)
dnl androiddump check
AC_MSG_CHECKING(whether to build androiddump)
AC_ARG_ENABLE(androiddump,
AC_HELP_STRING( [--enable-androiddump],
[build androiddump @<:@default=yes@:>@]),
androiddump=$enableval,enable_androiddump=yes)
if test "x$enable_androiddump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_ARG_ENABLE(androiddump_use_libpcap,
AC_HELP_STRING( [--enable-androiddump-use-libpcap],
[build androiddump using libpcap @<:@default=no@:>@]),
androiddump_use_libpcap=$enableval,enable_androiddump_use_libpcap=no)
if test "x$enable_androiddump_use_libpcap" = "xyes" ; then
AC_DEFINE(ANDROIDDUMP_USE_LIBPCAP, 1, [Androiddump will use Libpcap])
fi
if test "x$enable_androiddump" = "xyes" ; then
androiddump_bin="androiddump\$(EXEEXT)"
androiddump_man=""
else
androiddump_bin=""
androiddump_man=""
fi
AC_SUBST(androiddump_bin)
AC_SUBST(androiddump_man)
dnl sshdump check
AC_MSG_CHECKING(whether to build sshdump)
AC_ARG_ENABLE(sshdump,
AC_HELP_STRING( [--enable-sshdump],
[build sshdump @<:@default=yes@:>@]),
sshdump=$enableval,enable_sshdump=yes)
if test "x$enable_sshdump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl randpktdump check
AC_MSG_CHECKING(whether to build randpktdump)
AC_ARG_ENABLE(randpktdump,
AC_HELP_STRING( [--enable-randpktdump],
[build androiddump @<:@default=yes@:>@]),
randpktdump=$enableval,enable_randpktdump=yes)
if test "x$enable_randpktdump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
if test "x$enable_randpktdump" = "xyes" ; then
randpktdump_bin="randpktdump\$(EXEEXT)"
randpktdump_man=""
else
randpktdump_bin=""
randpktdump_man=""
fi
AC_SUBST(randpktdump_bin)
AC_SUBST(randpktdump_man)
# Enable/disable echld
AC_ARG_ENABLE(echld,
AC_HELP_STRING( [--enable-echld],
@ -3097,9 +3026,66 @@ AM_CONDITIONAL(HAVE_EXTCAP, test "x$have_extcap" = "xyes")
if test "x$have_extcap" = "xyes"
then
AC_DEFINE(HAVE_EXTCAP, 1, [Define if external capture sources should be enabled])
extcap_subdir="extcap"
extcap_man="extcap.4"
fi
AC_SUBST(extcap_subdir)
AC_SUBST(extcap_man)
AC_SUBST(extcapdir)
dnl androiddump check
AC_MSG_CHECKING(whether to build androiddump)
AC_ARG_ENABLE(androiddump,
AC_HELP_STRING( [--enable-androiddump],
[build androiddump @<:@default=yes@:>@]),
androiddump=$enableval,enable_androiddump=yes)
if test "x$have_extcap" != xyes; then
AC_MSG_RESULT(no, extcap disabled)
enable_androiddump=no
elif test "x$enable_androiddump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_ARG_ENABLE(androiddump_use_libpcap,
AC_HELP_STRING( [--enable-androiddump-use-libpcap],
[build androiddump using libpcap @<:@default=no@:>@]),
androiddump_use_libpcap=$enableval,enable_androiddump_use_libpcap=no)
if test "x$enable_androiddump" = "xyes" -a "x$enable_androiddump_use_libpcap" = "xyes" ; then
AC_DEFINE(ANDROIDDUMP_USE_LIBPCAP, 1, [Androiddump will use Libpcap])
fi
if test "x$enable_androiddump" = "xyes" ; then
androiddump_bin="androiddump\$(EXEEXT)"
androiddump_man=""
else
androiddump_bin=""
androiddump_man=""
fi
AC_SUBST(androiddump_bin)
AC_SUBST(androiddump_man)
dnl sshdump check
AC_MSG_CHECKING(whether to build sshdump)
AC_ARG_ENABLE(sshdump,
AC_HELP_STRING( [--enable-sshdump],
[build sshdump @<:@default=yes@:>@]),
sshdump=$enableval,enable_sshdump=yes)
if test "x$have_extcap" != xyes; then
AC_MSG_RESULT(no, extcap disabled)
enable_sshdump=no
elif test "x$enable_sshdump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
if test "x$enable_sshdump" = "xyes" ; then
if test "x$have_good_libssh" = "xyes" ; then
sshdump_bin="sshdump\$(EXEEXT)"
@ -3117,6 +3103,33 @@ fi
AC_SUBST(sshdump_bin)
AC_SUBST(sshdump_man)
dnl randpktdump check
AC_MSG_CHECKING(whether to build randpktdump)
AC_ARG_ENABLE(randpktdump,
AC_HELP_STRING( [--enable-randpktdump],
[build androiddump @<:@default=yes@:>@]),
randpktdump=$enableval,enable_randpktdump=yes)
if test "x$have_extcap" != xyes; then
AC_MSG_RESULT(no, extcap disabled)
enable_randpktdump=no
elif test "x$enable_randpktdump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
if test "x$enable_randpktdump" = "xyes" ; then
randpktdump_bin="randpktdump\$(EXEEXT)"
randpktdump_man=""
else
randpktdump_bin=""
randpktdump_man=""
fi
AC_SUBST(randpktdump_bin)
AC_SUBST(randpktdump_man)
dnl libtool defs
#
# Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)

View File

@ -75,7 +75,9 @@ man1_MANS = \
@sshdump_man@ \
@randpktdump_man@
man4_MANS = @wiresharkfilter_man@
man4_MANS = \
@extcap_man@ \
@wiresharkfilter_man@
man_MANS =
# Build these in case a developer wants to read them and for the Debian
@ -86,7 +88,8 @@ noinst_DATA = asn2deb.1 asn2deb.html idl2deb.1 idl2deb.html idl2wrs.1 idl2wrs.ht
pkgdata_DATA = AUTHORS-SHORT $(top_srcdir)/docbook/ws.css wireshark.html \
tshark.html wireshark-filter.html capinfos.html editcap.html \
mergecap.html reordercap.html text2pcap.html dumpcap.html androiddump.html \
sshdump.html randpktdump.html rawshark.html dftest.html randpkt.html
sshdump.html randpktdump.html rawshark.html dftest.html randpkt.html \
extcap.html
#
# Build the short version of the authors file for the about dialog
@ -134,7 +137,7 @@ POD_CSS_URL ?= $(top_srcdir)/docbook/ws.css
--noindex \
$< > $@
# This rule needs to stay separate because of the --section option.
# These rules need to stay separate because of the --section option.
wireshark-filter.4: wireshark-filter.pod ../config.h
$(AM_V_POD2MAN)$(POD2MAN) \
--section=4 \
@ -142,6 +145,13 @@ wireshark-filter.4: wireshark-filter.pod ../config.h
--release=$(VERSION) \
$(srcdir)/wireshark-filter.pod > wireshark-filter.4
extcap.4: extcap.pod ../config.h
$(AM_V_POD2MAN)$(POD2MAN) \
--section=4 \
--center="The Wireshark Network Analyzer" \
--release=$(VERSION) \
$(srcdir)/extcap.pod > extcap.4
# These rules need to stay separate because each man page has a separate
# title. Using GNU make's pattern rules would allow these to be removed
# but at the cost of portability.
@ -159,6 +169,13 @@ wireshark-filter.html: wireshark-filter.pod ../config.h $(top_srcdir)/docbook/ws
--noindex \
$(srcdir)/wireshark-filter.pod > wireshark-filter.html
extcap.html: extcap.pod ../config.h $(top_srcdir)/docbook/ws.css
$(AM_V_POD2HTML)$(POD2HTML) \
--title="extcap - The Wireshark Network Analyzer $(VERSION)" \
--css=$(POD_CSS_URL) \
--noindex \
$(srcdir)/extcap.pod > extcap.html
capinfos.html: capinfos.pod ../config.h $(top_srcdir)/docbook/ws.css
$(AM_V_POD2HTML)$(POD2HTML) \
--title="capinfos - The Wireshark Network Analyzer $(VERSION)" \

View File

@ -49,8 +49,6 @@
#include "capture_opts.h"
#ifdef HAVE_EXTCAP
#include "extcap.h"
#include "extcap_parser.h"
@ -1064,7 +1062,6 @@ void extcap_debug_arguments ( extcap_arg *arg_iter )
}
}
#endif
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html

View File

@ -35,8 +35,6 @@
#include <ui/capture_ui_utils.h>
#ifdef HAVE_EXTCAP
/* As boolean flags will be allowed any form of yes, true or any number != 0 (or starting with 0)
* The regex will be matched case-insensitive, so only the lower-case is defined here. */
#define EXTCAP_BOOLEAN_REGEX "^.*([yt1-9])"
@ -110,8 +108,6 @@ extcap_cleanup(capture_options * capture_opts _U_);
#endif
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*

View File

@ -32,6 +32,11 @@ BUILD_PIXBUF_CSOURCE = \
pixbuf-csource.c
endif
if HAVE_EXTCAP
WIRESHARK_COMMON_GTK_SRC += extcap_gtk.c
WIRESHARK_COMMON_GTK_HDRS += extcap_gtk.h
endif
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GTK_CFLAGS) \
$(PORTAUDIO_INCLUDES)

View File

@ -57,7 +57,6 @@ WIRESHARK_COMMON_GTK_SRC = \
expert_comp_table.c \
export_object_dlg.c \
export_sslkeys.c \
extcap_gtk.c \
filter_autocomplete.c \
file_dlg.c \
file_import_dlg.c \
@ -181,7 +180,6 @@ WIRESHARK_COMMON_GTK_HDRS = \
export_object_dlg.h \
export_pdu_dlg.h \
export_sslkeys.h \
extcap_gtk.h \
file_dlg.h \
file_import_dlg.h \
fileset_dlg.h \

View File

@ -36,7 +36,8 @@ WIRESHARK_CLEAN_LIBGTKUI_SRC = \
airpcap_gui_utils.c \
capture_if_details_dlg_win32.c \
main_airpcap_toolbar.c \
pixbuf-csource.c
pixbuf-csource.c \
extcap_gtk.c
WIRESHARK_LIBGTKUI_SRC = \
$(WIRESHARK_CLEAN_LIBGTKUI_SRC)

View File

@ -268,9 +268,11 @@ topic_action_url(topic_action_e action)
case(HELP_EXPERT_INFO_DIALOG):
url = user_guide_url("ChAdvExpert.html");
break;
#ifdef HAVE_EXTCAP
case(HELP_EXTCAP_OPTIONS_DIALOG):
url = user_guide_url("ChExtcapOptions.html");
break;
#endif
case(HELP_STATS_SUMMARY_DIALOG):
url = user_guide_url("ChStatSummary.html");
break;

View File

@ -86,7 +86,7 @@ typedef enum {
HELP_FOLLOW_STREAM_DIALOG,
HELP_SHOW_PACKET_BYTES_DIALOG,
HELP_EXPERT_INFO_DIALOG,
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
HELP_EXTCAP_OPTIONS_DIALOG,
#endif
HELP_STATS_SUMMARY_DIALOG,

View File

@ -43,6 +43,26 @@ MAINTAINERCLEANFILES = \
$(NODIST_GENERATED_FILES) \
Makefile.in
if HAVE_EXTCAP
NODIST_GENERATED_HEADER_FILES += \
ui_extcap_options_dialog.h
MOC_HDRS += \
extcap_argument.h \
extcap_argument_file.h \
extcap_argument_multiselect.h \
extcap_options_dialog.h
UI_FILES += \
extcap_options_dialog.ui
WIRESHARK_QT_SRC += \
extcap_argument.cpp \
extcap_argument_file.cpp \
extcap_argument_multiselect.cpp \
extcap_options_dialog.cpp
endif
#
# Build "wireshark-tap-register.c", which contains a function
# "register_all_tap_listeners()"

View File

@ -49,7 +49,6 @@ NODIST_GENERATED_HEADER_FILES = \
ui_expert_info_dialog.h \
ui_export_object_dialog.h \
ui_export_pdu_dialog.h \
ui_extcap_options_dialog.h \
ui_file_set_dialog.h \
ui_filter_dialog.h \
ui_filter_expression_frame.h \
@ -180,10 +179,6 @@ MOC_HDRS = \
export_dissection_dialog.h \
export_object_dialog.h \
export_pdu_dialog.h \
extcap_argument.h \
extcap_argument_file.h \
extcap_argument_multiselect.h \
extcap_options_dialog.h \
file_set_dialog.h \
filter_action.h \
filter_dialog.h \
@ -302,7 +297,6 @@ UI_FILES = \
expert_info_dialog.ui \
export_object_dialog.ui \
export_pdu_dialog.ui \
extcap_options_dialog.ui \
file_set_dialog.ui \
filter_dialog.ui \
filter_expression_frame.ui \
@ -451,10 +445,6 @@ WIRESHARK_QT_SRC = \
export_dissection_dialog.cpp \
export_object_dialog.cpp \
export_pdu_dialog.cpp \
extcap_argument.cpp \
extcap_argument_file.cpp \
extcap_argument_multiselect.cpp \
extcap_options_dialog.cpp \
file_set_dialog.cpp \
filter_action.cpp \
filter_dialog.cpp \

View File

@ -119,6 +119,7 @@ const QString AboutDialog::plugins_scan()
.arg(short_file);
}
#ifdef HAVE_EXTCAP
GHashTable * tools = extcap_tools_list();
if (tools && g_hash_table_size(tools) > 0) {
QString short_file;
@ -136,6 +137,7 @@ const QString AboutDialog::plugins_scan()
walker = g_list_next(walker);
}
}
#endif
return plugin_table;
}

View File

@ -159,7 +159,7 @@ void InterfaceTree::display()
{
#ifdef HAVE_LIBPCAP
interface_t device;
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
QIcon extcap_icon(StockIcon("x-capture-options"));
#endif
@ -209,7 +209,7 @@ void InterfaceTree::display()
ti->setData(IFTREE_COL_NAME, Qt::UserRole, QString(device.name));
ti->setData(IFTREE_COL_STATS, Qt::UserRole, qVariantFromValue(&ti->points));
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
if (device.if_info.type == IF_EXTCAP) {
if (extcap_has_configuration((const char *)(device.name), FALSE)) {
ti->setIcon(IFTREE_COL_EXTCAP, extcap_icon);
@ -248,7 +248,7 @@ void InterfaceTree::display()
resizeColumnToContents(IFTREE_COL_NAME);
resizeColumnToContents(IFTREE_COL_STATS);
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
resizeColumnToContents(IFTREE_COL_EXTCAP);
#endif

View File

@ -41,7 +41,7 @@ typedef QList<int> PointList;
enum InterfaceTreeColumns
{
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
IFTREE_COL_EXTCAP,
#endif
IFTREE_COL_NAME,

View File

@ -53,7 +53,7 @@
#define VERSION_FLAVOR ""
#endif
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
#include <extcap.h>
#endif
@ -165,7 +165,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
connect(welcome_ui_->interfaceTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(interfaceDoubleClicked(QTreeWidgetItem*,int)));
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
connect(welcome_ui_->interfaceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(interfaceClicked(QTreeWidgetItem*,int)));
#endif
@ -306,7 +306,7 @@ void MainWelcome::interfaceSelected()
void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int)
{
if (item) {
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
QString extcap_string = QVariant(item->data(IFTREE_COL_EXTCAP, Qt::UserRole)).toString();
/* We trust the string here. If this interface is really extcap, the string is
* being checked immediatly before the dialog is being generated */
@ -323,9 +323,9 @@ void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int)
}
}
#ifdef HAVE_EXTCAP
void MainWelcome::interfaceClicked(QTreeWidgetItem *item, int column)
{
#if HAVE_EXTCAP
if (column == IFTREE_COL_EXTCAP) {
QString extcap_string = QVariant(item->data(IFTREE_COL_EXTCAP, Qt::UserRole)).toString();
/* We trust the string here. If this interface is really extcap, the string is
@ -335,8 +335,8 @@ void MainWelcome::interfaceClicked(QTreeWidgetItem *item, int column)
emit showExtcapOptions(device_name);
}
}
#endif
}
#endif
void MainWelcome::updateRecentFiles() {
QString itemLabel;

View File

@ -68,7 +68,7 @@ signals:
void pushFilterSyntaxStatus(const QString&);
void popFilterSyntaxStatus();
void captureFilterSyntaxChanged(bool valid);
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
void showExtcapOptions(QString &device_name);
#endif
@ -78,7 +78,7 @@ public slots:
private slots:
void appInitialized();
void captureFilterTextEdited(const QString capture_filter);
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
void interfaceClicked(QTreeWidgetItem *item, int column);
#endif
void interfaceDoubleClicked(QTreeWidgetItem *item, int column);

View File

@ -646,7 +646,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(main_ui_->welcomePage, SIGNAL(captureFilterSyntaxChanged(bool)),
this, SLOT(captureFilterSyntaxChanged(bool)));
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
connect(this->main_welcome_, SIGNAL(showExtcapOptions(QString&)),
this, SLOT(showExtcapOptionsDialog(QString&)));
#endif

View File

@ -608,7 +608,7 @@ private slots:
void changeEvent(QEvent* event);
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
void extcap_options_finished(int result);
void showExtcapOptionsDialog(QString & device_name);
#endif

View File

@ -96,7 +96,7 @@
#include "expert_info_dialog.h"
#include "export_object_dialog.h"
#include "export_pdu_dialog.h"
#if HAVE_EXTCAP
#ifdef HAVE_EXTCAP
#include "extcap_options_dialog.h"
#endif
#include "filter_action.h"