aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>1998-10-10 03:32:20 +0000
committerGerald Combs <gerald@wireshark.org>1998-10-10 03:32:20 +0000
commit1b26a7cdb777972eb23d0d7d0b320855c1a03877 (patch)
tree9232afabf0abc9a8e5f5243798fbcc25d4aaa725
parent54945ddd046378b83ea09c45c3c42293d20a0d77 (diff)
* OSPF alignment fixes (Gerald)
* FDDI support (Laurent, Guy) svn path=/trunk/; revision=36
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in27
-rw-r--r--NEWS7
-rw-r--r--VERSION2
-rw-r--r--acconfig.h2
-rw-r--r--capture.c12
-rw-r--r--config.h.in2
-rwxr-xr-xconfigure14
-rw-r--r--configure.in7
-rw-r--r--ethereal.h4
-rw-r--r--ethertype.c6
-rw-r--r--file.c6
-rw-r--r--filter.c81
-rw-r--r--filter.h31
-rw-r--r--follow.c10
-rw-r--r--menu.c4
-rw-r--r--packet-arp.c17
-rw-r--r--packet-eth.c8
-rw-r--r--packet-fddi.c136
-rw-r--r--packet-ip.c22
-rw-r--r--packet-llc.c6
-rw-r--r--packet-ospf.c201
-rw-r--r--packet-ppp.c6
-rw-r--r--packet-raw.c6
-rw-r--r--packet-trmac.c6
-rw-r--r--packet.c28
-rw-r--r--packet.h53
-rw-r--r--prefs.c41
-rw-r--r--prefs.h3
-rw-r--r--print.c39
-rw-r--r--print.h8
32 files changed, 500 insertions, 297 deletions
diff --git a/AUTHORS b/AUTHORS
index 5a8ba59ac6..5359eb8461 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,6 +37,7 @@ Laurent Deniel <deniel@worldnet.fr> {
Name resolution
Ethernet/Manufacturer files support
+ FDDI support
ISO/OSI CLNP/COTP support
Miscellaneous enhancements and fixes
}
diff --git a/Makefile.am b/Makefile.am
index 97644a0fcd..400cf7082d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,6 +18,7 @@ ethereal_SOURCES = \
packet-data.c \
packet-dns.c \
packet-eth.c \
+ packet-fddi.c \
packet-llc.c \
packet-lpd.c \
packet-ip.c \
diff --git a/Makefile.in b/Makefile.in
index bca521fc2b..58e55fa497 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -90,6 +90,7 @@ ethereal_SOURCES = \
packet-data.c \
packet-dns.c \
packet-eth.c \
+ packet-fddi.c \
packet-llc.c \
packet-lpd.c \
packet-ip.c \
@@ -162,11 +163,11 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ethereal_OBJECTS = capture.o ethereal.o ethertype.o file.o filter.o \
follow.o menu.o packet.o packet-arp.o packet-bootp.o packet-data.o \
-packet-dns.o packet-eth.o packet-llc.o packet-lpd.o packet-ip.o \
-packet-ipv6.o packet-ipx.o packet-ncp.o packet-null.o packet-osi.o \
-packet-ospf.o packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o \
-packet-tr.o packet-trmac.o packet-udp.o packet-vines.o prefs.o print.o \
-ps.o resolv.o util.o
+packet-dns.o packet-eth.o packet-fddi.o packet-llc.o packet-lpd.o \
+packet-ip.o packet-ipv6.o packet-ipx.o packet-ncp.o packet-null.o \
+packet-osi.o packet-ospf.o packet-ppp.o packet-raw.o packet-rip.o \
+packet-tcp.o packet-tr.o packet-trmac.o packet-udp.o packet-vines.o \
+prefs.o print.o ps.o resolv.o util.o
ethereal_LDADD = $(LDADD)
ethereal_LDFLAGS =
CFLAGS = @CFLAGS@
@@ -191,14 +192,14 @@ GZIP = --best
DEP_FILES = .deps/capture.P .deps/ethereal.P .deps/ethertype.P \
.deps/file.P .deps/filter.P .deps/follow.P .deps/menu.P \
.deps/packet-arp.P .deps/packet-bootp.P .deps/packet-data.P \
-.deps/packet-dns.P .deps/packet-eth.P .deps/packet-ip.P \
-.deps/packet-ipv6.P .deps/packet-ipx.P .deps/packet-llc.P \
-.deps/packet-lpd.P .deps/packet-ncp.P .deps/packet-null.P \
-.deps/packet-osi.P .deps/packet-ospf.P .deps/packet-ppp.P \
-.deps/packet-raw.P .deps/packet-rip.P .deps/packet-tcp.P \
-.deps/packet-tr.P .deps/packet-trmac.P .deps/packet-udp.P \
-.deps/packet-vines.P .deps/packet.P .deps/prefs.P .deps/print.P \
-.deps/ps.P .deps/resolv.P .deps/util.P
+.deps/packet-dns.P .deps/packet-eth.P .deps/packet-fddi.P \
+.deps/packet-ip.P .deps/packet-ipv6.P .deps/packet-ipx.P \
+.deps/packet-llc.P .deps/packet-lpd.P .deps/packet-ncp.P \
+.deps/packet-null.P .deps/packet-osi.P .deps/packet-ospf.P \
+.deps/packet-ppp.P .deps/packet-raw.P .deps/packet-rip.P \
+.deps/packet-tcp.P .deps/packet-tr.P .deps/packet-trmac.P \
+.deps/packet-udp.P .deps/packet-vines.P .deps/packet.P .deps/prefs.P \
+.deps/print.P .deps/ps.P .deps/resolv.P .deps/util.P
SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES)
OBJECTS = $(ethereal_OBJECTS)
diff --git a/NEWS b/NEWS
index 4d567509e1..cea8c5441d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+Overview of changes in Ethereal 0.3.18:
+
+* Lots of fixes from Guy Harris
+* Preferences dialog (Gerald)
+* OSPF alignment fixes (Gerald)
+* FDDI support (Laurent, Guy)
+
Overview of changes in Ethereal 0.3.17:
* Ethernet manufacturer support (Laurent)
diff --git a/VERSION b/VERSION
index e5a9958c32..8355eafc6f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.17
+0.3.18
diff --git a/acconfig.h b/acconfig.h
index adcccec427..ea2366596e 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -5,3 +5,5 @@
#undef HAVE_SOCKADDR_SA_LEN
#undef DATAFILE_DIR
+
+#undef NEED_SNPRINTF_H
diff --git a/capture.c b/capture.c
index cc0b0b546b..0f9a37951b 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.4 1998/09/29 21:39:28 hannes Exp $
+ * $Id: capture.c,v 1.5 1998/10/10 03:32:02 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -23,10 +23,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <pcap.h>
@@ -35,6 +40,10 @@
#include <sys/ioctl.h>
#include <net/if.h>
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
@@ -289,7 +298,6 @@ cap_prep_fs_cancel_cb(GtkWidget *w, gpointer data) {
void
capture_prep_ok_cb(GtkWidget *w, gpointer data) {
GtkWidget *if_cb, *file_te, *count_cb, *open_ck, *snap_sb;
- gchar *file;
gint open;
if_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data), cap_iface_key);
diff --git a/config.h.in b/config.h.in
index 638c031dd3..71da4bec07 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,6 +12,8 @@
#undef DATAFILE_DIR
+#undef NEED_SNPRINTF_H
+
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
diff --git a/configure b/configure
index 590d569fea..7f4e8ee915 100755
--- a/configure
+++ b/configure
@@ -694,7 +694,7 @@ fi
PACKAGE=ethereal
-VERSION=0.3.17
+VERSION=0.3.18
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -1696,15 +1696,16 @@ else
{ echo "configure: error: Function 'socket' not found." 1>&2; exit 1; }
fi
+
# If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
# then this won't work.
echo $ac_n "checking for snprintf""... $ac_c" 1>&6
-echo "configure:1703: checking for snprintf" >&5
+echo "configure:1704: checking for snprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1708 "configure"
+#line 1709 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char snprintf(); below. */
@@ -1727,7 +1728,7 @@ snprintf();
; return 0; }
EOF
-if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_snprintf=yes"
else
@@ -1744,7 +1745,10 @@ if eval "test \"`echo '$ac_cv_func_'snprintf`\" = yes"; then
SNPRINTF_C="" SNPRINTF_O=""
else
echo "$ac_t""no" 1>&6
-SNPRINTF_C="snprintf.c" SNPRINTF_O="snprintf.o"
+SNPRINTF_C="snprintf.c" SNPRINTF_O="snprintf.o" cat >> confdefs.h <<\EOF
+#define NEED_SNPRINTF_H 1
+EOF
+
fi
diff --git a/configure.in b/configure.in
index abe4aaded7..4872cc7ddc 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,8 @@
-# $Id: configure.in,v 1.5 1998/09/25 23:23:58 gerald Exp $
+# $Id: configure.in,v 1.6 1998/10/10 03:32:05 gerald Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etypes.h)
-AM_INIT_AUTOMAKE(ethereal, 0.3.17)
+AM_INIT_AUTOMAKE(ethereal, 0.3.18)
dnl Check for CPU / vendor / OS
AC_CANONICAL_HOST
@@ -62,10 +62,11 @@ AC_C_BIGENDIAN
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNC(socket,, AC_MSG_ERROR(Function 'socket' not found.))
+
# If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
# then this won't work.
AC_CHECK_FUNC(snprintf, SNPRINTF_C="" SNPRINTF_O="",
- SNPRINTF_C="snprintf.c" SNPRINTF_O="snprintf.o")
+ SNPRINTF_C="snprintf.c" SNPRINTF_O="snprintf.o" AC_DEFINE(NEED_SNPRINTF_H))
AC_SUBST(SNPRINTF_C)
AC_SUBST(SNPRINTF_O)
diff --git a/ethereal.h b/ethereal.h
index 6b70dd3c0d..504926eb2e 100644
--- a/ethereal.h
+++ b/ethereal.h
@@ -1,7 +1,7 @@
/* ethereal.h
* Global defines, etc.
*
- * $Id: ethereal.h,v 1.4 1998/09/27 22:12:23 gerald Exp $
+ * $Id: ethereal.h,v 1.5 1998/10/10 03:32:05 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -48,7 +48,7 @@
/* Byte ordering */
#ifndef BYTE_ORDER
- #define LITTLE_ENDIAN 1234
+ #define LITTLE_ENDIAN 4321
#define BIG_ENDIAN 1234
#ifdef WORDS_BIGENDIAN
#define BYTE_ORDER BIG_ENDIAN
diff --git a/ethertype.c b/ethertype.c
index a92af5b84a..38b2118beb 100644
--- a/ethertype.c
+++ b/ethertype.c
@@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
- * $Id: ethertype.c,v 1.4 1998/09/27 22:12:23 gerald Exp $
+ * $Id: ethertype.c,v 1.5 1998/10/10 03:32:06 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -30,6 +30,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <stdio.h>
diff --git a/file.c b/file.c
index beec62d06b..da0fc48e6f 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.5 1998/09/27 22:12:24 gerald Exp $
+ * $Id: file.c,v 1.6 1998/10/10 03:32:06 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -36,6 +36,10 @@
#include <sys/stat.h>
#include <errno.h>
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
diff --git a/filter.c b/filter.c
index 479cf59a34..3538839c03 100644
--- a/filter.c
+++ b/filter.c
@@ -1,7 +1,7 @@
/* filter.c
* Routines for managing filter sets
*
- * $Id: filter.c,v 1.3 1998/09/27 22:12:24 gerald Exp $
+ * $Id: filter.c,v 1.4 1998/10/10 03:32:07 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -42,10 +42,10 @@
extern capture_file cf;
-const gchar *fn_key = "filter_name";
-const gchar *fl_key = "filter_label";
+const gchar *fn_key = "filter_name";
+const gchar *fl_key = "filter_label";
+const gchar *cancel_key = "in_cancel_mode";
GtkWidget *filter_l, *chg_bt, *copy_bt, *del_bt, *name_te, *filter_te;
-gint in_cancel = FALSE;
GList *fl = NULL;
GList *
@@ -56,8 +56,6 @@ read_filter_list() {
gchar *name_begin, *name_end, *filt_begin;
int len, line = 0;
- in_cancel = FALSE;
-
/* To do: generalize this */
ff_path = (gchar *) g_malloc(strlen(getenv("HOME")) + strlen(ff_name) + 4);
sprintf(ff_path, "%s/%s", getenv("HOME"), ff_name);
@@ -103,27 +101,24 @@ read_filter_list() {
return fl;
}
-/* filter_sel_cb - Create and display the filter selection dialog. */
-/* Called when the 'Filter' menu item is selected. */
-void
-filter_sel_cb(GtkWidget *w, gpointer d) {
- GtkWidget *filter_w, *main_vb, *top_hb, *list_bb, *bbox,
- *new_bt, *ok_bt, *save_bt, *cancel_bt, *filter_sc, *nl_item,
- *nl_lb, *middle_hb, *name_lb, *bottom_hb, *filter_lb;
- GtkWidget *l_select = NULL;
- GList *flp = NULL;
- filter_def *filt;
+/* filter_sel_pg - Create and display the filter selection widgets. */
+/* Called when the 'Filter' preference notebook page is selected. */
+GtkWidget *
+filter_prefs_show() {
+ GtkWidget *main_vb, *top_hb, *list_bb, *new_bt, *filter_sc,
+ *nl_item, *nl_lb, *middle_hb, *name_lb, *bottom_hb,
+ *filter_lb;
+ GtkWidget *l_select = NULL;
+ GList *flp = NULL;
+ filter_def *filt;
fl = read_filter_list();
- filter_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(filter_w), "Ethereal: Filters");
-
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
- gtk_container_add(GTK_CONTAINER(filter_w), main_vb);
gtk_widget_show(main_vb);
+ gtk_object_set_data(GTK_OBJECT(main_vb), cancel_key, (gpointer)FALSE);
/* Top row: Filter list and buttons */
top_hb = gtk_hbox_new(FALSE, 5);
@@ -171,7 +166,7 @@ filter_sel_cb(GtkWidget *w, gpointer d) {
filter_l = gtk_list_new();
gtk_signal_connect(GTK_OBJECT(filter_l), "selection_changed",
- GTK_SIGNAL_FUNC(filter_sel_list_cb), NULL);
+ GTK_SIGNAL_FUNC(filter_sel_list_cb), main_vb);
gtk_container_add(GTK_CONTAINER(filter_sc), filter_l);
gtk_widget_show(filter_l);
@@ -219,36 +214,10 @@ filter_sel_cb(GtkWidget *w, gpointer d) {
gtk_box_pack_start(GTK_BOX(bottom_hb), filter_te, TRUE, TRUE, 3);
gtk_widget_show(filter_te);
- /* Button row: OK and cancel buttons */
- bbox = gtk_hbutton_box_new();
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
- gtk_container_add(GTK_CONTAINER(main_vb), bbox);
- gtk_widget_show(bbox);
-
- ok_bt = gtk_button_new_with_label ("OK");
- gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked",
- GTK_SIGNAL_FUNC(filter_sel_ok_cb), (gpointer) filter_w);
- gtk_container_add(GTK_CONTAINER(bbox), ok_bt);
- GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(ok_bt);
- gtk_widget_show(ok_bt);
-
- save_bt = gtk_button_new_with_label ("Save");
- gtk_signal_connect(GTK_OBJECT(save_bt), "clicked",
- GTK_SIGNAL_FUNC(filter_sel_save_cb), (gpointer) fl);
- gtk_container_add(GTK_CONTAINER(bbox), save_bt);
- gtk_widget_show(save_bt);
-
- cancel_bt = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect(GTK_OBJECT(cancel_bt), "clicked",
- GTK_SIGNAL_FUNC(filter_sel_cancel_cb), (gpointer) filter_w);
- gtk_container_add(GTK_CONTAINER(bbox), cancel_bt);
- gtk_widget_show(cancel_bt);
-
- gtk_widget_show(filter_w);
-
if (l_select)
gtk_list_select_child(GTK_LIST(filter_l), l_select);
+
+ return(main_vb);
}
void
@@ -274,7 +243,7 @@ filter_sel_list_cb(GtkWidget *l, gpointer data) {
/* Did you know that this function is called when the window is destroyed? */
/* Funny, that. */
- if (!in_cancel) {
+ if (!gtk_object_get_data(GTK_OBJECT(data), cancel_key)) {
gtk_entry_set_text(GTK_ENTRY(name_te), name);
gtk_entry_set_text(GTK_ENTRY(filter_te), strval);
gtk_widget_set_sensitive(chg_bt, sensitivity);
@@ -398,7 +367,7 @@ filter_sel_del_cb(GtkWidget *w, gpointer data) {
}
void
-filter_sel_ok_cb(GtkWidget *w, gpointer data) {
+filter_prefs_ok(GtkWidget *w) {
GList *flp, *sl;
GtkObject *l_item;
filter_def *filt;
@@ -418,11 +387,11 @@ filter_sel_ok_cb(GtkWidget *w, gpointer data) {
}
}
- filter_sel_cancel_cb(w, data);
+ filter_prefs_cancel(w);
}
void
-filter_sel_save_cb(GtkWidget *w, gpointer data) {
+filter_prefs_save(GtkWidget *w) {
GList *flp;
filter_def *filt;
gchar *ff_path, *ff_dir = ".ethereal", *ff_name = "filters";
@@ -452,7 +421,7 @@ filter_sel_save_cb(GtkWidget *w, gpointer data) {
}
void
-filter_sel_cancel_cb(GtkWidget *w, gpointer win) {
+filter_prefs_cancel(GtkWidget *w) {
filter_def *filt;
while (fl) {
@@ -467,6 +436,6 @@ filter_sel_cancel_cb(GtkWidget *w, gpointer win) {
/* Let the list cb know we're about to destroy the widget tree, so it */
/* doesn't operate on widgets that don't exist. */
- in_cancel = TRUE;
- gtk_widget_destroy(GTK_WIDGET(win));
+ gtk_object_set_data(GTK_OBJECT(w), cancel_key, (gpointer)TRUE);
+ gtk_widget_destroy(GTK_WIDGET(w));
}
diff --git a/filter.h b/filter.h
index e7b1e2205f..872e4aaf0a 100644
--- a/filter.h
+++ b/filter.h
@@ -1,7 +1,7 @@
/* filter.h
* Definitions for packet filter window
*
- * $Id: filter.h,v 1.2 1998/09/16 03:21:59 gerald Exp $
+ * $Id: filter.h,v 1.3 1998/10/10 03:32:08 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -36,22 +36,15 @@ typedef struct _filter_cb_data {
GtkWidget *win;
} filter_cb_data;
-GList *read_filter_list();
-void filter_sel_cb(GtkWidget *, gpointer);
-void filter_sel_list_cb(GtkWidget *, gpointer);
-void filter_sel_new_cb(GtkWidget *, gpointer);
-void filter_sel_chg_cb(GtkWidget *, gpointer);
-void filter_sel_copy_cb(GtkWidget *, gpointer);
-void filter_sel_del_cb(GtkWidget *, gpointer);
-void filter_sel_ok_cb(GtkWidget *, gpointer);
-void filter_sel_save_cb(GtkWidget *, gpointer);
-void filter_sel_cancel_cb(GtkWidget *, gpointer);
+GList *read_filter_list();
+GtkWidget *filter_prefs_show();
+void filter_sel_list_cb(GtkWidget *, gpointer);
+void filter_sel_new_cb(GtkWidget *, gpointer);
+void filter_sel_chg_cb(GtkWidget *, gpointer);
+void filter_sel_copy_cb(GtkWidget *, gpointer);
+void filter_sel_del_cb(GtkWidget *, gpointer);
+void filter_prefs_ok(GtkWidget *);
+void filter_prefs_save(GtkWidget *);
+void filter_prefs_cancel(GtkWidget *);
-/* GList *get_interface_list();
-void capture_prep_file_cb(GtkWidget *, gpointer);
-void cap_prep_fs_ok_cb(GtkWidget *, gpointer);
-void cap_prep_fs_cancel_cb(GtkWidget *, gpointer);
-void capture_prep_ok_cb(GtkWidget *, gpointer);
-void capture_prep_close_cb(GtkWidget *, gpointer);
- */
-#endif /* capture.h */
+#endif /* filter.h */
diff --git a/follow.c b/follow.c
index b68def625f..8a42705c2d 100644
--- a/follow.c
+++ b/follow.c
@@ -1,6 +1,6 @@
/* follow.c
*
- * $Id: follow.c,v 1.2 1998/09/27 22:12:25 gerald Exp $
+ * $Id: follow.c,v 1.3 1998/10/10 03:32:09 gerald Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
@@ -25,10 +25,18 @@
*
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtk/gtk.h>
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include "ethereal.h"
#include "packet.h"
#include "follow.h"
diff --git a/menu.c b/menu.c
index 08a5edd8b7..ebd61e122b 100644
--- a/menu.c
+++ b/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.5 1998/09/26 19:28:49 gerald Exp $
+ * $Id: menu.c,v 1.6 1998/10/10 03:32:09 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,7 +37,6 @@
#include "menu.h"
#include "ethereal.h"
#include "capture.h"
-#include "filter.h"
#include "packet.h"
#include "print.h"
#include "follow.h"
@@ -74,7 +73,6 @@ static GtkMenuEntry menu_items[] =
{"<Main>/Edit/<separator>", NULL, NULL, NULL},
{"<Main>/Edit/Preferences", NULL, prefs_cb, NULL},
{"<Main>/Tools/Capture", "<control>K", capture_prep_cb, NULL},
- {"<Main>/Tools/Filter", NULL, filter_sel_cb, NULL},
{"<Main>/Tools/Follow TCP Stream", NULL, follow_stream_cb, NULL},
{"<Main>/Tools/Graph", NULL, NULL, NULL},
{"<Main>/Help/About Ethereal", NULL, NULL, NULL}
diff --git a/packet-arp.c b/packet-arp.c
index 6df7a584eb..f8144b5e3d 100644
--- a/packet-arp.c
+++ b/packet-arp.c
@@ -1,7 +1,7 @@
/* packet-arp.c
* Routines for ARP packet disassembly
*
- * $Id: packet-arp.c,v 1.3 1998/09/27 22:12:26 gerald Exp $
+ * $Id: packet-arp.c,v 1.4 1998/10/10 03:32:10 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -48,9 +48,12 @@ void
dissect_arp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
e_ether_arp *ea;
guint16 ar_hrd, ar_pro, ar_op;
- gchar *req_type[] = { "ARP request", "ARP reply",
- "RARP request", "RARP reply" };
GtkWidget *arp_tree, *ti;
+ gchar *op_str;
+ value_string op_vals[] = { ARPOP_REQUEST, "ARP request",
+ ARPOP_REPLY, "ARP reply",
+ ARPOP_RREQUEST, "RARP request",
+ ARPOP_RREPLY, "RARP reply" };
/* To do: Check for {cap len,pkt len} < struct len */
ea = (e_ether_arp *) &pd[offset];
@@ -62,7 +65,11 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], "ARP"); }
if (tree) {
- ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28, req_type[ar_op - 1]);
+ if (op_str = match_strval(ar_op, op_vals, 4))
+ ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28, op_str);
+ else
+ ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28,
+ "Unkown ARP (opcode 0x%04x)", ar_op);
arp_tree = gtk_tree_new();
add_subtree(ti, arp_tree, ETT_ARP);
add_item_to_tree(arp_tree, offset, 2,
@@ -74,7 +81,7 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
add_item_to_tree(arp_tree, offset + 5, 1,
"Protocol size: 0x%02x", ea->ar_pln);
add_item_to_tree(arp_tree, offset + 6, 2,
- "Opcode: 0x%04x", ar_op);
+ "Opcode: 0x%04x (%s)", ar_op, op_str ? op_str : "Unknown");
add_item_to_tree(arp_tree, offset + 8, 6,
"Sender ether: %s", ether_to_str((guint8 *) ea->arp_sha));
add_item_to_tree(arp_tree, offset + 14, 4,
diff --git a/packet-eth.c b/packet-eth.c
index 7806a9f966..c33ec5039c 100644
--- a/packet-eth.c
+++ b/packet-eth.c
@@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
- * $Id: packet-eth.c,v 1.4 1998/09/27 22:12:29 gerald Exp $
+ * $Id: packet-eth.c,v 1.5 1998/10/10 03:32:11 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -27,6 +27,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <stdio.h>
@@ -56,7 +60,7 @@ void
dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
guint16 etype, length;
int offset = 14;
- GtkWidget *fh_tree, *ti;
+ GtkWidget *fh_tree = NULL, *ti;
int ethhdr_type; /* the type of ethernet frame */
if (fd->win_info[COL_NUM]) {
diff --git a/packet-fddi.c b/packet-fddi.c
new file mode 100644
index 0000000000..9f8ef7f4bb
--- /dev/null
+++ b/packet-fddi.c
@@ -0,0 +1,136 @@
+/* packet-fddi.c
+ * Routines for FDDI packet disassembly
+ *
+ * Laurent Deniel <deniel@worldnet.fr>
+ *
+ * $Id: packet-fddi.c,v 1.1 1998/10/10 03:32:11 gerald Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * 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_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <stdio.h>
+
+#include <pcap.h>
+
+#include "ethereal.h"
+#include "packet.h"
+#include "resolv.h"
+
+/* FDDI Frame Control values */
+
+#define FDDI_FC_VOID 0x00 /* Void frame */
+#define FDDI_FC_NRT 0x80 /* Nonrestricted token */
+#define FDDI_FC_RT 0xc0 /* Restricted token */
+#define FDDI_FC_MAC 0xc0 /* MAC frame */
+#define FDDI_FC_SMT 0x40 /* SMT frame */
+#define FDDI_FC_SMT_INFO 0x41 /* SMT Info */
+#define FDDI_FC_SMT_NSA 0x4F /* SMT Next station adrs */
+#define FDDI_FC_SMT_MIN FDDI_FC_SMT_INFO
+#define FDDI_FC_SMT_MAX FDDI_FC_SMT_NSA
+#define FDDI_FC_MAC_MIN 0xc1
+#define FDDI_FC_MAC_BEACON 0xc2 /* MAC Beacon frame */
+#define FDDI_FC_MAC_CLAIM 0xc3 /* MAC Claim frame */
+#define FDDI_FC_MAC_MAX 0xcf
+#define FDDI_FC_LLC_ASYNC 0x50 /* Async. LLC frame */
+#define FDDI_FC_LLC_ASYNC_MIN FDDI_FC_LLC_ASYNC
+#define FDDI_FC_LLC_ASYNC_DEF 0x54
+#define FDDI_FC_LLC_ASYNC_MAX 0x5f
+#define FDDI_FC_LLC_SYNC 0xd0 /* Sync. LLC frame */
+#define FDDI_FC_LLC_SYNC_MIN FDDI_FC_LLC_SYNC
+#define FDDI_FC_LLC_SYNC_MAX 0xd7
+#define FDDI_FC_IMP_ASYNC 0x60 /* Implementor Async. */
+#define FDDI_FC_IMP_ASYNC_MIN FDDI_FC_IMP_ASYNC
+#define FDDI_FC_IMP_ASYNC_MAX 0x6f
+#define FDDI_FC_IMP_SYNC 0xe0 /* Implementor Synch. */
+
+#define FDDI_HEADER_SIZE 13
+
+/* field positions */
+
+#define FDDI_P_FC 0
+#define FDDI_P_DHOST 1
+#define FDDI_P_SHOST 7
+
+void dissect_fddi(const u_char *pd, frame_data *fd, GtkTree *tree)
+{
+
+ int offset = 0, fc;
+ GtkWidget *fh_tree, *ti;
+
+ if (fd->cap_len < FDDI_HEADER_SIZE) {
+ dissect_data(pd, offset, fd, tree);
+ return;
+ }
+
+ fc = (int) pd[FDDI_P_FC];
+
+ if (fd->win_info[0]) {
+ strcpy(fd->win_info[2], get_ether_name((u_char *)&pd[FDDI_P_DHOST]));
+ strcpy(fd->win_info[1], get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
+ strcpy(fd->win_info[4], "FDDI");
+ }
+
+ if (tree) {
+ ti = add_item_to_tree(GTK_WIDGET(tree), 0, offset,
+ "FDDI %s (%d on wire, %d captured)",
+ (fc == FDDI_FC_LLC_ASYNC_DEF || fc == FDDI_FC_LLC_ASYNC) ?
+ "Async LLC" : "unsupported FC",
+ fd->pkt_len, fd->cap_len);
+
+ fh_tree = gtk_tree_new();
+ add_subtree(ti, fh_tree, ETT_FDDI);
+ add_item_to_tree(fh_tree, FDDI_P_FC, 1, "Frame Control: 0x%02x", fc);
+ add_item_to_tree(fh_tree, FDDI_P_DHOST, 6, "Destination: %s (%s)",
+ ether_to_str((guint8 *) &pd[FDDI_P_DHOST]),
+ get_ether_name((u_char *) &pd[FDDI_P_DHOST]));
+ add_item_to_tree(fh_tree, FDDI_P_SHOST, 6, "Source: %s (%s)",
+ ether_to_str((guint8 *) &pd[FDDI_P_SHOST]),
+ get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
+ }
+
+ offset = FDDI_HEADER_SIZE;
+
+ switch (fc) {
+
+ /* From now, only 802.2 SNAP (Async. LCC frame) is supported */
+
+ case FDDI_FC_LLC_ASYNC :
+ case FDDI_FC_LLC_ASYNC_DEF :
+ dissect_llc(pd, offset, fd, tree);
+ return;
+
+ default :
+ dissect_data(pd, offset, fd, tree);
+ return;
+
+ } /* fc */
+
+} /* dissect_fddi */
+
diff --git a/packet-ip.c b/packet-ip.c
index 7615d29295..ddc6d393d5 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.4 1998/09/27 22:12:29 gerald Exp $
+ * $Id: packet-ip.c,v 1.5 1998/10/10 03:32:12 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -61,7 +61,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
iph.ip_off = ntohs(iph.ip_off);
iph.ip_sum = ntohs(iph.ip_sum);
- if (fd->win_info[COL_NUM]) {
+ if (fd->win_info[0]) {
switch (iph.ip_p) {
case IP_PROTO_ICMP:
case IP_PROTO_IGMP:
@@ -71,12 +71,12 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* Names are set in the associated dissect_* routines */
break;
default:
- strcpy(fd->win_info[COL_PROTOCOL], "IP");
- sprintf(fd->win_info[COL_INFO], "Unknown IP protocol (%02x)", iph.ip_p);
+ strcpy(fd->win_info[3], "IP");
+ sprintf(fd->win_info[4], "Unknown IP protocol (%02x)", iph.ip_p);
}
- strcpy(fd->win_info[COL_SOURCE], get_hostname(iph.ip_src));
- strcpy(fd->win_info[COL_DESTINATION], get_hostname(iph.ip_dst));
+ strcpy(fd->win_info[1], get_hostname(iph.ip_src));
+ strcpy(fd->win_info[2], get_hostname(iph.ip_dst));
}
iph.ip_tos = IPTOS_TOS(iph.ip_tos);
@@ -248,9 +248,9 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
strcpy(type_str, "Unknown ICMP (obsolete or malformed?)");
}
- if (fd->win_info[COL_NUM]) {
- strcpy(fd->win_info[COL_PROTOCOL], "ICMP");
- strcpy(fd->win_info[COL_INFO], type_str);
+ if (fd->win_info[0]) {
+ strcpy(fd->win_info[3], "ICMP");
+ strcpy(fd->win_info[4], type_str);
}
if (tree) {
@@ -307,8 +307,8 @@ dissect_igmp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
strcpy(type_str, "Unknown IGMP");
}
- if (fd->win_info[COL_NUM]) {
- strcpy(fd->win_info[COL_PROTOCOL], "IGMP");
+ if (fd->win_info[0]) {
+ strcpy(fd->win_info[3], "IGMP");
}
if (tree) {
diff --git a/packet-llc.c b/packet-llc.c
index 462637b801..ac342313a1 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-llc.c,v 1.7 1998/09/27 22:12:32 gerald Exp $
+ * $Id: packet-llc.c,v 1.8 1998/10/10 03:32:12 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -28,6 +28,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <pcap.h>
#include <gtk/gtk.h>
diff --git a/packet-ospf.c b/packet-ospf.c
index 60675579b9..73469fd021 100644
--- a/packet-ospf.c
+++ b/packet-ospf.c
@@ -2,7 +2,7 @@
* Routines for OSPF packet disassembly
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-ospf.c,v 1.4 1998/09/29 21:34:44 hannes Exp $
+ * $Id: packet-ospf.c,v 1.5 1998/10/10 03:32:13 gerald Exp $
*
* At this time, this module is able to analyze OSPF
* packets as specified in RFC2328. MOSPF (RFC1584) and other
@@ -38,6 +38,7 @@
#include <gtk/gtk.h>
#include <stdio.h>
+#include <string.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -54,16 +55,16 @@
void
dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- e_ospfhdr *ospfh;
+ e_ospfhdr ospfh;
GtkWidget *ospf_tree = NULL, *ti;
GtkWidget *ospf_header_tree;
char auth_data[9]="";
char *packet_type;
- ospfh = (e_ospfhdr *) &pd[offset];
+ memcpy(&ospfh, &pd[offset], sizeof(e_ospfhdr));
- switch(ospfh->packet_type) {
+ switch(ospfh.packet_type) {
case OSPF_HELLO:
packet_type="Hello Packet";
break;
@@ -81,7 +82,7 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
break;
default:
/* XXX - set it to some string with the value of
- "ospfh->packet_type"? */
+ "ospfh.packet_type"? */
break;
}
if (fd->win_info[COL_NUM]) {
@@ -90,7 +91,7 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
}
if (tree) {
- ti = add_item_to_tree(GTK_WIDGET(tree), offset, ntohs(ospfh->length), "Open Shortest Path First");
+ ti = add_item_to_tree(GTK_WIDGET(tree), offset, ntohs(ospfh.length), "Open Shortest Path First");
ospf_tree = gtk_tree_new();
add_subtree(ti, ospf_tree, ETT_OSPF);
@@ -98,28 +99,28 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
ospf_header_tree = gtk_tree_new();
add_subtree(ti, ospf_header_tree, ETT_OSPF_HDR);
- add_item_to_tree(ospf_header_tree, offset, 1, "OSPF Version: %d", ospfh->version);
+ add_item_to_tree(ospf_header_tree, offset, 1, "OSPF Version: %d", ospfh.version);
add_item_to_tree(ospf_header_tree, offset + 1 , 1, "OSPF Packet Type: %d (%s)",
- ospfh->packet_type, packet_type);
+ ospfh.packet_type, packet_type);
add_item_to_tree(ospf_header_tree, offset + 2 , 2, "Packet Legth: %d",
- ntohs(ospfh->length));
+ ntohs(ospfh.length));
add_item_to_tree(ospf_header_tree, offset + 4 , 4, "Source OSPF Router ID: %s",
- ip_to_str((guint8 *) &(ospfh->routerid)));
- if (!(ospfh->area)) {
+ ip_to_str((guint8 *) &(ospfh.routerid)));
+ if (!(ospfh.area)) {
add_item_to_tree(ospf_header_tree, offset + 8 , 4, "Area ID: Backbone");
} else {
- add_item_to_tree(ospf_header_tree, offset + 8 , 4, "Area ID: %s", ip_to_str((guint8 *) &(ospfh->area)));
+ add_item_to_tree(ospf_header_tree, offset + 8 , 4, "Area ID: %s", ip_to_str((guint8 *) &(ospfh.area)));
}
add_item_to_tree(ospf_header_tree, offset + 12 , 2, "Packet Checksum");
- switch( ntohs(ospfh->auth_type) ) {
+ switch( ntohs(ospfh.auth_type) ) {
case OSPF_AUTH_NONE:
add_item_to_tree(ospf_header_tree, offset + 14 , 2, "Auth Type: none");
add_item_to_tree(ospf_header_tree, offset + 16 , 8, "Auth Data (none)");
break;
case OSPF_AUTH_SIMPLE:
add_item_to_tree(ospf_header_tree, offset + 14 , 2, "Auth Type: simple");
- strncpy(auth_data, &(ospfh->auth_data), 8);
+ strncpy(auth_data, (char *) &ospfh.auth_data, 8);
add_item_to_tree(ospf_header_tree, offset + 16 , 8, "Auth Data: %s", auth_data);
break;
case OSPF_AUTH_CRYPT:
@@ -135,7 +136,7 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* Skip over header */
offset += OSPF_HEADER_LENGTH;
- switch(ospfh->packet_type){
+ switch(ospfh.packet_type){
case OSPF_HELLO:
dissect_ospf_hello(pd, offset, fd, (GtkTree *) ospf_tree);
break;
@@ -158,14 +159,14 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
void
dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- e_ospf_hello *ospfhello;
+ e_ospf_hello ospfhello;
guint32 *ospfneighbor;
char options[20]="";
int options_offset;
GtkWidget *ospf_hello_tree, *ti;
- ospfhello = (e_ospf_hello *) &pd[offset];
+ memcpy(&ospfhello, &pd[offset], sizeof(e_ospf_hello));
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), offset, (fd->cap_len - offset) , "OSPF Hello Packet");
@@ -173,37 +174,37 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
add_subtree(ti, ospf_hello_tree, ETT_OSPF_HELLO);
- add_item_to_tree(ospf_hello_tree, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello->network_mask));
- add_item_to_tree(ospf_hello_tree, offset + 4, 2, "Hello Intervall: %d seconds", ntohs(ospfhello->hellointervall));
+ add_item_to_tree(ospf_hello_tree, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello.network_mask));
+ add_item_to_tree(ospf_hello_tree, offset + 4, 2, "Hello Intervall: %d seconds", ntohs(ospfhello.hellointervall));
/* ATTENTION !!! no check for length of options string */
options_offset=0;
- if(( ospfhello->options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
+ if(( ospfhello.options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
strcpy( (char *)(options + options_offset), "E");
options_offset+=1;
}
- if(( ospfhello->options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
+ if(( ospfhello.options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
strcpy((char *) (options + options_offset), "/MC");
options_offset+=3;
}
- if(( ospfhello->options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
+ if(( ospfhello.options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
strcpy((char *) (options + options_offset), "/NP");
options_offset+=3;
}
- if(( ospfhello->options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
+ if(( ospfhello.options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
strcpy((char *) (options + options_offset) , "/EA");
options_offset+=3;
}
- if(( ospfhello->options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
+ if(( ospfhello.options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
strcpy((char *) (options + options_offset) , "/DC");
options_offset+=3;
}
- add_item_to_tree(ospf_hello_tree, offset + 6, 1, "Options: %d (%s)", ospfhello->options, options);
- add_item_to_tree(ospf_hello_tree, offset + 7, 1, "Router Priority: %d", ospfhello->priority);
- add_item_to_tree(ospf_hello_tree, offset + 8, 4, "RouterDeadIntervall: %ld seconds", (long)ntohl(ospfhello->dead_interval));
- add_item_to_tree(ospf_hello_tree, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello->drouter));
- add_item_to_tree(ospf_hello_tree, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello->bdrouter));
+ add_item_to_tree(ospf_hello_tree, offset + 6, 1, "Options: %d (%s)", ospfhello.options, options);
+ add_item_to_tree(ospf_hello_tree, offset + 7, 1, "Router Priority: %d", ospfhello.priority);
+ add_item_to_tree(ospf_hello_tree, offset + 8, 4, "RouterDeadIntervall: %ld seconds", (long)ntohl(ospfhello.dead_interval));
+ add_item_to_tree(ospf_hello_tree, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello.drouter));
+ add_item_to_tree(ospf_hello_tree, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello.bdrouter));
offset+=20;
@@ -218,7 +219,7 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
void
dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- e_ospf_dbd *ospf_dbd;
+ e_ospf_dbd ospf_dbd;
char options[20]="";
int options_offset;
char flags[20]="";
@@ -226,57 +227,57 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree
GtkWidget *ospf_db_desc_tree=NULL, *ti;
- ospf_dbd = (e_ospf_dbd *) &pd[offset];
+ memcpy(&ospf_dbd, &pd[offset], sizeof(e_ospf_dbd));
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), offset, (fd->cap_len - offset) , "OSPF DB Description");
ospf_db_desc_tree = gtk_tree_new();
add_subtree(ti, ospf_db_desc_tree, ETT_OSPF_DESC);
- add_item_to_tree(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd->interface_mtu) );
+ add_item_to_tree(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) );
options_offset=0;
- if(( ospf_dbd->options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
+ if(( ospf_dbd.options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
strcpy( (char *)(options + options_offset), "_E_");
options_offset+=1;
}
- if(( ospf_dbd->options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
+ if(( ospf_dbd.options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
strcpy((char *) (options + options_offset), "_MC_");
options_offset+=3;
}
- if(( ospf_dbd->options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
+ if(( ospf_dbd.options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
strcpy((char *) (options + options_offset), "_NP_");
options_offset+=3;
}
- if(( ospf_dbd->options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
+ if(( ospf_dbd.options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
strcpy((char *) (options + options_offset) , "_EA_");
options_offset+=3;
}
- if(( ospf_dbd->options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
+ if(( ospf_dbd.options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
strcpy((char *) (options + options_offset) , "_DC_");
options_offset+=3;
}
- add_item_to_tree(ospf_db_desc_tree, offset + 2 , 1, "Options: %d (%s)", ospf_dbd->options, options );
+ add_item_to_tree(ospf_db_desc_tree, offset + 2 , 1, "Options: %d (%s)", ospf_dbd.options, options );
flags_offset=0;
- if(( ospf_dbd->flags & OSPF_DBD_FLAG_MS ) == OSPF_DBD_FLAG_MS){
+ if(( ospf_dbd.flags & OSPF_DBD_FLAG_MS ) == OSPF_DBD_FLAG_MS){
strcpy( (char *)(flags + flags_offset), "_I_");
flags_offset+=1;
}
- if(( ospf_dbd->flags & OSPF_DBD_FLAG_M ) == OSPF_DBD_FLAG_M){
+ if(( ospf_dbd.flags & OSPF_DBD_FLAG_M ) == OSPF_DBD_FLAG_M){
strcpy((char *) (flags + flags_offset), "_M_");
flags_offset+=3;
}
- if(( ospf_dbd->flags & OSPF_DBD_FLAG_I ) == OSPF_DBD_FLAG_I){
+ if(( ospf_dbd.flags & OSPF_DBD_FLAG_I ) == OSPF_DBD_FLAG_I){
strcpy((char *) (flags + flags_offset), "_I_");
flags_offset+=3;
}
- add_item_to_tree(ospf_db_desc_tree, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd->flags, flags );
- add_item_to_tree(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd->dd_sequence) );
+ add_item_to_tree(ospf_db_desc_tree, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd.flags, flags );
+ add_item_to_tree(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd.dd_sequence) );
}
/* LS Headers will be processed here */
/* skip to the end of DB-Desc header */
@@ -289,7 +290,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree
void
dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- e_ospf_ls_req *ospf_lsr;
+ e_ospf_ls_req ospf_lsr;
GtkWidget *ospf_lsr_tree, *ti;
@@ -298,41 +299,41 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
/* we place every request for a LSA in a single subtree */
if (tree) {
while( ((int) ( fd->cap_len - offset)) >= OSPF_LS_REQ_LENGTH ){
- ospf_lsr = (e_ospf_ls_req *) &pd[offset];
+ memcpy(&ospf_lsr, &pd[offset], sizeof(e_ospf_ls_req));
ti = add_item_to_tree(GTK_WIDGET(tree), offset, OSPF_LS_REQ_LENGTH, "Link State Request");
ospf_lsr_tree = gtk_tree_new();
add_subtree(ti, ospf_lsr_tree, ETT_OSPF_LSR);
- switch( ntohl( ospf_lsr->ls_type ) ){
+ switch( ntohl( ospf_lsr.ls_type ) ){
case OSPF_LSTYPE_ROUTER:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Router-LSA (%ld)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
break;
case OSPF_LSTYPE_NETWORK:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Network-LSA (%ld)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
break;
case OSPF_LSTYPE_SUMMERY:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (IP network) (%ld)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
break;
case OSPF_LSTYPE_ASBR:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (ASBR) (%ld)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
break;
case OSPF_LSTYPE_ASEXT:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: AS-External-LSA (ASBR) (%ld)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
break;
default:
add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: %ld (unknown)",
- (long)ntohl( ospf_lsr->ls_type ) );
+ (long)ntohl( ospf_lsr.ls_type ) );
}
add_item_to_tree(ospf_lsr_tree, offset + 4, 4, "Link State ID : %s",
- ip_to_str((guint8 *) &(ospf_lsr->ls_id)));
+ ip_to_str((guint8 *) &(ospf_lsr.ls_id)));
add_item_to_tree(ospf_lsr_tree, offset + 8, 4, "Advertising Router : %s",
- ip_to_str((guint8 *) &(ospf_lsr->adv_router)));
+ ip_to_str((guint8 *) &(ospf_lsr.adv_router)));
offset+=12;
}
@@ -340,25 +341,25 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
}
void
dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- e_ospf_lsa_upd_hdr *upd_hdr;
+ e_ospf_lsa_upd_hdr upd_hdr;
guint32 lsa_counter;
GtkWidget *ospf_lsa_upd_tree=NULL, *ti;
- upd_hdr = (e_ospf_lsa_upd_hdr *) &pd[offset];
+ memcpy(&upd_hdr, &pd[offset], sizeof(e_ospf_lsa_upd_hdr));
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), offset, (fd->cap_len - offset) , "LS Update Packet");
ospf_lsa_upd_tree = gtk_tree_new();
add_subtree(ti, ospf_lsa_upd_tree, ETT_OSPF_LSA_UPD);
- add_item_to_tree(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr->lsa_nr) );
+ add_item_to_tree(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) );
}
/* skip to the beginning of the first LSA */
offset+=4; /* the LS Upd PAcket contains only a 32 bit #LSAs field */
lsa_counter = 0;
- while(lsa_counter < ntohl(upd_hdr->lsa_nr)){
+ while(lsa_counter < ntohl(upd_hdr.lsa_nr)){
offset+=dissect_ospf_lsa(pd, offset, fd, (GtkTree *) ospf_lsa_upd_tree, TRUE);
lsa_counter += 1;
}
@@ -377,24 +378,24 @@ dissect_ospf_ls_ack(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
int
dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, int disassemble_body) {
- e_ospf_lsa_hdr *lsa_hdr;
+ e_ospf_lsa_hdr lsa_hdr;
char *lsa_type;
/* data strutures for the router LSA */
- e_ospf_router_lsa *router_lsa;
- e_ospf_router_data *router_data;
- e_ospf_router_metric *tos_data;
+ e_ospf_router_lsa router_lsa;
+ e_ospf_router_data router_data;
+ e_ospf_router_metric tos_data;
guint16 link_counter;
guint8 tos_counter;
char *link_type;
char *link_id;
/* data structures for the network lsa */
- e_ospf_network_lsa *network_lsa;
+ e_ospf_network_lsa network_lsa;
guint32 *attached_router;
/* data structures for the summary and ASBR LSAs */
- e_ospf_summary_lsa *summary_lsa;
+ e_ospf_summary_lsa summary_lsa;
/* data structures for the AS-External LSA */
e_ospf_asexternal_lsa asext_lsa;
@@ -402,11 +403,11 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
GtkWidget *ospf_lsa_tree, *ti;
- lsa_hdr = (e_ospf_lsa_hdr *) &pd[offset];
+ memcpy(&lsa_hdr, &pd[offset], sizeof(e_ospf_lsa_hdr));
- switch(lsa_hdr->ls_type) {
+ switch(lsa_hdr.ls_type) {
case OSPF_LSTYPE_ROUTER:
lsa_type="Router LSA";
break;
@@ -428,8 +429,8 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
if (tree) {
if(disassemble_body){
- ti = add_item_to_tree(GTK_WIDGET(tree), offset, ntohs(lsa_hdr->length),
- "%s (Type: %d)", lsa_type, lsa_hdr->ls_type);
+ ti = add_item_to_tree(GTK_WIDGET(tree), offset, ntohs(lsa_hdr.length),
+ "%s (Type: %d)", lsa_type, lsa_hdr.ls_type);
} else {
ti = add_item_to_tree(GTK_WIDGET(tree), offset, OSPF_LSA_HEADER_LENGTH, "LSA Header");
}
@@ -437,20 +438,20 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
add_subtree(ti, ospf_lsa_tree, ETT_OSPF_LSA);
- add_item_to_tree(ospf_lsa_tree, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr->ls_age));
- add_item_to_tree(ospf_lsa_tree, offset + 2, 1, "Options: %d ", lsa_hdr->options);
- add_item_to_tree(ospf_lsa_tree, offset + 3, 1, "LSA Type: %d (%s)", lsa_hdr->ls_type, lsa_type);
+ add_item_to_tree(ospf_lsa_tree, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr.ls_age));
+ add_item_to_tree(ospf_lsa_tree, offset + 2, 1, "Options: %d ", lsa_hdr.options);
+ add_item_to_tree(ospf_lsa_tree, offset + 3, 1, "LSA Type: %d (%s)", lsa_hdr.ls_type, lsa_type);
add_item_to_tree(ospf_lsa_tree, offset + 4, 4, "Linke State ID: %s ",
- ip_to_str((guint8 *) &(lsa_hdr->ls_id)));
+ ip_to_str((guint8 *) &(lsa_hdr.ls_id)));
add_item_to_tree(ospf_lsa_tree, offset + 8, 4, "Advertising Router: %s ",
- ip_to_str((guint8 *) &(lsa_hdr->adv_router)));
+ ip_to_str((guint8 *) &(lsa_hdr.adv_router)));
add_item_to_tree(ospf_lsa_tree, offset + 12, 4, "LS Sequence Number: 0x%04lx ",
- (unsigned long)ntohl(lsa_hdr->ls_seq));
- add_item_to_tree(ospf_lsa_tree, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr->ls_checksum));
+ (unsigned long)ntohl(lsa_hdr.ls_seq));
+ add_item_to_tree(ospf_lsa_tree, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr.ls_checksum));
- add_item_to_tree(ospf_lsa_tree, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr->length));
+ add_item_to_tree(ospf_lsa_tree, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr.length));
if(!disassemble_body){
return OSPF_LSA_HEADER_LENGTH;
@@ -459,23 +460,23 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
/* the LSA body starts afte 20 bytes of LSA Header */
offset+=20;
- switch(lsa_hdr->ls_type){
+ switch(lsa_hdr.ls_type){
case(OSPF_LSTYPE_ROUTER):
- router_lsa = (e_ospf_router_lsa *) &pd[offset];
+ memcpy(&router_lsa, &pd[offset], sizeof(e_ospf_router_lsa));
/* again: flags should be secified in detail */
- add_item_to_tree(ospf_lsa_tree, offset, 1, "Flags: 0x%02x ", router_lsa->flags);
+ add_item_to_tree(ospf_lsa_tree, offset, 1, "Flags: 0x%02x ", router_lsa.flags);
add_item_to_tree(ospf_lsa_tree, offset + 2, 2, "Nr. of Links: %d ",
- ntohs(router_lsa->nr_links));
+ ntohs(router_lsa.nr_links));
offset += 4;
- /* router_lsa->nr_links links follow
+ /* router_lsa.nr_links links follow
* maybe we should put each of the links into its own subtree ???
*/
- for(link_counter = 1 ; link_counter <= ntohs(router_lsa->nr_links); link_counter++){
+ for(link_counter = 1 ; link_counter <= ntohs(router_lsa.nr_links); link_counter++){
- router_data = (e_ospf_router_data *) &pd[offset];
+ memcpy(&router_data, &pd[offset], sizeof(e_ospf_router_data));
/* check the Link Type and ID */
- switch(router_data->link_type) {
+ switch(router_data.link_type) {
case OSPF_LINK_PTP:
link_type="Point-to-point connection to another router";
link_id="Neighboring router's Router ID";
@@ -498,36 +499,36 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
}
add_item_to_tree(ospf_lsa_tree, offset, 4, "%s: %s", link_id,
- ip_to_str((guint8 *) &(router_data->link_id)));
+ ip_to_str((guint8 *) &(router_data.link_id)));
/* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
add_item_to_tree(ospf_lsa_tree, offset + 4, 4, "Link Data: %s",
- ip_to_str((guint8 *) &(router_data->link_data)));
+ ip_to_str((guint8 *) &(router_data.link_data)));
add_item_to_tree(ospf_lsa_tree, offset + 8, 1, "Link Type: %d - %s",
- router_data->link_type, link_type);
- add_item_to_tree(ospf_lsa_tree, offset + 9, 1, "Nr. of TOS metrics: %d", router_data->nr_tos);
- add_item_to_tree(ospf_lsa_tree, offset + 10, 2, "TOS 0 metric: %d", ntohs( router_data->tos0_metric ));
+ router_data.link_type, link_type);
+ add_item_to_tree(ospf_lsa_tree, offset + 9, 1, "Nr. of TOS metrics: %d", router_data.nr_tos);
+ add_item_to_tree(ospf_lsa_tree, offset + 10, 2, "TOS 0 metric: %d", ntohs( router_data.tos0_metric ));
offset += 12;
- /* router_data->nr_tos metrics may follow each link
+ /* router_data.nr_tos metrics may follow each link
* ATTENTION: TOS metrics are not tested (I don't have TOS based routing)
* please send me a mail if it is/isn't working
*/
- for(tos_counter = 1 ; link_counter <= ntohs(router_data->nr_tos); tos_counter++){
- tos_data = (e_ospf_router_metric *) &pd[offset];
+ for(tos_counter = 1 ; link_counter <= ntohs(router_data.nr_tos); tos_counter++){
+ memcpy(&tos_data, &pd[offset], sizeof(e_ospf_router_metric));
add_item_to_tree(ospf_lsa_tree, offset, 1, "TOS: %d, Metric: %d",
- tos_data->tos, ntohs(tos_data->metric));
+ tos_data.tos, ntohs(tos_data.metric));
offset += 4;
}
}
break;
case(OSPF_LSTYPE_NETWORK):
- network_lsa = (e_ospf_network_lsa *) &pd[offset];
+ memcpy(&network_lsa, &pd[offset], sizeof(e_ospf_network_lsa));
add_item_to_tree(ospf_lsa_tree, offset, 4, "Netmask: %s",
- ip_to_str((guint8 *) &(network_lsa->network_mask)));
+ ip_to_str((guint8 *) &(network_lsa.network_mask)));
offset += 4;
while( ((int) (fd->cap_len - offset)) >= 4){
@@ -540,15 +541,15 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
case(OSPF_LSTYPE_SUMMERY):
/* Type 3 and 4 LSAs have the same format */
case(OSPF_LSTYPE_ASBR):
- summary_lsa = (e_ospf_summary_lsa *) &pd[offset];
+ memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
add_item_to_tree(ospf_lsa_tree, offset, 4, "Netmask: %s",
- ip_to_str((guint8 *) &(summary_lsa->network_mask)));
+ ip_to_str((guint8 *) &(summary_lsa.network_mask)));
/* returns only the TOS 0 metric (even if there are more TOS metrics) */
break;
case(OSPF_LSTYPE_ASEXT):
- summary_lsa = (e_ospf_summary_lsa *) &pd[offset];
+ memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
add_item_to_tree(ospf_lsa_tree, offset, 4, "Netmask: %s",
- ip_to_str((guint8 *) &(summary_lsa->network_mask)));
+ ip_to_str((guint8 *) &(summary_lsa.network_mask)));
/* asext_lsa = (e_ospf_asexternal_lsa *) &pd[offset + 4]; */
memcpy(&asext_lsa, &pd[offset + 4], sizeof(asext_lsa));
@@ -578,5 +579,5 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
}
}
/* return the length of this LSA */
- return ntohs(lsa_hdr->length);
+ return ntohs(lsa_hdr.length);
}
diff --git a/packet-ppp.c b/packet-ppp.c
index 546e1a3d45..4da140ded6 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.4 1998/09/27 22:12:37 gerald Exp $
+ * $Id: packet-ppp.c,v 1.5 1998/10/10 03:32:14 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,6 +28,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <stdio.h>
#include <pcap.h>
diff --git a/packet-raw.c b/packet-raw.c
index b1ada2500d..be745c0237 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.3 1998/09/27 22:12:37 gerald Exp $
+ * $Id: packet-raw.c,v 1.4 1998/10/10 03:32:15 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,6 +28,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <stdio.h>
#include <pcap.h>
diff --git a/packet-trmac.c b/packet-trmac.c
index de810afdbf..0ba427d83e 100644
--- a/packet-trmac.c
+++ b/packet-trmac.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring Media Access Control
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-trmac.c,v 1.3 1998/09/27 22:12:40 gerald Exp $
+ * $Id: packet-trmac.c,v 1.4 1998/10/10 03:32:15 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -28,6 +28,10 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <pcap.h>
#include <gtk/gtk.h>
diff --git a/packet.c b/packet.c
index 00f8b3c4d2..a86708cc98 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.4 1998/09/27 22:12:42 gerald Exp $
+ * $Id: packet.c,v 1.5 1998/10/10 03:32:16 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -27,12 +27,20 @@
# include "config.h"
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
@@ -198,6 +206,21 @@ decode_start_len(GtkTreeItem *ti, gint *pstart, gint *plen)
*plen = t_info & 0xffff;
}
+/* Tries to match val against each element in the value_string array vs.
+ Returns the associated string ptr on a match, or NULL on failure.
+ Len is the length of the array. */
+gchar*
+match_strval(guint32 val, value_string *vs, gint len) {
+ gint i;
+
+ for (i = 0; i < len; i++) {
+ if (vs[i].value == val)
+ return(vs[i].strptr);
+ }
+
+ return(NULL);
+}
+
static const char *mon_names[12] = {
"Jan",
"Feb",
@@ -265,6 +288,9 @@ dissect_packet(const u_char *pd, guint32 ts_secs, guint32 ts_usecs,
case DLT_EN10MB :
dissect_eth(pd, fd, tree);
break;
+ case DLT_FDDI :
+ dissect_fddi(pd, fd, tree);
+ break;
case DLT_IEEE802 :
dissect_tr(pd, fd, tree);
break;
diff --git a/packet.h b/packet.h
index 82a2ca3a40..d659cd433f 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.10 1998/09/27 22:12:42 gerald Exp $
+ * $Id: packet.h,v 1.11 1998/10/10 03:32:17 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -29,28 +29,27 @@
/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
* byte array, returns the value of the two or four bytes at the pointer.
- * Handy for
+ * The pletoh[sl] versions return the little-endian representation.
*/
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define pntohs(p) ((guint16) \
- ((guint16)*((guint8 *)p+0)<<8| \
- (guint16)*((guint8 *)p+1)<<0))
-
-#define pntohl(p) ((guint32)*((guint8 *)p+0)<<24| \
- (guint32)*((guint8 *)p+1)<<16| \
- (guint32)*((guint8 *)p+2)<<8| \
- (guint32)*((guint8 *)p+3)<<0)
-#else /* BIG_ENDIAN */
-#define pntohs(p) ((guint16) \
- ((guint16)*((guint8 *)p+1)<<8| \
- (guint16)*((guint8 *)p+0)<<0))
-
-#define pntohl(p) ((guint32)*((guint8 *)p+3)<<24| \
- (guint32)*((guint8 *)p+2)<<16| \
- (guint32)*((guint8 *)p+1)<<8| \
- (guint32)*((guint8 *)p+0)<<0)
-#endif /* LITTLE_ENDIAN */
+#define pntohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+0)<<8| \
+ (guint16)*((guint8 *)p+1)<<0))
+
+#define pntohl(p) ((guint32)*((guint8 *)p+0)<<24| \
+ (guint32)*((guint8 *)p+1)<<16| \
+ (guint32)*((guint8 *)p+2)<<8| \
+ (guint32)*((guint8 *)p+3)<<0)
+
+#define pletohs(p) ((guint16) \
+ ((guint16)*((guint8 *)p+1)<<8| \
+ (guint16)*((guint8 *)p+0)<<0))
+
+#define pletohl(p) ((guint32)*((guint8 *)p+3)<<24| \
+ (guint32)*((guint8 *)p+2)<<16| \
+ (guint32)*((guint8 *)p+1)<<8| \
+ (guint32)*((guint8 *)p+0)<<0)
+
/* Useful when highlighting regions inside a dissect_*() function. With this
* macro, you can highlight from the start of the packet to the end of the
@@ -81,6 +80,13 @@ typedef struct _packet_info {
int iphdrlen;
} packet_info;
+/* Struct for the match_strval function */
+
+typedef struct _value_string {
+ guint32 value;
+ gchar *strptr;
+} value_string;
+
/* Many of the structs and definitions below were taken from include files
* in the Linux distribution. */
@@ -316,9 +322,10 @@ typedef struct _e_udphdr {
#define ETT_IPXSAP 40
#define ETT_IPXSAP_SERVER 41
#define ETT_NULL 42
+#define ETT_FDDI 43
/* Should be the last item number plus one */
-#define NUM_TREE_TYPES 43
+#define NUM_TREE_TYPES 44
/* The version of pcap.h that comes with some systems is missing these
* #defines.
@@ -347,6 +354,7 @@ GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...)
GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...);
#endif
void decode_start_len(GtkTreeItem *, gint*, gint*);
+gchar* match_strval(guint32, value_string*, gint);
/* Routines in packet.c */
void dissect_packet(const u_char *, guint32 ts_secs, guint32 ts_usecs,
@@ -361,6 +369,7 @@ void collapse_tree(GtkWidget *, gpointer);
* They should never modify the packet data.
*/
void dissect_eth(const u_char *, frame_data *, GtkTree *);
+void dissect_fddi(const u_char *, frame_data *, GtkTree *);
void dissect_null(const u_char *, frame_data *, GtkTree *);
void dissect_ppp(const u_char *, frame_data *, GtkTree *);
void dissect_raw(const u_char *, frame_data *, GtkTree *);
diff --git a/prefs.c b/prefs.c
index e3df68874d..cb65140219 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.3 1998/09/27 22:12:43 gerald Exp $
+ * $Id: prefs.c,v 1.4 1998/10/10 03:32:18 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,17 +37,19 @@
#include "packet.h"
#include "file.h"
#include "print.h"
+#include "filter.h"
#include "prefs.h"
extern capture_file cf;
-const gchar *print_page_key = "printer_options_page";
+const gchar *print_page_key = "printer_options_page";
+const gchar *filter_page_key = "filter_options_page";
void
prefs_cb() {
GtkWidget *prefs_w, *main_vb, *top_hb, *bbox, *prefs_nb,
- *ok_bt, *cancel_bt;
- GtkWidget *pr_opt_pg;
+ *ok_bt, *save_bt, *cancel_bt;
+ GtkWidget *print_pg, *filter_pg;
GtkWidget *nlabel, *label;
prefs_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -69,17 +71,23 @@ prefs_cb() {
gtk_widget_show(prefs_nb);
/* General prefs */
- nlabel = gtk_label_new("Nothing here yet");
+ nlabel = gtk_label_new("Nothing here yet...");
gtk_widget_show (nlabel);
label = gtk_label_new ("General");
gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), nlabel, label);
/* Printing prefs */
- pr_opt_pg = printer_opts_pg();
- gtk_object_set_data(GTK_OBJECT(prefs_w), print_page_key, pr_opt_pg);
+ print_pg = printer_prefs_show();
+ gtk_object_set_data(GTK_OBJECT(prefs_w), print_page_key, print_pg);
label = gtk_label_new ("Printing");
- gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), pr_opt_pg, label);
+ gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), print_pg, label);
+
+ /* Filter prefs */
+ filter_pg = filter_prefs_show();
+ gtk_object_set_data(GTK_OBJECT(prefs_w), filter_page_key, filter_pg);
+ label = gtk_label_new ("Filters");
+ gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), filter_pg, label);
/* Button row: OK and cancel buttons */
bbox = gtk_hbutton_box_new();
@@ -95,6 +103,12 @@ prefs_cb() {
gtk_widget_grab_default(ok_bt);
gtk_widget_show(ok_bt);
+ save_bt = gtk_button_new_with_label ("Save");
+ gtk_signal_connect_object(GTK_OBJECT(save_bt), "clicked",
+ GTK_SIGNAL_FUNC(prefs_main_save_cb), GTK_OBJECT(prefs_w));
+ gtk_container_add(GTK_CONTAINER(bbox), save_bt);
+ gtk_widget_show(save_bt);
+
cancel_bt = gtk_button_new_with_label ("Cancel");
gtk_signal_connect_object(GTK_OBJECT(cancel_bt), "clicked",
GTK_SIGNAL_FUNC(prefs_main_cancel_cb), GTK_OBJECT(prefs_w));
@@ -107,14 +121,21 @@ prefs_cb() {
void
prefs_main_ok_cb(GtkWidget *w, gpointer win) {
- printer_opts_ok(gtk_object_get_data(GTK_OBJECT(win), print_page_key));
+ printer_prefs_ok(gtk_object_get_data(GTK_OBJECT(win), print_page_key));
+ filter_prefs_ok(gtk_object_get_data(GTK_OBJECT(win), filter_page_key));
gtk_widget_destroy(GTK_WIDGET(win));
}
void
+prefs_main_save_cb(GtkWidget *w, gpointer win) {
+ filter_prefs_save(gtk_object_get_data(GTK_OBJECT(win), filter_page_key));
+}
+
+void
prefs_main_cancel_cb(GtkWidget *w, gpointer win) {
- printer_opts_close(gtk_object_get_data(GTK_OBJECT(win), print_page_key));
+ printer_prefs_cancel(gtk_object_get_data(GTK_OBJECT(win), print_page_key));
+ filter_prefs_cancel(gtk_object_get_data(GTK_OBJECT(win), filter_page_key));
gtk_widget_destroy(GTK_WIDGET(win));
}
diff --git a/prefs.h b/prefs.h
index fe1597a373..832437e207 100644
--- a/prefs.h
+++ b/prefs.h
@@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
- * $Id: prefs.h,v 1.1 1998/09/25 23:24:05 gerald Exp $
+ * $Id: prefs.h,v 1.2 1998/10/10 03:32:18 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,6 +28,7 @@
void prefs_cb();
void prefs_main_ok_cb(GtkWidget *, gpointer);
+void prefs_main_save_cb(GtkWidget *, gpointer);
void prefs_main_cancel_cb(GtkWidget *, gpointer);
#endif /* prefs.h */
diff --git a/print.c b/print.c
index 8faa1a3eb6..62849fc9f3 100644
--- a/print.c
+++ b/print.c
@@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
- * $Id: print.c,v 1.4 1998/09/27 22:12:44 gerald Exp $
+ * $Id: print.c,v 1.5 1998/10/10 03:32:19 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -57,15 +57,14 @@ static void ps_clean_string(unsigned char *out, const unsigned char *in,
pr_opts printer_opts;
/* Key for gtk_object_set_data */
-const gchar *print_opt_key = "printer_options_data";
-GtkWidget * printer_opts_pg()
+const gchar *print_prefs_key = "printer_prefs_data";
+GtkWidget * printer_prefs_show()
{
GtkWidget *main_vb, *button;
GtkWidget *format_hb, *format_lb;
GtkWidget *dest_hb, *dest_lb;
GtkWidget *cmd_hb, *cmd_lb, *cmd_te;
GtkWidget *file_hb, *file_bt, *file_te;
- GtkWidget *bbox, *ok_bt, *cancel_bt;
GSList *format_grp, *dest_grp;
pr_opts *temp_pr_opts = g_malloc(sizeof(pr_opts));
@@ -78,7 +77,7 @@ GtkWidget * printer_opts_pg()
main_vb = gtk_vbox_new(FALSE, 3);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
gtk_widget_show(main_vb);
- gtk_object_set_data(GTK_OBJECT(main_vb), print_opt_key,
+ gtk_object_set_data(GTK_OBJECT(main_vb), print_prefs_key,
temp_pr_opts);
/* Output format */
@@ -169,28 +168,8 @@ GtkWidget * printer_opts_pg()
gtk_signal_connect_object(GTK_OBJECT(file_bt), "clicked",
GTK_SIGNAL_FUNC(printer_opts_file_cb), GTK_OBJECT(file_te));
-
- /* Button row: OK and cancel buttons */
-/* bbox = gtk_hbutton_box_new();
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
- gtk_container_add(GTK_CONTAINER(main_vb), bbox);
- gtk_widget_show(bbox);
-
- ok_bt = gtk_button_new_with_label ("OK");
- gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked",
- GTK_SIGNAL_FUNC(printer_opts_ok_cb), (gpointer)temp_pr_opts);
- gtk_container_add(GTK_CONTAINER(bbox), ok_bt);
- gtk_widget_show(ok_bt);
-
- cancel_bt = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect_object(GTK_OBJECT(cancel_bt), "clicked",
- GTK_SIGNAL_FUNC(printer_opts_close_cb), (gpointer)temp_pr_opts);
- gtk_container_add(GTK_CONTAINER(bbox), cancel_bt);
- gtk_widget_show(cancel_bt);
-
- */
- return(main_vb);
+ return(main_vb);
}
@@ -232,9 +211,9 @@ printer_opts_fs_cancel_cb(GtkWidget *w, gpointer data) {
}
void
-printer_opts_ok(GtkWidget *w)
+printer_prefs_ok(GtkWidget *w)
{
- pr_opts *data = gtk_object_get_data(GTK_OBJECT(w), print_opt_key);
+ pr_opts *data = gtk_object_get_data(GTK_OBJECT(w), print_prefs_key);
printer_opts.output_format = ((pr_opts*)data)->output_format;
printer_opts.output_dest = ((pr_opts*)data)->output_dest;
@@ -251,9 +230,9 @@ printer_opts_ok(GtkWidget *w)
}
void
-printer_opts_close(GtkWidget *w)
+printer_prefs_cancel(GtkWidget *w)
{
- pr_opts *data = gtk_object_get_data(GTK_OBJECT(w), print_opt_key);
+ pr_opts *data = gtk_object_get_data(GTK_OBJECT(w), print_prefs_key);
g_free(data);
}
diff --git a/print.h b/print.h
index 360660e71a..0bafbd74d6 100644
--- a/print.h
+++ b/print.h
@@ -1,7 +1,7 @@
/* print.h
* Definitions for printing packet analysis trees.
*
- * $Id: print.h,v 1.4 1998/09/27 22:12:45 gerald Exp $
+ * $Id: print.h,v 1.5 1998/10/10 03:32:20 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -41,9 +41,9 @@ typedef struct pr_opts {
/* Functions in print.h */
-void printer_opts_cb(GtkWidget *, gpointer);
-void printer_opts_ok(GtkWidget *w);
-void printer_opts_close(GtkWidget *w);
+GtkWidget *printer_prefs_show();
+void printer_prefs_ok(GtkWidget *w);
+void printer_prefs_cancel(GtkWidget *w);
void print_tree(const u_char *pd, frame_data *fd, GtkTree *tree);
void print_tree_text(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);
void print_tree_ps(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);