epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-rtnet.c
blob36bd4c3d11c5ce4cd0c4de7a52ab63463432ad77
1 /* packet-rtnet.c
2 * Routines for RTnet packet disassembly
4 * Copyright (c) 2003 by Erwin Rol <erwin@erwinrol.com>
5 * Copyright (c) 2004 by Jan Kiszka <jan.kiszka@web.de>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1999 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 /* Include files */
16 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/addr_resolv.h>
20 #include <epan/etypes.h>
21 #include <epan/tfs.h>
22 #include <wsutil/array.h>
24 * See
26 * http://www.rtnet.org/
28 * https://github.com/iocroblab/rtnet/blob/master/Documentation/RTcfg.spec
29 * https://github.com/iocroblab/rtnet/blob/master/Documentation/RTmac.spec
32 void proto_register_rtmac(void);
33 void proto_reg_handoff_rtmac(void);
35 static dissector_handle_t rtmac_handle;
36 static dissector_handle_t rtcfg_handle;
38 void proto_register_rtcfg(void);
39 void proto_reg_handoff_rtcfg(void);
41 #define RTMAC_TYPE_TDMA 0x0001 /* since version 2 */
42 #define RTMAC_TYPE_TDMA_V1 0x9031 /* first TDMA version */
44 static const value_string rtmac_type_vals[] = {
45 { RTMAC_TYPE_TDMA, "TDMA" },
46 { RTMAC_TYPE_TDMA_V1, "TDMA-V1" },
47 { 0, NULL }
50 #define RTMAC_FLAG_TUNNEL 0x01
51 #define RTMAC_FLAGS_RES 0xFE
53 #define RTCFG_MSG_S1_CONFIG 0x0
54 #define RTCFG_MSG_ANN_NEW 0x1
55 #define RTCFG_MSG_ANN_REPLY 0x2
56 #define RTCFG_MSG_S2_CONFIG 0x3
57 #define RTCFG_MSG_S2_FRAG 0x4
58 #define RTCFG_MSG_ACK 0x5
59 #define RTCFG_MSG_READY 0x6
60 #define RTCFG_MSG_HBEAT 0x7
61 #define RTCFG_MSG_DEAD_STN 0x8
63 static const value_string rtcfg_msg_vals[] = {
64 { RTCFG_MSG_S1_CONFIG, "Stage 1 Config" },
65 { RTCFG_MSG_ANN_NEW, "New Announce" },
66 { RTCFG_MSG_ANN_REPLY, "Reply Announce" },
67 { RTCFG_MSG_S2_CONFIG, "Stage 2 Config" },
68 { RTCFG_MSG_S2_FRAG, "Stage 2 Fragment" },
69 { RTCFG_MSG_ACK, "Acknowledge" },
70 { RTCFG_MSG_READY, "Ready" },
71 { RTCFG_MSG_HBEAT, "Heartbeat" },
72 { RTCFG_MSG_DEAD_STN, "Dead Station" },
73 { 0, NULL }
76 #define RTCFG_ADDRESS_TYPE_MAC 0x00
77 #define RTCFG_ADDRESS_TYPE_IP 0x01
79 static const value_string rtcfg_address_type_vals[] = {
80 { RTCFG_ADDRESS_TYPE_MAC, "MAC" },
81 { RTCFG_ADDRESS_TYPE_IP, "IP" },
82 { 0, NULL }
85 #define TDMA_V1_MSG_NOTIFY_MASTER 0x10
86 #define TDMA_V1_MSG_REQUEST_TEST 0x11
87 #define TDMA_V1_MSG_ACK_TEST 0x12
88 #define TDMA_V1_MSG_REQUEST_CONF 0x13
89 #define TDMA_V1_MSG_ACK_CONF 0x14
90 #define TDMA_V1_MSG_ACK_ACK_CONF 0x15
91 #define TDMA_V1_MSG_STATION_LIST 0x16
92 #define TDMA_V1_MSG_REQUEST_CHANGE_OFFSET 0x17
93 #define TDMA_V1_MSG_START_OF_FRAME 0x18
95 static const value_string tdma_v1_msg_vals[] = {
96 { TDMA_V1_MSG_NOTIFY_MASTER, "Notify Master" },
97 { TDMA_V1_MSG_REQUEST_TEST, "Request Test" },
98 { TDMA_V1_MSG_ACK_TEST, "Acknowledge Test" },
99 { TDMA_V1_MSG_REQUEST_CONF, "Request Config" },
100 { TDMA_V1_MSG_ACK_CONF, "Acknowledge Config" },
101 { TDMA_V1_MSG_ACK_ACK_CONF, "Ack Ack Config" },
102 { TDMA_V1_MSG_STATION_LIST, "Station List" },
103 { TDMA_V1_MSG_REQUEST_CHANGE_OFFSET, "Request Change Offset" },
104 { TDMA_V1_MSG_START_OF_FRAME, "Start of Frame" },
105 { 0, NULL }
108 #define TDMA_MSG_SYNC 0x0000
109 #define TDMA_MSG_CAL_REQUEST 0x0010
110 #define TDMA_MSG_CAL_REPLY 0x0011
112 static const value_string tdma_msg_vals[] = {
113 { TDMA_MSG_SYNC, "Synchronisation" },
114 { TDMA_MSG_CAL_REQUEST, "Request Calibration" },
115 { TDMA_MSG_CAL_REPLY, "Reply Calibration" },
116 { 0, NULL }
119 static dissector_table_t ethertype_table;
120 static dissector_handle_t data_handle;
122 /* Define the rtnet proto */
123 static int proto_rtmac;
124 static int proto_tdma;
125 static int proto_rtcfg;
127 /* RTmac Header */
128 static int hf_rtmac_header_type;
129 static int hf_rtmac_header_ver;
130 static int hf_rtmac_header_flags;
131 static int hf_rtmac_header_flags_tunnel;
132 static int hf_rtmac_header_flags_res;
133 static int hf_rtmac_header_res_v1;
136 /* RTcfg */
137 static int hf_rtcfg_vers_id;
138 static int hf_rtcfg_vers;
139 static int hf_rtcfg_id;
140 static int hf_rtcfg_address_type;
141 static int hf_rtcfg_client_ip_address;
142 static int hf_rtcfg_server_ip_address;
143 static int hf_rtcfg_burst_rate;
144 static int hf_rtcfg_padding;
145 static int hf_rtcfg_s1_config_length;
146 static int hf_rtcfg_config_data;
147 static int hf_rtcfg_client_flags;
148 static int hf_rtcfg_client_flags_available;
149 static int hf_rtcfg_client_flags_ready;
150 static int hf_rtcfg_client_flags_res;
151 static int hf_rtcfg_server_flags;
152 static int hf_rtcfg_server_flags_res0;
153 static int hf_rtcfg_server_flags_ready;
154 static int hf_rtcfg_server_flags_res2;
155 static int hf_rtcfg_active_stations;
156 static int hf_rtcfg_heartbeat_period;
157 static int hf_rtcfg_s2_config_length;
158 static int hf_rtcfg_config_offset;
159 static int hf_rtcfg_ack_length;
160 static int hf_rtcfg_client_hw_address;
163 /* TDMA-V1 */
164 static int hf_tdma_v1_msg;
166 /* TDMA REQUEST_CONF */
167 static int hf_tdma_v1_msg_request_conf_station;
168 static int hf_tdma_v1_msg_request_conf_padding;
169 static int hf_tdma_v1_msg_request_conf_mtu;
170 static int hf_tdma_v1_msg_request_conf_cycle;
172 /* TDMA ACK_CONF */
173 static int hf_tdma_v1_msg_ack_conf_station;
174 static int hf_tdma_v1_msg_ack_conf_padding;
175 static int hf_tdma_v1_msg_ack_conf_mtu;
176 static int hf_tdma_v1_msg_ack_conf_cycle;
178 /* TDMA ACK_ACK_CONF */
179 static int hf_tdma_v1_msg_ack_ack_conf_station;
180 static int hf_tdma_v1_msg_ack_ack_conf_padding;
182 /* TDMA REQUEST_TEST */
183 static int hf_tdma_v1_msg_request_test_counter;
184 static int hf_tdma_v1_msg_request_test_tx;
186 /* TDMA ACK_TEST */
187 static int hf_tdma_v1_msg_ack_test_counter;
188 static int hf_tdma_v1_msg_ack_test_tx;
190 /* TDMA STATION_LIST */
191 static int hf_tdma_v1_msg_station_list_nr_stations;
192 static int hf_tdma_v1_msg_station_list_padding;
194 static int hf_tdma_v1_msg_station_list_ip;
195 static int hf_tdma_v1_msg_station_list_nr;
197 /* TDMA CHANGE_OFFSET */
198 static int hf_tdma_v1_msg_request_change_offset_offset;
200 /* TDMA START_OF_FRAME */
201 static int hf_tdma_v1_msg_start_of_frame_timestamp;
204 /* TDMA since version 2 */
205 static int hf_tdma_ver;
206 static int hf_tdma_id;
208 /* TDMA Sync */
209 static int hf_tdma_sync_cycle;
210 static int hf_tdma_sync_xmit_stamp;
211 static int hf_tdma_sync_sched_xmit;
213 /* TDMA Request Calibration */
214 static int hf_tdma_req_cal_xmit_stamp;
215 static int hf_tdma_req_cal_rpl_cycle;
216 static int hf_tdma_req_cal_rpl_slot;
218 /* TDMA Reply Calibration */
219 static int hf_tdma_rpl_cal_req_stamp;
220 static int hf_tdma_rpl_cal_rcv_stamp;
221 static int hf_tdma_rpl_cal_xmit_stamp;
224 /* Define the tree for rtnet */
225 static int ett_rtmac;
226 static int ett_rtmac_flags;
227 static int ett_tdma;
228 static int ett_rtcfg;
230 static unsigned
231 dissect_rtnet_tdma_notify_master(tvbuff_t *tvb _U_, unsigned offset, proto_tree *tree _U_)
233 return offset;
236 static unsigned
237 dissect_rtnet_tdma_request_test(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
239 proto_tree_add_item(tree, hf_tdma_v1_msg_request_test_counter, tvb,
240 offset, 4, ENC_LITTLE_ENDIAN );
241 offset += 4;
243 proto_tree_add_item(tree, hf_tdma_v1_msg_request_test_tx, tvb,
244 offset, 8, ENC_LITTLE_ENDIAN );
245 offset += 8;
247 return offset;
250 static unsigned
251 dissect_rtnet_tdma_ack_test(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
253 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_test_counter, tvb,
254 offset, 4, ENC_LITTLE_ENDIAN );
255 offset += 4;
257 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_test_tx, tvb,
258 offset, 8, ENC_LITTLE_ENDIAN );
259 offset += 8;
261 return offset;
264 static unsigned
265 dissect_rtnet_tdma_request_conf(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
267 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_station, tvb,
268 offset, 1, ENC_BIG_ENDIAN );
269 offset += 1;
271 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_padding, tvb,
272 offset, 1, ENC_BIG_ENDIAN );
273 offset += 1;
275 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_mtu, tvb,
276 offset, 2, ENC_BIG_ENDIAN );
277 offset += 2;
279 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_cycle, tvb,
280 offset, 4, ENC_BIG_ENDIAN );
281 offset += 4;
283 return offset;
287 static unsigned
288 dissect_rtnet_tdma_ack_conf(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
290 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_station, tvb,
291 offset, 1, ENC_BIG_ENDIAN );
292 offset += 1;
294 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_padding, tvb,
295 offset, 1, ENC_BIG_ENDIAN );
296 offset += 1;
298 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_mtu, tvb,
299 offset, 2, ENC_BIG_ENDIAN );
300 offset += 2;
302 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_cycle, tvb,
303 offset, 4, ENC_BIG_ENDIAN );
304 offset += 4;
306 return offset;
309 static unsigned
310 dissect_rtnet_tdma_ack_ack_conf(tvbuff_t *tvb, unsigned offset, proto_tree *tree) {
312 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_ack_conf_station, tvb,
313 offset, 1, ENC_BIG_ENDIAN );
315 offset += 1;
317 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_ack_conf_padding, tvb,
318 offset, 3, ENC_NA );
319 offset += 3;
321 return offset;
324 static unsigned
325 dissect_rtnet_tdma_station_list(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
327 uint8_t nr_stations;
328 uint8_t i;
330 nr_stations = tvb_get_uint8(tvb, offset);
331 proto_tree_add_uint(tree, hf_tdma_v1_msg_station_list_nr_stations, tvb,
332 offset, 1, nr_stations);
334 offset += 1;
336 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_padding, tvb,
337 offset, 3, ENC_NA );
338 offset += 3;
341 for( i = 0; i < nr_stations; i++ )
343 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_ip, tvb,
344 offset, 4, ENC_BIG_ENDIAN );
346 offset += 4;
348 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_nr, tvb,
349 offset, 1, ENC_BIG_ENDIAN );
351 offset += 1;
353 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_padding, tvb,
354 offset, 3, ENC_NA );
355 offset += 3;
358 return offset;
361 static unsigned
362 dissect_rtnet_tdma_request_change_offset(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
364 proto_tree_add_item(tree, hf_tdma_v1_msg_request_change_offset_offset, tvb,
365 offset, 4, ENC_BIG_ENDIAN );
367 offset += 4;
369 return offset;
372 static unsigned
373 dissect_rtnet_tdma_start_of_frame(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
375 proto_tree_add_item(tree, hf_tdma_v1_msg_start_of_frame_timestamp, tvb,
376 offset, 8, ENC_BIG_ENDIAN );
377 offset += 8;
379 return offset;
382 static void
383 dissect_rtnet_tdma_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) {
384 unsigned offset = 0;
385 uint32_t msg;
386 proto_tree *tree;
387 proto_item *ti;
389 msg = tvb_get_ntohl(tvb, offset);
391 /* Set the protocol column */
392 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA-V1");
394 /* set the info column */
395 col_add_str(pinfo->cinfo, COL_INFO,
396 val_to_str(msg, tdma_v1_msg_vals, "Unknown (0x%04x)"));
398 if (root) {
399 ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA);
400 tree = proto_item_add_subtree(ti, ett_tdma);
402 proto_item_append_text(ti, ", Version 1, %s",
403 val_to_str(msg, tdma_v1_msg_vals, "Unknown (0x%04x)"));
405 proto_tree_add_item(tree, hf_tdma_v1_msg, tvb,
406 offset, 4, ENC_BIG_ENDIAN);
407 offset += 4;
409 switch( msg ) {
410 case TDMA_V1_MSG_NOTIFY_MASTER:
411 dissect_rtnet_tdma_notify_master(tvb, offset, tree);
412 break;
414 case TDMA_V1_MSG_REQUEST_TEST:
415 dissect_rtnet_tdma_request_test(tvb, offset, tree);
416 break;
418 case TDMA_V1_MSG_ACK_TEST:
419 dissect_rtnet_tdma_ack_test(tvb, offset, tree);
420 break;
422 case TDMA_V1_MSG_REQUEST_CONF:
423 dissect_rtnet_tdma_request_conf(tvb, offset, tree);
424 break;
426 case TDMA_V1_MSG_ACK_CONF:
427 dissect_rtnet_tdma_ack_conf(tvb, offset, tree);
428 break;
430 case TDMA_V1_MSG_ACK_ACK_CONF:
431 dissect_rtnet_tdma_ack_ack_conf(tvb, offset, tree);
432 break;
434 case TDMA_V1_MSG_STATION_LIST:
435 dissect_rtnet_tdma_station_list (tvb, offset, tree);
436 break;
438 case TDMA_V1_MSG_REQUEST_CHANGE_OFFSET:
439 dissect_rtnet_tdma_request_change_offset(tvb, offset, tree);
440 break;
442 case TDMA_V1_MSG_START_OF_FRAME:
443 dissect_rtnet_tdma_start_of_frame(tvb, offset, tree);
444 break;
446 default:
447 break;
452 static void
453 dissect_tdma_sync(tvbuff_t *tvb, unsigned offset, proto_tree *tree) {
454 int64_t timestamp;
455 proto_item *ti;
457 proto_tree_add_item(tree, hf_tdma_sync_cycle, tvb, offset, 4, ENC_BIG_ENDIAN);
458 offset += 4;
460 ti = proto_tree_add_item(tree, hf_tdma_sync_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
461 timestamp = tvb_get_ntoh64(tvb, offset) - tvb_get_ntoh64(tvb, offset+8);
462 proto_item_append_text(ti, " (%s%" PRId64 ")", (timestamp > 0) ? "+" : "", timestamp);
463 offset += 8;
465 proto_tree_add_item(tree, hf_tdma_sync_sched_xmit, tvb, offset, 8, ENC_BIG_ENDIAN);
468 static void
469 dissect_tdma_request_cal(tvbuff_t *tvb, unsigned offset, proto_tree *tree) {
471 proto_tree_add_item(tree, hf_tdma_req_cal_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
472 offset += 8;
474 proto_tree_add_item(tree, hf_tdma_req_cal_rpl_cycle, tvb, offset, 4, ENC_BIG_ENDIAN);
475 offset += 4;
477 proto_tree_add_item(tree, hf_tdma_req_cal_rpl_slot, tvb, offset, 8, ENC_BIG_ENDIAN);
480 static void
481 dissect_tdma_reply_cal(tvbuff_t *tvb, unsigned offset, proto_tree *tree) {
482 int64_t timestamp;
483 proto_item *ti;
485 proto_tree_add_item(tree, hf_tdma_rpl_cal_req_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
486 offset += 8;
488 proto_tree_add_item(tree, hf_tdma_rpl_cal_rcv_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
490 timestamp = tvb_get_ntoh64(tvb, offset+8) - tvb_get_ntoh64(tvb, offset);
491 offset += 8;
493 ti = proto_tree_add_item(tree, hf_tdma_rpl_cal_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
494 proto_item_append_text(ti, " (%s%" PRId64 ")", (timestamp > 0) ? "+" : "", timestamp);
497 static void
498 dissect_rtnet_tdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) {
499 unsigned offset = 0;
500 uint16_t msg;
501 proto_item *ti;
502 proto_tree *tree;
504 msg = tvb_get_ntohs(tvb, 2);
506 /* Set the protocol column */
507 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA");
509 /* Set the info column */
510 col_add_str(pinfo->cinfo, COL_INFO,
511 val_to_str(msg, tdma_msg_vals, "Unknown (0x%04x)"));
513 if (root) {
514 ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA);
515 tree = proto_item_add_subtree(ti, ett_tdma);
517 proto_item_append_text(ti, ", %s", val_to_str(msg, tdma_msg_vals, "Unknown (0x%04x)"));
519 proto_tree_add_item(tree, hf_tdma_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
520 offset += 2;
522 proto_tree_add_item(tree, hf_tdma_id, tvb, offset, 2, ENC_BIG_ENDIAN);
523 offset += 2;
525 switch (msg) {
526 case TDMA_MSG_SYNC:
527 dissect_tdma_sync(tvb, offset, tree);
528 break;
530 case TDMA_MSG_CAL_REQUEST:
531 dissect_tdma_request_cal(tvb, offset, tree);
532 break;
534 case TDMA_MSG_CAL_REPLY:
535 dissect_tdma_reply_cal(tvb, offset, tree);
536 break;
538 default:
539 break;
544 static int
545 dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
546 int offset = 0;
547 uint8_t ver,flags;
548 uint16_t type;
549 tvbuff_t *next_tvb;
550 proto_tree *ti=NULL, *rtmac_tree=NULL;
551 proto_item *item;
552 dissector_handle_t dissector=NULL;
553 const char *type_str=NULL;
555 /* Read the header */
556 type = tvb_get_ntohs(tvb, offset);
557 ver = tvb_get_uint8(tvb, offset+2);
558 flags = tvb_get_uint8(tvb, offset+3);
560 if (ver == 1) {
561 type_str = try_val_to_str(type, rtmac_type_vals);
562 if (!type_str) {
563 dissector = dissector_get_uint_handle(ethertype_table, type);
565 } else {
566 if (flags & RTMAC_FLAG_TUNNEL) {
567 dissector = dissector_get_uint_handle(ethertype_table, type);
570 if (!dissector)
571 dissector = data_handle;
573 if (tree) {
574 ti = proto_tree_add_item(tree, proto_rtmac, tvb, offset, 4, ENC_NA);
575 rtmac_tree = proto_item_add_subtree(ti, ett_rtmac);
576 proto_item_append_text(ti, ", Version %d", ver);
579 /* Set the protocol column */
580 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTmac");
582 /* set the info column */
583 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown (0x%04x)",type);
585 if (rtmac_tree) {
586 if (ver == 1) {
587 if (!type_str) {
588 if (dissector != data_handle)
589 type_str = dissector_handle_get_protocol_short_name(dissector);
590 else
591 type_str = "Unknown";
593 } else {
594 if (!(flags & RTMAC_FLAG_TUNNEL))
595 type_str = val_to_str_const(type, rtmac_type_vals, "Unknown");
596 else {
597 if (dissector != data_handle)
598 type_str = dissector_handle_get_protocol_short_name(dissector);
599 else
600 type_str = "Unknown";
603 proto_tree_add_string_format_value(rtmac_tree, hf_rtmac_header_type, tvb, offset, 2,
604 type_str, "%s (0x%04x)", type_str, type);
605 offset += 2;
607 proto_tree_add_item(rtmac_tree, hf_rtmac_header_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
608 offset += 1;
610 if (ver == 1)
611 proto_tree_add_item(rtmac_tree, hf_rtmac_header_res_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
612 else {
613 item = proto_tree_add_item(rtmac_tree, hf_rtmac_header_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
614 ti = proto_item_add_subtree(item, ett_rtmac_flags);
615 proto_tree_add_item(ti, hf_rtmac_header_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
616 proto_tree_add_item(ti, hf_rtmac_header_flags_tunnel, tvb, offset, 1, ENC_BIG_ENDIAN);
618 offset += 1;
620 else
621 offset += 4;
623 next_tvb = tvb_new_subset_remaining(tvb, offset);
625 if (ver == 1) {
626 switch (type) {
627 case RTMAC_TYPE_TDMA_V1:
628 dissect_rtnet_tdma_v1(next_tvb, pinfo, tree);
629 break;
631 default:
632 call_dissector(dissector, next_tvb, pinfo, tree);
633 break;
635 } else {
636 if (flags & RTMAC_FLAG_TUNNEL)
637 call_dissector(dissector, next_tvb, pinfo, tree);
638 else {
639 switch (type) {
640 case RTMAC_TYPE_TDMA:
641 dissect_rtnet_tdma(next_tvb, pinfo, tree);
642 break;
644 default:
645 call_dissector(data_handle, next_tvb, pinfo, tree);
646 break;
651 return tvb_captured_length(tvb);
654 static int
655 dissect_rtcfg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
656 int offset = 0;
657 proto_tree *vers_id_tree, *vers_id_item, *flags_tree, *flags_item;
658 uint8_t vers_id;
659 uint8_t addr_type;
660 uint32_t config_length,len;
661 proto_tree *ti=NULL,*rtcfg_tree=NULL;
663 /* Set the protocol column */
664 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTcfg");
666 /* Clear out stuff in the info column */
667 col_clear(pinfo->cinfo, COL_INFO);
669 if (tree) {
670 ti = proto_tree_add_item(tree, proto_rtcfg, tvb, offset, -1, ENC_NA);
671 rtcfg_tree = proto_item_add_subtree(ti, ett_rtcfg);
674 vers_id = tvb_get_uint8(tvb, offset);
676 col_add_str(pinfo->cinfo, COL_INFO,
677 val_to_str(vers_id, rtcfg_msg_vals, "Unknown (0x%04x)"));
679 if( rtcfg_tree )
681 vers_id_item = proto_tree_add_uint(rtcfg_tree, hf_rtcfg_vers_id, tvb,
682 offset, 1, vers_id);
684 vers_id_tree=proto_item_add_subtree(vers_id_item, ett_rtcfg);
685 proto_tree_add_item(vers_id_tree, hf_rtcfg_vers, tvb, offset, 1, ENC_BIG_ENDIAN);
686 proto_tree_add_item(vers_id_tree, hf_rtcfg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
687 offset += 1;
689 proto_item_append_text(ti, ", Version %d, %s",
690 (vers_id >> 5),
691 val_to_str(vers_id, rtcfg_msg_vals, "Unknown (0x%04x)"));
693 switch( vers_id & 0x1f )
695 case RTCFG_MSG_S1_CONFIG:
696 addr_type = tvb_get_uint8(tvb, offset);
697 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
698 offset += 1;
700 switch( addr_type )
702 case RTCFG_ADDRESS_TYPE_MAC:
703 /* nothing */
704 break;
706 case RTCFG_ADDRESS_TYPE_IP:
707 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
708 offset += 4;
710 proto_tree_add_item( rtcfg_tree, hf_rtcfg_server_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
711 offset += 4;
713 break;
716 proto_tree_add_item( rtcfg_tree, hf_rtcfg_burst_rate, tvb, offset, 1, ENC_BIG_ENDIAN );
717 offset += 1;
719 config_length = tvb_get_ntohs( tvb, offset );
720 proto_tree_add_item( rtcfg_tree, hf_rtcfg_s1_config_length, tvb, offset, 2, ENC_BIG_ENDIAN );
721 offset += 2;
723 if( config_length > 0 ) {
724 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, config_length, ENC_NA );
725 /*offset += config_length;*/
728 break;
730 case RTCFG_MSG_ANN_NEW:
731 addr_type = tvb_get_uint8(tvb, offset);
732 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
733 offset += 1;
735 switch( addr_type )
737 case RTCFG_ADDRESS_TYPE_MAC:
738 /* nothing */
739 break;
741 case RTCFG_ADDRESS_TYPE_IP:
742 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
743 offset += 4;
744 break;
747 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_client_flags, tvb,
748 offset, 1, ENC_BIG_ENDIAN);
750 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
751 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_available, tvb, offset, 1, ENC_BIG_ENDIAN);
752 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
753 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
754 offset += 1;
756 proto_tree_add_item( rtcfg_tree, hf_rtcfg_burst_rate, tvb, offset, 1, ENC_BIG_ENDIAN );
757 /*offset += 1;*/
759 break;
761 case RTCFG_MSG_ANN_REPLY:
762 addr_type = tvb_get_uint8(tvb, offset);
763 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
764 offset += 1;
766 switch( addr_type )
768 case RTCFG_ADDRESS_TYPE_MAC:
769 /* nothing */
770 break;
772 case RTCFG_ADDRESS_TYPE_IP:
773 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
774 offset += 4;
775 break;
778 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_client_flags, tvb,
779 offset, 1, ENC_BIG_ENDIAN);
781 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
782 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_available, tvb, offset, 1, ENC_BIG_ENDIAN);
783 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
784 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
785 offset += 1;
787 proto_tree_add_item( rtcfg_tree, hf_rtcfg_padding, tvb, offset, 1, ENC_BIG_ENDIAN );
788 /*offset += 1;*/
790 break;
792 case RTCFG_MSG_S2_CONFIG:
793 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_server_flags, tvb,
794 offset, 1, ENC_BIG_ENDIAN);
796 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
797 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_res0, tvb, offset, 1, ENC_BIG_ENDIAN);
798 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
799 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_res2, tvb, offset, 1, ENC_BIG_ENDIAN);
800 offset += 1;
802 proto_tree_add_item( rtcfg_tree, hf_rtcfg_active_stations, tvb, offset, 4, ENC_BIG_ENDIAN );
803 offset += 4;
805 proto_tree_add_item( rtcfg_tree, hf_rtcfg_heartbeat_period, tvb, offset, 2, ENC_BIG_ENDIAN );
806 offset += 2;
808 config_length = tvb_get_ntohl( tvb, offset );
809 proto_tree_add_item( rtcfg_tree, hf_rtcfg_s2_config_length, tvb, offset, 4, ENC_BIG_ENDIAN );
810 offset += 4;
812 if( config_length > 0 ) {
813 len = tvb_reported_length_remaining(tvb, offset);
814 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, len, ENC_NA );
815 /*offset += len;*/
818 break;
820 case RTCFG_MSG_S2_FRAG:
821 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_offset, tvb, offset, 4, ENC_BIG_ENDIAN );
822 offset += 4;
824 len = tvb_reported_length_remaining(tvb, offset);
825 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, len, ENC_NA );
826 /*offset += len;*/
827 break;
829 case RTCFG_MSG_ACK:
830 proto_tree_add_item( rtcfg_tree, hf_rtcfg_ack_length, tvb, offset, 4, ENC_BIG_ENDIAN );
831 /*offset += 4;*/
833 break;
835 case RTCFG_MSG_READY:
836 break;
838 case RTCFG_MSG_HBEAT:
839 break;
841 case RTCFG_MSG_DEAD_STN:
842 addr_type = tvb_get_uint8(tvb, offset);
843 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
844 offset += 1;
846 switch( addr_type )
848 case RTCFG_ADDRESS_TYPE_MAC:
849 /* nothing */
850 break;
852 case RTCFG_ADDRESS_TYPE_IP:
853 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
854 offset += 4;
855 break;
859 * Infer the type of the physical address from the type of the
860 * source address of this packet.
862 switch( pinfo->dl_src.type )
864 case AT_ETHER:
865 proto_tree_add_bytes_format_value( rtcfg_tree, hf_rtcfg_client_hw_address, tvb, offset, 32,
866 NULL, "%s",
867 tvb_ether_to_str(pinfo->pool, tvb, offset));
868 break;
870 default:
871 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_hw_address, tvb, offset, 32, ENC_NA );
872 break;
874 /*offset += 32;*/
876 break;
880 return tvb_captured_length(tvb);
883 void
884 proto_register_rtmac(void) {
885 static hf_register_info hf_array_rtmac[] = {
887 /* RTmac header */
888 { &hf_rtmac_header_type,
889 { "Type",
890 "rtmac.header.type",
891 FT_STRING, BASE_NONE, NULL, 0x0,
892 "RTmac Type", HFILL }},
894 { &hf_rtmac_header_ver,
895 { "Version",
896 "rtmac.header.ver",
897 FT_UINT16, BASE_DEC, NULL, 0x0,
898 "RTmac Version", HFILL }},
900 { &hf_rtmac_header_flags,
901 { "Flags",
902 "rtmac.header.flags",
903 FT_UINT8, BASE_HEX, NULL, 0x0,
904 "RTmac Flags", HFILL }},
906 { &hf_rtmac_header_flags_tunnel,
907 { "Tunnelling Flag",
908 "rtmac.header.flags.tunnel",
909 FT_BOOLEAN, 8, TFS(&tfs_set_notset), RTMAC_FLAG_TUNNEL,
910 "RTmac Tunnelling Flag", HFILL }},
912 { &hf_rtmac_header_flags_res,
913 { "Reserved Flags",
914 "rtmac.header.flags.res",
915 FT_UINT8, BASE_HEX, NULL, RTMAC_FLAGS_RES,
916 "RTmac Reserved Flags", HFILL }},
918 { &hf_rtmac_header_res_v1,
919 { "Reserved",
920 "rtmac.header.res",
921 FT_UINT8, BASE_HEX, NULL, 0x0,
922 "RTmac Reserved", HFILL }},
925 static hf_register_info hf_array_tdma[] = {
927 /* TDMA msg */
928 { &hf_tdma_v1_msg,
929 { "Message",
930 "tdma-v1.msg",
931 FT_UINT32, BASE_HEX, VALS(tdma_v1_msg_vals), 0x0,
932 "TDMA-V1 Message", HFILL }},
934 /* TDMA request conf */
936 { &hf_tdma_v1_msg_request_conf_station,
937 { "Station",
938 "tdma-v1.msg.request_conf.station",
939 FT_UINT8, BASE_DEC, NULL, 0x0,
940 "TDMA Station", HFILL }},
942 { &hf_tdma_v1_msg_request_conf_padding,
943 { "Padding",
944 "tdma-v1.msg.request_conf.padding",
945 FT_UINT8, BASE_HEX, NULL, 0x0,
946 "TDMA Padding", HFILL }},
948 { &hf_tdma_v1_msg_request_conf_mtu,
949 { "MTU",
950 "tdma-v1.msg.request_conf.mtu",
951 FT_UINT16, BASE_DEC, NULL, 0x0,
952 "TDMA MTU", HFILL }},
954 { &hf_tdma_v1_msg_request_conf_cycle,
955 { "Cycle",
956 "tdma-v1.msg.request_conf.cycle",
957 FT_UINT32, BASE_DEC, NULL, 0x0,
958 "TDMA Cycle", HFILL }},
960 /* TDMA ack conf */
962 { &hf_tdma_v1_msg_ack_conf_station,
963 { "Station",
964 "tdma-v1.msg.ack_conf.station",
965 FT_UINT8, BASE_DEC, NULL, 0x0,
966 "TDMA Station", HFILL }},
968 { &hf_tdma_v1_msg_ack_conf_padding,
969 { "Padding",
970 "tdma-v1.msg.ack_conf.padding",
971 FT_UINT8, BASE_HEX, NULL, 0x0,
972 "TDMA Padding", HFILL }},
974 { &hf_tdma_v1_msg_ack_conf_mtu,
975 { "MTU",
976 "tdma-v1.msg.ack_conf.mtu",
977 FT_UINT16, BASE_DEC, NULL, 0x0,
978 "TDMA MTU", HFILL }},
980 { &hf_tdma_v1_msg_ack_conf_cycle,
981 { "Cycle",
982 "tdma-v1.msg.ack_conf.cycle",
983 FT_UINT32, BASE_DEC, NULL, 0x0,
984 "TDMA Cycle", HFILL }},
986 /* TDMA ack ack conf */
988 { &hf_tdma_v1_msg_ack_ack_conf_station,
989 { "Station",
990 "tdma-v1.msg.ack_ack_conf.station",
991 FT_UINT8, BASE_DEC, NULL, 0x0,
992 "TDMA Station", HFILL }},
994 { &hf_tdma_v1_msg_ack_ack_conf_padding,
995 { "Padding",
996 "tdma-v1.msg.ack_ack_conf.padding",
997 FT_BYTES, BASE_NONE, NULL, 0x0,
998 "TDMA Padding", HFILL }},
1000 /* TDMA request test */
1002 { &hf_tdma_v1_msg_request_test_counter,
1003 { "Counter",
1004 "tdma-v1.msg.request_test.counter",
1005 FT_UINT32, BASE_DEC, NULL, 0x0,
1006 "TDMA Counter", HFILL }},
1008 { &hf_tdma_v1_msg_request_test_tx,
1009 { "TX",
1010 "tdma-v1.msg.request_test.tx",
1011 FT_UINT64, BASE_DEC, NULL, 0x0,
1012 "TDMA TX", HFILL }},
1014 /* TDMA ack test */
1016 { &hf_tdma_v1_msg_ack_test_counter,
1017 { "Counter",
1018 "tdma-v1.msg.ack_test.counter",
1019 FT_UINT32, BASE_DEC, NULL, 0x0,
1020 "TDMA Counter", HFILL }},
1022 { &hf_tdma_v1_msg_ack_test_tx,
1023 { "TX",
1024 "tdma-v1.msg.ack_test.tx",
1025 FT_UINT64, BASE_DEC, NULL, 0x0,
1026 "TDMA TX", HFILL }},
1028 /* TDMA ack test */
1030 { &hf_tdma_v1_msg_request_change_offset_offset,
1031 { "Offset",
1032 "tdma-v1.msg.request_change_offset.offset",
1033 FT_UINT32, BASE_DEC, NULL, 0x0,
1034 "TDMA Offset", HFILL }},
1036 /* TDMA start of frame */
1039 { &hf_tdma_v1_msg_start_of_frame_timestamp,
1040 { "Timestamp",
1041 "tdma-v1.msg.start_of_frame.timestamp",
1042 FT_UINT64, BASE_DEC, NULL, 0x0,
1043 "TDMA Timestamp", HFILL }},
1045 /* TDMA station list */
1047 { &hf_tdma_v1_msg_station_list_nr_stations,
1048 { "Nr. Stations",
1049 "tdma-v1.msg.station_list.nr_stations",
1050 FT_UINT8, BASE_DEC, NULL, 0x0,
1051 "TDMA Nr. Stations", HFILL }},
1053 { &hf_tdma_v1_msg_station_list_nr,
1054 { "Nr.",
1055 "tdma-v1.msg.station_list.nr",
1056 FT_UINT8, BASE_DEC, NULL, 0x0,
1057 "TDMA Station Number", HFILL }},
1059 { &hf_tdma_v1_msg_station_list_ip,
1060 { "IP",
1061 "tdma-v1.msg.station_list.ip",
1062 FT_IPv4, BASE_NONE, NULL, 0x0,
1063 "TDMA Station IP", HFILL }},
1065 { &hf_tdma_v1_msg_station_list_padding,
1066 { "Padding",
1067 "tdma-v1.msg.station_list.padding",
1068 FT_BYTES, BASE_NONE, NULL, 0x0,
1069 "TDMA Padding", HFILL }},
1072 /* TDMA since version 2 */
1074 { &hf_tdma_ver,
1075 { "Version",
1076 "tdma.ver",
1077 FT_UINT16, BASE_HEX, NULL, 0x0,
1078 "TDMA Version", HFILL }},
1080 { &hf_tdma_id,
1081 { "Message ID",
1082 "tdma.id",
1083 FT_UINT16, BASE_HEX, VALS(tdma_msg_vals), 0x0,
1084 "TDMA Message ID", HFILL }},
1086 /* TDMA sync */
1088 { &hf_tdma_sync_cycle,
1089 { "Cycle Number",
1090 "tdma.sync.cycle",
1091 FT_UINT32, BASE_DEC, NULL, 0x0,
1092 "TDMA Sync Cycle Number", HFILL }},
1094 { &hf_tdma_sync_xmit_stamp,
1095 { "Transmission Time Stamp",
1096 "tdma.sync.xmit_stamp",
1097 FT_UINT64, BASE_DEC, NULL, 0x0,
1098 "TDMA Sync Transmission Time Stamp", HFILL }},
1100 { &hf_tdma_sync_sched_xmit,
1101 { "Scheduled Transmission Time",
1102 "tdma.sync.sched_xmit",
1103 FT_UINT64, BASE_DEC, NULL, 0x0,
1104 "TDMA Sync Scheduled Transmission Time", HFILL }},
1106 /* TDMA request calibration */
1108 { &hf_tdma_req_cal_xmit_stamp,
1109 { "Transmission Time Stamp",
1110 "tdma.req_cal.xmit_stamp",
1111 FT_UINT64, BASE_DEC, NULL, 0x0,
1112 "TDMA Request Calibration Transmission Time Stamp", HFILL }},
1114 { &hf_tdma_req_cal_rpl_cycle,
1115 { "Reply Cycle Number",
1116 "tdma.req_cal.rpl_cycle",
1117 FT_UINT32, BASE_DEC, NULL, 0x0,
1118 "TDMA Request Calibration Reply Cycle Number", HFILL }},
1120 { &hf_tdma_req_cal_rpl_slot,
1121 { "Reply Slot Offset",
1122 "tdma.req_cal.rpl_slot",
1123 FT_UINT64, BASE_DEC, NULL, 0x0,
1124 "TDMA Request Calibration Reply Slot Offset", HFILL }},
1126 /* TDMA reply calibration */
1128 { &hf_tdma_rpl_cal_req_stamp,
1129 { "Request Transmission Time",
1130 "tdma.rpl_cal.req_stamp",
1131 FT_UINT64, BASE_DEC, NULL, 0x0,
1132 "TDMA Reply Calibration Request Transmission Time", HFILL }},
1134 { &hf_tdma_rpl_cal_rcv_stamp,
1135 { "Reception Time Stamp",
1136 "tdma.rpl_cal.rcv_stamp",
1137 FT_UINT64, BASE_DEC, NULL, 0x0,
1138 "TDMA Reply Calibration Reception Time Stamp", HFILL }},
1140 { &hf_tdma_rpl_cal_xmit_stamp,
1141 { "Transmission Time Stamp",
1142 "tdma.rpl_cal.xmit_stamp",
1143 FT_UINT64, BASE_DEC, NULL, 0x0,
1144 "TDMA Reply Calibration Transmission Time Stamp", HFILL }},
1147 static int *ett_array_rtmac[] = {
1148 &ett_rtmac,
1149 &ett_rtmac_flags,
1152 static int *ett_array_tdma[] = {
1153 &ett_tdma,
1156 proto_rtmac = proto_register_protocol("Real-Time Media Access Control", "RTmac", "rtmac");
1157 proto_register_field_array(proto_rtmac, hf_array_rtmac, array_length(hf_array_rtmac));
1158 proto_register_subtree_array(ett_array_rtmac, array_length(ett_array_rtmac));
1160 rtmac_handle = register_dissector("rtmac", dissect_rtmac, proto_rtmac);
1162 proto_tdma = proto_register_protocol("TDMA RTmac Discipline", "TDMA", "tdma");
1163 proto_register_field_array(proto_rtmac, hf_array_tdma, array_length(hf_array_tdma));
1164 proto_register_subtree_array(ett_array_tdma, array_length(ett_array_tdma));
1168 void
1169 proto_register_rtcfg(void) {
1170 static hf_register_info hf[] = {
1171 { &hf_rtcfg_vers_id,
1172 { "Version and ID",
1173 "rtcfg.vers_id",
1174 FT_UINT8, BASE_HEX, NULL, 0x0,
1175 "RTcfg Version and ID", HFILL }},
1177 { &hf_rtcfg_vers,
1178 { "Version",
1179 "rtcfg.vers",
1180 FT_UINT8, BASE_DEC, NULL, 0xe0,
1181 "RTcfg Version", HFILL }},
1183 { &hf_rtcfg_id,
1184 { "ID",
1185 "rtcfg.id",
1186 FT_UINT8, BASE_HEX, VALS(rtcfg_msg_vals), 0x1f,
1187 "RTcfg ID", HFILL }},
1189 { &hf_rtcfg_address_type,
1190 { "Address Type",
1191 "rtcfg.address_type",
1192 FT_UINT8, BASE_DEC, VALS(rtcfg_address_type_vals), 0x00,
1193 "RTcfg Address Type", HFILL }},
1195 { &hf_rtcfg_client_ip_address,
1196 { "Client IP Address",
1197 "rtcfg.client_ip_address",
1198 FT_IPv4, BASE_NONE, NULL, 0x0,
1199 "RTcfg Client IP Address", HFILL }},
1201 { &hf_rtcfg_server_ip_address,
1202 { "Server IP Address",
1203 "rtcfg.server_ip_address",
1204 FT_IPv4, BASE_NONE, NULL, 0x0,
1205 "RTcfg Server IP Address", HFILL }},
1207 { &hf_rtcfg_burst_rate,
1208 { "Stage 2 Burst Rate",
1209 "rtcfg.burst_rate",
1210 FT_UINT8, BASE_DEC, NULL, 0x00,
1211 "RTcfg Stage 2 Burst Rate", HFILL }},
1213 { &hf_rtcfg_s1_config_length,
1214 { "Stage 1 Config Length",
1215 "rtcfg.s1_config_length",
1216 FT_UINT16, BASE_DEC, NULL, 0x00,
1217 "RTcfg Stage 1 Config Length", HFILL }},
1219 { &hf_rtcfg_config_data,
1220 { "Config Data",
1221 "rtcfg.config_data",
1222 FT_BYTES, BASE_NONE, NULL, 0x00,
1223 "RTcfg Config Data", HFILL }},
1225 { &hf_rtcfg_padding,
1226 { "Padding",
1227 "rtcfg.padding",
1228 FT_UINT8, BASE_DEC, NULL, 0x00,
1229 "RTcfg Padding", HFILL }},
1231 { &hf_rtcfg_client_flags,
1232 { "Flags",
1233 "rtcfg.client_flags",
1234 FT_UINT8, BASE_HEX, NULL, 0x00,
1235 "RTcfg Client Flags", HFILL }},
1237 { &hf_rtcfg_client_flags_available,
1238 { "Req. Available",
1239 "rtcfg.client_flags.available",
1240 FT_UINT8, BASE_DEC, NULL, 0x01,
1241 "Request Available", HFILL }},
1243 { &hf_rtcfg_client_flags_ready,
1244 { "Client Ready",
1245 "rtcfg.client_flags.ready",
1246 FT_UINT8, BASE_DEC, NULL, 0x02,
1247 NULL, HFILL }},
1249 { &hf_rtcfg_client_flags_res,
1250 { "Reserved",
1251 "rtcfg.client_flags.res",
1252 FT_UINT8, BASE_HEX, NULL, 0xfc,
1253 NULL, HFILL }},
1255 { &hf_rtcfg_server_flags,
1256 { "Flags",
1257 "rtcfg.server_flags",
1258 FT_UINT8, BASE_HEX, NULL, 0x00,
1259 "RTcfg Server Flags", HFILL }},
1261 { &hf_rtcfg_server_flags_res0,
1262 { "Reserved",
1263 "rtcfg.server_flags.res0",
1264 FT_UINT8, BASE_HEX, NULL, 0x01,
1265 NULL, HFILL }},
1267 { &hf_rtcfg_server_flags_ready,
1268 { "Server Ready",
1269 "rtcfg.server_flags.ready",
1270 FT_UINT8, BASE_DEC, NULL, 0x02,
1271 NULL, HFILL }},
1273 { &hf_rtcfg_server_flags_res2,
1274 { "Reserved",
1275 "rtcfg.server_flags.res2",
1276 FT_UINT8, BASE_HEX, NULL, 0xfc,
1277 NULL, HFILL }},
1279 { &hf_rtcfg_active_stations,
1280 { "Active Stations",
1281 "rtcfg.active_stations",
1282 FT_UINT32, BASE_DEC, NULL, 0x00,
1283 "RTcfg Active Stations", HFILL }},
1285 { &hf_rtcfg_heartbeat_period,
1286 { "Heartbeat Period",
1287 "rtcfg.hearbeat_period",
1288 FT_UINT16, BASE_DEC, NULL, 0x00,
1289 "RTcfg Heartbeat Period", HFILL }},
1291 { &hf_rtcfg_s2_config_length,
1292 { "Stage 2 Config Length",
1293 "rtcfg.s2_config_length",
1294 FT_UINT32, BASE_DEC, NULL, 0x00,
1295 "RTcfg Stage 2 Config Length", HFILL }},
1297 { &hf_rtcfg_config_offset,
1298 { "Config Offset",
1299 "rtcfg.config_offset",
1300 FT_UINT32, BASE_DEC, NULL, 0x00,
1301 "RTcfg Config Offset", HFILL }},
1303 { &hf_rtcfg_ack_length,
1304 { "Ack Length",
1305 "rtcfg.ack_length",
1306 FT_UINT32, BASE_DEC, NULL, 0x00,
1307 "RTcfg Ack Length", HFILL }},
1309 { &hf_rtcfg_client_hw_address,
1310 { "Client Hardware Address",
1311 "rtcfg.client_hw_address",
1312 FT_BYTES, BASE_NONE, NULL, 0x00,
1313 "RTcfg Client Hardware Address", HFILL }}
1316 static int *ett[] = {
1317 &ett_rtcfg,
1320 proto_rtcfg = proto_register_protocol("RTcfg","RTcfg","rtcfg");
1321 proto_register_field_array(proto_rtcfg,hf,array_length(hf));
1322 proto_register_subtree_array(ett,array_length(ett));
1324 rtcfg_handle = register_dissector("rtcfg", dissect_rtcfg, proto_rtcfg);
1327 /* The registration hand-off routing */
1329 void
1330 proto_reg_handoff_rtmac(void) {
1331 dissector_add_uint("ethertype", ETHERTYPE_RTMAC, rtmac_handle);
1332 ethertype_table = find_dissector_table("ethertype");
1335 void
1336 proto_reg_handoff_rtcfg(void) {
1337 data_handle = find_dissector("data");
1338 dissector_add_uint("ethertype", ETHERTYPE_RTCFG, rtcfg_handle);
1342 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1344 * Local Variables:
1345 * c-basic-offset: 2
1346 * tab-width: 8
1347 * indent-tabs-mode: nil
1348 * End:
1350 * ex: set shiftwidth=2 tabstop=8 expandtab:
1351 * :indentSize=2:tabSize=8:noTabs=true: