MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-rtnet.c
blob34089d8dfd5018c5b6dd2acb8a70e9016778bac0
1 /* packet-rtnet.c
2 * Routines for RTnet packet disassembly
4 * $Id$
6 * Copyright (c) 2003 by Erwin Rol <erwin@erwinrol.com>
7 * Copyright (c) 2004 by Jan Kiszka <jan.kiszka@web.de>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1999 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 /* Include files */
30 #include "config.h"
32 #include <glib.h>
34 #include <epan/packet.h>
35 #include <epan/addr_resolv.h>
36 #include <epan/etypes.h>
37 #include <epan/strutil.h>
40 * See
42 * http://www.rtnet.org/
44 * http://www.rts.uni-hannover.de/rtnet/lxr/source/Documentation/RTmac.spec
47 #define RTMAC_TYPE_TDMA 0x0001 /* since version 2 */
48 #define RTMAC_TYPE_TDMA_V1 0x9031 /* first TDMA version */
50 static const value_string rtmac_type_vals[] = {
51 { RTMAC_TYPE_TDMA, "TDMA" },
52 { RTMAC_TYPE_TDMA_V1, "TDMA-V1" },
53 { 0, NULL }
56 #define RTMAC_FLAG_TUNNEL 0x01
57 #define RTMAC_FLAGS_RES 0xFE
59 #define RTCFG_MSG_S1_CONFIG 0x0
60 #define RTCFG_MSG_ANN_NEW 0x1
61 #define RTCFG_MSG_ANN_REPLY 0x2
62 #define RTCFG_MSG_S2_CONFIG 0x3
63 #define RTCFG_MSG_S2_FRAG 0x4
64 #define RTCFG_MSG_ACK 0x5
65 #define RTCFG_MSG_READY 0x6
66 #define RTCFG_MSG_HBEAT 0x7
67 #define RTCFG_MSG_DEAD_STN 0x8
69 static const value_string rtcfg_msg_vals[] = {
70 { RTCFG_MSG_S1_CONFIG, "Stage 1 Config" },
71 { RTCFG_MSG_ANN_NEW, "New Announce" },
72 { RTCFG_MSG_ANN_REPLY, "Reply Announce" },
73 { RTCFG_MSG_S2_CONFIG, "Stage 2 Config" },
74 { RTCFG_MSG_S2_FRAG, "Stage 2 Fragment" },
75 { RTCFG_MSG_ACK, "Acknowledge" },
76 { RTCFG_MSG_READY, "Ready" },
77 { RTCFG_MSG_HBEAT, "Heartbeat" },
78 { RTCFG_MSG_DEAD_STN, "Dead Station" },
79 { 0, NULL }
82 #define RTCFG_ADDRESS_TYPE_MAC 0x00
83 #define RTCFG_ADDRESS_TYPE_IP 0x01
85 static const value_string rtcfg_address_type_vals[] = {
86 { RTCFG_ADDRESS_TYPE_MAC, "MAC" },
87 { RTCFG_ADDRESS_TYPE_IP, "IP" },
88 { 0, NULL }
91 #define TDMA_V1_MSG_NOTIFY_MASTER 0x10
92 #define TDMA_V1_MSG_REQUEST_TEST 0x11
93 #define TDMA_V1_MSG_ACK_TEST 0x12
94 #define TDMA_V1_MSG_REQUEST_CONF 0x13
95 #define TDMA_V1_MSG_ACK_CONF 0x14
96 #define TDMA_V1_MSG_ACK_ACK_CONF 0x15
97 #define TDMA_V1_MSG_STATION_LIST 0x16
98 #define TDMA_V1_MSG_REQUEST_CHANGE_OFFSET 0x17
99 #define TDMA_V1_MSG_START_OF_FRAME 0x18
101 static const value_string tdma_v1_msg_vals[] = {
102 { TDMA_V1_MSG_NOTIFY_MASTER, "Notify Master" },
103 { TDMA_V1_MSG_REQUEST_TEST, "Request Test" },
104 { TDMA_V1_MSG_ACK_TEST, "Acknowledge Test" },
105 { TDMA_V1_MSG_REQUEST_CONF, "Request Config" },
106 { TDMA_V1_MSG_ACK_CONF, "Acknowledge Config" },
107 { TDMA_V1_MSG_ACK_ACK_CONF, "Ack Ack Config" },
108 { TDMA_V1_MSG_STATION_LIST, "Station List" },
109 { TDMA_V1_MSG_REQUEST_CHANGE_OFFSET, "Request Change Offset" },
110 { TDMA_V1_MSG_START_OF_FRAME, "Start of Frame" },
111 { 0, NULL }
114 #define TDMA_MSG_SYNC 0x0000
115 #define TDMA_MSG_CAL_REQUEST 0x0010
116 #define TDMA_MSG_CAL_REPLY 0x0011
118 static const value_string tdma_msg_vals[] = {
119 { TDMA_MSG_SYNC, "Synchronisation" },
120 { TDMA_MSG_CAL_REQUEST, "Request Calibration" },
121 { TDMA_MSG_CAL_REPLY, "Reply Calibration" },
122 { 0, NULL }
125 static dissector_table_t ethertype_table;
126 static dissector_handle_t data_handle;
128 /* Define the rtnet proto */
129 static int proto_rtmac = -1;
130 static int proto_tdma = -1;
131 static int proto_rtcfg = -1;
133 /* RTmac Header */
134 static int hf_rtmac_header_type = -1;
135 static int hf_rtmac_header_ver = -1;
136 static int hf_rtmac_header_flags = -1;
137 static int hf_rtmac_header_flags_tunnel = -1;
138 static int hf_rtmac_header_flags_res = -1;
139 static int hf_rtmac_header_res_v1 = -1;
142 /* RTcfg */
143 static int hf_rtcfg_vers_id = -1;
144 static int hf_rtcfg_vers = -1;
145 static int hf_rtcfg_id = -1;
146 static int hf_rtcfg_address_type = -1;
147 static int hf_rtcfg_client_ip_address = -1;
148 static int hf_rtcfg_server_ip_address = -1;
149 static int hf_rtcfg_burst_rate = -1;
150 static int hf_rtcfg_padding = -1;
151 static int hf_rtcfg_s1_config_length = -1;
152 static int hf_rtcfg_config_data = -1;
153 static int hf_rtcfg_client_flags = -1;
154 static int hf_rtcfg_client_flags_available = -1;
155 static int hf_rtcfg_client_flags_ready = -1;
156 static int hf_rtcfg_client_flags_res = -1;
157 static int hf_rtcfg_server_flags = -1;
158 static int hf_rtcfg_server_flags_res0 = -1;
159 static int hf_rtcfg_server_flags_ready = -1;
160 static int hf_rtcfg_server_flags_res2 = -1;
161 static int hf_rtcfg_active_stations = -1;
162 static int hf_rtcfg_heartbeat_period = -1;
163 static int hf_rtcfg_s2_config_length = -1;
164 static int hf_rtcfg_config_offset = -1;
165 static int hf_rtcfg_ack_length = -1;
166 static int hf_rtcfg_client_hw_address = -1;
169 /* TDMA-V1 */
170 static int hf_tdma_v1_msg = -1;
172 /* TDMA REQUEST_CONF */
173 static int hf_tdma_v1_msg_request_conf_station = -1;
174 static int hf_tdma_v1_msg_request_conf_padding = -1;
175 static int hf_tdma_v1_msg_request_conf_mtu = -1;
176 static int hf_tdma_v1_msg_request_conf_cycle = -1;
178 /* TDMA ACK_CONF */
179 static int hf_tdma_v1_msg_ack_conf_station = -1;
180 static int hf_tdma_v1_msg_ack_conf_padding = -1;
181 static int hf_tdma_v1_msg_ack_conf_mtu = -1;
182 static int hf_tdma_v1_msg_ack_conf_cycle = -1;
184 /* TDMA ACK_ACK_CONF */
185 static int hf_tdma_v1_msg_ack_ack_conf_station = -1;
186 static int hf_tdma_v1_msg_ack_ack_conf_padding = -1;
188 /* TDMA REQUEST_TEST */
189 static int hf_tdma_v1_msg_request_test_counter = -1;
190 static int hf_tdma_v1_msg_request_test_tx = -1;
192 /* TDMA ACK_TEST */
193 static int hf_tdma_v1_msg_ack_test_counter = -1;
194 static int hf_tdma_v1_msg_ack_test_tx = -1;
196 /* TDMA STATION_LIST */
197 static int hf_tdma_v1_msg_station_list_nr_stations = -1;
198 static int hf_tdma_v1_msg_station_list_padding = -1;
200 static int hf_tdma_v1_msg_station_list_ip = -1;
201 static int hf_tdma_v1_msg_station_list_nr = -1;
203 /* TDMA CHANGE_OFFSET */
204 static int hf_tdma_v1_msg_request_change_offset_offset = -1;
206 /* TDMA START_OF_FRAME */
207 static int hf_tdma_v1_msg_start_of_frame_timestamp = -1;
210 /* TDMA since version 2 */
211 static int hf_tdma_ver = -1;
212 static int hf_tdma_id = -1;
214 /* TDMA Sync */
215 static int hf_tdma_sync_cycle = -1;
216 static int hf_tdma_sync_xmit_stamp = -1;
217 static int hf_tdma_sync_sched_xmit = -1;
219 /* TDMA Request Calibration */
220 static int hf_tdma_req_cal_xmit_stamp = -1;
221 static int hf_tdma_req_cal_rpl_cycle = -1;
222 static int hf_tdma_req_cal_rpl_slot = -1;
224 /* TDMA Reply Calibration */
225 static int hf_tdma_rpl_cal_req_stamp = -1;
226 static int hf_tdma_rpl_cal_rcv_stamp = -1;
227 static int hf_tdma_rpl_cal_xmit_stamp = -1;
230 /* Define the tree for rtnet */
231 static int ett_rtmac = -1;
232 static int ett_rtmac_flags = -1;
233 static int ett_tdma = -1;
234 static int ett_rtcfg = -1;
236 static guint
237 dissect_rtnet_tdma_notify_master(tvbuff_t *tvb _U_, guint offset, proto_tree *tree _U_)
239 return offset;
242 static guint
243 dissect_rtnet_tdma_request_test(tvbuff_t *tvb, guint offset, proto_tree *tree)
245 proto_tree_add_item(tree, hf_tdma_v1_msg_request_test_counter, tvb,
246 offset, 4, ENC_LITTLE_ENDIAN );
247 offset += 4;
249 proto_tree_add_item(tree, hf_tdma_v1_msg_request_test_tx, tvb,
250 offset, 8, ENC_LITTLE_ENDIAN );
251 offset += 8;
253 return offset;
256 static guint
257 dissect_rtnet_tdma_ack_test(tvbuff_t *tvb, guint offset, proto_tree *tree)
259 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_test_counter, tvb,
260 offset, 4, ENC_LITTLE_ENDIAN );
261 offset += 4;
263 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_test_tx, tvb,
264 offset, 8, ENC_LITTLE_ENDIAN );
265 offset += 8;
267 return offset;
270 static guint
271 dissect_rtnet_tdma_request_conf(tvbuff_t *tvb, guint offset, proto_tree *tree)
273 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_station, tvb,
274 offset, 1, ENC_BIG_ENDIAN );
275 offset += 1;
277 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_padding, tvb,
278 offset, 1, ENC_BIG_ENDIAN );
279 offset += 1;
281 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_mtu, tvb,
282 offset, 2, ENC_BIG_ENDIAN );
283 offset += 2;
285 proto_tree_add_item(tree, hf_tdma_v1_msg_request_conf_cycle, tvb,
286 offset, 4, ENC_BIG_ENDIAN );
287 offset += 4;
289 return offset;
293 static guint
294 dissect_rtnet_tdma_ack_conf(tvbuff_t *tvb, guint offset, proto_tree *tree)
296 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_station, tvb,
297 offset, 1, ENC_BIG_ENDIAN );
298 offset += 1;
300 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_padding, tvb,
301 offset, 1, ENC_BIG_ENDIAN );
302 offset += 1;
304 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_mtu, tvb,
305 offset, 2, ENC_BIG_ENDIAN );
306 offset += 2;
308 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_conf_cycle, tvb,
309 offset, 4, ENC_BIG_ENDIAN );
310 offset += 4;
312 return offset;
315 static guint
316 dissect_rtnet_tdma_ack_ack_conf(tvbuff_t *tvb, guint offset, proto_tree *tree) {
318 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_ack_conf_station, tvb,
319 offset, 1, ENC_BIG_ENDIAN );
321 offset += 1;
323 proto_tree_add_item(tree, hf_tdma_v1_msg_ack_ack_conf_padding, tvb,
324 offset, 3, ENC_NA );
325 offset += 3;
327 return offset;
330 static guint
331 dissect_rtnet_tdma_station_list(tvbuff_t *tvb, guint offset, proto_tree *tree)
333 guint8 nr_stations;
334 guint8 i;
336 nr_stations = tvb_get_guint8(tvb, offset);
337 proto_tree_add_uint(tree, hf_tdma_v1_msg_station_list_nr_stations, tvb,
338 offset, 1, nr_stations);
340 offset += 1;
342 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_padding, tvb,
343 offset, 3, ENC_NA );
344 offset += 3;
347 for( i = 0; i < nr_stations; i++ )
349 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_ip, tvb,
350 offset, 4, ENC_BIG_ENDIAN );
352 offset += 4;
354 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_nr, tvb,
355 offset, 1, ENC_BIG_ENDIAN );
357 offset += 1;
359 proto_tree_add_item(tree, hf_tdma_v1_msg_station_list_padding, tvb,
360 offset, 3, ENC_NA );
361 offset += 3;
364 return offset;
367 static guint
368 dissect_rtnet_tdma_request_change_offset(tvbuff_t *tvb, guint offset, proto_tree *tree)
370 proto_tree_add_item(tree, hf_tdma_v1_msg_request_change_offset_offset, tvb,
371 offset, 4, ENC_BIG_ENDIAN );
373 offset += 4;
375 return offset;
378 static guint
379 dissect_rtnet_tdma_start_of_frame(tvbuff_t *tvb, guint offset, proto_tree *tree)
381 proto_tree_add_item(tree, hf_tdma_v1_msg_start_of_frame_timestamp, tvb,
382 offset, 8, ENC_BIG_ENDIAN );
383 offset += 8;
385 return offset;
388 static void
389 dissect_rtnet_tdma_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) {
390 guint offset = 0;
391 guint32 msg;
392 proto_tree *tree;
393 proto_item *ti;
395 msg = tvb_get_ntohl(tvb, offset);
397 /* Set the protocol column */
398 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA-V1");
400 /* set the info column */
401 col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
402 val_to_str(msg, tdma_v1_msg_vals, "Unknown (0x%04x)"));
404 if (root) {
405 ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA);
406 tree = proto_item_add_subtree(ti, ett_tdma);
408 proto_item_append_text(ti, ", Version 1, %s",
409 val_to_str(msg, tdma_v1_msg_vals, "Unknown (0x%04x)"));
411 proto_tree_add_item(tree, hf_tdma_v1_msg, tvb,
412 offset, 4, ENC_BIG_ENDIAN);
413 offset += 4;
415 switch( msg ) {
416 case TDMA_V1_MSG_NOTIFY_MASTER:
417 dissect_rtnet_tdma_notify_master(tvb, offset, tree);
418 break;
420 case TDMA_V1_MSG_REQUEST_TEST:
421 dissect_rtnet_tdma_request_test(tvb, offset, tree);
422 break;
424 case TDMA_V1_MSG_ACK_TEST:
425 dissect_rtnet_tdma_ack_test(tvb, offset, tree);
426 break;
428 case TDMA_V1_MSG_REQUEST_CONF:
429 dissect_rtnet_tdma_request_conf(tvb, offset, tree);
430 break;
432 case TDMA_V1_MSG_ACK_CONF:
433 dissect_rtnet_tdma_ack_conf(tvb, offset, tree);
434 break;
436 case TDMA_V1_MSG_ACK_ACK_CONF:
437 dissect_rtnet_tdma_ack_ack_conf(tvb, offset, tree);
438 break;
440 case TDMA_V1_MSG_STATION_LIST:
441 dissect_rtnet_tdma_station_list (tvb, offset, tree);
442 break;
444 case TDMA_V1_MSG_REQUEST_CHANGE_OFFSET:
445 dissect_rtnet_tdma_request_change_offset(tvb, offset, tree);
446 break;
448 case TDMA_V1_MSG_START_OF_FRAME:
449 dissect_rtnet_tdma_start_of_frame(tvb, offset, tree);
450 break;
452 default:
453 break;
458 static void
459 dissect_tdma_sync(tvbuff_t *tvb, guint offset, proto_tree *tree) {
460 gint64 timestamp;
461 proto_item *ti;
463 proto_tree_add_item(tree, hf_tdma_sync_cycle, tvb, offset, 4, ENC_BIG_ENDIAN);
464 offset += 4;
466 ti = proto_tree_add_item(tree, hf_tdma_sync_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
467 timestamp = tvb_get_ntoh64(tvb, offset) - tvb_get_ntoh64(tvb, offset+8);
468 proto_item_append_text(ti, " (%s%" G_GINT64_MODIFIER "d)", (timestamp > 0) ? "+" : "", timestamp);
469 offset += 8;
471 proto_tree_add_item(tree, hf_tdma_sync_sched_xmit, tvb, offset, 8, ENC_BIG_ENDIAN);
474 static void
475 dissect_tdma_request_cal(tvbuff_t *tvb, guint offset, proto_tree *tree) {
477 proto_tree_add_item(tree, hf_tdma_req_cal_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
478 offset += 8;
480 proto_tree_add_item(tree, hf_tdma_req_cal_rpl_cycle, tvb, offset, 4, ENC_BIG_ENDIAN);
481 offset += 4;
483 proto_tree_add_item(tree, hf_tdma_req_cal_rpl_slot, tvb, offset, 8, ENC_BIG_ENDIAN);
486 static void
487 dissect_tdma_reply_cal(tvbuff_t *tvb, guint offset, proto_tree *tree) {
488 gint64 timestamp;
489 proto_item *ti;
491 proto_tree_add_item(tree, hf_tdma_rpl_cal_req_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
492 offset += 8;
494 proto_tree_add_item(tree, hf_tdma_rpl_cal_rcv_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
496 timestamp = tvb_get_ntoh64(tvb, offset+8) - tvb_get_ntoh64(tvb, offset);
497 offset += 8;
499 ti = proto_tree_add_item(tree, hf_tdma_rpl_cal_xmit_stamp, tvb, offset, 8, ENC_BIG_ENDIAN);
500 proto_item_append_text(ti, " (%s%" G_GINT64_MODIFIER "d)", (timestamp > 0) ? "+" : "", timestamp);
503 static void
504 dissect_rtnet_tdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) {
505 guint offset = 0;
506 guint16 msg;
507 proto_item *ti;
508 proto_tree *tree;
510 msg = tvb_get_ntohs(tvb, 2);
512 /* Set the protocol column */
513 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA");
515 /* Set the info column */
516 col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
517 val_to_str(msg, tdma_msg_vals, "Unknown (0x%04x)"));
519 if (root) {
520 ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA);
521 tree = proto_item_add_subtree(ti, ett_tdma);
523 proto_item_append_text(ti, ", %s", val_to_str(msg, tdma_msg_vals, "Unknown (0x%04x)"));
525 proto_tree_add_item(tree, hf_tdma_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
526 offset += 2;
528 proto_tree_add_item(tree, hf_tdma_id, tvb, offset, 2, ENC_BIG_ENDIAN);
529 offset += 2;
531 switch (msg) {
532 case TDMA_MSG_SYNC:
533 dissect_tdma_sync(tvb, offset, tree);
534 break;
536 case TDMA_MSG_CAL_REQUEST:
537 dissect_tdma_request_cal(tvb, offset, tree);
538 break;
540 case TDMA_MSG_CAL_REPLY:
541 dissect_tdma_reply_cal(tvb, offset, tree);
542 break;
544 default:
545 break;
550 static void
551 dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
552 gint offset = 0;
553 guint8 ver,flags;
554 guint16 type;
555 tvbuff_t *next_tvb;
556 proto_tree *ti=NULL, *rtmac_tree=NULL;
557 proto_item *item;
558 dissector_handle_t dissector=NULL;
559 const gchar *type_str=NULL;
561 /* Read the header */
562 type = tvb_get_ntohs(tvb, offset);
563 ver = tvb_get_guint8(tvb, offset+2);
564 flags = tvb_get_guint8(tvb, offset+3);
566 if (ver == 1) {
567 type_str = try_val_to_str(type, rtmac_type_vals);
568 if (!type_str) {
569 dissector = dissector_get_uint_handle(ethertype_table, type);
571 } else {
572 if (flags & RTMAC_FLAG_TUNNEL) {
573 dissector = dissector_get_uint_handle(ethertype_table, type);
576 if (!dissector)
577 dissector = data_handle;
579 if (tree) {
580 ti = proto_tree_add_item(tree, proto_rtmac, tvb, offset, 4, ENC_NA);
581 rtmac_tree = proto_item_add_subtree(ti, ett_rtmac);
582 proto_item_append_text(ti, ", Version %d", ver);
585 /* Set the protocol column */
586 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTmac");
588 /* set the info column */
589 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown (0x%04x)",type);
591 if (rtmac_tree) {
592 if (ver == 1) {
593 if (!type_str) {
594 if (dissector != data_handle)
595 type_str = dissector_handle_get_short_name(dissector);
596 else
597 type_str = "Unknown";
599 } else {
600 if (!(flags & RTMAC_FLAG_TUNNEL))
601 type_str = val_to_str_const(type, rtmac_type_vals, "Unknown");
602 else {
603 if (dissector != data_handle)
604 type_str = dissector_handle_get_short_name(dissector);
605 else
606 type_str = "Unknown";
609 proto_tree_add_string_format_value(rtmac_tree, hf_rtmac_header_type, tvb, offset, 2,
610 type_str, "%s (0x%04x)", type_str, type);
611 offset += 2;
613 proto_tree_add_item(rtmac_tree, hf_rtmac_header_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
614 offset += 1;
616 if (ver == 1)
617 proto_tree_add_item(rtmac_tree, hf_rtmac_header_res_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
618 else {
619 item = proto_tree_add_item(rtmac_tree, hf_rtmac_header_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
620 ti = proto_item_add_subtree(item, ett_rtmac_flags);
621 proto_tree_add_item(ti, hf_rtmac_header_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
622 proto_tree_add_item(ti, hf_rtmac_header_flags_tunnel, tvb, offset, 1, ENC_BIG_ENDIAN);
624 offset += 1;
626 else
627 offset += 4;
629 next_tvb = tvb_new_subset_remaining(tvb, offset);
631 if (ver == 1)
632 switch (type) {
633 case RTMAC_TYPE_TDMA_V1:
634 dissect_rtnet_tdma_v1(next_tvb, pinfo, tree);
635 break;
637 default:
638 call_dissector(dissector, next_tvb, pinfo, tree);
639 break;
641 else
642 if (flags & RTMAC_FLAG_TUNNEL)
643 call_dissector(dissector, next_tvb, pinfo, tree);
644 else
645 switch (type) {
646 case RTMAC_TYPE_TDMA:
647 dissect_rtnet_tdma(next_tvb, pinfo, tree);
648 break;
650 default:
651 call_dissector(data_handle, next_tvb, pinfo, tree);
652 break;
656 static void
657 dissect_rtcfg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
658 gint offset = 0;
659 proto_tree *vers_id_tree, *vers_id_item, *flags_tree, *flags_item;
660 guint8 vers_id;
661 guint8 addr_type;
662 guint32 config_length,len;
663 proto_tree *ti=NULL,*rtcfg_tree=NULL;
665 /* Set the protocol column */
666 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTcfg");
668 /* Clear out stuff in the info column */
669 col_clear(pinfo->cinfo, COL_INFO);
671 if (tree) {
672 ti = proto_tree_add_item(tree, proto_rtcfg, tvb, offset, -1, ENC_NA);
673 rtcfg_tree = proto_item_add_subtree(ti, ett_rtcfg);
676 vers_id = tvb_get_guint8(tvb, offset);
678 col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
679 val_to_str(vers_id, rtcfg_msg_vals, "Unknown (0x%04x)"));
681 if( rtcfg_tree )
683 vers_id_item = proto_tree_add_uint(rtcfg_tree, hf_rtcfg_vers_id, tvb,
684 offset, 1, vers_id);
686 vers_id_tree=proto_item_add_subtree(vers_id_item, ett_rtcfg);
687 proto_tree_add_item(vers_id_tree, hf_rtcfg_vers, tvb, offset, 1, ENC_BIG_ENDIAN);
688 proto_tree_add_item(vers_id_tree, hf_rtcfg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
689 offset += 1;
691 proto_item_append_text(ti, ", Version %d, %s",
692 (vers_id >> 5),
693 val_to_str(vers_id, rtcfg_msg_vals, "Unknown (0x%04x)"));
695 switch( vers_id & 0x1f )
697 case RTCFG_MSG_S1_CONFIG:
698 addr_type = tvb_get_guint8(tvb, offset);
699 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
700 offset += 1;
702 switch( addr_type )
704 case RTCFG_ADDRESS_TYPE_MAC:
705 /* nothing */
706 break;
708 case RTCFG_ADDRESS_TYPE_IP:
709 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
710 offset += 4;
712 proto_tree_add_item( rtcfg_tree, hf_rtcfg_server_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
713 offset += 4;
715 break;
718 proto_tree_add_item( rtcfg_tree, hf_rtcfg_burst_rate, tvb, offset, 1, ENC_BIG_ENDIAN );
719 offset += 1;
721 config_length = tvb_get_ntohs( tvb, offset );
722 proto_tree_add_item( rtcfg_tree, hf_rtcfg_s1_config_length, tvb, offset, 2, ENC_BIG_ENDIAN );
723 offset += 2;
725 if( config_length > 0 ) {
726 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, config_length, ENC_NA );
727 /*offset += config_length;*/
730 break;
732 case RTCFG_MSG_ANN_NEW:
733 addr_type = tvb_get_guint8(tvb, offset);
734 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
735 offset += 1;
737 switch( addr_type )
739 case RTCFG_ADDRESS_TYPE_MAC:
740 /* nothing */
741 break;
743 case RTCFG_ADDRESS_TYPE_IP:
744 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
745 offset += 4;
746 break;
749 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_client_flags, tvb,
750 offset, 1, ENC_BIG_ENDIAN);
752 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
753 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_available, tvb, offset, 1, ENC_BIG_ENDIAN);
754 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
755 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
756 offset += 1;
758 proto_tree_add_item( rtcfg_tree, hf_rtcfg_burst_rate, tvb, offset, 1, ENC_BIG_ENDIAN );
759 /*offset += 1;*/
761 break;
763 case RTCFG_MSG_ANN_REPLY:
764 addr_type = tvb_get_guint8(tvb, offset);
765 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
766 offset += 1;
768 switch( addr_type )
770 case RTCFG_ADDRESS_TYPE_MAC:
771 /* nothing */
772 break;
774 case RTCFG_ADDRESS_TYPE_IP:
775 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
776 offset += 4;
777 break;
780 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_client_flags, tvb,
781 offset, 1, ENC_BIG_ENDIAN);
783 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
784 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_available, tvb, offset, 1, ENC_BIG_ENDIAN);
785 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
786 proto_tree_add_item(flags_tree, hf_rtcfg_client_flags_res, tvb, offset, 1, ENC_BIG_ENDIAN);
787 offset += 1;
789 proto_tree_add_item( rtcfg_tree, hf_rtcfg_padding, tvb, offset, 1, ENC_BIG_ENDIAN );
790 /*offset += 1;*/
792 break;
794 case RTCFG_MSG_S2_CONFIG:
795 flags_item = proto_tree_add_item(rtcfg_tree, hf_rtcfg_server_flags, tvb,
796 offset, 1, ENC_BIG_ENDIAN);
798 flags_tree=proto_item_add_subtree(flags_item, ett_rtcfg);
799 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_res0, tvb, offset, 1, ENC_BIG_ENDIAN);
800 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_ready, tvb, offset, 1, ENC_BIG_ENDIAN);
801 proto_tree_add_item(flags_tree, hf_rtcfg_server_flags_res2, tvb, offset, 1, ENC_BIG_ENDIAN);
802 offset += 1;
804 proto_tree_add_item( rtcfg_tree, hf_rtcfg_active_stations, tvb, offset, 4, ENC_BIG_ENDIAN );
805 offset += 4;
807 proto_tree_add_item( rtcfg_tree, hf_rtcfg_heartbeat_period, tvb, offset, 2, ENC_BIG_ENDIAN );
808 offset += 2;
810 config_length = tvb_get_ntohl( tvb, offset );
811 proto_tree_add_item( rtcfg_tree, hf_rtcfg_s2_config_length, tvb, offset, 4, ENC_BIG_ENDIAN );
812 offset += 4;
814 if( config_length > 0 ) {
815 len = tvb_reported_length_remaining(tvb, offset);
816 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, len, ENC_NA );
817 /*offset += len;*/
820 break;
822 case RTCFG_MSG_S2_FRAG:
823 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_offset, tvb, offset, 4, ENC_BIG_ENDIAN );
824 offset += 4;
826 len = tvb_reported_length_remaining(tvb, offset);
827 proto_tree_add_item( rtcfg_tree, hf_rtcfg_config_data, tvb, offset, len, ENC_NA );
828 /*offset += len;*/
829 break;
831 case RTCFG_MSG_ACK:
832 proto_tree_add_item( rtcfg_tree, hf_rtcfg_ack_length, tvb, offset, 4, ENC_BIG_ENDIAN );
833 /*offset += 4;*/
835 break;
837 case RTCFG_MSG_READY:
838 break;
840 case RTCFG_MSG_HBEAT:
841 break;
843 case RTCFG_MSG_DEAD_STN:
844 addr_type = tvb_get_guint8(tvb, offset);
845 proto_tree_add_item( rtcfg_tree, hf_rtcfg_address_type, tvb, offset, 1, ENC_BIG_ENDIAN );
846 offset += 1;
848 switch( addr_type )
850 case RTCFG_ADDRESS_TYPE_MAC:
851 /* nothing */
852 break;
854 case RTCFG_ADDRESS_TYPE_IP:
855 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_ip_address, tvb, offset, 4, ENC_BIG_ENDIAN );
856 offset += 4;
857 break;
860 switch (pinfo->fd->lnk_t) {
861 case WTAP_ENCAP_ETHERNET:
862 proto_tree_add_bytes_format_value( rtcfg_tree, hf_rtcfg_client_hw_address, tvb, offset, 32,
863 NULL, "%s",
864 tvb_ether_to_str(tvb, offset));
865 break;
867 default:
868 proto_tree_add_item( rtcfg_tree, hf_rtcfg_client_hw_address, tvb, offset, 32, ENC_NA );
869 break;
871 /*offset += 32;*/
873 break;
879 void
880 proto_register_rtmac(void) {
881 static hf_register_info hf_array_rtmac[] = {
883 /* RTmac header */
884 { &hf_rtmac_header_type,
885 { "Type",
886 "rtmac.header.type",
887 FT_STRING, BASE_NONE, NULL, 0x0,
888 "RTmac Type", HFILL }},
890 { &hf_rtmac_header_ver,
891 { "Version",
892 "rtmac.header.ver",
893 FT_UINT16, BASE_DEC, NULL, 0x0,
894 "RTmac Version", HFILL }},
896 { &hf_rtmac_header_flags,
897 { "Flags",
898 "rtmac.header.flags",
899 FT_UINT8, BASE_HEX, NULL, 0x0,
900 "RTmac Flags", HFILL }},
902 { &hf_rtmac_header_flags_tunnel,
903 { "Tunnelling Flag",
904 "rtmac.header.flags.tunnel",
905 FT_BOOLEAN, 8, TFS(&tfs_set_notset), RTMAC_FLAG_TUNNEL,
906 "RTmac Tunnelling Flag", HFILL }},
908 { &hf_rtmac_header_flags_res,
909 { "Reserved Flags",
910 "rtmac.header.flags.res",
911 FT_UINT8, BASE_HEX, NULL, RTMAC_FLAGS_RES,
912 "RTmac Reserved Flags", HFILL }},
914 { &hf_rtmac_header_res_v1,
915 { "Reserved",
916 "rtmac.header.res",
917 FT_UINT8, BASE_HEX, NULL, 0x0,
918 "RTmac Reserved", HFILL }},
921 static hf_register_info hf_array_tdma[] = {
923 /* TDMA msg */
924 { &hf_tdma_v1_msg,
925 { "Message",
926 "tdma-v1.msg",
927 FT_UINT32, BASE_HEX, VALS(tdma_v1_msg_vals), 0x0,
928 "TDMA-V1 Message", HFILL }},
930 /* TDMA request conf */
932 { &hf_tdma_v1_msg_request_conf_station,
933 { "Station",
934 "tdma-v1.msg.request_conf.station",
935 FT_UINT8, BASE_DEC, NULL, 0x0,
936 "TDMA Station", HFILL }},
938 { &hf_tdma_v1_msg_request_conf_padding,
939 { "Padding",
940 "tdma-v1.msg.request_conf.padding",
941 FT_UINT8, BASE_HEX, NULL, 0x0,
942 "TDMA Padding", HFILL }},
944 { &hf_tdma_v1_msg_request_conf_mtu,
945 { "MTU",
946 "tdma-v1.msg.request_conf.mtu",
947 FT_UINT8, BASE_DEC, NULL, 0x0,
948 "TDMA MTU", HFILL }},
950 { &hf_tdma_v1_msg_request_conf_cycle,
951 { "Cycle",
952 "tdma-v1.msg.request_conf.cycle",
953 FT_UINT8, BASE_DEC, NULL, 0x0,
954 "TDMA Cycle", HFILL }},
956 /* TDMA ack conf */
958 { &hf_tdma_v1_msg_ack_conf_station,
959 { "Station",
960 "tdma-v1.msg.ack_conf.station",
961 FT_UINT8, BASE_DEC, NULL, 0x0,
962 "TDMA Station", HFILL }},
964 { &hf_tdma_v1_msg_ack_conf_padding,
965 { "Padding",
966 "tdma-v1.msg.ack_conf.padding",
967 FT_UINT8, BASE_HEX, NULL, 0x0,
968 "TDMA Padding", HFILL }},
970 { &hf_tdma_v1_msg_ack_conf_mtu,
971 { "MTU",
972 "tdma-v1.msg.ack_conf.mtu",
973 FT_UINT8, BASE_DEC, NULL, 0x0,
974 "TDMA MTU", HFILL }},
976 { &hf_tdma_v1_msg_ack_conf_cycle,
977 { "Cycle",
978 "tdma-v1.msg.ack_conf.cycle",
979 FT_UINT8, BASE_DEC, NULL, 0x0,
980 "TDMA Cycle", HFILL }},
982 /* TDMA ack ack conf */
984 { &hf_tdma_v1_msg_ack_ack_conf_station,
985 { "Station",
986 "tdma-v1.msg.ack_ack_conf.station",
987 FT_UINT8, BASE_DEC, NULL, 0x0,
988 "TDMA Station", HFILL }},
990 { &hf_tdma_v1_msg_ack_ack_conf_padding,
991 { "Padding",
992 "tdma-v1.msg.ack_ack_conf.padding",
993 FT_BYTES, BASE_NONE, NULL, 0x0,
994 "TDMA Padding", HFILL }},
996 /* TDMA request test */
998 { &hf_tdma_v1_msg_request_test_counter,
999 { "Counter",
1000 "tdma-v1.msg.request_test.counter",
1001 FT_UINT32, BASE_DEC, NULL, 0x0,
1002 "TDMA Counter", HFILL }},
1004 { &hf_tdma_v1_msg_request_test_tx,
1005 { "TX",
1006 "tdma-v1.msg.request_test.tx",
1007 FT_UINT64, BASE_DEC, NULL, 0x0,
1008 "TDMA TX", HFILL }},
1010 /* TDMA ack test */
1012 { &hf_tdma_v1_msg_ack_test_counter,
1013 { "Counter",
1014 "tdma-v1.msg.ack_test.counter",
1015 FT_UINT32, BASE_DEC, NULL, 0x0,
1016 "TDMA Counter", HFILL }},
1018 { &hf_tdma_v1_msg_ack_test_tx,
1019 { "TX",
1020 "tdma-v1.msg.ack_test.tx",
1021 FT_UINT64, BASE_DEC, NULL, 0x0,
1022 "TDMA TX", HFILL }},
1024 /* TDMA ack test */
1026 { &hf_tdma_v1_msg_request_change_offset_offset,
1027 { "Offset",
1028 "tdma-v1.msg.request_change_offset.offset",
1029 FT_UINT32, BASE_DEC, NULL, 0x0,
1030 "TDMA Offset", HFILL }},
1032 /* TDMA start of frame */
1035 { &hf_tdma_v1_msg_start_of_frame_timestamp,
1036 { "Timestamp",
1037 "tdma-v1.msg.start_of_frame.timestamp",
1038 FT_UINT64, BASE_DEC, NULL, 0x0,
1039 "TDMA Timestamp", HFILL }},
1041 /* TDMA station list */
1043 { &hf_tdma_v1_msg_station_list_nr_stations,
1044 { "Nr. Stations",
1045 "tdma-v1.msg.station_list.nr_stations",
1046 FT_UINT8, BASE_DEC, NULL, 0x0,
1047 "TDMA Nr. Stations", HFILL }},
1049 { &hf_tdma_v1_msg_station_list_nr,
1050 { "Nr.",
1051 "tdma-v1.msg.station_list.nr",
1052 FT_UINT8, BASE_DEC, NULL, 0x0,
1053 "TDMA Station Number", HFILL }},
1055 { &hf_tdma_v1_msg_station_list_ip,
1056 { "IP",
1057 "tdma-v1.msg.station_list.ip",
1058 FT_IPv4, BASE_NONE, NULL, 0x0,
1059 "TDMA Station IP", HFILL }},
1061 { &hf_tdma_v1_msg_station_list_padding,
1062 { "Padding",
1063 "tdma-v1.msg.station_list.padding",
1064 FT_BYTES, BASE_NONE, NULL, 0x0,
1065 "TDMA Padding", HFILL }},
1068 /* TDMA since version 2 */
1070 { &hf_tdma_ver,
1071 { "Version",
1072 "tdma.ver",
1073 FT_UINT16, BASE_HEX, NULL, 0x0,
1074 "TDMA Version", HFILL }},
1076 { &hf_tdma_id,
1077 { "Message ID",
1078 "tdma.id",
1079 FT_UINT16, BASE_HEX, VALS(tdma_msg_vals), 0x0,
1080 "TDMA Message ID", HFILL }},
1082 /* TDMA sync */
1084 { &hf_tdma_sync_cycle,
1085 { "Cycle Number",
1086 "tdma.sync.cycle",
1087 FT_UINT32, BASE_DEC, NULL, 0x0,
1088 "TDMA Sync Cycle Number", HFILL }},
1090 { &hf_tdma_sync_xmit_stamp,
1091 { "Transmission Time Stamp",
1092 "tdma.sync.xmit_stamp",
1093 FT_UINT64, BASE_DEC, NULL, 0x0,
1094 "TDMA Sync Transmission Time Stamp", HFILL }},
1096 { &hf_tdma_sync_sched_xmit,
1097 { "Scheduled Transmission Time",
1098 "tdma.sync.sched_xmit",
1099 FT_UINT64, BASE_DEC, NULL, 0x0,
1100 "TDMA Sync Scheduled Transmission Time", HFILL }},
1102 /* TDMA request calibration */
1104 { &hf_tdma_req_cal_xmit_stamp,
1105 { "Transmission Time Stamp",
1106 "tdma.req_cal.xmit_stamp",
1107 FT_UINT64, BASE_DEC, NULL, 0x0,
1108 "TDMA Request Calibration Transmission Time Stamp", HFILL }},
1110 { &hf_tdma_req_cal_rpl_cycle,
1111 { "Reply Cycle Number",
1112 "tdma.req_cal.rpl_cycle",
1113 FT_UINT32, BASE_DEC, NULL, 0x0,
1114 "TDMA Request Calibration Reply Cycle Number", HFILL }},
1116 { &hf_tdma_req_cal_rpl_slot,
1117 { "Reply Slot Offset",
1118 "tdma.req_cal.rpl_slot",
1119 FT_UINT64, BASE_DEC, NULL, 0x0,
1120 "TDMA Request Calibration Reply Slot Offset", HFILL }},
1122 /* TDMA reply calibration */
1124 { &hf_tdma_rpl_cal_req_stamp,
1125 { "Request Transmission Time",
1126 "tdma.rpl_cal.req_stamp",
1127 FT_UINT64, BASE_DEC, NULL, 0x0,
1128 "TDMA Reply Calibration Request Transmission Time", HFILL }},
1130 { &hf_tdma_rpl_cal_rcv_stamp,
1131 { "Reception Time Stamp",
1132 "tdma.rpl_cal.rcv_stamp",
1133 FT_UINT64, BASE_DEC, NULL, 0x0,
1134 "TDMA Reply Calibration Reception Time Stamp", HFILL }},
1136 { &hf_tdma_rpl_cal_xmit_stamp,
1137 { "Transmission Time Stamp",
1138 "tdma.rpl_cal.xmit_stamp",
1139 FT_UINT64, BASE_DEC, NULL, 0x0,
1140 "TDMA Reply Calibration Transmission Time Stamp", HFILL }},
1143 static gint *ett_array_rtmac[] = {
1144 &ett_rtmac,
1145 &ett_rtmac_flags,
1148 static gint *ett_array_tdma[] = {
1149 &ett_tdma,
1152 proto_rtmac = proto_register_protocol("Real-Time Media Access Control", "RTmac", "rtmac");
1153 proto_register_field_array(proto_rtmac, hf_array_rtmac, array_length(hf_array_rtmac));
1154 proto_register_subtree_array(ett_array_rtmac, array_length(ett_array_rtmac));
1156 proto_tdma = proto_register_protocol("TDMA RTmac Discipline", "TDMA", "tdma");
1157 proto_register_field_array(proto_rtmac, hf_array_tdma, array_length(hf_array_tdma));
1158 proto_register_subtree_array(ett_array_tdma, array_length(ett_array_tdma));
1162 void
1163 proto_register_rtcfg(void) {
1164 static hf_register_info hf[] = {
1165 { &hf_rtcfg_vers_id,
1166 { "Version and ID",
1167 "rtcfg.vers_id",
1168 FT_UINT8, BASE_HEX, NULL, 0x0,
1169 "RTcfg Version and ID", HFILL }},
1171 { &hf_rtcfg_vers,
1172 { "Version",
1173 "rtcfg.vers",
1174 FT_UINT8, BASE_DEC, NULL, 0xe0,
1175 "RTcfg Version", HFILL }},
1177 { &hf_rtcfg_id,
1178 { "ID",
1179 "rtcfg.id",
1180 FT_UINT8, BASE_HEX, VALS(rtcfg_msg_vals), 0x1f,
1181 "RTcfg ID", HFILL }},
1183 { &hf_rtcfg_address_type,
1184 { "Address Type",
1185 "rtcfg.address_type",
1186 FT_UINT8, BASE_DEC, VALS(rtcfg_address_type_vals), 0x00,
1187 "RTcfg Address Type", HFILL }},
1189 { &hf_rtcfg_client_ip_address,
1190 { "Client IP Address",
1191 "rtcfg.client_ip_address",
1192 FT_IPv4, BASE_NONE, NULL, 0x0,
1193 "RTcfg Client IP Address", HFILL }},
1195 { &hf_rtcfg_server_ip_address,
1196 { "Server IP Address",
1197 "rtcfg.server_ip_address",
1198 FT_IPv4, BASE_NONE, NULL, 0x0,
1199 "RTcfg Server IP Address", HFILL }},
1201 { &hf_rtcfg_burst_rate,
1202 { "Stage 2 Burst Rate",
1203 "rtcfg.burst_rate",
1204 FT_UINT8, BASE_DEC, NULL, 0x00,
1205 "RTcfg Stage 2 Burst Rate", HFILL }},
1207 { &hf_rtcfg_s1_config_length,
1208 { "Stage 1 Config Length",
1209 "rtcfg.s1_config_length",
1210 FT_UINT16, BASE_DEC, NULL, 0x00,
1211 "RTcfg Stage 1 Config Length", HFILL }},
1213 { &hf_rtcfg_config_data,
1214 { "Config Data",
1215 "rtcfg.config_data",
1216 FT_BYTES, BASE_NONE, NULL, 0x00,
1217 "RTcfg Config Data", HFILL }},
1219 { &hf_rtcfg_padding,
1220 { "Padding",
1221 "rtcfg.padding",
1222 FT_UINT8, BASE_DEC, NULL, 0x00,
1223 "RTcfg Padding", HFILL }},
1225 { &hf_rtcfg_client_flags,
1226 { "Flags",
1227 "rtcfg.client_flags",
1228 FT_UINT8, BASE_HEX, NULL, 0x00,
1229 "RTcfg Client Flags", HFILL }},
1231 { &hf_rtcfg_client_flags_available,
1232 { "Req. Available",
1233 "rtcfg.client_flags.available",
1234 FT_UINT8, BASE_DEC, NULL, 0x01,
1235 "Request Available", HFILL }},
1237 { &hf_rtcfg_client_flags_ready,
1238 { "Client Ready",
1239 "rtcfg.client_flags.ready",
1240 FT_UINT8, BASE_DEC, NULL, 0x02,
1241 NULL, HFILL }},
1243 { &hf_rtcfg_client_flags_res,
1244 { "Reserved",
1245 "rtcfg.client_flags.res",
1246 FT_UINT8, BASE_HEX, NULL, 0xfc,
1247 NULL, HFILL }},
1249 { &hf_rtcfg_server_flags,
1250 { "Flags",
1251 "rtcfg.server_flags",
1252 FT_UINT8, BASE_HEX, NULL, 0x00,
1253 "RTcfg Server Flags", HFILL }},
1255 { &hf_rtcfg_server_flags_res0,
1256 { "Reserved",
1257 "rtcfg.server_flags.res0",
1258 FT_UINT8, BASE_HEX, NULL, 0x01,
1259 NULL, HFILL }},
1261 { &hf_rtcfg_server_flags_ready,
1262 { "Server Ready",
1263 "rtcfg.server_flags.ready",
1264 FT_UINT8, BASE_DEC, NULL, 0x02,
1265 NULL, HFILL }},
1267 { &hf_rtcfg_server_flags_res2,
1268 { "Reserved",
1269 "rtcfg.server_flags.res2",
1270 FT_UINT8, BASE_HEX, NULL, 0xfc,
1271 NULL, HFILL }},
1273 { &hf_rtcfg_active_stations,
1274 { "Active Stations",
1275 "rtcfg.active_stations",
1276 FT_UINT32, BASE_DEC, NULL, 0x00,
1277 "RTcfg Active Stations", HFILL }},
1279 { &hf_rtcfg_heartbeat_period,
1280 { "Heartbeat Period",
1281 "rtcfg.hearbeat_period",
1282 FT_UINT16, BASE_DEC, NULL, 0x00,
1283 "RTcfg Heartbeat Period", HFILL }},
1285 { &hf_rtcfg_s2_config_length,
1286 { "Stage 2 Config Length",
1287 "rtcfg.s2_config_length",
1288 FT_UINT32, BASE_DEC, NULL, 0x00,
1289 "RTcfg Stage 2 Config Length", HFILL }},
1291 { &hf_rtcfg_config_offset,
1292 { "Config Offset",
1293 "rtcfg.config_offset",
1294 FT_UINT32, BASE_DEC, NULL, 0x00,
1295 "RTcfg Config Offset", HFILL }},
1297 { &hf_rtcfg_ack_length,
1298 { "Ack Length",
1299 "rtcfg.ack_length",
1300 FT_UINT32, BASE_DEC, NULL, 0x00,
1301 "RTcfg Ack Length", HFILL }},
1303 { &hf_rtcfg_client_hw_address,
1304 { "Client Hardware Address",
1305 "rtcfg.client_ip_address",
1306 FT_BYTES, BASE_NONE, NULL, 0x00,
1307 "RTcfg Client Hardware Address", HFILL }}
1310 static gint *ett[] = {
1311 &ett_rtcfg,
1314 proto_rtcfg = proto_register_protocol("RTcfg","RTcfg","rtcfg");
1315 proto_register_field_array(proto_rtcfg,hf,array_length(hf));
1316 proto_register_subtree_array(ett,array_length(ett));
1319 /* The registration hand-off routing */
1321 void
1322 proto_reg_handoff_rtmac(void) {
1323 dissector_handle_t rtmac_handle;
1325 rtmac_handle = create_dissector_handle(dissect_rtmac, proto_rtmac);
1326 dissector_add_uint("ethertype", ETHERTYPE_RTMAC, rtmac_handle);
1327 ethertype_table = find_dissector_table("ethertype");
1330 void
1331 proto_reg_handoff_rtcfg(void) {
1332 dissector_handle_t rtcfg_handle;
1334 data_handle = find_dissector("data");
1335 rtcfg_handle = create_dissector_handle(dissect_rtcfg, proto_rtcfg);
1336 dissector_add_uint("ethertype", ETHERTYPE_RTCFG, rtcfg_handle);