MSWSP: add two more Property Sets
[wireshark-wip.git] / epan / dissectors / packet-trmac.c
blob12ee053d24fca35d3e88fe2fd928e6b7a4d8989f
1 /* packet-trmac.c
2 * Routines for Token-Ring Media Access Control
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <string.h>
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/to_str.h>
32 #include <epan/expert.h>
34 static int proto_trmac = -1;
35 static int hf_trmac_mv = -1;
36 static int hf_trmac_length = -1;
37 static int hf_trmac_srcclass = -1;
38 static int hf_trmac_dstclass = -1;
39 static int hf_trmac_sv_len = -1;
40 static int hf_trmac_sv_id = -1;
41 static int hf_trmac_errors_iso = -1;
42 static int hf_trmac_errors_line = -1;
43 static int hf_trmac_errors_internal = -1;
44 static int hf_trmac_errors_burst = -1;
45 static int hf_trmac_errors_ac = -1;
46 static int hf_trmac_errors_abort = -1;
47 static int hf_trmac_errors_noniso = -1;
48 static int hf_trmac_errors_lost = -1;
49 static int hf_trmac_errors_congestion = -1;
50 static int hf_trmac_errors_fc = -1;
51 static int hf_trmac_errors_freq = -1;
52 static int hf_trmac_errors_token = -1;
53 static int hf_trmac_naun = -1;
54 static int hf_trmac_beacon_type = -1;
55 /* Generated from convert_proto_tree_add_text.pl */
56 static int hf_trmac_assign_physical_drop_number = -1;
57 static int hf_trmac_error_code = -1;
58 static int hf_trmac_group_address32 = -1;
59 static int hf_trmac_transmit_status_code = -1;
60 static int hf_trmac_station_identifier = -1;
61 static int hf_trmac_sa_of_last_amp_or_smp_frame = -1;
62 static int hf_trmac_error_report_timer_value = -1;
63 static int hf_trmac_individual_address_count = -1;
64 static int hf_trmac_correlator = -1;
65 static int hf_trmac_group_address_ether = -1;
66 static int hf_trmac_authorized_access_priority = -1;
67 static int hf_trmac_physical_drop_number = -1;
68 static int hf_trmac_authorized_function_classes = -1;
69 static int hf_trmac_local_ring_number = -1;
70 static int hf_trmac_functional_addresses = -1;
72 static gint ett_tr_mac = -1;
73 static gint ett_tr_sv = -1;
74 static gint ett_tr_ierr_cnt = -1;
75 static gint ett_tr_nerr_cnt = -1;
77 static expert_field ei_trmac_sv_len = EI_INIT;
79 /* Major Vector */
80 static const value_string major_vector_vs[] = {
81 { 0x00, "Response" },
82 { 0x02, "Beacon" },
83 { 0x03, "Claim Token" },
84 { 0x04, "Ring Purge" },
85 { 0x05, "Active Monitor Present" },
86 { 0x06, "Standby Monitor Present" },
87 { 0x07, "Duplicate Address Test" },
88 { 0x09, "Transmit Forward" },
89 { 0x0B, "Remove Ring Station" },
90 { 0x0C, "Change Parameters" },
91 { 0x0D, "Initialize Ring Station" },
92 { 0x0E, "Request Ring Station Address" },
93 { 0x0F, "Request Ring Station Address" },
94 { 0x10, "Request Ring Station Attachments" },
95 { 0x20, "Request Initialization" },
96 { 0x22, "Report Ring Station Address" },
97 { 0x23, "Report Ring Station State" },
98 { 0x24, "Report Ring Station Attachments" },
99 { 0x25, "Report New Active Monitor" },
100 { 0x26, "Report NAUN Change" },
101 { 0x27, "Report Poll Error" },
102 { 0x28, "Report Monitor Errors" },
103 { 0x29, "Report Error" },
104 { 0x2A, "Report Transmit Forward" },
105 { 0x00, NULL }
108 /* Src. and Dest. Classes */
109 static const value_string classes_vs[] = {
110 { 0x00, "Ring Station" },
111 { 0x01, "LLC Manager" },
112 { 0x04, "Configuration Report Server" },
113 { 0x05, "Ring Parameter Server" },
114 { 0x06, "Ring Error Monitor" },
115 { 0x00, NULL }
118 static const value_string subvector_vs[] = {
119 { 0x01, "Beacon Type" },
120 { 0x02, "Upstream Neighbor's Address" },
121 { 0x03, "Local Ring Number" },
122 { 0x04, "Assign Physical Drop Number" },
123 { 0x05, "Error Report Timer Value" },
124 { 0x06, "Authorized Function Classes" },
125 { 0x07, "Authorized Access Priority" },
126 { 0x09, "Correlator" },
127 { 0x0A, "SA of Last AMP or SMP Frame" },
128 { 0x0B, "Physical Drop Number" },
129 { 0x20, "Response Code" },
130 { 0x21, "Individual Address Count" },
131 { 0x22, "Product Instance ID" },
132 { 0x23, "Ring Station Version Number" },
133 { 0x26, "Wrap Data" },
134 { 0x27, "Frame Forward" },
135 { 0x28, "Station Identifier" },
136 { 0x29, "Ring Station Status" },
137 { 0x2A, "Transmit Forward Status Code" },
138 { 0x2B, "Group Addresses" },
139 { 0x2C, "Functional Addresses" },
140 { 0x2D, "Isolating Error Counts" },
141 { 0x2E, "Non-Isolating Error Counts" },
142 { 0x2F, "Function Request ID" },
143 { 0x30, "Error Code" },
144 { 0x00, NULL }
147 static const value_string beacon_vs[] = {
148 { 0x00, "Recovery mode set" },
149 { 0x01, "Signal loss error" },
150 { 0x02, "Streaming signal not Claim Token MAC frame" },
151 { 0x03, "Streaming signal, Claim Token MAC frame" },
152 { 0x00, NULL }
155 /* Sub-vectors */
156 static int
157 sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree)
159 guint sv_length, sv_id;
160 guint16 beacon_type, ring;
161 guint32 error_report_timer_value;
163 proto_tree *sv_tree, *sv_subtree;
164 proto_item *sv_item, *len_item, *ti;
166 guchar errors[6]; /* isolating or non-isolating */
168 sv_item = proto_tree_add_text(tree, tvb, svoff+0, 1, "Subvector");
169 sv_tree = proto_item_add_subtree(sv_item, ett_tr_sv);
171 sv_length = tvb_get_guint8(tvb, svoff+0);
172 len_item = proto_tree_add_item(sv_tree, hf_trmac_sv_len, tvb, svoff+0, 1, ENC_NA);
174 /* Check the SV length; it must be at least 2, to include
175 the subvector length and indicator. */
176 if (sv_length < 2) {
177 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
178 "Invalid subvector: length < 2");
179 return 0; /* tells our caller to give up */
182 sv_id = tvb_get_guint8(tvb, svoff+1);
183 proto_tree_add_item(sv_tree, hf_trmac_sv_id, tvb, svoff+1, 1, ENC_NA);
184 proto_item_append_text(sv_item, " (%s)", val_to_str(sv_id, subvector_vs, "Unknown subvector ID 0x%02X"));
186 switch(sv_id) {
187 case 0x01: /* Beacon Type */
188 if (sv_length != 4) {
189 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
190 "Subvector length is != 4");
191 break;
193 beacon_type = tvb_get_ntohs(tvb, svoff+2);
194 proto_tree_add_uint_format_value(sv_tree, hf_trmac_beacon_type, tvb, svoff+2, sv_length-2,
195 beacon_type, "%s", val_to_str(beacon_type, beacon_vs, "Illegal value: %d"));
196 proto_item_append_text(sv_item,
197 ": %s", val_to_str(beacon_type, beacon_vs, "Illegal value: %d"));
198 break;
200 case 0x02: /* Upstream Neighbor's Address */
201 if (sv_length != 8) {
202 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
203 "Subvector length is != 8");
204 break;
206 proto_tree_add_item(sv_tree, hf_trmac_naun, tvb, svoff+2, sv_length-2, ENC_NA);
207 proto_item_append_text(sv_item, ": %s",
208 tvb_ether_to_str(tvb, svoff+2));
209 break;
211 case 0x03: /* Local Ring Number */
212 if (sv_length != 4) {
213 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
214 "Subvector length is != 4");
215 break;
217 ring = tvb_get_ntohs(tvb, svoff+2);
218 proto_tree_add_item(sv_tree, hf_trmac_local_ring_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
219 proto_item_append_text(sv_item,
220 ": 0x%04X (%d)", ring, ring);
221 break;
223 case 0x04: /* Assign Physical Drop Number */
224 if (sv_length != 6) {
225 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
226 "Subvector length is != 6");
227 break;
229 proto_tree_add_item(sv_tree, hf_trmac_assign_physical_drop_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
230 proto_item_append_text(sv_item,
231 ": 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
232 break;
234 case 0x05: /* Error Report Timer Value */
235 if (sv_length != 4) {
236 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
237 "Subvector length is != 4");
238 break;
241 error_report_timer_value = 10 * tvb_get_ntohs(tvb, svoff+2);
242 proto_tree_add_uint_format_value(sv_tree, hf_trmac_error_report_timer_value, tvb, svoff+2, sv_length-2,
243 error_report_timer_value, "%d ms", error_report_timer_value );
244 proto_item_append_text(sv_item,
245 ": %d ms", error_report_timer_value );
246 break;
248 case 0x06: /* Authorized Function Classes */
249 if (sv_length != 4) {
250 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
251 "Subvector length is != 4");
252 break;
254 proto_tree_add_item(sv_tree, hf_trmac_authorized_function_classes, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
255 proto_item_append_text(sv_item,
256 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
257 break;
259 case 0x07: /* Authorized Access Priority */
260 if (sv_length != 4) {
261 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
262 "Subvector length is != 4");
263 break;
265 proto_tree_add_item(sv_tree, hf_trmac_authorized_access_priority, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
266 proto_item_append_text(sv_item,
267 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
268 break;
270 case 0x09: /* Correlator */
271 if (sv_length != 4) {
272 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
273 "Subvector length is != 4");
274 break;
276 proto_tree_add_item(sv_tree, hf_trmac_correlator, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
277 proto_item_append_text(sv_item,
278 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
279 break;
281 case 0x0A: /* SA of Last AMP or SMP Frame */
282 if (sv_length != 8) {
283 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
284 "Subvector length is != 8");
285 break;
287 proto_tree_add_item(sv_tree, hf_trmac_sa_of_last_amp_or_smp_frame, tvb, svoff+2, sv_length-2, ENC_NA);
288 proto_item_append_text(sv_item,
289 ": %s",
290 tvb_ether_to_str(tvb, svoff+2));
291 break;
293 case 0x0B: /* Physical Drop Number */
294 if (sv_length != 6) {
295 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
296 "Subvector length is != 6");
297 break;
299 proto_tree_add_item(sv_tree, hf_trmac_physical_drop_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
300 proto_item_append_text(sv_item,
301 ": 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
302 break;
304 case 0x20: /* Response Code */
305 if (sv_length != 4 && sv_length != 6) {
306 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
307 "Subvector length is != 4 and != 6");
308 break;
310 if (sv_length == 4) {
311 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
312 "Response Code: 0x%04X 0x%02X 0x%02x",
313 tvb_get_ntohs(tvb, svoff+2),
314 tvb_get_guint8(tvb, svoff+4),
315 tvb_get_guint8(tvb, svoff+5));
316 proto_item_append_text(sv_item,
317 ": 0x%04X 0x%02X 0x%02x",
318 tvb_get_ntohs(tvb, svoff+2),
319 tvb_get_guint8(tvb, svoff+4),
320 tvb_get_guint8(tvb, svoff+5));
321 } else {
322 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
323 "Response Code: 0x%04X 0x%02X 0x%06X",
324 tvb_get_ntohs(tvb, svoff+2),
325 tvb_get_guint8(tvb, svoff+4),
326 tvb_get_ntoh24(tvb, svoff+5));
327 proto_item_append_text(sv_item,
328 ": 0x%04X 0x%02X 0x%06X",
329 tvb_get_ntohs(tvb, svoff+2),
330 tvb_get_guint8(tvb, svoff+4),
331 tvb_get_ntoh24(tvb, svoff+5));
333 break;
335 case 0x21: /* Individual Address Count */
336 if (sv_length != 4) {
337 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
338 "Subvector length is != 4");
339 break;
341 proto_tree_add_item(sv_tree, hf_trmac_individual_address_count, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
342 proto_item_append_text(sv_item,
343 ": %u", tvb_get_ntohs(tvb, svoff+2) );
344 break;
346 case 0x22: /* Product Instance ID */
347 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
348 "Product Instance ID: ...");
349 break;
351 case 0x23: /* Ring Station Version Number */
352 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
353 "Ring Station Version Number: ...");
354 break;
356 case 0x26: /* Wrap data */
357 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
358 "Wrap Data: ... (%u bytes)", sv_length - 2);
359 break;
361 case 0x27: /* Frame Forward */
362 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
363 "Frame Forward: ... (%d bytes)", sv_length - 2);
364 break;
366 case 0x28: /* Station Identifier */
367 if (sv_length != 8) {
368 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
369 "Subvector length is != 8");
370 break;
372 proto_tree_add_item(sv_tree, hf_trmac_station_identifier, tvb, svoff+2, sv_length-2, ENC_NA);
373 proto_item_append_text(sv_item,
374 ": %s",
375 tvb_ether_to_str(tvb, svoff+2));
376 break;
378 case 0x29: /* Ring Station Status */
379 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
380 "Ring Station Status: ...");
381 break;
383 case 0x2A: /* Transmit Status Code */
384 if (sv_length != 4) {
385 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
386 "Subvector length is != 4");
387 break;
389 proto_tree_add_item(sv_tree, hf_trmac_transmit_status_code, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
390 proto_item_append_text(sv_item,
391 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
392 break;
394 case 0x2B: /* Group Address */
395 if (sv_length != 6 && sv_length != 8) {
396 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
397 "Subvector length is != 6 and != 8");
398 break;
400 if (sv_length == 6) {
401 proto_tree_add_item(sv_tree, hf_trmac_group_address32, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
402 proto_item_append_text(sv_item,
403 ": %08X", tvb_get_ntohl(tvb, svoff+2) );
404 } else {
405 proto_tree_add_item(sv_tree, hf_trmac_group_address_ether, tvb, svoff+2, sv_length-2, ENC_NA);
406 proto_item_append_text(sv_item,
407 ": %s",
408 tvb_ether_to_str(tvb, svoff+2));
410 break;
412 case 0x2C: /* Functional Addresses */
413 if (sv_length != 6) {
414 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
415 "Subvector length is != 6");
416 break;
418 proto_tree_add_item(sv_tree, hf_trmac_functional_addresses, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
419 proto_item_append_text(sv_item,
420 ": %08X", tvb_get_ntohl(tvb, svoff+2) );
421 break;
423 case 0x2D: /* Isolating Error Counts */
424 if (sv_length != 8) {
425 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
426 "Subvector length is != 8");
427 break;
429 tvb_memcpy(tvb, errors, svoff+2, 6);
430 ti = proto_tree_add_uint(sv_tree, hf_trmac_errors_iso, tvb, svoff+2, sv_length-2,
431 errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
432 sv_subtree = proto_item_add_subtree(ti, ett_tr_ierr_cnt);
434 proto_tree_add_uint(sv_subtree, hf_trmac_errors_line, tvb, svoff+2, 1, errors[0]);
435 proto_tree_add_uint(sv_subtree, hf_trmac_errors_internal, tvb, svoff+3, 1, errors[1]);
436 proto_tree_add_uint(sv_subtree, hf_trmac_errors_burst, tvb, svoff+4, 1, errors[2]);
437 proto_tree_add_uint(sv_subtree, hf_trmac_errors_ac, tvb, svoff+5, 1, errors[3]);
438 proto_tree_add_uint(sv_subtree, hf_trmac_errors_abort, tvb, svoff+6, 1, errors[4]);
440 break;
442 case 0x2E: /* Non-Isolating Error Counts */
443 if (sv_length != 8) {
444 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
445 "Subvector length is != 8");
446 break;
448 tvb_memcpy(tvb, errors, svoff+2, 6);
449 ti = proto_tree_add_uint(sv_tree, hf_trmac_errors_noniso, tvb, svoff+2, sv_length-2,
450 errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
451 sv_subtree = proto_item_add_subtree(ti, ett_tr_nerr_cnt);
453 proto_tree_add_uint(sv_subtree, hf_trmac_errors_lost, tvb, svoff+2, 1, errors[0]);
454 proto_tree_add_uint(sv_subtree, hf_trmac_errors_congestion, tvb, svoff+3, 1, errors[1]);
455 proto_tree_add_uint(sv_subtree, hf_trmac_errors_fc, tvb, svoff+4, 1, errors[2]);
456 proto_tree_add_uint(sv_subtree, hf_trmac_errors_freq, tvb, svoff+5, 1, errors[3]);
457 proto_tree_add_uint(sv_subtree, hf_trmac_errors_token, tvb, svoff+6, 1, errors[4]);
458 break;
460 case 0x30: /* Error Code */
461 if (sv_length != 4) {
462 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
463 "Subvector length is != 4");
464 break;
466 proto_tree_add_item(sv_tree, hf_trmac_error_code, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
467 proto_item_append_text(sv_item,
468 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
469 break;
471 default: /* Unknown */
472 proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2,
473 "Unknown Subvector");
474 break;
476 return sv_length;
479 static void
480 dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
482 proto_tree *mac_tree = NULL;
483 proto_item *ti;
484 int mv_length, sv_offset, sv_additional;
485 guint8 mv_val;
487 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC");
488 col_clear(pinfo->cinfo, COL_INFO);
490 mv_val = tvb_get_guint8(tvb, 3);
492 /* Interpret the major vector */
493 col_add_str(pinfo->cinfo, COL_INFO,
494 val_to_str(mv_val, major_vector_vs, "Unknown Major Vector: %u"));
496 if (tree) {
497 mv_length = tvb_get_ntohs(tvb, 0);
498 ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, mv_length, ENC_NA);
499 mac_tree = proto_item_add_subtree(ti, ett_tr_mac);
501 proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val);
502 proto_tree_add_uint_format_value(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length,
503 "%d bytes", mv_length);
504 proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f);
505 proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 );
507 /* interpret the subvectors */
508 sv_offset = 4;
509 while (sv_offset < mv_length) {
510 sv_additional = sv_text(tvb, sv_offset, pinfo, mac_tree);
512 /* if this is a bad packet, we could get a 0-length added here,
513 * looping forever */
514 if (sv_additional > 0)
515 sv_offset += sv_additional;
516 else
517 break;
522 void
523 proto_register_trmac(void)
525 static hf_register_info hf[] = {
526 { &hf_trmac_mv,
527 { "Major Vector", "trmac.mvec", FT_UINT8, BASE_HEX, major_vector_vs, 0x0,
528 NULL, HFILL }},
530 { &hf_trmac_length,
531 { "Total Length", "trmac.length", FT_UINT8, BASE_DEC, NULL, 0x0,
532 NULL, HFILL }},
534 { &hf_trmac_srcclass,
535 { "Source Class", "trmac.srcclass", FT_UINT8, BASE_HEX, classes_vs, 0x0,
536 NULL, HFILL }},
538 { &hf_trmac_dstclass,
539 { "Destination Class", "trmac.dstclass", FT_UINT8, BASE_HEX, classes_vs, 0x0,
540 NULL, HFILL }},
542 { &hf_trmac_sv_len,
543 { "Subvector Length", "trmac.svec.len", FT_UINT8, BASE_DEC, NULL, 0x0,
544 NULL, HFILL }},
546 { &hf_trmac_sv_id,
547 { "Subvector Identifier", "trmac.svec.id", FT_UINT8, BASE_HEX, VALS(subvector_vs), 0x0,
548 NULL, HFILL }},
550 { &hf_trmac_errors_iso,
551 { "Isolating Errors", "trmac.errors.iso", FT_UINT16, BASE_DEC, NULL, 0x0,
552 NULL, HFILL }},
554 { &hf_trmac_errors_line,
555 { "Line Errors", "trmac.errors.line", FT_UINT8, BASE_DEC, NULL, 0x0,
556 NULL, HFILL }},
558 { &hf_trmac_errors_internal,
559 { "Internal Errors", "trmac.errors.internal", FT_UINT8, BASE_DEC, NULL, 0x0,
560 NULL, HFILL }},
562 { &hf_trmac_errors_burst,
563 { "Burst Errors", "trmac.errors.burst", FT_UINT8, BASE_DEC, NULL, 0x0,
564 NULL, HFILL }},
566 { &hf_trmac_errors_ac,
567 { "A/C Errors", "trmac.errors.ac", FT_UINT8, BASE_DEC, NULL, 0x0,
568 NULL, HFILL }},
570 { &hf_trmac_errors_abort,
571 { "Abort Delimiter Transmitted Errors", "trmac.errors.abort", FT_UINT8, BASE_DEC, NULL, 0x0,
572 NULL, HFILL }},
574 { &hf_trmac_errors_noniso,
575 { "Non-Isolating Errors", "trmac.errors.noniso", FT_UINT16, BASE_DEC, NULL, 0x0,
576 NULL, HFILL }},
578 { &hf_trmac_errors_lost,
579 { "Lost Frame Errors", "trmac.errors.lost", FT_UINT8, BASE_DEC, NULL, 0x0,
580 NULL, HFILL }},
582 { &hf_trmac_errors_congestion,
583 { "Receiver Congestion Errors", "trmac.errors.congestion", FT_UINT8, BASE_DEC, NULL, 0x0,
584 NULL, HFILL }},
586 { &hf_trmac_errors_fc,
587 { "Frame-Copied Errors", "trmac.errors.fc", FT_UINT8, BASE_DEC, NULL, 0x0,
588 NULL, HFILL }},
590 { &hf_trmac_errors_freq,
591 { "Frequency Errors", "trmac.errors.freq", FT_UINT8, BASE_DEC, NULL, 0x0,
592 NULL, HFILL }},
594 { &hf_trmac_errors_token,
595 { "Token Errors", "trmac.errors.token", FT_UINT8, BASE_DEC, NULL, 0x0,
596 NULL, HFILL }},
598 { &hf_trmac_naun,
599 { "Upstream Neighbor's Address", "trmac.naun", FT_ETHER, BASE_NONE, NULL, 0x0,
600 NULL, HFILL }},
602 { &hf_trmac_beacon_type,
603 { "Beacon Type", "trmac.beacon_type", FT_UINT16, BASE_DEC, VALS(beacon_vs), 0x0,
604 NULL, HFILL }},
606 /* Generated from convert_proto_tree_add_text.pl */
607 { &hf_trmac_local_ring_number, { "Local Ring Number", "trmac.local_ring_number", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
608 { &hf_trmac_assign_physical_drop_number, { "Assign Physical Drop Number", "trmac.assign_physical_drop_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
609 { &hf_trmac_error_report_timer_value, { "Error Report Timer Value", "trmac.error_report_timer_value", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
610 { &hf_trmac_authorized_function_classes, { "Authorized Function Classes", "trmac.authorized_function_classes", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
611 { &hf_trmac_authorized_access_priority, { "Authorized Access Priority", "trmac.authorized_access_priority", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
612 { &hf_trmac_correlator, { "Correlator", "trmac.correlator", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
613 { &hf_trmac_sa_of_last_amp_or_smp_frame, { "SA of Last AMP or SMP Frame", "trmac.sa_of_last_amp_or_smp_frame", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
614 { &hf_trmac_physical_drop_number, { "Physical Drop Number", "trmac.physical_drop_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
615 { &hf_trmac_individual_address_count, { "Individual Address Count", "trmac.individual_address_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
616 { &hf_trmac_station_identifier, { "Station Identifier", "trmac.station_identifier", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
617 { &hf_trmac_transmit_status_code, { "Transmit Status Code", "trmac.transmit_status_code", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
618 { &hf_trmac_group_address32, { "Group Address", "trmac.group_address", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
619 { &hf_trmac_group_address_ether, { "Group Address", "trmac.group_address", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
620 { &hf_trmac_functional_addresses, { "Functional Addresses", "trmac.functional_addresses", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
621 { &hf_trmac_error_code, { "Error Code", "trmac.error_code", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
624 static gint *ett[] = {
625 &ett_tr_mac,
626 &ett_tr_sv,
627 &ett_tr_ierr_cnt,
628 &ett_tr_nerr_cnt,
631 static ei_register_info ei[] = {
632 { &ei_trmac_sv_len, { "trmac.svec.len.invalid", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }},
635 expert_module_t* expert_trmac;
637 proto_trmac = proto_register_protocol("Token-Ring Media Access Control", "TR MAC", "trmac");
638 proto_register_field_array(proto_trmac, hf, array_length(hf));
639 proto_register_subtree_array(ett, array_length(ett));
640 expert_trmac = expert_register_protocol(proto_trmac);
641 expert_register_field_array(expert_trmac, ei, array_length(ei));
643 register_dissector("trmac", dissect_trmac, proto_trmac);