1998-09-16 02:39:15 +00:00
|
|
|
/* packet-trmac.c
|
|
|
|
* Routines for Token-Ring Media Access Control
|
2001-11-13 23:55:44 +00:00
|
|
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-17 21:00:40 +00:00
|
|
|
#include <string.h>
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2002-06-02 17:51:00 +00:00
|
|
|
#include "packet-frame.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_trmac = -1;
|
1999-09-17 04:20:23 +00:00
|
|
|
static int hf_trmac_mv = -1;
|
|
|
|
static int hf_trmac_length = -1;
|
|
|
|
static int hf_trmac_srcclass = -1;
|
|
|
|
static int hf_trmac_dstclass = -1;
|
|
|
|
static int hf_trmac_sv = -1;
|
|
|
|
static int hf_trmac_errors_iso = -1;
|
|
|
|
static int hf_trmac_errors_line = -1;
|
|
|
|
static int hf_trmac_errors_internal = -1;
|
|
|
|
static int hf_trmac_errors_burst = -1;
|
|
|
|
static int hf_trmac_errors_ac = -1;
|
|
|
|
static int hf_trmac_errors_abort = -1;
|
|
|
|
static int hf_trmac_errors_noniso = -1;
|
|
|
|
static int hf_trmac_errors_lost = -1;
|
|
|
|
static int hf_trmac_errors_congestion = -1;
|
|
|
|
static int hf_trmac_errors_fc = -1;
|
|
|
|
static int hf_trmac_errors_freq = -1;
|
|
|
|
static int hf_trmac_errors_token = -1;
|
|
|
|
static int hf_trmac_naun = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_tr_mac = -1;
|
|
|
|
static gint ett_tr_ierr_cnt = -1;
|
|
|
|
static gint ett_tr_nerr_cnt = -1;
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
/* Major Vector */
|
1999-09-17 04:20:23 +00:00
|
|
|
static value_string major_vector_vs[] = {
|
1998-09-16 02:39:15 +00:00
|
|
|
{ 0x00, "Response" },
|
|
|
|
{ 0x02, "Beacon" },
|
|
|
|
{ 0x03, "Claim Token" },
|
|
|
|
{ 0x04, "Ring Purge" },
|
|
|
|
{ 0x05, "Active Monitor Present" },
|
|
|
|
{ 0x06, "Standby Monitor Present" },
|
|
|
|
{ 0x07, "Duplicate Address Test" },
|
|
|
|
{ 0x09, "Transmit Forward" },
|
|
|
|
{ 0x0B, "Remove Ring Station" },
|
|
|
|
{ 0x0C, "Change Parameters" },
|
|
|
|
{ 0x0D, "Initialize Ring Station" },
|
|
|
|
{ 0x0E, "Request Ring Station Address" },
|
|
|
|
{ 0x0F, "Request Ring Station Address" },
|
|
|
|
{ 0x10, "Request Ring Station Attachments" },
|
|
|
|
{ 0x20, "Request Initialization" },
|
|
|
|
{ 0x22, "Report Ring Station Address" },
|
|
|
|
{ 0x23, "Report Ring Station State" },
|
|
|
|
{ 0x24, "Report Ring Station Attachments" },
|
|
|
|
{ 0x25, "Report New Active Monitor" },
|
|
|
|
{ 0x26, "Report NAUN Change" },
|
|
|
|
{ 0x27, "Report Poll Error" },
|
|
|
|
{ 0x28, "Report Monitor Errors" },
|
|
|
|
{ 0x29, "Report Error" },
|
|
|
|
{ 0x2A, "Report Transmit Forward" },
|
|
|
|
{ 0x00, NULL }
|
1998-10-21 02:36:54 +00:00
|
|
|
};
|
|
|
|
|
1999-09-17 04:20:23 +00:00
|
|
|
/* Src. and Dest. Classes */
|
|
|
|
static value_string classes_vs[] = {
|
|
|
|
{ 0x00, "Ring Station" },
|
|
|
|
{ 0x01, "LLC Manager" },
|
|
|
|
{ 0x04, "Configuration Report Server" },
|
|
|
|
{ 0x05, "Ring Parameter Server" },
|
|
|
|
{ 0x06, "Ring Error Monitor" },
|
|
|
|
{ 0x00, NULL }
|
|
|
|
};
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* Sub-vectors */
|
|
|
|
static int
|
2000-06-20 03:05:37 +00:00
|
|
|
sv_text(tvbuff_t *tvb, int svoff, proto_tree *tree)
|
1998-09-16 02:39:15 +00:00
|
|
|
{
|
2000-06-20 03:05:37 +00:00
|
|
|
int sv_length = tvb_get_guint8(tvb, svoff+0);
|
|
|
|
guint16 beacon_type, ring;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2005-08-05 13:10:58 +00:00
|
|
|
const char *beacon[] = {
|
|
|
|
"Recovery mode set", "Signal loss error",
|
1998-09-16 02:39:15 +00:00
|
|
|
"Streaming signal not Claim Token MAC frame",
|
2005-08-05 13:10:58 +00:00
|
|
|
"Streaming signal, Claim Token MAC frame"
|
|
|
|
};
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *sv_tree;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2002-08-02 23:36:07 +00:00
|
|
|
guchar errors[6]; /* isolating or non-isolating */
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/* Check the SV length.
|
2002-06-02 17:51:00 +00:00
|
|
|
XXX - Should we do this in each case statement below, e.g. to force
|
|
|
|
an SV length of 6 for the NAUN address? */
|
|
|
|
if (sv_length < 1) {
|
|
|
|
proto_tree_add_protocol_format(tree, proto_malformed, tvb, svoff+0, 1,
|
|
|
|
"Invalid subvector length: %d bytes", sv_length);
|
|
|
|
return sv_length;
|
|
|
|
}
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
/* this just adds to the clutter on the screen...
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff, 1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Subvector Length: %d bytes", sv_length);*/
|
|
|
|
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_uint_hidden(tree, hf_trmac_sv, tvb, svoff+1, 1, tvb_get_guint8(tvb, svoff+1));
|
1999-09-17 04:20:23 +00:00
|
|
|
|
2000-06-20 03:05:37 +00:00
|
|
|
switch(tvb_get_guint8(tvb, svoff+1)) {
|
1998-09-16 02:39:15 +00:00
|
|
|
case 0x01: /* Beacon Type */
|
2000-06-20 03:05:37 +00:00
|
|
|
beacon_type = tvb_get_ntohs(tvb, svoff+2);
|
1999-09-09 04:47:17 +00:00
|
|
|
if (beacon_type < array_length(beacon)) {
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1999-09-09 04:47:17 +00:00
|
|
|
"Beacon Type: %s", beacon[beacon_type] );
|
|
|
|
} else {
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1999-09-09 04:47:17 +00:00
|
|
|
"Beacon Type: Illegal value: %d", beacon_type );
|
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x02: /* NAUN */
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_ether(tree, hf_trmac_naun, tvb, svoff+1, sv_length-1,
|
2000-06-20 03:05:37 +00:00
|
|
|
tvb_get_ptr(tvb, svoff+2, 6));
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x03: /* Local Ring Number */
|
2000-06-20 03:05:37 +00:00
|
|
|
ring = tvb_get_ntohs(tvb, svoff+2);
|
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Local Ring Number: 0x%04X (%d)", ring, ring);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x04: /* Assign Physical Location */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Assign Physical Location: 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x05: /* Soft Error Report Value */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Soft Error Report Value: %d ms", 10 * tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x06: /* Enabled Function Classes */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Enabled Function Classes: %04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x07: /* Allowed Access Priority */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Allowed Access Priority: %04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x09: /* Correlator */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Correlator: %04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0A: /* Address of last neighbor notification */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Address of Last Neighbor Notification: %s",
|
2000-06-20 03:05:37 +00:00
|
|
|
ether_to_str(tvb_get_ptr(tvb, svoff+2, 6)));
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0B: /* Physical Location */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Physical Location: 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x20: /* Response Code */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Response Code: 0x%04X 0x%04X", tvb_get_ntohl(tvb, svoff+2),
|
|
|
|
tvb_get_ntohl(tvb, svoff+4) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x21: /* Reserved */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Reserved: 0x%04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x22: /* Product Instance ID */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Product Instance ID: ...");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x23: /* Ring Station Microcode Level */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Ring Station Microcode Level: ...");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x26: /* Wrap data */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Wrap Data: ... (%d bytes)", sv_length - 2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x27: /* Frame Forward */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Frame Forward: ... (%d bytes)", sv_length - 2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x29: /* Ring Station Status Subvector */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
"Ring Station Status Subvector: ...");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2A: /* Transmit Status Code */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Transmit Status Code: %04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2B: /* Group Address */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Group Address: %08X", tvb_get_ntohl(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2C: /* Functional Address */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Functional Address: %08X", tvb_get_ntohl(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2D: /* Isolating Error Counts */
|
2000-06-20 03:05:37 +00:00
|
|
|
memcpy(errors, tvb_get_ptr(tvb, svoff+2, 6), 6);
|
|
|
|
ti = proto_tree_add_uint(tree, hf_trmac_errors_iso, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
|
1999-11-16 11:44:20 +00:00
|
|
|
sv_tree = proto_item_add_subtree(ti, ett_tr_ierr_cnt);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_line, tvb, svoff+2, 1, errors[0]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_internal, tvb, svoff+3, 1, errors[1]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_burst, tvb, svoff+4, 1, errors[2]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_ac, tvb, svoff+5, 1, errors[3]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_abort, tvb, svoff+6, 1, errors[4]);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2E: /* Non-Isolating Error Counts */
|
2000-06-20 03:05:37 +00:00
|
|
|
memcpy(errors, tvb_get_ptr(tvb, svoff+2, 6), 6);
|
|
|
|
ti = proto_tree_add_uint(tree, hf_trmac_errors_noniso, tvb, svoff+1, sv_length-1,
|
1998-09-16 02:39:15 +00:00
|
|
|
errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
|
1999-11-16 11:44:20 +00:00
|
|
|
sv_tree = proto_item_add_subtree(ti, ett_tr_nerr_cnt);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_lost, tvb, svoff+2, 1, errors[0]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_congestion, tvb, svoff+3, 1, errors[1]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_fc, tvb, svoff+4, 1, errors[2]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_freq, tvb, svoff+5, 1, errors[3]);
|
|
|
|
proto_tree_add_uint(sv_tree, hf_trmac_errors_token, tvb, svoff+6, 1, errors[4]);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x30: /* Error Code */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
|
|
|
|
"Error Code: %04X", tvb_get_ntohs(tvb, svoff+2) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* Unknown */
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_text(tree, tvb, svoff+1, 1,
|
|
|
|
"Unknown Sub-Vector: 0x%02X", tvb_get_guint8(tvb, svoff+1));
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
return sv_length;
|
|
|
|
}
|
|
|
|
|
2001-01-03 10:34:42 +00:00
|
|
|
static void
|
2000-06-20 03:05:37 +00:00
|
|
|
dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *mac_tree = NULL;
|
|
|
|
proto_item *ti;
|
2000-06-20 03:05:37 +00:00
|
|
|
int mv_length, sv_offset, sv_additional;
|
1999-09-17 04:20:23 +00:00
|
|
|
guint8 mv_val;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2000-06-20 03:05:37 +00:00
|
|
|
|
|
|
|
mv_val = tvb_get_guint8(tvb, 3);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* Interpret the major vector */
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
2005-06-26 19:56:52 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
|
|
|
val_to_str(mv_val, major_vector_vs, "Unknown Major Vector: %u"));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-06-20 03:05:37 +00:00
|
|
|
mv_length = tvb_get_ntohs(tvb, 0);
|
|
|
|
ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, mv_length, FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
mac_tree = proto_item_add_subtree(ti, ett_tr_mac);
|
1999-07-29 05:47:07 +00:00
|
|
|
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val);
|
|
|
|
proto_tree_add_uint_format(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length,
|
1999-09-17 04:20:23 +00:00
|
|
|
"Total Length: %d bytes", mv_length);
|
2000-06-20 03:05:37 +00:00
|
|
|
proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f);
|
|
|
|
proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 );
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* interpret the subvectors */
|
2000-06-20 03:05:37 +00:00
|
|
|
sv_offset = 4;
|
|
|
|
while (sv_offset < mv_length) {
|
|
|
|
sv_additional = sv_text(tvb, sv_offset, mac_tree);
|
1999-01-12 17:44:52 +00:00
|
|
|
|
|
|
|
/* if this is a bad packet, we could get a 0-length added here,
|
|
|
|
* looping forever */
|
2000-06-20 03:05:37 +00:00
|
|
|
if (sv_additional > 0)
|
1999-01-12 17:44:52 +00:00
|
|
|
sv_offset += sv_additional;
|
|
|
|
else
|
|
|
|
break;
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_trmac(void)
|
|
|
|
{
|
1999-09-17 04:20:23 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_trmac_mv,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Major Vector", "trmac.mvec", FT_UINT8, BASE_HEX, major_vector_vs, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_length,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Total Length", "trmac.length", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_srcclass,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source Class", "trmac.srcclass", FT_UINT8, BASE_HEX, classes_vs, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_dstclass,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Destination Class", "trmac.dstclass", FT_UINT8, BASE_HEX, classes_vs, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_sv,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Sub-Vector", "trmac.svec", FT_UINT8, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_iso,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Isolating Errors", "trmac.errors.iso", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_line,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Line Errors", "trmac.errors.line", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_internal,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Internal Errors", "trmac.errors.internal", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_burst,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Burst Errors", "trmac.errors.burst", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_ac,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "A/C Errors", "trmac.errors.ac", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_abort,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Abort Delimiter Transmitted Errors", "trmac.errors.abort", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_noniso,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Non-Isolating Errors", "trmac.errors.noniso", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_lost,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Lost Frame Errors", "trmac.errors.lost", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_congestion,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Receiver Congestion Errors", "trmac.errors.congestion", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_fc,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Frame-Copied Errors", "trmac.errors.fc", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_freq,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Frequency Errors", "trmac.errors.freq", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_errors_token,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Token Errors", "trmac.errors.token", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
|
|
|
|
{ &hf_trmac_naun,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "NAUN", "trmac.naun", FT_ETHER, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-09-17 04:20:23 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_tr_mac,
|
|
|
|
&ett_tr_ierr_cnt,
|
|
|
|
&ett_tr_nerr_cnt,
|
|
|
|
};
|
1999-07-29 05:47:07 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_trmac = proto_register_protocol("Token-Ring Media Access Control",
|
|
|
|
"TR MAC", "trmac");
|
1999-09-17 04:20:23 +00:00
|
|
|
proto_register_field_array(proto_trmac, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2001-01-03 10:34:42 +00:00
|
|
|
|
2001-01-09 06:32:10 +00:00
|
|
|
register_dissector("trmac", dissect_trmac, proto_trmac);
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|