2 * Routines for IEEE 802.2 LLC layer
3 * Gilbert Ramirez <gram@verdict.uthscsa.edu>
5 * $Id: packet-llc.c,v 1.6 1998/09/23 05:25:10 gram Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@unicom.net>
9 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
43 void (*func) (const u_char *, int, frame_data *, GtkTree *);
47 static struct sap_info saps[] = {
48 { 0x00, NULL, "NULL LSAP" },
49 { 0x02, NULL, "LLC Sub-Layer Management Individual" },
50 { 0x03, NULL, "LLC Sub-Layer Management Group" },
51 { 0x04, NULL, "SNA Path Control Individual" },
52 { 0x05, NULL, "SNA Path Control Group" },
53 { 0x06, dissect_ip, "TCP/IP" },
54 { 0x08, NULL, "SNA" },
55 { 0x0C, NULL, "SNA" },
56 { 0x42, NULL, "Spanning Tree BPDU" },
57 { 0x7F, NULL, "ISO 802.2" },
58 { 0x80, NULL, "XNS" },
59 { 0xAA, NULL, "SNAP" },
60 /*{ 0xBA, dissect_vines, "Banyan Vines" },
61 { 0xBC, dissect_vines, "Banyan Vines" },*/
62 { 0xBA, NULL, "Banyan Vines" },
63 { 0xBC, NULL, "Banyan Vines" },
64 { 0xE0, dissect_ipx, "NetWare" },
65 { 0xF0, NULL, "NetBIOS" },
66 { 0xF4, NULL, "IBM Net Management Individual" },
67 { 0xF5, NULL, "IBM Net Management Group" },
68 { 0xF8, NULL, "Remote Program Load" },
69 { 0xFC, NULL, "Remote Program Load" },
70 { 0xFE, dissect_osi, "ISO Network Layer" },
71 { 0xFF, NULL, "Global LSAP" },
77 sap_text(u_char sap) {
80 while (saps[i].text != NULL) {
81 if (saps[i].sap == sap) {
90 sap_func(u_char sap) {
93 while (saps[i].text != NULL) {
94 if (saps[i].sap == sap) {
103 llc_org(const u_char *ptr) {
105 unsigned long org = (ptr[0] << 16) | (ptr[1] << 8) | ptr[2];
107 "Encapsulated Ethernet"};
118 dissect_llc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
120 GtkWidget *llc_tree, *ti;
123 void (*dissect) (const u_char *, int, frame_data *, GtkTree *);
126 char *llc_ctrl[4] = {
127 "Information Transfer", "Supervisory",
128 "", "Unnumbered Information" };
130 is_snap = (pd[offset] == 0xAA) && (pd[offset+1] == 0xAA);
132 if (fd->win_info[0]) {
133 strcpy(fd->win_info[3], "LLC");
137 ti = add_item_to_tree(GTK_WIDGET(tree), offset, (is_snap ? 8 : 3),
138 "Logical-Link Control");
139 llc_tree = gtk_tree_new();
140 add_subtree(ti, llc_tree, ETT_LLC);
141 add_item_to_tree(llc_tree, offset, 1, "DSAP: %s (0x%02X)",
142 sap_text(pd[offset]), pd[offset]);
143 add_item_to_tree(llc_tree, offset+1, 1, "SSAP: %s (0x%02X)",
144 sap_text(pd[offset+1]), pd[offset+1]);
145 add_item_to_tree(llc_tree, offset+2, 1, "Control: %s",
146 llc_ctrl[pd[offset+2] & 3]);
150 if (fd->win_info[0]) {
151 strcpy(fd->win_info[4], "802.2 LLC (SNAP)");
154 add_item_to_tree(llc_tree, offset+3, 3,
155 "Organization Code: %s (%02X-%02X-%02X)",
156 llc_org(&pd[offset+3]),
157 pd[offset+3], pd[offset+4], pd[offset+5]);
159 etype = (pd[offset+6] << 8) | pd[offset+7];
161 ethertype(etype, offset, pd, fd, tree, llc_tree);
164 if (fd->win_info[0]) {
165 sprintf(fd->win_info[4], "802.2 LLC (%s)", sap_text(pd[offset]));
168 dissect = sap_func(pd[offset]);
174 dissect(pd, offset, fd, tree);
177 dissect_data(pd, offset, fd, tree);