Merge in the final code to make Ethereal run on Win32, compiled

with MSVC 6.0 and 'nmake', the make tool that comes with MSVC.

It compiles, links, and runs. It doesn't run correctly. There's a problem
when reading files. I'm getting short reads.  I'm not linking in zlib or
libsnmp because it first needs to be debugged.

I changed the plugin code to use gmodule instead of libltdl, but the
Unix build still links ethereal against libltdl. I'll fix that tonight; sorry
about leaving it in such a sad state, but I wanted to check in this code
before I left work on a Friday night. Ethereal still works, but the
building is less than optimal.

svn path=/trunk/; revision=1479
This commit is contained in:
Gilbert Ramirez 2000-01-15 00:23:13 +00:00
parent dbf3bf6177
commit 339d67b043
24 changed files with 353 additions and 255 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.151 2000/01/14 07:51:14 guy Exp $
# $Id: Makefile.am,v 1.152 2000/01/15 00:22:28 gram Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -252,6 +252,7 @@ EXTRA_ethereal_SOURCES = \
strerror.h \
strncasecmp.c \
mkstemp.c \
mkstemp.h \
inet_aton.c \
inet_pton.c \
inet_ntop.c

View File

@ -4,10 +4,9 @@
GTK_VERSION=1.3
GLIB_VERSION=1.3
GLIB_DIR=c:\prj\gtk+-win32\src\glib
GTK_DIR=c:\prj\gtk+-win32\src\gtk+
GLIB_DIR=T:\w32-ix86\glib
GTK_DIR=T:\w32-ix86\gtk+
#LOCAL_CFLAGS=/Ic:\tools\msdev\include
LOCAL_CFLAGS=
############### no need to modify below this line #########
@ -18,141 +17,160 @@ LINK= link
LDFLAGS = /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /MACHINE:I386 \
/OUT:ethereal.exe
CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) /I$(GLIB_DIR) /I$(GTK_DIR) /Iwiretap \
/I$(GTK_DIR)\gdk\win32
CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) /I$(GLIB_DIR) /I$(GLIB_DIR)\gmodule \
/I$(GTK_DIR) /Iwiretap /I$(GTK_DIR)\gdk /I$(GTK_DIR)\gdk\win32
OBJECTS=packet-aarp.obj \
packet-afs.obj \
packet-arp.obj \
packet-ascend.obj \
DISSECTOR_OBJECTS = \
packet-aarp.obj \
packet-afs.obj \
packet-arp.obj \
packet-ascend.obj\
packet-atalk.obj \
packet-atm.obj \
packet-auto-rp.obj \
packet-bgp.obj \
packet-atm.obj \
packet-auto_rp.obj \
packet-bgp.obj \
packet-bootp.obj \
packet-bootparams.obj \
packet-bpdu.obj \
packet-cdp.obj \
packet-clip.obj \
packet-data.obj \
packet-dns.obj \
packet-eth.obj \
packet-fddi.obj \
packet-ftp.obj \
packet-giop.obj \
packet-gre.obj \
packet-hsrp.obj \
packet-http.obj \
packet-icmpv6.obj \
packet-icp.obj \
packet-icq.obj \
packet-imap.obj \
packet-ip.obj \
packet-bpdu.obj \
packet-cdp.obj \
packet-clip.obj \
packet-data.obj \
packet-dns.obj \
packet-eth.obj \
packet-fddi.obj \
packet-ftp.obj \
packet-giop.obj \
packet-gre.obj \
packet-hsrp.obj \
packet-http.obj \
packet-icmpv6.obj\
packet-icp.obj \
packet-icq.obj \
packet-imap.obj \
packet-ip.obj \
packet-ipp.obj \
packet-ipsec.obj \
packet-ipv6.obj \
packet-ipx.obj \
packet-irc.obj \
packet-isakmp.obj \
packet-isis.obj \
packet-ipv6.obj \
packet-ipx.obj \
packet-irc.obj \
packet-isakmp.obj\
packet-isis.obj \
packet-isis-clv.obj \
packet-isis-hello.obj \
packet-isis-lsp.obj \
packet-isis-snp.obj \
packet-lapb.obj \
packet-lapd.obj \
packet-ldap.obj \
packet-llc.obj \
packet-lpd.obj \
packet-mapi.obj \
packet-l2tp.obj \
packet-lapb.obj \
packet-lapd.obj \
packet-ldap.obj \
packet-llc.obj \
packet-lpd.obj \
packet-mapi.obj \
packet-mount.obj \
packet-nbipx.obj \
packet-nbns.obj \
packet-ncp.obj \
packet-nbns.obj \
packet-ncp.obj \
packet-netbios.obj \
packet-nfs.obj \
packet-nlm.obj \
packet-nntp.obj \
packet-null.obj \
packet-osi.obj \
packet-ospf.obj \
packet-pim.obj \
packet-pop.obj \
packet-portmap.obj \
packet-ppp.obj \
packet-nfs.obj \
packet-nlm.obj \
packet-nntp.obj \
packet-ntp.obj \
packet-null.obj \
packet-osi.obj \
packet-ospf.obj \
packet-pim.obj \
packet-pop.obj \
packet-portmap.obj \
packet-ppp.obj \
packet-pppoe.obj \
packet-pptp.obj \
packet-pptp.obj \
packet-q2931.obj \
packet-q931.obj \
packet-radius.obj \
packet-raw.obj \
packet-rip.obj \
packet-q931.obj \
packet-radius.obj\
packet-raw.obj \
packet-rip.obj \
packet-ripng.obj \
packet-rpc.obj \
packet-rsvp.obj \
packet-rtsp.obj \
packet-rx.obj \
packet-sap.obj \
packet-sdp.obj \
packet-smb.obj \
packet-sna.obj \
packet-snmp.obj \
packet-rpc.obj \
packet-rsvp.obj \
packet-rtsp.obj \
packet-rx.obj \
packet-sap.obj \
packet-sdp.obj \
packet-smb.obj \
packet-sna.obj \
packet-snmp.obj \
packet-srvloc.obj \
packet-sscop.obj \
packet-stat.obj \
packet-stat.obj \
packet-tacacs.obj \
packet-tcp.obj \
packet-telnet.obj \
packet-tftp.obj \
packet-sns.obj \
packet-tr.obj \
packet-tcp.obj \
packet-telnet.obj\
packet-tftp.obj \
packet-tns.obj \
packet-tr.obj \
packet-trmac.obj \
packet-udp.obj \
packet-udp.obj \
packet-v120.obj \
packet-vines.obj \
packet-vlan.obj \
packet-vrrp.obj \
packet-wccp.obj \
packet-who.obj \
packet-x25.obj \
packet-yhoo.obj \
packet-wccp.obj\
packet-who.obj\
packet-x25.obj \
packet-yhoo.obj \
packet-ypbind.obj \
packet-ypserv.obj \
packet-ypxfr.obj \
asn1.obj \
capture.obj \
colors.obj \
column.obj \
ETHEREAL_COMMON_OBJECTS = \
asn1.obj \
column.obj \
conversation.obj \
dfilter-grammar.obj \
dfilter-scanner.obj \
dfilter.obj \
ethertype.obj \
file.obj \
follow.obj \
ipproto.obj \
packet.obj \
prefs.obj \
print.obj \
proto.obj \
ps.obj \
register.obj \
resolv.obj \
summary.obj \
util.obj \
xdlc.obj \
snprintf.obj \
strerror.obj
dfilter.obj \
ethertype.obj \
follow.obj \
ipproto.obj \
ipv4.obj \
packet.obj \
plugins.obj \
prefs.obj \
print.obj \
proto.obj \
ps.obj \
register.obj \
resolv.obj \
util.obj \
xdlc.obj \
ethereal_OBJECTS = \
$(DISSECTOR_OBJECTS) \
$(ETHEREAL_COMMON_OBJECTS) \
capture.obj \
colors.obj \
file.obj \
summary.obj \
EXTRA_ethereal_OBJECTS = \
snprintf.obj \
strerror.obj \
mkstemp.obj \
inet_aton.obj \
inet_pton.obj \
inet_ntop.obj
LIBS= wiretap\libwtap.lib gtk\libui.lib wsock32.lib \
$(GTK_DIR)\gtk\gtk-$(GTK_VERSION).lib \
$(GTK_DIR)\gdk\win32\gdk-$(GTK_VERSION).lib \
$(GTK_DIR)\gdk\gdk-$(GTK_VERSION).lib \
$(GLIB_DIR)\glib-$(GLIB_VERSION).lib \
$(GLIB_DIR)\gmodule-$(GLIB_VERSION).lib
ethereal.exe : config.h $(OBJECTS)
ethereal.exe : config.h $(ethereal_OBJECTS) $(EXTRA_ethereal_OBJECTS)
$(LINK) @<<
$(LDFLAGS) $(LIBS) $(OBJECTS)
$(LDFLAGS) $(LIBS) $(ethereal_OBJECTS) $(EXTRA_ethereal_OBJECTS)
<<
config.h : config.h.win32

View File

@ -1,4 +1,4 @@
$Id: README.win32,v 1.2 1999/07/21 17:40:34 gram Exp $
$Id: README.win32,v 1.3 2000/01/15 00:22:28 gram Exp $
Ethereal can be compiled on Win32 platforms. Some libraries are
needed, however.
@ -7,29 +7,35 @@ The glib, gtk, glib-dev, and gtk-dev packages for win32 can be found
at http://www.gimp.org/~tml/gimp/win32 You will definitely need these.
Download them and unpack them.
I have seen mention of a UCD SNMP library for win32 on the cygwin
home page, but I have not tried it with ethereal.
The UCD SNMP library for win32 can be had from
ftp://ftp.revelstone.com/pub/snmp/, but it has not been tested
with Ethereal.
There is no open-source libpcap for win32 yet.
The win32 versions of libpcap have not been integrated into
Ethereal yet.
Zlib (or 'libz') is available for Win32 from
http://www.winimage.com/zLibDll/
Instructions for MS Visual C
----------------------------
Modify the top lines of Makefile.nmake and wiretap/Makefile.nmake to
point to the glib and gtk directories.
Modify the top lines of Makefile.nmake, wiretap/Makefile.nmake, and
gtk/Makefile.nmake to point to your glib and gtk directories.
Be sure to set your %lib% environment variable to point to the msvc
lib directory. Example:
set lib=c:/tools/msdev/lib
Be sure that your command-line environment is set up to compile
and linke with MSVC. When installing MSVC, you can have your
system's environment set up to always allow compiling from the
command line, or you can invoke the vcvars32.bat script.
In the wiretap directory, type "nmake -f makefile.nmake"
In the gtk directory, type "nmake -f makefile.nmake"
Then in the ethereal directory, type "nmake -f makefile.nmake"
You must set your HOME environment variable for ethereal to work.
Make sure the glib and gtk DLL's are in your path when you run
ethereal.
ethereal. This includes gtk-*.dll, glib-*.dll, gmodule-*.dll, gdk-*.dll,
and gthread-*.dll
Instructions for cygwin
-----------------------

View File

@ -1,7 +1,7 @@
/* acconfig.h
* #ifdefs to be controlled by "configure"
*
* $Id: acconfig.h,v 1.13 1999/12/28 04:40:05 gerald Exp $
* $Id: acconfig.h,v 1.14 2000/01/15 00:22:29 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -37,4 +37,6 @@
#undef NEED_STRERROR_H
#undef NEED_MKSTEMP
#undef PLUGIN_DIR

6
asn1.c
View File

@ -1,7 +1,7 @@
/* asn1.c
* Routines for ASN.1 BER dissection
*
* $Id: asn1.c,v 1.2 1999/12/10 09:49:26 guy Exp $
* $Id: asn1.c,v 1.3 2000/01/15 00:22:29 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -65,6 +65,10 @@
# include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#include <glib.h>
#include "asn1.h"

View File

@ -8,102 +8,79 @@
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
/* #undef HAVE_SA_LEN */
#define DATAFILE_DIR "/usr/local/etc"
/* #undef NEED_INET_V6DEFS_H */
#define PLUGIN_DIR "/usr/local/lib/ethereal/plugins/0.8"
/* #undef NEED_SNPRINTF_H */
/* #undef NEED_STRERROR_H */
/* Define if you have the pcap library (-lpcap). */
/* #define HAVE_LIBPCAP 1 */ /* although there are versions available */
/* #undef HAVE_LIBZ */ /* I think it might be available */
/* Define if you have the gethostbyname2 function. */
/* #undef HAVE_GETHOSTBYNAME2 */
/* Define if you have the getprotobynumber function. */
/* #undef HAVE_GETPROTOBYNUMBER */
/* Define if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */ /* XXX - use "LoadLibrary()"? */
#define NEED_MKSTEMP 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <net/if.h> header file. */
/* #undef HAVE_NET_IF_H */
/* Define if you have the <netdb.h> header file. */
/* #undef HAVE_NETDB_H */
/* Define if you have the <netinet/in.h> header file. */
/* #define HAVE_NETINET_IN_H 1 */
/* Define if you have the <snmp/snmp.h> header file. */
/* #undef HAVE_SNMP_SNMP_H */
/* Define if you have the <snmp/version.h> header file. */
/* #undef HAVE_SNMP_VERSION_H */
/* Define if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define if you have the <stddef.h> header file. */
/* #undef HAVE_STDDEF_H */
/* Define if you have the <sys/ioctl.h> header file. */
/* #undef HAVE_SYS_IOCTL_H */
/* Define if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
/* Define if you have the <sys/stat.h> header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define if you have the <sys/time.h> header file. */
/* #define HAVE_SYS_TIME_H 1 */
/* #undef HAVE_DIRENT_H 1 */
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H */
/* Define if you have the <ucd-snmp/snmp.h> header file. */
/* #undef HAVE_UCD_SNMP_SNMP_H */
/* Define if you have the <ucd-snmp/version.h> header file. */
/* #undef HAVE_UCD_SNMP_VERSION_H */
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define if you have the pcap library (-lpcap). */
/* #define HAVE_LIBPCAP 1 */
/* Define if you have the z library (-lz). */
/*#define HAVE_LIBZ 1*/
/* Name of package */
#define PACKAGE "ethereal"
/* Version number of package */
#define VERSION "0.8.0"
#define VERSION "0.8.1"
#define HAVE_WINSOCK_H 1
#define HAVE_DIRECT_H 1
#define HAVE_IO_H 1
#define NEED_INET_V6DEFS_H 1
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strncasecmp strnicmp
#define open _open
#define close _close
#define popen _popen
#define pclose _pclose
#ifndef WIN32
#define WIN32 1
#endif
#define HAVE_WINDOWS_H 1
#define HAVE_WINSOCK_H 1
#define HAVE_DIRECT_H 1
#define HAVE_IO_H 1
#define NEED_INET_V6DEFS_H 1
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strncasecmp strnicmp
#define open _open
#define close _close
#define popen _popen
#define pclose _pclose
/* Needed for zlib, according to http://www.winimage.com/zLibDll/ */
/*#define ZLIB_DLL 1
#define _WINDOWS 1*/
#define HAVE_PLUGINS 1

View File

@ -1,4 +1,4 @@
# $Id: configure.in,v 1.72 2000/01/10 17:32:50 gram Exp $
# $Id: configure.in,v 1.73 2000/01/15 00:22:29 gram Exp $
dnl
dnl Process this file with autoconf 2.13 or later to produce a
dnl configure script; 2.12 doesn't generate a "configure" script that
@ -153,7 +153,7 @@ fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h dirent.h)
AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
AC_CHECK_HEADERS(sys/wait.h sys/param.h)
AC_CHECK_HEADERS(netinet/in.h net/if.h)
@ -231,6 +231,7 @@ AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
if test "$ac_cv_func_mkstemp" = no ; then
MKSTEMP_C="mkstemp.c"
MKSTEMP_O="mkstemp.o"
AC_DEFINE(NEED_MKSTEMP)
fi
AC_SUBST(MKSTEMP_C)
AC_SUBST(MKSTEMP_O)

View File

@ -1,7 +1,7 @@
/* dfilter.h
* Definitions for display filters
*
* $Id: dfilter.h,v 1.14 1999/10/12 05:00:47 guy Exp $
* $Id: dfilter.h,v 1.15 2000/01/15 00:22:30 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -26,6 +26,10 @@
#ifndef __DFILTER_H__
#define __DFILTER_H__
#ifndef __PROTO_H__
#include "proto.h"
#endif
/* dfilter_error_msg is NULL if there was no error during dfilter_compile,
* otherwise it points to a displayable error message. */
extern gchar *dfilter_error_msg;

8
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.152 2000/01/13 00:53:09 guy Exp $
* $Id: file.c,v 1.153 2000/01/15 00:22:30 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -83,9 +83,7 @@
#include "conversation.h"
#include "globals.h"
#ifdef HAVE_DLFCN_H
#include "plugins.h"
#endif
extern GtkWidget *packet_list, *prog_bar, *info_bar, *byte_view, *tree_view;
extern guint file_ctx;
@ -534,13 +532,13 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf
proto_tree_free(protocol_tree);
}
else {
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
if (plugin_list)
protocol_tree = proto_tree_create_root();
#endif
dissect_packet(buf, fdata, protocol_tree);
fdata->passed_dfilter = TRUE;
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
if (protocol_tree)
proto_tree_free(protocol_tree);
#endif

View File

@ -1,36 +1,41 @@
GLIB_DIR=c:\prj\gtk+-win32\src\glib
GTK_DIR=c:\prj\gtk+-win32\src\gtk+
GLIB_DIR=T:\w32-ix86\glib
GTK_DIR=T:\w32-ix86\gtk+
#LOCAL_CFLAGS=/Ic:\tools\msdev\include
LOCAL_CFLAGS=
#################3
CFLAGS=/DHAVE_CONFIG_H /I$(GLIB_DIR) /I$(GTK_DIR) /I.. \
/I$(GTK_DIR)\gdk\win32 $(LOCAL_CFLAGS)
CFLAGS=/DHAVE_CONFIG_H /I.. /I../wiretap \
/I$(GLIB_DIR) /I$(GTK_DIR) /I$(GLIB_DIR)/gmodule \
/I$(GTK_DIR)\gdk /I$(GTK_DIR)\gdk\win32 $(LOCAL_CFLAGS)
# gtkclist.obj is not in here because it is gtk+-1.2 code,
# while the DLL for GTK+ on windows is gtk+-1.3, and there's
# some functions that have disappeared in gtk+-1.3. I might
# get around to #ifdef'ing them out in our gtkclist.c.
OBJECTS=capture_dlg.obj \
column_prefs.obj \
display_opts.obj \
file_dlg.obj \
filter_prefs.obj \
find_dlg.obj \
goto_dlg.obj \
gtkclist.obj \
gui_prefs.obj \
main.obj \
menu.obj \
plugins_dlg.obj \
prefs_dlg.obj \
print_dlg.obj \
print_prefs.c \
print_prefs.obj \
proto_draw.obj \
simple_dialog.obj \
stream_prefs.obj \
summary_dlg.obj \
ui_util.obj
libui.lib : config.h $(OBJECTS)
libui.lib : ..\config.h $(OBJECTS)
lib /out:libui.lib $(OBJECTS)
config.h : config.h.win32
copy config.h.win32 $@
..\config.h : ..\config.h.win32
copy ..\config.h.win32 ..\config.h

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.86 2000/01/12 22:07:56 oabad Exp $
* $Id: main.c,v 1.87 2000/01/15 00:22:51 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -53,6 +53,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_IO_H
#include <io.h> /* open/close on win32 */
#endif
#ifdef HAVE_DIRECT_H
#include <direct.h>
#endif
@ -1294,8 +1298,10 @@ main(int argc, char *argv[])
if (capture_option_specified)
fprintf(stderr, "This version of Ethereal was not built with support for capturing packets.\n");
#endif
#ifndef WIN32
if (arg_error)
print_usage();
#endif
#ifdef HAVE_LIBPCAP
if (start_capture) {
if (cf.iface == NULL) {

View File

@ -1,7 +1,7 @@
/* ethereal.h
* Global defines, etc.
*
* $Id: main.h,v 1.8 1999/12/10 06:28:23 guy Exp $
* $Id: main.h,v 1.9 2000/01/15 00:22:52 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -64,7 +64,7 @@ void file_quit_cmd_cb(GtkWidget *, gpointer);
void file_reload_cmd_cb(GtkWidget *, gpointer);
void file_print_cmd_cb(GtkWidget *, gpointer);
void file_print_packet_cmd_cb(GtkWidget *, gpointer);
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
void tools_plugins_cmd_cb(GtkWidget *, gpointer);
#endif
void expand_all_cb(GtkWidget *, gpointer);

View File

@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
* $Id: menu.c,v 1.15 2000/01/08 23:34:50 guy Exp $
* $Id: menu.c,v 1.16 2000/01/15 00:22:53 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -114,7 +114,7 @@ static GtkItemFactoryEntry menu_items[] =
{"/Display/Collapse _All", NULL, GTK_MENU_FUNC(collapse_all_cb), 0, NULL},
{"/Display/_Expand All", NULL, GTK_MENU_FUNC(expand_all_cb), 0, NULL},
{"/_Tools", NULL, NULL, 0, "<Branch>" },
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
{"/Tools/_Plugins...", NULL, GTK_MENU_FUNC(tools_plugins_cmd_cb), 0, NULL},
#endif
{"/Tools/_Follow TCP Stream", NULL, GTK_MENU_FUNC(follow_stream_cb), 0, NULL},

View File

@ -1,7 +1,7 @@
/* plugins_dlg.c
* Dialog boxes for plugins
*
* $Id: plugins_dlg.c,v 1.9 2000/01/04 20:37:18 oabad Exp $
* $Id: plugins_dlg.c,v 1.10 2000/01/15 00:22:53 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -27,7 +27,7 @@
#include "config.h"
#endif
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
#include <errno.h>
#include <sys/types.h>
@ -160,7 +160,6 @@ tools_plugins_cmd_cb(GtkWidget *widget, gpointer data)
gtk_widget_show(plugins_window);
lt_dlinit();
}
/*
@ -186,10 +185,16 @@ plugins_scan(GtkWidget *clist)
while (pt_plug)
{
plugent[0] = pt_plug->name;
plugent[1] = (gchar *)lt_dlsym(pt_plug->handle, "desc");
if (g_module_symbol(pt_plug->handle, "desc", &plugent[1]) == FALSE) {
/* This plugin fails; continue next plugin */
goto NEXT_PLUGIN;
}
plugent[2] = pt_plug->version;
plugent[3] = (pt_plug->enabled ? "Yes" : "No");
gtk_clist_append(GTK_CLIST(clist), plugent);
NEXT_PLUGIN:
pt_plug = pt_plug->next;
}
}
@ -240,8 +245,7 @@ plugins_enable_cb(GtkWidget *button, gpointer clist)
simple_dialog(ESD_TYPE_WARN, NULL, "Plugin not found");
return;
}
proto_init = (void (*)())lt_dlsym(pt_plug->handle, "proto_init");
if (proto_init)
if (g_module_symbol(pt_plug->handle, "proto_init", (void**)&proto_init) == TRUE)
proto_init();
gtk_clist_set_text(GTK_CLIST(clist), selected_row, 3, "Yes");
@ -370,7 +374,7 @@ filter_default_cb(GtkWidget *button, gpointer parent_w)
filter_entry = gtk_object_get_data(GTK_OBJECT(parent_w), PLUGINS_DFILTER_TE);
pt_plug = find_plugin(selected_name, selected_version);
filter_string = (gchar *)lt_dlsym(pt_plug->handle, "filter_string");
g_module_symbol(pt_plug->handle, "filter_string", &filter_string);
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter_string);
}
#endif

View File

@ -16,12 +16,22 @@
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
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef __set_errno
#define __set_errno(x) errno=(x)
@ -64,6 +74,7 @@ mkstemp (template)
}
/* We return the null string if we can't find a unique file name. */
template[0] = '\0';
return -1;
}

24
mkstemp.h Normal file
View File

@ -0,0 +1,24 @@
/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique.
Returns a file descriptor open on the file for reading and writing. */
int mkstemp (char *template);

View File

@ -1,7 +1,7 @@
/* packet-isis-lsp.c
* Routines for decoding isis lsp packets and their CLVs
*
* $Id: packet-isis-lsp.c,v 1.1 1999/12/15 04:34:18 guy Exp $
* $Id: packet-isis-lsp.c,v 1.2 2000/01/15 00:22:32 gram Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@ -37,12 +37,16 @@
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <netinet/in.h>
#ifdef HAVE_NET_INET_H
#include <net/inet.h>
#endif
#include "packet.h"
#include "resolv.h"
#include "packet-isis.h"
#include "packet-isis-clv.h"
#include "packet-isis-lsp.h"
#include "resolv.h"
/* lsp packets */
static int proto_isis_lsp = -1;

View File

@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
* $Id: packet-tcp.c,v 1.54 1999/12/09 20:54:32 guy Exp $
* $Id: packet-tcp.c,v 1.55 2000/01/15 00:22:33 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -51,9 +51,7 @@
# include "snprintf.h"
#endif
#ifdef HAVE_DLFCN_H
#include "plugins.h"
#endif
#ifndef __PACKET_IP_H__
#include "packet-ip.h"
@ -490,7 +488,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
if (packet_max > offset) {
/* try to apply the plugins */
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
plugin *pt_plug = plugin_list;
if (pt_plug) {

View File

@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
* $Id: packet-udp.c,v 1.45 2000/01/07 09:10:12 guy Exp $
* $Id: packet-udp.c,v 1.46 2000/01/15 00:22:33 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -44,9 +44,7 @@
#include "globals.h"
#include "resolv.h"
#ifdef HAVE_DLFCN_H
#include "plugins.h"
#endif
static int proto_udp = -1;
static int hf_udp_srcport = -1;
@ -247,7 +245,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
return;
/* try to apply the plugins */
#ifdef HAVE_DLFCN_H
#ifdef HAVE_PLUGINS
{
plugin *pt_plug = plugin_list;

View File

@ -1,7 +1,7 @@
/* plugins.c
* plugin routines
*
* $Id: plugins.c,v 1.4 2000/01/04 21:29:43 oabad Exp $
* $Id: plugins.c,v 1.5 2000/01/15 00:22:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -27,19 +27,35 @@
# include "config.h"
#endif
#ifdef HAVE_DLFCN_H
#include "plugins.h"
#ifdef HAVE_PLUGINS
#include <time.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_DIRECT_H
#include <direct.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "globals.h"
#include "plugins.h"
/* linked list of all plugins */
plugin *plugin_list;
@ -240,7 +256,11 @@ save_plugin_status()
if (!statusfile) {
pf_path = g_malloc(strlen(getenv("HOME")) + strlen(PF_DIR) + 2);
sprintf(pf_path, "%s/%s", getenv("HOME"), PF_DIR);
#ifdef WIN32
mkdir(pf_path);
#else
mkdir(pf_path, 0755);
#endif
g_free(pf_path);
statusfile=fopen(plugin_status_file, "w");
if (!statusfile) return -1;
@ -262,7 +282,7 @@ save_plugin_status()
* If necessary, enable the plugin, and change the filter.
*/
static void
check_plugin_status(gchar *name, gchar *version, lt_dlhandle handle,
check_plugin_status(gchar *name, gchar *version, GModule *handle,
gchar *filter_string, FILE *statusfile)
{
gchar *ref_string;
@ -285,9 +305,9 @@ check_plugin_status(gchar *name, gchar *version, lt_dlhandle handle,
else { /* found the plugin */
if (line[ref_string_len+1] == '1') {
enable_plugin(name, version);
proto_init = (void (*)())lt_dlsym(handle, "proto_init");
if (proto_init)
if (g_module_symbol(handle, "proto_init", (gpointer*)&proto_init) == TRUE) {
proto_init();
}
}
if (fgets(line, 512, statusfile) == NULL) return;
@ -307,7 +327,7 @@ plugins_scan_dir(const char *dirname)
DIR *dir; /* scanned directory */
struct dirent *file; /* current file */
gchar filename[512]; /* current file name */
lt_dlhandle handle; /* handle returned by dlopen */
GModule *handle; /* handle returned by dlopen */
gchar *name;
gchar *version;
gchar *protocol;
@ -318,7 +338,11 @@ plugins_scan_dir(const char *dirname)
int cr;
FILE *statusfile;
#ifdef WIN32
#define LT_LIB_EXT ".dll"
#else
#define LT_LIB_EXT ".la"
#endif
if (!plugin_status_file)
{
@ -341,34 +365,31 @@ plugins_scan_dir(const char *dirname)
sprintf(filename, "%s/%s", dirname, file->d_name);
if ((handle = lt_dlopen(filename)) == NULL) continue;
if ((handle = g_module_open(filename, 0)) == NULL) continue;
name = (gchar *)file->d_name;
if ((version = (gchar *)lt_dlsym(handle, "version")) == NULL)
if (g_module_symbol(handle, "version", (gpointer*)&version) == FALSE)
{
lt_dlclose(handle);
g_module_close(handle);
continue;
}
if ((protocol = (gchar *)lt_dlsym(handle, "protocol")) == NULL)
if (g_module_symbol(handle, "protocol", (gpointer*)&protocol) == FALSE)
{
lt_dlclose(handle);
g_module_close(handle);
continue;
}
if ((filter_string = (gchar *)lt_dlsym(handle, "filter_string")) == NULL)
if (g_module_symbol(handle, "filter_string", (gpointer*)&filter_string) == FALSE)
{
lt_dlclose(handle);
g_module_close(handle);
continue;
}
if (dfilter_compile(filter_string, &filter) != 0) {
lt_dlclose(handle);
g_module_close(handle);
continue;
}
if ((dissector = (void (*)(const u_char *, int,
frame_data *,
proto_tree *)) lt_dlsym(handle, "dissector")) == NULL)
{
if (g_module_symbol(handle, "dissector", (gpointer*)&dissector) == FALSE) {
if (filter != NULL)
dfilter_destroy(filter);
lt_dlclose(handle);
g_module_close(handle);
continue;
}
@ -384,7 +405,7 @@ plugins_scan_dir(const char *dirname)
name, version);
if (filter != NULL)
dfilter_destroy(filter);
lt_dlclose(handle);
g_module_close(handle);
continue;
}
if (statusfile) {

View File

@ -1,7 +1,7 @@
/* plugins.h
* definitions for plugins structures
*
* $Id: plugins.h,v 1.4 2000/01/04 20:37:07 oabad Exp $
* $Id: plugins.h,v 1.5 2000/01/15 00:22:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -26,10 +26,30 @@
#ifndef __PLUGINS_H__
#define __PLUGINS_H__
#include "ltdl.h"
#include <glib.h>
#include <gmodule.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#ifdef HAVE_DLFCN_H
#define HAVE_PLUGINS 1
#endif
#endif /* HAVE_CONFIG_H */
#ifndef __DFILTER_H__
#include "dfilter.h"
#endif
#ifndef __PACKET_H__
#include "packet.h"
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
typedef struct _plugin {
lt_dlhandle handle; /* handle returned by dlopen */
GModule *handle; /* handle returned by dlopen */
gchar *name; /* plugin name */
gchar *version; /* plugin version */
gboolean enabled; /* is it active ? */

6
util.c
View File

@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
* $Id: util.c,v 1.25 2000/01/10 17:32:53 gram Exp $
* $Id: util.c,v 1.26 2000/01/15 00:22:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -55,6 +55,10 @@
# include "snprintf.h"
#endif
#ifdef NEED_MKSTEMP
#include "mkstemp.h"
#endif
#include "util.h"
#ifdef HAVE_IO_H

View File

@ -1,5 +1,4 @@
GLIB_DIR=c:\prj\gtk+-win32\src\glib
#LOCAL_CFLAGS=/Ic:\tools\msdev\include
GLIB_DIR=T:\w32-ix86\glib
LOCAL_CFLAGS=
#################3

View File

@ -1,23 +1,12 @@
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
/* #undef HAVE_GLIB10 */
/* Define if you have the <netinet/in.h> header file. */
/* #undef HAVE_NETINET_IN_H */
/* Define if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H */
/* Define if you have the z library (-lz). */
/* #undef HAVE_LIBZ */
/*#define HAVE_LIBZ 1*/
/* Name of package */
#define PACKAGE "libwtap.a"
@ -27,5 +16,9 @@
#define HAVE_WINSOCK_H 1
#define HAVE_IO_H 1
#define open _open
#define close _close
#define open _open
#define close _close
/* Needed for zlib, according to http://www.winimage.com/zLibDll/ */
/*#define ZLIB_DLL 1
#define _WINDOWS 1*/