Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-trmac.c
blobe11822955320ba00453439837ecf95b8a6d1254d
1 /* packet-trmac.c
2 * Routines for Token-Ring Media Access Control
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/to_str.h>
16 #include <epan/expert.h>
17 #include <epan/unit_strings.h>
19 #include <wsutil/array.h>
20 void proto_register_trmac(void);
22 static int proto_trmac;
23 static int hf_trmac_mv;
24 static int hf_trmac_length;
25 static int hf_trmac_srcclass;
26 static int hf_trmac_dstclass;
27 static int hf_trmac_sv_len;
28 static int hf_trmac_sv_id;
29 static int hf_trmac_errors_iso;
30 static int hf_trmac_errors_line;
31 static int hf_trmac_errors_internal;
32 static int hf_trmac_errors_burst;
33 static int hf_trmac_errors_ac;
34 static int hf_trmac_errors_abort;
35 static int hf_trmac_errors_noniso;
36 static int hf_trmac_errors_lost;
37 static int hf_trmac_errors_congestion;
38 static int hf_trmac_errors_fc;
39 static int hf_trmac_errors_freq;
40 static int hf_trmac_errors_token;
41 static int hf_trmac_naun;
42 static int hf_trmac_beacon_type;
43 static int hf_trmac_assign_physical_drop_number;
44 static int hf_trmac_error_code;
45 static int hf_trmac_group_address32;
46 static int hf_trmac_transmit_status_code;
47 static int hf_trmac_station_identifier;
48 static int hf_trmac_sa_of_last_amp_or_smp_frame;
49 static int hf_trmac_error_report_timer_value;
50 static int hf_trmac_individual_address_count;
51 static int hf_trmac_correlator;
52 static int hf_trmac_group_address_ether;
53 static int hf_trmac_authorized_access_priority;
54 static int hf_trmac_physical_drop_number;
55 static int hf_trmac_authorized_function_classes;
56 static int hf_trmac_local_ring_number;
57 static int hf_trmac_functional_addresses;
58 /* Generated from convert_proto_tree_add_text.pl */
59 static int hf_trmac_unknown_subvector;
60 static int hf_trmac_response_code48;
61 static int hf_trmac_product_instance_id;
62 static int hf_trmac_ring_station_version_number;
63 static int hf_trmac_wrap_data;
64 static int hf_trmac_ring_station_status;
65 static int hf_trmac_frame_forward;
66 static int hf_trmac_response_code32;
68 static int ett_tr_mac;
69 static int ett_tr_sv;
70 static int ett_tr_ierr_cnt;
71 static int ett_tr_nerr_cnt;
73 static expert_field ei_trmac_sv_len;
75 /* Major Vector */
76 static const value_string major_vector_vs[] = {
77 { 0x00, "Response" },
78 { 0x02, "Beacon" },
79 { 0x03, "Claim Token" },
80 { 0x04, "Ring Purge" },
81 { 0x05, "Active Monitor Present" },
82 { 0x06, "Standby Monitor Present" },
83 { 0x07, "Duplicate Address Test" },
84 { 0x09, "Transmit Forward" },
85 { 0x0B, "Remove Ring Station" },
86 { 0x0C, "Change Parameters" },
87 { 0x0D, "Initialize Ring Station" },
88 { 0x0E, "Request Ring Station Address" },
89 { 0x0F, "Request Ring Station Address" },
90 { 0x10, "Request Ring Station Attachments" },
91 { 0x20, "Request Initialization" },
92 { 0x22, "Report Ring Station Address" },
93 { 0x23, "Report Ring Station State" },
94 { 0x24, "Report Ring Station Attachments" },
95 { 0x25, "Report New Active Monitor" },
96 { 0x26, "Report NAUN Change" },
97 { 0x27, "Report Poll Error" },
98 { 0x28, "Report Monitor Errors" },
99 { 0x29, "Report Error" },
100 { 0x2A, "Report Transmit Forward" },
101 { 0x00, NULL }
103 static value_string_ext major_vector_vs_ext = VALUE_STRING_EXT_INIT(major_vector_vs);
105 /* Src. and Dest. Classes */
106 static const value_string classes_vs[] = {
107 { 0x00, "Ring Station" },
108 { 0x01, "LLC Manager" },
109 { 0x04, "Configuration Report Server" },
110 { 0x05, "Ring Parameter Server" },
111 { 0x06, "Ring Error Monitor" },
112 { 0x00, NULL }
115 static const value_string subvector_vs[] = {
116 { 0x01, "Beacon Type" },
117 { 0x02, "Upstream Neighbor's Address" },
118 { 0x03, "Local Ring Number" },
119 { 0x04, "Assign Physical Drop Number" },
120 { 0x05, "Error Report Timer Value" },
121 { 0x06, "Authorized Function Classes" },
122 { 0x07, "Authorized Access Priority" },
123 { 0x09, "Correlator" },
124 { 0x0A, "SA of Last AMP or SMP Frame" },
125 { 0x0B, "Physical Drop Number" },
126 { 0x20, "Response Code" },
127 { 0x21, "Individual Address Count" },
128 { 0x22, "Product Instance ID" },
129 { 0x23, "Ring Station Version Number" },
130 { 0x26, "Wrap Data" },
131 { 0x27, "Frame Forward" },
132 { 0x28, "Station Identifier" },
133 { 0x29, "Ring Station Status" },
134 { 0x2A, "Transmit Forward Status Code" },
135 { 0x2B, "Group Addresses" },
136 { 0x2C, "Functional Addresses" },
137 { 0x2D, "Isolating Error Counts" },
138 { 0x2E, "Non-Isolating Error Counts" },
139 { 0x2F, "Function Request ID" },
140 { 0x30, "Error Code" },
141 { 0x00, NULL }
143 static value_string_ext subvector_vs_ext = VALUE_STRING_EXT_INIT(subvector_vs);
145 static const value_string beacon_vs[] = {
146 { 0x00, "Recovery mode set" },
147 { 0x01, "Signal loss error" },
148 { 0x02, "Streaming signal not Claim Token MAC frame" },
149 { 0x03, "Streaming signal, Claim Token MAC frame" },
150 { 0x00, NULL }
153 /* Sub-vectors */
154 static int
155 sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree)
157 unsigned sv_length, sv_id;
158 uint16_t beacon_type, ring;
159 uint32_t error_report_timer_value;
161 proto_tree *sv_tree, *sv_subtree;
162 proto_item *sv_item, *len_item, *ti;
164 unsigned char errors[6]; /* isolating or non-isolating */
166 sv_tree = proto_tree_add_subtree(tree, tvb, svoff+0, 1, ett_tr_sv, &sv_item, "Subvector");
168 sv_length = tvb_get_uint8(tvb, svoff+0);
169 len_item = proto_tree_add_item(sv_tree, hf_trmac_sv_len, tvb, svoff+0, 1, ENC_BIG_ENDIAN);
171 /* Check the SV length; it must be at least 2, to include
172 the subvector length and indicator. */
173 if (sv_length < 2) {
174 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
175 "Invalid subvector: length < 2");
176 return 0; /* tells our caller to give up */
179 sv_id = tvb_get_uint8(tvb, svoff+1);
180 proto_tree_add_item(sv_tree, hf_trmac_sv_id, tvb, svoff+1, 1, ENC_BIG_ENDIAN);
181 proto_item_append_text(sv_item, " (%s)", val_to_str_ext(sv_id, &subvector_vs_ext, "Unknown subvector ID 0x%02X"));
183 switch(sv_id) {
184 case 0x01: /* Beacon Type */
185 if (sv_length != 4) {
186 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
187 "Subvector length is != 4");
188 break;
190 beacon_type = tvb_get_ntohs(tvb, svoff+2);
191 proto_tree_add_item(sv_tree, hf_trmac_beacon_type, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
192 proto_item_append_text(sv_item,
193 ": %s", val_to_str(beacon_type, beacon_vs, "Illegal value: %d"));
194 break;
196 case 0x02: /* Upstream Neighbor's Address */
197 if (sv_length != 8) {
198 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
199 "Subvector length is != 8");
200 break;
202 proto_tree_add_item(sv_tree, hf_trmac_naun, tvb, svoff+2, sv_length-2, ENC_NA);
203 proto_item_append_text(sv_item, ": %s",
204 tvb_ether_to_str(pinfo->pool, tvb, svoff+2));
205 break;
207 case 0x03: /* Local Ring Number */
208 if (sv_length != 4) {
209 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
210 "Subvector length is != 4");
211 break;
213 ring = tvb_get_ntohs(tvb, svoff+2);
214 proto_tree_add_item(sv_tree, hf_trmac_local_ring_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
215 proto_item_append_text(sv_item,
216 ": 0x%04X (%d)", ring, ring);
217 break;
219 case 0x04: /* Assign Physical Drop Number */
220 if (sv_length != 6) {
221 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
222 "Subvector length is != 6");
223 break;
225 proto_tree_add_item(sv_tree, hf_trmac_assign_physical_drop_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
226 proto_item_append_text(sv_item,
227 ": 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
228 break;
230 case 0x05: /* Error Report Timer Value */
231 if (sv_length != 4) {
232 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
233 "Subvector length is != 4");
234 break;
237 error_report_timer_value = 10 * tvb_get_ntohs(tvb, svoff+2);
238 proto_tree_add_uint(sv_tree, hf_trmac_error_report_timer_value, tvb, svoff+2, sv_length-2, error_report_timer_value);
239 proto_item_append_text(sv_item,
240 ": %u ms", error_report_timer_value );
241 break;
243 case 0x06: /* Authorized Function Classes */
244 if (sv_length != 4) {
245 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
246 "Subvector length is != 4");
247 break;
249 proto_tree_add_item(sv_tree, hf_trmac_authorized_function_classes, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
250 proto_item_append_text(sv_item,
251 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
252 break;
254 case 0x07: /* Authorized Access Priority */
255 if (sv_length != 4) {
256 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
257 "Subvector length is != 4");
258 break;
260 proto_tree_add_item(sv_tree, hf_trmac_authorized_access_priority, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
261 proto_item_append_text(sv_item,
262 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
263 break;
265 case 0x09: /* Correlator */
266 if (sv_length != 4) {
267 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
268 "Subvector length is != 4");
269 break;
271 proto_tree_add_item(sv_tree, hf_trmac_correlator, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
272 proto_item_append_text(sv_item,
273 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
274 break;
276 case 0x0A: /* SA of Last AMP or SMP Frame */
277 if (sv_length != 8) {
278 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
279 "Subvector length is != 8");
280 break;
282 proto_tree_add_item(sv_tree, hf_trmac_sa_of_last_amp_or_smp_frame, tvb, svoff+2, sv_length-2, ENC_NA);
283 proto_item_append_text(sv_item,
284 ": %s",
285 tvb_ether_to_str(pinfo->pool, tvb, svoff+2));
286 break;
288 case 0x0B: /* Physical Drop Number */
289 if (sv_length != 6) {
290 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
291 "Subvector length is != 6");
292 break;
294 proto_tree_add_item(sv_tree, hf_trmac_physical_drop_number, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
295 proto_item_append_text(sv_item,
296 ": 0x%08X", tvb_get_ntohl(tvb, svoff+2) );
297 break;
299 case 0x20: /* Response Code */
300 if (sv_length != 4 && sv_length != 6) {
301 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
302 "Subvector length is != 4 and != 6");
303 break;
305 if (sv_length == 4) {
306 proto_tree_add_uint_format_value(sv_tree, hf_trmac_response_code32, tvb, svoff+2, sv_length-2,
307 tvb_get_ntohl(tvb, svoff+2), "0x%04X 0x%02X 0x%02x",
308 tvb_get_ntohs(tvb, svoff+2), tvb_get_uint8(tvb, svoff+4), tvb_get_uint8(tvb, svoff+5));
309 proto_item_append_text(sv_item,
310 ": 0x%04X 0x%02X 0x%02x",
311 tvb_get_ntohs(tvb, svoff+2),
312 tvb_get_uint8(tvb, svoff+4),
313 tvb_get_uint8(tvb, svoff+5));
314 } else {
315 proto_tree_add_uint64_format_value(sv_tree, hf_trmac_response_code48, tvb, svoff+2, sv_length-2,
316 tvb_get_ntoh48(tvb, svoff+2), "0x%04X 0x%02X 0x%06X",
317 tvb_get_ntohs(tvb, svoff+2),
318 tvb_get_uint8(tvb, svoff+4),
319 tvb_get_ntoh24(tvb, svoff+5));
320 proto_item_append_text(sv_item,
321 ": 0x%04X 0x%02X 0x%06X",
322 tvb_get_ntohs(tvb, svoff+2),
323 tvb_get_uint8(tvb, svoff+4),
324 tvb_get_ntoh24(tvb, svoff+5));
326 break;
328 case 0x21: /* Individual Address Count */
329 if (sv_length != 4) {
330 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
331 "Subvector length is != 4");
332 break;
334 proto_tree_add_item(sv_tree, hf_trmac_individual_address_count, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
335 proto_item_append_text(sv_item,
336 ": %u", tvb_get_ntohs(tvb, svoff+2) );
337 break;
339 case 0x22: /* Product Instance ID */
340 proto_tree_add_item(sv_tree, hf_trmac_product_instance_id, tvb, svoff+2, sv_length-2, ENC_NA);
341 break;
343 case 0x23: /* Ring Station Version Number */
344 proto_tree_add_item(sv_tree, hf_trmac_ring_station_version_number, tvb, svoff+2, sv_length-2, ENC_NA);
345 break;
347 case 0x26: /* Wrap data */
348 proto_tree_add_item(sv_tree, hf_trmac_wrap_data, tvb, svoff+2, sv_length-2, ENC_NA);
349 break;
351 case 0x27: /* Frame Forward */
352 proto_tree_add_item(sv_tree, hf_trmac_frame_forward, tvb, svoff+2, sv_length-2, ENC_NA);
353 break;
355 case 0x28: /* Station Identifier */
356 if (sv_length != 8) {
357 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
358 "Subvector length is != 8");
359 break;
361 proto_tree_add_item(sv_tree, hf_trmac_station_identifier, tvb, svoff+2, sv_length-2, ENC_NA);
362 proto_item_append_text(sv_item,
363 ": %s",
364 tvb_ether_to_str(pinfo->pool, tvb, svoff+2));
365 break;
367 case 0x29: /* Ring Station Status */
368 proto_tree_add_item(sv_tree, hf_trmac_ring_station_status, tvb, svoff+2, sv_length-2, ENC_NA);
369 break;
371 case 0x2A: /* Transmit Status Code */
372 if (sv_length != 4) {
373 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
374 "Subvector length is != 4");
375 break;
377 proto_tree_add_item(sv_tree, hf_trmac_transmit_status_code, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
378 proto_item_append_text(sv_item,
379 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
380 break;
382 case 0x2B: /* Group Address */
383 if (sv_length != 6 && sv_length != 8) {
384 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
385 "Subvector length is != 6 and != 8");
386 break;
388 if (sv_length == 6) {
389 proto_tree_add_item(sv_tree, hf_trmac_group_address32, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
390 proto_item_append_text(sv_item,
391 ": %08X", tvb_get_ntohl(tvb, svoff+2) );
392 } else {
393 proto_tree_add_item(sv_tree, hf_trmac_group_address_ether, tvb, svoff+2, sv_length-2, ENC_NA);
394 proto_item_append_text(sv_item,
395 ": %s",
396 tvb_ether_to_str(pinfo->pool, tvb, svoff+2));
398 break;
400 case 0x2C: /* Functional Addresses */
401 if (sv_length != 6) {
402 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
403 "Subvector length is != 6");
404 break;
406 proto_tree_add_item(sv_tree, hf_trmac_functional_addresses, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
407 proto_item_append_text(sv_item,
408 ": %08X", tvb_get_ntohl(tvb, svoff+2) );
409 break;
411 case 0x2D: /* Isolating Error Counts */
412 if (sv_length != 8) {
413 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
414 "Subvector length is != 8");
415 break;
417 tvb_memcpy(tvb, errors, svoff+2, 6);
418 ti = proto_tree_add_uint(sv_tree, hf_trmac_errors_iso, tvb, svoff+2, sv_length-2,
419 errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
420 sv_subtree = proto_item_add_subtree(ti, ett_tr_ierr_cnt);
422 proto_tree_add_uint(sv_subtree, hf_trmac_errors_line, tvb, svoff+2, 1, errors[0]);
423 proto_tree_add_uint(sv_subtree, hf_trmac_errors_internal, tvb, svoff+3, 1, errors[1]);
424 proto_tree_add_uint(sv_subtree, hf_trmac_errors_burst, tvb, svoff+4, 1, errors[2]);
425 proto_tree_add_uint(sv_subtree, hf_trmac_errors_ac, tvb, svoff+5, 1, errors[3]);
426 proto_tree_add_uint(sv_subtree, hf_trmac_errors_abort, tvb, svoff+6, 1, errors[4]);
428 break;
430 case 0x2E: /* Non-Isolating Error Counts */
431 if (sv_length != 8) {
432 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
433 "Subvector length is != 8");
434 break;
436 tvb_memcpy(tvb, errors, svoff+2, 6);
437 ti = proto_tree_add_uint(sv_tree, hf_trmac_errors_noniso, tvb, svoff+2, sv_length-2,
438 errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
439 sv_subtree = proto_item_add_subtree(ti, ett_tr_nerr_cnt);
441 proto_tree_add_uint(sv_subtree, hf_trmac_errors_lost, tvb, svoff+2, 1, errors[0]);
442 proto_tree_add_uint(sv_subtree, hf_trmac_errors_congestion, tvb, svoff+3, 1, errors[1]);
443 proto_tree_add_uint(sv_subtree, hf_trmac_errors_fc, tvb, svoff+4, 1, errors[2]);
444 proto_tree_add_uint(sv_subtree, hf_trmac_errors_freq, tvb, svoff+5, 1, errors[3]);
445 proto_tree_add_uint(sv_subtree, hf_trmac_errors_token, tvb, svoff+6, 1, errors[4]);
446 break;
448 case 0x30: /* Error Code */
449 if (sv_length != 4) {
450 expert_add_info_format(pinfo, len_item, &ei_trmac_sv_len,
451 "Subvector length is != 4");
452 break;
454 proto_tree_add_item(sv_tree, hf_trmac_error_code, tvb, svoff+2, sv_length-2, ENC_BIG_ENDIAN);
455 proto_item_append_text(sv_item,
456 ": %04X", tvb_get_ntohs(tvb, svoff+2) );
457 break;
459 default: /* Unknown */
460 proto_tree_add_item(sv_tree, hf_trmac_unknown_subvector, tvb, svoff+2, sv_length-2, ENC_NA);
461 break;
463 return sv_length;
466 static int
467 dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
469 proto_tree *mac_tree;
470 proto_item *ti;
471 int sv_additional;
472 uint32_t mv_val, mv_length, sv_offset;
474 if (tvb_captured_length(tvb) < 3)
475 return 0;
477 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC");
478 col_clear(pinfo->cinfo, COL_INFO);
480 ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, -1, ENC_NA);
481 mac_tree = proto_item_add_subtree(ti, ett_tr_mac);
483 proto_tree_add_item_ret_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, ENC_NA, &mv_val);
484 proto_tree_add_item_ret_uint(mac_tree, hf_trmac_length, tvb, 0, 2, ENC_BIG_ENDIAN, &mv_length);
485 proto_item_set_len(ti, mv_length);
486 proto_tree_add_item(mac_tree, hf_trmac_srcclass, tvb, 2, 1, ENC_NA);
487 proto_tree_add_item(mac_tree, hf_trmac_dstclass, tvb, 2, 1, ENC_NA);
489 /* Interpret the major vector */
490 col_add_str(pinfo->cinfo, COL_INFO,
491 val_to_str_ext(mv_val, &major_vector_vs_ext, "Unknown Major Vector: %u"));
493 /* interpret the subvectors */
494 sv_offset = 4;
495 while (sv_offset < mv_length) {
496 sv_additional = sv_text(tvb, sv_offset, pinfo, mac_tree);
498 /* if this is a bad packet, we could get a 0-length added here,
499 * looping forever */
500 if (sv_additional > 0)
501 sv_offset += sv_additional;
502 else
503 break;
506 return tvb_captured_length(tvb);
509 void
510 proto_register_trmac(void)
512 static hf_register_info hf[] = {
513 { &hf_trmac_mv,
514 { "Major Vector", "trmac.mvec", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &major_vector_vs_ext, 0x0,
515 NULL, HFILL }},
517 { &hf_trmac_length,
518 { "Total Length", "trmac.length", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0,
519 NULL, HFILL }},
521 { &hf_trmac_srcclass,
522 { "Source Class", "trmac.srcclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0x0F,
523 NULL, HFILL }},
525 { &hf_trmac_dstclass,
526 { "Destination Class", "trmac.dstclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0xF0,
527 NULL, HFILL }},
529 { &hf_trmac_sv_len,
530 { "Subvector Length", "trmac.svec.len", FT_UINT8, BASE_DEC, NULL, 0x0,
531 NULL, HFILL }},
533 { &hf_trmac_sv_id,
534 { "Subvector Identifier", "trmac.svec.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &subvector_vs_ext, 0x0,
535 NULL, HFILL }},
537 { &hf_trmac_errors_iso,
538 { "Isolating Errors", "trmac.errors.iso", FT_UINT16, BASE_DEC, NULL, 0x0,
539 NULL, HFILL }},
541 { &hf_trmac_errors_line,
542 { "Line Errors", "trmac.errors.line", FT_UINT8, BASE_DEC, NULL, 0x0,
543 NULL, HFILL }},
545 { &hf_trmac_errors_internal,
546 { "Internal Errors", "trmac.errors.internal", FT_UINT8, BASE_DEC, NULL, 0x0,
547 NULL, HFILL }},
549 { &hf_trmac_errors_burst,
550 { "Burst Errors", "trmac.errors.burst", FT_UINT8, BASE_DEC, NULL, 0x0,
551 NULL, HFILL }},
553 { &hf_trmac_errors_ac,
554 { "A/C Errors", "trmac.errors.ac", FT_UINT8, BASE_DEC, NULL, 0x0,
555 NULL, HFILL }},
557 { &hf_trmac_errors_abort,
558 { "Abort Delimiter Transmitted Errors", "trmac.errors.abort", FT_UINT8, BASE_DEC, NULL, 0x0,
559 NULL, HFILL }},
561 { &hf_trmac_errors_noniso,
562 { "Non-Isolating Errors", "trmac.errors.noniso", FT_UINT16, BASE_DEC, NULL, 0x0,
563 NULL, HFILL }},
565 { &hf_trmac_errors_lost,
566 { "Lost Frame Errors", "trmac.errors.lost", FT_UINT8, BASE_DEC, NULL, 0x0,
567 NULL, HFILL }},
569 { &hf_trmac_errors_congestion,
570 { "Receiver Congestion Errors", "trmac.errors.congestion", FT_UINT8, BASE_DEC, NULL, 0x0,
571 NULL, HFILL }},
573 { &hf_trmac_errors_fc,
574 { "Frame-Copied Errors", "trmac.errors.fc", FT_UINT8, BASE_DEC, NULL, 0x0,
575 NULL, HFILL }},
577 { &hf_trmac_errors_freq,
578 { "Frequency Errors", "trmac.errors.freq", FT_UINT8, BASE_DEC, NULL, 0x0,
579 NULL, HFILL }},
581 { &hf_trmac_errors_token,
582 { "Token Errors", "trmac.errors.token", FT_UINT8, BASE_DEC, NULL, 0x0,
583 NULL, HFILL }},
585 { &hf_trmac_naun,
586 { "Upstream Neighbor's Address", "trmac.naun", FT_ETHER, BASE_NONE, NULL, 0x0,
587 NULL, HFILL }},
589 { &hf_trmac_beacon_type,
590 { "Beacon Type", "trmac.beacon_type", FT_UINT16, BASE_DEC, VALS(beacon_vs), 0x0,
591 NULL, HFILL }},
593 { &hf_trmac_local_ring_number,
594 { "Local Ring Number", "trmac.local_ring_number", FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
595 NULL, HFILL }},
597 { &hf_trmac_assign_physical_drop_number,
598 { "Assign Physical Drop Number", "trmac.assign_physical_drop_number", FT_UINT32, BASE_HEX, NULL, 0x0,
599 NULL, HFILL }},
601 { &hf_trmac_error_report_timer_value,
602 { "Error Report Timer Value", "trmac.error_report_timer_value", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
603 NULL, HFILL }},
605 { &hf_trmac_authorized_function_classes,
606 { "Authorized Function Classes", "trmac.authorized_function_classes", FT_UINT16, BASE_HEX, NULL, 0x0,
607 NULL, HFILL }},
609 { &hf_trmac_authorized_access_priority,
610 { "Authorized Access Priority", "trmac.authorized_access_priority", FT_UINT16, BASE_HEX, NULL, 0x0,
611 NULL, HFILL }},
613 { &hf_trmac_correlator,
614 { "Correlator", "trmac.correlator", FT_UINT16, BASE_HEX, NULL, 0x0,
615 NULL, HFILL }},
617 { &hf_trmac_sa_of_last_amp_or_smp_frame,
618 { "SA of Last AMP or SMP Frame", "trmac.sa_of_last_amp_or_smp_frame", FT_ETHER, BASE_NONE, NULL, 0x0,
619 NULL, HFILL }},
621 { &hf_trmac_physical_drop_number,
622 { "Physical Drop Number", "trmac.physical_drop_number", FT_UINT32, BASE_HEX, NULL, 0x0,
623 NULL, HFILL }},
625 { &hf_trmac_individual_address_count,
626 { "Individual Address Count", "trmac.individual_address_count", FT_UINT16, BASE_DEC, NULL, 0x0,
627 NULL, HFILL }},
629 { &hf_trmac_station_identifier,
630 { "Station Identifier", "trmac.station_identifier", FT_ETHER, BASE_NONE, NULL, 0x0,
631 NULL, HFILL }},
633 { &hf_trmac_transmit_status_code,
634 { "Transmit Status Code", "trmac.transmit_status_code", FT_UINT16, BASE_HEX, NULL, 0x0,
635 NULL, HFILL }},
637 { &hf_trmac_group_address32,
638 { "Group Address", "trmac.group_address32s", FT_UINT32, BASE_HEX, NULL, 0x0,
639 NULL, HFILL }},
641 { &hf_trmac_group_address_ether,
642 { "Group Address", "trmac.group_address_ether", FT_ETHER, BASE_NONE, NULL, 0x0,
643 NULL, HFILL }},
645 { &hf_trmac_functional_addresses,
646 { "Functional Addresses", "trmac.functional_addresses", FT_UINT32, BASE_HEX, NULL, 0x0,
647 NULL, HFILL }},
649 { &hf_trmac_error_code,
650 { "Error Code", "trmac.error_code", FT_UINT16, BASE_HEX, NULL, 0x0,
651 NULL, HFILL }},
653 /* Generated from convert_proto_tree_add_text.pl */
654 { &hf_trmac_response_code32, { "Response Code", "trmac.response_code", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
655 { &hf_trmac_response_code48, { "Response Code", "trmac.response_code48", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }},
656 { &hf_trmac_product_instance_id, { "Product Instance ID", "trmac.product_instance_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
657 { &hf_trmac_ring_station_version_number, { "Ring Station Version Number", "trmac.ring_station_version_number", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
658 { &hf_trmac_wrap_data, { "Wrap Data", "trmac.wrap_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
659 { &hf_trmac_frame_forward, { "Frame Forward", "trmac.frame_forward", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
660 { &hf_trmac_ring_station_status, { "Ring Station Status", "trmac.ring_station_status", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
661 { &hf_trmac_unknown_subvector, { "Unknown Subvector", "trmac.unknown_subvector", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
664 static int *ett[] = {
665 &ett_tr_mac,
666 &ett_tr_sv,
667 &ett_tr_ierr_cnt,
668 &ett_tr_nerr_cnt,
671 static ei_register_info ei[] = {
672 { &ei_trmac_sv_len, { "trmac.svec.len.invalid", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }},
675 expert_module_t* expert_trmac;
677 proto_trmac = proto_register_protocol("Token-Ring Media Access Control", "TR MAC", "trmac");
678 proto_register_field_array(proto_trmac, hf, array_length(hf));
679 proto_register_subtree_array(ett, array_length(ett));
680 expert_trmac = expert_register_protocol(proto_trmac);
681 expert_register_field_array(expert_trmac, ei, array_length(ei));
683 register_dissector("trmac", dissect_trmac, proto_trmac);
687 * Editor modelines - https://www.wireshark.org/tools/modelines.html
689 * Local variables:
690 * c-basic-offset: 8
691 * tab-width: 8
692 * indent-tabs-mode: t
693 * End:
695 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
696 * :indentSize=8:tabSize=8:noTabs=false: