aboutsummaryrefslogtreecommitdiffstats
path: root/packet-fddi.c
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>1998-10-10 03:32:20 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>1998-10-10 03:32:20 +0000
commitef264a695adde71e953a80fe02e4b995a7fd4fc5 (patch)
tree9232afabf0abc9a8e5f5243798fbcc25d4aaa725 /packet-fddi.c
parente12c1bb31a93c2e440e5dc37972947297e683deb (diff)
* OSPF alignment fixes (Gerald)
* FDDI support (Laurent, Guy) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-fddi.c')
-rw-r--r--packet-fddi.c136
1 files changed, 136 insertions, 0 deletions
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 */
+