aboutsummaryrefslogtreecommitdiffstats
path: root/packet-llc.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-04-17 00:32:43 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-04-17 00:32:43 +0000
commit9ec8de619bf2a0570bb182426fc772e6d34b8781 (patch)
treebeec035095e135d72c17c3cdee265524a117611f /packet-llc.c
parent99c3bce667e07a5c303c05ac0c95f42b1abba3e9 (diff)
Register a "llc.dsap" dissector table for 802.2 LLC, and have dissectors
for protocols that run inside 802.2 LLC register themselves with it using "dissector_add()". Make various dissectors static if they can be, and remove from header files declarations of those dissectors. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1872 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-llc.c')
-rw-r--r--packet-llc.c128
1 files changed, 47 insertions, 81 deletions
diff --git a/packet-llc.c b/packet-llc.c
index 732f0ecc12..dc1948e3bc 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-llc.c,v 1.54 2000/04/13 02:36:35 guy Exp $
+ * $Id: packet-llc.c,v 1.55 2000/04/17 00:32:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,6 +37,7 @@
#include "oui.h"
#include "xdlc.h"
#include "etypes.h"
+#include "llcsaps.h"
#include "packet-bpdu.h"
#include "packet-cdp.h"
#include "packet-cgmp.h"
@@ -60,16 +61,17 @@ static int hf_llc_pid = -1;
static gint ett_llc = -1;
static gint ett_llc_ctrl = -1;
+static dissector_table_t subdissector_table;
+
typedef void (capture_func_t)(const u_char *, int, packet_counts *);
-typedef void (dissect_func_t)(const u_char *, int, frame_data *, proto_tree *);
-/* The SAP info is split into two tables, one value_string table and one table of sap_info. This is
- * so that the value_string can be used in the header field registration.
+/* The SAP info is split into two tables, one value_string table and one
+ * table of sap_info. This is so that the value_string can be used in the
+ * header field registration.
*/
struct sap_info {
guint8 sap;
capture_func_t *capture_func;
- dissect_func_t *dissect_func;
};
/*
@@ -97,8 +99,6 @@ struct sap_info {
*/
#define SAP_MASK 0xFE
-#define SAP_SNAP 0xAA
-
/*
* These are for SSAP and DSAP, wth last bit always zero.
* XXX - some DSAPs come in separate "individual" and "group" versions,
@@ -107,64 +107,45 @@ struct sap_info {
* the ISO Network Layer Protocol, 0xFF is the Global LSAP.
*/
static const value_string sap_vals[] = {
- { 0x00, "NULL LSAP" },
- { 0x02, "LLC Sub-Layer Management" },
- { 0x04, "SNA Path Control" },
- { 0x06, "TCP/IP" },
- { 0x08, "SNA" },
- { 0x0C, "SNA" },
- { 0x0E, "PROWAY (IEC955) Network Management and Initialization" },
- { 0x18, "Texas Instruments" },
- { 0x42, "Spanning Tree BPDU" },
- { 0x4E, "EIA RS-511 Manufacturing Message Service" },
+ { SAP_NULL, "NULL LSAP" },
+ { SAP_LLC_SLMGMT, "LLC Sub-Layer Management" },
+ { SAP_SNA_PATHCTRL, "SNA Path Control" },
+ { SAP_IP, "TCP/IP" },
+ { SAP_SNA1, "SNA" },
+ { SAP_SNA2, "SNA" },
+ { SAP_PROWAY_NM_INIT, "PROWAY (IEC955) Network Management and Initialization" },
+ { SAP_TI, "Texas Instruments" },
+ { SAP_BPDU, "Spanning Tree BPDU" },
+ { SAP_RS511, "EIA RS-511 Manufacturing Message Service" },
#if 0
/* XXX - setting the group bit makes this 0x7F; is that just
a group version of this? */
- { 0x7E, "ISO 8208 (X.25 over 802.2 Type 2)" },
+ { 0x7E, "ISO 8208 (X.25 over 802.2 Type 2)" },
#endif
- { 0x7F, "ISO 802.2" },
- { 0x80, "XNS" },
- { 0x86, "Nestar" },
- { 0x8E, "PROWAY (IEC955) Active Station List Maintenance" },
- { 0x98, "ARP" }, /* XXX - hand to "dissect_arp()"? */
- { SAP_SNAP, "SNAP" },
- { 0xBA, "Banyan Vines" },
- { 0xBC, "Banyan Vines" },
- { 0xE0, "NetWare" },
- { 0xF0, "NetBIOS" },
- { 0xF4, "IBM Net Management" },
- { 0xF8, "Remote Program Load" },
- { 0xFA, "Ungermann-Bass" },
- { 0xFC, "Remote Program Load" },
- { 0xFE, "ISO Network Layer" },
- { 0xFF, "Global LSAP" },
- { 0x00, NULL }
+ { 0x7F, "ISO 802.2" },
+ { SAP_XNS, "XNS" },
+ { SAP_NESTAR, "Nestar" },
+ { SAP_PROWAY_ASLM, "PROWAY (IEC955) Active Station List Maintenance" },
+ { SAP_ARP, "ARP" }, /* XXX - hand to "dissect_arp()"? */
+ { SAP_SNAP, "SNAP" },
+ { SAP_VINES1, "Banyan Vines" },
+ { SAP_VINES2, "Banyan Vines" },
+ { SAP_NETWARE, "NetWare" },
+ { SAP_NETBIOS, "NetBIOS" },
+ { SAP_IBMNM, "IBM Net Management" },
+ { SAP_RPL1, "Remote Program Load" },
+ { SAP_UB, "Ungermann-Bass" },
+ { SAP_RPL2, "Remote Program Load" },
+ { SAP_OSINL, "ISO Network Layer" },
+ { SAP_GLOBAL, "Global LSAP" },
+ { 0x00, NULL }
};
static struct sap_info saps[] = {
- { 0x00, NULL, NULL },
- { 0x02, NULL, NULL },
- { 0x03, NULL, NULL },
- { 0x04, NULL, dissect_sna },
- { 0x05, NULL, NULL },
- { 0x06, capture_ip, dissect_ip },
- { 0x08, NULL, NULL },
- { 0x0C, NULL, NULL },
- { 0x42, NULL, dissect_bpdu },
- { 0x7F, NULL, NULL },
- { 0x80, NULL, NULL },
- { SAP_SNAP, NULL, NULL },
- { 0xBA, NULL, NULL },
- { 0xBC, NULL, NULL },
- { 0xE0, capture_ipx, dissect_ipx },
- { 0xF0, capture_netbios, dissect_netbios },
- { 0xF4, NULL, NULL },
- { 0xF5, NULL, NULL },
- { 0xF8, NULL, NULL },
- { 0xFC, NULL, NULL },
- { 0xFE, NULL, dissect_osi },
- { 0xFF, NULL, NULL },
- { 0x00, NULL, NULL}
+ { SAP_IP, capture_ip },
+ { SAP_NETWARE, capture_ipx },
+ { SAP_NETBIOS, capture_netbios },
+ { 0x00, NULL}
};
/*
@@ -204,22 +185,6 @@ sap_capture_func(u_char sap) {
return NULL;
}
-static dissect_func_t *
-sap_dissect_func(u_char sap) {
- int i=0;
-
- /* look for the second record where sap == 0, which should
- * be the last record
- */
- while (saps[i].sap > 0 || i == 0) {
- if (saps[i].sap == sap) {
- return saps[i].dissect_func;
- }
- i++;
- }
- return &dissect_data;
-}
-
void
capture_llc(const u_char *pd, int offset, packet_counts *ld) {
@@ -308,7 +273,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
int llc_header_len;
guint32 oui;
guint16 etype;
- dissect_func_t *dissect;
+ guint8 dsap;
if (!BYTES_ARE_IN_FRAME(offset, 2)) {
dissect_data(pd, offset, fd, tree);
@@ -459,15 +424,13 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
if (XDLC_IS_INFORMATION(control)) {
- dissect = sap_dissect_func(pd[offset]);
-
/* non-SNAP */
+ dsap = pd[offset];
offset += llc_header_len;
- if (dissect) {
- dissect(pd, offset, fd, tree);
- }
- else {
+ /* do lookup with the subdissector table */
+ if (!dissector_try_port(subdissector_table, dsap,
+ pd, offset, fd, tree)) {
dissect_data(pd, offset, fd, tree);
}
} else {
@@ -525,4 +488,7 @@ proto_register_llc(void)
proto_llc = proto_register_protocol ("Logical-Link Control", "llc" );
proto_register_field_array(proto_llc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+/* subdissector code */
+ subdissector_table = register_dissector_table("llc.dsap");
}