2 * Routines for FDDI packet disassembly
4 * Laurent Deniel <deniel@worldnet.fr>
6 * $Id: packet-fddi.c,v 1.3 1998/10/13 05:12:13 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@zing.org>
10 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 /* FDDI Frame Control values */
44 #define FDDI_FC_VOID 0x00 /* Void frame */
45 #define FDDI_FC_NRT 0x80 /* Nonrestricted token */
46 #define FDDI_FC_RT 0xc0 /* Restricted token */
47 #define FDDI_FC_MAC 0xc0 /* MAC frame */
48 #define FDDI_FC_SMT 0x40 /* SMT frame */
49 #define FDDI_FC_SMT_INFO 0x41 /* SMT Info */
50 #define FDDI_FC_SMT_NSA 0x4F /* SMT Next station adrs */
51 #define FDDI_FC_SMT_MIN FDDI_FC_SMT_INFO
52 #define FDDI_FC_SMT_MAX FDDI_FC_SMT_NSA
53 #define FDDI_FC_MAC_MIN 0xc1
54 #define FDDI_FC_MAC_BEACON 0xc2 /* MAC Beacon frame */
55 #define FDDI_FC_MAC_CLAIM 0xc3 /* MAC Claim frame */
56 #define FDDI_FC_MAC_MAX 0xcf
57 #define FDDI_FC_LLC_ASYNC 0x50 /* Async. LLC frame */
58 #define FDDI_FC_LLC_ASYNC_MIN FDDI_FC_LLC_ASYNC
59 #define FDDI_FC_LLC_ASYNC_DEF 0x54
60 #define FDDI_FC_LLC_ASYNC_MAX 0x5f
61 #define FDDI_FC_LLC_SYNC 0xd0 /* Sync. LLC frame */
62 #define FDDI_FC_LLC_SYNC_MIN FDDI_FC_LLC_SYNC
63 #define FDDI_FC_LLC_SYNC_MAX 0xd7
64 #define FDDI_FC_IMP_ASYNC 0x60 /* Implementor Async. */
65 #define FDDI_FC_IMP_ASYNC_MIN FDDI_FC_IMP_ASYNC
66 #define FDDI_FC_IMP_ASYNC_MAX 0x6f
67 #define FDDI_FC_IMP_SYNC 0xe0 /* Implementor Synch. */
69 #define FDDI_HEADER_SIZE 13
74 #define FDDI_P_DHOST 1
75 #define FDDI_P_SHOST 7
77 void dissect_fddi(const u_char *pd, frame_data *fd, GtkTree *tree)
81 GtkWidget *fh_tree, *ti;
83 if (fd->cap_len < FDDI_HEADER_SIZE) {
84 dissect_data(pd, offset, fd, tree);
88 fc = (int) pd[FDDI_P_FC];
90 if (fd->win_info[COL_NUM]) {
91 strcpy(fd->win_info[COL_DESTINATION], get_ether_name((u_char *)&pd[FDDI_P_DHOST]));
92 strcpy(fd->win_info[COL_SOURCE], get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
93 strcpy(fd->win_info[COL_INFO], "FDDI");
97 ti = add_item_to_tree(GTK_WIDGET(tree), 0, offset,
98 "FDDI %s (%d on wire, %d captured)",
99 (fc >= FDDI_FC_LLC_ASYNC_MIN && fc <= FDDI_FC_LLC_ASYNC_MAX) ?
100 "Async LLC" : "unsupported FC",
101 fd->pkt_len, fd->cap_len);
103 fh_tree = gtk_tree_new();
104 add_subtree(ti, fh_tree, ETT_FDDI);
105 add_item_to_tree(fh_tree, FDDI_P_FC, 1, "Frame Control: 0x%02x", fc);
106 add_item_to_tree(fh_tree, FDDI_P_DHOST, 6, "Destination: %s (%s)",
107 ether_to_str((guint8 *) &pd[FDDI_P_DHOST]),
108 get_ether_name((u_char *) &pd[FDDI_P_DHOST]));
109 add_item_to_tree(fh_tree, FDDI_P_SHOST, 6, "Source: %s (%s)",
110 ether_to_str((guint8 *) &pd[FDDI_P_SHOST]),
111 get_ether_name((u_char *)&pd[FDDI_P_SHOST]));
114 offset = FDDI_HEADER_SIZE;
118 /* From now, only 802.2 SNAP (Async. LCC frame) is supported */
120 case FDDI_FC_LLC_ASYNC + 0 :
121 case FDDI_FC_LLC_ASYNC + 1 :
122 case FDDI_FC_LLC_ASYNC + 2 :
123 case FDDI_FC_LLC_ASYNC + 3 :
124 case FDDI_FC_LLC_ASYNC + 4 :
125 case FDDI_FC_LLC_ASYNC + 5 :
126 case FDDI_FC_LLC_ASYNC + 6 :
127 case FDDI_FC_LLC_ASYNC + 7 :
128 case FDDI_FC_LLC_ASYNC + 8 :
129 case FDDI_FC_LLC_ASYNC + 9 :
130 case FDDI_FC_LLC_ASYNC + 10 :
131 case FDDI_FC_LLC_ASYNC + 11 :
132 case FDDI_FC_LLC_ASYNC + 12 :
133 case FDDI_FC_LLC_ASYNC + 13 :
134 case FDDI_FC_LLC_ASYNC + 14 :
135 case FDDI_FC_LLC_ASYNC + 15 :
136 dissect_llc(pd, offset, fd, tree);
140 dissect_data(pd, offset, fd, tree);