2003-01-14 01:17:44 +00:00
|
|
|
/* packet-brdwlk.c
|
|
|
|
* Routines for decoding MDS Port Analyzer Adapter (FC in Eth) Header
|
|
|
|
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-01-14 01:17:44 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2012-05-04 21:39:30 +00:00
|
|
|
*
|
2003-01-14 01:17:44 +00:00
|
|
|
* 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.
|
2012-05-04 21:39:30 +00:00
|
|
|
*
|
2003-01-14 01:17:44 +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.
|
2012-05-04 21:39:30 +00:00
|
|
|
*
|
2003-01-14 01:17:44 +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-14 01:17:44 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
2013-11-25 16:04:57 +00:00
|
|
|
#include "packet-fc.h"
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
#define BRDWLK_MAX_PACKET_CNT 0xFFFF
|
|
|
|
#define BRDWLK_TRUNCATED_BIT 0x8
|
2003-10-30 02:06:13 +00:00
|
|
|
#define BRDWLK_HAS_PLEN 0x1
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
#define FCM_DELIM_SOFC1 0x01
|
2010-05-10 15:54:57 +00:00
|
|
|
#define FCM_DELIM_SOFI1 0x02
|
|
|
|
#define FCM_DELIM_SOFI2 0x04
|
|
|
|
#define FCM_DELIM_SOFI3 0x06
|
|
|
|
#define FCM_DELIM_SOFN1 0x03
|
|
|
|
#define FCM_DELIM_SOFN2 0x05
|
|
|
|
#define FCM_DELIM_SOFN3 0x07
|
|
|
|
#define FCM_DELIM_SOFF 0x08
|
2003-01-14 01:17:44 +00:00
|
|
|
#define FCM_DELIM_SOFC4 0x09
|
|
|
|
#define FCM_DELIM_SOFI4 0x0A
|
|
|
|
#define FCM_DELIM_SOFN4 0x0B
|
|
|
|
|
2010-05-10 15:54:57 +00:00
|
|
|
#define FCM_DELIM_EOFT 0x01
|
|
|
|
#define FCM_DELIM_EOFDT 0x02
|
|
|
|
#define FCM_DELIM_EOFN 0x03
|
|
|
|
#define FCM_DELIM_EOFA 0x04
|
2003-01-14 01:17:44 +00:00
|
|
|
#define FCM_DELIM_EOFNI 0x07
|
|
|
|
#define FCM_DELIM_EOFDTI 0x06
|
|
|
|
#define FCM_DELIM_EOFRT 0x0A
|
|
|
|
#define FCM_DELIM_EOFRTI 0x0E
|
|
|
|
#define FCM_DELIM_NOEOF 0xF0
|
|
|
|
#define FCM_DELIM_EOFJUMBO 0xF1
|
|
|
|
|
2013-03-15 04:52:42 +00:00
|
|
|
void proto_register_brdwlk(void);
|
|
|
|
void proto_reg_handoff_brdwlk(void);
|
|
|
|
|
2003-01-14 01:17:44 +00:00
|
|
|
static const value_string brdwlk_sof_vals[] = {
|
|
|
|
{FCM_DELIM_SOFI1, "SOFi1"},
|
|
|
|
{FCM_DELIM_SOFI2, "SOFi2"},
|
|
|
|
{FCM_DELIM_SOFI3, "SOFi3"},
|
|
|
|
{FCM_DELIM_SOFN1, "SOFn1"},
|
|
|
|
{FCM_DELIM_SOFN2, "SOFn2"},
|
|
|
|
{FCM_DELIM_SOFN3, "SOFn3"},
|
|
|
|
{FCM_DELIM_SOFF, "SOFf"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string brdwlk_eof_vals[] = {
|
|
|
|
{FCM_DELIM_EOFDT, "EOFdt"},
|
|
|
|
{FCM_DELIM_EOFA, "EOFa"},
|
|
|
|
{FCM_DELIM_EOFN, "EOFn"},
|
|
|
|
{FCM_DELIM_EOFT, "EOFt"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
static int hf_brdwlk_sof = -1;
|
|
|
|
static int hf_brdwlk_eof = -1;
|
|
|
|
static int hf_brdwlk_error = -1;
|
|
|
|
static int hf_brdwlk_vsan = -1;
|
|
|
|
static int hf_brdwlk_pktcnt = -1;
|
|
|
|
static int hf_brdwlk_drop = -1;
|
2003-10-30 02:06:13 +00:00
|
|
|
static int hf_brdwlk_plen = -1;
|
2005-11-05 02:03:21 +00:00
|
|
|
static int hf_brdwlk_error_plp = -1;
|
|
|
|
static int hf_brdwlk_error_ef = -1;
|
|
|
|
static int hf_brdwlk_error_nd = -1;
|
|
|
|
static int hf_brdwlk_error_tr = -1;
|
|
|
|
static int hf_brdwlk_error_badcrc = -1;
|
|
|
|
static int hf_brdwlk_error_ff = -1;
|
|
|
|
static int hf_brdwlk_error_jumbo = -1;
|
|
|
|
static int hf_brdwlk_error_ctrl = -1;
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_brdwlk = -1;
|
2005-11-05 02:03:21 +00:00
|
|
|
static gint ett_brdwlk_error = -1;
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
static gint proto_brdwlk = -1;
|
|
|
|
|
|
|
|
static guint16 packet_count = 0;
|
|
|
|
static gboolean first_pkt = TRUE; /* start of capture */
|
|
|
|
|
|
|
|
static dissector_handle_t fc_dissector_handle;
|
|
|
|
|
|
|
|
|
2005-11-05 02:03:21 +00:00
|
|
|
static const true_false_string tfs_error_plp = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"Packet Length is PRESENT",
|
|
|
|
"Packet length is NOT present"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_ef = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"This is an Empty Frame",
|
|
|
|
"Frame is NOT empty"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_nd = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"This Frame has NO Data",
|
|
|
|
"This frame carries data"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_tr = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"This frame is TRUNCATED",
|
|
|
|
"This frame is NOT truncated"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_crc = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"This Frame has a BAD FC CRC",
|
|
|
|
"This frame has a valid crc"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_ff = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"Fifo is Full",
|
|
|
|
"Fifo is NOT full"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_jumbo = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"This is a JUMBO FC Frame",
|
|
|
|
"This is a NORMAL FC Frame"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
|
|
|
static const true_false_string tfs_error_ctrl = {
|
2010-05-10 15:54:57 +00:00
|
|
|
"Ctrl Characters inside the frame",
|
|
|
|
"No ctrl chars inside the frame"
|
2005-11-05 02:03:21 +00:00
|
|
|
};
|
2003-01-14 01:17:44 +00:00
|
|
|
|
2005-11-05 02:03:21 +00:00
|
|
|
static void
|
|
|
|
dissect_brdwlk_err(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
|
|
|
|
{
|
2014-12-21 17:26:19 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
2010-05-10 15:54:57 +00:00
|
|
|
guint8 flags;
|
|
|
|
|
2012-05-04 21:39:30 +00:00
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
2014-12-21 17:26:19 +00:00
|
|
|
item = proto_tree_add_uint(parent_tree, hf_brdwlk_error,
|
|
|
|
tvb, offset, 1, flags);
|
|
|
|
tree = proto_item_add_subtree(item, ett_brdwlk_error);
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_plp, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x01) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Packet Length Present");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x01 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_ef, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x02) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Empty Frame");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x02 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_nd, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x04) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " No Data");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x04 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_tr, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x08) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Truncated");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x08 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_badcrc, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x10) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Bad FC CRC");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x10 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_ff, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x20) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Fifo Full");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x20 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_jumbo, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x40) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Jumbo FC Frame");
|
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
flags &= (~( 0x40 ));
|
2010-05-10 15:54:57 +00:00
|
|
|
|
|
|
|
proto_tree_add_boolean(tree, hf_brdwlk_error_ctrl, tvb, offset, 1, flags);
|
2012-05-04 21:39:30 +00:00
|
|
|
if (flags & 0x80) {
|
2010-05-10 15:54:57 +00:00
|
|
|
proto_item_append_text(item, " Ctrl Char Inside Frame");
|
|
|
|
}
|
2013-07-03 16:43:02 +00:00
|
|
|
/*flags &= (~( 0x80 ));*/
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
|
|
|
static void
|
2012-05-04 21:39:30 +00:00
|
|
|
dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2003-01-14 01:17:44 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
/* Set up structures needed to add the protocol subtree and manage it */
|
2008-05-14 01:47:41 +00:00
|
|
|
proto_item *ti, *hidden_item;
|
2014-12-21 17:26:19 +00:00
|
|
|
proto_tree *brdwlk_tree;
|
2003-01-14 01:17:44 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2003-10-30 02:06:13 +00:00
|
|
|
guint8 error, eof, sof;
|
2003-01-14 01:17:44 +00:00
|
|
|
int hdrlen = 2,
|
|
|
|
offset = 0;
|
2003-10-30 02:06:13 +00:00
|
|
|
gint len, reported_len, plen;
|
2003-01-14 01:17:44 +00:00
|
|
|
guint16 pkt_cnt;
|
2003-07-21 21:52:32 +00:00
|
|
|
gboolean dropped_packets;
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data_t fc_data;
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
/* Make entries in Protocol column and Info column on summary display */
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Boardwalk");
|
2012-05-04 21:39:30 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-01-14 01:17:44 +00:00
|
|
|
|
2012-05-04 21:39:30 +00:00
|
|
|
sof = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4;
|
2003-10-30 02:06:13 +00:00
|
|
|
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.sof_eof = 0;
|
2003-10-30 02:06:13 +00:00
|
|
|
if ((sof == FCM_DELIM_SOFI3) || (sof == FCM_DELIM_SOFI2) || (sof == FCM_DELIM_SOFI1)
|
|
|
|
|| (sof == FCM_DELIM_SOFI4)) {
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
|
|
|
else if (sof == FCM_DELIM_SOFF) {
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 17:26:19 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_brdwlk, tvb, 0,
|
|
|
|
hdrlen, "Boardwalk");
|
2003-01-14 01:17:44 +00:00
|
|
|
|
2014-12-21 17:26:19 +00:00
|
|
|
brdwlk_tree = proto_item_add_subtree(ti, ett_brdwlk);
|
2003-01-14 01:17:44 +00:00
|
|
|
|
2014-12-21 17:26:19 +00:00
|
|
|
proto_tree_add_item(brdwlk_tree, hf_brdwlk_sof, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(brdwlk_tree, hf_brdwlk_vsan, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2003-01-23 07:01:52 +00:00
|
|
|
|
2003-07-21 21:30:10 +00:00
|
|
|
/* Locate EOF which is the last 4 bytes of the frame */
|
2014-06-19 17:18:16 +00:00
|
|
|
len = tvb_length_remaining(tvb, hdrlen);
|
2003-07-21 21:30:10 +00:00
|
|
|
reported_len = tvb_reported_length_remaining(tvb, hdrlen);
|
|
|
|
if (reported_len < 4) {
|
|
|
|
/*
|
|
|
|
* This packet is claimed not to even have enough data for
|
|
|
|
* a 4-byte EOF.
|
|
|
|
* Don't try to process the EOF.
|
|
|
|
*/
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else if (len < reported_len) {
|
|
|
|
/*
|
|
|
|
* This packet is claimed to have enough data for a 4-byte EOF,
|
|
|
|
* but we didn't capture all of the packet.
|
|
|
|
* Slice off the 4-byte EOF from the reported length, and trim
|
|
|
|
* the captured length so it's no more than the reported length;
|
|
|
|
* that will slice off what of the EOF, if any, is in the
|
|
|
|
* captured length.
|
|
|
|
*/
|
|
|
|
reported_len -= 4;
|
|
|
|
if (len > reported_len)
|
|
|
|
len = reported_len;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* We have the entire packet, and it includes a 4-byte EOF.
|
|
|
|
* Slice it off, and put it into the tree if we're building
|
|
|
|
* a tree.
|
|
|
|
*/
|
|
|
|
len -= 4;
|
|
|
|
reported_len -= 4;
|
|
|
|
offset = tvb_reported_length(tvb) - 4;
|
2012-05-04 21:39:30 +00:00
|
|
|
pkt_cnt = tvb_get_ntohs(tvb, offset);
|
2003-07-21 21:30:10 +00:00
|
|
|
if (tree) {
|
2012-05-04 21:39:30 +00:00
|
|
|
proto_tree_add_uint(brdwlk_tree, hf_brdwlk_pktcnt, tvb, offset,
|
|
|
|
2, pkt_cnt);
|
2003-07-21 21:30:10 +00:00
|
|
|
}
|
2003-07-21 21:52:32 +00:00
|
|
|
dropped_packets = FALSE;
|
|
|
|
if (pinfo->fd->flags.visited) {
|
|
|
|
/*
|
|
|
|
* This isn't the first pass, so we can't use the global
|
|
|
|
* "packet_count" variable to determine whether there were
|
|
|
|
* any dropped frames or not.
|
|
|
|
* We therefore attach a non-null pointer as frame data to
|
|
|
|
* any frame preceded by dropped packets.
|
|
|
|
*/
|
2013-11-23 02:20:13 +00:00
|
|
|
if (p_get_proto_data(wmem_file_scope(), pinfo, proto_brdwlk, 0) != NULL)
|
2003-07-21 21:52:32 +00:00
|
|
|
dropped_packets = TRUE;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* This is the first pass, so we have to use the global
|
|
|
|
* "packet_count" variable to determine whether there were
|
|
|
|
* any dropped frames or not.
|
|
|
|
*
|
|
|
|
* XXX - can there be more than one stream of packets, so that
|
|
|
|
* we can't just use a global variable?
|
|
|
|
*/
|
|
|
|
if (pkt_cnt != packet_count + 1) {
|
|
|
|
if (!first_pkt &&
|
|
|
|
(pkt_cnt != 0 || (packet_count != BRDWLK_MAX_PACKET_CNT))) {
|
|
|
|
dropped_packets = TRUE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark this frame as having been preceded by dropped
|
|
|
|
* packets. (The data we use as the frame data doesn't
|
|
|
|
* matter - it just matters that it's non-null.)
|
|
|
|
*/
|
2013-11-23 02:20:13 +00:00
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_brdwlk, 0, &packet_count);
|
2003-07-21 21:30:10 +00:00
|
|
|
}
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
2013-07-03 16:43:02 +00:00
|
|
|
}
|
2014-12-21 17:26:19 +00:00
|
|
|
|
|
|
|
hidden_item = proto_tree_add_boolean(brdwlk_tree, hf_brdwlk_drop,
|
|
|
|
tvb, offset, 0, dropped_packets);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2013-07-03 16:43:02 +00:00
|
|
|
|
2003-01-14 01:17:44 +00:00
|
|
|
packet_count = pkt_cnt;
|
2005-11-05 02:03:21 +00:00
|
|
|
|
2012-05-04 21:39:30 +00:00
|
|
|
error=tvb_get_guint8(tvb, offset+2);
|
2010-05-10 15:54:57 +00:00
|
|
|
dissect_brdwlk_err(brdwlk_tree, tvb, offset+2);
|
2003-10-30 02:06:13 +00:00
|
|
|
|
2012-05-04 21:39:30 +00:00
|
|
|
eof = tvb_get_guint8(tvb, offset+3);
|
2003-10-30 02:06:13 +00:00
|
|
|
if (eof != FCM_DELIM_EOFN) {
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
|
|
|
else if (eof != FCM_DELIM_EOFT) {
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
|
2014-12-21 17:26:19 +00:00
|
|
|
proto_tree_add_item(brdwlk_tree, hf_brdwlk_eof, tvb, offset+3,
|
|
|
|
1, ENC_BIG_ENDIAN);
|
2003-10-30 02:06:13 +00:00
|
|
|
|
|
|
|
if ((error & BRDWLK_HAS_PLEN) && tree) {
|
|
|
|
/* In newer Boardwalks, if this bit is set, the actual frame length
|
|
|
|
* is also provided. This length is the size between SOF & EOF
|
|
|
|
* including FC CRC.
|
|
|
|
*/
|
2012-05-04 21:39:30 +00:00
|
|
|
plen = tvb_get_ntohl(tvb, offset-4);
|
2003-10-30 02:06:13 +00:00
|
|
|
plen *= 4;
|
2012-05-04 21:39:30 +00:00
|
|
|
proto_tree_add_uint(brdwlk_tree, hf_brdwlk_plen, tvb, offset-4,
|
|
|
|
4, plen);
|
|
|
|
|
2003-10-30 03:15:26 +00:00
|
|
|
#if 0
|
|
|
|
/* XXX - this would throw an exception if it would increase
|
|
|
|
* the reported length.
|
|
|
|
*/
|
2003-10-30 02:06:13 +00:00
|
|
|
if (error & BRDWLK_TRUNCATED_BIT) {
|
2012-05-04 21:39:30 +00:00
|
|
|
tvb_set_reported_length(tvb, plen);
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
2003-10-30 03:15:26 +00:00
|
|
|
#endif
|
2003-10-30 02:06:13 +00:00
|
|
|
}
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
2012-05-04 21:39:30 +00:00
|
|
|
|
2013-11-25 16:04:57 +00:00
|
|
|
fc_data.ethertype = ETHERTYPE_BRDWALK;
|
2012-05-04 21:39:30 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, 2, len, reported_len);
|
2013-11-25 16:04:57 +00:00
|
|
|
call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, &fc_data);
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
|
|
|
|
2003-07-21 21:52:32 +00:00
|
|
|
static void
|
|
|
|
brdwlk_init(void)
|
|
|
|
{
|
|
|
|
packet_count = 0;
|
|
|
|
first_pkt = TRUE;
|
|
|
|
}
|
2003-01-14 01:17:44 +00:00
|
|
|
|
2006-05-21 04:49:01 +00:00
|
|
|
/* Register the protocol with Wireshark */
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
/* this format is require because a script is used to build the C function
|
|
|
|
that calls all the protocol registration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2012-05-04 21:39:30 +00:00
|
|
|
proto_register_brdwlk(void)
|
|
|
|
{
|
2003-01-14 01:17:44 +00:00
|
|
|
|
|
|
|
/* Setup list of header fields See Section 1.6.1 for details*/
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_brdwlk_sof,
|
2012-05-04 21:39:30 +00:00
|
|
|
{"SOF", "brdwlk.sof", FT_UINT8, BASE_HEX, VALS(brdwlk_sof_vals),
|
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
|
|
|
0xF0, NULL, HFILL}},
|
2003-01-14 01:17:44 +00:00
|
|
|
{ &hf_brdwlk_eof,
|
2012-05-04 21:39:30 +00:00
|
|
|
{"EOF", "brdwlk.eof", FT_UINT8, BASE_HEX, VALS(brdwlk_eof_vals),
|
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
|
|
|
0x0F, NULL, HFILL}},
|
2003-01-14 01:17:44 +00:00
|
|
|
{ &hf_brdwlk_error,
|
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
|
|
|
{"Error", "brdwlk.error", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
|
2003-01-14 01:17:44 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_pktcnt,
|
|
|
|
{"Packet Count", "brdwlk.pktcnt", FT_UINT16, BASE_DEC, NULL, 0x0,
|
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
|
|
|
NULL, HFILL}},
|
2003-01-14 01:17:44 +00:00
|
|
|
{ &hf_brdwlk_drop,
|
2009-05-08 20:35:57 +00:00
|
|
|
{"Packet Dropped", "brdwlk.drop", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
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
|
|
|
NULL, HFILL}},
|
2003-01-14 01:17:44 +00:00
|
|
|
{ &hf_brdwlk_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", "brdwlk.vsan", FT_UINT16, BASE_DEC, NULL, 0xFFF, NULL,
|
2003-01-14 01:17:44 +00:00
|
|
|
HFILL}},
|
2003-10-30 02:06:13 +00:00
|
|
|
{ &hf_brdwlk_plen,
|
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
|
|
|
{"Original Packet Length", "brdwlk.plen", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
|
2003-10-30 02:06:13 +00:00
|
|
|
HFILL}},
|
2005-11-05 02:03:21 +00:00
|
|
|
{ &hf_brdwlk_error_plp,
|
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 Length Present", "brdwlk.error.plp", FT_BOOLEAN, 8, TFS(&tfs_error_plp), 0x01, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_ef,
|
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
|
|
|
{"Empty Frame", "brdwlk.error.ef", FT_BOOLEAN, 8, TFS(&tfs_error_ef), 0x02, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_nd,
|
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
|
|
|
{"No Data", "brdwlk.error.nd", FT_BOOLEAN, 8, TFS(&tfs_error_nd), 0x04, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_tr,
|
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
|
|
|
{"Truncated", "brdwlk.error.tr", FT_BOOLEAN, 8, TFS(&tfs_error_tr), 0x08, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_badcrc,
|
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", "brdwlk.error.crc", FT_BOOLEAN, 8, TFS(&tfs_error_crc), 0x10, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_ff,
|
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
|
|
|
{"Fifo Full", "brdwlk.error.ff", FT_BOOLEAN, 8, TFS(&tfs_error_ff), 0x20, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_jumbo,
|
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
|
|
|
{"Jumbo FC Frame", "brdwlk.error.jumbo", FT_BOOLEAN, 8, TFS(&tfs_error_jumbo), 0x40, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
|
|
|
{ &hf_brdwlk_error_ctrl,
|
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
|
|
|
{"Ctrl Char Inside Frame", "brdwlk.error.ctrl", FT_BOOLEAN, 8, TFS(&tfs_error_ctrl), 0x80, NULL,
|
2005-11-05 02:03:21 +00:00
|
|
|
HFILL}},
|
2003-01-14 01:17:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_brdwlk,
|
2005-11-05 02:03:21 +00:00
|
|
|
&ett_brdwlk_error,
|
2003-01-14 01:17:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_brdwlk = proto_register_protocol("Boardwalk",
|
|
|
|
"Boardwalk", "brdwlk");
|
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array(proto_brdwlk, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2003-07-21 21:52:32 +00:00
|
|
|
register_init_routine(&brdwlk_init);
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_brdwlk(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t brdwlk_handle;
|
|
|
|
|
2012-05-04 21:39:30 +00:00
|
|
|
brdwlk_handle = create_dissector_handle(dissect_brdwlk, proto_brdwlk);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_BRDWALK, brdwlk_handle);
|
|
|
|
dissector_add_uint("ethertype", 0xABCD, brdwlk_handle);
|
2012-05-04 21:39:30 +00:00
|
|
|
fc_dissector_handle = find_dissector("fc");
|
2003-01-14 01:17:44 +00:00
|
|
|
}
|
2014-09-29 18:42:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|