diff options
author | Gerald Combs <gerald@wireshark.org> | 1998-09-17 02:37:47 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 1998-09-17 02:37:47 +0000 |
commit | 3ad9f399156ea5af0864455e042a43727cac715d (patch) | |
tree | b8ac054dc758c3e59754dc85aead82d0ee296571 | |
parent | 19176fbb4f84cce7cac6ebe5f453837bfafa76d0 (diff) |
* Added Don Lafontaine's support for Banyan Vines.
svn path=/trunk/; revision=9
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | Makefile.in | 7 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | ethertype.c | 9 | ||||
-rw-r--r-- | etypes.h | 5 | ||||
-rw-r--r-- | packet-vines.c | 215 | ||||
-rw-r--r-- | packet-vines.h | 85 | ||||
-rw-r--r-- | packet.h | 8 |
9 files changed, 327 insertions, 8 deletions
@@ -34,7 +34,7 @@ Laurent Deniel <deniel@worldnet.fr> { } Don Lafontaine <lafont02@cn.ca> { - /* add your info here */ + Banyan Vines support } diff --git a/Makefile.am b/Makefile.am index 67761fd9f0..74e1f2c017 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,6 +29,7 @@ ethereal_SOURCES = \ packet-tr.c \ packet-trmac.c \ packet-udp.c \ + packet-vines.c \ print.c \ ps.c \ resolv.c \ @@ -44,6 +45,7 @@ ethereal_SOURCES = \ packet-ipv6.h \ packet-ospf.h \ packet-rip.h \ + packet-vines.h \ print.h \ ps.h \ resolv.h \ diff --git a/Makefile.in b/Makefile.in index e1139a4f27..12d5bf7c5c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -98,6 +98,7 @@ ethereal_SOURCES = \ packet-tr.c \ packet-trmac.c \ packet-udp.c \ + packet-vines.c \ print.c \ ps.c \ resolv.c \ @@ -113,6 +114,7 @@ ethereal_SOURCES = \ packet-ipv6.h \ packet-ospf.h \ packet-rip.h \ + packet-vines.h \ print.h \ ps.h \ resolv.h \ @@ -147,7 +149,7 @@ 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-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 \ -print.o ps.o resolv.o util.o +packet-vines.o print.o ps.o resolv.o util.o ethereal_LDADD = $(LDADD) ethereal_LDFLAGS = CFLAGS = @CFLAGS@ @@ -174,7 +176,8 @@ DEP_FILES = .deps/capture.P .deps/ethereal.P .deps/ethertype.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.P .deps/print.P .deps/ps.P .deps/resolv.P .deps/util.P +.deps/packet-vines.P .deps/packet.P .deps/print.P .deps/ps.P \ +.deps/resolv.P .deps/util.P SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES) OBJECTS = $(ethereal_OBJECTS) @@ -694,7 +694,7 @@ fi PACKAGE=ethereal -VERSION=0.3.15 +VERSION=0.3.16 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; } diff --git a/ethertype.c b/ethertype.c index 78e9165ade..77e9b87fe4 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.2 1998/09/16 03:21:55 gerald Exp $ + * $Id: ethertype.c,v 1.3 1998/09/17 02:37:45 gerald Exp $ * * Gilbert Ramirez <gram@verdict.uthscsa.edu> * @@ -97,6 +97,13 @@ ethertype(guint16 etype, int offset, } dissect_ipx(pd, offset, fd, tree); break; + case ETHERTYPE_VINES: + if (tree) { + add_item_to_tree(fh_tree, offset - 2, 2, + "Type Vines (0x%04x)", etype); + } + dissect_vines(pd, offset, fd, tree); + break; default: if (tree) { add_item_to_tree(fh_tree, offset - 2, 2, @@ -1,7 +1,7 @@ /* etypes.h * Defines ethernet packet types, similar to tcpdump's ethertype.h * - * $Id: etypes.h,v 1.2 1998/09/16 03:21:56 gerald Exp $ + * $Id: etypes.h,v 1.3 1998/09/17 02:37:45 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -66,4 +66,7 @@ #define ETHERTYPE_IPX 0x8137 #endif +#ifndef ETHERTYPE_VINES +#define ETHERTYPE_VINES 0xbad +#endif #endif /* etypes.h */ diff --git a/packet-vines.c b/packet-vines.c new file mode 100644 index 0000000000..67bf31a75e --- /dev/null +++ b/packet-vines.c @@ -0,0 +1,215 @@ +/* packet-vines.c + * Routines for Banyan VINES protocol packet disassembly + * + * $Id: packet-vines.c,v 1.1 1998/09/17 02:37:46 gerald Exp $ + * + * Don Lafontaine <lafont02@cn.ca> + * + * 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. + */ + +#include "config.h" + +#include <gtk/gtk.h> +#include <pcap.h> + +#include <stdio.h> + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif + +#include "ethereal.h" +#include "packet.h" +#include "etypes.h" +#include "packet-vines.h" + +#define VINES_VSPP 2 +#define VINES_DATA 1 + +void +dissect_vines(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) + { + e_vip iph; + GtkWidget *vip_tree, *ti; + gchar tos_str[32]; + + /* To do: check for runts, errs, etc. */ + /* Avoids alignment problems on many architectures. */ + memcpy(&iph, &pd[offset], sizeof(e_vip)); + + iph.vip_sum = pntohs(&pd[offset]); + iph.vip_len = pntohs(&pd[offset+2]); + iph.vip_dnet = pntohl(&pd[offset+6]); + iph.vip_snet = pntohl(&pd[offset+12]); + iph.vip_dsub = pntohs(&pd[offset+10]); + iph.vip_ssub = pntohs(&pd[offset+16]); + + if (fd->win_info[0]) + { + switch (iph.vip_proto) + { + case VINES_VSPP: + strcpy(fd->win_info[3], "Vines"); + sprintf(fd->win_info[4], "VSPP (%02x)", iph.vip_proto); + break; + case VINES_DATA: + strcpy(fd->win_info[3], "Vines IP"); + sprintf(fd->win_info[4], "DATA (%02x)", iph.vip_proto); + break; + default: + strcpy(fd->win_info[3], "Vines IP"); + sprintf(fd->win_info[4], "Unknown VIP protocol (%02x)", iph.vip_proto); + } + + sprintf(fd->win_info[1], "%08x.%04x", iph.vip_snet, iph.vip_ssub); + sprintf(fd->win_info[2], "%08x.%04x", iph.vip_dnet, iph.vip_dsub); + } + /* + iph.ip_tos = IPTOS_TOS(iph.ip_tos); + switch (iph.ip_tos) + { + case IPTOS_NONE: + strcpy(tos_str, "None"); + break; + case IPTOS_LOWDELAY: + strcpy(tos_str, "Minimize delay"); + break; + case IPTOS_THROUGHPUT: + strcpy(tos_str, "Maximize throughput"); + break; + case IPTOS_RELIABILITY: + strcpy(tos_str, "Maximize reliability"); + break; + case IPTOS_LOWCOST: + strcpy(tos_str, "Minimize cost"); + break; + default: + strcpy(tos_str, "Unknon. Malformed?"); + break; + } + */ + if (tree) + { + ti = add_item_to_tree(GTK_WIDGET(tree), offset, (iph.vip_len), + "Vines IP"); + vip_tree = gtk_tree_new(); + add_subtree(ti, vip_tree, ETT_VINES); + add_item_to_tree(vip_tree, offset, 2, "Header checksum: 0x%04x", iph.vip_sum); + add_item_to_tree(vip_tree, offset + 2, 2, "Header length: 0x%02x (%d)", iph.vip_len, iph.vip_len); + add_item_to_tree(vip_tree, offset + 4, 1, "Transport control: 0x%02x", + iph.vip_tos); + add_item_to_tree(vip_tree, offset + 5, 1, "Protocol: 0x%02x", iph.vip_proto); + } + + + offset += 18; + switch (iph.vip_proto) + { + case VINES_VSPP: + dissect_vspp(pd, offset, fd, tree); + break; + } + } +#define VINES_VSPP_DATA 1 +#define VINES_VSPP_ACK 5 +void dissect_vspp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) + { + e_vspp iph; + GtkWidget *vspp_tree, *ti; + gchar tos_str[32]; + + /* To do: check for runts, errs, etc. */ + /* Avoids alignment problems on many architectures. */ + memcpy(&iph, &pd[offset], sizeof(e_vspp)); + + iph.vspp_sport = ntohs(iph.vspp_sport); + iph.vspp_dport = ntohs(iph.vspp_dport); + iph.vspp_lclid = ntohs(iph.vspp_lclid); + iph.vspp_rmtid = ntohs(iph.vspp_rmtid); + + if (fd->win_info[0]) + { + switch (iph.vspp_pkttype) + { + case VINES_VSPP_DATA: + strcpy(fd->win_info[3], "Vines"); + sprintf(fd->win_info[4], "VSPP Data Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x D=%04x S=%04x", + iph.vspp_sport, iph.vspp_seq, iph.vspp_ack, iph.vspp_win, iph.vspp_rmtid, + iph.vspp_lclid, iph.vspp_dport, iph.vspp_sport); + break; + case VINES_VSPP_ACK: + strcpy(fd->win_info[3], "Vines"); + sprintf(fd->win_info[4], "VSPP Ack Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x", + iph.vspp_sport, iph.vspp_seq, iph.vspp_ack, iph.vspp_win, iph.vspp_rmtid, + iph.vspp_lclid); + + break; + default: + strcpy(fd->win_info[3], "Vines IP"); + sprintf(fd->win_info[4], "Unknown VSPP packet type (%02x)", iph.vspp_pkttype); + } + } + /* + iph.ip_tos = IPTOS_TOS(iph.ip_tos); + switch (iph.ip_tos) + { + case IPTOS_NONE: + strcpy(tos_str, "None"); + break; + case IPTOS_LOWDELAY: + strcpy(tos_str, "Minimize delay"); + break; + case IPTOS_THROUGHPUT: + strcpy(tos_str, "Maximize throughput"); + break; + case IPTOS_RELIABILITY: + strcpy(tos_str, "Maximize reliability"); + break; + case IPTOS_LOWCOST: + strcpy(tos_str, "Minimize cost"); + break; + default: + strcpy(tos_str, "Unknon. Malformed?"); + break; + } +*/ + if (tree) + { + ti = add_item_to_tree(GTK_WIDGET(tree), offset, sizeof(iph), + "Vines SPP"); + vspp_tree = gtk_tree_new(); + add_subtree(ti, vspp_tree, ETT_VSPP); + add_item_to_tree(vspp_tree, offset, 2, "Source port: 0x%04x", iph.vspp_sport); + add_item_to_tree(vspp_tree, offset+2, 2, "Destination port: 0x%04x", iph.vspp_dport); + add_item_to_tree(vspp_tree, offset+4, 1, "Packet type: 0x%02x", iph.vspp_pkttype); + add_item_to_tree(vspp_tree, offset+5, 1, "Control: 0x%02x", iph.vspp_tos); + add_item_to_tree(vspp_tree, offset+6, 2, "Local Connection ID: 0x%04x", iph.vspp_lclid); + add_item_to_tree(vspp_tree, offset+8, 2, "Remote Connection ID: 0x%04x", iph.vspp_rmtid); + add_item_to_tree(vspp_tree, offset+10, 2, "Sequence number: 0x%04x", iph.vspp_seq); + add_item_to_tree(vspp_tree, offset+12, 2, "Ack number: 0x%04x", iph.vspp_ack); + add_item_to_tree(vspp_tree, offset+14, 2, "Window: 0x%04x", iph.vspp_win); + } + + } diff --git a/packet-vines.h b/packet-vines.h new file mode 100644 index 0000000000..f028bf6910 --- /dev/null +++ b/packet-vines.h @@ -0,0 +1,85 @@ +/* packet-vines.h + * Definitions for packet disassembly structures and routines + * + * $Id: packet-vines.h,v 1.1 1998/09/17 02:37:46 gerald Exp $ + * + * Don Lafontaine <lafont02@cn.ca> + * + * 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. + */ + + +#ifndef __PACKETVINES_H__ +#define __PACKETVINES_H__ + +/* VINES IP structs and definitions */ + +typedef struct _e_vip { + guint16 vip_sum; + guint16 vip_len; + guint8 vip_tos; + guint8 vip_proto; /* 2 = VSPP */ + guint32 vip_dnet; + guint16 vip_dsub; + guint32 vip_snet; + guint16 vip_ssub; + +} e_vip; + +/* VINES SPP structs and definitions */ + +typedef struct _e_vspp { + guint16 vspp_sport; + guint16 vspp_dport; + guint8 vspp_pkttype; /* 5=ack 1=data */ + guint8 vspp_tos; /* Unused with type 5 packets */ + guint16 vspp_lclid; + guint16 vspp_rmtid; + guint16 vspp_seq; + guint16 vspp_ack; + guint16 vspp_win; +} e_vspp; + +/* VINES SMB structs and definitions */ + +typedef struct _e_vsmb { + guint32 vsmb_tag; + guint8 vsmb_func; + guint8 vsmb_d1; + guint32 vsmb_d2; + guint32 vsmb_d3; + guint16 vsmb_d4; + guint32 vsmb_d5; + guint32 vsmb_d6; + guint16 vsmb_treeid; + guint16 vsmb_pid; + guint16 vsmb_uid; + guint16 vsmb_mid; + guint8 vsmb_wcnt; + guint16 vsmb_pbytes; + guint16 vsmb_dbytes; + guint16 vsmb_maxpbytes; + guint16 vsmb_maxdbytes; + guint16 vsmb_setupw; + guint16 vsmb_tflags; + guint32 vsmb_ttw; +} e_vsmb; + +#endif /* packet-vines.h */ @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.3 1998/09/17 02:01:49 gerald Exp $ + * $Id: packet.h,v 1.4 1998/09/17 02:37:47 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -284,9 +284,11 @@ typedef struct _e_udphdr { #define ETT_IPv6 33 #define ETT_CLNP 34 #define ETT_COTP 35 +#define ETT_VINES 36 +#define ETT_VSPP 37 /* Should be the last item number plus one */ -#define NUM_TREE_TYPES 36 +#define NUM_TREE_TYPES 38 /* The version of pcap.h that comes with some systems is missing these * #defines. @@ -350,6 +352,8 @@ void dissect_ospf_hello(const u_char *, int, frame_data *, GtkTree *); void dissect_tcp(const u_char *, int, frame_data *, GtkTree *); void dissect_trmac(const u_char *, int, frame_data *, GtkTree *); void dissect_udp(const u_char *, int, frame_data *, GtkTree *); +void dissect_vines(const u_char *, int, frame_data *, GtkTree *); +void dissect_vspp(const u_char *, int, frame_data *, GtkTree *); /* This function is in ethertype.c */ void ethertype(guint16 etype, int offset, |