2003-01-22 06:26:36 +00:00
|
|
|
/* packet-mdshdr.c
|
|
|
|
* Routines for dissection of Cisco MDS Switch Internal Header
|
|
|
|
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-01-22 06:26:36 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-01-22 06:26:36 +00:00
|
|
|
* 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.
|
2011-08-08 17:59:32 +00:00
|
|
|
*
|
2003-01-22 06:26:36 +00:00
|
|
|
* 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.
|
2011-08-08 17:59:32 +00:00
|
|
|
*
|
2003-01-22 06:26:36 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-01-22 06:26:36 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2011-08-08 17:59:32 +00:00
|
|
|
#include <etypes.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2003-01-22 06:26:36 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_VERSION_OFFSET 0
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* Mdshdr Control bits */
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_CTL_IDXDIRECT 1
|
|
|
|
#define MDSHDR_CTL_IGNACLO 2
|
|
|
|
#define MDSHDR_CTL_DRP 4
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* OFFSETS OF FIELDS */
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_VER_OFFSET 0
|
|
|
|
#define MDSHDR_SOF_OFFSET 1
|
|
|
|
#define MDSHDR_PKTLEN_OFFSET 2
|
|
|
|
#define MDSHDR_DIDX_OFFSET 5
|
|
|
|
#define MDSHDR_SIDX_OFFSET 6
|
2003-01-22 06:26:36 +00:00
|
|
|
#define MDSHDR_VSAN_OFFSET 13
|
|
|
|
|
|
|
|
/* Two size definitions are sufficient */
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_SIZE_BYTE sizeof(gchar)
|
|
|
|
#define MDSHDR_SIZE_INT16 sizeof(guint16)
|
|
|
|
#define MDSHDR_SIZE_INT32 sizeof(guint32)
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* Other miscellaneous defines; can't rely on sizeof structs */
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_MAX_VERSION 0
|
2003-01-22 06:26:36 +00:00
|
|
|
#define MDSHDR_HEADER_SIZE 16
|
2012-05-03 21:01:22 +00:00
|
|
|
#define MDSHDR_TRAILER_SIZE 6
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* SOF Encodings */
|
|
|
|
#define MDSHDR_SOFc1 0x1
|
|
|
|
#define MDSHDR_SOFi1 0x2
|
|
|
|
#define MDSHDR_SOFn1 0x3
|
|
|
|
#define MDSHDR_SOFi2 0x4
|
|
|
|
#define MDSHDR_SOFn2 0x5
|
|
|
|
#define MDSHDR_SOFi3 0x6
|
|
|
|
#define MDSHDR_SOFn3 0x7
|
|
|
|
#define MDSHDR_SOFf 0x8
|
|
|
|
#define MDSHDR_SOFc4 0x9
|
|
|
|
#define MDSHDR_SOFi4 0xa
|
|
|
|
#define MDSHDR_SOFn4 0xb
|
|
|
|
|
|
|
|
/* EOF Encodings */
|
|
|
|
#define MDSHDR_EOFt 0x1
|
|
|
|
#define MDSHDR_EOFdt 0x2
|
|
|
|
#define MDSHDR_EOFa 0x4
|
|
|
|
#define MDSHDR_EOFn 0x3
|
|
|
|
#define MDSHDR_EOFdti 0x6
|
|
|
|
#define MDSHDR_EOFni 0x7
|
|
|
|
#define MDSHDR_EOFrt 0xa
|
|
|
|
#define MDSHDR_EOFrti 0xe
|
|
|
|
#define MDSHDR_EOF_UNKNOWN 0xb
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_mdshdr = -1;
|
|
|
|
static int hf_mdshdr_sof = -1;
|
|
|
|
static int hf_mdshdr_pkt_len = -1;
|
|
|
|
static int hf_mdshdr_dstidx = -1;
|
|
|
|
static int hf_mdshdr_srcidx = -1;
|
|
|
|
static int hf_mdshdr_vsan = -1;
|
|
|
|
static int hf_mdshdr_eof = -1;
|
2003-01-23 07:01:52 +00:00
|
|
|
static int hf_mdshdr_span = -1;
|
2003-10-27 19:30:55 +00:00
|
|
|
static int hf_mdshdr_fccrc = -1;
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_mdshdr = -1;
|
|
|
|
static gint ett_mdshdr_hdr = -1;
|
|
|
|
static gint ett_mdshdr_trlr = -1;
|
|
|
|
|
|
|
|
static dissector_handle_t data_handle, fc_dissector_handle;
|
|
|
|
|
2003-06-07 09:35:13 +00:00
|
|
|
static gboolean decode_if_zero_etype = TRUE;
|
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
static const value_string sof_vals[] = {
|
|
|
|
{MDSHDR_SOFc1, "SOFc1"},
|
|
|
|
{MDSHDR_SOFi1, "SOFi1"},
|
|
|
|
{MDSHDR_SOFn1, "SOFn1"},
|
|
|
|
{MDSHDR_SOFi2, "SOFi2"},
|
|
|
|
{MDSHDR_SOFn2, "SOFn2"},
|
|
|
|
{MDSHDR_SOFi3, "SOFi3"},
|
|
|
|
{MDSHDR_SOFn3, "SOFn3"},
|
|
|
|
{MDSHDR_SOFc4, "SOFc4"},
|
|
|
|
{MDSHDR_SOFi4, "SOFi4"},
|
|
|
|
{MDSHDR_SOFn4, "SOFn4"},
|
|
|
|
{MDSHDR_SOFf, "SOFf"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string eof_vals[] = {
|
|
|
|
{MDSHDR_EOFt, "EOFt"},
|
|
|
|
{MDSHDR_EOFdt, "EOFdt"},
|
|
|
|
{MDSHDR_EOFa, "EOFa"},
|
|
|
|
{MDSHDR_EOFn, "EOFn"},
|
|
|
|
{MDSHDR_EOFdti, "EOFdti"},
|
|
|
|
{MDSHDR_EOFni, "EOFni"},
|
|
|
|
{MDSHDR_EOFrt, "EOFrt"},
|
|
|
|
{MDSHDR_EOFrti, "EOFrti"},
|
2010-04-22 22:18:56 +00:00
|
|
|
/*{MDSHDR_EOF_UNKNOWN, ""}, intentionally removed*/
|
2003-01-22 06:26:36 +00:00
|
|
|
{0, NULL},
|
|
|
|
};
|
|
|
|
|
2003-06-07 09:35:13 +00:00
|
|
|
void proto_reg_handoff_mdshdr(void);
|
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
static void
|
|
|
|
dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Set up structures needed to add the protocol subtree and manage it */
|
|
|
|
proto_item *ti_main, *ti_hdr, *ti_trlr;
|
2011-08-08 17:59:32 +00:00
|
|
|
proto_item *hidden_item;
|
2003-01-22 06:26:36 +00:00
|
|
|
proto_tree *mdshdr_tree_main, *mdshdr_tree_hdr, *mdshdr_tree_trlr;
|
2012-05-03 21:01:22 +00:00
|
|
|
int offset = 0;
|
|
|
|
guint pktlen;
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
guint8 sof, eof;
|
|
|
|
guint16 vsan;
|
|
|
|
guint8 span_id;
|
|
|
|
int trailer_start = 0; /*0 means "no trailer found"*/
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MDS Header");
|
2011-08-08 17:59:32 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-01-22 06:26:36 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
sof = tvb_get_guint8(tvb, offset+MDSHDR_SOF_OFFSET) & 0x0F;
|
|
|
|
pktlen = tvb_get_ntohs(tvb, offset+MDSHDR_PKTLEN_OFFSET) & 0x1FFF;
|
|
|
|
vsan = tvb_get_ntohs(tvb, offset+MDSHDR_VSAN_OFFSET) & 0x0FFF;
|
|
|
|
span_id = (tvb_get_ntohs(tvb, offset+MDSHDR_VSAN_OFFSET) & 0xF000) >> 12;
|
2011-08-08 17:59:32 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
/* The Mdshdr trailer is at the end of the frame */
|
2012-05-03 21:01:22 +00:00
|
|
|
if ((tvb_length(tvb) >= (MDSHDR_HEADER_SIZE + pktlen))
|
|
|
|
/* Avoid header/trailer overlap if something wrong */
|
|
|
|
&& (pktlen >= MDSHDR_TRAILER_SIZE)) {
|
2011-08-08 17:59:32 +00:00
|
|
|
trailer_start = MDSHDR_HEADER_SIZE + pktlen - MDSHDR_TRAILER_SIZE;
|
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
eof = tvb_get_guint8(tvb, trailer_start);
|
|
|
|
tvb_set_reported_length(tvb, MDSHDR_HEADER_SIZE+pktlen);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
eof = MDSHDR_EOF_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
pinfo->src_idx = (tvb_get_ntohs(tvb, MDSHDR_SIDX_OFFSET) & 0x3FF);
|
|
|
|
pinfo->dst_idx = (tvb_get_ntohs(tvb, MDSHDR_DIDX_OFFSET) & 0xFFC) >> 2;
|
|
|
|
pinfo->vsan = vsan;
|
2003-10-30 02:06:13 +00:00
|
|
|
pinfo->sof_eof = 0;
|
|
|
|
|
|
|
|
if ((sof == MDSHDR_SOFi3) || (sof == MDSHDR_SOFi2) || (sof == MDSHDR_SOFi1)
|
|
|
|
|| (sof == MDSHDR_SOFi4)) {
|
|
|
|
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
|
|
|
}
|
|
|
|
else if (sof == MDSHDR_SOFf) {
|
2011-08-08 17:59:32 +00:00
|
|
|
pinfo->sof_eof = PINFO_SOF_SOFF;
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (eof != MDSHDR_EOFn) {
|
|
|
|
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
|
|
|
}
|
|
|
|
else if (eof != MDSHDR_EOFt) {
|
|
|
|
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
|
|
|
}
|
2011-08-08 17:59:32 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
if (tree) {
|
2012-05-03 21:01:22 +00:00
|
|
|
ti_main = proto_tree_add_protocol_format(tree, proto_mdshdr, tvb, 0,
|
|
|
|
MDSHDR_HEADER_SIZE+pktlen,
|
|
|
|
"MDS Header(%s/%s)",
|
|
|
|
val_to_str(sof, sof_vals, "Unknown(%u)"),
|
|
|
|
val_to_str(eof, eof_vals, "Unknown(%u)"));
|
2003-01-22 06:26:36 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
mdshdr_tree_main = proto_item_add_subtree(ti_main, ett_mdshdr);
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* Add Header part as subtree first */
|
2012-05-03 21:01:22 +00:00
|
|
|
ti_hdr = proto_tree_add_text(mdshdr_tree_main, tvb, MDSHDR_VER_OFFSET,
|
|
|
|
MDSHDR_HEADER_SIZE, "MDS Header");
|
2003-01-22 06:26:36 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
mdshdr_tree_hdr = proto_item_add_subtree(ti_hdr, ett_mdshdr_hdr);
|
|
|
|
hidden_item = proto_tree_add_item(mdshdr_tree_hdr, hf_mdshdr_sof, tvb, MDSHDR_SOF_OFFSET,
|
|
|
|
MDSHDR_SIZE_BYTE, ENC_BIG_ENDIAN);
|
2008-05-15 01:44:53 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2012-05-03 21:01:22 +00:00
|
|
|
proto_tree_add_item(mdshdr_tree_hdr, hf_mdshdr_pkt_len, tvb, MDSHDR_PKTLEN_OFFSET,
|
|
|
|
MDSHDR_SIZE_INT16, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(mdshdr_tree_hdr, hf_mdshdr_dstidx, tvb, MDSHDR_DIDX_OFFSET,
|
|
|
|
MDSHDR_SIZE_INT16, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(mdshdr_tree_hdr, hf_mdshdr_srcidx, tvb, MDSHDR_SIDX_OFFSET,
|
|
|
|
MDSHDR_SIZE_INT16, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(mdshdr_tree_hdr, hf_mdshdr_vsan, tvb, MDSHDR_VSAN_OFFSET,
|
|
|
|
MDSHDR_SIZE_INT16, ENC_BIG_ENDIAN);
|
2008-05-15 01:44:53 +00:00
|
|
|
hidden_item = proto_tree_add_uint(mdshdr_tree_hdr, hf_mdshdr_span,
|
2012-05-03 21:01:22 +00:00
|
|
|
tvb, MDSHDR_VSAN_OFFSET,
|
|
|
|
MDSHDR_SIZE_BYTE, span_id);
|
2008-05-15 01:44:53 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2011-08-08 17:59:32 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
/* Add Mdshdr Trailer part */
|
2012-05-03 21:01:22 +00:00
|
|
|
if (tvb_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
|
|
|
|
&& 0 != trailer_start) {
|
|
|
|
ti_trlr = proto_tree_add_text(mdshdr_tree_main, tvb, trailer_start,
|
|
|
|
MDSHDR_TRAILER_SIZE,
|
|
|
|
"MDS Trailer");
|
|
|
|
mdshdr_tree_trlr = proto_item_add_subtree(ti_trlr, ett_mdshdr_trlr);
|
|
|
|
|
|
|
|
proto_tree_add_item(mdshdr_tree_trlr, hf_mdshdr_eof, tvb,
|
|
|
|
trailer_start, MDSHDR_SIZE_BYTE, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(mdshdr_tree_trlr, hf_mdshdr_fccrc, tvb,
|
|
|
|
trailer_start+2, MDSHDR_SIZE_INT32, ENC_BIG_ENDIAN);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
2010-04-22 22:18:56 +00:00
|
|
|
else {
|
2012-05-03 21:01:22 +00:00
|
|
|
proto_tree_add_text(mdshdr_tree_main, tvb, 0, 0, "MDS Trailer: Not Found");
|
2010-04-22 22:18:56 +00:00
|
|
|
}
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
2011-08-08 17:59:32 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
if (tvb_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
|
|
|
|
&& 0 != pktlen /*if something wrong*/) {
|
|
|
|
next_tvb = tvb_new_subset(tvb, MDSHDR_HEADER_SIZE, pktlen, pktlen);
|
2010-04-22 22:18:56 +00:00
|
|
|
/* XXX what to do with the rest of this frame? --ArtemTamazov */
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-05-03 21:01:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, MDSHDR_HEADER_SIZE);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the Fibre Channel dissector */
|
|
|
|
if (fc_dissector_handle) {
|
2012-05-03 21:01:22 +00:00
|
|
|
call_dissector(fc_dissector_handle, next_tvb, pinfo, tree);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-05-03 21:01:22 +00:00
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_mdshdr(void)
|
2011-08-08 17:59:32 +00:00
|
|
|
{
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_mdshdr_sof,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"SOF", "mdshdr.sof", FT_UINT8, BASE_DEC, VALS(sof_vals), 0x0, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
{ &hf_mdshdr_pkt_len,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"Packet Len", "mdshdr.plen", FT_UINT16, BASE_DEC, NULL, 0x1FFF, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
{ &hf_mdshdr_dstidx,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"Dst Index", "mdshdr.dstidx", FT_UINT16, BASE_HEX, NULL, 0xFFC, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
{ &hf_mdshdr_srcidx,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"Src Index", "mdshdr.srcidx", FT_UINT16, BASE_HEX, NULL, 0x3FF, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
{ &hf_mdshdr_vsan,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"VSAN", "mdshdr.vsan", FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-22 06:26:36 +00:00
|
|
|
{ &hf_mdshdr_eof,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"EOF", "mdshdr.eof", FT_UINT8, BASE_DEC, VALS(eof_vals), 0x0, NULL, HFILL}},
|
2012-05-03 21:01:22 +00:00
|
|
|
|
2003-01-23 07:01:52 +00:00
|
|
|
{ &hf_mdshdr_span,
|
2012-05-03 21:01:22 +00:00
|
|
|
{"SPAN Frame", "mdshdr.span", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
|
|
|
|
2003-10-27 19:30:55 +00:00
|
|
|
{ &hf_mdshdr_fccrc,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{"CRC", "mdshdr.crc", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
|
2003-01-22 06:26:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_mdshdr,
|
|
|
|
&ett_mdshdr_hdr,
|
|
|
|
&ett_mdshdr_trlr
|
|
|
|
};
|
2003-06-07 09:35:13 +00:00
|
|
|
module_t *mdshdr_module;
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
2003-06-07 09:35:13 +00:00
|
|
|
proto_mdshdr = proto_register_protocol("MDS Header", "MDS Header", "mdshdr");
|
2003-01-22 06:26:36 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_mdshdr, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2003-06-07 09:35:13 +00:00
|
|
|
|
2012-05-03 21:01:22 +00:00
|
|
|
mdshdr_module = prefs_register_protocol(proto_mdshdr, proto_reg_handoff_mdshdr);
|
|
|
|
prefs_register_bool_preference(mdshdr_module, "decode_if_etype_zero",
|
|
|
|
"Decode as MDS Header if Ethertype == 0",
|
|
|
|
"A frame is considered for decoding as MDSHDR if either "
|
|
|
|
"ethertype is 0xFCFC or zero. Turn this flag off if you "
|
2013-01-24 01:39:59 +00:00
|
|
|
"don't want ethertype zero to be decoded as MDSHDR. "
|
2012-05-03 21:01:22 +00:00
|
|
|
"This might be useful to avoid problems with test frames.",
|
|
|
|
&decode_if_zero_etype);
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_mdshdr(void)
|
|
|
|
{
|
2003-06-07 09:35:13 +00:00
|
|
|
static dissector_handle_t mdshdr_handle;
|
2012-05-03 21:01:22 +00:00
|
|
|
static gboolean registered_for_zero_etype = FALSE;
|
|
|
|
static gboolean mdshdr_prefs_initialized = FALSE;
|
2003-06-07 09:35:13 +00:00
|
|
|
|
|
|
|
if (!mdshdr_prefs_initialized) {
|
|
|
|
/*
|
|
|
|
* This is the first time this has been called (i.e.,
|
2006-05-31 17:38:42 +00:00
|
|
|
* Wireshark/TShark is starting up), so create a handle for
|
2003-06-07 09:35:13 +00:00
|
|
|
* the MDS Header dissector, register the dissector for
|
|
|
|
* ethertype ETHERTYPE_FCFT, and fetch the data and Fibre
|
|
|
|
* Channel handles.
|
|
|
|
*/
|
2012-05-03 21:01:22 +00:00
|
|
|
mdshdr_handle = create_dissector_handle(dissect_mdshdr, proto_mdshdr);
|
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_FCFT, mdshdr_handle);
|
|
|
|
data_handle = find_dissector("data");
|
|
|
|
fc_dissector_handle = find_dissector("fc");
|
2003-06-07 09:35:13 +00:00
|
|
|
mdshdr_prefs_initialized = TRUE;
|
|
|
|
}
|
2003-01-22 06:26:36 +00:00
|
|
|
|
2003-06-07 09:35:13 +00:00
|
|
|
/*
|
|
|
|
* Only register the dissector for ethertype 0 if the preference
|
|
|
|
* is set to do so.
|
|
|
|
*/
|
|
|
|
if (decode_if_zero_etype) {
|
|
|
|
/*
|
|
|
|
* The preference to register for ethertype ETHERTYPE_UNK (0)
|
|
|
|
* is set; if we're not registered for ethertype ETHERTYPE_UNK,
|
|
|
|
* do so.
|
|
|
|
*/
|
|
|
|
if (!registered_for_zero_etype) {
|
2012-05-03 21:01:22 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_UNK, mdshdr_handle);
|
2003-06-07 09:35:13 +00:00
|
|
|
registered_for_zero_etype = TRUE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* The preference to register for ethertype ETHERTYPE_UNK (0)
|
|
|
|
* is not set; if we're registered for ethertype ETHERTYPE_UNK,
|
|
|
|
* undo that registration.
|
|
|
|
*/
|
|
|
|
if (registered_for_zero_etype) {
|
2012-05-03 21:01:22 +00:00
|
|
|
dissector_delete_uint("ethertype", ETHERTYPE_UNK, mdshdr_handle);
|
2003-06-07 09:35:13 +00:00
|
|
|
registered_for_zero_etype = FALSE;
|
|
|
|
}
|
|
|
|
}
|
2003-01-22 06:26:36 +00:00
|
|
|
}
|