Add a "capture_errs.c" routine to cough up error messages for capture
problems, and use the first routine in it in multiple places. Get rid of DISSECTOR_SUPPORT_INCLUDES - just add its contents to ETHEREAL_COMMON_INCLUDES. svn path=/trunk/; revision=16109
This commit is contained in:
parent
e1ebb0953d
commit
bfcbcfb4ea
|
@ -23,18 +23,6 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# XXX - this is used by dissectors and by other parts of Ethereal.
|
||||
# Ultimately, we need to handle strings "right", so that we can handle
|
||||
# strings in protocols that are in various encodings, and figure out
|
||||
# properly whether a given character can be {displayed in the GUI,
|
||||
# printed to a printout, written to a file} internally to the routines
|
||||
# handling that, with a scheme more sophisticated than "if it ain't
|
||||
# ASCII it ain't ....".
|
||||
#
|
||||
DISSECTOR_SUPPORT_INCLUDES = \
|
||||
isprint.h
|
||||
|
||||
# "BUILT_SOURCES" are built before any "make all" or "make check" targets.
|
||||
BUILT_HEADER_FILES = \
|
||||
svnversion.h
|
||||
|
@ -59,6 +47,7 @@ GENERATED_FILES = $(GENERATED_C_FILES) $(GENERATED_HEADER_FILES)
|
|||
# sources common for ethereal and tethereal
|
||||
ETHEREAL_COMMON_SRC = \
|
||||
$(PLATFORM_SRC) \
|
||||
capture_errs.c \
|
||||
capture_stop_conditions.c \
|
||||
capture_ui_utils.c \
|
||||
cfile.c \
|
||||
|
@ -76,8 +65,8 @@ ETHEREAL_COMMON_SRC = \
|
|||
|
||||
# corresponding headers
|
||||
ETHEREAL_COMMON_INCLUDES = \
|
||||
$(DISSECTOR_SUPPORT_INCLUDES) \
|
||||
svnversion.h \
|
||||
capture_errs.h \
|
||||
capture_stop_conditions.h \
|
||||
capture_ui_utils.h \
|
||||
cfile.h \
|
||||
|
@ -87,6 +76,7 @@ ETHEREAL_COMMON_INCLUDES = \
|
|||
disabled_protos.h \
|
||||
file.h \
|
||||
fileset.h \
|
||||
isprint.h \
|
||||
packet-range.h \
|
||||
pcap-util.h \
|
||||
pcap-util-int.h \
|
||||
|
@ -212,7 +202,6 @@ randpkt_SOURCES = \
|
|||
|
||||
# this target needed for distribution only
|
||||
noinst_HEADERS = \
|
||||
$(DISSECTOR_SUPPORT_INCLUDES) \
|
||||
$(ETHEREAL_COMMON_INCLUDES) \
|
||||
$(ethereal_INCLUDES) \
|
||||
$(EXTRA_ethereal_INCLUDES)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* capture_errs.c
|
||||
* Routines to return error and warning messages for packet capture
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
||||
#include "capture_errs.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
char *
|
||||
cant_load_winpcap_err(const char *app_name)
|
||||
{
|
||||
return g_strdup_printf(
|
||||
"Unable to load WinPcap (wpcap.dll); %s will not be able to capture\n"
|
||||
"packets.\n"
|
||||
"\n"
|
||||
"In order to capture packets, WinPcap must be installed; see\n"
|
||||
"\n"
|
||||
" http://www.winpcap.org/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://winpcap.mirror.ethereal.com/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
|
||||
"\n"
|
||||
"for a downloadable version of WinPcap and for instructions on how to install\n"
|
||||
"WinPcap.",
|
||||
app_name);
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#endif /* HAVE_LIBPCAP */
|
|
@ -0,0 +1,32 @@
|
|||
/* capture_errs.h
|
||||
* Declarations of routines to return error and warning messages for
|
||||
* packet capture
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
||||
#ifdef _WIN32
|
||||
extern const char *cant_load_winpcap_err(void);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#endif /* HAVE_LIBPCAP */
|
|
@ -40,6 +40,7 @@
|
|||
#include "gui_utils.h"
|
||||
#include "capture.h"
|
||||
#include "capture_dlg.h"
|
||||
#include "capture_errs.h"
|
||||
#include "filter_dlg.h"
|
||||
#include "simple_dialog.h"
|
||||
#include "dlg_utils.h"
|
||||
|
@ -563,24 +564,12 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
#ifdef _WIN32
|
||||
/* Is WPcap loaded? */
|
||||
if (!has_wpcap) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Unable to load WinPcap (wpcap.dll); Ethereal will not be able\n"
|
||||
"to capture packets.\n\n"
|
||||
"In order to capture packets, WinPcap must be installed; see\n"
|
||||
"\n"
|
||||
" http://www.winpcap.org/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://winpcap.mirror.ethereal.com/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
|
||||
"\n"
|
||||
"for a downloadable version of WinPcap and for instructions\n"
|
||||
"on how to install WinPcap.");
|
||||
return;
|
||||
char *detailed_err;
|
||||
|
||||
detailed_err = cant_load_winpcap_err();
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", detailed_err);
|
||||
g_free(detailed_err);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "capture.h"
|
||||
#include "capture_dlg.h"
|
||||
#include "capture_if_details_dlg.h"
|
||||
#include "capture_errs.h"
|
||||
|
||||
#include "gui_utils.h"
|
||||
#include "dlg_utils.h"
|
||||
|
@ -352,24 +353,12 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
#ifdef _WIN32
|
||||
/* Is WPcap loaded? */
|
||||
if (!has_wpcap) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Unable to load WinPcap (wpcap.dll); Ethereal will not be able\n"
|
||||
"to capture packets.\n\n"
|
||||
"In order to capture packets, WinPcap must be installed; see\n"
|
||||
"\n"
|
||||
" http://www.winpcap.org/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://winpcap.mirror.ethereal.com/\n"
|
||||
"\n"
|
||||
"or the mirror at\n"
|
||||
"\n"
|
||||
" http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
|
||||
"\n"
|
||||
"for a downloadable version of WinPcap and for instructions\n"
|
||||
"on how to install WinPcap.");
|
||||
return;
|
||||
char *detailed_err;
|
||||
|
||||
detailed_err = cant_load_winpcap_err();
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", detailed_err);
|
||||
g_free(detailed_err);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1367,7 +1367,12 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
if (!has_wpcap) {
|
||||
fprintf(stderr, "tethereal: Could not load wpcap.dll.\n");
|
||||
char *detailed_err;
|
||||
|
||||
fprintf(stderr, "tethereal: WinPcap couldn't be found.\n");
|
||||
detailed_err = cant_load_winpcap_err("Tethereal");
|
||||
fprintf(stderr, "%s\n", detailed_err);
|
||||
g_free(detailed_err);
|
||||
exit(2);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue