/* packet-isl.c
* Routines for Cisco ISL Ethernet header disassembly
*
- * $Id: packet-isl.c,v 1.24 2001/04/19 23:02:44 guy Exp $
+ * $Id: packet-isl.c,v 1.33 2003/08/08 17:57:44 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
* 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.
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
#include "packet-isl.h"
#include "packet-eth.h"
#include "packet-tr.h"
/*
* See
*
- * http://www.cisco.com/warp/public/741/4.html
+ * http://www.cisco.com/warp/public/473/741_4.html
*
* and
*
static dissector_handle_t eth_handle;
static dissector_handle_t tr_handle;
+static dissector_handle_t data_handle;
void
-capture_isl(const u_char *pd, int offset, packet_counts *ld)
+capture_isl(const guchar *pd, int offset, int len, packet_counts *ld)
{
guint8 type;
- if (!BYTES_ARE_IN_FRAME(offset, ISL_HEADER_SIZE)) {
+ if (!BYTES_ARE_IN_FRAME(offset, len, ISL_HEADER_SIZE)) {
ld->other++;
return;
}
case TYPE_ETHER:
offset += 14+12; /* skip the header */
- capture_eth(pd, offset, ld);
+ capture_eth(pd, offset, len, ld);
break;
case TYPE_TR:
offset += 14+17; /* skip the header */
- capture_tr(pd, offset, ld);
+ capture_tr(pd, offset, len, ld);
break;
default:
gint crc_offset;
gint captured_length;
tvbuff_t *next_tvb;
- const guint8 *compat_pd;
- int compat_offset;
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "ISL");
- 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, "ISL");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
type = (tvb_get_guint8(tvb, 5) >> 4)&0x0F;
field (which is, admittedly, an OUI). */
proto_tree_add_item(fh_tree, hf_isl_hsa, tvb, 17, 3, FALSE);
}
- if (check_col(pinfo->fd, COL_INFO))
- col_add_fstr(pinfo->fd, COL_INFO, "VLAN ID: 0x%04X",
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_fstr(pinfo->cinfo, COL_INFO, "VLAN ID: 0x%04X",
tvb_get_ntohs(tvb, 20) >> 1);
if (tree) {
proto_tree_add_item(fh_tree, hf_isl_vlan_id, tvb, 20, 2, FALSE);
next_tvb = tvb_new_subset(tvb, ISL_HEADER_SIZE, captured_length, length);
- /* Set "pinfo"'s payload and captured-payload lengths to the values
- we calculated.
-
- XXX - when all dissectors are tvbuffified we shouldn't have to
- do this any more. */
- tvb_compat(next_tvb, &compat_pd, &compat_offset);
- pinfo->len = compat_offset + length;
- pinfo->captured_len = compat_offset + captured_length;
-
call_dissector(eth_handle, next_tvb, pinfo, tree);
}
}
default:
next_tvb = tvb_new_subset(tvb, ISL_HEADER_SIZE, -1, -1);
- dissect_data(next_tvb, 0, pinfo, tree);
+ call_dissector(data_handle,next_tvb, pinfo, tree);
break;
}
}
-
+
void
proto_register_isl(void)
{
static hf_register_info hf[] = {
{ &hf_isl_dst,
{ "Destination", "isl.dst", FT_ETHER, BASE_NONE, NULL, 0x0,
- "Destination Address" }},
+ "Destination Address", HFILL }},
{ &hf_isl_type,
{ "Type", "isl.type", FT_UINT8, BASE_DEC,
- VALS(type_vals), 0xF0, "Type" }},
+ VALS(type_vals), 0xF0, "Type", HFILL }},
{ &hf_isl_user_eth,
{ "User", "isl.user_eth", FT_UINT8, BASE_DEC,
- VALS(ether_user_vals), 0x0F, "Priority (for Ethernet)" }},
+ VALS(ether_user_vals), 0x0F, "Priority (for Ethernet)", HFILL }},
{ &hf_isl_user,
{ "User", "isl.user", FT_UINT8, BASE_HEX, NULL, 0x0F,
- "User-defined bits" }},
+ "User-defined bits", HFILL }},
{ &hf_isl_src,
{ "Source", "isl.src", FT_ETHER, BASE_NONE, NULL, 0x0,
- "Source Hardware Address" }},
+ "Source Hardware Address", HFILL }},
{ &hf_isl_addr,
{ "Source or Destination Address", "isl.addr", FT_ETHER, BASE_NONE, NULL, 0x0,
- "Source or Destination Hardware Address" }},
+ "Source or Destination Hardware Address", HFILL }},
{ &hf_isl_len,
{ "Length", "isl.len", FT_UINT16, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_isl_hsa,
{ "HSA", "isl.hsa", FT_UINT24, BASE_HEX, NULL, 0x0,
- "High bits of source address" }},
+ "High bits of source address", HFILL }},
{ &hf_isl_vlan_id,
{ "VLAN ID", "isl.vlan_id", FT_UINT16, BASE_HEX, NULL,
- 0xFFFE, "Virtual LAN ID" }},
+ 0xFFFE, "Virtual LAN ID", HFILL }},
{ &hf_isl_bpdu,
{ "BPDU", "isl.bpdu", FT_BOOLEAN, 16,
- TFS(&bpdu_tfs), 0x0001, "BPDU indicator" }},
+ TFS(&bpdu_tfs), 0x0001, "BPDU indicator", HFILL }},
{ &hf_isl_index,
{ "Index", "isl.index", FT_UINT16, BASE_DEC, NULL, 0x0,
- "Port index of packet source" }},
+ "Port index of packet source", HFILL }},
{ &hf_isl_crc,
{ "CRC", "isl.crc", FT_UINT32, BASE_HEX, NULL, 0x0,
- "CRC field of encapsulated frame" }},
+ "CRC field of encapsulated frame", HFILL }},
{ &hf_isl_src_vlan_id,
{ "Source VLAN ID", "isl.src_vlan_id", FT_UINT16, BASE_HEX, NULL,
- 0xFFFE, "Source Virtual LAN ID" }},
+ 0xFFFE, "Source Virtual LAN ID", HFILL }},
{ &hf_isl_explorer,
{ "Explorer", "isl.explorer", FT_BOOLEAN, 16,
- TFS(&explorer_tfs), 0x0001, "Explorer" }},
+ TFS(&explorer_tfs), 0x0001, "Explorer", HFILL }},
{ &hf_isl_dst_route_descriptor,
{ "Destination route descriptor", "isl.dst_route_desc",
FT_UINT16, BASE_HEX, NULL, 0x0,
- "Route descriptor to be used for forwarding" }},
+ "Route descriptor to be used for forwarding", HFILL }},
{ &hf_isl_src_route_descriptor,
{ "Source-route descriptor", "isl.src_route_desc",
FT_UINT16, BASE_HEX, NULL, 0x0,
- "Route descriptor to be used for source learning" }},
+ "Route descriptor to be used for source learning", HFILL }},
{ &hf_isl_fcs_not_incl,
{ "FCS Not Included", "isl.fcs_not_incl", FT_BOOLEAN, 9,
- NULL, 0x40, "FCS not included" }},
+ NULL, 0x40, "FCS not included", HFILL }},
{ &hf_isl_esize,
{ "Esize", "isl.esize", FT_UINT8, BASE_DEC, NULL,
- 0x3F, "Frame size for frames less than 64 bytes" }},
+ 0x3F, "Frame size for frames less than 64 bytes", HFILL }},
};
static gint *ett[] = {
&ett_isl,
*/
eth_handle = find_dissector("eth");
tr_handle = find_dissector("tr");
+ data_handle = find_dissector("data");
}