/* packet-sll.c
* Routines for disassembly of packets from Linux "cooked mode" captures
*
- * $Id: packet-sll.c,v 1.10 2001/06/18 02:17:52 guy Exp $
+ * $Id: packet-sll.c,v 1.15 2001/12/10 00:25:34 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* 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
#include <string.h>
#include <glib.h>
#include "packet.h"
+#include "packet-sll.h"
#include "packet-ipx.h"
#include "packet-llc.h"
#include "resolv.h"
static dissector_handle_t ipx_handle;
static dissector_handle_t llc_handle;
+static dissector_handle_t data_handle;
void
-capture_sll(const u_char *pd, packet_counts *ld)
+capture_sll(const u_char *pd, int len, packet_counts *ld)
{
guint16 protocol;
- if (!BYTES_ARE_IN_FRAME(0, SLL_HEADER_SIZE)) {
+ if (!BYTES_ARE_IN_FRAME(0, len, SLL_HEADER_SIZE)) {
ld->other++;
return;
}
/*
* 802.2 LLC.
*/
- capture_llc(pd, SLL_HEADER_SIZE, ld);
+ capture_llc(pd, len, SLL_HEADER_SIZE, ld);
break;
case LINUX_SLL_P_802_3:
* Novell IPX inside 802.3 with no 802.2 LLC
* header.
*/
- capture_ipx(pd, SLL_HEADER_SIZE, ld);
+ capture_ipx(pd, len, SLL_HEADER_SIZE, ld);
break;
default:
break;
}
} else
- capture_ethertype(protocol, SLL_HEADER_SIZE, pd, ld);
+ capture_ethertype(protocol, pd, SLL_HEADER_SIZE, len, ld);
}
static void
tvbuff_t *next_tvb;
proto_tree *fh_tree = NULL;
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "SLL");
- if (check_col(pinfo->fd, COL_INFO))
- col_clear(pinfo->fd, COL_INFO);
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "SLL");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
pkttype = tvb_get_ntohs(tvb, 0);
- if (check_col(pinfo->fd, COL_INFO))
- col_add_str(pinfo->fd, COL_INFO,
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(pkttype, packet_type_vals, "Unknown (%u)"));
if (tree) {
}
} else {
if (tree) {
- proto_tree_add_bytes(fh_tree, hf_sll_src_other, tvb,
- 6, halen, tvb_get_ptr(tvb, 6, halen));
+ proto_tree_add_item(fh_tree, hf_sll_src_other, tvb,
+ 6, halen, FALSE);
}
}
break;
default:
- dissect_data(next_tvb, 0, pinfo, tree);
+ call_dissector(data_handle,next_tvb, pinfo, tree);
break;
}
} else {
void
proto_reg_handoff_sll(void)
{
+ dissector_handle_t sll_handle;
+
/*
* Get handles for the IPX and LLC dissectors.
*/
llc_handle = find_dissector("llc");
ipx_handle = find_dissector("ipx");
+ data_handle = find_dissector("data");
- dissector_add("wtap_encap", WTAP_ENCAP_SLL, dissect_sll, proto_sll);
+ sll_handle = create_dissector_handle(dissect_sll, proto_sll);
+ dissector_add("wtap_encap", WTAP_ENCAP_SLL, sll_handle);
}