PROFINET: AdjustMAUType-Extension and CheckMAUTypeExtension
[metze/wireshark/wip.git] / plugins / profinet / packet-dcerpc-pn-io.c
1 /* packet-dcerpc-pn-io.c
2  * Routines for PROFINET IO dissection.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 /*
24  * The PN-IO protocol is a field bus protocol related to decentralized
25  * periphery and is developed by the PROFIBUS Nutzerorganisation e.V. (PNO),
26  * see: www.profibus.com
27  *
28  *
29  * PN-IO is based on the common DCE-RPC and the "lightweight" PN-RT
30  * (ethernet type 0x8892) protocols.
31  *
32  * The context manager (CM) part is handling context information
33  * (like establishing, ...) and is using DCE-RPC as its underlying
34  * protocol.
35  *
36  * The actual cyclic data transfer and acyclic notification uses the
37  * "lightweight" PN-RT protocol.
38  *
39  * There are some other related PROFINET protocols (e.g. PN-DCP, which is
40  * handling addressing topics).
41  *
42  * Please note: the PROFINET CBA protocol is independent of the PN-IO protocol!
43  */
44
45 /*
46  * Cyclic PNIO RTC1 Data Dissection:
47  *
48  * To dissect cyclic PNIO RTC1 frames, this plug-in has to collect important module
49  * information out of "Ident OK", "Connect Request" and "Write Response"
50  * frames first. This information will be used within "packet-pn-rtc-one.c" to
51  * dissect PNIO and PROFIsafe RTC1 frames.
52  *
53  * The data of Stationname-, -type and -id will be gained out of
54  * packet-pn-dcp.c. The header packet-pn.h will save those data.
55  *
56  * Overview for cyclic PNIO RTC1 data dissection functions:
57  *   -> dissect_IOCRBlockReq_block     (Save amount of IODataObjects, IOCS)
58  *   -> dissect_DataDescription        (Save important values for cyclic data)
59  *   -> dissect_ExpectedSubmoduleBlockReq_block    (Get GSD information)
60  *   -> dissect_ModuleDiffBlock_block  (Module has different ID)
61  *   -> dissect_ProfiSafeParameterRequest  (Save PROFIsafe parameters)
62  *   -> dissect_RecordDataWrite        (Call ProfiSafeParameterRequest)
63  *   -> pnio_rtc1_cleanup              (Reset routine of saved RTC1 information)
64  */
65
66
67 #include "config.h"
68
69 #include <string.h>
70 #include <glib.h>
71
72 #include <epan/packet.h>
73 #include <epan/to_str.h>
74 #include <epan/wmem/wmem.h>
75 #include <epan/dissectors/packet-dcerpc.h>
76 #include <epan/expert.h>
77 #include <epan/dissector_filters.h>
78 #include <epan/proto_data.h>
79
80 #include <wsutil/file_util.h>
81 #include <epan/prefs.h>
82
83 #include "packet-pn.h"
84
85 #include <stdio.h>
86 #include <stdlib.h>
87
88 void proto_register_pn_io(void);
89 void proto_reg_handoff_pn_io(void);
90
91
92 #define MAX_NAMELENGTH           200    /* max. length of the given paths */
93 #define F_MESSAGE_TRAILER_4BYTE  4      /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte */
94 #define PN_INPUT_CR              1      /* PROFINET Input Connect Request value */
95 #define PN_INPUT_DATADESCRITPION 1      /* PROFINET Input Data Description value */
96
97
98 static int proto_pn_io = -1;
99 static int proto_pn_io_device = -1;
100 static int proto_pn_io_controller = -1;
101 static int proto_pn_io_supervisor = -1;
102 static int proto_pn_io_parameterserver = -1;
103 static int proto_pn_io_implicitar = -1;
104 int proto_pn_io_apdu_status = -1;
105
106 static int hf_pn_io_opnum = -1;
107 static int hf_pn_io_reserved16 = -1;
108
109 static int hf_pn_io_array = -1;
110 static int hf_pn_io_status = -1;
111 static int hf_pn_io_args_max = -1;
112 static int hf_pn_io_args_len = -1;
113 static int hf_pn_io_array_max_count = -1;
114 static int hf_pn_io_array_offset = -1;
115 static int hf_pn_io_array_act_count = -1;
116
117 static int hf_pn_io_ar_type = -1;
118 static int hf_pn_io_artype_req = -1;
119 static int hf_pn_io_cminitiator_macadd = -1;
120 static int hf_pn_io_cminitiator_objectuuid = -1;
121 static int hf_pn_io_parameter_server_objectuuid = -1;
122 static int hf_pn_io_ar_data = -1;
123 static int hf_pn_io_ar_properties = -1;
124 static int hf_pn_io_ar_properties_state = -1;
125 static int hf_pn_io_ar_properties_supervisor_takeover_allowed = -1;
126 static int hf_pn_io_ar_properties_parametrization_server = -1;
127 /* removed within 2.3
128 static int hf_pn_io_ar_properties_data_rate = -1;
129 */
130 static int hf_pn_io_ar_properties_reserved_1 = -1;
131 static int hf_pn_io_ar_properties_device_access = -1;
132 static int hf_pn_io_ar_properties_companion_ar = -1;
133 static int hf_pn_io_ar_properties_achnowledge_companion_ar = -1;
134 static int hf_pn_io_ar_properties_reserved = -1;
135 static int hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode = -1;
136 static int hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode = -1;
137 static int hf_pn_io_ar_properties_pull_module_alarm_allowed = -1;
138
139 static int hf_pn_RedundancyInfo = -1;
140 static int hf_pn_RedundancyInfo_reserved = -1;
141 static int hf_pn_io_number_of_ARDATAInfo = -1;
142
143 static int hf_pn_io_cminitiator_activitytimeoutfactor = -1;
144 static int hf_pn_io_cminitiator_udprtport = -1;
145 static int hf_pn_io_station_name_length = -1;
146 static int hf_pn_io_cminitiator_station_name = -1;
147 /* static int hf_pn_io_responder_station_name = -1; */
148 static int hf_pn_io_arproperties_StartupMode = -1;
149
150 static int hf_pn_io_parameter_server_station_name = -1;
151
152 static int hf_pn_io_cmresponder_macadd = -1;
153 static int hf_pn_io_cmresponder_udprtport = -1;
154
155 static int hf_pn_io_number_of_iocrs = -1;
156 static int hf_pn_io_iocr_tree = -1;
157 static int hf_pn_io_iocr_type = -1;
158 static int hf_pn_io_iocr_reference = -1;
159 static int hf_pn_io_iocr_SubframeOffset = -1;
160 static int hf_pn_io_iocr_SubframeData =-1;
161 /* static int hf_pn_io_iocr_txports_port = -1; */
162 /* static int hf_pn_io_iocr_txports_redundantport = -1; */
163 static int hf_pn_io_sr_properties_Reserved_1 = -1;
164 static int hf_pn_io_sr_properties_Mode = -1;
165 static int hf_pn_io_sr_properties_Reserved_2 = -1;
166 static int hf_pn_io_sr_properties_Reserved_3 = -1;
167 static int hf_pn_io_RedundancyDataHoldFactor = -1;
168 static int hf_pn_io_sr_properties = -1;
169 static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0 = -1;
170 static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1 = -1;
171
172 static int hf_pn_io_arvendor_strucidentifier_if0_low = -1;
173 static int hf_pn_io_arvendor_strucidentifier_if0_high = -1;
174 static int hf_pn_io_arvendor_strucidentifier_if0_is8000= -1;
175 static int hf_pn_io_arvendor_strucidentifier_not0 = -1;
176
177 static int hf_pn_io_lt = -1;
178 static int hf_pn_io_iocr_properties = -1;
179 static int hf_pn_io_iocr_properties_rtclass = -1;
180 static int hf_pn_io_iocr_properties_reserved_1 = -1;
181 static int hf_pn_io_iocr_properties_media_redundancy = -1;
182 static int hf_pn_io_iocr_properties_reserved_2 = -1;
183 static int hf_pn_io_iocr_properties_reserved_3 = -1;
184 static int hf_pn_io_iocr_properties_fast_forwarding_mac_adr = -1;
185 static int hf_pn_io_iocr_properties_distributed_subframe_watchdog = -1;
186 static int hf_pn_io_iocr_properties_full_subframe_structure = -1;
187
188
189 static int hf_pn_io_data_length = -1;
190 static int hf_pn_io_ir_frame_data = -1;
191 static int hf_pn_io_frame_id = -1;
192 static int hf_pn_io_send_clock_factor = -1;
193 static int hf_pn_io_reduction_ratio = -1;
194 static int hf_pn_io_phase = -1;
195 static int hf_pn_io_sequence = -1;
196 static int hf_pn_io_frame_send_offset = -1;
197 static int hf_pn_io_frame_data_properties = -1;
198 static int hf_pn_io_frame_data_properties_forwarding_Mode = -1;
199 static int hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd = -1;
200 static int hf_pn_io_frame_data_properties_FragmentMode = -1;
201 static int hf_pn_io_frame_data_properties_reserved_1 = -1;
202 static int hf_pn_io_frame_data_properties_reserved_2 = -1;
203 static int hf_pn_io_watchdog_factor = -1;
204 static int hf_pn_io_data_hold_factor = -1;
205 static int hf_pn_io_iocr_tag_header = -1;
206 static int hf_pn_io_iocr_multicast_mac_add = -1;
207 static int hf_pn_io_number_of_apis = -1;
208 static int hf_pn_io_number_of_io_data_objects = -1;
209 static int hf_pn_io_io_data_object_frame_offset = -1;
210 static int hf_pn_io_number_of_iocs = -1;
211 static int hf_pn_io_iocs_frame_offset = -1;
212
213 static int hf_pn_io_SFIOCRProperties = -1;
214 static int hf_pn_io_DistributedWatchDogFactor = -1;
215 static int hf_pn_io_RestartFactorForDistributedWD = -1;
216 static int hf_pn_io_SFIOCRProperties_DFPmode = -1;
217 static int hf_pn_io_SFIOCRProperties_reserved_1 = -1;
218 static int hf_pn_io_SFIOCRProperties_reserved_2 = -1;
219 static int hf_pn_io_SFIOCRProperties_DFPType =-1;
220 static int hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout = -1;
221 static int hf_pn_io_SFIOCRProperties_SFCRC16 = -1;
222
223 static int hf_pn_io_subframe_data = -1;
224 static int hf_pn_io_subframe_data_reserved1 = -1;
225 static int hf_pn_io_subframe_data_reserved2 = -1;
226
227 static int hf_pn_io_subframe_data_position = -1;
228 static int hf_pn_io_subframe_reserved1 = -1;
229 static int hf_pn_io_subframe_data_length = -1;
230 static int hf_pn_io_subframe_reserved2 = -1;
231
232 static int hf_pn_io_alarmcr_type = -1;
233 static int hf_pn_io_alarmcr_properties = -1;
234 static int hf_pn_io_alarmcr_properties_priority = -1;
235 static int hf_pn_io_alarmcr_properties_transport = -1;
236 static int hf_pn_io_alarmcr_properties_reserved = -1;
237
238 static int hf_pn_io_rta_timeoutfactor = -1;
239 static int hf_pn_io_rta_retries = -1;
240 static int hf_pn_io_localalarmref = -1;
241 static int hf_pn_io_remotealarmref = -1;
242 static int hf_pn_io_maxalarmdatalength = -1;
243 static int hf_pn_io_alarmcr_tagheaderhigh = -1;
244 static int hf_pn_io_alarmcr_tagheaderlow = -1;
245
246 static int hf_pn_io_IRData_uuid = -1;
247 static int hf_pn_io_ar_uuid = -1;
248 static int hf_pn_io_target_ar_uuid = -1;
249 static int hf_pn_io_ar_discriminator = -1;
250 static int hf_pn_io_ar_configid = -1;
251 static int hf_pn_io_ar_arnumber = -1;
252 static int hf_pn_io_ar_arresource = -1;
253 static int hf_pn_io_ar_arreserved = -1;
254 static int hf_pn_io_ar_selector = -1;
255 static int hf_pn_io_api_tree = -1;
256 static int hf_pn_io_module_tree = -1;
257 static int hf_pn_io_submodule_tree = -1;
258 static int hf_pn_io_io_data_object = -1;
259 /* General module information */
260 static int hf_pn_io_io_cs = -1;
261
262 static int hf_pn_io_substitutionmode = -1;
263
264 static int hf_pn_io_api = -1;
265 static int hf_pn_io_slot_nr = -1;
266 static int hf_pn_io_subslot_nr = -1;
267 static int hf_pn_io_index = -1;
268 static int hf_pn_io_seq_number = -1;
269 static int hf_pn_io_record_data_length = -1;
270 static int hf_pn_io_add_val1 = -1;
271 static int hf_pn_io_add_val2 = -1;
272
273 static int hf_pn_io_block = -1;
274 static int hf_pn_io_block_header = -1;
275 static int hf_pn_io_block_type = -1;
276 static int hf_pn_io_block_length = -1;
277 static int hf_pn_io_block_version_high = -1;
278 static int hf_pn_io_block_version_low = -1;
279
280 static int hf_pn_io_sessionkey = -1;
281 static int hf_pn_io_control_command = -1;
282 static int hf_pn_io_control_command_prmend = -1;
283 static int hf_pn_io_control_command_applready = -1;
284 static int hf_pn_io_control_command_release = -1;
285 static int hf_pn_io_control_command_done = -1;
286 static int hf_pn_io_control_command_ready_for_companion = -1;
287 static int hf_pn_io_control_command_ready_for_rt_class3 = -1;
288 static int hf_pn_io_control_command_prmbegin = -1;
289 static int hf_pn_io_control_command_reserved_7_15 = -1;
290 static int hf_pn_io_control_block_properties = -1;
291 static int hf_pn_io_control_block_properties_applready = -1;
292 static int hf_pn_io_control_block_properties_applready0 = -1;
293
294 /* static int hf_pn_io_AlarmSequenceNumber = -1; */
295 static int hf_pn_io_control_command_reserved = -1;
296 static int hf_pn_io_SubmoduleListEntries = -1;
297 static int hf_pn_io_error_code = -1;
298 static int hf_pn_io_error_decode = -1;
299 static int hf_pn_io_error_code1 = -1;
300 static int hf_pn_io_error_code1_pniorw = -1;
301 static int hf_pn_io_error_code1_pnio = -1;
302 static int hf_pn_io_error_code2 = -1;
303 static int hf_pn_io_error_code2_pniorw = -1;
304 static int hf_pn_io_error_code2_pnio_1 = -1;
305 static int hf_pn_io_error_code2_pnio_2 = -1;
306 static int hf_pn_io_error_code2_pnio_3 = -1;
307 static int hf_pn_io_error_code2_pnio_4 = -1;
308 static int hf_pn_io_error_code2_pnio_5 = -1;
309 static int hf_pn_io_error_code2_pnio_6 = -1;
310 static int hf_pn_io_error_code2_pnio_7 = -1;
311 static int hf_pn_io_error_code2_pnio_8 = -1;
312 static int hf_pn_io_error_code2_pnio_13 = -1;
313 static int hf_pn_io_error_code2_pnio_20 = -1;
314 static int hf_pn_io_error_code2_pnio_21 = -1;
315 static int hf_pn_io_error_code2_pnio_22 = -1;
316 static int hf_pn_io_error_code2_pnio_23 = -1;
317 static int hf_pn_io_error_code2_pnio_40 = -1;
318 static int hf_pn_io_error_code2_pnio_60 = -1;
319 static int hf_pn_io_error_code2_pnio_61 = -1;
320 static int hf_pn_io_error_code2_pnio_62 = -1;
321 static int hf_pn_io_error_code2_pnio_63 = -1;
322 static int hf_pn_io_error_code2_pnio_64 = -1;
323 static int hf_pn_io_error_code2_pnio_65 = -1;
324 static int hf_pn_io_error_code2_pnio_66 = -1;
325 static int hf_pn_io_error_code2_pnio_70 = -1;
326 static int hf_pn_io_error_code2_pnio_71 = -1;
327 static int hf_pn_io_error_code2_pnio_72 = -1;
328 static int hf_pn_io_error_code2_pnio_73 = -1;
329 static int hf_pn_io_error_code2_pnio_74 = -1;
330 static int hf_pn_io_error_code2_pnio_75 = -1;
331 static int hf_pn_io_error_code2_pnio_76 = -1;
332 static int hf_pn_io_error_code2_pnio_77 = -1;
333 static int hf_pn_io_error_code2_pnio_253 = -1;
334 static int hf_pn_io_error_code2_pnio_255 = -1;
335
336 static int hf_pn_io_alarm_type = -1;
337 static int hf_pn_io_alarm_specifier = -1;
338 static int hf_pn_io_alarm_specifier_sequence = -1;
339 static int hf_pn_io_alarm_specifier_channel = -1;
340 static int hf_pn_io_alarm_specifier_manufacturer = -1;
341 static int hf_pn_io_alarm_specifier_submodule = -1;
342 static int hf_pn_io_alarm_specifier_ardiagnosis = -1;
343
344 static int hf_pn_io_alarm_dst_endpoint = -1;
345 static int hf_pn_io_alarm_src_endpoint = -1;
346 static int hf_pn_io_pdu_type = -1;
347 static int hf_pn_io_pdu_type_type = -1;
348 static int hf_pn_io_pdu_type_version = -1;
349 static int hf_pn_io_add_flags = -1;
350 static int hf_pn_io_window_size = -1;
351 static int hf_pn_io_tack = -1;
352 static int hf_pn_io_send_seq_num = -1;
353 static int hf_pn_io_ack_seq_num = -1;
354 static int hf_pn_io_var_part_len = -1;
355
356 static int hf_pn_io_number_of_modules = -1;
357 static int hf_pn_io_module_ident_number = -1;
358 static int hf_pn_io_module_properties = -1;
359 static int hf_pn_io_module_state = -1;
360 static int hf_pn_io_number_of_submodules = -1;
361 static int hf_pn_io_submodule_ident_number = -1;
362 static int hf_pn_io_submodule_properties = -1;
363 static int hf_pn_io_submodule_properties_type = -1;
364 static int hf_pn_io_submodule_properties_shared_input = -1;
365 static int hf_pn_io_submodule_properties_reduce_input_submodule_data_length = -1;
366 static int hf_pn_io_submodule_properties_reduce_output_submodule_data_length = -1;
367 static int hf_pn_io_submodule_properties_discard_ioxs = -1;
368 static int hf_pn_io_submodule_properties_reserved = -1;
369
370 static int hf_pn_io_submodule_state = -1;
371 static int hf_pn_io_submodule_state_format_indicator = -1;
372 static int hf_pn_io_submodule_state_add_info = -1;
373 static int hf_pn_io_submodule_state_qualified_info = -1;
374 static int hf_pn_io_submodule_state_maintenance_required = -1;
375 static int hf_pn_io_submodule_state_maintenance_demanded = -1;
376 static int hf_pn_io_submodule_state_diag_info = -1;
377 static int hf_pn_io_submodule_state_ar_info = -1;
378 static int hf_pn_io_submodule_state_ident_info = -1;
379 static int hf_pn_io_submodule_state_detail = -1;
380
381 static int hf_pn_io_data_description_tree = -1;
382 static int hf_pn_io_data_description = -1;
383 static int hf_pn_io_submodule_data_length = -1;
384 static int hf_pn_io_length_iocs = -1;
385 static int hf_pn_io_length_iops = -1;
386
387 static int hf_pn_io_iocs = -1;
388 static int hf_pn_io_iops = -1;
389 static int hf_pn_io_ioxs_extension = -1;
390 static int hf_pn_io_ioxs_res14 = -1;
391 static int hf_pn_io_ioxs_instance = -1;
392 static int hf_pn_io_ioxs_datastate = -1;
393
394 static int hf_pn_io_address_resolution_properties = -1;
395 static int hf_pn_io_mci_timeout_factor = -1;
396 static int hf_pn_io_provider_station_name = -1;
397
398 static int hf_pn_io_user_structure_identifier = -1;
399 static int hf_pn_io_user_structure_identifier_manf = -1;
400
401 static int hf_pn_io_channel_number = -1;
402 static int hf_pn_io_channel_properties = -1;
403 static int hf_pn_io_channel_properties_type = -1;
404 static int hf_pn_io_channel_properties_accumulative = -1;
405 static int hf_pn_io_channel_properties_maintenance = -1;
406
407
408 static int hf_pn_io_NumberOfSubframeBlocks = -1;
409 static int hf_pn_io_channel_properties_specifier = -1;
410 static int hf_pn_io_channel_properties_direction = -1;
411
412 static int hf_pn_io_channel_error_type = -1;
413 static int hf_pn_io_ext_channel_error_type0 = -1;
414 static int hf_pn_io_ext_channel_error_type0x8000 = -1;
415 static int hf_pn_io_ext_channel_error_type0x8001 = -1;
416 static int hf_pn_io_ext_channel_error_type0x8002 = -1;
417 static int hf_pn_io_ext_channel_error_type0x8003 = -1;
418 static int hf_pn_io_ext_channel_error_type0x8004 = -1;
419 static int hf_pn_io_ext_channel_error_type0x8005 = -1;
420 static int hf_pn_io_ext_channel_error_type0x8007 = -1;
421 static int hf_pn_io_ext_channel_error_type0x8008 = -1;
422 static int hf_pn_io_ext_channel_error_type0x800A = -1;
423 static int hf_pn_io_ext_channel_error_type0x800B = -1;
424 static int hf_pn_io_ext_channel_error_type0x800C = -1;
425
426 static int hf_pn_io_ext_channel_error_type = -1;
427
428 static int hf_pn_io_ext_channel_add_value = -1;
429
430 static int hf_pn_io_ptcp_subdomain_id = -1;
431 static int hf_pn_io_ir_data_id = -1;
432 static int hf_pn_io_max_bridge_delay = -1;
433 static int hf_pn_io_number_of_ports = -1;
434 static int hf_pn_io_max_port_tx_delay = -1;
435 static int hf_pn_io_max_port_rx_delay = -1;
436
437 static int hf_pn_io_max_line_rx_delay = -1;
438 static int hf_pn_io_yellowtime = -1;
439 static int hf_pn_io_reserved_interval_begin = -1;
440 static int hf_pn_io_reserved_interval_end = -1;
441 static int hf_pn_io_pllwindow = -1;
442 static int hf_pn_io_sync_send_factor = -1;
443 static int hf_pn_io_sync_properties = -1;
444 static int hf_pn_io_sync_frame_address = -1;
445 static int hf_pn_io_ptcp_timeout_factor = -1;
446 static int hf_pn_io_ptcp_takeover_timeout_factor = -1;
447 static int hf_pn_io_ptcp_master_startup_time = -1;
448 static int hf_pn_io_ptcp_master_priority_1 = -1;
449 static int hf_pn_io_ptcp_master_priority_2 = -1;
450 static int hf_pn_io_ptcp_length_subdomain_name = -1;
451 static int hf_pn_io_ptcp_subdomain_name = -1;
452
453 static int hf_pn_io_MultipleInterfaceMode_NameOfDevice = -1;
454 static int hf_pn_io_MultipleInterfaceMode_reserved_1 = -1;
455 static int hf_pn_io_MultipleInterfaceMode_reserved_2 = -1;
456 /* added Portstatistics */
457 static int hf_pn_io_pdportstatistic_counter_status = -1;
458 static int hf_pn_io_pdportstatistic_counter_status_ifInOctets = -1;
459 static int hf_pn_io_pdportstatistic_counter_status_ifOutOctets = -1;
460 static int hf_pn_io_pdportstatistic_counter_status_ifInDiscards = -1;
461 static int hf_pn_io_pdportstatistic_counter_status_ifOutDiscards = -1;
462 static int hf_pn_io_pdportstatistic_counter_status_ifInErrors = -1;
463 static int hf_pn_io_pdportstatistic_counter_status_ifOutErrors = -1;
464 static int hf_pn_io_pdportstatistic_counter_status_reserved = -1;
465 static int hf_pn_io_pdportstatistic_ifInOctets = -1;
466 static int hf_pn_io_pdportstatistic_ifOutOctets = -1;
467 static int hf_pn_io_pdportstatistic_ifInDiscards = -1;
468 static int hf_pn_io_pdportstatistic_ifOutDiscards = -1;
469 static int hf_pn_io_pdportstatistic_ifInErrors = -1;
470 static int hf_pn_io_pdportstatistic_ifOutErrors = -1;
471 /* end of port statistics */
472
473 static int hf_pn_io_domain_boundary = -1;
474 static int hf_pn_io_domain_boundary_ingress = -1;
475 static int hf_pn_io_domain_boundary_egress = -1;
476 static int hf_pn_io_multicast_boundary = -1;
477 static int hf_pn_io_adjust_properties = -1;
478 static int hf_pn_io_PreambleLength = -1;
479 static int hf_pn_io_mau_type = -1;
480 static int hf_pn_io_mau_type_mode = -1;
481 static int hf_pn_io_port_state = -1;
482 static int hf_pn_io_line_delay = -1;
483 static int hf_pn_io_line_delay_value = -1;
484 static int hf_pn_io_cable_delay_value = -1;
485 static int hf_pn_io_line_delay_format_indicator = -1;
486 static int hf_pn_io_number_of_peers = -1;
487 static int hf_pn_io_length_peer_port_id = -1;
488 static int hf_pn_io_peer_port_id = -1;
489 static int hf_pn_io_length_peer_chassis_id = -1;
490 static int hf_pn_io_peer_chassis_id = -1;
491 static int hf_pn_io_length_own_port_id = -1;
492 static int hf_pn_io_own_port_id = -1;
493 static int hf_pn_io_peer_macadd = -1;
494 static int hf_pn_io_media_type = -1;
495 static int hf_pn_io_macadd = -1;
496 static int hf_pn_io_length_own_chassis_id = -1;
497 static int hf_pn_io_own_chassis_id = -1;
498
499 static int hf_pn_io_ethertype = -1;
500 static int hf_pn_io_rx_port = -1;
501 static int hf_pn_io_frame_details = -1;
502 static int hf_pn_io_frame_details_sync_frame = -1;
503 static int hf_pn_io_frame_details_meaning_frame_send_offset = -1;
504 static int hf_pn_io_frame_details_reserved = -1;
505 static int hf_pn_io_nr_of_tx_port_groups = -1;
506 static int hf_pn_io_TxPortGroupProperties = -1;
507 static int hf_pn_io_TxPortGroupProperties_bit0 = -1;
508 static int hf_pn_io_TxPortGroupProperties_bit1 = -1;
509 static int hf_pn_io_TxPortGroupProperties_bit2 = -1;
510 static int hf_pn_io_TxPortGroupProperties_bit3 = -1;
511 static int hf_pn_io_TxPortGroupProperties_bit4 = -1;
512 static int hf_pn_io_TxPortGroupProperties_bit5 = -1;
513 static int hf_pn_io_TxPortGroupProperties_bit6 = -1;
514 static int hf_pn_io_TxPortGroupProperties_bit7 = -1;
515
516 static int hf_pn_io_start_of_red_frame_id = -1;
517 static int hf_pn_io_end_of_red_frame_id = -1;
518 static int hf_pn_io_ir_begin_end_port = -1;
519 static int hf_pn_io_number_of_assignments = -1;
520 static int hf_pn_io_number_of_phases = -1;
521 static int hf_pn_io_red_orange_period_begin_tx = -1;
522 static int hf_pn_io_orange_period_begin_tx = -1;
523 static int hf_pn_io_green_period_begin_tx = -1;
524 static int hf_pn_io_red_orange_period_begin_rx = -1;
525 static int hf_pn_io_orange_period_begin_rx = -1;
526 static int hf_pn_io_green_period_begin_rx = -1;
527 /* static int hf_pn_io_tx_phase_assignment = -1; */
528 static int hf_pn_ir_tx_phase_assignment = -1;
529 static int hf_pn_ir_rx_phase_assignment = -1;
530 static int hf_pn_io_tx_phase_assignment_begin_value = -1;
531 static int hf_pn_io_tx_phase_assignment_orange_begin = -1;
532 static int hf_pn_io_tx_phase_assignment_end_reserved = -1;
533 static int hf_pn_io_tx_phase_assignment_reserved = -1;
534 /* static int hf_pn_io_rx_phase_assignment = -1; */
535
536 static int hf_pn_io_slot = -1;
537 static int hf_pn_io_subslot = -1;
538 static int hf_pn_io_number_of_slots = -1;
539 static int hf_pn_io_number_of_subslots = -1;
540
541 /* static int hf_pn_io_maintenance_required_drop_budget = -1; */
542 /* static int hf_pn_io_maintenance_demanded_drop_budget = -1; */
543 /* static int hf_pn_io_error_drop_budget = -1; */
544
545 static int hf_pn_io_maintenance_required_power_budget = -1;
546 static int hf_pn_io_maintenance_demanded_power_budget = -1;
547 static int hf_pn_io_error_power_budget = -1;
548
549 static int hf_pn_io_fiber_optic_type = -1;
550 static int hf_pn_io_fiber_optic_cable_type = -1;
551
552 static int hf_pn_io_controller_appl_cycle_factor = -1;
553 static int hf_pn_io_time_data_cycle = -1;
554 static int hf_pn_io_time_io_input = -1;
555 static int hf_pn_io_time_io_output = -1;
556 static int hf_pn_io_time_io_input_valid = -1;
557 static int hf_pn_io_time_io_output_valid = -1;
558
559 static int hf_pn_io_maintenance_status = -1;
560 static int hf_pn_io_maintenance_status_required = -1;
561 static int hf_pn_io_maintenance_status_demanded = -1;
562
563 static int hf_pn_io_vendor_id_high = -1;
564 static int hf_pn_io_vendor_id_low = -1;
565 static int hf_pn_io_vendor_block_type = -1;
566 static int hf_pn_io_order_id = -1;
567 static int hf_pn_io_im_serial_number = -1;
568 static int hf_pn_io_im_hardware_revision = -1;
569 static int hf_pn_io_im_revision_prefix = -1;
570 static int hf_pn_io_im_sw_revision_functional_enhancement = -1;
571 static int hf_pn_io_im_revision_bugfix = -1;
572 static int hf_pn_io_im_sw_revision_internal_change = -1;
573 static int hf_pn_io_im_revision_counter = -1;
574 static int hf_pn_io_im_profile_id = -1;
575 static int hf_pn_io_im_profile_specific_type = -1;
576 static int hf_pn_io_im_version_major = -1;
577 static int hf_pn_io_im_version_minor = -1;
578 static int hf_pn_io_im_supported = -1;
579 static int hf_pn_io_im_numberofentries = -1;
580 static int hf_pn_io_im_annotation = -1;
581 static int hf_pn_io_im_order_id = -1;
582
583 static int hf_pn_io_number_of_ars = -1;
584
585 static int hf_pn_io_cycle_counter = -1;
586 static int hf_pn_io_data_status = -1;
587 static int hf_pn_io_data_status_res67 = -1;
588 static int hf_pn_io_data_status_ok = -1;
589 static int hf_pn_io_data_status_operate = -1;
590 static int hf_pn_io_data_status_res3 = -1;
591 static int hf_pn_io_data_status_valid = -1;
592 static int hf_pn_io_data_status_res1 = -1;
593 static int hf_pn_io_data_status_primary = -1;
594 static int hf_pn_io_transfer_status = -1;
595
596 static int hf_pn_io_actual_local_time_stamp = -1;
597 static int hf_pn_io_number_of_log_entries = -1;
598 static int hf_pn_io_local_time_stamp = -1;
599 static int hf_pn_io_entry_detail = -1;
600
601 static int hf_pn_io_ip_address = -1;
602 static int hf_pn_io_subnetmask = -1;
603 static int hf_pn_io_standard_gateway = -1;
604
605 static int hf_pn_io_mrp_domain_uuid = -1;
606 static int hf_pn_io_mrp_role = -1;
607 static int hf_pn_io_mrp_length_domain_name = -1;
608 static int hf_pn_io_mrp_domain_name = -1;
609 static int hf_pn_io_mrp_instances = -1;
610 static int hf_pn_io_mrp_instance = -1;
611
612 static int hf_pn_io_mrp_prio = -1;
613 static int hf_pn_io_mrp_topchgt = -1;
614 static int hf_pn_io_mrp_topnrmax = -1;
615 static int hf_pn_io_mrp_tstshortt = -1;
616 static int hf_pn_io_mrp_tstdefaultt = -1;
617 static int hf_pn_io_mrp_tstnrmax = -1;
618 static int hf_pn_io_mrp_check = -1;
619 static int hf_pn_io_mrp_check_mrm = -1;
620 static int hf_pn_io_mrp_check_mrpdomain = -1;
621 static int hf_pn_io_mrp_check_reserved_1 = -1;
622 static int hf_pn_io_mrp_check_reserved_2 = -1;
623
624 static int hf_pn_io_mrp_rtmode = -1;
625 static int hf_pn_io_mrp_rtmode_rtclass12 = -1;
626 static int hf_pn_io_mrp_rtmode_rtclass3 = -1;
627 static int hf_pn_io_mrp_rtmode_reserved1 = -1;
628 static int hf_pn_io_mrp_rtmode_reserved2 = -1;
629
630 static int hf_pn_io_mrp_lnkdownt = -1;
631 static int hf_pn_io_mrp_lnkupt = -1;
632 static int hf_pn_io_mrp_lnknrmax = -1;
633 static int hf_pn_io_mrp_version = -1;
634
635 static int hf_pn_io_substitute_active_flag = -1;
636 static int hf_pn_io_length_data = -1;
637
638 static int hf_pn_io_mrp_ring_state = -1;
639 static int hf_pn_io_mrp_rt_state = -1;
640
641 static int hf_pn_io_im_tag_function = -1;
642 static int hf_pn_io_im_tag_location = -1;
643 static int hf_pn_io_im_date = -1;
644 static int hf_pn_io_im_descriptor = -1;
645
646 static int hf_pn_io_fs_hello_mode = -1;
647 static int hf_pn_io_fs_hello_interval = -1;
648 static int hf_pn_io_fs_hello_retry = -1;
649 static int hf_pn_io_fs_hello_delay = -1;
650
651 static int hf_pn_io_fs_parameter_mode = -1;
652 static int hf_pn_io_fs_parameter_uuid = -1;
653
654
655 static int hf_pn_io_check_sync_mode = -1;
656 static int hf_pn_io_check_sync_mode_reserved = -1;
657 static int hf_pn_io_check_sync_mode_sync_master = -1;
658 static int hf_pn_io_check_sync_mode_cable_delay = -1;
659
660 /* PROFIsafe fParameters */
661 static int hf_pn_io_ps_f_prm_flag1 = -1;
662 static int hf_pn_io_ps_f_prm_flag1_chck_seq = -1;
663 static int hf_pn_io_ps_f_prm_flag1_chck_ipar = -1;
664 static int hf_pn_io_ps_f_prm_flag1_sil = -1;
665 static int hf_pn_io_ps_f_prm_flag1_crc_len = -1;
666 static int hf_pn_io_ps_f_prm_flag1_crc_seed = -1;
667 static int hf_pn_io_ps_f_prm_flag1_reserved = -1;
668 static int hf_pn_io_ps_f_prm_flag2 = -1;
669 static int hf_pn_io_ps_f_wd_time = -1;
670 static int hf_pn_io_ps_f_ipar_crc = -1;
671 static int hf_pn_io_ps_f_par_crc = -1;
672 static int hf_pn_io_ps_f_src_adr = -1;
673 static int hf_pn_io_ps_f_dest_adr = -1;
674 static int hf_pn_io_ps_f_prm_flag2_reserved = -1;
675 static int hf_pn_io_ps_f_prm_flag2_f_block_id = -1;
676 static int hf_pn_io_ps_f_prm_flag2_f_par_version = -1;
677
678 static int hf_pn_io_profidrive_request_reference = -1;
679 static int hf_pn_io_profidrive_request_id = -1;
680 static int hf_pn_io_profidrive_do_id = -1;
681 static int hf_pn_io_profidrive_no_of_parameters = -1;
682 static int hf_pn_io_profidrive_response_id = -1;
683 static int hf_pn_io_profidrive_param_attribute = -1;
684 static int hf_pn_io_profidrive_param_no_of_elems = -1;
685 static int hf_pn_io_profidrive_param_number = -1;
686 static int hf_pn_io_profidrive_param_subindex = -1;
687 static int hf_pn_io_profidrive_param_format = -1;
688 static int hf_pn_io_profidrive_param_no_of_values = -1;
689 static int hf_pn_io_profidrive_param_value_byte = -1;
690 static int hf_pn_io_profidrive_param_value_word = -1;
691 static int hf_pn_io_profidrive_param_value_dword = -1;
692 static int hf_pn_io_profidrive_param_value_float = -1;
693 static int hf_pn_io_profidrive_param_value_string = -1;
694
695 /* Sequence of Events - Reporting System Alarm/Event Information */
696 static int hf_pn_io_rs_alarm_info_reserved_0_7 = -1;
697 static int hf_pn_io_rs_alarm_info_reserved_8_15 = -1;
698 static int hf_pn_io_rs_alarm_info = -1;
699 static int hf_pn_io_rs_event_info = -1;
700 static int hf_pn_io_rs_event_block = -1;
701 static int hf_pn_io_rs_adjust_block = -1;
702 static int hf_pn_io_rs_event_data_extension = -1;
703 static int hf_pn_io_number_of_rs_event_info = -1;
704 static int hf_pn_io_rs_block_type = -1;
705 static int hf_pn_io_rs_block_length = -1;
706 static int hf_pn_io_rs_specifier = -1;
707 static int hf_pn_io_rs_specifier_sequence = -1;
708 static int hf_pn_io_rs_specifier_reserved = -1;
709 static int hf_pn_io_rs_specifier_specifier = -1;
710 static int hf_pn_io_rs_time_stamp = -1;
711 static int hf_pn_io_rs_time_stamp_status = -1;
712 static int hf_pn_io_rs_time_stamp_value = -1;
713 static int hf_pn_io_rs_minus_error = -1;
714 static int hf_pn_io_rs_plus_error = -1;
715 static int hf_pn_io_rs_extension_block_type = -1;
716 static int hf_pn_io_rs_extension_block_length = -1;
717 static int hf_pn_io_rs_reason_code = -1;
718 static int hf_pn_io_rs_reason_code_reason = -1;
719 static int hf_pn_io_rs_reason_code_detail = -1;
720 static int hf_pn_io_rs_domain_identification = -1;
721 static int hf_pn_io_rs_master_identification = -1;
722 static int hf_pn_io_soe_digital_input_current_value = -1;
723 static int hf_pn_io_soe_digital_input_current_value_value = -1;
724 static int hf_pn_io_soe_digital_input_current_value_reserved = -1;
725 static int hf_pn_io_am_device_identification = -1;
726 static int hf_pn_io_am_device_identification_device_sub_id = -1;
727 static int hf_pn_io_am_device_identification_device_id = -1;
728 static int hf_pn_io_am_device_identification_vendor_id = -1;
729 static int hf_pn_io_am_device_identification_organization = -1;
730 static int hf_pn_io_rs_adjust_info = -1;
731 static int hf_pn_io_soe_max_scan_delay = -1;
732 static int hf_pn_io_soe_adjust_specifier = -1;
733 static int hf_pn_io_soe_adjust_specifier_reserved = -1;
734 static int hf_pn_io_soe_adjust_specifier_incident = -1;
735 static int hf_pn_io_rs_properties = -1;
736 static int hf_pn_io_rs_properties_alarm_transport = -1;
737 static int hf_pn_io_rs_properties_reserved1 = -1;
738 static int hf_pn_io_rs_properties_reserved2 = -1;
739
740 static int hf_pn_io_asset_management_info = -1;
741 static int hf_pn_io_number_of_asset_management_info = -1;
742 static int hf_pn_io_im_uniqueidentifier = -1;
743 static int hf_pn_io_am_location_structure = -1;
744 static int hf_pn_io_am_location_level_0 = -1;
745 static int hf_pn_io_am_location_level_1 = -1;
746 static int hf_pn_io_am_location_level_2 = -1;
747 static int hf_pn_io_am_location_level_3 = -1;
748 static int hf_pn_io_am_location_level_4 = -1;
749 static int hf_pn_io_am_location_level_5 = -1;
750 static int hf_pn_io_am_location_level_6 = -1;
751 static int hf_pn_io_am_location_level_7 = -1;
752 static int hf_pn_io_am_location_level_8 = -1;
753 static int hf_pn_io_am_location_level_9 = -1;
754 static int hf_pn_io_am_location_level_10 = -1;
755 static int hf_pn_io_am_location_level_11 = -1;
756 static int hf_pn_io_am_location = -1;
757 static int hf_pn_io_am_location_reserved1 = -1;
758 static int hf_pn_io_am_location_reserved2 = -1;
759 static int hf_pn_io_am_location_reserved3 = -1;
760 static int hf_pn_io_am_location_reserved4 = -1;
761 static int hf_pn_io_am_software_revision = -1;
762 static int hf_pn_io_am_hardware_revision = -1;
763 static int hf_pn_io_am_type_identification = -1;
764
765 static int hf_pn_io_dcp_boundary_value = -1;
766 static int hf_pn_io_dcp_boundary_value_bit0 = -1;
767 static int hf_pn_io_dcp_boundary_value_bit1 = -1;
768 static int hf_pn_io_dcp_boundary_value_otherbits = -1;
769
770 static int hf_pn_io_peer_to_peer_boundary_value = -1;
771 static int hf_pn_io_peer_to_peer_boundary_value_bit0 = -1;
772 static int hf_pn_io_peer_to_peer_boundary_value_bit1 = -1;
773 static int hf_pn_io_peer_to_peer_boundary_value_bit2 = -1;
774 static int hf_pn_io_peer_to_peer_boundary_value_otherbits = -1;
775
776 static int hf_pn_io_mau_type_extension = -1;
777
778 /* static int hf_pn_io_packedframe_SFCRC = -1; */
779 static gint ett_pn_io = -1;
780 static gint ett_pn_io_block = -1;
781 static gint ett_pn_io_block_header = -1;
782 static gint ett_pn_io_status = -1;
783 static gint ett_pn_io_rtc = -1;
784 static gint ett_pn_io_rta = -1;
785 static gint ett_pn_io_pdu_type = -1;
786 static gint ett_pn_io_add_flags = -1;
787 static gint ett_pn_io_control_command = -1;
788 static gint ett_pn_io_ioxs = -1;
789 static gint ett_pn_io_api = -1;
790 static gint ett_pn_io_data_description = -1;
791 static gint ett_pn_io_module = -1;
792 static gint ett_pn_io_submodule = -1;
793 static gint ett_pn_io_io_data_object = -1;
794 static gint ett_pn_io_io_cs = -1;
795 static gint ett_pn_io_ar_properties = -1;
796 static gint ett_pn_io_iocr_properties = -1;
797 static gint ett_pn_io_submodule_properties = -1;
798 static gint ett_pn_io_alarmcr_properties = -1;
799 static gint ett_pn_io_submodule_state = -1;
800 static gint ett_pn_io_channel_properties = -1;
801 static gint ett_pn_io_slot = -1;
802 static gint ett_pn_io_subslot = -1;
803 static gint ett_pn_io_maintenance_status = -1;
804 static gint ett_pn_io_data_status = -1;
805 static gint ett_pn_io_iocr = -1;
806 static gint ett_pn_io_mrp_rtmode = -1;
807 static gint ett_pn_io_control_block_properties = -1;
808 static gint ett_pn_io_check_sync_mode = -1;
809 static gint ett_pn_io_ir_frame_data = -1;
810 static gint ett_pn_FrameDataProperties = -1;
811 static gint ett_pn_io_ar_info = -1;
812 static gint ett_pn_io_ar_data = -1;
813 static gint ett_pn_io_ir_begin_end_port = -1;
814 static gint ett_pn_io_ir_tx_phase = -1;
815 static gint ett_pn_io_ir_rx_phase = -1;
816 static gint ett_pn_io_subframe_data =-1;
817 static gint ett_pn_io_SFIOCRProperties = -1;
818 static gint ett_pn_io_frame_defails = -1;
819 static gint ett_pn_io_profisafe_f_parameter = -1;
820 static gint ett_pn_io_profisafe_f_parameter_prm_flag1 = -1;
821 static gint ett_pn_io_profisafe_f_parameter_prm_flag2 = -1;
822 static gint ett_pn_io_profidrive_parameter_request = -1;
823 static gint ett_pn_io_profidrive_parameter_response = -1;
824 static gint ett_pn_io_profidrive_parameter_address = -1;
825 static gint ett_pn_io_profidrive_parameter_value = -1;
826 static gint ett_pn_io_rs_alarm_info = -1;
827 static gint ett_pn_io_rs_event_info = -1;
828 static gint ett_pn_io_rs_event_block = -1;
829 static gint ett_pn_io_rs_adjust_block = -1;
830 static gint ett_pn_io_rs_event_data_extension = -1;
831 static gint ett_pn_io_rs_specifier = -1;
832 static gint ett_pn_io_rs_time_stamp = -1;
833 static gint ett_pn_io_am_device_identification = -1;
834 static gint ett_pn_io_rs_reason_code = -1;
835 static gint ett_pn_io_soe_digital_input_current_value = -1;
836 static gint ett_pn_io_rs_adjust_info = -1;
837 static gint ett_pn_io_soe_adjust_specifier = -1;
838 static gint ett_pn_io_sr_properties = -1;
839 static gint ett_pn_io_line_delay = -1;
840 static gint ett_pn_io_counter_status = -1;
841
842 static gint ett_pn_io_GroupProperties = -1;
843
844 static gint ett_pn_io_asset_management_info = -1;
845 static gint ett_pn_io_asset_management_block = -1;
846 static gint ett_pn_io_am_location = -1;
847
848 static gint ett_pn_io_dcp_boundary = -1;
849 static gint ett_pn_io_peer_to_peer_boundary = -1;
850
851 static gint ett_pn_io_mau_type_extension = -1;
852
853 #define PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH 4
854 #define PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH 2
855 #define PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH 4
856
857 static expert_field ei_pn_io_block_version = EI_INIT;
858 static expert_field ei_pn_io_block_length = EI_INIT;
859 static expert_field ei_pn_io_unsupported = EI_INIT;
860 static expert_field ei_pn_io_error_code1 = EI_INIT;
861 static expert_field ei_pn_io_localalarmref = EI_INIT;
862 static expert_field ei_pn_io_mrp_instances = EI_INIT;
863 static expert_field ei_pn_io_error_code2 = EI_INIT;
864 static expert_field ei_pn_io_ar_info_not_found = EI_INIT;
865 static expert_field ei_pn_io_iocr_type = EI_INIT;
866 static expert_field ei_pn_io_frame_id = EI_INIT;
867 static expert_field ei_pn_io_nr_of_tx_port_groups = EI_INIT;
868 static expert_field ei_pn_io_max_recursion_depth_reached = EI_INIT;
869
870 static e_guid_t uuid_pn_io_device = { 0xDEA00001, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
871 static guint16  ver_pn_io_device = 1;
872
873 static e_guid_t uuid_pn_io_controller = { 0xDEA00002, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
874 static guint16  ver_pn_io_controller = 1;
875
876 static e_guid_t uuid_pn_io_supervisor = { 0xDEA00003, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
877 static guint16  ver_pn_io_supervisor = 1;
878
879 static e_guid_t uuid_pn_io_parameterserver = { 0xDEA00004, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
880 static guint16  ver_pn_io_parameterserver = 1;
881
882 /* According to specification:
883  * Value(UUID): 00000000-0000-0000-0000-000000000000
884  * Meaning: Reserved
885  * Use: The value NIL indicates the usage of the implicit AR.
886  */
887 static e_guid_t uuid_pn_io_implicitar = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
888 static guint16  ver_pn_io_implicitar = 1;
889
890 /* PNIO Preference Variables */
891 gboolean           pnio_ps_selection = TRUE;
892 static const char *pnio_ps_networkpath = "";
893
894
895 /* Allow heuristic dissection */
896 static heur_dissector_list_t heur_pn_subdissector_list;
897
898 static const value_string pn_io_block_type[] = {
899     { 0x0000, "Reserved" },
900     { 0x0001, "Alarm Notification High"},
901     { 0x0002, "Alarm Notification Low"},
902     { 0x0008, "IODWriteReqHeader"},
903     { 0x8008, "IODWriteResHeader"},
904     { 0x0009, "IODReadReqHeader"},
905     { 0x8009, "IODReadResHeader"},
906     { 0x0010, "DiagnosisData"},
907     { 0x0011, "Reserved"},
908     { 0x0012, "ExpectedIdentificationData"},
909     { 0x0013, "RealIdentificationData"},
910     { 0x0014, "SubstituteValue"},
911     { 0x0015, "RecordInputDataObjectElement"},
912     { 0x0016, "RecordOutputDataObjectElement"},
913     { 0x0017, "reserved"},
914     { 0x0018, "ARData"},
915     { 0x0019, "LogData"},
916     { 0x001A, "APIData"},
917     { 0x001b, "SRLData"},
918     { 0x0020, "I&M0"},
919     { 0x0021, "I&M1"},
920     { 0x0022, "I&M2"},
921     { 0x0023, "I&M3"},
922     { 0x0024, "I&M4"},
923     { 0x0025, "I&M5"},
924     { 0x0026, "I&M6"},
925     { 0x0027, "I&M7"},
926     { 0x0028, "I&M8"},
927     { 0x0029, "I&M9"},
928     { 0x002A, "I&M10"},
929     { 0x002B, "I&M11"},
930     { 0x002C, "I&M12"},
931     { 0x002D, "I&M13"},
932     { 0x002E, "I&M14"},
933     { 0x002F, "I&M15"},
934     { 0x0030, "I&M0FilterDataSubmodul"},
935     { 0x0031, "I&M0FilterDataModul"},
936     { 0x0032, "I&M0FilterDataDevice"},
937     { 0x0033, "Reserved" },
938     { 0x0034, "I&M5Data"},
939     { 0x0035, "AssetManagementData"},
940     { 0x0036, "AM_FullInformation"},
941     { 0x0037, "AM_HardwareOnlyInformation"},
942     { 0x0038, "AM_FirmwareOnlyInformation" },
943     { 0x8001, "Alarm Ack High"},
944     { 0x8002, "Alarm Ack Low"},
945     { 0x0101, "ARBlockReq"},
946     { 0x8101, "ARBlockRes"},
947     { 0x0102, "IOCRBlockReq"},
948     { 0x8102, "IOCRBlockRes"},
949     { 0x0103, "AlarmCRBlockReq"},
950     { 0x8103, "AlarmCRBlockRes"},
951     { 0x0104, "ExpectedSubmoduleBlockReq"},
952     { 0x8104, "ModuleDiffBlock"},
953     { 0x0105, "PrmServerBlockReq"},
954     { 0x8105, "PrmServerBlockRes"},
955     { 0x0106, "MCRBlockReq"},
956     { 0x8106, "ARServerBlock"},
957     { 0x0107, "SubFrameBlock"},
958     { 0x0108, "ARVendorBlockReq"},
959     { 0x8108, "ARVendorBlockRes"},
960     { 0x0109, "IRInfoBlock"},
961     { 0x010A, "SRInfoBlock"},
962     { 0x010B, "ARFSUBlock"},
963     { 0x010C, "RSInfoBlock"},
964     { 0x0110, "IODControlReq Prm End.req"},
965     { 0x8110, "IODControlRes Prm End.rsp"},
966     { 0x0111, "IODControlReq Prm End.req"},
967     { 0x8111, "IODControlRes Prm End.rsp"},
968     { 0x0112, "IOXBlockReq Application Ready.req"},
969     { 0x8112, "IOXBlockRes Application Ready.rsp"},
970     { 0x0113, "IOXBlockReq Application Ready.req"},
971     { 0x8113, "IOXBlockRes Application Ready.rsp"},
972     { 0x0114, "IODReleaseReq"},
973     { 0x8114, "IODReleaseRes"},
974     { 0x0115, "ARRPCServerBlockReq"},
975     { 0x8115, "ARRPCServerBlockRes"},
976     { 0x0116, "IOXControlReq Ready for Companion.req"},
977     { 0x8116, "IOXControlRes Ready for Companion.rsp"},
978     { 0x0117, "IOXControlReq Ready for RT_CLASS_3.req"},
979     { 0x8117, "IOXControlRes Ready for RT_CLASS_3.rsp"},
980     { 0x0118, "ControlBlockPrmBegin"},
981     { 0x0119, "SubmoduleListBlock"},
982     { 0x8118, "ControlBlockPrmBeginRes"},
983
984     { 0x0200, "PDPortDataCheck"},
985     { 0x0201, "PDevData"},
986     { 0x0202, "PDPortDataAdjust"},
987     { 0x0203, "PDSyncData"},
988     { 0x0204, "IsochronousModeData"},
989     { 0x0205, "PDIRData"},
990     { 0x0206, "PDIRGlobalData"},
991     { 0x0207, "PDIRFrameData"},
992     { 0x0208, "PDIRBeginEndData"},
993     { 0x0209, "AdjustDomainBoundary"},
994     { 0x020A, "CheckPeers"},
995     { 0x020B, "CheckLineDelay"},
996     { 0x020C, "Checking MAUType"},
997     { 0x020E, "Adjusting MAUType"},
998     { 0x020F, "PDPortDataReal"},
999     { 0x0210, "AdjustMulticastBoundary"},
1000     { 0x0211, "PDInterfaceMrpDataAdjust"},
1001     { 0x0212, "PDInterfaceMrpDataReal"},
1002     { 0x0213, "PDInterfaceMrpDataCheck"},
1003     { 0x0214, "PDPortMrpDataAdjust"},
1004     { 0x0215, "PDPortMrpDataReal"},
1005     { 0x0216, "Media redundancy manager parameters"},
1006     { 0x0217, "Media redundancy client parameters"},
1007     { 0x0218, "Media redundancy RT mode for manager"},
1008     { 0x0219, "Media redundancy ring state data"},
1009     { 0x021A, "Media redundancy RT ring state data"},
1010     { 0x021B, "Adjust LinkState"},
1011     { 0x021C, "Checking LinkState"},
1012     { 0x021D, "Media redundancy RT mode for clients"},
1013     { 0x021E, "CheckSyncDifference"},
1014     { 0x021F, "CheckMAUTypeDifference"},
1015     { 0x0220, "PDPortFODataReal"},
1016     { 0x0221, "Reading real fiber optic manufacturerspecific data"},
1017     { 0x0222, "PDPortFODataAdjust"},
1018     { 0x0223, "PDPortFODataCheck"},
1019     { 0x0224, "Adjust PeerToPeerBoundary"},
1020     { 0x0225, "Adjust DCPBoundary"},
1021     { 0x0226, "Adjust PreambleLength"},
1022     { 0x0227, "CheckMAUType-Extension"},
1023     { 0x0228, "Reading real fiber optic diagnosis data"},
1024     { 0x0229, "AdjustMAUType-Extension"},
1025     { 0x022A, "PDIRSubframeData"},
1026     { 0x022B, "SubframeBlock"},
1027     { 0x0230, "PDNCDataCheck"},
1028     { 0x0231, "MrpInstanceDataAdjust"},
1029     { 0x0232, "MrpInstanceDataReal"},
1030     { 0x0233, "MrpInstanceDataCheck"},
1031     { 0x0240, "PDInterfaceDataReal"},
1032     { 0x0250, "PDInterfaceAdjust"},
1033     { 0x0251, "PDPortStatistic"},
1034     { 0x0400, "MultipleBlockHeader"},
1035     { 0x0401, "COContainerContent"},
1036     { 0x0500, "RecordDataReadQuery"},
1037     { 0x0600, "FSHello"},
1038     { 0x0601, "FSParameterBlock"},
1039     { 0x0608, "PDInterfaceFSUDataAdjust"},
1040     { 0x0609, "ARFSUDataAdjust"},
1041     { 0x0700, "AutoConfiguration"},
1042     { 0x0701, "AutoConfiguration Communication"},
1043     { 0x0702, "AutoConfiguration Configuration"},
1044     { 0x0900, "RS_AdjustObserver" },
1045     { 0x0901, "RS_GetEvent" },
1046     { 0x0902, "RS_AckEvent" },
1047     { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" },
1048     { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" },
1049
1050     { 0xB060, "EDD Trace Unit (EDD)" },
1051     { 0xB061, "EDD Trace Unit (EDD)" },
1052
1053     { 0xB070, "OHA Info (OHA)" },
1054
1055     { 0x0F00, "MaintenanceItem"},
1056     { 0x0F01, "Upload selected Records within Upload&RetrievalItem"},
1057     { 0x0F02, "iParameterItem"},
1058     { 0x0F03, "Retrieve selected Records within Upload&RetrievalItem"},
1059     { 0x0F04, "Retrieve all Records within Upload&RetrievalItem"},
1060     { 0, NULL }
1061 };
1062
1063 static const value_string pn_io_alarm_type[] = {
1064     { 0x0000, "Reserved" },
1065     { 0x0001, "Diagnosis" },
1066     { 0x0002, "Process" },
1067     { 0x0003, "Pull" },
1068     { 0x0004, "Plug" },
1069     { 0x0005, "Status" },
1070     { 0x0006, "Update" },
1071     { 0x0007, "Redundancy" },
1072     { 0x0008, "Controlled by supervisor" },
1073     { 0x0009, "Released" },
1074     { 0x000A, "Plug wrong submodule" },
1075     { 0x000B, "Return of submodule" },
1076     { 0x000C, "Diagnosis disappears" },
1077     { 0x000D, "Multicast communication mismatch notification" },
1078     { 0x000E, "Port data change notification" },
1079     { 0x000F, "Sync data changed notification" },
1080     { 0x0010, "Isochronous mode problem notification" },
1081     { 0x0011, "Network component problem notification" },
1082     { 0x0012, "Time data changed notification" },
1083     { 0x0013, "Dynamic Frame Packing problem notification" },
1084     /*0x0014 - 0x001D reserved */
1085     { 0x001E, "Upload and retrieval notification" },
1086     { 0x001F, "Pull module" },
1087     /*0x0020 - 0x007F manufacturer specific */
1088     /*0x0080 - 0x00FF reserved for profiles */
1089     /*0x0100 - 0xFFFF reserved */
1090     { 0, NULL }
1091 };
1092
1093 static const value_string pn_io_pdu_type[] = {
1094     { 0x01, "Data-RTA-PDU" },
1095     { 0x02, "NACK-RTA-PDU" },
1096     { 0x03, "ACK-RTA-PDU" },
1097     { 0x04, "ERR-RTA-PDU" },
1098     { 0, NULL }
1099 };
1100
1101 static const value_string hf_pn_io_frame_data_properties_forwardingMode[] = {
1102     { 0x00, "absolute mode" },
1103     { 0x01, "relative mode"},
1104     { 0, NULL }
1105 };
1106 static const value_string hf_pn_io_frame_data_properties_FFMulticastMACAdd[] = {
1107     { 0x00, "Use interface MAC destination unicast address" },
1108     { 0x01, "Use RT_CLASS_3 destination multicast address"},
1109     { 0x02, "Use FastForwardingMulticastMACAdd"},
1110     { 0x03, "reserved"},
1111     { 0, NULL }};
1112
1113 static const value_string hf_pn_io_frame_data_properties_FragMode[] = {
1114     { 0x00, "No fragmentation" },
1115     { 0x01, "Fragmentation enabled maximum size for static fragmentation 128 bytes"},
1116     { 0x02, "Fragmentation enabled maximum size for static fragmentation 256 bytes"},
1117     { 0x03, "reserved"},
1118     { 0, NULL }};
1119
1120 static const value_string pn_io_SFIOCRProperties_DFPType_vals[] = {
1121     { 0x00, "DFP_INBOUND" },
1122     { 0x01, "DFP_OUTBOUND" },
1123     { 0, NULL }
1124 };
1125
1126 static const value_string pn_io_DFPRedundantPathLayout_decode[] = {
1127     { 0x00, "The Frame for the redundant path contains the ordering shown by SubframeData" },
1128     { 0x01, "The Frame for the redundant path contains the inverse ordering shown by SubframeData" },
1129     { 0, NULL }
1130 };
1131
1132 static const value_string pn_io_SFCRC16_Decode[] = {
1133     { 0x00, "SFCRC16 and SFCycleCounter shall be created or set to zero by the sender and not checked by the receiver" },
1134     { 0x01, "SFCRC16 and SFCycleCounter shall be created by the sender and checked by the receiver." },
1135     { 0, NULL }
1136 };
1137
1138 static const value_string pn_io_txgroup_state[] = {
1139     { 0x00, "Transmission off" },
1140     { 0x01, "Transmission on " },
1141     { 0, NULL }
1142 };
1143
1144 static const value_string pn_io_error_code[] = {
1145     { 0x00, "OK" },
1146     { 0x81, "PNIO" },
1147     { 0xCF, "RTA error" },
1148     { 0xDA, "AlarmAck" },
1149     { 0xDB, "IODConnectRes" },
1150     { 0xDC, "IODReleaseRes" },
1151     { 0xDD, "IODControlRes" },
1152     { 0xDE, "IODReadRes" },
1153     { 0xDF, "IODWriteRes" },
1154     { 0, NULL }
1155 };
1156
1157 static const value_string pn_io_error_decode[] = {
1158     { 0x00, "OK" },
1159     { 0x80, "PNIORW" },
1160     { 0x81, "PNIO" },
1161     { 0, NULL }
1162 };
1163
1164 /* dummy for unknown decode */
1165 static const value_string pn_io_error_code1[] = {
1166     { 0x00, "OK" },
1167     { 0, NULL }
1168 };
1169
1170 /* dummy for unknown decode/code1 combination */
1171 static const value_string pn_io_error_code2[] = {
1172     { 0x00, "OK" },
1173     { 0, NULL }
1174 };
1175
1176 static const value_string pn_io_error_code1_pniorw[] = {
1177     /* high nibble 0-9 not specified -> legacy codes */
1178     { 0xa0, "application: read error" },
1179     { 0xa1, "application: write error" },
1180     { 0xa2, "application: module failure" },
1181     { 0xa3, "application: not specified" },
1182     { 0xa4, "application: not specified" },
1183     { 0xa5, "application: not specified" },
1184     { 0xa6, "application: not specified" },
1185     { 0xa7, "application: busy" },
1186     { 0xa8, "application: version conflict" },
1187     { 0xa9, "application: feature not supported" },
1188     { 0xaa, "application: User specific 1" },
1189     { 0xab, "application: User specific 2" },
1190     { 0xac, "application: User specific 3" },
1191     { 0xad, "application: User specific 4" },
1192     { 0xae, "application: User specific 5" },
1193     { 0xaf, "application: User specific 6" },
1194     { 0xb0, "access: invalid index" },
1195     { 0xb1, "access: write length error" },
1196     { 0xb2, "access: invalid slot/subslot" },
1197     { 0xb3, "access: type conflict" },
1198     { 0xb4, "access: invalid area" },
1199     { 0xb5, "access: state conflict" },
1200     { 0xb6, "access: access denied" },
1201     { 0xb7, "access: invalid range" },
1202     { 0xb8, "access: invalid parameter" },
1203     { 0xb9, "access: invalid type" },
1204     { 0xba, "access: backup" },
1205     { 0xbb, "access: User specific 7" },
1206     { 0xbc, "access: User specific 8" },
1207     { 0xbd, "access: User specific 9" },
1208     { 0xbe, "access: User specific 10" },
1209     { 0xbf, "access: User specific 11" },
1210     { 0xc0, "resource: read constrain conflict" },
1211     { 0xc1, "resource: write constrain conflict" },
1212     { 0xc2, "resource: resource busy" },
1213     { 0xc3, "resource: resource unavailable" },
1214     { 0xc4, "resource: not specified" },
1215     { 0xc5, "resource: not specified" },
1216     { 0xc6, "resource: not specified" },
1217     { 0xc7, "resource: not specified" },
1218     { 0xc8, "resource: User specific 12" },
1219     { 0xc9, "resource: User specific 13" },
1220     { 0xca, "resource: User specific 14" },
1221     { 0xcb, "resource: User specific 15" },
1222     { 0xcc, "resource: User specific 16" },
1223     { 0xcd, "resource: User specific 17" },
1224     { 0xce, "resource: User specific 18" },
1225     { 0xcf, "resource: User specific 19" },
1226     /* high nibble d-f user specific */
1227     { 0, NULL }
1228 };
1229
1230 static const value_string pn_io_error_code2_pniorw[] = {
1231     /* all values are user specified */
1232     { 0, NULL }
1233 };
1234
1235 static const value_string pn_io_error_code1_pnio[] = {
1236     { 0x00 /*  0*/, "Reserved" },
1237     { 0x01 /*  1*/, "Connect: Faulty ARBlockReq" },
1238     { 0x02 /*  2*/, "Connect: Faulty IOCRBlockReq" },
1239     { 0x03 /*  3*/, "Connect: Faulty ExpectedSubmoduleBlockReq" },
1240     { 0x04 /*  4*/, "Connect: Faulty AlarmCRBlockReq" },
1241     { 0x05 /*  5*/, "Connect: Faulty PrmServerBlockReq" },
1242     { 0x06 /*  6*/, "Connect: Faulty MCRBlockReq" },
1243     { 0x07 /*  7*/, "Connect: Faulty ARRPCBlockReq" },
1244     { 0x08 /*  8*/, "Read/Write Record: Faulty Record" },
1245     { 0x09 /*  9*/, "Connect: Faulty SubFrameBlock" },
1246     { 0x0A /* 10*/, "Connect: Faulty IRTFrameBlock" },
1247     { 0x0D /* 13*/, "Connect: Faulty RSInfoBlock" },
1248     { 0x14 /* 20*/, "IODControl: Faulty ControlBlockConnect" },
1249     { 0x15 /* 21*/, "IODControl: Faulty ControlBlockPlug" },
1250     { 0x16 /* 22*/, "IOXControl: Faulty ControlBlock after a connect est." },
1251     { 0x17 /* 23*/, "IOXControl: Faulty ControlBlock a plug alarm" },
1252
1253     { 0x28 /* 40*/, "Release: Faulty ReleaseBlock" },
1254
1255     { 0x32 /* 50*/, "Response: Faulty ARBlockRes" },
1256     { 0x33 /* 51*/, "Response: Faulty IOCRBlockRes" },
1257     { 0x34 /* 52*/, "Response: Faulty AlarmCRBlockRes" },
1258     { 0x35 /* 53*/, "Response: Faulty ModuleDifflock" },
1259     { 0x36 /* 54*/, "Response: Faulty ARRPCBlockRes" },
1260
1261     { 0x3c /* 60*/, "AlarmAck Error Codes" },
1262     { 0x3d /* 61*/, "CMDEV" },
1263     { 0x3e /* 62*/, "CMCTL" },
1264     { 0x3f /* 63*/, "NRPM" },
1265     { 0x40 /* 64*/, "RMPM" },
1266     { 0x41 /* 65*/, "ALPMI" },
1267     { 0x42 /* 66*/, "ALPMR" },
1268     { 0x43 /* 67*/, "LMPM" },
1269     { 0x44 /* 68*/, "MMAC" },
1270     { 0x45 /* 69*/, "RPC" },
1271     { 0x46 /* 70*/, "APMR" },
1272     { 0x47 /* 71*/, "APMS" },
1273     { 0x48 /* 72*/, "CPM" },
1274     { 0x49 /* 73*/, "PPM" },
1275     { 0x4a /* 74*/, "DCPUCS" },
1276     { 0x4b /* 75*/, "DCPUCR" },
1277     { 0x4c /* 76*/, "DCPMCS" },
1278     { 0x4d /* 77*/, "DCPMCR" },
1279     { 0x4e /* 78*/, "FSPM" },
1280     { 0xfd /*253*/, "RTA_ERR_CLS_PROTOCOL" },
1281     { 0xff /*255*/, "User specific" },
1282     { 0, NULL }
1283 };
1284
1285 static const value_string pn_io_error_code2_pnio_1[] = {
1286     /* CheckingRules for ARBlockReq */
1287     {  0, "Error in Parameter BlockType" },
1288     {  1, "Error in Parameter BlockLength" },
1289     {  2, "Error in Parameter BlockVersionHigh" },
1290     {  3, "Error in Parameter BlockVersionLow" },
1291     {  4, "Error in Parameter ARType" },
1292     {  5, "Error in Parameter ARUUID" },
1293     {  7, "Error in Parameter CMInitiatorMACAddress" },
1294     {  8, "Error in Parameter CMInitiatorObjectUUID" },
1295     {  9, "Error in Parameter ARProperties" },
1296     { 10, "Error in Parameter CMInitiatorActivityTimeoutFactor" },
1297     { 11, "Error in Parameter InitiatorUDPRTPort" },
1298     { 12, "Error in Parameter StationNameLength" },
1299     { 13, "Error in Parameter CMInitiatorStationName" },
1300     {  0, NULL }
1301 };
1302
1303 static const value_string pn_io_error_code2_pnio_2[] = {
1304     /* CheckingRules for IOCRBlockReq */
1305     {  0, "Error in Parameter BlockType" },
1306     {  1, "Error in Parameter BlockLength" },
1307     {  2, "Error in Parameter BlockVersionHigh" },
1308     {  3, "Error in Parameter BlockVersionLow" },
1309     {  4, "Error in Parameter IOCRType" },
1310     {  5, "Error in Parameter IOCRReference" },
1311     {  6, "Error in Parameter LT" },
1312     {  7, "Error in Parameter IOCRProperties" },
1313     {  8, "Error in Parameter DataLength" },
1314     {  9, "Error in Parameter FrameID" },
1315     { 10, "Error in Parameter SendClockFactor" },
1316     { 11, "Error in Parameter ReductionRatio" },
1317     { 12, "Error in Parameter Phase" },
1318     { 14, "Error in Parameter FrameSendOffset" },
1319     { 15, "Error in Parameter WatchdogFactor" },
1320     { 16, "Error in Parameter DataHoldFactor" },
1321     { 17, "Error in Parameter IOCRTagHeader" },
1322     { 18, "Error in Parameter IOCRMulticastMacAddress" },
1323     { 19, "Error in Parameter NumberOfAPI" },
1324     { 20, "Error in Parameter API" },
1325     { 21, "Error in Parameter NumberOfIODataObjects" },
1326     { 22, "Error in Parameter SlotNumber" },
1327     { 23, "Error in Parameter SubslotNumber" },
1328     { 24, "Error in Parameter IODataObjectFrameOffset" },
1329     { 25, "Error in Parameter NumberOfIOCS" },
1330     { 26, "Error in Parameter SlotNumber" },
1331     { 27, "Error in Parameter SubslotNumber" },
1332     { 28, "Error in Parameter IOCSFrameOffset" },
1333     {  0, NULL }
1334 };
1335
1336 static const value_string pn_io_error_code2_pnio_3[] = {
1337     /* CheckingRules for ExpectedSubmoduleBlockReq */
1338     {  0, "Error in Parameter BlockType" },
1339     {  1, "Error in Parameter BlockLength" },
1340     {  2, "Error in Parameter BlockVersionHigh" },
1341     {  3, "Error in Parameter BlockVersionLow" },
1342     {  4, "Error in Parameter NumberOfAPI" },
1343     {  5, "Error in Parameter API" },
1344     {  6, "Error in Parameter SlotNumber" },
1345     {  7, "Error in Parameter ModuleIdentNumber" },
1346     {  8, "Error in Parameter ModuleProperties" },
1347     {  9, "Error in Parameter NumberOfSubmodules" },
1348     { 10, "Error in Parameter SubslotNumber" },
1349     { 12, "Error in Parameter SubmoduleProperties" },
1350     { 13, "Error in Parameter DataDescription" },
1351     { 14, "Error in Parameter SubmoduleDataLength" },
1352     { 15, "Error in Parameter LengthIOPS" },
1353     { 16, "Error in Parameter LengthIOCS" },
1354     {  0, NULL }
1355 };
1356
1357
1358 static const value_string pn_io_error_code2_pnio_4[] = {
1359     /* CheckingRules for AlarmCRBlockReq */
1360     {  0, "Error in Parameter BlockType" },
1361     {  1, "Error in Parameter BlockLength" },
1362     {  2, "Error in Parameter BlockVersionHigh" },
1363     {  3, "Error in Parameter BlockVersionLow" },
1364     {  4, "Error in Parameter AlarmCRType" },
1365     {  5, "Error in Parameter LT" },
1366     {  6, "Error in Parameter AlarmCRProperties" },
1367     {  7, "Error in Parameter RTATimeoutFactor" },
1368     {  8, "Error in Parameter RTARetries" },
1369     { 10, "Error in Parameter MaxAlarmDataLength" },
1370     { 11, "Error in Parameter AlarmCRTagHeaderHigh" },
1371     { 12, "Error in Parameter AlarmCRTagHeaderLow" },
1372     {  0, NULL }
1373 };
1374
1375 static const value_string pn_io_error_code2_pnio_5[] = {
1376     /* CheckingRules for PrmServerBlockReq */
1377     { 0, "Error in Parameter BlockType" },
1378     { 1, "Error in Parameter BlockLength" },
1379     { 2, "Error in Parameter BlockVersionHigh" },
1380     { 3, "Error in Parameter BlockVersionLow" },
1381     { 6, "Error in Parameter CMInitiatorActivityTimeoutFactor" },
1382     { 7, "Error in Parameter StationNameLength" },
1383     { 8, "Error in Parameter ParameterServerStationName" },
1384     { 0, NULL }
1385 };
1386
1387 static const value_string pn_io_error_code2_pnio_6[] = {
1388     /* CheckingRules for MCRBlockReq */
1389     { 0, "Error in Parameter BlockType" },
1390     { 1, "Error in Parameter BlockLength" },
1391     { 2, "Error in Parameter BlockVersionHigh" },
1392     { 3, "Error in Parameter BlockVersionLow" },
1393     { 4, "Error in Parameter IOCRReference" },
1394     { 5, "Error in Parameter AddressResolutionProperties" },
1395     { 6, "Error in Parameter MCITimeoutFactor" },
1396     { 7, "Error in Parameter StationNameLength" },
1397     { 8, "Error in Parameter ProviderStationName" },
1398     { 0, NULL }
1399 };
1400
1401 static const value_string pn_io_error_code2_pnio_7[] = {
1402     /* CheckingRules for MCRBlockReq */
1403     { 0, "Error in Parameter BlockType" },
1404     { 1, "Error in Parameter BlockLength" },
1405     { 2, "Error in Parameter BlockVersionHigh" },
1406     { 3, "Error in Parameter BlockVersionLow" },
1407     { 4, "Error in Parameter InitiatorRPCServerPort" },
1408     { 0, NULL }
1409 };
1410
1411 static const value_string pn_io_error_code2_pnio_8[] = {
1412     /* CheckingRules for Read/Write ParameterReqHeader */
1413     {  0, "Error in Parameter BlockType" },
1414     {  1, "Error in Parameter BlockLength" },
1415     {  2, "Error in Parameter BlockVersionHigh" },
1416     {  3, "Error in Parameter BlockVersionLow" },
1417     {  5, "Error in Parameter ARUUID" },
1418     {  6, "Error in Parameter API" },
1419     {  7, "Error in Parameter SlotNumber" },
1420     {  8, "Error in Parameter SubslotNumber" },
1421     {  9, "Error in Parameter Padding" },
1422     { 10, "Error in Parameter Index" },
1423     { 11, "Error in Parameter RecordDataLength" },
1424     { 12, "Error in Parameter TargetARUUID" },
1425     {  0, NULL }
1426 };
1427
1428 static const value_string pn_io_error_code2_pnio_13[] = {
1429     /* CheckingRules for RSInfoBlock */
1430     { 0, "Error in Parameter BlockType" },
1431     { 1, "Error in Parameter BlockLength" },
1432     { 2, "Error in Parameter BlockVersionHigh" },
1433     { 3, "Error in Parameter BlockVersionLow" },
1434     { 4, "Error in Parameter Padding" },
1435     { 5, "Error in Parameter RSProperties" },
1436     { 0, NULL }
1437 };
1438
1439 static const value_string pn_io_error_code2_pnio_20[] = {
1440     /* CheckingRules for ControlBlockConnect */
1441     { 0, "Error in Parameter BlockType" },
1442     { 1, "Error in Parameter BlockLength" },
1443     { 2, "Error in Parameter BlockVersionHigh" },
1444     { 3, "Error in Parameter BlockVersionLow" },
1445     { 4, "Error in Parameter Padding" },
1446     { 6, "Error in Parameter SessionKey" },
1447     { 7, "Error in Parameter Padding" },
1448     { 8, "Error in Parameter ControlCommand" },
1449     { 9, "Error in Parameter ControlBlockProperties" },
1450     { 0, NULL }
1451 };
1452
1453 static const value_string pn_io_error_code2_pnio_21[] = {
1454     /* CheckingRules for ControlBlockPlug */
1455     { 0, "Error in Parameter BlockType" },
1456     { 1, "Error in Parameter BlockLength" },
1457     { 2, "Error in Parameter BlockVersionHigh" },
1458     { 3, "Error in Parameter BlockVersionLow" },
1459     { 4, "Error in Parameter Padding" },
1460     { 6, "Error in Parameter SessionKey" },
1461     { 7, "Error in Parameter AlarmSequenceNumber" },
1462     { 8, "Error in Parameter ControlCommand" },
1463     { 9, "Error in Parameter ControlBlockProperties" },
1464     { 0, NULL }
1465 };
1466
1467 static const value_string pn_io_error_code2_pnio_22[] = {
1468     /* CheckingRule for ControlBlockConnect */
1469     { 0, "Error in Parameter BlockType" },
1470     { 1, "Error in Parameter BlockLength" },
1471     { 2, "Error in Parameter BlockVersionHigh" },
1472     { 3, "Error in Parameter BlockVersionLow" },
1473     { 4, "Error in Parameter Padding" },
1474     { 6, "Error in Parameter SessionKey" },
1475     { 7, "Error in Parameter Padding" },
1476     { 8, "Error in Parameter ControlCommand" },
1477     { 9, "Error in Parameter ControlBlockProperties" },
1478     { 0, NULL }
1479 };
1480
1481 static const value_string pn_io_error_code2_pnio_23[] = {
1482     /* CheckingRules for ControlBlockPlug */
1483     { 0, "Error in Parameter BlockType" },
1484     { 1, "Error in Parameter BlockLength" },
1485     { 2, "Error in Parameter BlockVersionHigh" },
1486     { 3, "Error in Parameter BlockVersionLow" },
1487     { 4, "Error in Parameter Padding" },
1488     { 6, "Error in Parameter SessionKey" },
1489     { 7, "Error in Parameter AlarmSequenceNumber" },
1490     { 8, "Error in Parameter ControlCommand" },
1491     { 9, "Error in Parameter ControlBlockProperties" },
1492     { 0, NULL }
1493 };
1494
1495 static const value_string pn_io_error_code2_pnio_40[] = {
1496     /* CheckingRules for ReleaseBlock */
1497     { 0, "Error in Parameter BlockType" },
1498     { 1, "Error in Parameter BlockLength" },
1499     { 2, "Error in Parameter BlockVersionHigh" },
1500     { 3, "Error in Parameter BlockVersionLow" },
1501     { 4, "Error in Parameter Padding" },
1502     { 6, "Error in Parameter SessionKey" },
1503     { 7, "Error in Parameter Padding" },
1504     { 8, "Error in Parameter ControlCommand" },
1505     { 9, "Error in Parameter ControlBlockProperties" },
1506     { 0, NULL }
1507 };
1508
1509 static const value_string pn_io_error_code2_pnio_60[] = {
1510     /* AlarmAck Error Codes */
1511     { 0, "Alarm Type Not Supported" },
1512     { 1, "Wrong Submodule State" },
1513     { 2, "IOCARSR Backup - Alarm not executed" },
1514     { 0, NULL }
1515 };
1516
1517 static const value_string pn_io_error_code2_pnio_61[] = {
1518     /* CMDEV */
1519     { 0, "State Conflict" },
1520     { 1, "Resources" },
1521     { 0, NULL }
1522 };
1523
1524 static const value_string pn_io_error_code2_pnio_62[] = {
1525     /* CMCTL */
1526     { 0, "State Conflict" },
1527     { 1, "Timeout" },
1528     { 2, "No data send" },
1529     { 0, NULL }
1530 };
1531
1532 static const value_string pn_io_error_code2_pnio_63[] = {
1533     /* NRPM */
1534     { 0, "No DCP active" },
1535     { 1, "DNS Unknown_RealStationName" },
1536     { 2, "DCP No_RealStationName" },
1537     { 3, "DCP Multiple_RealStationName" },
1538     { 4, "DCP No_StationName" },
1539     { 5, "No_IP_Addr" },
1540     { 6, "DCP_Set_Error" },
1541     { 0, NULL }
1542 };
1543
1544 static const value_string pn_io_error_code2_pnio_64[] = {
1545     /* RMPM */
1546     { 0, "ArgsLength invalid" },
1547     { 1, "Unknown Blocks" },
1548     { 2, "IOCR Missing" },
1549     { 3, "Wrong AlarmCRBlock count" },
1550     { 4, "Out of AR Resources" },
1551     { 5, "AR UUID unknown" },
1552     { 6, "State conflict" },
1553     { 7, "Out of Provider, Consumer or Alarm Resources" },
1554     { 8, "Out of Memory" },
1555     { 0, NULL }
1556 };
1557
1558 static const value_string pn_io_error_code2_pnio_65[] = {
1559     /* ALPMI */
1560     { 0, "Invalid State" },
1561     { 1, "Wrong ACK-PDU" },
1562     { 0, NULL }
1563 };
1564
1565 static const value_string pn_io_error_code2_pnio_66[] = {
1566     /* ALPMR */
1567     { 0, "Invalid State" },
1568     { 1, "Wrong Notification PDU" },
1569     { 0, NULL }
1570 };
1571
1572 static const value_string pn_io_error_code2_pnio_70[] = {
1573     /* APMR */
1574     { 0, "Invalid State" },
1575     { 1, "LMPM signaled error" },
1576     { 0, NULL }
1577 };
1578
1579 static const value_string pn_io_error_code2_pnio_71[] = {
1580     /* APMS */
1581     { 0, "Invalid State" },
1582     { 1, "LMPM signaled error" },
1583     { 2, "Timeout" },
1584     { 0, NULL }
1585 };
1586
1587 static const value_string pn_io_error_code2_pnio_72[] = {
1588     /* CPM */
1589     { 1, "Invalid State" },
1590     { 0, NULL }
1591 };
1592
1593 static const value_string pn_io_error_code2_pnio_73[] = {
1594     /* PPM */
1595     { 1, "Invalid State" },
1596     { 0, NULL }
1597 };
1598
1599 static const value_string pn_io_error_code2_pnio_74[] = {
1600     /* DCPUCS */
1601     { 0, "Invalid State" },
1602     { 1, "LMPM signaled an error" },
1603     { 2, "Timeout" },
1604     { 0, NULL }
1605 };
1606
1607 static const value_string pn_io_error_code2_pnio_75[] = {
1608     /* DCPUCR */
1609     { 0, "Invalid State" },
1610     { 1, "LMPM signaled an error" },
1611     { 0, NULL }
1612 };
1613
1614 static const value_string pn_io_error_code2_pnio_76[] = {
1615     /* DCPMCS */
1616     { 0, "Invalid State" },
1617     { 1, "LMPM signaled an error" },
1618     { 0, NULL }
1619 };
1620
1621 static const value_string pn_io_error_code2_pnio_77[] = {
1622     /* DCPMCR */
1623     { 0, "Invalid State" },
1624     { 1, "LMPM signaled an error" },
1625     { 0, NULL }
1626 };
1627
1628 static const value_string pn_io_error_code2_pnio_253[] = {
1629     {  0, "reserved" },
1630     {  1, "Error within the coordination of sequence numbers (RTA_ERR_CODE_SEQ) error" },
1631     {  2, "Instance closed (RTA_ERR_ABORT)" },
1632     {  3, "AR out of memory (RTA_ERR_ABORT)" },
1633     {  4, "AR add provider or consumer failed (RTA_ERR_ABORT)" },
1634     {  5, "AR consumer DHT/WDT expired (RTA_ERR_ABORT)" },
1635     {  6, "AR cmi timeout (RTA_ERR_ABORT)" },
1636     {  7, "AR alarm-open failed (RTA_ERR_ABORT)" },
1637     {  8, "AR alarm-send.cnf(-) (RTA_ERR_ABORT)" },
1638     {  9, "AR alarm-ack-send.cnf(-) (RTA_ERR_ABORT)" },
1639     { 10, "AR alarm data too long (RTA_ERR_ABORT)" },
1640     { 11, "AR alarm.ind(err) (RTA_ERR_ABORT)" },
1641     { 12, "AR rpc-client call.cnf(-) (RTA_ERR_ABORT)" },
1642     { 13, "AR abort.req (RTA_ERR_ABORT)" },
1643     { 14, "AR re-run aborts existing (RTA_ERR_ABORT)" },
1644     { 15, "AR release.ind received (RTA_ERR_ABORT)" },
1645     { 16, "AR device deactivated (RTA_ERR_ABORT)" },
1646     { 17, "AR removed (RTA_ERR_ABORT)" },
1647     { 18, "AR protocol violation (RTA_ERR_ABORT)" },
1648     { 19, "AR name resolution error (RTA_ERR_ABORT)" },
1649     { 20, "AR RPC-Bind error (RTA_ERR_ABORT)" },
1650     { 21, "AR RPC-Connect error (RTA_ERR_ABORT)" },
1651     { 22, "AR RPC-Read error (RTA_ERR_ABORT)" },
1652     { 23, "AR RPC-Write error (RTA_ERR_ABORT)" },
1653     { 24, "AR RPC-Control error (RTA_ERR_ABORT)" },
1654     { 25, "AR forbidden pull or plug after check.rsp and before in-data.ind (RTA_ERR_ABORT)" },
1655     { 26, "AR AP removed (RTA_ERR_ABORT)" },
1656     { 27, "AR link down (RTA_ERR_ABORT)" },
1657     { 28, "AR could not register multicast-mac address (RTA_ERR_ABORT)" },
1658     { 29, "not synchronized (cannot start companion-ar) (RTA_ERR_ABORT)" },
1659     { 30, "wrong topology (cannot start companion-ar) (RTA_ERR_ABORT)" },
1660     { 31, "dcp, station-name changed (RTA_ERR_ABORT)" },
1661     { 32, "dcp, reset to factory-settings (RTA_ERR_ABORT)" },
1662     { 33, "cannot start companion-AR because a 0x8ipp submodule in the first AR... (RTA_ERR_ABORT)" },
1663     { 34, "no irdata record yet (RTA_ERR_ABORT)" },
1664     { 35, "PDEV (RTA_ERROR_ABORT)" },
1665     { 36, "PDEV, no port offers required speed/duplexity (RTA_ERROR_ABORT)" },
1666     { 37, "IP-Suite [of the IOC] changed by means of DCP_Set(IPParameter) or local engineering (RTA_ERROR_ABORT)" },
1667     { 0, NULL }
1668 };
1669
1670 static const value_string pn_io_error_code2_pnio_255[] = {
1671     /* User specific */
1672     { 255, "User abort" },
1673     { 0, NULL }
1674 };
1675
1676 static const value_string pn_io_ioxs[] = {
1677     { 0x00 /*  0*/, "detected by subslot" },
1678     { 0x01 /*  1*/, "detected by slot" },
1679     { 0x02 /*  2*/, "detected by IO device" },
1680     { 0x03 /*  3*/, "detected by IO controller" },
1681     { 0, NULL }
1682 };
1683
1684
1685 static const value_string pn_io_ar_type[] = {
1686     { 0x0000, "reserved" },
1687     { 0x0001, "IO Controller AR"},
1688     { 0x0002, "reserved" },
1689     { 0x0003, "IOCARCIR" },
1690     { 0x0004, "reserved" },
1691     { 0x0005, "reserved" },
1692     { 0x0006, "IO Supervisor AR / DeviceAccess AR" },
1693     /*0x0007 - 0x000F reserved */
1694     { 0x0010, "IO Controller AR (RT_CLASS_3)" },
1695     /*0x0011 - 0x001F reserved */
1696     { 0x0020, "IO Controller AR (sysred/CiR)" },
1697     /*0x0007 - 0xFFFF reserved */
1698     { 0, NULL }
1699 };
1700
1701 static const value_string pn_io_iocr_type[] = {
1702     { 0x0000, "reserved" },
1703     { 0x0001, "Input CR" },
1704     { 0x0002, "Output CR" },
1705     { 0x0003, "Multicast Provider CR" },
1706     { 0x0004, "Multicast Consumer CR" },
1707     /*0x0005 - 0xFFFF reserved */
1708     { 0, NULL }
1709 };
1710
1711
1712 static const value_string pn_io_data_description[] = {
1713     { 0x0000, "reserved" },
1714     { 0x0001, "Input" },
1715     { 0x0002, "Output" },
1716     { 0x0003, "reserved" },
1717     /*0x0004 - 0xFFFF reserved */
1718     { 0, NULL }
1719 };
1720
1721
1722 static const value_string pn_io_module_state[] = {
1723     { 0x0000, "no module" },
1724     { 0x0001, "wrong module" },
1725     { 0x0002, "proper module" },
1726     { 0x0003, "substitute" },
1727     /*0x0004 - 0xFFFF reserved */
1728     { 0, NULL }
1729 };
1730
1731 static const value_string pn_io_arproperties_state[] = {
1732     { 0x00000000, "Reserved" },
1733     { 0x00000001, "Active" },
1734     { 0x00000002, "reserved" },
1735     { 0x00000003, "reserved" },
1736     { 0x00000004, "reserved" },
1737     { 0x00000005, "reserved" },
1738     { 0x00000006, "reserved" },
1739     { 0x00000007, "reserved" },
1740     { 0, NULL }
1741 };
1742
1743 static const value_string pn_io_arproperties_supervisor_takeover_allowed[] = {
1744     { 0x00000000, "not allowed" },
1745     { 0x00000001, "allowed" },
1746     { 0, NULL }
1747 };
1748
1749 static const value_string pn_io_arproperties_parametrization_server[] = {
1750     { 0x00000000, "External PrmServer" },
1751     { 0x00000001, "CM Initiator" },
1752     { 0, NULL }
1753 };
1754 /* BIT 8 */
1755 static const value_string pn_io_arproperties_DeviceAccess[] = {
1756     { 0x00000000, "Only the submodules from the ExpectedSubmoduleBlock are accessible" },
1757     { 0x00000001, "Submodule access is controlled by IO device application" },
1758     { 0, NULL }
1759 };
1760
1761 /* Bit 9 - 10 */
1762 static const value_string pn_io_arproperties_companion_ar[] = {
1763     { 0x00000000, "Single AR" },
1764     { 0x00000001, "First AR of a companion pair and a companion AR shall follow" },
1765     { 0x00000002, "Companion AR" },
1766     { 0x00000003, "Reserved" },
1767     { 0, NULL }
1768 };
1769 /* REMOVED with 2.3
1770 static const value_string pn_io_arproperties_data_rate[] = {
1771     { 0x00000000, "at least 100 MB/s or more" },
1772     { 0x00000001, "100 MB/s" },
1773     { 0x00000002, "1 GB/s" },
1774     { 0x00000003, "10 GB/s" },
1775     { 0, NULL }
1776 };
1777 */
1778
1779 /* BIT 11 */
1780 static const value_string pn_io_arproperties_acknowldege_companion_ar[] = {
1781     { 0x00000000, "No companion AR or no acknowledge for the companion AR required" },
1782     { 0x00000001, "Companion AR with acknowledge" },
1783     { 0, NULL }
1784 };
1785
1786 /* bit 29 for legacy startup mode*/
1787 static const value_string pn_io_arproperties_combined_object_container_with_legacy_startupmode[] = {
1788     { 0x00000000, "CombinedObjectContainer not used" },
1789     { 0x00000001, "Reserved" },
1790     { 0, NULL }
1791 };
1792
1793 /* bit 29 for advanced statup mode*/
1794 static const value_string pn_io_arproperties_combined_object_container_with_advanced_startupmode[] = {
1795     { 0x00000000, "CombinedObjectContainer not used" },
1796     { 0x00000001, "Usage of CombinedObjectContainer required" },
1797     { 0, NULL }
1798 };
1799
1800 /* bit 30 */
1801 static const value_string pn_io_arpropertiesStartupMode[] = {
1802     { 0x00000000, "Legacy" },
1803     { 0x00000001, "Advanced" },
1804     { 0, NULL }
1805 };
1806
1807 /* bit 31 */
1808 static const value_string pn_io_arproperties_pull_module_alarm_allowed[] = {
1809     { 0x00000000, "AlarmType(=Pull) shall signal pulling of submodule and module" },
1810     { 0x00000001, "AlarmType(=Pull) shall signal pulling of submodule" },
1811     { 0, NULL }
1812 };
1813
1814 static const value_string pn_io_RedundancyInfo[] = {
1815     { 0x00000000, "Reserved" },
1816     { 0x00000001, "The delivering node is the left or below one" },
1817     { 0x00000002, "The delivering node is the right or above one" },
1818     { 0x00000003, "Reserved" },
1819     { 0, NULL }
1820 };
1821
1822 static const value_string pn_io_iocr_properties_rtclass[] = {
1823     { 0x00000000, "reserved" },
1824     { 0x00000001, "RT_CLASS_1" },
1825     { 0x00000002, "RT_CLASS_2" },
1826     { 0x00000003, "RT_CLASS_3" },
1827     { 0x00000004, "RT_CLASS_UDP" },
1828     /*0x00000005 - 0x00000007 reserved */
1829     { 0, NULL }
1830 };
1831
1832 static const value_string pn_io_MultipleInterfaceMode_NameOfDevice[] = {
1833     { 0x00000000, "PortID of LLDP contains name of port (Default)" },
1834     { 0x00000001, "PortID of LLDP contains name of port and NameOfStation" },
1835     { 0, NULL }
1836 };
1837
1838 static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0 =
1839     { "The device shall deliver valid input data", "The IO controller shall not evaluate the input data." };
1840
1841 static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1 =
1842     { "The device shall deliver valid input data", "The IO device shall mark the data as invalid using APDU_Status.DataStatus.DataValid == Invalid." };
1843
1844 static const true_false_string tfs_pn_io_sr_properties_Mode =
1845     { "Default The IO device shall use APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid.",
1846       "The IO controller do not support APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid." };
1847
1848 static const true_false_string tfs_pn_io_sr_properties_Reserved1 =
1849     { "Legacy mode", "Shall be set to zero for this standard." };
1850
1851 static const value_string pn_io_iocr_properties_media_redundancy[] = {
1852     { 0x00000000, "No media redundant frame transfer" },
1853     { 0x00000001, "Media redundant frame transfer" },
1854     { 0, NULL }
1855 };
1856
1857
1858 static const value_string pn_io_submodule_properties_type[] = {
1859     { 0x0000, "no input and no output data" },
1860     { 0x0001, "input data" },
1861     { 0x0002, "output data" },
1862     { 0x0003, "input and output data" },
1863     { 0, NULL }
1864 };
1865
1866 static const value_string pn_io_submodule_properties_shared_input[] = {
1867     { 0x0000, "IO controller" },
1868     { 0x0001, "IO controller shared" },
1869     { 0, NULL }
1870 };
1871
1872 static const value_string pn_io_submodule_properties_reduce_input_submodule_data_length[] = {
1873     { 0x0000, "Expected" },
1874     { 0x0001, "Zero" },
1875     { 0, NULL }
1876 };
1877
1878 static const value_string pn_io_submodule_properties_reduce_output_submodule_data_length[] = {
1879     { 0x0000, "Expected" },
1880     { 0x0001, "Zero" },
1881     { 0, NULL }
1882 };
1883
1884 static const value_string pn_io_submodule_properties_discard_ioxs[] = {
1885     { 0x0000, "Expected" },
1886     { 0x0001, "Zero" },
1887     { 0, NULL }
1888 };
1889
1890 static const value_string pn_io_alarmcr_properties_priority[] = {
1891     { 0x0000, "user priority (default)" },
1892     { 0x0001, "use only low priority" },
1893     { 0, NULL }
1894 };
1895
1896 static const value_string pn_io_alarmcr_properties_transport[] = {
1897     { 0x0000, "RTA_CLASS_1" },
1898     { 0x0001, "RTA_CLASS_UDP" },
1899     { 0, NULL }
1900 };
1901
1902
1903 static const value_string pn_io_submodule_state_format_indicator[] = {
1904     { 0x0000, "Coding uses Detail" },
1905     { 0x0001, "Coding uses .IdentInfo, ..." },
1906     { 0, NULL }
1907 };
1908
1909 static const value_string pn_io_submodule_state_add_info[] = {
1910     { 0x0000, "None" },
1911     { 0x0001, "Takeover not allowed" },
1912     /*0x0002 - 0x0007 reserved */
1913     { 0, NULL }
1914 };
1915
1916 static const value_string pn_io_submodule_state_qualified_info[] = {
1917     { 0x0000, "No QualifiedInfo available" },
1918     { 0x0001, "QualifiedInfo available" },
1919     { 0, NULL }
1920 };
1921
1922 static const value_string pn_io_submodule_state_maintenance_required[] = {
1923     { 0x0000, "No MaintenanceRequired available" },
1924     { 0x0001, "MaintenanceRequired available" },
1925     { 0, NULL }
1926 };
1927
1928 static const value_string pn_io_submodule_state_maintenance_demanded[] = {
1929     { 0x0000, "No MaintenanceDemanded available" },
1930     { 0x0001, "MaintenanceDemanded available" },
1931     { 0, NULL }
1932 };
1933
1934 static const value_string pn_io_submodule_state_diag_info[] = {
1935     { 0x0000, "No DiagnosisData available" },
1936     { 0x0001, "DiagnosisData available" },
1937     { 0, NULL }
1938 };
1939
1940 static const value_string pn_io_submodule_state_ar_info[] = {
1941     { 0x0000, "Own" },
1942     { 0x0001, "ApplicationReadyPending (ARP)" },
1943     { 0x0002, "Superordinated Locked (SO)" },
1944     { 0x0003, "Locked By IO Controller (IOC)" },
1945     { 0x0004, "Locked By IO Supervisor (IOS)" },
1946     /*0x0005 - 0x000F reserved */
1947     { 0, NULL }
1948 };
1949
1950 static const value_string pn_io_submodule_state_ident_info[] = {
1951     { 0x0000, "OK" },
1952     { 0x0001, "Substitute (SU)" },
1953     { 0x0002, "Wrong (WR)" },
1954     { 0x0003, "NoSubmodule (NO)" },
1955     /*0x0004 - 0x000F reserved */
1956     { 0, NULL }
1957 };
1958
1959 static const value_string pn_io_submodule_state_detail[] = {
1960     { 0x0000, "no submodule" },
1961     { 0x0001, "wrong submodule" },
1962     { 0x0002, "locked by IO controller" },
1963     { 0x0003, "reserved" },
1964     { 0x0004, "application ready pending" },
1965     { 0x0005, "reserved" },
1966     { 0x0006, "reserved" },
1967     { 0x0007, "Substitute" },
1968     /*0x0008 - 0x7FFF reserved */
1969     { 0, NULL }
1970 };
1971
1972 static const value_string pn_io_substitutionmode[] = {
1973     { 0x0000, "ZERO" },
1974     { 0x0001, "Last value" },
1975     { 0x0002, "Replacement value" },
1976     /*0x0003 - 0xFFFF reserved */
1977     { 0, NULL }
1978 };
1979
1980 static const value_string pn_io_index[] = {
1981     /*0x0008 - 0x7FFF user specific */
1982
1983     /* PROFISafe */
1984     { 0x0100, "PROFISafe" },
1985
1986     /* subslot specific */
1987     { 0x8000, "ExpectedIdentificationData for one subslot" },
1988     { 0x8001, "RealIdentificationData for one subslot" },
1989     /*0x8002 - 0x8009 reserved */
1990     { 0x800A, "Diagnosis in channel coding for one subslot" },
1991     { 0x800B, "Diagnosis in all codings for one subslot" },
1992     { 0x800C, "Diagnosis, Maintenance, Qualified and Status for one subslot" },
1993     /*0x800D - 0x800F reserved */
1994     { 0x8010, "Maintenance required in channel coding for one subslot" },
1995     { 0x8011, "Maintenance demanded in channel coding for one subslot" },
1996     { 0x8012, "Maintenance required in all codings for one subslot" },
1997     { 0x8013, "Maintenance demanded in all codings for one subslot" },
1998     /*0x8014 - 0x801D reserved */
1999     { 0x801E, "SubstituteValues for one subslot" },
2000     /*0x801F - 0x8027 reserved */
2001     { 0x8028, "RecordInputDataObjectElement for one subslot" },
2002     { 0x8029, "RecordOutputDataObjectElement for one subslot" },
2003     { 0x802A, "PDPortDataReal for one subslot" },
2004     { 0x802B, "PDPortDataCheck for one subslot" },
2005     { 0x802C, "PDIRData for one subslot" },
2006     { 0x802D, "Expected PDSyncData for one subslot with SyncID value 0" },
2007     /*0x802E reserved */
2008     { 0x802F, "PDPortDataAdjust for one subslot" },
2009     { 0x8030, "IsochronousModeData for one subslot" },
2010     { 0x8031, "Expected PDSyncData for one subslot with SyncID value 1" },
2011     { 0x8032, "Expected PDSyncData for one subslot with SyncID value 2" },
2012     { 0x8033, "Expected PDSyncData for one subslot with SyncID value 3" },
2013     { 0x8034, "Expected PDSyncData for one subslot with SyncID value 4" },
2014     { 0x8035, "Expected PDSyncData for one subslot with SyncID value 5" },
2015     { 0x8036, "Expected PDSyncData for one subslot with SyncID value 6" },
2016     { 0x8037, "Expected PDSyncData for one subslot with SyncID value 7" },
2017     { 0x8038, "Expected PDSyncData for one subslot with SyncID value 8" },
2018     { 0x8039, "Expected PDSyncData for one subslot with SyncID value 9" },
2019     { 0x803A, "Expected PDSyncData for one subslot with SyncID value 10" },
2020     { 0x803B, "Expected PDSyncData for one subslot with SyncID value 11" },
2021     { 0x803C, "Expected PDSyncData for one subslot with SyncID value 12" },
2022     { 0x803D, "Expected PDSyncData for one subslot with SyncID value 13" },
2023     { 0x803E, "Expected PDSyncData for one subslot with SyncID value 14" },
2024     { 0x803F, "Expected PDSyncData for one subslot with SyncID value 15" },
2025     { 0x8040, "Expected PDSyncData for one subslot with SyncID value 16" },
2026     { 0x8041, "Expected PDSyncData for one subslot with SyncID value 17" },
2027     { 0x8042, "Expected PDSyncData for one subslot with SyncID value 18" },
2028     { 0x8043, "Expected PDSyncData for one subslot with SyncID value 19" },
2029     { 0x8044, "Expected PDSyncData for one subslot with SyncID value 20" },
2030     { 0x8045, "Expected PDSyncData for one subslot with SyncID value 21" },
2031     { 0x8046, "Expected PDSyncData for one subslot with SyncID value 22" },
2032     { 0x8047, "Expected PDSyncData for one subslot with SyncID value 23" },
2033     { 0x8048, "Expected PDSyncData for one subslot with SyncID value 24" },
2034     { 0x8049, "Expected PDSyncData for one subslot with SyncID value 25" },
2035     { 0x804A, "Expected PDSyncData for one subslot with SyncID value 26" },
2036     { 0x804B, "Expected PDSyncData for one subslot with SyncID value 27" },
2037     { 0x804C, "Expected PDSyncData for one subslot with SyncID value 28" },
2038     { 0x804D, "Expected PDSyncData for one subslot with SyncID value 29" },
2039     { 0x804E, "Expected PDSyncData for one subslot with SyncID value 30" },
2040     { 0x804F, "Expected PDSyncData for one subslot with SyncID value 31" },
2041     { 0x8050, "PDInterfaceMrpDataReal for one subslot" },
2042     { 0x8051, "PDInterfaceMrpDataCheck for one subslot" },
2043     { 0x8052, "PDInterfaceMrpDataAdjust for one subslot" },
2044     { 0x8053, "PDPortMrpDataAdjust for one subslot" },
2045     { 0x8054, "PDPortMrpDataReal for one subslot" },
2046     /*0x8055 - 0x805F reserved */
2047     { 0x8060, "PDPortFODataReal for one subslot" },
2048     { 0x8061, "PDPortFODataCheck for one subslot" },
2049     { 0x8062, "PDPortFODataAdjust for one subslot" },
2050     /*0x8063 - 0x806F reserved */
2051     { 0x8070, "PDNCDataCheck for one subslot" },
2052     { 0x8071, "PDInterfaceAdjust for one subslot" },
2053     { 0x8072, "PDPortStatistic for one subslot" },
2054     /*0x8071 - 0x807F reserved */
2055     { 0x8080, "PDInterfaceDataReal" },
2056     /*0x8081 - 0x808F reserved */
2057     { 0x8090, "Expected PDInterfaceFSUDataAdjust" },
2058     /*0x8091 - 0xAFEF reserved except 0x80B0*/
2059     { 0x80B0, "CombinedObjectContainer" },
2060     { 0x80CF, "RS_AdjustObserver" },
2061     { 0xAFF0, "I&M0" },
2062     { 0xAFF1, "I&M1" },
2063     { 0xAFF2, "I&M2" },
2064     { 0xAFF3, "I&M3" },
2065     { 0xAFF4, "I&M4" },
2066     { 0xAFF5, "I&M5" },
2067     { 0xAFF6, "I&M6" },
2068     { 0xAFF7, "I&M7" },
2069     { 0xAFF8, "I&M8" },
2070     { 0xAFF9, "I&M9" },
2071     { 0xAFFA, "I&M10" },
2072     { 0xAFFB, "I&M11" },
2073     { 0xAFFC, "I&M12" },
2074     { 0xAFFD, "I&M13" },
2075     { 0xAFFE, "I&M14" },
2076     { 0xAFFF, "I&M15" },
2077     /*0xB000 - 0xB02D reserved for profiles */
2078     { 0xB000, "Sync-Log / RTA SyncID 0 (GSY)" },
2079     { 0xB001, "Sync-Log / RTA SyncID 1 (GSY)" },
2080     { 0xB002, "reserved for profiles" },
2081     { 0xB003, "reserved for profiles" },
2082     { 0xB004, "reserved for profiles" },
2083     { 0xB005, "reserved for profiles" },
2084     { 0xB006, "reserved for profiles" },
2085     { 0xB007, "reserved for profiles" },
2086     { 0xB008, "reserved for profiles" },
2087     { 0xB009, "reserved for profiles" },
2088     { 0xB00A, "reserved for profiles" },
2089     { 0xB00B, "reserved for profiles" },
2090     { 0xB00C, "reserved for profiles" },
2091     { 0xB00D, "reserved for profiles" },
2092     { 0xB00E, "reserved for profiles" },
2093     { 0xB00F, "reserved for profiles" },
2094     { 0xB010, "reserved for profiles" },
2095     { 0xB011, "reserved for profiles" },
2096     { 0xB012, "reserved for profiles" },
2097     { 0xB013, "reserved for profiles" },
2098     { 0xB014, "reserved for profiles" },
2099     { 0xB015, "reserved for profiles" },
2100     { 0xB016, "reserved for profiles" },
2101     { 0xB017, "reserved for profiles" },
2102     { 0xB018, "reserved for profiles" },
2103     { 0xB019, "reserved for profiles" },
2104     { 0xB01A, "reserved for profiles" },
2105     { 0xB01B, "reserved for profiles" },
2106     { 0xB01C, "reserved for profiles" },
2107     { 0xB01D, "reserved for profiles" },
2108     { 0xB01E, "reserved for profiles" },
2109     { 0xB01F, "reserved for profiles" },
2110     { 0xB020, "reserved for profiles" },
2111     { 0xB021, "reserved for profiles" },
2112     { 0xB022, "reserved for profiles" },
2113     { 0xB023, "reserved for profiles" },
2114     { 0xB024, "reserved for profiles" },
2115     { 0xB025, "reserved for profiles" },
2116     { 0xB026, "reserved for profiles" },
2117     { 0xB027, "reserved for profiles" },
2118     { 0xB028, "reserved for profiles" },
2119     { 0xB029, "reserved for profiles" },
2120     { 0xB02A, "reserved for profiles" },
2121     { 0xB02B, "reserved for profiles" },
2122     { 0xB02C, "reserved for profiles" },
2123     { 0xB02D, "reserved for profiles" },
2124     /* PROFIDrive */
2125     { 0xB02E, "PROFIDrive Parameter Access - Local"},
2126     { 0xB02F, "PROFIDrive Parameter Access - Global"},
2127
2128     /*0xB030 - 0xBFFF reserved for profiles */
2129     { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" },
2130     { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" },
2131
2132     { 0xB060, "EDD Trace Unit (EDD" },
2133     { 0xB061, "EDD Trace Unit (EDD" },
2134
2135     { 0xB070, "OHA Info (OHA)" },
2136
2137
2138     /* slot specific */
2139     { 0xC000, "ExpectedIdentificationData for one slot" },
2140     { 0xC001, "RealIdentificationData for one slot" },
2141     /*0xC002 - 0xC009 reserved */
2142     { 0xC00A, "Diagnosis in channel coding for one slot" },
2143     { 0xC00B, "Diagnosis in all codings for one slot" },
2144     { 0xC00C, "Diagnosis, Maintenance, Qualified and Status for one slot" },
2145     /*0xC00D - 0xC00F reserved */
2146     { 0xC010, "Maintenance required in channel coding for one slot" },
2147     { 0xC011, "Maintenance demanded in channel coding for one slot" },
2148     { 0xC012, "Maintenance required in all codings for one slot" },
2149     { 0xC013, "Maintenance demanded in all codings for one slot" },
2150     /*0xC014 - 0xCFFF reserved */
2151     /*0xD000 - 0xDFFF reserved for profiles */
2152
2153     /* AR specific */
2154     { 0xE000, "ExpectedIdentificationData for one AR" },
2155     { 0xE001, "RealIdentificationData for one AR" },
2156     { 0xE002, "ModuleDiffBlock for one AR" },
2157     /*0xE003 - 0xE009 reserved */
2158     { 0xE00A, "Diagnosis in channel coding for one AR" },
2159     { 0xE00B, "Diagnosis in all codings for one AR" },
2160     { 0xE00C, "Diagnosis, Maintenance, Qualified and Status for one AR" },
2161     /*0xE00D - 0xE00F reserved */
2162     { 0xE010, "Maintenance required in channel coding for one AR" },
2163     { 0xE011, "Maintenance demanded in channel coding for one AR" },
2164     { 0xE012, "Maintenance required in all codings for one AR" },
2165     { 0xE013, "Maintenance demanded in all codings for one AR" },
2166     /*0xE014 - 0xE02F reserved */
2167     { 0xE030, "IsochronousModeData for one AR" },
2168     /*0xE031 - 0xE03F reserved */
2169     { 0xE040, "MultipleWrite" },
2170     /*0xE041 - 0xE04F reserved */
2171     { 0xE050, "ARFSUDataAdjust data for one AR" },
2172     /*0xE051 - 0xE05F reserved */
2173     { 0xE060, "RS_GetEvent (using RecordDataRead service)" },
2174     { 0xE061, "RS_AckEvent (using RecordDataWrite service)" },
2175     /*0xEC00 - 0xEFFF reserved */
2176
2177     /* API specific */
2178     { 0xF000, "RealIdentificationData for one API" },
2179     /*0xF001 - 0xF009 reserved */
2180     { 0xF00A, "Diagnosis in channel coding for one API" },
2181     { 0xF00B, "Diagnosis in all codings for one API" },
2182     { 0xF00C, "Diagnosis, Maintenance, Qualified and Status for one API" },
2183     /*0xF00D - 0xF00F reserved */
2184     { 0xF010, "Maintenance required in channel coding for one API" },
2185     { 0xF011, "Maintenance demanded in channel coding for one API" },
2186     { 0xF012, "Maintenance required in all codings for one API" },
2187     { 0xF013, "Maintenance demanded in all codings for one API" },
2188     /*0xF014 - 0xF01F reserved */
2189     { 0xF020, "ARData for one API" },
2190     /*0xF021 - 0xF3FF reserved */
2191     /*0xF400 - 0xF7FF reserved */
2192
2193     /* device specific */
2194     /*0xF800 - 0xF80B reserved */
2195     { 0xF80C, "Diagnosis, Maintenance, Qualified and Status for one device" },
2196     /*0xF80D - 0xF81F reserved */
2197     { 0xF820, "ARData" },
2198     { 0xF821, "APIData" },
2199     /*0xF822 - 0xF82F reserved */
2200     { 0xF830, "LogData" },
2201     { 0xF831, "PDevData" },
2202     /*0xF832 - 0xF83F reserved */
2203     { 0xF840, "I&M0FilterData" },
2204     { 0xF841, "PDRealData" },
2205     { 0xF842, "PDExpectedData" },
2206     /*0xF843 - 0xF84F reserved */
2207     { 0xF850, "AutoConfigurarion" },
2208     { 0xF880, "AssetManagementData" },
2209     /*0xF851 - 0xFBFF reserved */
2210     /*0xFC00 - 0xFFFF reserved for profiles */
2211     { 0, NULL }
2212 };
2213
2214 static const value_string pn_io_user_structure_identifier[] = {
2215     /*0x0000 - 0x7FFF manufacturer specific */
2216     { 0x8000, "ChannelDiagnosis" },
2217     { 0x8001, "Multiple" },
2218     { 0x8002, "ExtChannelDiagnosis" },
2219     { 0x8003, "QualifiedChannelDiagnosis" },
2220     /*0x8004 - 0x80FF reserved */
2221     { 0x8100, "Maintenance" },
2222     /*0x8101 - 0x8FFF reserved  except 8300, 8301, 8302, 8303 */
2223     { 0x8300, "Sequence of events RS_LowWatermark" },
2224     { 0x8301, "Sequence of events RS_Timeout" },
2225     { 0x8302, "Sequence of events RS_Overflow" },
2226     { 0x8303, "Sequence of events RS_Event" },
2227     /*0x9000 - 0x9FFF reserved for profiles */
2228     /*0xA000 - 0xFFFF reserved */
2229     { 0, NULL }
2230 };
2231
2232 static const value_string pn_io_channel_error_type[] = {
2233     { 0x0000, "reserved" },
2234     { 0x0001, "short circuit" },
2235     { 0x0002, "Undervoltage" },
2236     { 0x0003, "Overvoltage" },
2237     { 0x0004, "Overload" },
2238     { 0x0005, "Overtemperature" },
2239     { 0x0006, "line break" },
2240     { 0x0007, "upper limit value exceeded" },
2241     { 0x0008, "lower limit value exceeded" },
2242     { 0x0009, "Error" },
2243     /*0x000A - 0x000F reserved */
2244     { 0x0010, "parametrization fault" },
2245     { 0x0011, "power supply fault" },
2246     { 0x0012, "fuse blown / open" },
2247     { 0x0013, "Manufacturer specific" },
2248     { 0x0014, "ground fault" },
2249     { 0x0015, "reference point lost" },
2250     { 0x0016, "process event lost / sampling error" },
2251     { 0x0017, "threshold warning" },
2252     { 0x0018, "output disabled" },
2253     { 0x0019, "safety event" },
2254     { 0x001A, "external fault" },
2255     /*0x001B - 0x001F manufacturer specific */
2256     /*0x0020 - 0x00FF reserved for common profiles */
2257     /*0x0100 - 0x7FFF manufacturer specific */
2258     { 0x8000, "Data transmission impossible" },
2259     { 0x8001, "Remote mismatch" },
2260     { 0x8002, "Media redundancy mismatch" },
2261     { 0x8003, "Sync mismatch" },
2262     { 0x8004, "IsochronousMode mismatch" },
2263     { 0x8005, "Multicast CR mismatch" },
2264     { 0x8006, "reserved" },
2265     { 0x8007, "Fiber optic mismatch" },
2266     { 0x8008, "Network component function mismatch" },
2267     { 0x8009, "Time mismatch" },
2268     /* added values for IEC version 2.3: */
2269     { 0x800A, "Dynamic frame packing function mismatch" },
2270     { 0x800B, "Media redundancy with planned duplication mismatch"},
2271     { 0x800C, "System redundancy mismatch"},
2272     /* ends */
2273     /*0x800D - 0x8FFF reserved */
2274     /*0x9000 - 0x9FFF reserved for profile */
2275     /*0xA000 - 0xFFFF reserved */
2276     { 0, NULL }
2277 };
2278     /* ExtChannelErrorType for ChannelErrorType 0 - 0x7FFF */
2279
2280 static const value_string pn_io_ext_channel_error_type0[] = {
2281     /* 0x0000 Reserved */
2282     /* 0x0001 - 0x7FFF Manufacturer specific */
2283     { 0x8000, "Accumulative Info"},
2284     /* 0x8001 - 0x8FFF Reserved */
2285     /* 0x9000 - 0x9FFF Reserved for profiles */
2286     /* 0xA000 - 0xFFFF Reserved */
2287     { 0, NULL }
2288 };
2289
2290
2291     /* ExtChannelErrorType for ChannelErrorType "Data transmission impossible" */
2292 static const value_string pn_io_ext_channel_error_type0x8000[] = {
2293     /* 0x0000 Reserved */
2294     /* 0x0001 - 0x7FFF Manufacturer specific */
2295     { 0x8000, "Link State mismatch - Link down"},
2296     { 0x8001, "MAUType mismatch"},
2297     { 0x8002, "Line Delay mismatch"},
2298     /* 0x8003 - 0x8FFF Reserved */
2299     /* 0x9000 - 0x9FFF Reserved for profiles */
2300     /* 0xA000 - 0xFFFF Reserved */
2301     { 0, NULL }
2302 };
2303
2304     /* ExtChannelErrorType for ChannelErrorType "Remote mismatch" */
2305 static const value_string pn_io_ext_channel_error_type0x8001[] = {
2306     /* 0x0000 Reserved */
2307     /* 0x0001 - 0x7FFF Manufacturer specific */
2308     { 0x8000, "Peer Chassis ID mismatch"},
2309     { 0x8001, "Peer Port ID mismatch"},
2310     { 0x8002, "Peer RT_CLASS_3 mismatch a"},
2311     { 0x8003, "Peer MAUType mismatch"},
2312     { 0x8004, "Peer MRP domain mismatch"},
2313     { 0x8005, "No peer detected"},
2314     { 0x8006, "Reserved"},
2315     { 0x8007, "Peer Line Delay mismatch"},
2316     { 0x8008, "Peer PTCP mismatch b"},
2317     { 0x8009, "Peer Preamble Length mismatch"},
2318     { 0x800A, "Peer Fragmentation mismatch"},
2319     /* 0x800B - 0x8FFF Reserved */
2320     /* 0x9000 - 0x9FFF Reserved for profiles */
2321     /* 0xA000 - 0xFFFF Reserved */
2322     { 0, NULL }
2323 };
2324
2325     /* ExtChannelErrorType for ChannelErrorType "Media redundancy mismatch" 0x8002 */
2326 static const value_string pn_io_ext_channel_error_type0x8002[] = {
2327     /* 0x0000 Reserved */
2328     /* 0x0001 - 0x7FFF Manufacturer specific */
2329     { 0x8000, "Manager role fail MRP-instance 1"},
2330     { 0x8001, "MRP-instance 1 ring open"},
2331     { 0x8002, "Reserved"},
2332     { 0x8003, "Multiple manager MRP-instance 1"},
2333     { 0x8010, "Manager role fail MRP-instance 2"},
2334     { 0x8011, "MRP-instance 2 ring open"},
2335     { 0x8012, "Reserved"},
2336     { 0x8013, "Multiple manager MRP-instance 2"},
2337     { 0x8020, "Manager role fail MRP-instance 3"},
2338     { 0x8021, "MRP-instance 3 ring open"},
2339     { 0x8023, "Multiple manager MRP-instance 3"},
2340     { 0x8030, "Manager role fail MRP-instance 4"},
2341     { 0x8031, "MRP-instance 4 ring open"},
2342     { 0x8033, "Multiple manager MRP-instance 4"},
2343     { 0x8040, "Manager role fail MRP-instance 5"},
2344     { 0x8041, "MRP-instance 5 ring open"},
2345     { 0x8043, "Multiple manager MRP-instance 5"},
2346     { 0x8050, "Manager role fail MRP-instance 6"},
2347     { 0x8051, "MRP-instance 6 ring open"},
2348     { 0x8053, "Multiple manager MRP-instance 6"},
2349     { 0x8060, "Manager role fail MRP-instance 7"},
2350     { 0x8061, "MRP-instance 7 ring open"},
2351     { 0x8063, "Multiple manager MRP-instance 7"},
2352     { 0x8070, "Manager role fail MRP-instance 8"},
2353     { 0x8071, "MRP-instance 8 ring open"},
2354     { 0x8073, "Multiple manager MRP-instance 8"},
2355     { 0x8080, "Manager role fail MRP-instance 9"},
2356     { 0x8081, "MRP-instance 9 ring open"},
2357     { 0x8083, "Multiple manager MRP-instance 9"},
2358     { 0x8090, "Manager role fail MRP-instance 10"},
2359     { 0x8091, "MRP-instance 10 ring open"},
2360     { 0x8093, "Multiple manager MRP-instance 10"},
2361     { 0x80A0, "Manager role fail MRP-instance 11"},
2362     { 0x80A1, "MRP-instance 11 ring open"},
2363     { 0x80A3, "Multiple manager MRP-instance 11"},
2364     { 0x80B0, "Manager role fail MRP-instance 12"},
2365     { 0x80B1, "MRP-instance 12 ring open"},
2366     { 0x80B3, "Multiple manager MRP-instance 12"},
2367     { 0x80C0, "Manager role fail MRP-instance 13"},
2368     { 0x80C1, "MRP-instance 13 ring open"},
2369     { 0x80C3, "Multiple manager MRP-instance 13"},
2370     { 0x80D0, "Manager role fail MRP-instance 14"},
2371     { 0x80D1, "MRP-instance 14 ring open"},
2372     { 0x80D3, "Multiple manager MRP-instance 14"},
2373     { 0x80E0, "Manager role fail MRP-instance 15"},
2374     { 0x80E1, "MRP-instance 15 ring open"},
2375     { 0x80E3, "Multiple manager MRP-instance 15"},
2376     { 0x80F0, "Manager role fail MRP-instance 16"},
2377     { 0x80F1, "MRP-instance 16 ring open"},
2378     { 0x80F3, "Multiple manager MRP-instance 16"},
2379     /* 0x8004 - 0x8FFF Reserved */
2380     /* 0x9000 - 0x9FFF Reserved for profiles */
2381     /* 0xA000 - 0xFFFF Reserved */
2382     { 0, NULL }
2383 };
2384
2385     /* ExtChannelErrorType for ChannelErrorType "Sync mismatch" and for ChannelErrorType "Time mismatch" 0x8003 and 0x8009*/
2386 static const value_string pn_io_ext_channel_error_type0x8003[] = {
2387     /* 0x0000 Reserved */
2388     /* 0x0001 - 0x7FFF Manufacturer specific */
2389     { 0x8000, "No sync message received"},
2390     { 0x8001, "- 0x8002 Reserved"},
2391     { 0x8003, "Jitter out of boundary"},
2392     /* 0x8004 - 0x8FFF Reserved */
2393     /* 0x9000 - 0x9FFF Reserved for profiles */
2394     /* 0xA000 - 0xFFFF Reserved */
2395     { 0, NULL }
2396 };
2397
2398     /*ExtChannelErrorType for ChannelErrorType "Isochronous mode mismatch" 0x8004 */
2399 static const value_string pn_io_ext_channel_error_type0x8004[] = {
2400     /* 0x0000 Reserved */
2401     /* 0x0001 - 0x7FFF Manufacturer specific */
2402     { 0x8000, "Output Time Failure - Output update missing or out of order"},
2403     { 0x8001, "Input Time Failure"},
2404     { 0x8002, "Master Life Sign Failure - Error in MLS update detected"},
2405     /* 0x8003 - 0x8FFF Reserved */
2406     /* 0x9000 - 0x9FFF Reserved for profiles */
2407     /* 0xA000 - 0xFFFF Reserved */
2408     { 0, NULL }
2409 };
2410
2411     /* ExtChannelErrorType for ChannelErrorType "Multicast CR mismatch" 0x8005 */
2412 static const value_string pn_io_ext_channel_error_type0x8005[] = {
2413     /* 0x0000 Reserved */
2414     /* 0x0001 - 0x7FFF Manufacturer specific */
2415     { 0x8000, "Multicast Consumer CR timed out"},
2416     { 0x8001, "Address resolution failed"},
2417     /* 0x8002 - 0x8FFF Reserved */
2418     /* 0x9000 - 0x9FFF Reserved for profiles */
2419     /* 0xA000 - 0xFFFF Reserved */
2420     { 0, NULL }
2421 };
2422
2423     /* ExtChannelErrorType for ChannelErrorType "Fiber optic mismatch" 0x8007*/
2424 static const value_string pn_io_ext_channel_error_type0x8007[] = {
2425     /* 0x0000 Reserved */
2426     /* 0x0001 - 0x7FFF Manufacturer specific */
2427     { 0x8000, "Power Budget"},
2428     /* 0x8001 - 0x8FFF Reserved */
2429     /* 0x9000 - 0x9FFF Reserved for profiles */
2430     /* 0xA000 - 0xFFFF Reserved */
2431     { 0, NULL }
2432 };
2433
2434     /* ExtChannelErrorType for ChannelErrorType "Network component function mismatch" 0x8008 */
2435 static const value_string pn_io_ext_channel_error_type0x8008[] = {
2436     /* 0x0000 Reserved */
2437     /* 0x0001 - 0x7FFF Manufacturer specific */
2438     { 0x8000, "Frame dropped - no resource"},
2439     /* 0x8001 - 0x8FFF Reserved */
2440     /* 0x9000 - 0x9FFF Reserved for profiles */
2441     /* 0xA000 - 0xFFFF Reserved */
2442     { 0, NULL }
2443 };
2444
2445     /* ExtChannelErrorType for ChannelErrorType "Dynamic Frame Packing function mismatch" 0x800A */
2446 static const value_string pn_io_ext_channel_error_type0x800A[] = {
2447     /* 0x0000 Reserved */
2448     /* 0x0001 - 0x7FFF Manufacturer specific */
2449     /* 0x8000 - 0x80FF Reserved */
2450     { 0x8100, "Frame late error for FrameID (0x0100)"},
2451     /* 0x8101 + 0x8FFE See Equation (56) */
2452     { 0x8FFF, "Frame late error for FrameID (0x0FFF)"},
2453     /* 0x8001 - 0x8FFF Reserved */
2454     /* 0x9000 - 0x9FFF Reserved for profiles */
2455     /* 0xA000 - 0xFFFF Reserved */
2456     { 0, NULL }
2457 };
2458
2459     /* ExtChannelErrorType for ChannelErrorType "Media redundancy with planned duplication mismatch" 0x800B */
2460 static const value_string pn_io_ext_channel_error_type0x800B[] = {
2461     /* 0x0000 Reserved */
2462     /* 0x0001 - 0x7FFF Manufacturer specific */
2463     /* 0x8000 - 0x86FF Reserved */
2464     { 0x8700, "MRPD duplication void for FrameID (0x0700)"},
2465     /* 0x8701 + 0x8FFE See Equation (57) */
2466     { 0x8FFF, "MRPD duplication void for FrameID (0x0FFF)"},
2467     /* 0x9000 - 0x9FFF Reserved for profiles */
2468     /* 0xA000 - 0xFFFF Reserved */
2469     { 0, NULL }
2470 };
2471
2472     /* ExtChannelErrorType for ChannelErrorType "System redundancy mismatch" 0x800C */
2473 static const value_string pn_io_ext_channel_error_type0x800C[] = {
2474     /* 0x0000 Reserved */
2475     /* 0x0001 - 0x7FFF Manufacturer specific */
2476     { 0x8000, "System redundancy event"},
2477     /* 0x8001 - 0x8FFF Reserved */
2478     /* 0x9000 - 0x9FFF Reserved for profiles */
2479     /* 0xA000 - 0xFFFF Reserved */
2480     { 0, NULL }
2481 };
2482
2483 static const value_string pn_io_channel_properties_type[] = {
2484     { 0x0000, "submodule or unspecified" },
2485     { 0x0001, "1 Bit" },
2486     { 0x0002, "2 Bit" },
2487     { 0x0003, "4 Bit" },
2488     { 0x0004, "8 Bit" },
2489     { 0x0005, "16 Bit" },
2490     { 0x0006, "32 Bit" },
2491     { 0x0007, "64 Bit" },
2492     /*0x0008 - 0x00FF reserved */
2493     { 0, NULL }
2494 };
2495
2496 static const value_string pn_io_channel_properties_accumulative_vals[] = {
2497     { 0x0000, "Channel" },
2498     { 0x0001, "ChannelGroup" },
2499     { 0, NULL }
2500 };
2501
2502 /* We are reading this as a two bit value, but the spec specifies each bit
2503  * separately. Beware endianness when reading spec
2504  */
2505 static const value_string pn_io_channel_properties_maintenance[] = {
2506     { 0x0000, "Failure" },
2507     { 0x0001, "Maintenance required" },
2508     { 0x0002, "Maintenance demanded" },
2509     { 0x0003, "see QualifiedChannelQualifier" },
2510     { 0, NULL }
2511 };
2512
2513 static const value_string pn_io_channel_properties_specifier[] = {
2514     { 0x0000, "All subsequent disappears" },
2515     { 0x0001, "Appears" },
2516     { 0x0002, "Disappears" },
2517     { 0x0003, "Disappears but others remain" },
2518     { 0, NULL }
2519 };
2520
2521 static const value_string pn_io_channel_properties_direction[] = {
2522     { 0x0000, "Manufacturer-specific" },
2523     { 0x0001, "Input" },
2524     { 0x0002, "Output" },
2525     { 0x0003, "Input/Output" },
2526     /*0x0004 - 0x0007 reserved */
2527     { 0, NULL }
2528 };
2529
2530 static const value_string pn_io_alarmcr_type[] = {
2531     { 0x0000, "reserved" },
2532     { 0x0001, "Alarm CR" },
2533     /*0x0002 - 0xFFFF reserved */
2534     { 0, NULL }
2535 };
2536
2537 static const value_string pn_io_mau_type[] = {
2538     /*0x0000 - 0x0004 reserved */
2539     { 0x0005, "10BASET" },
2540     /*0x0006 - 0x0009 reserved */
2541     { 0x000A, "10BASETXHD" },
2542     { 0x000B, "10BASETXFD" },
2543     { 0x000C, "10BASEFLHD" },
2544     { 0x000D, "10BASEFLFD" },
2545     { 0x000F, "100BASETXHD" },
2546     { 0x0010, "100BASETXFD" },
2547     { 0x0011, "100BASEFXHD" },
2548     { 0x0012, "100BASEFXFD" },
2549     /*0x0013 - 0x0014 reserved */
2550     { 0x0015, "1000BASEXHD" },
2551     { 0x0016, "1000BASEXFD" },
2552     { 0x0017, "1000BASELXHD" },
2553     { 0x0018, "1000BASELXFD" },
2554     { 0x0019, "1000BASESXHD" },
2555     { 0x001A, "1000BASESXFD" },
2556     /*0x001B - 0x001C reserved */
2557     { 0x001D, "1000BASETHD" },
2558     { 0x001E, "1000BASETFD" },
2559     { 0x001F, "10GigBASEFX" },
2560     /*0x0020 - 0x002D reserved */
2561     { 0x002E, "100BASELX10" },
2562     /*0x002F - 0x0035 reserved */
2563     { 0x0036, "100BASEPXFD" },
2564     /*0x0037 - 0xFFFF reserved */
2565     { 0, NULL }
2566 };
2567
2568
2569 static const value_string pn_io_preamble_length[] = {
2570     { 0x0000, "Seven octets Preamble shall be used" },
2571     { 0x0001, "One octet Preamble shall be used" },
2572     /*0x0002 - 0xFFFF reserved */
2573     { 0, NULL }
2574 };
2575
2576 static const value_string pn_io_mau_type_mode[] = {
2577     { 0x0000, "OFF" },
2578     { 0x0001, "ON" },
2579     /*0x0002 - 0xFFFF reserved */
2580     { 0, NULL }
2581 };
2582
2583
2584 static const value_string pn_io_dcp_boundary_value_bit0[] = {
2585     { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-00" },
2586     { 0x01, "Block an outgoing DCP_Identify frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-00" },
2587     { 0, NULL }
2588 };
2589
2590 static const value_string pn_io_dcp_boundary_value_bit1[] = {
2591     { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-01" },
2592     { 0x01, "Block an outgoing DCP_Hello frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-01" },
2593     { 0, NULL }
2594 };
2595
2596 static const value_string pn_io_peer_to_peer_boundary_value_bit0[] = {
2597     { 0x00, "The LLDP agent shall send LLDP frames for this port." },
2598     { 0x01, "The LLDP agent shall not send LLDP frames (egress filter)." },
2599     { 0, NULL }
2600 };
2601
2602 static const value_string pn_io_peer_to_peer_boundary_value_bit1[] = {
2603     { 0x00, "The PTCP ASE shall send PTCP_DELAY request frames for this port." },
2604     { 0x01, "The PTCP ASE shall not send PTCP_DELAY request frames (egress filter)." },
2605     { 0, NULL }
2606 };
2607
2608 static const value_string pn_io_peer_to_peer_boundary_value_bit2[] = {
2609     { 0x00, "The Time ASE shall send PATH_DELAY request frames for this port." },
2610     { 0x01, "The Time ASE shall not send PATH_DELAY request frames (egress filter)." },
2611     { 0, NULL }
2612 };
2613
2614 static const range_string pn_io_mau_type_extension[] = {
2615     { 0x0000, 0x0000, "No SubMAUType" },
2616     { 0x0001, 0x00FF, "Reserved" },
2617     { 0x0100, 0x0100, "POF" },
2618     { 0x0101, 0xFFEF, "Reserved for SubMAUType" },
2619     { 0xFFF0, 0xFFFF, "Reserved" },
2620     { 0, 0, NULL }
2621 };
2622
2623
2624 static const value_string pn_io_port_state[] = {
2625     { 0x0000, "reserved" },
2626     { 0x0001, "up" },
2627     { 0x0002, "down" },
2628     { 0x0003, "testing" },
2629     { 0x0004, "unknown" },
2630     /*0x0005 - 0xFFFF reserved */
2631     { 0, NULL }
2632 };
2633
2634
2635 static const value_string pn_io_media_type[] = {
2636     { 0x0000, "Unknown" },
2637     { 0x0001, "Copper cable" },
2638     { 0x0002, "Fiber optic cable" },
2639     { 0x0003, "Radio communication" },
2640     /*0x0004 - 0xFFFF reserved */
2641     { 0, NULL }
2642 };
2643
2644
2645 static const value_string pn_io_fiber_optic_type[] = {
2646     { 0x0000, "No fiber type adjusted" },
2647     { 0x0001, "9 um single mode fiber" },
2648     { 0x0002, "50 um multi mode fiber" },
2649     { 0x0003, "62,5 um multi mode fiber" },
2650     { 0x0004, "SI-POF, NA=0.5" },
2651     { 0x0005, "SI-PCF, NA=0.36" },
2652     { 0x0006, "LowNA-POF, NA=0.3" },
2653     { 0x0007, "GI-POF" },
2654     /*0x0008 - 0xFFFF reserved */
2655     { 0, NULL }
2656 };
2657
2658
2659 static const value_string pn_io_fiber_optic_cable_type[] = {
2660     { 0x0000, "No cable specified" },
2661     { 0x0001, "Inside/outside cable, fixed installation" },
2662     { 0x0002, "Inside/outside cable, flexible installation" },
2663     { 0x0003, "Outdoor cable, fixed installation" },
2664     /*0x0004 - 0xFFFF reserved */
2665     { 0, NULL }
2666 };
2667
2668 static const value_string pn_io_im_revision_prefix_vals[] = {
2669     { 'V', "V - Officially released version" },
2670     { 'R', "R - Revision" },
2671     { 'P', "P - Prototype" },
2672     { 'U', "U - Under Test (Field Test)" },
2673     { 'T', "T - Test Device" },
2674     /*all others reserved */
2675     { 0, NULL }
2676 };
2677
2678
2679 static const value_string pn_io_mrp_role_vals[] = {
2680     { 0x0000, "Media Redundancy disabled" },
2681     { 0x0001, "Media Redundancy Client" },
2682     { 0x0002, "Media Redundancy Manager" },
2683     /*all others reserved */
2684     { 0, NULL }
2685 };
2686
2687 static const value_string pn_io_mrp_instance_no[] = {
2688     { 0x0000, "MRP_Instance 1" },
2689     { 0x0001, "MRP_Instance 2" },
2690     { 0x0002, "MRP_Instance 3" },
2691     { 0x0003, "MRP_Instance 4" },
2692     { 0x0004, "MRP_Instance 5" },
2693     { 0x0005, "MRP_Instance 6" },
2694     { 0x0006, "MRP_Instance 7" },
2695     { 0x0007, "MRP_Instance 8" },
2696     { 0x0008, "MRP_Instance 9" },
2697     { 0x0009, "MRP_Instance 10" },
2698     { 0x000A, "MRP_Instance 11" },
2699     { 0x000B, "MRP_Instance 12" },
2700     { 0x000C, "MRP_Instance 13" },
2701     { 0x000D, "MRP_Instance 14" },
2702     { 0x000E, "MRP_Instance 15" },
2703     { 0x000F, "MRP_Instance 16" },
2704     /*all others reserved */
2705     { 0, NULL }
2706 };
2707
2708 static const value_string pn_io_mrp_mrm_on[] = {
2709     { 0x0000, "Disable MediaRedundancyManager diagnosis" },
2710     { 0x0001, "Enable MediaRedundancyManager diagnosis"},
2711     { 0, NULL }
2712 };
2713 static const value_string pn_io_mrp_checkUUID[] = {
2714     { 0x0000, "Disable the check of the MRP_DomainUUID" },
2715     { 0x0001, "Enable the check of the MRP_DomainUUID"},
2716     { 0, NULL }
2717 };
2718
2719 static const value_string pn_io_mrp_prio_vals[] = {
2720     { 0x0000, "Highest priority redundancy manager" },
2721     /* 0x1000 - 0x7000 High priorities */
2722     { 0x8000, "Default priority for redundancy manager" },
2723     /* 0x9000 - 0xE000 Low priorities */
2724     { 0xF000, "Lowest priority redundancy manager" },
2725     /*all others reserved */
2726     { 0, NULL }
2727 };
2728
2729 static const value_string pn_io_mrp_rtmode_rtclass12_vals[] = {
2730     { 0x0000, "RT_CLASS_1 and RT_CLASS_2 redundancy mode deactivated" },
2731     { 0x0001, "RT_CLASS_1 and RT_CLASS_2 redundancy mode activated" },
2732     { 0, NULL }
2733 };
2734
2735 static const value_string pn_io_mrp_rtmode_rtclass3_vals[] = {
2736     { 0x0000, "RT_CLASS_3 redundancy mode deactivated" },
2737     { 0x0001, "RT_CLASS_3 redundancy mode activated" },
2738     { 0, NULL }
2739 };
2740
2741 static const value_string pn_io_mrp_ring_state_vals[] = {
2742     { 0x0000, "Ring open" },
2743     { 0x0001, "Ring closed" },
2744     { 0, NULL }
2745 };
2746
2747 static const value_string pn_io_mrp_rt_state_vals[] = {
2748     { 0x0000, "RT media redundancy lost" },
2749     { 0x0001, "RT media redundancy available" },
2750     { 0, NULL }
2751 };
2752
2753 static const value_string pn_io_control_properties_vals[] = {
2754     { 0x0000, "Reserved" },
2755     { 0, NULL }
2756 };
2757
2758 static const value_string pn_io_control_properties_prmbegin_vals[] = {
2759     { 0x0000, "No PrmBegin" },
2760     { 0x0001, "The IO controller starts the transmisson of the stored start-up parameter" },
2761     { 0, NULL }
2762 };
2763 static const value_string pn_io_control_properties_application_ready_vals[] = {
2764     { 0x0000, "Wait for explicit ControlCommand.ReadyForCompanion" },
2765     { 0x0001, "Implicit ControlCommand.ReadyForCompanion" },
2766     { 0, NULL }
2767 };
2768
2769 static const value_string pn_io_fs_hello_mode_vals[] = {
2770     { 0x0000, "OFF" },
2771     { 0x0001, "Send req on LinkUp" },
2772     { 0x0002, "Send req on LinkUp after HelloDelay" },
2773     { 0, NULL }
2774 };
2775
2776 static const value_string pn_io_fs_parameter_mode_vals[] = {
2777     { 0x0000, "OFF" },
2778     { 0x0001, "ON" },
2779     { 0x0002, "Reserved" },
2780     { 0x0003, "Reserved" },
2781     { 0, NULL }
2782 };
2783
2784 static const value_string pn_io_frame_details_sync_master_vals[] = {
2785     { 0x0000, "No Sync Frame" },
2786     { 0x0001, "Primary sync frame" },
2787     { 0x0002, "Secondary sync frame" },
2788     { 0x0003, "Reserved" },
2789     { 0, NULL }
2790 };
2791 static const value_string pn_io_frame_details_meaning_frame_send_offset_vals[] = {
2792     { 0x0000, "Field FrameSendOffset specifies the point of time for receiving or transmitting a frame " },
2793     { 0x0001, "Field FrameSendOffset specifies the beginning of the RT_CLASS_3 interval within a phase" },
2794     { 0x0002, "Field FrameSendOffset specifies the ending of the RT_CLASS_3 interval within a phase" },
2795     { 0x0003, "Reserved" },
2796     { 0, NULL }
2797 };
2798
2799 static const value_string pn_io_f_check_seqnr[] = {
2800     { 0x00, "consecutive number not included in crc" },
2801     { 0x01, "consecutive number included in crc" },
2802     { 0, NULL }
2803 };
2804
2805 static const value_string pn_io_f_check_ipar[] = {
2806     { 0x00, "no check" },
2807     { 0x01, "check" },
2808     { 0, NULL }
2809 };
2810
2811 static const value_string pn_io_f_sil[] = {
2812     { 0x00, "SIL1" },
2813     { 0x01, "SIL2" },
2814     { 0x02, "SIL3" },
2815     { 0x03, "NoSIL" },
2816     { 0, NULL }
2817 };
2818
2819 static const value_string pn_io_f_crc_len[] = {
2820     { 0x00, "3 octet CRC" },
2821     { 0x01, "2 octet CRC" },
2822     { 0x02, "4 octet CRC" },
2823     { 0x03, "reserved" },
2824     { 0, NULL }
2825 };
2826
2827 static const value_string pn_io_f_crc_seed[] = {
2828     { 0x00, "CRC-FP as seed value and counter" },
2829     { 0x01, "'1' as seed value and CRC-FP+/MNR" },
2830     { 0, NULL }
2831 };
2832
2833 /* F_Block_ID dissection due to ver2.6 specifikation of PI */
2834 static const value_string pn_io_f_block_id[] = {
2835     { 0x00, "No F_WD_Time_2, no F_iPar_CRC" },
2836     { 0x01, "No F_WD_Time_2, F_iPar_CRC" },
2837     { 0x02, "F_WD_Time_2, no F_iPar_CRC" },
2838     { 0x03, "F_WD_Time_2, F_iPar_CRC" },
2839     /* 0x04..0x07 reserved */
2840     /* { 0x00, "Parameter set for F-Host/F-Device relationship" }, */
2841     /* { 0x01, "Additional F_Address parameter block" }, */
2842     /* 0x02..0x07 reserved */
2843     { 0, NULL }
2844 };
2845
2846 static const value_string pn_io_f_par_version[] = {
2847     { 0x00, "Valid for V1-mode" },
2848     { 0x01, "Valid for V2-mode" },
2849     /* 0x02..0x03 reserved */
2850     { 0, NULL }
2851 };
2852
2853 static const value_string pn_io_profidrive_request_id_vals[] = {
2854     { 0x00, "Reserved" },
2855     { 0x01, "Read request" },
2856     { 0x02, "Change request" },
2857     { 0, NULL }
2858 };
2859
2860 static const value_string pn_io_profidrive_response_id_vals[] = {
2861     { 0x00, "Reserved" },
2862     { 0x01, "Positive read response" },
2863     { 0x02, "Positive change response" },
2864     { 0x81, "Negative read response" },
2865     { 0x82, "Negative change response" },
2866     { 0, NULL }
2867 };
2868
2869 static const value_string pn_io_profidrive_attribute_vals[] = {
2870     { 0x00, "Reserved" },
2871     { 0x10, "Value" },
2872     { 0x20, "Description" },
2873     { 0x30, "Text" },
2874     { 0, NULL }
2875 };
2876
2877 static const value_string pn_io_profidrive_format_vals[] = {
2878     {0x01, "Boolean" },
2879     {0x02, "Integer8" },
2880     {0x03, "Integer16" },
2881     {0x04, "Integer32" },
2882     {0x05, "Unsigned8" },
2883     {0x06, "Unsigned16" },
2884     {0x07, "Unsigned32" },
2885     {0x08, "Float32" },
2886     {0x09, "VisibleString" },
2887     {0x0A, "OctetString" },
2888     {0x0C, "TimeOfDay" },
2889     {0x0D, "TimeDifference" },
2890     {0x32, "Date" },
2891     {0x34, "TimeOfDay" },
2892     {0x35, "TimeDifference" },
2893     {0x36, "TimeDifference" },
2894     { 0, NULL }
2895 };
2896
2897 static const range_string pn_io_rs_block_type[] = {
2898     /* Following ranges are used for events */
2899     { 0x0000, 0x0000, "reserved" },
2900     { 0x0001, 0x3FFF, "Manufacturer specific" },
2901     { 0x4000, 0x4000, "Stop observer - Observer Status Observer" },
2902     { 0x4001, 0x4001, "Buffer observer - RS_BufferObserver" },
2903     { 0x4002, 0x4002, "Time status observer - RS_TimeStatus" },
2904     { 0x4003, 0x4003, "System redundancy layer observer - RS_SRLObserver" },
2905     { 0x4004, 0x4004, "Source identification observer - RS_SourceIdentification" },
2906     { 0x4005, 0x400F, "reserved" },
2907     { 0x4010, 0x4010, "Digital input observer - SoE_DigitalInputObserver" },
2908     { 0x4011, 0x6FFF, "Reserved for normative usage" },
2909     { 0x7000, 0x7FFF, "Reserved for profile usage" },
2910     /* Following ranges are used for adjust */
2911     { 0x8000, 0x8000, "reserved" },
2912     { 0x8001, 0xBFFF, "Manufacturer specific" },
2913     { 0xC000, 0xC00F, "Reserved for normative usage" },
2914     { 0xC010, 0xC010, "Digital input observer - SoE_DigitalInputObserver" },
2915     { 0xC011, 0xEFFF, "Reserved for normative usage"},
2916     { 0xF000, 0xFFFF, "Reserved for profile usage"},
2917     { 0, 0, NULL }
2918 };
2919
2920 static const value_string pn_io_rs_specifier_specifier[] = {
2921     { 0x0, "Current value" },
2922     { 0x1, "Appears" },
2923     { 0x2, "Disappears" },
2924     { 0x3, "Reserved" },
2925     { 0, NULL }
2926 };
2927
2928 static const value_string pn_io_rs_time_stamp_status[] = {
2929     { 0x0, "TimeStamp related to global synchronized time" },
2930     { 0x1, "TimeStamp related to local time" },
2931     { 0x2, "TimeStamp related to local (arbitrary timescale) time" },
2932     { 0, NULL }
2933 };
2934
2935 static const value_string pn_io_rs_reason_code_reason[] = {
2936     { 0x00000000, "Reserved" },
2937     { 0x00000001, "Observed data status unclear" },
2938     { 0x00000002, "Buffer overrun" },
2939     /* 0x0003 - 0xFFFF Reserved */
2940     { 0, NULL }
2941 };
2942
2943 static const value_string pn_io_rs_reason_code_detail[] = {
2944     { 0x00000000, "No Detail" },
2945     /* 0x0001 - 0xFFFF Reserved */
2946     { 0, NULL }
2947 };
2948
2949 static const value_string pn_io_soe_digital_input_current_value_value[] = {
2950     { 0x0, "Digital input is zero" },
2951     { 0x1, "Digital input is one" },
2952     { 0, NULL }
2953 };
2954
2955 static const value_string pn_io_soe_adjust_specifier_incident[] = {
2956     { 0x00, "Reserved" },
2957     { 0x01, "Rising edge" },
2958     { 0x02, "Falling edge" },
2959     { 0x03, "Reserved" },
2960     { 0, NULL }
2961 };
2962
2963 static const value_string pn_io_rs_properties_alarm_transport[] = {
2964     { 0x00000000, "Default Reporting system events need to be read by record " },
2965     { 0x00000001, "Reporting system events shall be forwarded to the IOC using the alarm transport" },
2966     { 0, NULL }
2967 };
2968
2969 static const value_string pn_io_am_location_structure_vals[] = {
2970     { 0x00, "Reserved" },
2971     { 0x01, "Twelve level tree format" },
2972     { 0x02, "Slot - and SubslotNumber format" },
2973     { 0, NULL }
2974 };
2975
2976 static const range_string pn_io_am_location_level_vals[] = {
2977     { 0x0000, 0x03FE, "Address information to identify a reported node" },
2978     { 0x03FF, 0x03FF, "Level not used" },
2979     { 0, 0, NULL }
2980 };
2981
2982 static const value_string pn_io_am_location_reserved_vals[] = {
2983     { 0x00, "Reserved" },
2984     { 0, NULL }
2985 };
2986
2987 static const range_string pn_io_RedundancyDataHoldFactor[] = {
2988     { 0x0000, 0x0002, "Reserved" },
2989     { 0x0003, 0x00C7, "Optional - An expiration of the time leads to an AR termination." },
2990     { 0x00C8, 0xFFFF, "Mandatory - An expiration of the time leads to an AR termination." },
2991     { 0, 0, NULL }
2992 };
2993
2994 static const value_string pn_io_ar_arnumber[] = {
2995     { 0x0000, "reserved" },
2996     { 0x0001, "1st AR of an ARset" },
2997     { 0x0002, "2nd AR of an ARset" },
2998     { 0x0003, "3rd AR of an ARset" },
2999     { 0x0004, "4th AR of an ARset" },
3000     /*0x0005 - 0xFFFF reserved */
3001     { 0, NULL }
3002 };
3003
3004 static const value_string pn_io_ar_arresource[] = {
3005     { 0x0000, "reserved" },
3006     { 0x0002, "Communication endpoint shall allocate two ARs for the ARset" },
3007     /*0x0001 and 0x0003 - 0xFFFF reserved */
3008     { 0, NULL }
3009 };
3010
3011 static const range_string pn_io_line_delay_value[] = {
3012     { 0x00000000, 0x00000000, "Line delay and cable delay unknown" },
3013     { 0x00000001, 0x7FFFFFFF, "Line delay in nanoseconds" },
3014     { 0, 0, NULL }
3015 };
3016
3017 static const range_string pn_io_cable_delay_value[] = {
3018     { 0x00000000, 0x00000000, "Reserved" },
3019     { 0x00000001, 0x7FFFFFFF, "Cable delay in nanoseconds" },
3020     { 0, 0, NULL }
3021 };
3022
3023 static const true_false_string pn_io_pdportstatistic_counter_status_contents = {
3024     "The contents of the field are invalid. They shall be set to zero.",
3025     "The contents of the field are valid"
3026 };
3027
3028 static const value_string pn_io_pdportstatistic_counter_status_reserved[] = {
3029     { 0x00, "Reserved" },
3030     { 0, NULL }
3031 };
3032
3033 static int
3034 dissect_profidrive_value(tvbuff_t *tvb, gint offset, packet_info *pinfo,
3035                          proto_tree *tree, guint8 *drep, guint8 format_val)
3036 {
3037     guint32 value32;
3038     guint16 value16;
3039     guint8  value8;
3040
3041     switch(format_val)
3042     {
3043     case 1:
3044     case 2:
3045     case 5:
3046         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3047             hf_pn_io_profidrive_param_value_byte, &value8);
3048         break;
3049     case 3:
3050     case 6:
3051         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3052             hf_pn_io_profidrive_param_value_word, &value16);
3053         break;
3054     case 4:
3055     case 7:
3056         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3057             hf_pn_io_profidrive_param_value_dword, &value32);
3058         break;
3059     case 8:
3060         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3061             hf_pn_io_profidrive_param_value_float, &value32);
3062         break;
3063     case 9:
3064     case 0x0A:
3065         {
3066             gint sLen;
3067             sLen = (gint)tvb_strnlen( tvb, offset, -1);
3068             proto_tree_add_item(tree, hf_pn_io_profidrive_param_value_string, tvb, offset, sLen, ENC_ASCII|ENC_NA);
3069             offset = (offset + sLen);
3070             break;
3071         }
3072     default:
3073         offset = offset + 1;
3074         expert_add_info_format(pinfo, tree, &ei_pn_io_unsupported, "Not supported or invalid format %u!", format_val);
3075         break;
3076     }
3077     return(offset);
3078 }
3079
3080 static GList *pnio_ars;
3081
3082 typedef struct pnio_ar_s {
3083     /* generic */
3084     e_guid_t     aruuid;
3085     guint16      inputframeid;
3086     guint16      outputframeid;
3087
3088     /* controller only */
3089     /*const char      controllername[33];*/
3090     const guint8 controllermac[6];
3091     guint16      controlleralarmref;
3092
3093     /* device only */
3094     const guint8 devicemac[6];
3095     guint16      devicealarmref;
3096     guint16      arType;
3097 } pnio_ar_t;
3098
3099
3100
3101 static void
3102 pnio_ar_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pnio_ar_t *ar)
3103 {
3104     p_add_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0, ar );
3105     p_add_proto_data(pinfo->pool, pinfo, proto_pn_io, 0, GUINT_TO_POINTER(10));
3106
3107     if (tree) {
3108         proto_item *item;
3109         proto_item *sub_item;
3110         proto_tree *sub_tree;
3111         address   controllermac_addr, devicemac_addr;
3112
3113         set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
3114         set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
3115
3116         sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_pn_io_ar_info, &sub_item,
3117             "ARUUID:%s ContrMAC:%s ContrAlRef:0x%x DevMAC:%s DevAlRef:0x%x InCR:0x%x OutCR=0x%x",
3118             guid_to_str(wmem_packet_scope(), (const e_guid_t*) &ar->aruuid),
3119             address_to_str(wmem_packet_scope(), &controllermac_addr), ar->controlleralarmref,
3120             address_to_str(wmem_packet_scope(), &devicemac_addr), ar->devicealarmref,
3121             ar->inputframeid, ar->outputframeid);
3122         PROTO_ITEM_SET_GENERATED(sub_item);
3123
3124         item = proto_tree_add_guid(sub_tree, hf_pn_io_ar_uuid, tvb, 0, 0, (e_guid_t *) &ar->aruuid);
3125         PROTO_ITEM_SET_GENERATED(item);
3126
3127         item = proto_tree_add_ether(sub_tree, hf_pn_io_cminitiator_macadd, tvb, 0, 0, ar->controllermac);
3128         PROTO_ITEM_SET_GENERATED(item);
3129         item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->controlleralarmref);
3130         PROTO_ITEM_SET_GENERATED(item);
3131
3132         item = proto_tree_add_ether(sub_tree, hf_pn_io_cmresponder_macadd, tvb, 0, 0, ar->devicemac);
3133         PROTO_ITEM_SET_GENERATED(item);
3134         item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->devicealarmref);
3135         PROTO_ITEM_SET_GENERATED(item);
3136
3137         item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->inputframeid);
3138         PROTO_ITEM_SET_GENERATED(item);
3139         item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->outputframeid);
3140         PROTO_ITEM_SET_GENERATED(item);
3141     }
3142 }
3143
3144
3145
3146
3147 static int dissect_block(tvbuff_t *tvb, int offset,
3148     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar);
3149
3150 static int dissect_a_block(tvbuff_t *tvb, int offset,
3151     packet_info *pinfo, proto_tree *tree, guint8 *drep);
3152
3153 static int dissect_blocks(tvbuff_t *tvb, int offset,
3154     packet_info *pinfo, proto_tree *tree, guint8 *drep);
3155
3156 static int dissect_PNIO_IOxS(tvbuff_t *tvb, int offset,
3157     packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex);
3158
3159
3160
3161
3162
3163 static pnio_ar_t *
3164 pnio_ar_find_by_aruuid(packet_info *pinfo _U_, e_guid_t *aruuid)
3165 {
3166     GList     *ars;
3167     pnio_ar_t *ar;
3168
3169
3170     /* find pdev */
3171     for(ars = pnio_ars; ars != NULL; ars = g_list_next(ars)) {
3172         ar = (pnio_ar_t *)ars->data;
3173
3174         if (memcmp(&ar->aruuid, aruuid, sizeof(e_guid_t)) == 0) {
3175             return ar;
3176         }
3177     }
3178
3179     return NULL;
3180 }
3181
3182
3183 static pnio_ar_t *
3184 pnio_ar_new(e_guid_t *aruuid)
3185 {
3186     pnio_ar_t *ar;
3187
3188
3189     ar = (pnio_ar_t *)wmem_alloc0(wmem_file_scope(), sizeof(pnio_ar_t));
3190
3191     memcpy(&ar->aruuid, aruuid, sizeof(e_guid_t));
3192
3193     ar->controlleralarmref  = 0xffff;
3194     ar->devicealarmref      = 0xffff;
3195
3196     pnio_ars = g_list_append(pnio_ars, ar);
3197
3198     return ar;
3199 }
3200
3201
3202
3203 /* dissect the four status (error) fields */
3204 static int
3205 dissect_PNIO_status(tvbuff_t *tvb, int offset,
3206     packet_info *pinfo, proto_tree *tree, guint8 *drep)
3207 {
3208     guint8  u8ErrorCode;
3209     guint8  u8ErrorDecode;
3210     guint8  u8ErrorCode1;
3211     guint8  u8ErrorCode2;
3212
3213     proto_item *sub_item;
3214     proto_tree *sub_tree;
3215     guint32     u32SubStart;
3216     int         bytemask = (drep[0] & DREP_LITTLE_ENDIAN) ? 3 : 0;
3217
3218     const value_string *error_code1_vals;
3219     const value_string *error_code2_vals = pn_io_error_code2;   /* defaults */
3220
3221
3222
3223     /* status */
3224     sub_item = proto_tree_add_item(tree, hf_pn_io_status, tvb, offset, 0, ENC_NA);
3225     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_status);
3226     u32SubStart = offset;
3227
3228     /* the PNIOStatus field is existing in both the RPC and the application data,
3229      * depending on the current PDU.
3230      * As the byte representation of these layers are different, this has to be handled
3231      * in a somewhat different way than elsewhere. */
3232
3233     dissect_dcerpc_uint8(tvb, offset+(0^bytemask), pinfo, sub_tree, drep,
3234                          hf_pn_io_error_code, &u8ErrorCode);
3235     dissect_dcerpc_uint8(tvb, offset+(1^bytemask), pinfo, sub_tree, drep,
3236                          hf_pn_io_error_decode, &u8ErrorDecode);
3237
3238     switch (u8ErrorDecode) {
3239     case(0x80): /* PNIORW */
3240         dissect_dcerpc_uint8(tvb, offset+(2^bytemask), pinfo, sub_tree, drep,
3241                              hf_pn_io_error_code1_pniorw, &u8ErrorCode1);
3242         error_code1_vals = pn_io_error_code1_pniorw;
3243
3244         /* u8ErrorCode2 for PNIORW is always user specific */
3245         dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3246                              hf_pn_io_error_code2_pniorw, &u8ErrorCode2);
3247
3248         error_code2_vals = pn_io_error_code2_pniorw;
3249
3250         break;
3251     case(0x81): /* PNIO */
3252         dissect_dcerpc_uint8(tvb, offset+(2^bytemask), pinfo, sub_tree, drep,
3253                              hf_pn_io_error_code1_pnio, &u8ErrorCode1);
3254         error_code1_vals = pn_io_error_code1_pnio;
3255
3256         switch (u8ErrorCode1) {
3257         case(1):
3258             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3259                                  hf_pn_io_error_code2_pnio_1, &u8ErrorCode2);
3260             error_code2_vals = pn_io_error_code2_pnio_1;
3261             break;
3262         case(2):
3263             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3264                                  hf_pn_io_error_code2_pnio_2, &u8ErrorCode2);
3265             error_code2_vals = pn_io_error_code2_pnio_2;
3266             break;
3267         case(3):
3268             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3269                                  hf_pn_io_error_code2_pnio_3, &u8ErrorCode2);
3270             error_code2_vals = pn_io_error_code2_pnio_3;
3271             break;
3272         case(4):
3273             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3274                                  hf_pn_io_error_code2_pnio_4, &u8ErrorCode2);
3275             error_code2_vals = pn_io_error_code2_pnio_4;
3276             break;
3277         case(5):
3278             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3279                                  hf_pn_io_error_code2_pnio_5, &u8ErrorCode2);
3280             error_code2_vals = pn_io_error_code2_pnio_5;
3281             break;
3282         case(6):
3283             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3284                                  hf_pn_io_error_code2_pnio_6, &u8ErrorCode2);
3285             error_code2_vals = pn_io_error_code2_pnio_6;
3286             break;
3287         case(7):
3288             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3289                                  hf_pn_io_error_code2_pnio_7, &u8ErrorCode2);
3290             error_code2_vals = pn_io_error_code2_pnio_7;
3291             break;
3292         case(8):
3293             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3294                                  hf_pn_io_error_code2_pnio_8, &u8ErrorCode2);
3295             error_code2_vals = pn_io_error_code2_pnio_8;
3296             break;
3297         case(13):
3298             dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep,
3299                                  hf_pn_io_error_code2_pnio_13, &u8ErrorCode2);
3300             error_code2_vals = pn_io_error_code2_pnio_13;
3301             break;
3302         case(20):
3303             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3304                                  hf_pn_io_error_code2_pnio_20, &u8ErrorCode2);
3305             error_code2_vals = pn_io_error_code2_pnio_20;
3306             break;
3307         case(21):
3308             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3309                                  hf_pn_io_error_code2_pnio_21, &u8ErrorCode2);
3310             error_code2_vals = pn_io_error_code2_pnio_21;
3311             break;
3312         case(22):
3313             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3314                                  hf_pn_io_error_code2_pnio_22, &u8ErrorCode2);
3315             error_code2_vals = pn_io_error_code2_pnio_22;
3316             break;
3317         case(23):
3318             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3319                                  hf_pn_io_error_code2_pnio_23, &u8ErrorCode2);
3320             error_code2_vals = pn_io_error_code2_pnio_23;
3321             break;
3322         case(40):
3323             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3324                                  hf_pn_io_error_code2_pnio_40, &u8ErrorCode2);
3325             error_code2_vals = pn_io_error_code2_pnio_40;
3326             break;
3327         case(60) :
3328             dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep,
3329                                  hf_pn_io_error_code2_pnio_60, &u8ErrorCode2);
3330             error_code2_vals = pn_io_error_code2_pnio_60;
3331             break;
3332         case(61):
3333             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3334                                  hf_pn_io_error_code2_pnio_61, &u8ErrorCode2);
3335             error_code2_vals = pn_io_error_code2_pnio_61;
3336             break;
3337         case(62):
3338             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3339                                  hf_pn_io_error_code2_pnio_62, &u8ErrorCode2);
3340             error_code2_vals = pn_io_error_code2_pnio_62;
3341             break;
3342         case(63):
3343             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3344                                  hf_pn_io_error_code2_pnio_63, &u8ErrorCode2);
3345             error_code2_vals = pn_io_error_code2_pnio_63;
3346             break;
3347         case(64):
3348             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3349                                  hf_pn_io_error_code2_pnio_64, &u8ErrorCode2);
3350             error_code2_vals = pn_io_error_code2_pnio_64;
3351             break;
3352         case(65):
3353             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3354                                  hf_pn_io_error_code2_pnio_65, &u8ErrorCode2);
3355             error_code2_vals = pn_io_error_code2_pnio_65;
3356             break;
3357         case(66):
3358             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3359                                  hf_pn_io_error_code2_pnio_66, &u8ErrorCode2);
3360             error_code2_vals = pn_io_error_code2_pnio_66;
3361             break;
3362         case(70):
3363             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3364                                  hf_pn_io_error_code2_pnio_70, &u8ErrorCode2);
3365             error_code2_vals = pn_io_error_code2_pnio_70;
3366             break;
3367         case(71):
3368             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3369                                  hf_pn_io_error_code2_pnio_71, &u8ErrorCode2);
3370             error_code2_vals = pn_io_error_code2_pnio_71;
3371             break;
3372         case(72):
3373             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3374                                  hf_pn_io_error_code2_pnio_72, &u8ErrorCode2);
3375             error_code2_vals = pn_io_error_code2_pnio_72;
3376             break;
3377         case(73):
3378             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3379                                  hf_pn_io_error_code2_pnio_73, &u8ErrorCode2);
3380             error_code2_vals = pn_io_error_code2_pnio_73;
3381             break;
3382         case(74):
3383             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3384                                  hf_pn_io_error_code2_pnio_74, &u8ErrorCode2);
3385             error_code2_vals = pn_io_error_code2_pnio_74;
3386             break;
3387         case(75):
3388             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3389                                  hf_pn_io_error_code2_pnio_75, &u8ErrorCode2);
3390             error_code2_vals = pn_io_error_code2_pnio_75;
3391             break;
3392         case(76):
3393             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3394                                  hf_pn_io_error_code2_pnio_76, &u8ErrorCode2);
3395             error_code2_vals = pn_io_error_code2_pnio_76;
3396             break;
3397         case(77):
3398             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3399                                  hf_pn_io_error_code2_pnio_77, &u8ErrorCode2);
3400             error_code2_vals = pn_io_error_code2_pnio_77;
3401             break;
3402         case(253):
3403             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3404                                  hf_pn_io_error_code2_pnio_253, &u8ErrorCode2);
3405             error_code2_vals = pn_io_error_code2_pnio_253;
3406             break;
3407         case(255):
3408             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3409                                  hf_pn_io_error_code2_pnio_255, &u8ErrorCode2);
3410             error_code2_vals = pn_io_error_code2_pnio_255;
3411             break;
3412         default:
3413             /* don't know this u8ErrorCode1 for PNIO, use defaults */
3414             dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3415                                  hf_pn_io_error_code2, &u8ErrorCode2);
3416             expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code1, "Unknown ErrorCode1 0x%x (for ErrorDecode==PNIO)", u8ErrorCode1);
3417             break;
3418         }
3419         break;
3420     default:
3421         dissect_dcerpc_uint8(tvb, offset+(2^bytemask), pinfo, sub_tree, drep,
3422                              hf_pn_io_error_code1, &u8ErrorCode1);
3423         if (u8ErrorDecode!=0) {
3424             expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code1, "Unknown ErrorDecode 0x%x", u8ErrorDecode);
3425         }
3426         error_code1_vals = pn_io_error_code1;
3427
3428         /* don't know this u8ErrorDecode, use defaults */
3429         dissect_dcerpc_uint8(tvb, offset+(3^bytemask), pinfo, sub_tree, drep,
3430                              hf_pn_io_error_code2, &u8ErrorCode2);
3431         if (u8ErrorDecode != 0) {
3432             expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code2, "Unknown ErrorDecode 0x%x", u8ErrorDecode);
3433         }
3434     }
3435
3436     offset += 4;
3437
3438     if ((u8ErrorCode == 0) && (u8ErrorDecode == 0) && (u8ErrorCode1 == 0) && (u8ErrorCode2 == 0)) {
3439         proto_item_append_text(sub_item, ": OK");
3440         col_append_str(pinfo->cinfo, COL_INFO, ", OK");
3441     } else {
3442         proto_item_append_text(sub_item, ": Error: \"%s\", \"%s\", \"%s\", \"%s\"",
3443             val_to_str(u8ErrorCode, pn_io_error_code, "(0x%x)"),
3444             val_to_str(u8ErrorDecode, pn_io_error_decode, "(0x%x)"),
3445             val_to_str(u8ErrorCode1, error_code1_vals, "(0x%x)"),
3446             val_to_str(u8ErrorCode2, error_code2_vals, "(0x%x)"));
3447         col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: \"%s\", \"%s\", \"%s\", \"%s\"",
3448             val_to_str(u8ErrorCode, pn_io_error_code, "(0x%x)"),
3449             val_to_str(u8ErrorDecode, pn_io_error_decode, "(0x%x)"),
3450             val_to_str(u8ErrorCode1, error_code1_vals, "(0x%x)"),
3451             val_to_str(u8ErrorCode2, error_code2_vals, "(0x%x)"));
3452     }
3453     proto_item_set_len(sub_item, offset - u32SubStart);
3454
3455     return offset;
3456 }
3457
3458
3459 /* dissect the alarm specifier */
3460 static int
3461 dissect_Alarm_specifier(tvbuff_t *tvb, int offset,
3462     packet_info *pinfo, proto_tree *tree, guint8 *drep)
3463 {
3464     guint16     u16AlarmSpecifierSequence;
3465     guint16     u16AlarmSpecifierChannel;
3466     guint16     u16AlarmSpecifierManufacturer;
3467     guint16     u16AlarmSpecifierSubmodule;
3468     guint16     u16AlarmSpecifierAR;
3469     proto_item *sub_item;
3470     proto_tree *sub_tree;
3471
3472     /* alarm specifier */
3473     sub_item = proto_tree_add_item(tree, hf_pn_io_alarm_specifier, tvb, offset, 2, ENC_NA);
3474     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type);
3475
3476     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3477                         hf_pn_io_alarm_specifier_sequence, &u16AlarmSpecifierSequence);
3478     u16AlarmSpecifierSequence &= 0x07FF;
3479     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3480                         hf_pn_io_alarm_specifier_channel, &u16AlarmSpecifierChannel);
3481     u16AlarmSpecifierChannel = (u16AlarmSpecifierChannel &0x0800) >> 11;
3482     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3483                         hf_pn_io_alarm_specifier_manufacturer, &u16AlarmSpecifierManufacturer);
3484     u16AlarmSpecifierManufacturer = (u16AlarmSpecifierManufacturer &0x1000) >> 12;
3485     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3486                         hf_pn_io_alarm_specifier_submodule, &u16AlarmSpecifierSubmodule);
3487     u16AlarmSpecifierSubmodule = (u16AlarmSpecifierSubmodule & 0x2000) >> 13;
3488     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3489                         hf_pn_io_alarm_specifier_ardiagnosis, &u16AlarmSpecifierAR);
3490     u16AlarmSpecifierAR = (u16AlarmSpecifierAR & 0x8000) >> 15;
3491
3492
3493     proto_item_append_text(sub_item, ", Sequence: %u, Channel: %u, Manuf: %u, Submodule: %u AR: %u",
3494         u16AlarmSpecifierSequence, u16AlarmSpecifierChannel,
3495         u16AlarmSpecifierManufacturer, u16AlarmSpecifierSubmodule, u16AlarmSpecifierAR);
3496
3497     return offset;
3498 }
3499
3500
3501 /* dissect the alarm header */
3502 static int
3503 dissect_Alarm_header(tvbuff_t *tvb, int offset,
3504     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep)
3505 {
3506     guint16 u16AlarmType;
3507     guint32 u32Api;
3508     guint16 u16SlotNr;
3509     guint16 u16SubslotNr;
3510
3511     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3512                         hf_pn_io_alarm_type, &u16AlarmType);
3513     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3514                         hf_pn_io_api, &u32Api);
3515     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3516                         hf_pn_io_slot_nr, &u16SlotNr);
3517     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3518                         hf_pn_io_subslot_nr, &u16SubslotNr);
3519
3520     proto_item_append_text(item, ", %s, API:%u, Slot:0x%x/0x%x",
3521         val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"),
3522         u32Api, u16SlotNr, u16SubslotNr);
3523
3524     col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, Slot: 0x%x/0x%x",
3525         val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"),
3526         u16SlotNr, u16SubslotNr);
3527
3528     return offset;
3529 }
3530
3531
3532 static int
3533 dissect_ChannelProperties(tvbuff_t *tvb, int offset,
3534     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
3535 {
3536     proto_item *sub_item;
3537     proto_tree *sub_tree;
3538     guint16     u16ChannelProperties;
3539
3540
3541     sub_item = proto_tree_add_item(tree, hf_pn_io_channel_properties, tvb, offset, 2, ENC_BIG_ENDIAN);
3542     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_channel_properties);
3543     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3544                     hf_pn_io_channel_properties_direction, &u16ChannelProperties);
3545     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3546                     hf_pn_io_channel_properties_specifier, &u16ChannelProperties);
3547     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3548                     hf_pn_io_channel_properties_maintenance, &u16ChannelProperties);
3549     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3550                     hf_pn_io_channel_properties_accumulative, &u16ChannelProperties);
3551     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3552                     hf_pn_io_channel_properties_type, &u16ChannelProperties);
3553
3554     return offset;
3555 }
3556
3557 /* dissect the RS_BlockHeader */
3558 static int
3559 dissect_RS_BlockHeader(tvbuff_t *tvb, int offset,
3560     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep,
3561     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
3562 {
3563     guint16 u16RSBlockLength;
3564     guint8  u8BlockVersionHigh;
3565     guint8  u8BlockVersionLow;
3566
3567     /* u16RSBlockType is needed for further dissection */
3568     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3569         hf_pn_io_rs_block_type, u16RSBlockType);
3570
3571     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3572         hf_pn_io_rs_block_length, &u16RSBlockLength);
3573
3574     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3575         hf_pn_io_block_version_high, &u8BlockVersionHigh);
3576     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3577         hf_pn_io_block_version_low, &u8BlockVersionLow);
3578
3579     proto_item_append_text(item, ": Type=%s, Length=%u(+4), Version=%u.%u",
3580         rval_to_str(*u16RSBlockType, pn_io_rs_block_type, "Unknown (0x%04x)"),
3581         u16RSBlockLength, u8BlockVersionHigh, u8BlockVersionLow);
3582
3583     /* Block length is without type and length fields, but with version field */
3584     /* as it's already dissected, remove it */
3585     *u16RSBodyLength = u16RSBlockLength - 2;
3586
3587     /* Padding 2 + 2 + 1 + 1 = 6 */
3588     /* Therefore we need 2 byte padding to make the block u32 aligned */
3589     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
3590
3591     /* remove padding */
3592     *u16RSBodyLength -= 2;
3593     return offset;
3594 }
3595
3596 static int
3597 dissect_RS_AddressInfo(tvbuff_t *tvb, int offset,
3598     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength)
3599 {
3600     e_guid_t IM_UniqueIdentifier;
3601     guint32  u32Api;
3602     guint16  u16SlotNr;
3603     guint16  u16SubslotNr;
3604     guint16  u16ChannelNumber;
3605
3606     /* IM_UniqueIdentifier */
3607     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
3608         hf_pn_io_ar_uuid, &IM_UniqueIdentifier);
3609     *u16RSBodyLength -= 16;
3610
3611     /* API */
3612     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3613         hf_pn_io_api, &u32Api);
3614     *u16RSBodyLength -= 4;
3615
3616     /* SlotNumber */
3617     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3618         hf_pn_io_slot_nr, &u16SlotNr);
3619     *u16RSBodyLength -= 2;
3620
3621     /* SubSlotNumber*/
3622     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3623         hf_pn_io_subslot_nr, &u16SubslotNr);
3624     *u16RSBodyLength -= 2;
3625
3626     /* Channel Number*/
3627     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3628         hf_pn_io_channel_number, &u16ChannelNumber);
3629     *u16RSBodyLength -= 2;
3630
3631     return offset;
3632 }
3633
3634 /* dissect the RS_EventDataCommon */
3635 static int
3636 dissect_RS_EventDataCommon(tvbuff_t *tvb, int offset,
3637     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength)
3638 {
3639     guint16     u16RSSpecifierSequenceNumber;
3640     guint16     u16RSSpecifierReserved;
3641     guint16     u16RSSpecifierSpecifier;
3642     guint16     u16RSMinorError;
3643     guint16     u16RSPlusError;
3644     proto_item  *sub_item;
3645     proto_tree  *sub_tree;
3646     proto_item  *sub_item_time_stamp;
3647     proto_tree  *sub_tree_time_stamp;
3648     nstime_t    timestamp;
3649     guint16     u16RSTimeStampStatus;
3650
3651     /* RS_AddressInfo */
3652     offset = dissect_RS_AddressInfo(tvb, offset, pinfo, tree, drep, u16RSBodyLength);
3653
3654     /* RS_Specifier */
3655     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_specifier, tvb, offset, 2, ENC_BIG_ENDIAN);
3656     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_specifier);
3657
3658     /* RS_Specifier.SequenceNumber */
3659     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3660         hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber);
3661
3662     /* RS_Specifier.Reserved */
3663     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3664         hf_pn_io_rs_specifier_reserved, &u16RSSpecifierReserved);
3665
3666     /* RS_Specifier.Specifier */
3667     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3668         hf_pn_io_rs_specifier_specifier, &u16RSSpecifierSpecifier);
3669     *u16RSBodyLength -= 2;
3670
3671     /* RS_TimeStamp */
3672     sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA);
3673     sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp);
3674
3675     /* RS_TimeStamp.Status */
3676     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep,
3677         hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus);
3678
3679     /* RS_TimeStamp.TimeStamp */
3680
3681     /* Start after from 2 bytes Status */
3682     timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2);
3683
3684     /* Start after from 4 bytes timestamp.secs */
3685     timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8);
3686
3687     /* Start after from 2 bytes Status and get all 10 bytes */
3688     proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp);
3689     *u16RSBodyLength -= 12;
3690     offset += 12;
3691
3692     /* RS_MinusError */
3693     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3694         hf_pn_io_rs_minus_error, &u16RSMinorError);
3695     *u16RSBodyLength -= 2;
3696
3697     /* RS_PlusError */
3698     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3699         hf_pn_io_rs_plus_error, &u16RSPlusError);
3700     *u16RSBodyLength -= 2;
3701
3702     return offset;
3703 }
3704
3705 /* dissect the RS_IdentificationInfo */
3706 static int
3707 dissect_RS_IdentificationInfo(tvbuff_t *tvb, int offset,
3708     packet_info *pinfo, proto_tree *tree, guint8 *drep)
3709 {
3710     dcerpc_info di; /* fake dcerpc_info struct */
3711     guint64     u64AMDeviceIdentificationDeviceSubID;
3712     guint64     u64AMDeviceIdentificationDeviceID;
3713     guint64     u64AMDeviceIdentificationVendorID;
3714     guint64     u64AM_DeviceIdentificationOrganization;
3715
3716     proto_item *sub_item;
3717     proto_tree *sub_tree;
3718
3719     sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN);
3720     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification);
3721
3722     /* AM_DeviceIdentification */
3723     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3724         hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID);
3725     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3726         hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID);
3727     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3728         hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID);
3729     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3730         hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization);
3731
3732     /* IM_Tag_Function [32] */
3733     proto_tree_add_item(tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII|ENC_NA);
3734     offset += 32;
3735
3736     /* IM_Tag_Location [22] */
3737     proto_tree_add_item(tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII|ENC_NA);
3738     offset += 22;
3739
3740     return offset;
3741 }
3742
3743 /* dissect the RS_EventDataExtension_Data */
3744 static int
3745 dissect_RS_EventDataExtension_Data(tvbuff_t *tvb, int offset,
3746     packet_info *pinfo, proto_tree *tree, guint8 *drep,
3747     guint8 *u8RSExtensionBlockLength, guint16 *u16RSBlockType)
3748 {
3749     guint32     u32RSReasonCodeReason;
3750     guint32     u32RSReasonCodeDetail;
3751     guint8      u8LengthRSDomainIdentification = 16;
3752     guint8      u8LengthRSMasterIdentification = 8;
3753     guint16     u16SoE_DigitalInputCurrentValueValue;
3754     guint16     u16SoE_DigitalInputCurrentValueReserved;
3755
3756     proto_item *sub_item;
3757     proto_tree *sub_tree;
3758     nstime_t timestamp;
3759     guint16 u16RSTimeStampStatus;
3760     proto_item *sub_item_time_stamp;
3761     proto_tree *sub_tree_time_stamp;
3762
3763     switch (*u16RSBlockType) {
3764     case(0x4000): /* RS_StopObserver */
3765
3766         /* RS_BlockType */
3767         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3768         hf_pn_io_rs_block_type, u16RSBlockType);
3769
3770         /* RS_ReasonCode */
3771         sub_item = proto_tree_add_item(tree, hf_pn_io_rs_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN);
3772         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_reason_code);
3773         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
3774             hf_pn_io_rs_reason_code_reason, &u32RSReasonCodeReason);
3775         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
3776             hf_pn_io_rs_reason_code_detail, &u32RSReasonCodeDetail);
3777         *u8RSExtensionBlockLength -= 6;
3778         break;
3779     case(0x4001): /* RS_BufferObserver */
3780         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3781         *u8RSExtensionBlockLength = 0;
3782         break;
3783     case(0x4002): /* RS_TimeStatus */
3784
3785         /* Padding 1 + 1 + 16 + 8 = 26  or 1 + 1 + 16 + 8 + 12 = 38 */
3786         /* Therefore we need 2 byte padding to make the block u32 aligned */
3787         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
3788         *u8RSExtensionBlockLength -= 2;
3789
3790         /* RS_DomainIdentification */
3791         proto_tree_add_item(tree, hf_pn_io_rs_domain_identification, tvb, offset, u8LengthRSDomainIdentification, ENC_NA);
3792         offset += u8LengthRSDomainIdentification;
3793         *u8RSExtensionBlockLength -= 16;
3794
3795         /* RS_MasterIdentification */
3796         proto_tree_add_item(tree, hf_pn_io_rs_master_identification, tvb, offset, u8LengthRSMasterIdentification, ENC_NA);
3797         offset += u8LengthRSMasterIdentification;
3798         *u8RSExtensionBlockLength -= 8;
3799
3800         if (*u8RSExtensionBlockLength > 2)
3801         {
3802             /* RS_TimeStamp */
3803             sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA);
3804             sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp);
3805
3806             /* RS_TimeStamp.Status */
3807             dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep,
3808                 hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus);
3809
3810             /* RS_TimeStamp.TimeStamp */
3811             timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2); // Start after from 2 bytes Status
3812             timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8);  // Start after from 4 bytes timestamp.secs
3813             // Start after from 2 bytes Status and get all 10 bytes
3814             proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp);
3815             offset += 12;
3816         }
3817         break;
3818     case(0x4003): /* RS_SRLObserver */
3819         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3820         *u8RSExtensionBlockLength = 0;
3821         break;
3822     case(0x4004): /* RS_SourceIdentification */
3823         offset = dissect_RS_IdentificationInfo(tvb, offset, pinfo, tree, drep);
3824         *u8RSExtensionBlockLength = 0;
3825         break;
3826     case(0x4010): /* SoE_DigitalInputObserver */
3827         /* SoE_DigitalInputCurrentValue */
3828         sub_item = proto_tree_add_item(tree, hf_pn_io_soe_digital_input_current_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3829         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_digital_input_current_value);
3830
3831         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3832         hf_pn_io_soe_digital_input_current_value_value, &u16SoE_DigitalInputCurrentValueValue);
3833         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3834             hf_pn_io_soe_digital_input_current_value_reserved, &u16SoE_DigitalInputCurrentValueReserved);
3835         *u8RSExtensionBlockLength -= 2;
3836         break;
3837     default:
3838         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3839         *u8RSExtensionBlockLength = 0;
3840         break;
3841     }
3842     return offset;
3843 }
3844
3845 /* dissect the RS_EventDataExtension */
3846 static int
3847 dissect_RS_EventDataExtension(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3848     proto_tree *tree, guint8 *drep, guint16 *u16RSBlockLength, guint16 *u16RSBlockType)
3849 {
3850     guint8 u8RSExtensionBlockType;
3851     guint8 u8RSExtensionBlockLength;
3852
3853     /* RS_ExtensionBlockType */
3854     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3855         hf_pn_io_rs_extension_block_type, &u8RSExtensionBlockType);
3856     *u16RSBlockLength -= 1;
3857
3858     /* RS_ExtensionBlockLength */
3859     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3860         hf_pn_io_rs_extension_block_length, &u8RSExtensionBlockLength);
3861     *u16RSBlockLength -= 1;
3862
3863     /* Data*[Padding] * a*/
3864     while (u8RSExtensionBlockLength) {
3865         *u16RSBlockLength -= u8RSExtensionBlockLength;
3866         offset = dissect_RS_EventDataExtension_Data(tvb, offset, pinfo, tree, drep,
3867             &u8RSExtensionBlockLength, u16RSBlockType);
3868     }
3869
3870     return offset;
3871 }
3872
3873 /* dissect the RS_EventData */
3874 static int
3875 dissect_RS_EventData(tvbuff_t *tvb, int offset,
3876     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep,
3877     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
3878 {
3879     proto_item *sub_item;
3880     proto_tree *sub_tree;
3881
3882     /* RS_EventDataCommon */
3883     offset = dissect_RS_EventDataCommon(tvb, offset, pinfo, tree, drep, u16RSBodyLength);
3884
3885     /* optional: RS_EventDataExtension */
3886     while (*u16RSBodyLength > 0) {
3887         sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_data_extension, tvb, offset, 0, ENC_NA);
3888         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_data_extension);
3889         offset = dissect_RS_EventDataExtension(tvb, offset, pinfo, sub_tree, drep,
3890             u16RSBodyLength, u16RSBlockType);
3891     }
3892
3893     return offset;
3894 }
3895
3896 /* dissect the RS_EventBlock */
3897 static int
3898 dissect_RS_EventBlock(tvbuff_t *tvb, int offset,
3899     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3900 {
3901     proto_item *sub_item;
3902     proto_tree *sub_tree;
3903
3904     guint16 u16RSBodyLength;
3905     guint16 u16RSBlockType;
3906
3907     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_block, tvb, offset, 0, ENC_NA);
3908     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_block);
3909
3910     /* RS_BlockHeader */
3911     offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep,
3912         &u16RSBodyLength, &u16RSBlockType);
3913
3914     /* RS_EventData */
3915     offset = dissect_RS_EventData(tvb, offset, pinfo, sub_tree, drep,
3916         &u16RSBodyLength, &u16RSBlockType);
3917     return offset;
3918 }
3919
3920 /* dissect the RS_AlarmInfo */
3921 static int
3922 dissect_RS_AlarmInfo(tvbuff_t *tvb, int offset,
3923     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3924 {
3925     proto_item *sub_item;
3926     proto_tree *sub_tree;
3927     guint16    u16RSAlarmInfo;
3928
3929     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_alarm_info, tvb, offset, 2, ENC_BIG_ENDIAN);
3930     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_alarm_info);
3931
3932     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3933         hf_pn_io_rs_alarm_info_reserved_0_7, &u16RSAlarmInfo);
3934
3935     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3936         hf_pn_io_rs_alarm_info_reserved_8_15, &u16RSAlarmInfo);
3937
3938     return offset;
3939 }
3940
3941 /* dissect the RS_EventInfo */
3942 static int
3943 dissect_RS_EventInfo(tvbuff_t *tvb, int offset,
3944     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3945 {
3946     proto_item *sub_item;
3947     proto_tree *sub_tree;
3948     guint16    u16NumberofEntries;
3949
3950     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_info, tvb, offset, 0, ENC_NA);
3951     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_info);
3952
3953     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3954         hf_pn_io_number_of_rs_event_info, &u16NumberofEntries);
3955
3956     while (u16NumberofEntries > 0) {
3957         u16NumberofEntries--;
3958         offset = dissect_RS_EventBlock(tvb, offset, pinfo, sub_tree, drep);
3959     }
3960     return offset;
3961 }
3962
3963 static int
3964 dissect_AlarmUserStructure(tvbuff_t *tvb, int offset,
3965     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
3966         guint16 *body_length, guint16 u16UserStructureIdentifier)
3967 {
3968     guint16    u16ChannelNumber;
3969     guint16    u16ChannelErrorType;
3970     guint16    u16ExtChannelErrorType;
3971     guint32    u32ExtChannelAddValue;
3972     guint16    u16Index = 0;
3973     guint32    u32RecDataLen;
3974     pnio_ar_t *ar       = NULL;
3975
3976
3977     switch (u16UserStructureIdentifier) {
3978     case(0x8000):   /* ChannelDiagnosisData */
3979         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3980                         hf_pn_io_channel_number, &u16ChannelNumber);
3981         offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
3982         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3983                         hf_pn_io_channel_error_type, &u16ChannelErrorType);
3984         *body_length -= 6;
3985         break;
3986     case(0x8002):   /* ExtChannelDiagnosisData */
3987         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3988                         hf_pn_io_channel_number, &u16ChannelNumber);
3989
3990         offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
3991
3992         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3993                         hf_pn_io_channel_error_type, &u16ChannelErrorType);
3994
3995         if (u16ChannelErrorType < 0x7fff)
3996         {
3997             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3998                         hf_pn_io_ext_channel_error_type0, &u16ExtChannelErrorType);
3999         }
4000         else if (u16ChannelErrorType == 0x8000)
4001         {
4002             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4003                         hf_pn_io_ext_channel_error_type0x8000, &u16ExtChannelErrorType);
4004         }
4005         else if (u16ChannelErrorType == 0x8001)
4006         {
4007             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4008                         hf_pn_io_ext_channel_error_type0x8001, &u16ExtChannelErrorType);
4009         }
4010         else if (u16ChannelErrorType == 0x8002)
4011         {
4012             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4013                         hf_pn_io_ext_channel_error_type0x8002, &u16ExtChannelErrorType);
4014         }
4015         else if ((u16ChannelErrorType == 0x8003)||(u16ChannelErrorType == 0x8009))
4016         {
4017             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4018                         hf_pn_io_ext_channel_error_type0x8003, &u16ExtChannelErrorType);
4019         }
4020         else if (u16ChannelErrorType == 0x8004)
4021         {
4022             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4023                         hf_pn_io_ext_channel_error_type0x8004, &u16ExtChannelErrorType);
4024         }
4025         else if (u16ChannelErrorType == 0x8005)
4026         {
4027             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4028                         hf_pn_io_ext_channel_error_type0x8005, &u16ExtChannelErrorType);
4029         }
4030         else if (u16ChannelErrorType == 0x8007)
4031         {
4032             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4033                         hf_pn_io_ext_channel_error_type0x8007, &u16ExtChannelErrorType);
4034         }
4035         else if (u16ChannelErrorType == 0x8008)
4036         {
4037             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4038                         hf_pn_io_ext_channel_error_type0x8008, &u16ExtChannelErrorType);
4039         }
4040         else if (u16ChannelErrorType == 0x800A)
4041         {
4042             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4043                         hf_pn_io_ext_channel_error_type0x800A, &u16ExtChannelErrorType);
4044         }
4045         else if (u16ChannelErrorType == 0x800B)
4046         {
4047             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4048                         hf_pn_io_ext_channel_error_type0x800B, &u16ExtChannelErrorType);
4049         }
4050         else if (u16ChannelErrorType == 0x800C)
4051         {
4052             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4053                         hf_pn_io_ext_channel_error_type0x800C, &u16ExtChannelErrorType);
4054         }
4055         else
4056         {
4057             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4058                         hf_pn_io_ext_channel_error_type, &u16ExtChannelErrorType);
4059         }
4060         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4061                         hf_pn_io_ext_channel_add_value, &u32ExtChannelAddValue);
4062         *body_length -= 12;
4063         break;
4064     case(0x8100):   /* MaintenanceItem */
4065         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
4066         *body_length -= 12;
4067         break;
4068     case(0x8300): /* RS_AlarmInfo (Reporting System Alarm Information) */
4069     case(0x8301): /* RS_AlarmInfo */
4070     case(0x8302): /* RS_AlarmInfo */
4071         offset = dissect_RS_AlarmInfo(tvb, offset, pinfo, tree, drep);
4072         *body_length = 0;
4073         break;
4074     case(0x8303): /* RS_EventInfo (Reporting System Event Information) */
4075         offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep);
4076         *body_length = 0;
4077         break;
4078     /* XXX - dissect remaining user structures of [AlarmItem] */
4079     case(0x8001):   /* DiagnosisData */
4080     case(0x8003):   /* QualifiedChannelDiagnosisData */
4081     default:
4082         if (u16UserStructureIdentifier >= 0x8000) {
4083             offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, *body_length);
4084         } else {
4085             offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *body_length, "UserData");
4086         }
4087
4088         *body_length = 0;
4089     }
4090
4091     return offset;
4092 }
4093
4094
4095
4096 /* dissect the alarm notification block */
4097 static int
4098 dissect_AlarmNotification_block(tvbuff_t *tvb, int offset,
4099     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4100     guint16 body_length)
4101 {
4102     guint32 u32ModuleIdentNumber;
4103     guint32 u32SubmoduleIdentNumber;
4104     guint16 u16UserStructureIdentifier;
4105
4106
4107     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4108         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4109             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4110         return offset;
4111     }
4112
4113     offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep);
4114
4115     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4116                         hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
4117     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4118                         hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
4119
4120     offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep);
4121
4122     proto_item_append_text(item, ", Ident:0x%x, SubIdent:0x%x",
4123         u32ModuleIdentNumber, u32SubmoduleIdentNumber);
4124
4125     body_length -= 20;
4126
4127     /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */
4128     while (body_length) {
4129         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4130                             hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier);
4131         proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier);
4132         body_length -= 2;
4133
4134         offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep, &body_length, u16UserStructureIdentifier);
4135     }
4136
4137     return offset;
4138 }
4139
4140
4141 static int
4142 dissect_IandM0_block(tvbuff_t *tvb, int offset,
4143     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4144 {
4145     guint8   u8VendorIDHigh;
4146     guint8   u8VendorIDLow;
4147     char    *pOrderID;
4148     char    *pIMSerialNumber;
4149     guint16  u16IMHardwareRevision;
4150     guint8   u8SWRevisionPrefix;
4151     guint8   u8IMSWRevisionFunctionalEnhancement;
4152     guint8   u8IMSWRevisionBugFix;
4153     guint8   u8IMSWRevisionInternalChange;
4154     guint16  u16IMRevisionCounter;
4155     guint16  u16IMProfileID;
4156     guint16  u16IMProfileSpecificType;
4157     guint8   u8IMVersionMajor;
4158     guint8   u8IMVersionMinor;
4159     guint16  u16IMSupported;
4160
4161
4162     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4163         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4164             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4165         return offset;
4166     }
4167
4168     /* x8 VendorIDHigh */
4169     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4170                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
4171     /* x8 VendorIDLow */
4172     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4173                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
4174     /* c8[20] OrderID */
4175     pOrderID = (char *)wmem_alloc(wmem_packet_scope(), 20+1);
4176     tvb_memcpy(tvb, (guint8 *) pOrderID, offset, 20);
4177     pOrderID[20] = '\0';
4178     proto_tree_add_string (tree, hf_pn_io_order_id, tvb, offset, 20, pOrderID);
4179     offset += 20;
4180
4181     /* c8[16] IM_Serial_Number */
4182     pIMSerialNumber = (char *)wmem_alloc(wmem_packet_scope(), 16+1);
4183     tvb_memcpy(tvb, (guint8 *) pIMSerialNumber, offset, 16);
4184     pIMSerialNumber[16] = '\0';
4185     proto_tree_add_string (tree, hf_pn_io_im_serial_number, tvb, offset, 16, pIMSerialNumber);
4186     offset += 16;
4187
4188     /* x16 IM_Hardware_Revision */
4189     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4190                     hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4191     /* c8 SWRevisionPrefix */
4192     offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep,
4193                     hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
4194     /* x8 IM_SWRevision_Functional_Enhancement */
4195     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4196                     hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
4197     /* x8 IM_SWRevision_Bug_Fix */
4198     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4199                     hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
4200     /* x8 IM_SWRevision_Internal_Change */
4201     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4202                     hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
4203     /* x16 IM_Revision_Counter */
4204     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4205                     hf_pn_io_im_revision_counter, &u16IMRevisionCounter);
4206     /* x16 IM_Profile_ID */
4207     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4208                     hf_pn_io_im_profile_id, &u16IMProfileID);
4209     /* x16 IM_Profile_Specific_Type */
4210     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4211                     hf_pn_io_im_profile_specific_type, &u16IMProfileSpecificType);
4212     /* x8 IM_Version_Major (values) */
4213     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4214                     hf_pn_io_im_version_major, &u8IMVersionMajor);
4215     /* x8 IM_Version_Minor (values) */
4216     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4217                     hf_pn_io_im_version_minor, &u8IMVersionMinor);
4218     /* x16 IM_Supported (bitfield) */
4219     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4220                     hf_pn_io_im_supported, &u16IMSupported);
4221
4222     return offset;
4223 }
4224
4225
4226 static int
4227 dissect_IandM1_block(tvbuff_t *tvb, int offset,
4228     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4229 {
4230     char *pTagFunction;
4231     char *pTagLocation;
4232
4233     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4234         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4235             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4236         return offset;
4237     }
4238
4239     /* IM_Tag_Function [32] */
4240     pTagFunction = (char *)wmem_alloc(wmem_packet_scope(), 32+1);
4241     tvb_memcpy(tvb, (guint8 *) pTagFunction, offset, 32);
4242     pTagFunction[32] = '\0';
4243     proto_tree_add_string (tree, hf_pn_io_im_tag_function, tvb, offset, 32, pTagFunction);
4244     offset += 32;
4245
4246     /* IM_Tag_Location [22] */
4247     pTagLocation = (char *)wmem_alloc(wmem_packet_scope(), 22+1);
4248     tvb_memcpy(tvb, (guint8 *) pTagLocation, offset, 22);
4249     pTagLocation[22] = '\0';
4250     proto_tree_add_string (tree, hf_pn_io_im_tag_location, tvb, offset, 22, pTagLocation);
4251     offset += 22;
4252
4253     proto_item_append_text(item, ": TagFunction:\"%s\", TagLocation:\"%s\"", pTagFunction, pTagLocation);
4254
4255     return offset;
4256 }
4257
4258
4259 static int
4260 dissect_IandM2_block(tvbuff_t *tvb, int offset,
4261     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4262 {
4263     char *pDate;
4264
4265     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4266         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4267             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4268         return offset;
4269     }
4270
4271     /* IM_Date [16] */
4272     pDate = (char *)wmem_alloc(wmem_packet_scope(), 16+1);
4273     tvb_memcpy(tvb, (guint8 *) pDate, offset, 16);
4274     pDate[16] = '\0';
4275     proto_tree_add_string (tree, hf_pn_io_im_date, tvb, offset, 16, pDate);
4276     offset += 16;
4277
4278     proto_item_append_text(item, ": Date:\"%s\"", pDate);
4279
4280     return offset;
4281 }
4282
4283
4284 static int
4285 dissect_IandM3_block(tvbuff_t *tvb, int offset,
4286     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4287 {
4288     char *pDescriptor;
4289
4290     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4291         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4292             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4293         return offset;
4294     }
4295
4296     /* IM_Descriptor [54] */
4297     pDescriptor = (char *)wmem_alloc(wmem_packet_scope(), 54+1);
4298     tvb_memcpy(tvb, (guint8 *) pDescriptor, offset, 54);
4299     pDescriptor[54] = '\0';
4300     proto_tree_add_string (tree, hf_pn_io_im_descriptor, tvb, offset, 54, pDescriptor);
4301     offset += 54;
4302
4303     proto_item_append_text(item, ": Descriptor:\"%s\"", pDescriptor);
4304
4305     return offset;
4306 }
4307
4308
4309 static int
4310 dissect_IandM4_block(tvbuff_t *tvb, int offset,
4311     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4312 {
4313
4314     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4315         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4316             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4317         return offset;
4318     }
4319
4320     dissect_pn_user_data(tvb, offset, pinfo, tree, 54, "IM Signature");
4321
4322     return offset;
4323 }
4324
4325 static int
4326 dissect_IandM5_block(tvbuff_t *tvb, int offset,
4327     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4328 {
4329     guint16    u16NumberofEntries;
4330
4331     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4332         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4333             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4334         return offset;
4335     }
4336
4337     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_numberofentries, &u16NumberofEntries);
4338
4339     while(u16NumberofEntries > 0) {
4340         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
4341         u16NumberofEntries--;
4342     }
4343     return offset;
4344 }
4345
4346 static int
4347 dissect_IandM0FilterData_block(tvbuff_t *tvb, int offset,
4348     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4349 {
4350     guint16     u16NumberOfAPIs;
4351     guint32     u32Api;
4352     guint16     u16NumberOfModules;
4353     guint16     u16SlotNr;
4354     guint32     u32ModuleIdentNumber;
4355     guint16     u16NumberOfSubmodules;
4356     guint16     u16SubslotNr;
4357     guint32     u32SubmoduleIdentNumber;
4358     proto_item *subslot_item;
4359     proto_tree *subslot_tree;
4360     proto_item *module_item;
4361     proto_tree *module_tree;
4362     guint32     u32ModuleStart;
4363
4364
4365     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4366         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4367             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4368         return offset;
4369     }
4370
4371     /* NumberOfAPIs */
4372     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4373                     hf_pn_io_number_of_apis, &u16NumberOfAPIs);
4374
4375     while (u16NumberOfAPIs--) {
4376         /* API */
4377         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4378                         hf_pn_io_api, &u32Api);
4379         /* NumberOfModules */
4380         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4381                         hf_pn_io_number_of_modules, &u16NumberOfModules);
4382
4383         while (u16NumberOfModules--) {
4384             module_item = proto_tree_add_item(tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
4385             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
4386
4387             u32ModuleStart = offset;
4388
4389             /* SlotNumber */
4390             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
4391                             hf_pn_io_slot_nr, &u16SlotNr);
4392             /* ModuleIdentNumber */
4393             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep,
4394                             hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
4395             /* NumberOfSubmodules */
4396             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
4397                             hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
4398
4399             proto_item_append_text(module_item, ": Slot:%u, Ident:0x%x Submodules:%u",
4400                 u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubmodules);
4401
4402             while (u16NumberOfSubmodules--) {
4403                 subslot_item = proto_tree_add_item(module_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
4404                 subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot);
4405
4406                 /* SubslotNumber */
4407                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep,
4408                                     hf_pn_io_subslot_nr, &u16SubslotNr);
4409                 /* SubmoduleIdentNumber */
4410                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep,
4411                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
4412
4413                 proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x",
4414                     u16SubslotNr, u32SubmoduleIdentNumber);
4415             }
4416
4417             proto_item_set_len(module_item, offset-u32ModuleStart);
4418         }
4419     }
4420
4421     return offset;
4422 }
4423
4424
4425 static int
4426 dissect_IandM5Data_block(tvbuff_t *tvb, int offset,
4427     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
4428 {
4429     char       *pIMAnnotation;
4430     char       *pIMOrderID;
4431     guint8     u8VendorIDHigh;
4432     guint8     u8VendorIDLow;
4433     char       *pIMSerialNumber;
4434     guint16    u16IMHardwareRevision;
4435     guint8     u8SWRevisionPrefix;
4436     guint8     u8IMSWRevisionFunctionalEnhancement;
4437     guint8     u8IMSWRevisionBugFix;
4438     guint8     u8IMSWRevisionInternalChange;
4439
4440     /* c8[64] IM Annotation */
4441     pIMAnnotation = (char *)wmem_alloc(wmem_packet_scope(), 64+1);
4442     tvb_memcpy(tvb, (guint8 *) pIMAnnotation, offset, 64);
4443     pIMAnnotation[64] = '\0';
4444     proto_tree_add_string(tree, hf_pn_io_im_annotation, tvb, offset, 64, pIMAnnotation);
4445     offset += 64;
4446
4447     /* c8[64] IM Order ID */
4448     pIMOrderID = (char *)wmem_alloc(wmem_packet_scope(), 64+1);
4449     tvb_memcpy(tvb, (guint8 *) pIMOrderID, offset, 64);
4450     pIMOrderID[64] = '\0';
4451     proto_tree_add_string(tree, hf_pn_io_im_order_id, tvb, offset, 64, pIMOrderID);
4452     offset += 64;
4453
4454     /* x8 VendorIDHigh */
4455     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4456                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
4457     /* x8 VendorIDLow */
4458     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4459                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
4460
4461     /* c8[16] IM Serial Number */
4462     pIMSerialNumber = (char *)wmem_alloc(wmem_packet_scope(), 16+1);
4463     tvb_memcpy(tvb, (guint8 *) pIMSerialNumber, offset, 16);
4464     pIMSerialNumber[16] = '\0';
4465     proto_tree_add_string(tree, hf_pn_io_im_serial_number, tvb, offset, 16, pIMSerialNumber);
4466     offset += 16;
4467
4468     /* x16 IM_Hardware_Revision */
4469     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4470                 hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4471         /* c8 SWRevisionPrefix */
4472     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4473                 hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
4474     /* x8 IM_SWRevision_Functional_Enhancement */
4475     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4476                 hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
4477     /* x8 IM_SWRevision_Bug_Fix */
4478     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4479                 hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
4480
4481     /* x8 IM_SWRevision_Internal_Change */
4482     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4483                 hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
4484
4485     return offset;
4486 }
4487
4488 static int
4489 dissect_AM_Location(tvbuff_t *tvb, int offset,
4490 packet_info *pinfo, proto_tree *tree, guint8 *drep)
4491 {
4492     proto_item          *sub_item;
4493     proto_tree          *sub_tree;
4494     guint8              am_location_structtype;
4495     int bit_offset;
4496     guint8 am_location_reserved1;
4497     guint16 am_location_begin_slot_number;
4498     guint16 am_location_begin_subslot_number;
4499     guint16 am_location_end_slot_number;
4500     guint16 am_location_end_subslot_number;
4501     guint16 am_location_reserved2;
4502     guint16 am_location_reserved3;
4503     guint16 am_location_reserved4;
4504     sub_item = proto_tree_add_item(tree, hf_pn_io_am_location, tvb, offset, 16, ENC_NA);
4505     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_location);
4506     offset = dissect_dcerpc_char(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_structure,
4507         &am_location_structtype);
4508
4509     bit_offset = offset << 3;
4510     switch (am_location_structtype)
4511     {
4512     case (0x01):
4513         /* level 0 */
4514         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_0, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4515         bit_offset += 10;
4516         /* level 1 */
4517         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_1, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4518         bit_offset += 10;
4519         /* level 2 */
4520         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_2, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4521         bit_offset += 10;
4522         /* level 3 */
4523         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_3, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4524         bit_offset += 10;
4525         /* level 4 */
4526         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_4, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4527         bit_offset += 10;
4528         /* level 5 */
4529         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_5, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4530         bit_offset += 10;
4531         /* level 6 */
4532         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_6, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4533         bit_offset += 10;
4534         /* level 7 */
4535         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_7, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4536         bit_offset += 10;
4537         /* level 8 */
4538         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_8, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4539         bit_offset += 10;
4540         /* level 9 */
4541         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_9, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4542         bit_offset += 10;
4543         /* level 10 */
4544         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_10, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4545         bit_offset += 10;
4546         /* level 11 */
4547         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_11, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
4548         bit_offset += 10;
4549         offset = bit_offset >> 3;
4550         break;
4551     case (0x02):
4552         /* Reserved1 */
4553         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
4554             hf_pn_io_am_location_reserved1, &am_location_reserved1);
4555
4556         /* BeginSlotNumber */
4557         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4558             hf_pn_io_slot_nr, &am_location_begin_slot_number);
4559
4560         /* BeginSubslotNumber */
4561         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4562             hf_pn_io_subslot_nr, &am_location_begin_subslot_number);
4563
4564         /* EndSlotNumber*/
4565         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4566             hf_pn_io_slot_nr, &am_location_end_slot_number);
4567
4568         /* EndSubSlotNumber*/
4569         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4570             hf_pn_io_subslot_nr, &am_location_end_subslot_number);
4571
4572         /* Reserved 2 */
4573         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4574             hf_pn_io_am_location_reserved2, &am_location_reserved2);
4575
4576         /* Reserved 3 */
4577         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4578             hf_pn_io_am_location_reserved3, &am_location_reserved3);
4579
4580         /* Reserved 4 */
4581         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4582             hf_pn_io_am_location_reserved4, &am_location_reserved4);
4583         break;
4584     default: /* will not execute because of the line preceding the switch */
4585         offset += 15;
4586         break;
4587     }
4588
4589     return offset;
4590 }
4591
4592 static int
4593 dissect_IM_software_revision(tvbuff_t *tvb, int offset,
4594 packet_info *pinfo, proto_tree *tree, guint8 *drep)
4595 {
4596     guint8   u8SWRevisionPrefix;
4597     guint8   u8IMSWRevisionFunctionalEnhancement;
4598     guint8   u8IMSWRevisionBugFix;
4599     guint8   u8IMSWRevisionInternalChange;
4600
4601     /* SWRevisionPrefix */
4602     offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep,
4603         hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
4604
4605     /* IM_SWRevision_Functional_Enhancement */
4606     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4607         hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
4608
4609     /* IM_SWRevision_Bug_Fix */
4610     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4611         hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
4612
4613     /* IM_SWRevision_Internal_Change */
4614     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4615         hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
4616
4617     return offset;
4618 }
4619
4620 static int
4621 dissect_AM_device_identification(tvbuff_t *tvb, int offset,
4622 packet_info *pinfo, proto_tree *tree, guint8 *drep)
4623 {
4624     dcerpc_info di; /* fake dcerpc_info struct */
4625     guint64     u64AMDeviceIdentificationDeviceSubID;
4626     guint64     u64AMDeviceIdentificationDeviceID;
4627     guint64     u64AMDeviceIdentificationVendorID;
4628     guint64     u64AM_DeviceIdentificationOrganization;
4629
4630     proto_item *sub_item;
4631     proto_tree *sub_tree;
4632
4633     sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN);
4634     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification);
4635     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
4636         hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID);
4637     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
4638         hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID);
4639     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
4640         hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID);
4641     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
4642         hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization);
4643
4644     return offset;
4645 }
4646
4647 static int
4648 dissect_AM_FullInformation_block(tvbuff_t *tvb, int offset,
4649 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4650 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4651 {
4652     e_guid_t IM_UniqueIdentifier;
4653     guint16  u16AM_TypeIdentification;
4654     guint16  u16IMHardwareRevision;
4655
4656     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4657         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4658             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4659         return offset;
4660     }
4661
4662     /* align padding */
4663     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4664
4665     /* IM_UniqueIdentifier */
4666     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4667         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
4668
4669     /* AM_Location */
4670     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4671
4672     /* IM_Annotation */
4673     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII|ENC_NA);
4674     offset += 64;
4675
4676     /* IM_OrderID */
4677     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII|ENC_NA);
4678     offset += 64;
4679
4680     /* AM_SoftwareRevision */
4681     proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII|ENC_NA);
4682     offset += 64;
4683
4684     /* AM_HardwareRevision */
4685     proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII|ENC_NA);
4686     offset += 64;
4687
4688     /* IM_Serial_Number */
4689     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII|ENC_NA);
4690     offset += 16;
4691
4692     /* IM_Software_Revision */
4693     offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep);
4694
4695     /* AM_DeviceIdentification */
4696     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4697
4698     /* AM_TypeIdentification */
4699     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4700         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4701
4702     /* IM_Hardware_Revision */
4703     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4704         hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4705
4706     return offset;
4707 }
4708
4709 static int
4710 dissect_AM_HardwareOnlyInformation_block(tvbuff_t *tvb, int offset,
4711 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4712 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4713 {
4714     e_guid_t IM_UniqueIdentifier;
4715     guint16  u16AM_TypeIdentification;
4716     guint16  u16IMHardwareRevision;
4717
4718     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4719         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4720             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4721         return offset;
4722     }
4723
4724     /* align padding */
4725     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4726
4727     /* IM_UniqueIdentifier */
4728     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4729         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
4730
4731     /* AM_Location */
4732     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4733
4734     /* IM_Annotation */
4735     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA);
4736     offset += 64;
4737
4738     /* IM_OrderID */
4739     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA);
4740     offset += 64;
4741
4742     /* AM_HardwareRevision */
4743     proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII | ENC_NA);
4744     offset += 64;
4745
4746     /* IM_Serial_Number */
4747     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA);
4748     offset += 16;
4749
4750     /* AM_DeviceIdentification */
4751     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4752
4753     /* AM_TypeIdentification */
4754     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4755         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4756
4757     /* IM_Hardware_Revision */
4758     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4759         hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4760
4761     return offset;
4762 }
4763
4764 static int
4765 dissect_AM_FirmwareOnlyInformation_block(tvbuff_t *tvb, int offset,
4766 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4767 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4768 {
4769     e_guid_t IM_UniqueIdentifier;
4770     guint16  u16AM_TypeIdentification;
4771
4772     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4773         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4774             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4775         return offset;
4776     }
4777
4778     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4779
4780     /* IM_UniqueIdentifier */
4781     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4782         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
4783
4784     /* AM_Location */
4785     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4786
4787     /* IM_Annotation */
4788     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA);
4789     offset += 64;
4790
4791     /* IM_OrderID */
4792     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA);
4793     offset += 64;
4794
4795     /* AM_SoftwareRevision */
4796     proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII | ENC_NA);
4797     offset += 64;
4798
4799     /* IM_Serial_Number */
4800     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA);
4801     offset += 16;
4802
4803     /* IM_Software_Revision */
4804     offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep);
4805
4806     /* AM_DeviceIdentification */
4807     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4808
4809     /* AM_TypeIdentification */
4810     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4811         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4812
4813     return offset;
4814 }
4815
4816 /* dissect the AssetManagementInfo */
4817 static int
4818 dissect_AssetManagementInfo(tvbuff_t *tvb, int offset,
4819 packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
4820 {
4821     proto_item *sub_item;
4822     proto_tree *sub_tree;
4823     guint16    u16NumberofEntries;
4824
4825     sub_item = proto_tree_add_item(tree, hf_pn_io_asset_management_info, tvb, offset, 0, ENC_NA);
4826     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_asset_management_info);
4827
4828     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4829         hf_pn_io_number_of_asset_management_info, &u16NumberofEntries);
4830
4831     while (u16NumberofEntries > 0) {
4832         u16NumberofEntries--;
4833         offset = dissect_a_block(tvb, offset, pinfo, sub_tree, drep);
4834     }
4835     return offset;
4836 }
4837
4838 /* dissect the AssetManagementData block */
4839 static int
4840 dissect_AssetManagementData_block(tvbuff_t *tvb, int offset,
4841 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4842 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4843 {
4844     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4845         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4846             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4847         return offset;
4848     }
4849     offset = dissect_AssetManagementInfo(tvb, offset, pinfo, tree, drep);
4850     return offset;
4851 }
4852
4853 /* dissect the IdentificationData block */
4854 static int
4855 dissect_IdentificationData_block(tvbuff_t *tvb, int offset,
4856     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4857 {
4858     guint16     u16NumberOfAPIs = 1;
4859     guint32     u32Api;
4860     guint16     u16NumberOfSlots;
4861     guint16     u16SlotNr;
4862     guint32     u32ModuleIdentNumber;
4863     guint16     u16NumberOfSubslots;
4864     guint32     u32SubmoduleIdentNumber;
4865     guint16     u16SubslotNr;
4866     proto_item *slot_item;
4867     proto_tree *slot_tree;
4868     guint32     u32SlotStart;
4869     proto_item *subslot_item;
4870     proto_tree *subslot_tree;
4871
4872
4873     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
4874         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4875             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4876         return offset;
4877     }
4878
4879     if (u8BlockVersionLow == 1) {
4880         /* NumberOfAPIs */
4881         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4882                             hf_pn_io_number_of_apis, &u16NumberOfAPIs);
4883     }
4884
4885     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
4886
4887     while (u16NumberOfAPIs--) {
4888         if (u8BlockVersionLow == 1) {
4889             /* API */
4890             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4891                             hf_pn_io_api, &u32Api);
4892         }
4893
4894         /* NumberOfSlots */
4895         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4896                             hf_pn_io_number_of_slots, &u16NumberOfSlots);
4897
4898         proto_item_append_text(item, ", Slots:%u", u16NumberOfSlots);
4899
4900         while (u16NumberOfSlots--) {
4901             slot_item = proto_tree_add_item(tree, hf_pn_io_slot, tvb, offset, 0, ENC_NA);
4902             slot_tree = proto_item_add_subtree(slot_item, ett_pn_io_slot);
4903             u32SlotStart = offset;
4904
4905             /* SlotNumber */
4906             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep,
4907                                 hf_pn_io_slot_nr, &u16SlotNr);
4908             /* ModuleIdentNumber */
4909             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, slot_tree, drep,
4910                                 hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
4911             /* NumberOfSubslots */
4912             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep,
4913                                 hf_pn_io_number_of_subslots, &u16NumberOfSubslots);
4914
4915             proto_item_append_text(slot_item, ": SlotNr:%u Ident:0x%x Subslots:%u",
4916                 u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubslots);
4917
4918             while (u16NumberOfSubslots--) {
4919                 subslot_item = proto_tree_add_item(slot_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
4920                 subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot);
4921
4922                 /* SubslotNumber */
4923                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep,
4924                                     hf_pn_io_subslot_nr, &u16SubslotNr);
4925                 /* SubmoduleIdentNumber */
4926                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep,
4927                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
4928
4929                 proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x",
4930                     u16SubslotNr, u32SubmoduleIdentNumber);
4931             }
4932
4933             proto_item_set_len(slot_item, offset-u32SlotStart);
4934         }
4935     }
4936
4937     return offset;
4938 }
4939
4940
4941 /* dissect the substitute value block */
4942 static int
4943 dissect_SubstituteValue_block(tvbuff_t *tvb, int offset,
4944     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4945     guint16 u16BodyLength)
4946 {
4947     guint16 u16SubstitutionMode;
4948
4949     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4950         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4951             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4952         return offset;
4953     }
4954
4955     /* SubstitutionMode */
4956     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4957                     hf_pn_io_substitutionmode, &u16SubstitutionMode);
4958
4959
4960     /* SubstituteDataItem */
4961     /* IOCS */
4962     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
4963     u16BodyLength -= 3;
4964     /* SubstituteDataObjectElement */
4965     dissect_pn_user_data_bytes(tvb, offset, pinfo, tree, u16BodyLength, SUBST_DATA);
4966
4967     return offset;
4968 }
4969
4970
4971 /* dissect the RecordInputDataObjectElement block */
4972 static int
4973 dissect_RecordInputDataObjectElement_block(tvbuff_t *tvb, int offset,
4974     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4975 {
4976     guint8  u8LengthIOCS;
4977     guint8  u8LengthIOPS;
4978     guint16 u16LengthData;
4979
4980
4981     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4982         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4983             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4984         return offset;
4985     }
4986
4987     /* LengthIOCS */
4988     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4989                 hf_pn_io_length_iocs, &u8LengthIOCS);
4990     /* IOCS */
4991     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
4992     /* LengthIOPS */
4993     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4994                 hf_pn_io_length_iops, &u8LengthIOPS);
4995     /* IOPS */
4996     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops);
4997     /* LengthData */
4998     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4999                 hf_pn_io_length_data, &u16LengthData);
5000     /* Data */
5001     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data");
5002
5003     return offset;
5004 }
5005
5006
5007 /* dissect the RecordOutputDataObjectElement block */
5008 static int
5009 dissect_RecordOutputDataObjectElement_block(tvbuff_t *tvb, int offset,
5010     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5011 {
5012     guint16    u16SubstituteActiveFlag;
5013     guint8     u8LengthIOCS;
5014     guint8     u8LengthIOPS;
5015     guint16    u16LengthData;
5016     guint16    u16Index = 0;
5017     guint32    u32RecDataLen;
5018     pnio_ar_t *ar       = NULL;
5019
5020
5021     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5022         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5023             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5024         return offset;
5025     }
5026
5027     /* SubstituteActiveFlag */
5028     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5029                 hf_pn_io_substitute_active_flag, &u16SubstituteActiveFlag);
5030
5031     /* LengthIOCS */
5032     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5033                 hf_pn_io_length_iocs, &u8LengthIOCS);
5034     /* LengthIOPS */
5035     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5036                 hf_pn_io_length_iops, &u8LengthIOPS);
5037     /* LengthData */
5038     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5039                 hf_pn_io_length_data, &u16LengthData);
5040     /* DataItem (IOCS, Data, IOPS) */
5041     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
5042
5043     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data");
5044
5045     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops);
5046
5047     /* SubstituteValue */
5048     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
5049
5050     return offset;
5051 }
5052
5053
5054 /* dissect the alarm acknowledge block */
5055 static int
5056 dissect_Alarm_ack_block(tvbuff_t *tvb, int offset,
5057     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5058 {
5059     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5060         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5061             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5062         return offset;
5063     }
5064
5065     col_append_str(pinfo->cinfo, COL_INFO, ", Alarm Ack");
5066
5067     offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep);
5068
5069     offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep);
5070
5071     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
5072
5073     return offset;
5074 }
5075
5076
5077 /* dissect the maintenance block */
5078 static int
5079 dissect_Maintenance_block(tvbuff_t *tvb, int offset,
5080     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5081 {
5082     proto_item *sub_item;
5083     proto_tree *sub_tree;
5084     guint32     u32MaintenanceStatus;
5085
5086
5087     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5088         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5089             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5090         return offset;
5091     }
5092
5093     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5094
5095     sub_item = proto_tree_add_item(tree, hf_pn_io_maintenance_status, tvb, offset, 4, ENC_BIG_ENDIAN);
5096     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_maintenance_status);
5097
5098     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5099                     hf_pn_io_maintenance_status_demanded, &u32MaintenanceStatus);
5100     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5101                     hf_pn_io_maintenance_status_required, &u32MaintenanceStatus);
5102
5103     if (u32MaintenanceStatus & 0x0002) {
5104         proto_item_append_text(item, ", Demanded");
5105         proto_item_append_text(sub_item, ", Demanded");
5106     }
5107
5108     if (u32MaintenanceStatus & 0x0001) {
5109         proto_item_append_text(item, ", Required");
5110         proto_item_append_text(sub_item, ", Required");
5111     }
5112
5113     return offset;
5114 }
5115
5116
5117 /* dissect the read/write header */
5118 static int
5119 dissect_ReadWrite_header(tvbuff_t *tvb, int offset,
5120     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint16 *u16Index, e_guid_t *aruuid)
5121 {
5122     guint32 u32Api;
5123     guint16 u16SlotNr;
5124     guint16 u16SubslotNr;
5125     guint16 u16SeqNr;
5126
5127     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5128                         hf_pn_io_seq_number, &u16SeqNr);
5129
5130     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5131                         hf_pn_io_ar_uuid, aruuid);
5132
5133     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5134                         hf_pn_io_api, &u32Api);
5135     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5136                         hf_pn_io_slot_nr, &u16SlotNr);
5137     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5138                         hf_pn_io_subslot_nr, &u16SubslotNr);
5139         /* padding doesn't match offset required for align4 */
5140     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
5141     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5142                         hf_pn_io_index, u16Index);
5143
5144     proto_item_append_text(item, ": Seq:%u, Api:0x%x, Slot:0x%x/0x%x",
5145         u16SeqNr, u32Api, u16SlotNr, u16SubslotNr);
5146
5147     col_append_fstr(pinfo->cinfo, COL_INFO, ", Api:0x%x, Slot:0x%x/0x%x, Index:%s",
5148         u32Api, u16SlotNr, u16SubslotNr,
5149         val_to_str(*u16Index, pn_io_index, "(0x%x)"));
5150
5151     return offset;
5152 }
5153
5154
5155 /* dissect the write request block */
5156 static int
5157 dissect_IODWriteReqHeader_block(tvbuff_t *tvb, int offset,
5158     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5159     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t ** ar)
5160 {
5161     e_guid_t aruuid;
5162     e_guid_t null_uuid;
5163
5164     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5165         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5166             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5167         return offset;
5168     }
5169
5170     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
5171
5172     /* The value NIL indicates the usage of the implicit AR*/
5173     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
5174
5175     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5176                         hf_pn_io_record_data_length, u32RecDataLen);
5177
5178     memset(&null_uuid, 0, sizeof(e_guid_t));
5179     if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) {
5180         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5181                         hf_pn_io_target_ar_uuid, &aruuid);
5182     }
5183
5184     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24);
5185
5186     proto_item_append_text(item, ", Len:%u", *u32RecDataLen);
5187
5188     if (*u32RecDataLen != 0)
5189         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
5190             *u32RecDataLen);
5191
5192     return offset;
5193 }
5194
5195
5196 /* dissect the read request block */
5197 static int
5198 dissect_IODReadReqHeader_block(tvbuff_t *tvb, int offset,
5199     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5200     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
5201 {
5202     e_guid_t aruuid;
5203     e_guid_t null_uuid;
5204
5205     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5206         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5207             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5208         return offset;
5209     }
5210
5211     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
5212
5213     /* The value NIL indicates the usage of the implicit AR*/
5214     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
5215
5216     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5217                         hf_pn_io_record_data_length, u32RecDataLen);
5218
5219     memset(&null_uuid, 0, sizeof(e_guid_t));
5220     if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) {
5221         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5222                         hf_pn_io_target_ar_uuid, &aruuid);
5223         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 8);
5224     } else {
5225         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24);
5226     }
5227
5228     proto_item_append_text(item, ", Len:%u", *u32RecDataLen);
5229
5230     if (*u32RecDataLen != 0)
5231         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
5232             *u32RecDataLen);
5233
5234     return offset;
5235 }
5236
5237
5238 /* dissect the write response block */
5239 static int
5240 dissect_IODWriteResHeader_block(tvbuff_t *tvb, int offset,
5241     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5242     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
5243 {
5244     e_guid_t aruuid;
5245     guint16  u16AddVal1;
5246     guint16  u16AddVal2;
5247     guint32  u32Status;
5248
5249
5250     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5251         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5252             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5253         return offset;
5254     }
5255
5256     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
5257
5258     /* The value NIL indicates the usage of the implicit AR*/
5259     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
5260
5261     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5262                         hf_pn_io_record_data_length, u32RecDataLen);
5263
5264     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5265                         hf_pn_io_add_val1, &u16AddVal1);
5266
5267     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5268                         hf_pn_io_add_val2, &u16AddVal2);
5269
5270     u32Status = ((drep[0] & DREP_LITTLE_ENDIAN)
5271             ? tvb_get_letohl (tvb, offset)
5272             : tvb_get_ntohl (tvb, offset));
5273
5274     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
5275
5276     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 16);
5277
5278     proto_item_append_text(item, ", Len:%u, Index:0x%x, Status:0x%x, Val1:%u, Val2:%u",
5279         *u32RecDataLen, *u16Index, u32Status, u16AddVal1, u16AddVal2);
5280
5281     if (*u32RecDataLen != 0)
5282         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
5283             *u32RecDataLen);
5284
5285     return offset;
5286 }
5287
5288
5289 /* dissect the read response block */
5290 static int
5291 dissect_IODReadResHeader_block(tvbuff_t *tvb, int offset,
5292     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5293     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
5294 {
5295     e_guid_t aruuid;
5296     guint16  u16AddVal1;
5297     guint16  u16AddVal2;
5298
5299
5300     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5301         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5302             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5303         return offset;
5304     }
5305
5306     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
5307
5308     /* The value NIL indicates the usage of the implicit AR*/
5309     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
5310
5311     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5312                         hf_pn_io_record_data_length, u32RecDataLen);
5313
5314     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5315                         hf_pn_io_add_val1, &u16AddVal1);
5316
5317     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5318                         hf_pn_io_add_val2, &u16AddVal2);
5319
5320     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 20);
5321
5322     proto_item_append_text(item, ", Len:%u, AddVal1:%u, AddVal2:%u",
5323         *u32RecDataLen, u16AddVal1, u16AddVal2);
5324
5325     if (*u32RecDataLen != 0)
5326         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
5327             *u32RecDataLen);
5328
5329     return offset;
5330 }
5331
5332
5333 /* dissect the control/connect block */
5334 static int
5335 dissect_ControlConnect_block(tvbuff_t *tvb, int offset,
5336     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5337     pnio_ar_t **ar)
5338 {
5339     e_guid_t    ar_uuid;
5340     guint16     u16SessionKey;
5341     proto_item *sub_item;
5342     proto_tree *sub_tree;
5343     guint16     u16Command;
5344     guint16     u16Properties;
5345
5346
5347     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5348         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5349             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5350         return offset;
5351     }
5352
5353     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5354                         hf_pn_io_reserved16, NULL);
5355
5356     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5357                         hf_pn_io_ar_uuid, &ar_uuid);
5358
5359     /* The value NIL indicates the usage of the implicit AR*/
5360     *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid);
5361
5362     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5363                         hf_pn_io_sessionkey, &u16SessionKey);
5364
5365     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5366                         hf_pn_io_reserved16, NULL);
5367
5368     sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN);
5369     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command);
5370
5371     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5372                         hf_pn_io_control_command_prmend, &u16Command);
5373     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5374                         hf_pn_io_control_command_applready, &u16Command);
5375     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5376                         hf_pn_io_control_command_release, &u16Command);
5377     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5378                         hf_pn_io_control_command_done, &u16Command);
5379     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5380                         hf_pn_io_control_command_ready_for_companion, &u16Command);
5381     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5382                         hf_pn_io_control_command_ready_for_rt_class3, &u16Command);
5383     /* Prm.Begin */
5384     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5385                         hf_pn_io_control_command_prmbegin, &u16Command);
5386
5387     if (u16Command & 0x0002) {
5388         /* ApplicationReady: special decode */
5389         sub_item = proto_tree_add_item(tree, hf_pn_io_control_block_properties_applready, tvb, offset, 2, ENC_BIG_ENDIAN);
5390         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_block_properties);
5391         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5392                             hf_pn_io_control_block_properties_applready0, &u16Properties);
5393     } else {
5394         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5395                             hf_pn_io_control_block_properties, &u16Properties);
5396     }
5397
5398     proto_item_append_text(item, ": Session:%u, Command:", u16SessionKey);
5399
5400     if (u16Command & 0x0001) {
5401         proto_item_append_text(sub_item, ", ParameterEnd");
5402         proto_item_append_text(item, " ParameterEnd");
5403         col_append_str(pinfo->cinfo, COL_INFO, ", Command: ParameterEnd");
5404     }
5405     if (u16Command & 0x0002) {
5406         proto_item_append_text(sub_item, ", ApplicationReady");
5407         proto_item_append_text(item, " ApplicationReady");
5408         col_append_str(pinfo->cinfo, COL_INFO, ", Command: ApplicationReady");
5409     }
5410     if (u16Command & 0x0004) {
5411         proto_item_append_text(sub_item, ", Release");
5412         proto_item_append_text(item, " Release");
5413         col_append_str(pinfo->cinfo, COL_INFO, ", Command: Release");
5414     }
5415     if (u16Command & 0x0008) {
5416         proto_item_append_text(sub_item, ", Done");
5417         proto_item_append_text(item, ", Done");
5418         col_append_str(pinfo->cinfo, COL_INFO, ", Command: Done");
5419     }
5420
5421     proto_item_append_text(item, ", Properties:0x%x", u16Properties);
5422
5423     return offset;
5424 }
5425
5426 /* dissect the ControlBlockPrmBegin block */
5427 static int
5428 dissect_ControlBlockPrmBegin(tvbuff_t *tvb, int offset,
5429     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen,
5430     pnio_ar_t **ar)
5431 {
5432     e_guid_t    ar_uuid;
5433     guint16     u16SessionKey;
5434     guint16     u16Command;
5435     proto_item *sub_item;
5436     proto_tree *sub_tree;
5437
5438     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5439         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5440             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5441         return offset;
5442     }
5443     if (u32RecDataLen != 28-2) /* must be 28 see specification (version already dissected) */
5444     {
5445         expert_add_info_format(pinfo, item, &ei_pn_io_block_length, "Block length of %u is invalid!", u32RecDataLen);
5446         return offset;
5447     }
5448     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
5449
5450     /* ARUUID */
5451     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &ar_uuid);
5452
5453     /* The value NIL indicates the usage of the implicit AR*/
5454     *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid);
5455
5456     /* SessionKey */
5457     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey);
5458
5459     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
5460
5461     /* ControlCommand */
5462     sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN);
5463     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command);
5464
5465     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5466                         hf_pn_io_control_command_prmend, &u16Command);
5467     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5468                         hf_pn_io_control_command_applready, &u16Command);
5469     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5470                         hf_pn_io_control_command_release, &u16Command);
5471     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5472                         hf_pn_io_control_command_done, &u16Command);
5473     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5474                         hf_pn_io_control_command_ready_for_companion, &u16Command);
5475     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5476                         hf_pn_io_control_command_ready_for_rt_class3, &u16Command);
5477     /* Prm.Begin */
5478     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5479                         hf_pn_io_control_command_prmbegin, &u16Command);
5480
5481     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5482                         hf_pn_io_control_command_reserved_7_15, &u16Command);
5483
5484     /* ControlBlockProperties.reserved */
5485     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_control_command_reserved, NULL);
5486     return offset;
5487 }
5488
5489 /* dissect the SubmoduleListBlock  block */
5490 static int
5491 dissect_SubmoduleListBlock(tvbuff_t *tvb, int offset,
5492     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen _U_,
5493     pnio_ar_t **ar _U_)
5494 {
5495     guint16 u16Entries;
5496     guint32 u32API;
5497     guint16 u16SlotNumber;
5498     guint16 u16SubSlotNumber;
5499
5500     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5501         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5502             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5503         return offset;
5504     }
5505
5506     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_SubmoduleListEntries, &u16Entries);
5507
5508     while (u16Entries --)
5509     {
5510         /*API */
5511         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32API);
5512         /*SlotNumber */
5513         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNumber);
5514         /* SubSlotNumber */
5515         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubSlotNumber);
5516     }
5517     return offset;
5518 }
5519
5520
5521 /* dissect the PDevData block */
5522 static int
5523 dissect_PDevData_block(tvbuff_t *tvb, int offset,
5524     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5525 {
5526
5527     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5528         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5529             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5530         return offset;
5531     }
5532
5533     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5534
5535     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
5536
5537     return offset;
5538 }
5539
5540 /* dissect the AdjustPreambleLength block */
5541 static int
5542 dissect_AdjustPreambleLength_block(tvbuff_t *tvb, int offset,
5543     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5544 {
5545     guint16 u16AdjustProperties;
5546     guint16 u16PreambleLength;
5547
5548     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5549         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5550             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5551         return offset;
5552     }
5553
5554     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5555
5556     /* PreambleLength */
5557     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5558         hf_pn_io_PreambleLength, &u16PreambleLength);
5559
5560
5561     /* AdjustProperties */
5562     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5563         hf_pn_io_adjust_properties, &u16AdjustProperties);
5564
5565     return offset;
5566 }
5567
5568 /* dissect the dissect_CheckMAUTypeExtension_block block */
5569 static int
5570 dissect_CheckMAUTypeExtension_block(tvbuff_t *tvb, int offset,
5571     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5572 {
5573     guint16 u16MauTypeExtension;
5574
5575     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5576         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5577             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5578         return offset;
5579     }
5580
5581     /* MauTypeExtension */
5582     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension);
5583
5584     return offset;
5585 }
5586
5587 /* dissect the PDPortDataAdjust block */
5588 static int
5589 dissect_PDPortData_Adjust_block(tvbuff_t *tvb, int offset,
5590     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5591     guint16 u16BodyLength)
5592 {
5593     guint16   u16SlotNr;
5594     guint16   u16SubslotNr;
5595     tvbuff_t *new_tvb;
5596
5597
5598     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5599         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5600             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5601         return offset;
5602     }
5603
5604     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5605
5606     /* SlotNumber */
5607     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5608                         hf_pn_io_slot_nr, &u16SlotNr);
5609     /* Subslotnumber */
5610     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5611                         hf_pn_io_subslot_nr, &u16SubslotNr);
5612
5613     proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr);
5614
5615     u16BodyLength -= 6;
5616
5617     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
5618     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
5619     offset += u16BodyLength;
5620
5621     /* XXX - do we have to free the new_tvb somehow? */
5622
5623     return offset;
5624 }
5625
5626
5627 /* dissect the PDPortDataCheck blocks */
5628 static int
5629 dissect_PDPortData_Check_block(tvbuff_t *tvb, int offset,
5630     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5631     guint16 u16BodyLength)
5632 {
5633     guint16   u16SlotNr;
5634     guint16   u16SubslotNr;
5635     tvbuff_t *new_tvb;
5636
5637
5638     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5639         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5640             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5641         return offset;
5642     }
5643
5644     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5645
5646     /* SlotNumber */
5647     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5648                         hf_pn_io_slot_nr, &u16SlotNr);
5649     /* Subslotnumber */
5650     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5651                         hf_pn_io_subslot_nr, &u16SubslotNr);
5652
5653     proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr);
5654
5655     u16BodyLength -= 6;
5656
5657     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
5658     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
5659     offset += u16BodyLength;
5660
5661     /* XXX - do we have to free the new_tvb somehow? */
5662
5663     return offset;
5664 }
5665
5666 /* dissect the Line Delay */
5667 static int
5668 dissect_Line_Delay(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep,
5669     guint32  *u32LineDelayValue)
5670 {
5671     proto_item *sub_item;
5672     proto_tree *sub_tree;
5673     guint32  u32FormatIndicator;
5674     guint8   isFormatIndicatorEnabled;
5675
5676     sub_item = proto_tree_add_item(tree, hf_pn_io_line_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
5677     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_line_delay);
5678
5679     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5680         hf_pn_io_line_delay_format_indicator, &u32FormatIndicator);
5681
5682     isFormatIndicatorEnabled = (guint8)((u32FormatIndicator >> 31) & 0x01);
5683     if (isFormatIndicatorEnabled)
5684     {
5685         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5686             hf_pn_io_cable_delay_value, u32LineDelayValue);
5687     }
5688     else
5689     {
5690         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5691             hf_pn_io_line_delay_value, u32LineDelayValue);
5692     }
5693
5694     return offset;
5695 }
5696
5697 /* dissect the PDPortDataReal blocks */
5698 static int
5699 dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset,
5700     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5701 {
5702     guint16  u16SlotNr;
5703     guint16  u16SubslotNr;
5704     guint8   u8LengthOwnPortID;
5705     char    *pOwnPortID;
5706     guint8   u8NumberOfPeers;
5707     guint8   u8I;
5708     guint8   u8LengthPeerPortID;
5709     char    *pPeerPortID;
5710     guint8   u8LengthPeerChassisID;
5711     char    *pPeerChassisID;
5712     guint8   mac[6];
5713     guint16  u16MAUType;
5714     guint32  u32DomainBoundary;
5715     guint32  u32MulticastBoundary;
5716     guint16  u16PortState;
5717     guint32  u32MediaType;
5718     guint32  u32LineDelayValue;
5719
5720     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5721         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5722             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5723         return offset;
5724     }
5725
5726     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5727
5728     /* SlotNumber */
5729     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5730                         hf_pn_io_slot_nr, &u16SlotNr);
5731     /* Subslotnumber */
5732     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5733                         hf_pn_io_subslot_nr, &u16SubslotNr);
5734
5735     /* LengthOwnPortID */
5736     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5737                         hf_pn_io_length_own_port_id, &u8LengthOwnPortID);
5738     /* OwnPortID */
5739     pOwnPortID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthOwnPortID+1);
5740     tvb_memcpy(tvb, (guint8 *) pOwnPortID, offset, u8LengthOwnPortID);
5741     pOwnPortID[u8LengthOwnPortID] = '\0';
5742     proto_tree_add_string (tree, hf_pn_io_own_port_id, tvb, offset, u8LengthOwnPortID, pOwnPortID);
5743     offset += u8LengthOwnPortID;
5744
5745     /* NumberOfPeers */
5746     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5747                         hf_pn_io_number_of_peers, &u8NumberOfPeers);
5748     /* Padding */
5749     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5750
5751     u8I = u8NumberOfPeers;
5752     while (u8I--) {
5753         /* LengthPeerPortID */
5754         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5755                             hf_pn_io_length_peer_port_id, &u8LengthPeerPortID);
5756         /* PeerPortID */
5757         pPeerPortID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthPeerPortID+1);
5758         tvb_memcpy(tvb, (guint8 *) pPeerPortID, offset, u8LengthPeerPortID);
5759         pPeerPortID[u8LengthPeerPortID] = '\0';
5760         proto_tree_add_string (tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, pPeerPortID);
5761         offset += u8LengthPeerPortID;
5762
5763         /* LengthPeerChassisID */
5764         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5765                             hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID);
5766         /* PeerChassisID */
5767         pPeerChassisID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthPeerChassisID+1);
5768         tvb_memcpy(tvb, (guint8 *) pPeerChassisID, offset, u8LengthPeerChassisID);
5769         pPeerChassisID[u8LengthPeerChassisID] = '\0';
5770         proto_tree_add_string (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, pPeerChassisID);
5771         offset += u8LengthPeerChassisID;
5772
5773         /* Padding */
5774         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5775
5776         /* LineDelay */
5777         offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelayValue);
5778
5779         /* PeerMACAddress */
5780         offset = dissect_pn_mac(tvb, offset, pinfo, tree,
5781                             hf_pn_io_peer_macadd, mac);
5782         /* Padding */
5783         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5784     }
5785
5786     /* MAUType */
5787     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5788                         hf_pn_io_mau_type, &u16MAUType);
5789     /* Padding */
5790     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5791
5792     /* DomainBoundary */
5793     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5794                         hf_pn_io_domain_boundary, &u32DomainBoundary);
5795     /* MulticastBoundary */
5796     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5797                         hf_pn_io_multicast_boundary, &u32MulticastBoundary);
5798     /* PortState */
5799     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5800                         hf_pn_io_port_state, &u16PortState);
5801     /* Padding */
5802     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5803
5804     /* MediaType */
5805     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5806                         hf_pn_io_media_type, &u32MediaType);
5807
5808     proto_item_append_text(item, ": Slot:0x%x/0x%x, OwnPortID:%s, Peers:%u PortState:%s MediaType:%s",
5809         u16SlotNr, u16SubslotNr, pOwnPortID, u8NumberOfPeers,
5810         val_to_str(u16PortState, pn_io_port_state, "0x%x"),
5811         val_to_str(u32MediaType, pn_io_media_type, "0x%x"));
5812
5813     return offset;
5814 }
5815
5816
5817 static int
5818 dissect_PDInterfaceMrpDataAdjust_block(tvbuff_t *tvb, int offset,
5819     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
5820 {
5821     e_guid_t  uuid;
5822     guint16   u16Role;
5823     guint8    u8LengthDomainName;
5824     guint8    u8NumberOfMrpInstances;
5825     char     *pDomainName;
5826     int       iStartOffset = offset;
5827
5828
5829     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { /* added low version == 1 */
5830         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5831             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5832         return offset;
5833     }
5834
5835     if (u8BlockVersionLow == 0) /*dissect LowVersion == 0 */
5836     {
5837     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5838
5839     /* MRP_DomainUUID */
5840     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5841                         hf_pn_io_mrp_domain_uuid, &uuid);
5842     /* MRP_Role */
5843     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5844                     hf_pn_io_mrp_role, &u16Role);
5845     /* Padding */
5846     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5847
5848     /* MRP_LengthDomainName */
5849     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5850                     hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
5851     /* MRP_DomainName */
5852     pDomainName = (char *)wmem_alloc(wmem_packet_scope(), u8LengthDomainName+1);
5853     tvb_memcpy(tvb, (guint8 *) pDomainName, offset, u8LengthDomainName);
5854     pDomainName[u8LengthDomainName] = '\0';
5855     proto_tree_add_string (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, pDomainName);
5856     offset += u8LengthDomainName;
5857
5858     /* Padding */
5859     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5860     if ((offset - iStartOffset) < u16BodyLength)
5861     {
5862         offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
5863     }
5864     }
5865     else if (u8BlockVersionLow == 1) /*dissect LowVersion == 1 */
5866     {
5867         /* Padding one byte */
5868         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5869         /* Number of Mrp Instances */
5870         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5871             hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
5872         if (u8NumberOfMrpInstances > 0xf) {
5873              expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
5874             return offset;
5875         }
5876         while(u8NumberOfMrpInstances > 0)
5877         {
5878             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5879             u8NumberOfMrpInstances--;
5880         }
5881     }
5882     return offset;
5883 }
5884
5885
5886 static int
5887 dissect_PDInterfaceMrpDataReal_block(tvbuff_t *tvb, int offset,
5888     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
5889 {
5890     e_guid_t  uuid;
5891     guint16   u16Role;
5892     guint16   u16Version;
5893     guint8    u8LengthDomainName;
5894     guint8    u8NumberOfMrpInstances;
5895     char     *pDomainName;
5896     int       endoffset = offset + u16BodyLength;
5897
5898     /* added blockversion 1 */
5899     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 2) {
5900         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5901             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5902         return offset;
5903     }
5904
5905     if (u8BlockVersionLow < 2) /* dissect low versions 0 and 1 */
5906     {
5907         /* Padding */
5908         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5909
5910         /* MRP_DomainUUID */
5911         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5912                 hf_pn_io_mrp_domain_uuid, &uuid);
5913         /* MRP_Role */
5914         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5915                 hf_pn_io_mrp_role, &u16Role);
5916
5917         if (u8BlockVersionLow == 1) {
5918             /* MRP_Version */
5919             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5920                     hf_pn_io_mrp_version, &u16Version);
5921         }
5922         /* MRP_LengthDomainName */
5923         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5924                 hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
5925         /* MRP_DomainName */
5926         pDomainName = (char *)wmem_alloc(wmem_packet_scope(), u8LengthDomainName+1);
5927         tvb_memcpy(tvb, (guint8 *) pDomainName, offset, u8LengthDomainName);
5928         pDomainName[u8LengthDomainName] = '\0';
5929         proto_tree_add_string (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, pDomainName);
5930         offset += u8LengthDomainName;
5931
5932         if (u8BlockVersionLow == 0) {
5933             /* MRP_Version */
5934             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5935                     hf_pn_io_mrp_version, &u16Version);
5936         }
5937         /* Padding */
5938         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5939
5940         while(endoffset > offset)
5941         {
5942             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5943         }
5944     }
5945     else if (u8BlockVersionLow == 2)
5946     {
5947         /* Padding one byte */
5948         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5949         /* Number of Mrp Instances */
5950         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5951                 hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
5952         if (u8NumberOfMrpInstances > 0xf) {
5953             expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
5954             return offset;
5955         }
5956         while(u8NumberOfMrpInstances > 0)
5957         {
5958             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5959             u8NumberOfMrpInstances--;
5960         }
5961     }
5962     return offset;
5963 }
5964
5965
5966 static int
5967 dissect_PDInterfaceMrpDataCheck_block(tvbuff_t *tvb, int offset,
5968     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5969 {
5970     e_guid_t uuid;
5971     guint32 u32Check;
5972     guint8 u8NumberOfMrpInstances;
5973
5974     /* BlockVersionLow == 1 added */
5975     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
5976         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5977             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5978         return offset;
5979     }
5980     if (u8BlockVersionLow == 0)
5981     {
5982     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5983
5984     /* MRP_DomainUUID */
5985     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5986                         hf_pn_io_mrp_domain_uuid, &uuid);
5987
5988     /* MRP_Check */
5989         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5990             hf_pn_io_mrp_check, &u32Check);
5991         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5992             hf_pn_io_mrp_check_mrm, &u32Check);
5993         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5994             hf_pn_io_mrp_check_mrpdomain, &u32Check);
5995         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5996             hf_pn_io_mrp_check_reserved_1, &u32Check);
5997         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5998             hf_pn_io_mrp_check_reserved_2, &u32Check);
5999         offset +=4; /* MRP_Check (32 bit) done */
6000     }
6001     else if (u8BlockVersionLow == 1)
6002     {
6003         /* Padding one byte */
6004         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6005         /* Number of Mrp Instances */
6006         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6007             hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
6008         if (u8NumberOfMrpInstances > 0xf) {
6009             expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
6010             return offset;
6011         }
6012         while(u8NumberOfMrpInstances > 0)
6013         {
6014             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
6015             u8NumberOfMrpInstances--;
6016         }
6017     }
6018
6019     return offset;
6020 }
6021
6022
6023 static int
6024 dissect_PDPortMrpData_block(tvbuff_t *tvb, int offset,
6025     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6026 {
6027     e_guid_t uuid;
6028     guint8  u8MrpInstance;
6029
6030     /* added BlockVersionLow == 1 */
6031     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
6032         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6033             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6034         return offset;
6035     }
6036     if (u8BlockVersionLow == 0) {
6037     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6038     }
6039     else /*if (u8BlockVersionLow == 1) */
6040     {
6041         /* Padding one byte */
6042         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6043         /* Mrp Instance */
6044         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6045             hf_pn_io_mrp_instance, &u8MrpInstance);
6046     }
6047     /* MRP_DomainUUID */
6048     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6049                         hf_pn_io_mrp_domain_uuid, &uuid);
6050     return offset;
6051 }
6052
6053
6054 static int
6055 dissect_MrpManagerParams_block(tvbuff_t *tvb, int offset,
6056     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6057 {
6058     guint16 u16Prio;
6059     guint16 u16TOPchgT;
6060     guint16 u16TOPNRmax;
6061     guint16 u16TSTshortT;
6062     guint16 u16TSTdefaultT;
6063     guint16 u16TSTNRmax;
6064
6065
6066     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6067         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6068             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6069         return offset;
6070     }
6071
6072     /* MRP_Prio */
6073     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6074                     hf_pn_io_mrp_prio, &u16Prio);
6075     /* MRP_TOPchgT */
6076     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6077                     hf_pn_io_mrp_topchgt, &u16TOPchgT);
6078     /* MRP_TOPNRmax */
6079     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6080                     hf_pn_io_mrp_topnrmax, &u16TOPNRmax);
6081     /* MRP_TSTshortT */
6082     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6083                     hf_pn_io_mrp_tstshortt, &u16TSTshortT);
6084     /* MRP_TSTdefaultT */
6085     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6086                     hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT);
6087     /* MSP_TSTNRmax */
6088     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6089                     hf_pn_io_mrp_tstnrmax, &u16TSTNRmax);
6090     /* Padding */
6091     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6092
6093     return offset;
6094 }
6095
6096
6097 static int
6098 dissect_MrpRTMode(tvbuff_t *tvb, int offset,
6099     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
6100 {
6101     proto_item *sub_item;
6102     proto_tree *sub_tree;
6103     guint32     u32RTMode;
6104
6105
6106     /* MRP_RTMode */
6107     sub_item = proto_tree_add_item(tree, hf_pn_io_mrp_rtmode, tvb, offset, 4, ENC_BIG_ENDIAN);
6108     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_mrp_rtmode);
6109
6110     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6111                     hf_pn_io_mrp_rtmode_reserved2, &u32RTMode);
6112     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6113                     hf_pn_io_mrp_rtmode_reserved1, &u32RTMode);
6114     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6115                     hf_pn_io_mrp_rtmode_rtclass3, &u32RTMode);
6116     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6117                     hf_pn_io_mrp_rtmode_rtclass12, &u32RTMode);
6118
6119     return offset;
6120 }
6121
6122
6123 static int
6124 dissect_MrpRTModeManagerData_block(tvbuff_t *tvb, int offset,
6125     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6126 {
6127     guint16 u16TSTNRmax;
6128     guint16 u16TSTdefaultT;
6129
6130
6131     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6132         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6133             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6134         return offset;
6135     }
6136
6137     /* MSP_TSTNRmax */
6138     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6139                     hf_pn_io_mrp_tstnrmax, &u16TSTNRmax);
6140     /* MRP_TSTdefaultT */
6141     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6142                     hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT);
6143     /* Padding */
6144     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6145
6146     /* MRP_RTMode */
6147     offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep);
6148
6149     return offset;
6150 }
6151
6152
6153 static int
6154 dissect_MrpRingStateData_block(tvbuff_t *tvb, int offset,
6155     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6156 {
6157     guint16 u16RingState;
6158
6159
6160     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6161         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6162             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6163         return offset;
6164     }
6165
6166     /* MRP_RingState */
6167     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6168                     hf_pn_io_mrp_ring_state, &u16RingState);
6169
6170     return offset;
6171 }
6172
6173
6174 static int
6175 dissect_MrpRTStateData_block(tvbuff_t *tvb, int offset,
6176     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6177 {
6178     guint16 u16RTState;
6179
6180
6181     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6182         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6183             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6184         return offset;
6185     }
6186
6187     /* MRP_RTState */
6188     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6189                     hf_pn_io_mrp_rt_state, &u16RTState);
6190
6191     return offset;
6192 }
6193
6194
6195 static int
6196 dissect_MrpClientParams_block(tvbuff_t *tvb, int offset,
6197     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6198 {
6199     guint16 u16MRP_LNKdownT;
6200     guint16 u16MRP_LNKupT;
6201     guint16 u16MRP_LNKNRmax;
6202
6203
6204     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6205         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6206             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6207         return offset;
6208     }
6209
6210     /* MRP_LNKdownT */
6211     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6212                     hf_pn_io_mrp_lnkdownt, &u16MRP_LNKdownT);
6213     /* MRP_LNKupT */
6214     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6215                     hf_pn_io_mrp_lnkupt, &u16MRP_LNKupT);
6216     /* MRP_LNKNRmax u16 */
6217     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6218                     hf_pn_io_mrp_lnknrmax, &u16MRP_LNKNRmax);
6219
6220     return offset;
6221 }
6222
6223
6224 static int
6225 dissect_MrpRTModeClientData_block(tvbuff_t *tvb, int offset,
6226     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6227 {
6228     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6229
6230     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6231         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6232             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6233         return offset;
6234     }
6235
6236     /* MRP_RTMode */
6237     offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep);
6238
6239     return offset;
6240 }
6241
6242
6243 static int
6244 dissect_CheckSyncDifference_block(tvbuff_t *tvb, int offset,
6245     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6246 {
6247     proto_item *sub_item;
6248     proto_tree *sub_tree;
6249     guint16     u16CheckSyncMode;
6250
6251
6252     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6253         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6254             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6255         return offset;
6256     }
6257
6258     sub_item = proto_tree_add_item(tree, hf_pn_io_check_sync_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
6259     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_check_sync_mode);
6260
6261     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6262                     hf_pn_io_check_sync_mode_reserved, &u16CheckSyncMode);
6263     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6264                     hf_pn_io_check_sync_mode_sync_master, &u16CheckSyncMode);
6265     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6266                     hf_pn_io_check_sync_mode_cable_delay, &u16CheckSyncMode);
6267
6268
6269     proto_item_append_text(sub_item, "CheckSyncMode: SyncMaster:%d, CableDelay:%d",
6270         (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1);
6271
6272     proto_item_append_text(item, " : SyncMaster:%d, CableDelay:%d",
6273         (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1);
6274
6275     return offset;
6276 }
6277
6278
6279 static int
6280 dissect_CheckMAUTypeDifference_block(tvbuff_t *tvb, int offset,
6281     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6282 {
6283     guint16 u16MAUTypeMode;
6284
6285     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6286         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6287             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6288         return offset;
6289     }
6290
6291     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6292                     hf_pn_io_mau_type_mode, &u16MAUTypeMode);
6293
6294     proto_item_append_text(item, ": MAUTypeMode:%s",
6295         val_to_str(u16MAUTypeMode, pn_io_mau_type_mode, "0x%x"));
6296
6297     return offset;
6298 }
6299
6300
6301 /* dissect the AdjustDomainBoundary blocks */
6302 static int
6303 dissect_AdjustDomainBoundary_block(tvbuff_t *tvb, int offset,
6304     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6305 {
6306     guint32 u32DomainBoundary;
6307     guint32 u32DomainBoundaryIngress;
6308     guint32 u32DomainBoundaryEgress;
6309     guint16 u16AdjustProperties;
6310
6311
6312     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
6313         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6314             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6315         return offset;
6316     }
6317
6318     /* Padding */
6319     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6320
6321     switch (u8BlockVersionLow) {
6322         case(0):
6323         /* DomainBoundary */
6324         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6325                             hf_pn_io_domain_boundary, &u32DomainBoundary);
6326         /* AdjustProperties */
6327         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6328                             hf_pn_io_adjust_properties, &u16AdjustProperties);
6329         /* Padding */
6330         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6331
6332         proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x",
6333             u32DomainBoundary, u16AdjustProperties);
6334
6335         break;
6336         case(1):
6337         /* DomainBoundaryIngress */
6338         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6339                             hf_pn_io_domain_boundary_ingress, &u32DomainBoundaryIngress);
6340         /* DomainBoundaryEgress */
6341         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6342                             hf_pn_io_domain_boundary_egress, &u32DomainBoundaryEgress);
6343         /* AdjustProperties */
6344         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6345                             hf_pn_io_adjust_properties, &u16AdjustProperties);
6346         /* Padding */
6347         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6348
6349         proto_item_append_text(item, ": BoundaryIngress:0x%x, BoundaryEgress:0x%x, Properties:0x%x",
6350             u32DomainBoundaryIngress, u32DomainBoundaryEgress, u16AdjustProperties);
6351
6352         break;
6353         default:
6354         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6355             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6356         return offset;
6357     }
6358
6359     return offset;
6360 }
6361
6362
6363 /* dissect the AdjustMulticastBoundary blocks */
6364 static int
6365 dissect_AdjustMulticastBoundary_block(tvbuff_t *tvb, int offset,
6366     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6367 {
6368     guint32 u32MulticastBoundary;
6369     guint16 u16AdjustProperties;
6370
6371
6372     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6373         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6374             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6375         return offset;
6376     }
6377
6378     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6379
6380     /* Boundary */
6381     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6382                         hf_pn_io_multicast_boundary, &u32MulticastBoundary);
6383     /* AdjustProperties */
6384     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6385                         hf_pn_io_adjust_properties, &u16AdjustProperties);
6386
6387     proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x",
6388         u32MulticastBoundary, u16AdjustProperties);
6389
6390     return offset;
6391 }
6392
6393
6394 /* dissect the AdjustMAUType block */
6395 static int
6396 dissect_AdjustMAUType_block(tvbuff_t *tvb, int offset,
6397     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6398 {
6399     guint16 u16MAUType;
6400     guint16 u16AdjustProperties;
6401
6402
6403     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6404         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6405             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6406         return offset;
6407     }
6408
6409     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6410
6411     /* MAUType */
6412     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6413                         hf_pn_io_mau_type, &u16MAUType);
6414     /* AdjustProperties */
6415     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6416                         hf_pn_io_adjust_properties, &u16AdjustProperties);
6417
6418     proto_item_append_text(item, ": MAUType:%s, Properties:0x%x",
6419         val_to_str(u16MAUType, pn_io_mau_type, "0x%x"),
6420         u16AdjustProperties);
6421
6422     return offset;
6423 }
6424
6425
6426 /* dissect the CheckMAUType block */
6427 static int
6428 dissect_CheckMAUType_block(tvbuff_t *tvb, int offset,
6429     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6430 {
6431     guint16 u16MAUType;
6432
6433
6434     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6435         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6436             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6437         return offset;
6438     }
6439
6440     /* MAUType */
6441     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6442                         hf_pn_io_mau_type, &u16MAUType);
6443
6444     proto_item_append_text(item, ": MAUType:%s",
6445         val_to_str(u16MAUType, pn_io_mau_type, "0x%x"));
6446
6447     return offset;
6448 }
6449
6450
6451 /* dissect the CheckLineDelay block */
6452 static int
6453 dissect_CheckLineDelay_block(tvbuff_t *tvb, int offset,
6454     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6455 {
6456     guint32 u32LineDelay;
6457
6458
6459     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6460         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6461             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6462         return offset;
6463     }
6464
6465     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6466
6467     /* LineDelay */
6468     offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelay);
6469
6470     proto_item_append_text(item, ": LineDelay:%uns", u32LineDelay);
6471
6472     return offset;
6473 }
6474
6475
6476 /* dissect the CheckPeers block */
6477 static int
6478 dissect_CheckPeers_block(tvbuff_t *tvb, int offset,
6479     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6480 {
6481     guint8  u8NumberOfPeers;
6482     guint8  u8I;
6483     guint8  u8LengthPeerPortID;
6484     char   *pPeerPortID;
6485     guint8  u8LengthPeerChassisID;
6486     char   *pPeerChassisID;
6487
6488
6489     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6490         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6491             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6492         return offset;
6493     }
6494
6495     /* NumberOfPeers */
6496     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6497                         hf_pn_io_number_of_peers, &u8NumberOfPeers);
6498
6499     u8I = u8NumberOfPeers;
6500     while (u8I--) {
6501         /* LengthPeerPortID */
6502         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6503                             hf_pn_io_length_peer_port_id, &u8LengthPeerPortID);
6504         /* PeerPortID */
6505         pPeerPortID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthPeerPortID+1);
6506         tvb_memcpy(tvb, (guint8 *) pPeerPortID, offset, u8LengthPeerPortID);
6507         pPeerPortID[u8LengthPeerPortID] = '\0';
6508         proto_tree_add_string (tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, pPeerPortID);
6509         offset += u8LengthPeerPortID;
6510
6511         /* LengthPeerChassisID */
6512         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6513                             hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID);
6514         /* PeerChassisID */
6515         pPeerChassisID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthPeerChassisID+1);
6516         tvb_memcpy(tvb, (guint8 *) pPeerChassisID, offset, u8LengthPeerChassisID);
6517         pPeerChassisID[u8LengthPeerChassisID] = '\0';
6518         proto_tree_add_string (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, pPeerChassisID);
6519         offset += u8LengthPeerChassisID;
6520     }
6521
6522     proto_item_append_text(item, ": NumberOfPeers:%u", u8NumberOfPeers);
6523
6524     return offset;
6525 }
6526
6527
6528 /* dissect the AdjustPortState block */
6529 static int
6530 dissect_AdjustPortState_block(tvbuff_t *tvb, int offset,
6531     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6532 {
6533     guint16 u16PortState;
6534     guint16 u16AdjustProperties;
6535
6536
6537     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6538         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6539             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6540         return offset;
6541     }
6542
6543     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6544
6545     /* PortState */
6546     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6547                         hf_pn_io_port_state, &u16PortState);
6548     /* AdjustProperties */
6549     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6550                         hf_pn_io_adjust_properties, &u16AdjustProperties);
6551
6552     proto_item_append_text(item, ": PortState:%s, Properties:0x%x",
6553         val_to_str(u16PortState, pn_io_port_state, "0x%x"),
6554         u16AdjustProperties);
6555
6556     return offset;
6557 }
6558
6559
6560 /* dissect the CheckPortState block */
6561 static int
6562 dissect_CheckPortState_block(tvbuff_t *tvb, int offset,
6563     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6564 {
6565     guint16 u16PortState;
6566
6567
6568     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6569         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6570             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6571         return offset;
6572     }
6573
6574     /* PortState */
6575     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6576                         hf_pn_io_port_state, &u16PortState);
6577
6578     proto_item_append_text(item, ": %s",
6579         val_to_str(u16PortState, pn_io_port_state, "0x%x"));
6580     return offset;
6581 }
6582
6583
6584 /* dissect the PDPortFODataReal block */
6585 static int
6586 dissect_PDPortFODataReal_block(tvbuff_t *tvb, int offset,
6587     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
6588     guint16 u16BodyLength)
6589 {
6590     guint32    u32FiberOpticType;
6591     guint32    u32FiberOpticCableType;
6592     guint16    u16Index = 0;
6593     guint32    u32RecDataLen;
6594     pnio_ar_t *ar       = NULL;
6595
6596
6597     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6598         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6599             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6600         return offset;
6601     }
6602
6603     /* Padding */
6604     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6605
6606     /* FiberOpticType */
6607     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6608                         hf_pn_io_fiber_optic_type, &u32FiberOpticType);
6609
6610     /* FiberOpticCableType */
6611     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6612                         hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType);
6613
6614     /* optional: FiberOpticManufacturerSpecific */
6615     if (u16BodyLength != 10) {
6616         dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6617     }
6618
6619     return offset;
6620 }
6621
6622
6623 /* dissect the FiberOpticManufacturerSpecific block */
6624 static int
6625 dissect_FiberOpticManufacturerSpecific_block(tvbuff_t *tvb, int offset,
6626     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
6627     guint16 u16BodyLength)
6628 {
6629     guint8  u8VendorIDHigh;
6630     guint8  u8VendorIDLow;
6631     guint16 u16VendorBlockType;
6632
6633
6634     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6635         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6636             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6637         return offset;
6638     }
6639
6640     /* x8 VendorIDHigh */
6641     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6642                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
6643     /* x8 VendorIDLow */
6644     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6645                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
6646
6647     /* VendorBlockType */
6648     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6649                     hf_pn_io_vendor_block_type, &u16VendorBlockType);
6650     /* Data */
6651     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength-4, "Data");
6652
6653     return offset;
6654 }
6655
6656
6657 /* dissect the FiberOpticDiagnosisInfo block */
6658 static int
6659 dissect_FiberOpticDiagnosisInfo_block(tvbuff_t *tvb, int offset,
6660     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6661 {
6662     guint32 u32FiberOpticPowerBudget;
6663
6664
6665     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6666         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6667             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6668         return offset;
6669     }
6670
6671     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
6672
6673     /* decode the u32FiberOpticPowerBudget better */
6674     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6675                         hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget);
6676
6677     return offset;
6678 }
6679
6680 /* dissect the AdjustMAUTypeExtension block */
6681 static int
6682 dissect_AdjustMAUTypeExtension_block(tvbuff_t *tvb, int offset,
6683     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6684 {
6685     guint16 u16MauTypeExtension;
6686     guint16 u16AdjustProperties;
6687
6688     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6689         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6690             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6691         return offset;
6692     }
6693
6694     /* Padding */
6695     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6696
6697     /* MauTypeExtension */
6698     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension);
6699
6700     /* Properties */
6701     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6702         hf_pn_io_adjust_properties, &u16AdjustProperties);
6703
6704     return offset;
6705 }
6706
6707 /* dissect the PDPortFODataAdjust block */
6708 static int
6709 dissect_PDPortFODataAdjust_block(tvbuff_t *tvb, int offset,
6710     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6711 {
6712     guint32 u32FiberOpticType;
6713     guint32 u32FiberOpticCableType;
6714
6715
6716     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6717         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6718             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6719         return offset;
6720     }
6721
6722     /* Padding */
6723     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6724
6725     /* FiberOpticType */
6726     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6727                         hf_pn_io_fiber_optic_type, &u32FiberOpticType);
6728
6729     /* FiberOpticCableType */
6730     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6731                         hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType);
6732
6733 /*
6734     proto_item_append_text(item, ": %s",
6735         val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/
6736
6737     return offset;
6738 }
6739
6740
6741 /* dissect the PDPortFODataCheck block */
6742 static int
6743 dissect_PDPortFODataCheck_block(tvbuff_t *tvb, int offset,
6744     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6745 {
6746     guint32 u32FiberOpticPowerBudget;
6747
6748
6749     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6750         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6751             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6752         return offset;
6753     }
6754
6755     /* Padding */
6756     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6757
6758     /* MaintenanceRequiredPowerBudget */
6759     /* XXX - decode the u32FiberOpticPowerBudget better */
6760     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6761                         hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget);
6762
6763     /* MaintenanceDemandedPowerBudget */
6764     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6765                         hf_pn_io_maintenance_demanded_power_budget, &u32FiberOpticPowerBudget);
6766
6767     /* ErrorPowerBudget */
6768     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6769                         hf_pn_io_error_power_budget, &u32FiberOpticPowerBudget);
6770
6771 /*
6772     proto_item_append_text(item, ": %s",
6773         val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/
6774
6775     return offset;
6776 }
6777
6778 /* dissect the AdjustPeerToPeerBoundary block */
6779 static int
6780 dissect_AdjustPeerToPeerBoundary_block(tvbuff_t *tvb, int offset,
6781     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6782 {
6783     proto_item *sub_item;
6784     proto_tree *sub_tree;
6785     guint32 u32PeerToPeerBoundary;
6786     guint16 u16AdjustProperties;
6787
6788     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6789         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6790             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6791         return offset;
6792     }
6793
6794     /* Padding */
6795     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6796
6797     sub_item = proto_tree_add_item(tree, hf_pn_io_peer_to_peer_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN);
6798     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_peer_to_peer_boundary);
6799
6800     /* PeerToPeerBoundary.Bit0 */
6801     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit0, &u32PeerToPeerBoundary);
6802
6803     /* PeerToPeerBoundary.Bit1 */
6804     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit1, &u32PeerToPeerBoundary);
6805
6806     /* PeerToPeerBoundary.Bit2 */
6807     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit2, &u32PeerToPeerBoundary);
6808
6809     /* PeerToPeerBoundary.OtherBits */
6810     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_otherbits, &u32PeerToPeerBoundary);
6811
6812     /* Properties */
6813     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6814         hf_pn_io_adjust_properties, &u16AdjustProperties);
6815
6816     return offset;
6817 }
6818
6819
6820 /* dissect the AdjustDCPBoundary block */
6821 static int
6822 dissect_AdjustDCPBoundary_block(tvbuff_t *tvb, int offset,
6823     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6824 {
6825     proto_item *sub_item;
6826     proto_tree *sub_tree;
6827     guint32 u32DcpBoundary;
6828     guint16 u16AdjustProperties;
6829
6830     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6831         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6832             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6833         return offset;
6834     }
6835
6836     /* Padding */
6837     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6838
6839     sub_item = proto_tree_add_item(tree, hf_pn_io_dcp_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN);
6840     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_dcp_boundary);
6841
6842     /* DcpBoundary.Bit0 */
6843     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit0, &u32DcpBoundary);
6844
6845     /* DcpBoundary.Bit1 */
6846     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit1, &u32DcpBoundary);
6847
6848     /* DcpBoundary.OtherBits */
6849     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_otherbits, &u32DcpBoundary);
6850
6851     /* Properties */
6852     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6853         hf_pn_io_adjust_properties, &u16AdjustProperties);
6854
6855     return offset;
6856 }
6857
6858 static int
6859 dissect_MrpInstanceDataAdjust_block(tvbuff_t *tvb, int offset,
6860     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
6861 {
6862     guint8  u8MrpInstance;
6863     e_guid_t uuid;
6864     guint16 u16Role;
6865     guint8  u8LengthDomainName;
6866     char*   pDomainName;
6867     int endoffset = offset + u16BodyLength;
6868
6869     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6870         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6871             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6872         return offset;
6873     }
6874     /* Padding one byte */
6875     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6876     /* Mrp Instance */
6877     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6878         hf_pn_io_mrp_instance, &u8MrpInstance);
6879     /* MRP_DomainUUID */
6880     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6881         hf_pn_io_mrp_domain_uuid, &uuid);
6882     /* MRP_Role */
6883     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6884                     hf_pn_io_mrp_role, &u16Role);
6885     /* Padding */
6886     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6887     /* MRP_LengthDomainName */
6888     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6889                     hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
6890     /* MRP_DomainName */
6891     pDomainName = (char *)wmem_alloc(wmem_packet_scope(), u8LengthDomainName+1);
6892     tvb_memcpy(tvb, (guint8 *) pDomainName, offset, u8LengthDomainName);
6893     pDomainName[u8LengthDomainName] = '\0';
6894     proto_tree_add_string (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, pDomainName);
6895     offset += u8LengthDomainName;
6896     /* Padding */
6897     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6898     while(endoffset > offset)
6899     {
6900         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
6901     }
6902
6903     return offset;
6904 }
6905
6906 static int
6907 dissect_MrpInstanceDataReal_block(tvbuff_t *tvb, int offset,
6908     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
6909 {
6910     guint8  u8MrpInstance;
6911     e_guid_t uuid;
6912     guint16 u16Role;
6913     guint16 u16Version;
6914     guint8  u8LengthDomainName;
6915     char*   pDomainName;
6916     int     endoffset = offset + u16BodyLength;
6917
6918     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6919         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6920             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6921         return offset;
6922     }
6923     /* Padding one byte */
6924     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6925     /* Mrp Instance */
6926     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6927         hf_pn_io_mrp_instance, &u8MrpInstance);
6928     /* MRP_DomainUUID */
6929     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6930         hf_pn_io_mrp_domain_uuid, &uuid);
6931     /* MRP_Role */
6932     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6933                     hf_pn_io_mrp_role, &u16Role);
6934     /* MRP_Version */
6935     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6936         hf_pn_io_mrp_version, &u16Version);
6937     /* MRP_LengthDomainName */
6938     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6939                     hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
6940     /* MRP_DomainName */
6941     pDomainName = (char *)wmem_alloc(wmem_packet_scope(), u8LengthDomainName+1);
6942     tvb_memcpy(tvb, (guint8 *) pDomainName, offset, u8LengthDomainName);
6943     pDomainName[u8LengthDomainName] = '\0';
6944     proto_tree_add_string (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, pDomainName);
6945     offset += u8LengthDomainName;
6946     /* Padding */
6947     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6948
6949     while(endoffset > offset)
6950     {
6951         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
6952     }
6953     return offset;
6954 }
6955
6956 static int
6957 dissect_MrpInstanceDataCheck_block(tvbuff_t *tvb, int offset,
6958     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_)
6959 {
6960     guint8  u8MrpInstance;
6961     guint32 u32Check;
6962     e_guid_t uuid;
6963
6964     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6965         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6966             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6967         return offset;
6968     }
6969     /* Padding one byte */
6970     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6971     /* Mrp Instance */
6972     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6973         hf_pn_io_mrp_instance, &u8MrpInstance);
6974     /* MRP_DomainUUID */
6975     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6976         hf_pn_io_mrp_domain_uuid, &uuid);
6977
6978     /* MRP_Check */
6979     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6980                           hf_pn_io_mrp_check, &u32Check);
6981     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6982                           hf_pn_io_mrp_check_mrm, &u32Check);
6983     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6984                           hf_pn_io_mrp_check_mrpdomain, &u32Check);
6985     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6986                           hf_pn_io_mrp_check_reserved_1, &u32Check);
6987     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6988                           hf_pn_io_mrp_check_reserved_2, &u32Check);
6989     offset +=4; /* MRP_Check (32 bit) done */
6990
6991     return offset;
6992 }
6993
6994 /* PDInterfaceAdjust */
6995 static int
6996 dissect_PDInterfaceAdjust_block(tvbuff_t *tvb, int offset,
6997  packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6998 {
6999     guint32     u32SMultipleInterfaceMode;
7000
7001     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7002         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7003             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7004     return offset;
7005 }
7006     /* Padding */
7007     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7008 /* MultipleInterfaceMode */
7009     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7010                         hf_pn_io_MultipleInterfaceMode_NameOfDevice, &u32SMultipleInterfaceMode);
7011     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7012                         hf_pn_io_MultipleInterfaceMode_reserved_1, &u32SMultipleInterfaceMode);
7013     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7014                         hf_pn_io_MultipleInterfaceMode_reserved_2, &u32SMultipleInterfaceMode);
7015     return offset;
7016 }
7017
7018 /* PDPortStatistic for one subslot */
7019 static int
7020 dissect_PDPortStatistic_block(tvbuff_t *tvb, int offset,
7021  packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7022 {
7023     guint32 u32StatValue;
7024     guint16 u16CounterStatus;
7025     proto_item *sub_item;
7026     proto_tree *sub_tree;
7027     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
7028         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7029             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7030         return offset;
7031     }
7032     switch (u8BlockVersionLow) {
7033     case(0):
7034         /* Padding */
7035         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7036     break;
7037     case(1):
7038         sub_item = proto_tree_add_item(tree, hf_pn_io_pdportstatistic_counter_status, tvb, offset, 2, ENC_BIG_ENDIAN);
7039         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_counter_status);
7040         /* bit 0 */
7041         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7042             hf_pn_io_pdportstatistic_counter_status_ifInOctets, &u16CounterStatus);
7043         /* bit 1 */
7044         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7045             hf_pn_io_pdportstatistic_counter_status_ifOutOctets, &u16CounterStatus);
7046         /* bit 2 */
7047         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7048             hf_pn_io_pdportstatistic_counter_status_ifInDiscards, &u16CounterStatus);
7049         /* bit 3 */
7050         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7051             hf_pn_io_pdportstatistic_counter_status_ifOutDiscards, &u16CounterStatus);
7052         /* bit 4 */
7053         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7054             hf_pn_io_pdportstatistic_counter_status_ifInErrors, &u16CounterStatus);
7055         /* bit 5 */
7056         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7057             hf_pn_io_pdportstatistic_counter_status_ifOutErrors, &u16CounterStatus);
7058         /* bit 6-15 */
7059         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7060             hf_pn_io_pdportstatistic_counter_status_reserved, &u16CounterStatus);
7061     break;
7062     default: /* will not execute because of the line preceding the switch */
7063     break;
7064     }
7065
7066     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7067                         hf_pn_io_pdportstatistic_ifInOctets, &u32StatValue);
7068     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7069                         hf_pn_io_pdportstatistic_ifOutOctets, &u32StatValue);
7070
7071     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7072                         hf_pn_io_pdportstatistic_ifInDiscards, &u32StatValue);
7073     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7074                         hf_pn_io_pdportstatistic_ifOutDiscards, &u32StatValue);
7075
7076     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7077                         hf_pn_io_pdportstatistic_ifInErrors, &u32StatValue);
7078     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7079                         hf_pn_io_pdportstatistic_ifOutErrors, &u32StatValue);
7080
7081     return offset;
7082 }
7083
7084
7085 /* dissect the PDInterfaceDataReal block */
7086 static int
7087 dissect_PDInterfaceDataReal_block(tvbuff_t *tvb, int offset,
7088     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7089 {
7090     guint8   u8LengthOwnChassisID;
7091     char    *pOwnChassisID;
7092     guint8   mac[6];
7093     guint32  ip;
7094
7095
7096     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7097         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7098             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7099         return offset;
7100     }
7101
7102     /* LengthOwnChassisID */
7103     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
7104                         hf_pn_io_length_own_chassis_id, &u8LengthOwnChassisID);
7105     /* OwnChassisID */
7106     pOwnChassisID = (char *)wmem_alloc(wmem_packet_scope(), u8LengthOwnChassisID+1);
7107     tvb_memcpy(tvb, (guint8 *) pOwnChassisID, offset, u8LengthOwnChassisID);
7108     pOwnChassisID[u8LengthOwnChassisID] = '\0';
7109     proto_tree_add_string (tree, hf_pn_io_own_chassis_id, tvb, offset, u8LengthOwnChassisID, pOwnChassisID);
7110     offset += u8LengthOwnChassisID;
7111
7112     /* Padding */
7113     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7114
7115     /* MACAddressValue */
7116     offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_macadd, mac);
7117
7118     /* Padding */
7119     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7120
7121     /* IPAddress */
7122     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_ip_address, &ip);
7123     /*proto_item_append_text(block_item, ", IP: %s", ip_to_str((guint8*)&ip));*/
7124
7125     /* Subnetmask */
7126     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_subnetmask, &ip);
7127     /*proto_item_append_text(block_item, ", Subnet: %s", ip_to_str((guint8*)&ip));*/
7128
7129     /* StandardGateway */
7130     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_standard_gateway, &ip);
7131     /*proto_item_append_text(block_item, ", Router: %s", ip_to_str((guint8*)&ip));*/
7132
7133
7134     return offset;
7135 }
7136
7137
7138 /* dissect the PDSyncData block */
7139 static int
7140 dissect_PDSyncData_block(tvbuff_t *tvb, int offset,
7141     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7142 {
7143     guint16   u16SlotNr;
7144     guint16   u16SubslotNr;
7145     e_guid_t  uuid;
7146     guint32   u32ReservedIntervalBegin;
7147     guint32   u32ReservedIntervalEnd;
7148     guint32   u32PLLWindow;
7149     guint32   u32SyncSendFactor;
7150     guint16   u16SendClockFactor;
7151     guint16   u16SyncProperties;
7152     guint16   u16SyncFrameAddress;
7153     guint16   u16PTCPTimeoutFactor;
7154     guint16   u16PTCPTakeoverTimeoutFactor;
7155     guint16   u16PTCPMasterStartupTime;
7156     guint8    u8MasterPriority1;
7157     guint8    u8MasterPriority2;
7158     guint8    u8LengthSubdomainName;
7159     char     *pSubdomainName;
7160
7161
7162     if (u8BlockVersionHigh != 1) {
7163         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7164             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7165         return offset;
7166     }
7167
7168     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7169
7170     switch (u8BlockVersionLow) {
7171     case(0):
7172         /* SlotNumber */
7173         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7174                             hf_pn_io_slot_nr, &u16SlotNr);
7175         /* Subslotnumber */
7176         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7177                             hf_pn_io_subslot_nr, &u16SubslotNr);
7178         /* PTCPSubdomainID */
7179         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7180                             hf_pn_io_ptcp_subdomain_id, &uuid);
7181         /* IRDataID */
7182         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7183                             hf_pn_io_ir_data_id, &uuid);
7184         /* ReservedIntervalBegin */
7185         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7186                             hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin);
7187         /* ReservedIntervalEnd */
7188         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7189                             hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd);
7190         /* PLLWindow enum */
7191         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7192                             hf_pn_io_pllwindow, &u32PLLWindow);
7193         /* SyncSendFactor 32 enum */
7194         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7195                             hf_pn_io_sync_send_factor, &u32SyncSendFactor);
7196         /* SendClockFactor 16 */
7197         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7198                             hf_pn_io_send_clock_factor, &u16SendClockFactor);
7199         /* SyncProperties 16 bitfield */
7200         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7201                             hf_pn_io_sync_properties, &u16SyncProperties);
7202         /* SyncFrameAddress 16 bitfield */
7203         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7204                             hf_pn_io_sync_frame_address, &u16SyncFrameAddress);
7205         /* PTCPTimeoutFactor 16 enum */
7206         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7207                             hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor);
7208
7209         proto_item_append_text(item, ": Slot:0x%x/0x%x, Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u",
7210             u16SlotNr, u16SubslotNr, u32ReservedIntervalBegin, u32ReservedIntervalEnd,
7211             u32PLLWindow, u32SyncSendFactor, u16SendClockFactor);
7212         break;
7213     case(2):
7214         /* PTCPSubdomainID */
7215         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7216                             hf_pn_io_ptcp_subdomain_id, &uuid);
7217         /* ReservedIntervalBegin */
7218         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7219                             hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin);
7220         /* ReservedIntervalEnd */
7221         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7222                             hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd);
7223         /* PLLWindow enum */
7224         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7225                             hf_pn_io_pllwindow, &u32PLLWindow);
7226         /* SyncSendFactor 32 enum */
7227         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7228                             hf_pn_io_sync_send_factor, &u32SyncSendFactor);
7229         /* SendClockFactor 16 */
7230         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7231                             hf_pn_io_send_clock_factor, &u16SendClockFactor);
7232         /* PTCPTimeoutFactor 16 enum */
7233         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7234                             hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor);
7235         /* PTCPTakeoverTimeoutFactor 16 */
7236         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7237                             hf_pn_io_ptcp_takeover_timeout_factor, &u16PTCPTakeoverTimeoutFactor);
7238         /* PTCPMasterStartupTime 16 */
7239         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7240                             hf_pn_io_ptcp_master_startup_time, &u16PTCPMasterStartupTime);
7241         /* SyncProperties 16 bitfield */
7242         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7243                             hf_pn_io_sync_properties, &u16SyncProperties);
7244         /* PTCP_MasterPriority1 */
7245         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
7246                             hf_pn_io_ptcp_master_priority_1, &u8MasterPriority1);
7247         /* PTCP_MasterPriority2 */
7248         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
7249                             hf_pn_io_ptcp_master_priority_2, &u8MasterPriority2);
7250         /* PTCPLengthSubdomainName */
7251         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
7252                             hf_pn_io_ptcp_length_subdomain_name, &u8LengthSubdomainName);
7253         /* PTCPSubdomainName */
7254         pSubdomainName = (char *)wmem_alloc(wmem_packet_scope(), u8LengthSubdomainName+1);
7255         tvb_memcpy(tvb, (guint8 *) pSubdomainName, offset, u8LengthSubdomainName);
7256         pSubdomainName[u8LengthSubdomainName] = '\0';
7257         proto_tree_add_string (tree, hf_pn_io_ptcp_subdomain_name, tvb, offset, u8LengthSubdomainName, pSubdomainName);
7258         offset += u8LengthSubdomainName;
7259
7260         /* Padding */
7261         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7262
7263         proto_item_append_text(item, ": Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u",
7264             u32ReservedIntervalBegin, u32ReservedIntervalEnd,
7265             u32PLLWindow, u32SyncSendFactor, u16SendClockFactor);
7266         break;
7267     default:
7268         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7269             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7270     }
7271
7272     return offset;
7273 }
7274
7275
7276 /* dissect the PDIRData block */
7277 static int
7278 dissect_PDIRData_block(tvbuff_t *tvb, int offset,
7279     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7280 {
7281     guint16    u16SlotNr;
7282     guint16    u16SubslotNr;
7283     guint16    u16Index = 0;
7284     guint32    u32RecDataLen;
7285     pnio_ar_t *ar       = NULL;
7286
7287     /* versions decoded are High: 1 and LOW 0..2 */
7288     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2 ) ) {
7289         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7290             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7291         return offset;
7292     }
7293
7294     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7295
7296     /* SlotNumber */
7297     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7298                         hf_pn_io_slot_nr, &u16SlotNr);
7299     /* Subslotnumber */
7300     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7301                         hf_pn_io_subslot_nr, &u16SubslotNr);
7302
7303     proto_item_append_text(item, ": Slot:0x%x/0x%x",
7304         u16SlotNr, u16SubslotNr);
7305
7306     /* PDIRGlobalData */
7307     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7308     if (u8BlockVersionLow == 0) {
7309         /* PDIRFrameData */
7310         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7311     } else if (u8BlockVersionLow == 1) {
7312         /* [PDIRFrameData] */
7313         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7314         /* PDIRBeginEndData */
7315         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7316     }else if (u8BlockVersionLow == 2) {
7317         /* [PDIRFrameData] */
7318         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7319         /* PDIRBeginEndData */
7320         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
7321     }
7322     return offset;
7323 }
7324
7325
7326 /* dissect the PDIRGlobalData block */
7327 static int
7328 dissect_PDIRGlobalData_block(tvbuff_t *tvb, int offset,
7329     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7330 {
7331     e_guid_t uuid;
7332     guint32  u32MaxBridgeDelay;
7333     guint32  u32NumberOfPorts;
7334     guint32  u32MaxPortTxDelay;
7335     guint32  u32MaxPortRxDelay;
7336     guint32  u32MaxLineRxDelay;
7337     guint32  u32YellowTime;
7338     guint32  u32Tmp;
7339
7340     /* added blockversion 2 */
7341     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2)) {
7342         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7343             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7344         return offset;
7345     }
7346
7347     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7348
7349     /* IRDataID */
7350     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7351                         hf_pn_io_ir_data_id, &uuid);
7352
7353     if (u8BlockVersionLow <= 2) {
7354         /* MaxBridgeDelay */
7355         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7356                                      hf_pn_io_max_bridge_delay, &u32MaxBridgeDelay);
7357         /* NumberOfPorts */
7358         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7359                                      hf_pn_io_number_of_ports, &u32NumberOfPorts);
7360         u32Tmp = u32NumberOfPorts;
7361
7362         while (u32Tmp--) {
7363             /* MaxPortTxDelay */
7364             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7365                                          hf_pn_io_max_port_tx_delay, &u32MaxPortTxDelay);
7366             /* MaxPortRxDelay */
7367             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7368                                          hf_pn_io_max_port_rx_delay, &u32MaxPortRxDelay);
7369             if (u8BlockVersionLow >= 2) {
7370                 /* MaxLineRxDelay */
7371                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7372                     hf_pn_io_max_line_rx_delay, &u32MaxLineRxDelay);
7373                 /* YellowTime */
7374                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7375                     hf_pn_io_yellowtime, &u32YellowTime);
7376             }
7377         }
7378         proto_item_append_text(item, ": MaxBridgeDelay:%u, NumberOfPorts:%u",
7379                              u32MaxBridgeDelay, u32NumberOfPorts);
7380
7381     }
7382     return offset;
7383 }
7384
7385
7386 /* dissect the PDIRFrameData block */
7387 static int
7388 dissect_PDIRFrameData_block(tvbuff_t *tvb, int offset,
7389     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7390     guint16 u16BodyLength)
7391 {
7392     guint32     u32FrameSendOffset;
7393     guint32     u32FrameDataProperties;
7394     guint16     u16DataLength;
7395     guint16     u16ReductionRatio;
7396     guint16     u16Phase;
7397     guint16     u16FrameID;
7398     guint16     u16Ethertype;
7399     guint8      u8RXPort;
7400     guint8      u8FrameDetails;
7401     guint8      u8NumberOfTxPortGroups;
7402     guint8      u8TxPortGroupArray;
7403     guint16     u16TxPortGroupArraySize;
7404     guint16     u16EndOffset;
7405     guint16     n = 0;
7406     proto_item *sub_item;
7407     proto_tree *sub_tree;
7408
7409     /* added low version 1 */
7410     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
7411         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7412             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7413         return offset;
7414     }
7415
7416     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7417
7418     u16EndOffset = offset + u16BodyLength -2;
7419     if (u8BlockVersionLow > 0) {
7420         /* for low version 1 FrameDataProperties is added */
7421         sub_item = proto_tree_add_item(tree, hf_pn_io_frame_data_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
7422         sub_tree = proto_item_add_subtree(sub_item, ett_pn_FrameDataProperties);
7423         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7424                               hf_pn_io_frame_data_properties_forwarding_Mode, &u32FrameDataProperties);
7425         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7426                               hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd, &u32FrameDataProperties);
7427         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7428                               hf_pn_io_frame_data_properties_FragmentMode, &u32FrameDataProperties);
7429         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7430                               hf_pn_io_frame_data_properties_reserved_1, &u32FrameDataProperties);
7431         offset =
7432         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7433                               hf_pn_io_frame_data_properties_reserved_2, &u32FrameDataProperties);
7434     }
7435     /* dissect all IR frame data */
7436     while (offset < u16EndOffset)
7437     {
7438         proto_item *ir_frame_data_sub_item;
7439         proto_tree *ir_frame_data_tree;
7440
7441         n++;
7442
7443         /* new subtree for each IR frame */
7444         ir_frame_data_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_frame_data, tvb, offset, 17, ENC_NA);
7445         ir_frame_data_tree     = proto_item_add_subtree(ir_frame_data_sub_item, ett_pn_io_ir_frame_data);
7446
7447         /* FrameSendOffset */
7448         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_frame_data_tree, drep,
7449                                        hf_pn_io_frame_send_offset, &u32FrameSendOffset);
7450         /* DataLength */
7451         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
7452                                        hf_pn_io_data_length, &u16DataLength);
7453         /* ReductionRatio */
7454         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
7455                                        hf_pn_io_reduction_ratio, &u16ReductionRatio);
7456         /* Phase */
7457         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
7458                                        hf_pn_io_phase, &u16Phase);
7459         /* FrameID */
7460         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
7461                                        hf_pn_io_frame_id, &u16FrameID);
7462
7463         /* Ethertype */
7464         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
7465                                        hf_pn_io_ethertype, &u16Ethertype);
7466         /* RxPort */
7467         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, ir_frame_data_tree, drep,
7468                                       hf_pn_io_rx_port, &u8RXPort);
7469         /* FrameDetails */
7470         sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_frame_details, tvb, offset, 1, ENC_BIG_ENDIAN);
7471         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_frame_defails);
7472         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
7473                              hf_pn_io_frame_details_sync_frame, &u8FrameDetails);
7474         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
7475                              hf_pn_io_frame_details_meaning_frame_send_offset, &u8FrameDetails);
7476         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
7477                              hf_pn_io_frame_details_reserved, &u8FrameDetails);
7478         /* TxPortGroup */
7479         u8NumberOfTxPortGroups = tvb_get_guint8(tvb, offset);
7480         sub_item = proto_tree_add_uint(ir_frame_data_tree, hf_pn_io_nr_of_tx_port_groups,
7481                              tvb, offset, 1, u8NumberOfTxPortGroups);
7482         offset++;
7483         if ((u8NumberOfTxPortGroups > 21) || ((u8NumberOfTxPortGroups & 0x1) !=1)) {
7484             expert_add_info(pinfo, sub_item, &ei_pn_io_nr_of_tx_port_groups);
7485         }
7486
7487         /* TxPortArray */
7488         u16TxPortGroupArraySize =  (u8NumberOfTxPortGroups + 7 / 8);
7489         sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_TxPortGroupProperties,
7490                              tvb, offset, u16TxPortGroupArraySize, ENC_BIG_ENDIAN);
7491         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_GroupProperties);
7492         while (u16TxPortGroupArraySize > 0)
7493         {
7494             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit0, &u8TxPortGroupArray);
7495             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit1, &u8TxPortGroupArray);
7496             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit2, &u8TxPortGroupArray);
7497             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit3, &u8TxPortGroupArray);
7498             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit4, &u8TxPortGroupArray);
7499             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit5, &u8TxPortGroupArray);
7500             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit6, &u8TxPortGroupArray);
7501             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit7, &u8TxPortGroupArray);
7502
7503             offset+=1;
7504             u16TxPortGroupArraySize --;
7505         }
7506
7507         /* align to next dataset */
7508         offset = dissect_pn_align4(tvb, offset, pinfo, ir_frame_data_tree);
7509
7510         proto_item_append_text(ir_frame_data_tree, ": Offset:%u, Len:%u, Ratio:%u, Phase:%u, FrameID:0x%04x",
7511                                u32FrameSendOffset, u16DataLength, u16ReductionRatio, u16Phase, u16FrameID);
7512
7513     }
7514
7515     proto_item_append_text(item, ": Frames:%u", n);
7516
7517     return offset;
7518 }
7519
7520
7521 static int
7522 dissect_PDIRBeginEndData_block(tvbuff_t *tvb, int offset,
7523     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7524     guint16 u16BodyLength)
7525 {
7526     guint16 u16StartOfRedFrameID;
7527     guint16 u16EndOfRedFrameID;
7528     guint32 u32NumberOfPorts;
7529     guint32 u32NumberOfAssignments;
7530     guint32 u32NumberOfPhases;
7531     guint32 u32RedOrangePeriodBegin;
7532     guint32 u32OrangePeriodBegin;
7533     guint32 u32GreenPeriodBegin;
7534     guint16 u16TXPhaseAssignment;
7535     guint16 u16RXPhaseAssignment;
7536     guint32 u32SubStart;
7537     guint32 u32Tmp;
7538     guint32 u32Tmp2;
7539     guint32 u32TxRedOrangePeriodBegin[0x11] = {0};
7540     guint32 u32TxOrangePeriodBegin [0x11]   = {0};
7541     guint32 u32TxGreenPeriodBegin [0x11]    = {0};
7542     guint32 u32RxRedOrangePeriodBegin[0x11] = {0};
7543     guint32 u32RxOrangePeriodBegin [0x11]   = {0};
7544     guint32 u32RxGreenPeriodBegin [0x11]    = {0};
7545     guint32 u32PortIndex;
7546
7547     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7548         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7549             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7550         return offset;
7551     }
7552
7553     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7554
7555     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7556                     hf_pn_io_start_of_red_frame_id, &u16StartOfRedFrameID);
7557     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7558                     hf_pn_io_end_of_red_frame_id, &u16EndOfRedFrameID);
7559
7560     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7561                         hf_pn_io_number_of_ports, &u32NumberOfPorts);
7562     u32Tmp2 = u32NumberOfPorts;
7563     while (u32Tmp2--) {
7564         proto_item *ir_begin_end_port_sub_item;
7565         proto_tree *ir_begin_end_port_tree;
7566
7567         /* new subtree for each Port */
7568         ir_begin_end_port_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_begin_end_port, tvb, offset, 0, ENC_NA);
7569         ir_begin_end_port_tree = proto_item_add_subtree(ir_begin_end_port_sub_item, ett_pn_io_ir_begin_end_port);
7570         u32SubStart = offset;
7571
7572         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7573                             hf_pn_io_number_of_assignments, &u32NumberOfAssignments);
7574         u32Tmp = u32NumberOfAssignments;
7575         u32PortIndex = 0;
7576         if (u32Tmp <= 0x10)
7577         {
7578             while (u32Tmp--) {
7579                 /* TXBeginEndAssignment */
7580                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7581                                                hf_pn_io_red_orange_period_begin_tx, &u32RedOrangePeriodBegin);
7582                 u32TxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin;
7583
7584                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7585                                                hf_pn_io_orange_period_begin_tx, &u32OrangePeriodBegin);
7586                 u32TxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin;
7587
7588                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7589                                                hf_pn_io_green_period_begin_tx, &u32GreenPeriodBegin);
7590                 u32TxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin;
7591
7592                 /* RXBeginEndAssignment */
7593                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7594                                                hf_pn_io_red_orange_period_begin_rx, &u32RedOrangePeriodBegin);
7595                 u32RxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin;
7596
7597                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7598                                                hf_pn_io_orange_period_begin_rx, &u32OrangePeriodBegin);
7599                 u32RxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin;
7600
7601                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7602                                                hf_pn_io_green_period_begin_rx, &u32GreenPeriodBegin);
7603                 u32RxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin;
7604
7605                 u32PortIndex++;
7606             }
7607         }
7608
7609         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
7610                             hf_pn_io_number_of_phases, &u32NumberOfPhases);
7611         u32Tmp = u32NumberOfPhases;
7612         if (u32Tmp <= 0x10)
7613         {
7614             while (u32Tmp--) {
7615                 proto_item *ir_begin_tx_phase_sub_item;
7616                 proto_tree *ir_begin_tx_phase_tree;
7617
7618                 /* new subtree  for TXPhaseAssignment */
7619                 ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree,
7620                                       hf_pn_ir_tx_phase_assignment, tvb, offset, 0, ENC_NA);
7621                 ir_begin_tx_phase_tree     = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_tx_phase);
7622                 /* bit 0..3 */
7623                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7624                                       hf_pn_io_tx_phase_assignment_begin_value, &u16TXPhaseAssignment);
7625                 /* bit 4..7 */
7626                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7627                                       hf_pn_io_tx_phase_assignment_orange_begin, &u16TXPhaseAssignment);
7628                 /* bit 8..11 */
7629                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7630                                       hf_pn_io_tx_phase_assignment_end_reserved, &u16TXPhaseAssignment);
7631                 /* bit 12..15 */
7632                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7633                                       hf_pn_io_tx_phase_assignment_reserved, &u16TXPhaseAssignment);
7634
7635                 proto_item_append_text(ir_begin_tx_phase_sub_item,
7636                                       ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d",
7637                                       u16TXPhaseAssignment,
7638                                       u32TxRedOrangePeriodBegin[u16TXPhaseAssignment & 0x0F],
7639                                       u32TxOrangePeriodBegin[(u16TXPhaseAssignment & 0x0F0) >> 4],
7640                                       u32TxGreenPeriodBegin[(u16TXPhaseAssignment & 0x0F00)>> 8]);
7641
7642                 /* new subtree  for RXPhaseAssignment */
7643                 ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree,
7644                                       hf_pn_ir_rx_phase_assignment, tvb, offset, 0, ENC_NA);
7645                 ir_begin_tx_phase_tree     = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_rx_phase);
7646                 /* bit 0..3 */
7647                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7648                                       hf_pn_io_tx_phase_assignment_begin_value, &u16RXPhaseAssignment);
7649                 /* bit 4..7 */
7650                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7651                                       hf_pn_io_tx_phase_assignment_orange_begin, &u16RXPhaseAssignment);
7652                 /* bit 8..11 */
7653                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7654                                       hf_pn_io_tx_phase_assignment_end_reserved, &u16RXPhaseAssignment);
7655                 /* bit 12..15 */
7656                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7657                                       hf_pn_io_tx_phase_assignment_reserved, &u16RXPhaseAssignment);
7658
7659                 proto_item_append_text(ir_begin_tx_phase_sub_item,
7660                                       ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d",
7661                                       u16RXPhaseAssignment,
7662                                       u32RxRedOrangePeriodBegin[u16RXPhaseAssignment & 0x0F],
7663                                       u32RxOrangePeriodBegin[(u16RXPhaseAssignment & 0x0F0) >> 4],
7664                                       u32RxGreenPeriodBegin[(u16RXPhaseAssignment & 0x0F00)>> 8]);
7665             }
7666         }
7667         proto_item_append_text(ir_begin_end_port_sub_item, ": Assignments:%u, Phases:%u",
7668             u32NumberOfAssignments, u32NumberOfPhases);
7669
7670         proto_item_set_len(ir_begin_end_port_sub_item, offset - u32SubStart);
7671     }
7672
7673     proto_item_append_text(item, ": StartOfRedFrameID: 0x%x, EndOfRedFrameID: 0x%x, Ports: %u",
7674         u16StartOfRedFrameID, u16EndOfRedFrameID, u32NumberOfPorts);
7675
7676     return offset+u16BodyLength;
7677 }
7678
7679
7680 /* dissect the DiagnosisData block */
7681 static int
7682 dissect_DiagnosisData_block(tvbuff_t *tvb, int offset,
7683     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7684     guint16 body_length)
7685 {
7686     guint32 u32Api;
7687     guint16 u16SlotNr;
7688     guint16 u16SubslotNr;
7689     guint16 u16ChannelNumber;
7690     guint16 u16UserStructureIdentifier;
7691     proto_item *sub_item;
7692
7693
7694     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
7695         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7696             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7697         return offset;
7698     }
7699
7700     if (u8BlockVersionLow == 1) {
7701         /* API */
7702     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7703                         hf_pn_io_api, &u32Api);
7704         body_length-=4;
7705     }
7706
7707     /* SlotNumber */
7708     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7709                     hf_pn_io_slot_nr, &u16SlotNr);
7710     /* Subslotnumber */
7711     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7712                     hf_pn_io_subslot_nr, &u16SubslotNr);
7713     /* ChannelNumber got new ranges: 0..0x7FFF the source is a channel as specified by the manufacturer */
7714     /* fetch u16ChannelNumber */
7715     u16ChannelNumber =  ((drep[0] & DREP_LITTLE_ENDIAN)
7716                             ? tvb_get_letohs(tvb, offset)
7717                             : tvb_get_ntohs(tvb, offset));
7718     if (tree) {
7719         sub_item = proto_tree_add_item(tree,hf_pn_io_channel_number, tvb, offset, 2, DREP_ENC_INTEGER(drep));
7720         if (u16ChannelNumber < 0x8000){ /*  0..0x7FFF the source is a channel  as specified by the manufacturer */
7721              proto_item_append_text(sub_item, " channel number of the diagnosis source");
7722         }
7723         else
7724             if (u16ChannelNumber == 0x8000) /* 0x8000 the whole submodule is the source, */
7725                 proto_item_append_text(sub_item, " (whole) Submodule");
7726             else
7727                 proto_item_append_text(sub_item, " reserved");
7728     }
7729     offset = offset +2; /* Advance behind ChannelNumber */
7730     /* ChannelProperties */
7731     offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
7732     body_length-=8;
7733     /* UserStructureIdentifier */
7734     u16UserStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN)
7735                                         ? tvb_get_letohs(tvb, offset)
7736                                         : tvb_get_ntohs(tvb, offset));
7737     if (u16UserStructureIdentifier > 0x7FFF){
7738         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7739                                        hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier);
7740     }
7741     else
7742     { /* range 0x0 to 0x7fff is manufacturer specific */
7743         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7744                                        hf_pn_io_user_structure_identifier_manf, &u16UserStructureIdentifier);
7745     }
7746     proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier);
7747     body_length-=2;
7748
7749     /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */
7750     while (body_length) {
7751         offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep,
7752             &body_length, u16UserStructureIdentifier);
7753     }
7754     return offset;
7755 }
7756
7757
7758 static int
7759 dissect_ARProperties(tvbuff_t *tvb, int offset,
7760     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_)
7761 {
7762     proto_item *sub_item;
7763     proto_tree *sub_tree;
7764     guint32     u32ARProperties;
7765     guint8      startupMode;
7766
7767     sub_item = proto_tree_add_item(tree, hf_pn_io_ar_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
7768     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_properties);
7769     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7770                         hf_pn_io_ar_properties_pull_module_alarm_allowed, &u32ARProperties);
7771     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7772                         hf_pn_io_arproperties_StartupMode, &u32ARProperties);
7773     startupMode = (guint8)((u32ARProperties >> 30) & 0x01);
7774     /* Advanced startup mode */
7775     if (startupMode)
7776     {
7777         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7778             hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode, &u32ARProperties);
7779     }
7780     /* Legacy startup mode */
7781     else
7782     {
7783         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7784             hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode, &u32ARProperties);
7785     }
7786     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7787                         hf_pn_io_ar_properties_reserved, &u32ARProperties);
7788     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7789                         hf_pn_io_ar_properties_achnowledge_companion_ar, &u32ARProperties);
7790     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7791                         hf_pn_io_ar_properties_companion_ar, &u32ARProperties);
7792     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7793                         hf_pn_io_ar_properties_device_access, &u32ARProperties);
7794     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7795                         hf_pn_io_ar_properties_reserved_1, &u32ARProperties);
7796 /* removed within 2.3
7797     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7798                         hf_pn_io_ar_properties_data_rate, &u32ARProperties);
7799 */
7800     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7801                         hf_pn_io_ar_properties_parametrization_server, &u32ARProperties);
7802     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7803                         hf_pn_io_ar_properties_supervisor_takeover_allowed, &u32ARProperties);
7804     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7805                         hf_pn_io_ar_properties_state, &u32ARProperties);
7806
7807     return offset;
7808 }
7809
7810
7811 /* dissect the IOCRProperties */
7812 static int
7813 dissect_IOCRProperties(tvbuff_t *tvb, int offset,
7814     packet_info *pinfo, proto_tree *tree, guint8 *drep)
7815 {
7816     proto_item *sub_item;
7817     proto_tree *sub_tree;
7818     guint32     u32IOCRProperties;
7819
7820     sub_item = proto_tree_add_item(tree, hf_pn_io_iocr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
7821     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_iocr_properties);
7822     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7823                     hf_pn_io_iocr_properties_full_subframe_structure, &u32IOCRProperties);
7824     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7825                     hf_pn_io_iocr_properties_distributed_subframe_watchdog, &u32IOCRProperties);
7826     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7827                     hf_pn_io_iocr_properties_fast_forwarding_mac_adr, &u32IOCRProperties);
7828     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7829                     hf_pn_io_iocr_properties_reserved_3, &u32IOCRProperties);
7830     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7831                     hf_pn_io_iocr_properties_reserved_2, &u32IOCRProperties);
7832     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7833                     hf_pn_io_iocr_properties_media_redundancy, &u32IOCRProperties);
7834     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7835                     hf_pn_io_iocr_properties_reserved_1, &u32IOCRProperties);
7836     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7837                     hf_pn_io_iocr_properties_rtclass, &u32IOCRProperties);
7838
7839     return offset;
7840 }
7841
7842
7843 /* dissect the ARData block */
7844 static int
7845 dissect_ARData_block(tvbuff_t *tvb, int offset,
7846     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BlockLength)
7847 {
7848     guint16     u16NumberOfARs;
7849     guint16     u16NumberofEntries;
7850     e_guid_t    aruuid;
7851     e_guid_t    uuid;
7852     guint16     u16ARType;
7853     char       *pStationName;
7854     guint16     u16NameLength;
7855     guint16     u16NumberOfIOCRs;
7856     guint16     u16IOCRType;
7857     guint16     u16FrameID;
7858     guint16     u16CycleCounter;
7859     guint8      u8DataStatus;
7860     guint8      u8TransferStatus;
7861     proto_item *ds_item;
7862     proto_tree *ds_tree;
7863     guint16     u16UDPRTPort;
7864     guint16     u16AlarmCRType;
7865     guint16     u16LocalAlarmReference;
7866     guint16     u16RemoteAlarmReference;
7867     guint16     u16NumberOfAPIs;
7868     guint32     u32Api;
7869     proto_item *iocr_item;
7870     proto_tree *iocr_tree;
7871     proto_item *ar_item;
7872     proto_tree *ar_tree;
7873     guint32     u32IOCRStart;
7874     gint32      i32EndOffset;
7875     guint32     u32ARDataStart;
7876
7877     /* added BlockversionLow == 1  */
7878     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
7879         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7880             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7881         return offset;
7882     }
7883     i32EndOffset = offset + u16BlockLength;
7884     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7885                     hf_pn_io_number_of_ars, &u16NumberOfARs);
7886     /* BlockversionLow:  0 */
7887     if (u8BlockVersionLow == 0) {
7888     while (u16NumberOfARs--) {
7889             ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA);
7890             ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data);
7891             u32ARDataStart = offset;
7892             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7893                             hf_pn_io_ar_uuid, &aruuid);
7894             proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(wmem_packet_scope(), (const e_guid_t*) &aruuid));
7895             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7896                         hf_pn_io_ar_type, &u16ARType);
7897             offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep);
7898         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7899                          hf_pn_io_cminitiator_objectuuid, &uuid);
7900             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7901                         hf_pn_io_station_name_length, &u16NameLength);
7902         pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
7903         tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
7904         pStationName[u16NameLength] = '\0';
7905             proto_tree_add_string (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pStationName);
7906         offset += u16NameLength;
7907
7908             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7909                         hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs);
7910
7911         while (u16NumberOfIOCRs--) {
7912             iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA);
7913             iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr);
7914             u32IOCRStart = offset;
7915
7916         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7917                             hf_pn_io_iocr_type, &u16IOCRType);
7918             offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep);
7919         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7920                             hf_pn_io_frame_id, &u16FrameID);
7921
7922             proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID);
7923
7924             /* add cycle counter */
7925             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7926                             hf_pn_io_cycle_counter, &u16CycleCounter);
7927
7928         u8DataStatus = tvb_get_guint8(tvb, offset);
7929         u8TransferStatus = tvb_get_guint8(tvb, offset+1);
7930
7931             /* add data status subtree */
7932             ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status,
7933                 tvb, offset, 1, u8DataStatus,
7934                 "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)",
7935                 u8DataStatus,
7936                 (u8DataStatus & 0x04) ? "Valid" : "Invalid",
7937                 (u8DataStatus & 0x01) ? "Primary" : "Backup",
7938                 (u8DataStatus & 0x20) ? "Ok" : "Problem",
7939                 (u8DataStatus & 0x10) ? "Run" : "Stop");
7940             ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status);
7941             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus);
7942             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus);
7943             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus);
7944             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus);
7945             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus);
7946             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus);
7947             proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus);
7948
7949             offset++;
7950
7951             /* add transfer status */
7952             if (u8TransferStatus) {
7953                 proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7954                 offset, 1, u8TransferStatus,
7955                 "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus);
7956             } else {
7957                 proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7958                 offset, 1, u8TransferStatus,
7959                 "TransferStatus: 0x%02x (OK)", u8TransferStatus);
7960             }
7961
7962             offset++;
7963
7964             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7965                             hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
7966             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7967                             hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
7968
7969             proto_item_set_len(iocr_item, offset - u32IOCRStart);
7970         }
7971
7972         /* AlarmCRType */
7973             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7974                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
7975         /* LocalAlarmReference */
7976             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7977                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
7978         /* RemoteAlarmReference */
7979             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7980                         hf_pn_io_remotealarmref, &u16RemoteAlarmReference);
7981         /* ParameterServerObjectUUID */
7982             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7983                             hf_pn_io_parameter_server_objectuuid, &uuid);
7984         /* StationNameLength */
7985             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7986                         hf_pn_io_station_name_length, &u16NameLength);
7987         /* ParameterServerStationName */
7988         pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
7989         tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
7990         pStationName[u16NameLength] = '\0';
7991             proto_tree_add_string (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, pStationName);
7992         offset += u16NameLength;
7993         /* NumberOfAPIs */
7994             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7995                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7996         /* API */
7997         if (u16NumberOfAPIs > 0) {
7998                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep,
7999                 hf_pn_io_api, &u32Api);
8000             }
8001             proto_item_set_len(ar_item, offset - u32ARDataStart);
8002         }
8003     }
8004     else
8005     {    /* BlockversionLow == 1 */
8006         while (u16NumberOfARs--) {
8007             ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA);
8008             ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data);
8009             u32ARDataStart = offset;
8010             /*ARUUID */
8011             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_uuid, &aruuid);
8012             proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(wmem_packet_scope(), (const e_guid_t*) &aruuid));
8013             /* CMInitiatorObjectUUID */
8014             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_objectuuid, &uuid);
8015             /* ParameterServerObjectUUID */
8016             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_parameter_server_objectuuid, &uuid);
8017             /* ARProperties*/
8018             offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep);
8019             /* ARType*/
8020             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_type, &u16ARType);
8021             /* AlarmCRType */
8022             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType);
8023             /* LocalAlarmReference */
8024             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference);
8025             /* RemoteAlarmReference */
8026             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_remotealarmref, &u16RemoteAlarmReference);
8027             /* InitiatorUDPRTPort*/
8028             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
8029             /* ResponderUDPRTPort*/
8030             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
8031             /* CMInitiatorStationName*/
8032             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength);
8033             pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
8034             tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
8035             pStationName[u16NameLength] = '\0';
8036             proto_tree_add_string (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pStationName);
8037             offset += u16NameLength;
8038             /** align padding! **/
8039             offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree);
8040
8041             /* StationNameLength */
8042             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength);
8043             if (u16NameLength != 0) {
8044                 /* ParameterServerStationName */
8045                 pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
8046                 tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
8047                 pStationName[u16NameLength] = '\0';
8048                 proto_tree_add_string (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, pStationName);
8049                 offset += u16NameLength;
8050             }
8051             else
8052             { /* display no name present */
8053                 proto_tree_add_string (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, " <no ParameterServerStationName present>");
8054             }
8055             /** align padding! **/
8056             offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree);
8057
8058             /* NumberOfIOCRs*/
8059             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs);
8060             /* align to next 32 bit */
8061             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
8062
8063             while (u16NumberOfIOCRs--) {
8064                 iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA);
8065                 iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr);
8066                 u32IOCRStart = offset;
8067
8068                 /* IOCRProperties*/
8069                 offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep);
8070                 /* IOCRType*/
8071                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_iocr_type, &u16IOCRType);
8072                 /* FrameID*/
8073                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_frame_id, &u16FrameID);
8074                 proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID);
8075
8076                 /* add cycle counter */
8077                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
8078                     hf_pn_io_cycle_counter, &u16CycleCounter);
8079
8080                 u8DataStatus = tvb_get_guint8(tvb, offset);
8081                 u8TransferStatus = tvb_get_guint8(tvb, offset+1);
8082
8083                 /* add data status subtree */
8084                 ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status,
8085                     tvb, offset, 1, u8DataStatus,
8086                     "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)",
8087                     u8DataStatus,
8088                     (u8DataStatus & 0x04) ? "Valid" : "Invalid",
8089                     (u8DataStatus & 0x01) ? "Primary" : "Backup",
8090                     (u8DataStatus & 0x20) ? "Ok" : "Problem",
8091                     (u8DataStatus & 0x10) ? "Run" : "Stop");
8092                 ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status);
8093                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus);
8094                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus);
8095                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus);
8096                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus);
8097                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus);
8098                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus);
8099                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus);
8100
8101                 offset++;
8102
8103                 /* add transfer status */
8104                 if (u8TransferStatus) {
8105                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
8106                         offset, 1, u8TransferStatus,
8107                         "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus);
8108                 } else {
8109                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
8110                         offset, 1, u8TransferStatus,
8111                         "TransferStatus: 0x%02x (OK)", u8TransferStatus);
8112                 }
8113                 offset++;
8114                 proto_item_set_len(iocr_item, offset - u32IOCRStart);
8115             }
8116             /* NumberOfAPIs */
8117             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs);
8118             /* align to next 32 bit */
8119             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
8120             /* API */
8121             if (u16NumberOfAPIs > 0) {
8122                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_api, &u32Api);
8123             }
8124             /* get the number of subblocks an dissect them */
8125             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_ARDATAInfo, &u16NumberofEntries);
8126
8127             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
8128
8129             while ((offset < i32EndOffset) && (u16NumberofEntries > 0)) {
8130                 offset = dissect_a_block(tvb, offset, pinfo, ar_tree, drep);
8131                 u16NumberofEntries--;
8132             }
8133             proto_item_set_len(ar_item, offset - u32ARDataStart);
8134         }
8135     }
8136     return offset;
8137 }
8138
8139
8140 /* dissect the APIData block */
8141 static int
8142 dissect_APIData_block(tvbuff_t *tvb, int offset,
8143     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8144 {
8145     guint16 u16NumberOfAPIs;
8146     guint32 u32Api;
8147
8148
8149     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8150         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8151             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8152         return offset;
8153     }
8154
8155     /* NumberOfAPIs */
8156     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8157                     hf_pn_io_number_of_apis, &u16NumberOfAPIs);
8158
8159     while (u16NumberOfAPIs--) {
8160         /* API */
8161         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8162                         hf_pn_io_api, &u32Api);
8163     }
8164
8165     return offset;
8166 }
8167
8168 /* dissect the SLRData block */
8169 static int
8170 dissect_SRLData_block(tvbuff_t *tvb, int offset,
8171     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8172 {
8173     guint16 RedundancyInfo;
8174
8175     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8176         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8177             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8178         return offset;
8179     }
8180     /* bit 0 ..1  EndPoint1 and EndPoint2*/
8181     dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo, &RedundancyInfo);
8182     /* bit 2 .. 15 reserved */
8183     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo_reserved, &RedundancyInfo);
8184     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8185     return offset;
8186 }
8187
8188 /* dissect the LogData block */
8189 static int
8190 dissect_LogData_block(tvbuff_t *tvb, int offset,
8191     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8192 {
8193     guint64  u64ActualLocaltimeStamp;
8194     guint16  u16NumberOfLogEntries;
8195     guint64  u64LocaltimeStamp;
8196     e_guid_t aruuid;
8197     guint32  u32EntryDetail;
8198     dcerpc_info        di; /* fake dcerpc_info struct */
8199     dcerpc_call_value  call_data;
8200
8201     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8202         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8203             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8204         return offset;
8205     }
8206
8207     di.conformant_run = 0;
8208     /* we need di->call_data->flags.NDR64 == 0 */
8209     call_data.flags = 0;
8210     di.call_data = &call_data;
8211     di.dcerpc_procedure_name = "";
8212
8213     /* ActualLocalTimeStamp */
8214     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep,
8215                     hf_pn_io_actual_local_time_stamp, &u64ActualLocaltimeStamp);
8216     /* NumberOfLogEntries */
8217     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8218                     hf_pn_io_number_of_log_entries, &u16NumberOfLogEntries);
8219
8220     while (u16NumberOfLogEntries--) {
8221         /* LocalTimeStamp */
8222         offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep,
8223                         hf_pn_io_local_time_stamp, &u64LocaltimeStamp);
8224         /* ARUUID */
8225         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8226                         hf_pn_io_ar_uuid, &aruuid);
8227         /* PNIOStatus */
8228         offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
8229         /* EntryDetail */
8230     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8231                         hf_pn_io_entry_detail, &u32EntryDetail);
8232     }
8233
8234     return offset;
8235 }
8236
8237
8238 /* dissect the FS Hello block */
8239 static int
8240 dissect_FSHello_block(tvbuff_t *tvb, int offset,
8241     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8242 {
8243     guint32 u32FSHelloMode;
8244     guint32 u32FSHelloInterval;
8245     guint32 u32FSHelloRetry;
8246     guint32 u32FSHelloDelay;
8247
8248
8249     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8250         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8251             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8252         return offset;
8253     }
8254
8255     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
8256
8257     /* FSHelloMode */
8258     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8259                         hf_pn_io_fs_hello_mode, &u32FSHelloMode);
8260     /* FSHelloInterval */
8261     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8262                         hf_pn_io_fs_hello_interval, &u32FSHelloInterval);
8263     /* FSHelloRetry */
8264     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8265                         hf_pn_io_fs_hello_retry, &u32FSHelloRetry);
8266     /* FSHelloDelay */
8267     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8268                         hf_pn_io_fs_hello_delay, &u32FSHelloDelay);
8269
8270     proto_item_append_text(item, ": Mode:%s, Interval:%ums, Retry:%u, Delay:%ums",
8271         val_to_str(u32FSHelloMode, pn_io_fs_hello_mode_vals, "0x%x"),
8272         u32FSHelloInterval, u32FSHelloRetry, u32FSHelloDelay);
8273
8274     return offset;
8275 }
8276
8277
8278 /* dissect the FS Parameter block */
8279 static int
8280 dissect_FSParameter_block(tvbuff_t *tvb, int offset,
8281     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8282 {
8283     guint32 u32FSParameterMode;
8284     e_guid_t FSParameterUUID;
8285
8286
8287     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8288         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8289             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8290         return offset;
8291     }
8292
8293     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
8294
8295     /* FSParameterMode */
8296     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8297                         hf_pn_io_fs_parameter_mode, &u32FSParameterMode);
8298     /* FSParameterUUID */
8299     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8300                         hf_pn_io_fs_parameter_uuid, &FSParameterUUID);
8301
8302     proto_item_append_text(item, ": Mode:%s",
8303         val_to_str(u32FSParameterMode, pn_io_fs_parameter_mode_vals, "0x%x"));
8304
8305     return offset;
8306 }
8307
8308
8309
8310
8311 /* dissect the FSUDataAdjust block */
8312 static int
8313 dissect_PDInterfaceFSUDataAdjust_block(tvbuff_t *tvb, int offset,
8314     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8315     guint16 u16BodyLength)
8316 {
8317     tvbuff_t *new_tvb;
8318
8319
8320     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8321         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8322             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8323         return offset;
8324     }
8325
8326     /* Padding */
8327     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8328
8329     u16BodyLength -= 2;
8330
8331     /* sub blocks */
8332     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
8333     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
8334     offset += u16BodyLength;
8335
8336     return offset;
8337 }
8338
8339
8340 /* dissect the ARFSUDataAdjust block */
8341 static int
8342 dissect_ARFSUDataAdjust_block(tvbuff_t *tvb, int offset,
8343     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8344     guint16 u16BodyLength)
8345 {
8346     tvbuff_t *new_tvb;
8347
8348
8349     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8350         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8351             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8352         return offset;
8353     }
8354
8355     /* Padding */
8356     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8357
8358     u16BodyLength -= 2;
8359
8360     /* sub blocks */
8361     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
8362     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
8363     offset += u16BodyLength;
8364
8365     return offset;
8366 }
8367
8368 static const char *
8369 decode_ARType_spezial(guint16 ARType, guint16 ARAccess)
8370 {
8371     if (ARType == 0x0001)
8372         return ("IO Controller AR");
8373     else if (ARType == 0x0003)
8374         return("IO Controller AR");
8375     else if (ARType == 0x0010)
8376         return("IO Controller AR (RT_CLASS_3)");
8377     else if (ARType == 0x0020)
8378         return("IO Controller AR (sysred/CiR)");
8379     else if (ARType == 0x0006)
8380     {
8381         if (ARAccess) /*TRUE */
8382             return("DeviceAccess AR");
8383         else
8384             return("IO Supervisor AR");
8385     }
8386     else
8387         return("reserved");
8388 }
8389
8390 /* dissect the ARBlockReq */
8391 static int
8392 dissect_ARBlockReq_block(tvbuff_t *tvb, int offset,
8393     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8394     pnio_ar_t ** ar)
8395 {
8396     guint16    u16ARType;
8397     guint32    u32ARProperties;
8398     gboolean   have_aruuid = FALSE;
8399     e_guid_t   aruuid;
8400     e_guid_t   uuid;
8401     guint16    u16SessionKey;
8402     guint8     mac[6];
8403     guint16    u16TimeoutFactor;
8404     guint16    u16UDPRTPort;
8405     guint16    u16NameLength;
8406     char      *pStationName;
8407     pnio_ar_t *par;
8408     proto_item          *sub_item;
8409     proto_tree          *sub_tree;
8410     guint16             u16ArNumber;
8411     guint16             u16ArResource;
8412     guint16             u16ArReserved;
8413     proto_item          *sub_item_selector;
8414     proto_tree          *sub_tree_selector;
8415     conversation_t      *conversation;
8416     apduStatusSwitch    *apdu_status_switch = NULL;
8417
8418     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8419         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8420             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8421         return offset;
8422     }
8423
8424     u32ARProperties = ((drep[0] & DREP_LITTLE_ENDIAN)
8425             ? tvb_get_letohl (tvb, offset + 2 + 16 +2 + 6 +12)
8426             : tvb_get_ntohl (tvb, offset + 2 + 16 +2 + 6 +12));
8427
8428     u16ARType = ((drep[0] & DREP_LITTLE_ENDIAN)
8429                 ? tvb_get_letohs (tvb, offset)
8430                 : tvb_get_ntohs (tvb, offset));
8431
8432     if (tree) {
8433         proto_tree_add_string_format(tree, hf_pn_io_artype_req, tvb, offset, 2,
8434                         "ARType", "ARType: (0x%04x) %s ",
8435                         u16ARType, decode_ARType_spezial(u16ARType, u32ARProperties));
8436     }
8437     offset = offset + 2;
8438
8439     if (u16ARType == 0x0020)
8440     {
8441         sub_item = proto_tree_add_item(tree, hf_pn_io_ar_uuid, tvb, offset, 16, ENC_NA);
8442         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_info);
8443
8444         proto_tree_add_item(sub_tree, hf_pn_io_ar_discriminator, tvb, offset, 6, ENC_NA);
8445         offset += 6;
8446
8447         proto_tree_add_item(sub_tree, hf_pn_io_ar_configid, tvb, offset, 8, ENC_NA);
8448         offset += 8;
8449
8450         sub_item_selector = proto_tree_add_item(sub_tree, hf_pn_io_ar_selector, tvb, offset, 2, ENC_BIG_ENDIAN);
8451         sub_tree_selector = proto_item_add_subtree(sub_item_selector, ett_pn_io_ar_info);
8452         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arnumber, &u16ArNumber);
8453         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arresource, &u16ArResource);
8454         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arreserved, &u16ArReserved);
8455
8456         /* When ARType==IOCARSR, then find or create conversation for this frame */
8457         if (!pinfo->fd->flags.visited) {
8458             /* Get current conversation endpoints using MAC addresses */
8459             conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_UDP, 0, 0, 0);
8460             if (conversation == NULL) {
8461                 /* If conversation is null, then create new conversation */
8462                 /* Connect Request is sent by controller and not by device. */
8463                 /* All conversations are based on Controller MAC as address */
8464                 conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_UDP, 0, 0, 0);
8465             }
8466
8467             /* Try to get apdu status switch information from the conversation */
8468             apdu_status_switch = (apduStatusSwitch*)conversation_get_proto_data(conversation, proto_pn_io_apdu_status);
8469
8470             /* If apdu status switch is null, then fill it*/
8471             /* If apdu status switch is not null, then update it*/
8472             if (apdu_status_switch == NULL) {
8473                 /* apdu status switch information is valid for whole file*/
8474                 apdu_status_switch = wmem_new0(wmem_file_scope(), apduStatusSwitch);
8475                 copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr));
8476                 copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr));
8477                 apdu_status_switch->isRedundancyActive = TRUE;
8478                 conversation_add_proto_data(conversation, proto_pn_io_apdu_status, apdu_status_switch);
8479             }
8480             else {
8481                 copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr));
8482                 copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr));
8483                 apdu_status_switch->isRedundancyActive = TRUE;
8484             }
8485         }
8486     }
8487     else
8488     {
8489         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8490             hf_pn_io_ar_uuid, &aruuid);
8491         have_aruuid = TRUE;
8492     }
8493     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8494                         hf_pn_io_sessionkey, &u16SessionKey);
8495     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8496                         hf_pn_io_cminitiator_macadd, mac);
8497     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8498                         hf_pn_io_cminitiator_objectuuid, &uuid);
8499
8500
8501     offset = dissect_ARProperties(tvb, offset, pinfo, tree, item, drep);
8502
8503     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8504                         hf_pn_io_cminitiator_activitytimeoutfactor, &u16TimeoutFactor);   /* XXX - special values */
8505     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8506                         hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
8507     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8508                         hf_pn_io_station_name_length, &u16NameLength);
8509
8510     pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
8511     tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
8512     pStationName[u16NameLength] = '\0';
8513     proto_tree_add_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pStationName);
8514     offset += u16NameLength;
8515
8516     proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x, Station:%s",
8517         decode_ARType_spezial(u16ARType, u32ARProperties),
8518         u16SessionKey,
8519         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
8520         u16UDPRTPort,
8521         pStationName);
8522
8523     if (have_aruuid) {
8524         par = pnio_ar_find_by_aruuid(pinfo, &aruuid);
8525         if (par == NULL) {
8526             par = pnio_ar_new(&aruuid);
8527             memcpy( (void *) (&par->controllermac), mac, sizeof(par->controllermac));
8528             par->arType = u16ARType; /* store AR-type for filter generation */
8529             /*strncpy( (char *) (&par->controllername), pStationName, sizeof(par->controllername));*/
8530         } else {
8531             /*expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "ARBlockReq: AR already existing!");*/
8532         }
8533         *ar = par;
8534     } else {
8535         *ar = NULL;
8536     }
8537
8538     return offset;
8539 }
8540
8541
8542 /* dissect the ARBlockRes */
8543 static int
8544 dissect_ARBlockRes_block(tvbuff_t *tvb, int offset,
8545     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8546     pnio_ar_t **ar)
8547 {
8548     guint16    u16ARType;
8549     e_guid_t   uuid;
8550     guint16    u16SessionKey;
8551     guint8     mac[6];
8552     guint16    u16UDPRTPort;
8553     pnio_ar_t *par;
8554
8555
8556     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8557         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8558             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8559         return offset;
8560     }
8561
8562     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8563                         hf_pn_io_ar_type, &u16ARType);
8564     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8565                         hf_pn_io_ar_uuid, &uuid);
8566     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8567                         hf_pn_io_sessionkey, &u16SessionKey);
8568     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8569                         hf_pn_io_cmresponder_macadd, mac);
8570     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8571                         hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
8572
8573     proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x",
8574         val_to_str(u16ARType, pn_io_ar_type, "0x%x"),
8575         u16SessionKey,
8576         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
8577         u16UDPRTPort);
8578
8579     /* The value NIL indicates the usage of the implicit AR*/
8580     par = pnio_ar_find_by_aruuid(pinfo, &uuid);
8581     if (par != NULL) {
8582         memcpy( (void *) (&par->devicemac), mac, sizeof(par->controllermac));
8583     }
8584     *ar = par;
8585
8586     return offset;
8587 }
8588
8589
8590 /* dissect the IOCRBlockReq */
8591 static int
8592 dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset,
8593     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8594     pnio_ar_t *ar)
8595 {
8596     guint16     u16IOCRType;
8597     guint16     u16IOCRReference;
8598     guint16     u16LT;
8599     guint16     u16DataLength;
8600     guint16     u16FrameID;
8601     guint16     u16SendClockFactor;
8602     guint16     u16ReductionRatio;
8603     guint16     u16Phase;
8604     guint16     u16Sequence;
8605     guint32     u32FrameSendOffset;
8606     guint16     u16WatchdogFactor;
8607     guint16     u16DataHoldFactor;
8608     guint16     u16IOCRTagHeader;
8609     guint8      mac[6];
8610     guint16     u16NumberOfAPIs;
8611     guint32     u32Api;
8612     guint16     u16NumberOfIODataObjects;
8613     guint16     u16SlotNr;
8614     guint16     u16SubslotNr;
8615     guint16     u16IODataObjectFrameOffset;
8616     guint16     u16NumberOfIOCS;
8617     guint16     u16IOCSFrameOffset;
8618     proto_item *api_item;
8619     proto_tree *api_tree;
8620     guint32     u32ApiStart;
8621     guint16     u16Tmp;
8622     proto_item *sub_item;
8623     proto_tree *sub_tree;
8624     guint32     u32SubStart;
8625
8626     conversation_t    *conversation;
8627     stationInfo       *station_info = NULL;
8628     iocsObject        *iocs_object;
8629     iocsObject        *cmp_iocs_object;
8630     ioDataObject      *io_data_object;
8631     ioDataObject      *cmp_io_data_object;
8632     wmem_list_frame_t *frame;
8633     wmem_list_t       *iocs_list;
8634
8635     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8636         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8637             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8638         return offset;
8639     }
8640
8641     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8642                         hf_pn_io_iocr_type, &u16IOCRType);
8643     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8644                         hf_pn_io_iocr_reference, &u16IOCRReference);
8645     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8646                         hf_pn_io_lt, &u16LT);
8647
8648         offset = dissect_IOCRProperties(tvb, offset, pinfo, tree, drep);
8649
8650     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8651                         hf_pn_io_data_length, &u16DataLength);
8652     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8653                         hf_pn_io_frame_id, &u16FrameID);
8654     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8655                         hf_pn_io_send_clock_factor, &u16SendClockFactor);
8656     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8657                         hf_pn_io_reduction_ratio, &u16ReductionRatio);
8658     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8659                         hf_pn_io_phase, &u16Phase);
8660     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8661                         hf_pn_io_sequence, &u16Sequence);
8662     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8663                         hf_pn_io_frame_send_offset, &u32FrameSendOffset);
8664     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8665                         hf_pn_io_watchdog_factor, &u16WatchdogFactor);
8666     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8667                         hf_pn_io_data_hold_factor, &u16DataHoldFactor);
8668     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8669                         hf_pn_io_iocr_tag_header, &u16IOCRTagHeader);
8670     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8671                         hf_pn_io_iocr_multicast_mac_add, mac);
8672
8673     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8674                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
8675
8676     proto_item_append_text(item, ": %s, Ref:0x%x, Len:%u, FrameID:0x%x, Clock:%u, Ratio:%u, Phase:%u APIs:%u",
8677         val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"),
8678         u16IOCRReference, u16DataLength, u16FrameID,
8679         u16SendClockFactor, u16ReductionRatio, u16Phase, u16NumberOfAPIs);
8680
8681     while (u16NumberOfAPIs--) {
8682         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
8683         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
8684         u32ApiStart = offset;
8685
8686         /* API */
8687         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
8688                             hf_pn_io_api, &u32Api);
8689         /* NumberOfIODataObjects */
8690         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
8691                             hf_pn_io_number_of_io_data_objects, &u16NumberOfIODataObjects);
8692
8693         /* Set global Variant for Number of IO Data Objects */
8694         /* Notice: Handle Input & Output seperate!!! */
8695         if (!pinfo->fd->flags.visited) {
8696             /* Get current conversation endpoints using MAC addresses */
8697             conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
8698             if (conversation == NULL) {
8699                 /* Create new conversation, if no "Ident OK" frame as been dissected yet!
8700                  * Need to switch dl_src & dl_dst, as Connect Request is sent by controller and not by device.
8701                  * All conversations are based on Device MAC as addr1 */
8702                 conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
8703             }
8704
8705             station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
8706             if (station_info == NULL) {
8707                 station_info = wmem_new0(wmem_file_scope(), stationInfo);
8708                 init_pnio_rtc1_station(station_info);
8709                 conversation_add_proto_data(conversation, proto_pn_dcp, station_info);
8710             }
8711             else {
8712                 station_info->ioDataObjectNr = u16NumberOfIODataObjects;
8713             }
8714         }
8715
8716         u16Tmp = u16NumberOfIODataObjects;
8717         while (u16Tmp--) {
8718             sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_data_object, tvb, offset, 0, ENC_NA);
8719             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_data_object);
8720             u32SubStart = offset;
8721
8722             /* SlotNumber */
8723             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8724                                 hf_pn_io_slot_nr, &u16SlotNr);
8725             /* Subslotnumber */
8726             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8727                                 hf_pn_io_subslot_nr, &u16SubslotNr);
8728             /* IODataObjectFrameOffset */
8729             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8730                                 hf_pn_io_io_data_object_frame_offset, &u16IODataObjectFrameOffset);
8731
8732             proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u",
8733                 u16SlotNr, u16SubslotNr, u16IODataObjectFrameOffset);
8734
8735             proto_item_set_len(sub_item, offset - u32SubStart);
8736
8737             if (!pinfo->fd->flags.visited && station_info != NULL) {
8738                 io_data_object = wmem_new0(wmem_file_scope(), ioDataObject);
8739                 io_data_object->slotNr = u16SlotNr;
8740                 io_data_object->subSlotNr = u16SubslotNr;
8741                 io_data_object->frameOffset = u16IODataObjectFrameOffset;
8742                 /* initial - Will be added later with Write Request */
8743                 io_data_object->f_dest_adr = 0;
8744                 io_data_object->f_par_crc1 = 0;
8745                 io_data_object->f_src_adr = 0;
8746                 io_data_object->f_crc_seed = FALSE;
8747                 io_data_object->f_crc_len = 0;
8748                 /* Reset as a PNIO Connect Request of a known module appears */
8749                 io_data_object->last_sb_cb = 0;
8750                 io_data_object->lastToggleBit = 0;
8751
8752                 if (u16IOCRType == PN_INPUT_CR) {
8753                     iocs_list = station_info->ioobject_data_in;
8754                 }
8755                 else {
8756                     iocs_list = station_info->ioobject_data_out;
8757                 }
8758
8759                 for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
8760                     cmp_io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
8761                     if (cmp_io_data_object->slotNr == u16SlotNr && cmp_io_data_object->subSlotNr == u16SubslotNr) {
8762                         /* Found identical existing object */
8763                         break;
8764                     }
8765                 }
8766
8767                 if (frame == NULL) {
8768                     /* new io_object data incoming */
8769                     wmem_list_append(iocs_list, io_data_object);
8770                 }
8771             }
8772         }
8773
8774         /* NumberOfIOCS */
8775         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
8776                             hf_pn_io_number_of_iocs, &u16NumberOfIOCS);
8777
8778         /* Set global Vairant for NumberOfIOCS */
8779         if (!pinfo->fd->flags.visited) {
8780             if (station_info != NULL) {
8781                 station_info->iocsNr = u16NumberOfIOCS;
8782             }
8783         }
8784
8785         u16Tmp = u16NumberOfIOCS;
8786         while (u16Tmp--) {
8787             sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_cs, tvb, offset, 0, ENC_NA);
8788             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_cs);
8789             u32SubStart = offset;
8790
8791             /* SlotNumber */
8792             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8793                                 hf_pn_io_slot_nr, &u16SlotNr);
8794             /* Subslotnumber */
8795             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8796                                 hf_pn_io_subslot_nr, &u16SubslotNr);
8797             /* IOCSFrameOffset */
8798             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8799                                 hf_pn_io_iocs_frame_offset, &u16IOCSFrameOffset);
8800
8801             proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u",
8802                 u16SlotNr, u16SubslotNr, u16IOCSFrameOffset);
8803
8804             proto_item_set_len(sub_item, offset - u32SubStart);
8805
8806             if (!pinfo->fd->flags.visited) {
8807                 if (station_info != NULL) {
8808                     if (u16IOCRType == PN_INPUT_CR) {
8809                         iocs_list = station_info->iocs_data_in;
8810                     }
8811                     else {
8812                         iocs_list = station_info->iocs_data_out;
8813                     }
8814
8815                     for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
8816                         cmp_iocs_object = (iocsObject*)wmem_list_frame_data(frame);
8817                         if (cmp_iocs_object->slotNr == u16SlotNr && cmp_iocs_object->subSlotNr == u16SubslotNr) {
8818                             /* Found identical existing object */
8819                             break;
8820                         }
8821                     }
8822
8823                     if (frame == NULL) {
8824                         /* new iocs_object data incoming */
8825                         iocs_object = wmem_new(wmem_file_scope(), iocsObject);
8826                         iocs_object->slotNr = u16SlotNr;
8827                         iocs_object->subSlotNr = u16SubslotNr;
8828                         iocs_object->frameOffset = u16IOCSFrameOffset;
8829                         wmem_list_append(iocs_list, iocs_object);
8830                     }
8831                 }
8832             }
8833         }
8834
8835         proto_item_append_text(api_item, ": 0x%x, NumberOfIODataObjects: %u NumberOfIOCS: %u",
8836             u32Api, u16NumberOfIODataObjects, u16NumberOfIOCS);
8837
8838         proto_item_set_len(api_item, offset - u32ApiStart);
8839     }
8840
8841     if (ar != NULL) {
8842         switch (u16IOCRType) {
8843         case(1): /* Input CR */
8844             if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) {
8845                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID);
8846             }
8847             ar->inputframeid = u16FrameID;
8848             break;
8849         case(2): /* Output CR */
8850 #if 0
8851             /* will usually contain 0xffff here because the correct framid will be given in the connect.Cnf */
8852             if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) {
8853                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID);
8854             }
8855             ar->outputframeid = u16FrameID;
8856 #endif
8857             break;
8858         default:
8859             expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockReq: IOCRType %u undecoded!", u16IOCRType);
8860         }
8861     } else {
8862         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockReq: no corresponding AR found!");
8863     }
8864
8865     return offset;
8866 }
8867
8868
8869 /* dissect the AlarmCRBlockReq */
8870 static int
8871 dissect_AlarmCRBlockReq_block(tvbuff_t *tvb, int offset,
8872     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8873     pnio_ar_t *ar)
8874 {
8875     guint16     u16AlarmCRType;
8876     guint16     u16LT;
8877     guint32     u32AlarmCRProperties;
8878     guint16     u16RTATimeoutFactor;
8879     guint16     u16RTARetries;
8880     guint16     u16LocalAlarmReference;
8881     guint16     u16MaxAlarmDataLength;
8882     guint16     u16AlarmCRTagHeaderHigh;
8883     guint16     u16AlarmCRTagHeaderLow;
8884     proto_item *sub_item;
8885     proto_tree *sub_tree;
8886
8887
8888     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8889         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8890             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8891         return offset;
8892     }
8893
8894     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8895                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
8896     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8897                         hf_pn_io_lt, &u16LT);
8898
8899     sub_item = proto_tree_add_item(tree, hf_pn_io_alarmcr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
8900     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_alarmcr_properties);
8901     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8902                         hf_pn_io_alarmcr_properties_reserved, &u32AlarmCRProperties);
8903     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8904                         hf_pn_io_alarmcr_properties_transport, &u32AlarmCRProperties);
8905     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8906                         hf_pn_io_alarmcr_properties_priority, &u32AlarmCRProperties);
8907
8908     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8909                         hf_pn_io_rta_timeoutfactor, &u16RTATimeoutFactor);
8910     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8911                         hf_pn_io_rta_retries, &u16RTARetries);
8912     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8913                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
8914     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8915                         hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength);
8916     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8917                         hf_pn_io_alarmcr_tagheaderhigh, &u16AlarmCRTagHeaderHigh);
8918     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8919                         hf_pn_io_alarmcr_tagheaderlow, &u16AlarmCRTagHeaderLow);
8920
8921     proto_item_append_text(item, ": %s, LT:0x%x, TFactor:%u, Retries:%u, Ref:0x%x, Len:%u Tag:0x%x/0x%x",
8922         val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"),
8923         u16LT, u16RTATimeoutFactor, u16RTARetries, u16LocalAlarmReference, u16MaxAlarmDataLength,
8924         u16AlarmCRTagHeaderHigh, u16AlarmCRTagHeaderLow);
8925
8926     if (ar != NULL) {
8927         if (ar->controlleralarmref != 0xffff && ar->controlleralarmref != u16LocalAlarmReference) {
8928             expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockReq: local alarm ref changed from %u to %u!", ar->controlleralarmref, u16LocalAlarmReference);
8929         }
8930         ar->controlleralarmref = u16LocalAlarmReference;
8931     } else {
8932         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockReq: no corresponding AR found!");
8933     }
8934
8935     return offset;
8936 }
8937
8938
8939 /* dissect the AlarmCRBlockRes */
8940 static int
8941 dissect_AlarmCRBlockRes_block(tvbuff_t *tvb, int offset,
8942     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8943     pnio_ar_t *ar)
8944 {
8945     guint16 u16AlarmCRType;
8946     guint16 u16LocalAlarmReference;
8947     guint16 u16MaxAlarmDataLength;
8948
8949
8950     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8951         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8952             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8953         return offset;
8954     }
8955
8956     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8957                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
8958     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8959                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
8960     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8961                         hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength);
8962
8963     proto_item_append_text(item, ": %s, Ref:0x%04x, MaxDataLen:%u",
8964         val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"),
8965         u16LocalAlarmReference, u16MaxAlarmDataLength);
8966
8967     if (ar != NULL) {
8968         if (ar->devicealarmref != 0xffff && ar->devicealarmref != u16LocalAlarmReference) {
8969             expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockRes: local alarm ref changed from %u to %u!", ar->devicealarmref, u16LocalAlarmReference);
8970         }
8971         ar->devicealarmref = u16LocalAlarmReference;
8972     } else {
8973         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockRes: no corresponding AR found!");
8974     }
8975
8976     return offset;
8977 }
8978
8979 /* dissect the ARServerBlock */
8980 static int
8981 dissect_ARServerBlock(tvbuff_t *tvb, int offset,
8982     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8983 {
8984     char    *pStationName;
8985     guint16  u16NameLength, u16padding;
8986
8987     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8988         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8989             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8990         return offset;
8991     }
8992
8993     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8994                         hf_pn_io_station_name_length, &u16NameLength);
8995
8996     pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
8997     tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
8998     pStationName[u16NameLength] = '\0';
8999     proto_tree_add_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pStationName);
9000     offset += u16NameLength;
9001     /* Padding to next 4 byte allignment in this block */
9002     u16padding = (u16NameLength-2) & 0x3;
9003     if (u16padding >0)
9004         offset = dissect_pn_padding(tvb, offset, pinfo, tree, u16padding);
9005     return offset;
9006 }
9007
9008
9009
9010 /* dissect the IOCRBlockRes */
9011 static int
9012 dissect_IOCRBlockRes_block(tvbuff_t *tvb, int offset,
9013     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9014     pnio_ar_t *ar)
9015 {
9016     guint16 u16IOCRType;
9017     guint16 u16IOCRReference;
9018     guint16 u16FrameID;
9019
9020
9021     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9022         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9023             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9024         return offset;
9025     }
9026
9027     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9028                         hf_pn_io_iocr_type, &u16IOCRType);
9029     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9030                         hf_pn_io_iocr_reference, &u16IOCRReference);
9031     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9032                         hf_pn_io_frame_id, &u16FrameID);
9033
9034     proto_item_append_text(item, ": %s, Ref:0x%04x, FrameID:0x%04x",
9035         val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"),
9036         u16IOCRReference, u16FrameID);
9037
9038     if (ar != NULL) {
9039         switch (u16IOCRType) {
9040         case(1): /* Input CR */
9041             if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) {
9042                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID);
9043             }
9044             ar->inputframeid = u16FrameID;
9045             break;
9046         case(2): /* Output CR */
9047             if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) {
9048                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID);
9049             }
9050             ar->outputframeid = u16FrameID;
9051             break;
9052         default:
9053             expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockRes: IOCRType %u undecoded!", u16IOCRType);
9054         }
9055     } else {
9056         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockRes: no corresponding AR found!");
9057     }
9058
9059     return offset;
9060 }
9061
9062
9063
9064 /* dissect the MCRBlockReq */
9065 static int
9066 dissect_MCRBlockReq_block(tvbuff_t *tvb, int offset,
9067     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9068 {
9069     guint16  u16IOCRReference;
9070     guint32  u32AddressResolutionProperties;
9071     guint16  u16MCITimeoutFactor;
9072     guint16  u16NameLength;
9073     char    *pStationName;
9074
9075
9076     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9077         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9078             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9079         return offset;
9080     }
9081
9082     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9083                         hf_pn_io_iocr_reference, &u16IOCRReference);
9084     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9085                         hf_pn_io_address_resolution_properties, &u32AddressResolutionProperties);
9086     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9087                         hf_pn_io_mci_timeout_factor, &u16MCITimeoutFactor);
9088
9089     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9090                         hf_pn_io_station_name_length, &u16NameLength);
9091
9092     pStationName = (char *)wmem_alloc(wmem_packet_scope(), u16NameLength+1);
9093     tvb_memcpy(tvb, (guint8 *) pStationName, offset, u16NameLength);
9094     pStationName[u16NameLength] = '\0';
9095     proto_tree_add_string (tree, hf_pn_io_provider_station_name, tvb, offset, u16NameLength, pStationName);
9096     offset += u16NameLength;
9097
9098     proto_item_append_text(item, ", CRRef:%u, Properties:0x%x, TFactor:%u, Station:%s",
9099         u16IOCRReference, u32AddressResolutionProperties, u16MCITimeoutFactor, pStationName);
9100
9101     return offset;
9102 }
9103
9104
9105
9106 /* dissect the SubFrameBlock */
9107 static int
9108 dissect_SubFrameBlock_block(tvbuff_t *tvb, int offset,
9109     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9110     guint16 u16BodyLength)
9111 {
9112     guint16     u16IOCRReference;
9113     guint8      mac[6];
9114     guint32     u32SubFrameData;
9115     guint16     u16Tmp;
9116     proto_item *sub_item;
9117     proto_tree *sub_tree;
9118
9119
9120     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9121         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9122             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9123         return offset;
9124     }
9125     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9126
9127     /* IOCRReference */
9128     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9129                         hf_pn_io_iocr_reference, &u16IOCRReference);
9130
9131     /* CMInitiatorMACAdd */
9132     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
9133                         hf_pn_io_cminitiator_macadd, mac);
9134
9135     /* SubFrameData n*32 */
9136     u16BodyLength -= 10;
9137     u16Tmp = u16BodyLength;
9138     do {
9139         sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN);
9140         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data);
9141         /* 31-16 reserved_2 */
9142         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9143                             hf_pn_io_subframe_data_reserved2, &u32SubFrameData);
9144         /* 15- 8 DataLength */
9145         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9146                             hf_pn_io_subframe_data_length, &u32SubFrameData);
9147         /*    7 reserved_1 */
9148         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9149                             hf_pn_io_subframe_data_reserved1, &u32SubFrameData);
9150         /*  6-0 Position */
9151         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9152                             hf_pn_io_subframe_data_position, &u32SubFrameData);
9153
9154         proto_item_append_text(sub_item, ", Length:%u, Pos:%u",
9155             (u32SubFrameData & 0x0000FF00) >> 8, u32SubFrameData & 0x0000007F);
9156     } while (u16Tmp -= 4);
9157
9158     proto_item_append_text(item, ", CRRef:%u, %u*Data",
9159         u16IOCRReference, u16BodyLength/4);
9160
9161     return offset;
9162 }
9163
9164 /* dissect the (PD)SubFrameBlock  0x022B */
9165 static int
9166 dissect_PDSubFrameBlock_block(tvbuff_t *tvb, int offset,
9167     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9168     guint16 u16BodyLength)
9169 {
9170     guint32 u32SFIOCRProperties;
9171     guint32 u32SubFrameData;
9172     guint16 u16FrameID;
9173     proto_item *sub_item;
9174     proto_tree *sub_tree;
9175     guint16 u16RemainingLength;
9176
9177     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9178         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9179             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9180         return offset;
9181     }
9182     /* FrameID */
9183     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_id, &u16FrameID);
9184     /* SFIOCRProperties */
9185     sub_item = proto_tree_add_item(tree, hf_pn_io_SFIOCRProperties, tvb, offset, PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH, ENC_BIG_ENDIAN);
9186     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_SFIOCRProperties);
9187
9188     /*    dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties, &u32SFIOCRProperties); */
9189     /* Bit 31: SFIOCRProperties.SFCRC16 */
9190     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_SFCRC16, &u32SFIOCRProperties);
9191
9192     /* Bit 30: SFIOCRProperties.DFPRedundantPathLayout */
9193     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout, &u32SFIOCRProperties);
9194     /* Bit 29: SFIOCRProperties.DFPRedundantPathLayout */
9195     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPType, &u32SFIOCRProperties);
9196     /* Bit 28 - 29: SFIOCRProperties.reserved_2 */
9197     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_2, &u32SFIOCRProperties);
9198     /* Bit 24 - 27: SFIOCRProperties.reserved_1 */
9199     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_1, &u32SFIOCRProperties);
9200     /* Bit 16 - 23: SFIOCRProperties.DFPmode */
9201     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPmode, &u32SFIOCRProperties);
9202     /*  Bit 8 - 15: SFIOCRProperties.RestartFactorForDistributedWD */
9203     /*      0x00           Mandatory    No restart delay necessary
9204             0x01 - 0x09    Optional    Less than 1 s restart delay
9205             0x0A - 0x50    Mandatory    1 s to 8 s restart delay
9206             0x51 - 0xFF    Optional    More than 8 s restart delay */
9207     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_RestartFactorForDistributedWD, &u32SFIOCRProperties);
9208     /*  bit 0..7 SFIOCRProperties.DistributedWatchDogFactor */
9209     offset = /* it is the last one, so advance! */
9210         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_DistributedWatchDogFactor, &u32SFIOCRProperties);
9211
9212     /* SubframeData */
9213     u16RemainingLength = u16BodyLength - PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH - PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH;
9214     while (u16RemainingLength >= PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH)
9215     {
9216         guint8 Position,
9217                DataLength;
9218         sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN);
9219         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data);
9220
9221         /* Bit 0 - 6: SubframeData.Position */
9222         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_position, &u32SubFrameData);
9223         /* Bit 7: SubframeData.reserved_1 */
9224         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved1, &u32SubFrameData);
9225         /* Bit 8 - 15: SubframeData.dataLength */
9226         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_length, &u32SubFrameData);
9227         /* Bit 16 - 31: SubframeData.reserved_2 */
9228         offset =
9229             dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved2, &u32SubFrameData);
9230         Position  = (guint8) (u32SubFrameData & 0x7F);       /* the lower 6 bits */
9231         DataLength =(guint8) ((u32SubFrameData >>8) & 0x0ff); /* bit 8 to 15 */
9232         proto_item_append_text(sub_item, ", Length:%u (0x%x), Pos:%u",
9233             DataLength,DataLength, Position);
9234         u16RemainingLength = u16RemainingLength - 4;
9235     }
9236     return offset;
9237 }
9238
9239
9240 /* dissect the IRInfoBlock */
9241 static int
9242 dissect_IRInfoBlock_block(tvbuff_t *tvb, int offset,
9243     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9244     guint16 u16BodyLength _U_)
9245 {
9246     guint16  u16NumberOfIOCR;
9247     guint16  u16SubframeOffset;
9248     guint32  u32SubframeData;
9249     guint16  u16IOCRReference;
9250     e_guid_t IRDataUUID;
9251
9252
9253     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9254         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9255             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9256         return offset;
9257     }
9258     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9259
9260     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
9261                         hf_pn_io_IRData_uuid, &IRDataUUID);
9262
9263     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9264
9265     /* Numbers of IOCRs */
9266     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9267                         hf_pn_io_number_of_iocrs, &u16NumberOfIOCR);
9268
9269     while (u16NumberOfIOCR--)
9270     {   /* IOCRReference */
9271         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference);
9272
9273         /* SubframeOffset 16 */
9274         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeOffset, &u16SubframeOffset);
9275
9276         /* SubframeData  32 */
9277         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeData, &u32SubframeData);
9278     }
9279     return offset;
9280 }
9281
9282 /* dissect the SRInfoBlock */
9283 static int
9284 dissect_SRInfoBlock_block(tvbuff_t *tvb, int offset,
9285     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9286     guint16 u16BodyLength _U_)
9287 {
9288     guint16 u16RedundancyDataHoldFactor;
9289     guint32 u32sr_properties;
9290     guint8 u8SRPropertiesMode;
9291     proto_item *sub_item;
9292     proto_tree *sub_tree;
9293
9294     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9295         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9296             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9297         return offset;
9298     }
9299     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_RedundancyDataHoldFactor, &u16RedundancyDataHoldFactor);
9300
9301     u32sr_properties = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN);
9302     sub_item = proto_tree_add_item(tree, hf_pn_io_sr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
9303     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_sr_properties);
9304
9305     u8SRPropertiesMode = (guint8)((u32sr_properties >> 2) & 0x01);
9306
9307     /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 1 */
9308     if (u8SRPropertiesMode)
9309     {
9310         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9311             hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1, &u32sr_properties);
9312     }
9313     /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 0 */
9314     else
9315     {
9316         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9317             hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0, &u32sr_properties);
9318     }
9319     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_1, &u32sr_properties);
9320     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Mode, &u32sr_properties);
9321
9322     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_2, &u32sr_properties);
9323
9324     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_3, &u32sr_properties);
9325     return offset;
9326 }
9327
9328 /* dissect the RSInfoBlock */
9329 static int
9330 dissect_RSInfoBlock_block(tvbuff_t *tvb, int offset,
9331     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
9332     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_)
9333 {
9334     guint32 u32RSProperties;
9335
9336     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9337         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9338             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9339         return offset;
9340     }
9341
9342     /* Padding 2 + 2 + 1 + 1 = 6 */
9343     /* Therefore we need 2 byte padding to make the block u32 aligned */
9344     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9345
9346     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties, &u32RSProperties);
9347     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_alarm_transport, &u32RSProperties);
9348     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved1, &u32RSProperties);
9349     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved2, &u32RSProperties);
9350
9351     return offset;
9352 }
9353
9354 /* dissect the PDIRSubframeData block  0x022a */
9355 static int
9356 dissect_PDIRSubframeData_block(tvbuff_t *tvb, int offset,
9357     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9358 {
9359     guint16     u16NumberOfSubframeBlocks;
9360
9361     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9362         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9363             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9364         return offset;
9365     }
9366     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_NumberOfSubframeBlocks, &u16NumberOfSubframeBlocks);
9367
9368     while (u16NumberOfSubframeBlocks --)
9369     {   /* dissect the Subframe Block  */
9370         offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep);
9371     }
9372
9373     return offset;
9374 }
9375
9376 static int
9377 dissect_ARVendorBlockReq_block(tvbuff_t *tvb, int offset,
9378     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9379     guint16 u16BodyLength _U_)
9380 {
9381     guint16 APStructureIdentifier;
9382     guint32 gu32API;
9383     guint32 guDataBytes;
9384
9385     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9386         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9387             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9388         return offset;
9389     }
9390     APStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN)
9391                             ? tvb_get_letohs(tvb, offset)
9392                             : tvb_get_ntohs(tvb, offset));
9393
9394     gu32API = ((drep[0] & DREP_LITTLE_ENDIAN)
9395                 ? tvb_get_letohl(tvb, offset + 2)
9396                 : tvb_get_ntohl (tvb, offset + 2));
9397
9398     if (tree)
9399     {
9400         if (gu32API == 0)
9401         {
9402             if (APStructureIdentifier <0x8000)
9403             {
9404                 proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_low, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9405             }
9406             else
9407             {
9408                 if (APStructureIdentifier > 0x8000)
9409                 {
9410                     proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_high, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9411                 }
9412                 else /* APStructureIdentifier == 0x8000 */
9413                 {
9414                     proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_is8000, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9415                 }
9416             }
9417         }
9418         else
9419         {
9420             proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_not0, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9421         }
9422         /* API */
9423         proto_tree_add_item(tree, hf_pn_io_api, tvb, offset + 2, 4, DREP_ENC_INTEGER(drep));
9424     }
9425     offset += 6;
9426     if (u16BodyLength < 6 )
9427         return offset; /* there are no user bytes! */
9428     guDataBytes = u16BodyLength - 6;
9429
9430     dissect_pn_user_data(tvb, offset, pinfo, tree, guDataBytes, "Data ");
9431     return offset;
9432 }
9433
9434 /* dissect the DataDescription */
9435 static int
9436 dissect_DataDescription(tvbuff_t *tvb, int offset,
9437     packet_info *pinfo, proto_tree *tree, guint8 *drep, ioDataObject *tmp_io_data_object)
9438 {
9439     guint16     u16DataDescription;
9440     guint16     u16SubmoduleDataLength;
9441     guint8      u8LengthIOCS;
9442     guint8      u8LengthIOPS;
9443     proto_item *sub_item;
9444     proto_tree *sub_tree;
9445     guint32     u32SubStart;
9446
9447     conversation_t    *conversation;
9448     stationInfo       *station_info = NULL;
9449     ioDataObject      *io_data_object;
9450     wmem_list_frame_t *frame;
9451     wmem_list_t       *ioobject_list;
9452
9453     sub_item = proto_tree_add_item(tree, hf_pn_io_data_description_tree, tvb, offset, 0, ENC_NA);
9454     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_data_description);
9455     u32SubStart = offset;
9456
9457     /* DataDescription */
9458     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9459                     hf_pn_io_data_description, &u16DataDescription);
9460     /* SubmoduleDataLength */
9461     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9462                     hf_pn_io_submodule_data_length, &u16SubmoduleDataLength);
9463     /* LengthIOCS */
9464     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9465                     hf_pn_io_length_iocs, &u8LengthIOCS);
9466     /* LengthIOPS */
9467     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9468                     hf_pn_io_length_iops, &u8LengthIOPS);
9469
9470     proto_item_append_text(sub_item, ": %s, SubmoduleDataLength: %u, LengthIOCS: %u, u8LengthIOPS: %u",
9471         val_to_str(u16DataDescription, pn_io_data_description, "(0x%x)"),
9472         u16SubmoduleDataLength, u8LengthIOCS, u8LengthIOPS);
9473     proto_item_set_len(sub_item, offset - u32SubStart);
9474
9475     /* Save new data for IO Data Objects */
9476     if (!pinfo->fd->flags.visited) {
9477         /* Get current conversation endpoints using MAC addresses */
9478         conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9479         if (conversation == NULL) {
9480             conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9481         }
9482
9483         station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
9484
9485         if (station_info != NULL) {
9486             if (u16DataDescription == PN_INPUT_DATADESCRITPION) {
9487                 /* INPUT HANDLING */
9488                 ioobject_list = station_info->ioobject_data_in;
9489             }
9490             else {
9491                 /* OUTPUT HANDLING */
9492                 ioobject_list = station_info->ioobject_data_out;
9493             }
9494
9495             for (frame = wmem_list_head(ioobject_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
9496                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
9497                 if (io_data_object->slotNr == tmp_io_data_object->slotNr && io_data_object->subSlotNr == tmp_io_data_object->subSlotNr) {
9498                     /* Write additional data from dissect_ExpectedSubmoduleBlockReq_block() to corresponding io_data_object */
9499                     io_data_object->moduleIdentNr = tmp_io_data_object->moduleIdentNr;
9500                     io_data_object->subModuleIdentNr = tmp_io_data_object->subModuleIdentNr;
9501                     io_data_object->length = u16SubmoduleDataLength;
9502
9503                     io_data_object->moduleNameStr = wmem_strdup(wmem_file_scope(), tmp_io_data_object->moduleNameStr);
9504                     io_data_object->profisafeSupported = tmp_io_data_object->profisafeSupported;
9505                     io_data_object->discardIOXS = tmp_io_data_object->discardIOXS;
9506                     io_data_object->amountInGSDML = tmp_io_data_object->amountInGSDML;
9507                     io_data_object->fParameterIndexNr = tmp_io_data_object->fParameterIndexNr;
9508
9509                     break;
9510                 }
9511             }
9512         }
9513     }
9514
9515     return offset;
9516 }
9517
9518
9519 /* dissect the ExpectedSubmoduleBlockReq */
9520 static int
9521 dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
9522     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9523 {
9524     guint16     u16NumberOfAPIs;
9525     guint32     u32Api;
9526     guint16     u16SlotNr;
9527     guint32     u32ModuleIdentNumber;
9528     guint16     u16ModuleProperties;
9529     guint16     u16NumberOfSubmodules;
9530     guint16     u16SubslotNr;
9531     guint32     u32SubmoduleIdentNumber;
9532     guint16     u16SubmoduleProperties;
9533     proto_item *api_item;
9534     proto_tree *api_tree;
9535     guint32     u32ApiStart;
9536     proto_item *sub_item;
9537     proto_tree *sub_tree;
9538     proto_item *submodule_item;
9539     proto_tree *submodule_tree;
9540     guint32     u32SubStart;
9541
9542     /* Variable for the search of gsd file */
9543     const char vendorIdStr[] = "VendorID=\"";
9544     const char deviceIdStr[] = "DeviceID=\"";
9545     const char moduleStr[] = "ModuleIdentNumber=\"";
9546     const char subModuleStr[] = "SubmoduleIdentNumber=\"";
9547     const char profisafeStr[] = "PROFIsafeSupported=\"true\"";
9548     const char fParameterStr[] = "<F_ParameterRecordDataItem";
9549     const char fParameterIndexStr[] = "Index=";
9550     const char moduleNameInfo[] = "<Name";
9551     const char moduleValueInfo[] = "Value=\"";
9552
9553     guint16  searchVendorID = 0;
9554     guint16  searchDeviceID = 0;
9555     gboolean vendorMatch;
9556     gboolean deviceMatch;
9557     conversation_t *conversation;
9558     stationInfo    *station_info = NULL;
9559     ioDataObject   *io_data_object = NULL; /* Used to transfer data to fct. "dissect_DataDescription()" */
9560
9561     /* Variable for the search of GSD-file */
9562     guint32  read_vendor_id;
9563     guint32  read_device_id;
9564     guint32  read_module_id;
9565     guint32  read_submodule_id;
9566     gboolean gsdmlFoundFlag;
9567     gchar   tmp_moduletext[MAX_NAMELENGTH];
9568     gchar   *convertStr;      /* GSD-file search */
9569     gchar   *pch;             /* helppointer, to save temp. the found Networkpath of GSD-file */
9570     gchar   *puffer;          /* used for fgets() during GSD-file search */
9571     gchar   *temp;            /* used for fgets() during GSD-file search */
9572     gchar   *diropen = NULL;  /* saves the final networkpath to open for GSD-files */
9573     GDir    *dir;
9574     FILE    *fp = NULL;       /* filepointer */
9575     const gchar *filename;    /* saves the found GSD-file name */
9576
9577     /* Helppointer initial */
9578     convertStr = (gchar*)wmem_alloc(wmem_packet_scope(), MAX_NAMELENGTH);
9579     convertStr[0] = '\0';
9580     pch = (gchar*)wmem_alloc(wmem_packet_scope(), MAX_LINE_LENGTH);
9581     pch[0] = '\0';
9582     puffer = (gchar*)wmem_alloc(wmem_packet_scope(), MAX_LINE_LENGTH);
9583     puffer[0] = '\0';
9584     temp = (gchar*)wmem_alloc(wmem_packet_scope(), MAX_LINE_LENGTH);
9585     temp[0] = '\0';
9586
9587     /* Initial */
9588     io_data_object = wmem_new0(wmem_file_scope(), ioDataObject);
9589     io_data_object->profisafeSupported = FALSE;
9590     io_data_object->moduleNameStr = (gchar*)wmem_alloc(wmem_file_scope(), MAX_NAMELENGTH);
9591     g_strlcpy(io_data_object->moduleNameStr, "Unknown", MAX_NAMELENGTH);
9592     vendorMatch = FALSE;
9593     deviceMatch = FALSE;
9594     gsdmlFoundFlag = FALSE;
9595
9596
9597     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9598         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9599             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9600         return offset;
9601     }
9602
9603     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9604                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
9605
9606     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
9607
9608
9609     /* Get current conversation endpoints using MAC addresses */
9610     conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9611     if (conversation == NULL) {
9612         conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9613     }
9614
9615     station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
9616     if (station_info != NULL) {
9617         station_info->gsdFound = FALSE;
9618         station_info->gsdPathLength = FALSE;
9619
9620         /* Set searchVendorID and searchDeviceID for GSDfile search */
9621         searchVendorID = station_info->u16Vendor_id;
9622         searchDeviceID = station_info->u16Device_id;
9623
9624         /* Use the given GSD-file networkpath of the PNIO-Preference */
9625         if(pnio_ps_networkpath[0] != '\0') {   /* check the length of the given networkpath (array overflow protection) */
9626             station_info->gsdPathLength = TRUE;
9627
9628             if ((dir = g_dir_open(pnio_ps_networkpath, 0, NULL)) != NULL) {
9629                 /* Find all GSD-files within directory */
9630                 while ((filename = g_dir_read_name(dir)) != NULL) {
9631
9632                     /* ---- complete the path to open a GSD-file ---- */
9633                     diropen = wmem_strdup_printf(wmem_packet_scope(), "%s" G_DIR_SEPARATOR_S "%s", pnio_ps_networkpath, filename);
9634
9635                     /* ---- Open the found GSD-file  ---- */
9636                     fp = ws_fopen(diropen, "r");
9637
9638                     if(fp != NULL) {
9639                         /* ---- Get VendorID & DeviceID ---- */
9640                         while(pn_fgets(puffer, MAX_LINE_LENGTH, fp) != NULL) {
9641                             /* ----- VendorID ------ */
9642                             if((strstr(puffer, vendorIdStr)) != NULL) {
9643                                 memset (convertStr, 0, sizeof(*convertStr));
9644                                 pch = strstr(puffer, vendorIdStr);
9645                                 if (pch!= NULL && sscanf(pch, "VendorID=\"%199[^\"]", convertStr) == 1) {
9646                                     read_vendor_id = (guint32) strtoul (convertStr, NULL, 0);
9647
9648                                     if(read_vendor_id == searchVendorID) {
9649                                         vendorMatch = TRUE;        /* found correct VendorID */
9650                                     }
9651                                 }
9652                             }
9653
9654                             /* ----- DeviceID ------ */
9655                             if((strstr(puffer, deviceIdStr)) != NULL) {
9656                                 memset(convertStr, 0, sizeof(*convertStr));
9657                                 pch = strstr(puffer, deviceIdStr);
9658                                 if (pch != NULL && sscanf(pch, "DeviceID=\"%199[^\"]", convertStr) == 1) {
9659                                     read_device_id = (guint32)strtoul(convertStr, NULL, 0);
9660
9661                                     if(read_device_id == searchDeviceID) {
9662                                         deviceMatch = TRUE;        /* found correct DeviceID */
9663                                     }
9664                                 }
9665                             }
9666                         }
9667
9668                         fclose(fp);
9669                         fp = NULL;
9670
9671                         if(vendorMatch && deviceMatch) {
9672                             break;        /* Found correct GSD-file! -> Break the searchloop */
9673                         }
9674                         else {
9675                             /* Couldn't find the correct GSD-file to the corresponding device */
9676                             vendorMatch = FALSE;
9677                             deviceMatch = FALSE;
9678                             gsdmlFoundFlag = FALSE;
9679                             diropen = "";           /* reset array for next search */
9680                         }
9681                     }
9682                 }
9683
9684                 g_dir_close(dir);
9685             }
9686
9687             /* ---- Found the correct GSD-file -> set Flag and save the completed path ---- */
9688             if(vendorMatch && deviceMatch) {
9689                 gsdmlFoundFlag = TRUE;
9690                 station_info->gsdFound = TRUE;
9691                 station_info->gsdLocation = wmem_strdup(wmem_file_scope(), diropen);
9692             }
9693             else {
9694                 /* Copy searchpath to array for a detailed output message in cyclic data dissection */
9695                 station_info->gsdLocation = wmem_strdup_printf(wmem_file_scope(), "%s" G_DIR_SEPARATOR_S "*.xml", pnio_ps_networkpath);
9696             }
9697         }
9698         else {
9699             /* will be used later on in cyclic RTC1 data dissection for detailed output message */
9700             station_info->gsdPathLength = FALSE;
9701         }
9702     }
9703
9704     while (u16NumberOfAPIs--) {
9705         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
9706         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
9707         u32ApiStart = offset;
9708
9709         /* API */
9710         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9711                             hf_pn_io_api, &u32Api);
9712         /* SlotNumber */
9713         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9714                             hf_pn_io_slot_nr, &u16SlotNr);
9715         /* ModuleIdentNumber */
9716         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9717                             hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
9718         /* ModuleProperties */
9719         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9720                             hf_pn_io_module_properties, &u16ModuleProperties);
9721         /* NumberOfSubmodules */
9722         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9723                             hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
9724
9725         proto_item_append_text(api_item, ": %u, Slot:0x%x, IdentNumber:0x%x Properties:0x%x Submodules:%u",
9726             u32Api, u16SlotNr, u32ModuleIdentNumber, u16ModuleProperties, u16NumberOfSubmodules);
9727
9728         proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
9729
9730         while (u16NumberOfSubmodules--) {
9731             sub_item = proto_tree_add_item(api_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
9732             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
9733             u32SubStart = offset;
9734
9735             /* Subslotnumber */
9736             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9737                                 hf_pn_io_subslot_nr, &u16SubslotNr);
9738             /* SubmoduleIdentNumber */
9739             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9740                             hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
9741             /* SubmoduleProperties */
9742             submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_properties, tvb, offset, 2, ENC_BIG_ENDIAN);
9743             submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_properties);
9744             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9745                             hf_pn_io_submodule_properties_reserved, &u16SubmoduleProperties);
9746             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9747                             hf_pn_io_submodule_properties_discard_ioxs, &u16SubmoduleProperties);
9748             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9749                             hf_pn_io_submodule_properties_reduce_output_submodule_data_length, &u16SubmoduleProperties);
9750             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9751                             hf_pn_io_submodule_properties_reduce_input_submodule_data_length, &u16SubmoduleProperties);
9752             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9753                             hf_pn_io_submodule_properties_shared_input, &u16SubmoduleProperties);
9754             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9755                             hf_pn_io_submodule_properties_type, &u16SubmoduleProperties);
9756
9757             io_data_object->slotNr = u16SlotNr;
9758             io_data_object->subSlotNr = u16SubslotNr;
9759             io_data_object->moduleIdentNr = u32ModuleIdentNumber;
9760             io_data_object->subModuleIdentNr = u32SubmoduleIdentNumber;
9761             io_data_object->discardIOXS = u16SubmoduleProperties & 0x0020;
9762
9763             /* Search the moduleID and subModuleID, find if PROFIsafe and also search for F-Par. Indexnumber
9764              * ---------------------------------------------------------------------------------------------
9765              * Speical case: Module has several ModuleIdentNr. in one GSD-file
9766              * Also with the given parameters of wireshark, some modules were completely equal. For this
9767              * special case a compromise for this problem has been made, to set the module name will
9768              * be more generally displayed.
9769              * Also this searchloop will find the F-Parameter Indexnumber, so that Wireshark is able to
9770              * dissect those F-Parameters correctly, as this index can change between the vendors.
9771              */
9772
9773             io_data_object->amountInGSDML = 0;
9774             io_data_object->fParameterIndexNr = 0;
9775             io_data_object->profisafeSupported = FALSE;
9776
9777             if (diropen != NULL) {
9778                 fp = ws_fopen(diropen, "r");
9779             }
9780             else {
9781                 fp = NULL;
9782             }
9783             if(fp != NULL && gsdmlFoundFlag) {
9784                 fseek(fp, 0, SEEK_SET);
9785
9786                 /* Find Indexnumber for fParameter */
9787                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
9788                     if((strstr(temp, fParameterStr)) != NULL) {
9789                         memset (convertStr, 0, sizeof(*convertStr));
9790
9791                         pch = strstr(temp, fParameterIndexStr);
9792                         if (pch != NULL && sscanf(pch, "Index=\"%199[^\"]", convertStr) == 1) {
9793                             io_data_object->fParameterIndexNr = (guint32)strtoul(convertStr, NULL, 0);
9794                         }
9795                         break;    /* found Indexnumber -> break search loop */
9796                     }
9797                 }
9798
9799                 memset (temp, 0, sizeof(*temp));
9800                 fseek(fp, 0, SEEK_SET);                /* Set filepointer to the beginning */
9801
9802                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
9803                     if((strstr(temp, moduleStr)) != NULL) {                         /* find the String "ModuleIdentNumber=" */
9804                         memset (convertStr, 0, sizeof(*convertStr));
9805                         pch = strstr(temp, moduleStr);                              /* search for "ModuleIdentNumber=\"" within GSD-file */
9806                         if (pch != NULL && sscanf(pch, "ModuleIdentNumber=\"%199[^\"]", convertStr) == 1) {  /* Change format of Value string-->numeric string */
9807                             read_module_id = (guint32)strtoul(convertStr, NULL, 0);     /* Change numeric string --> unsigned long; read_module_id contains the Value of the ModuleIdentNumber */
9808
9809                             /* If the found ModuleID matches with the wanted ModuleID, search for the Submodule and break */
9810                             if (read_module_id == io_data_object->moduleIdentNr) {
9811                                 ++io_data_object->amountInGSDML;    /* Save the amount of same (!) Module- & SubmoduleIdentNr in one GSD-file */
9812
9813                                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
9814                                     if((strstr(temp, moduleNameInfo)) != NULL) {                    /* find the String "<Name" for the TextID */
9815                                         long filePosRecord;
9816
9817                                         if (sscanf(temp, "%*s TextId=\"%199[^\"]", tmp_moduletext) != 1)        /* saves the correct TextId for the next searchloop */
9818                                             break;
9819
9820                                         filePosRecord = ftell(fp);            /* save the current position of the filepointer (Offset) */
9821                                         /* ftell() may return -1 for error, don't move fp in this case */
9822                                         if (filePosRecord >= 0) {
9823                                             while (pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL && io_data_object->amountInGSDML == 1) {
9824                                                 /* Find a String with the saved TextID and with a fitting value for it in the same line. This value is the name of the Module! */
9825                                                 if(((strstr(temp, tmp_moduletext)) != NULL) && ((strstr(temp, moduleValueInfo)) != NULL)) {
9826                                                     pch = strstr(temp, moduleValueInfo);
9827                                                     if (pch != NULL && sscanf(pch, "Value=\"%199[^\"]", io_data_object->moduleNameStr) == 1)
9828                                                         break;    /* Found the name of the module */
9829                                                 }
9830                                             }
9831
9832                                             fseek(fp, filePosRecord, SEEK_SET);    /* set filepointer to the correct TextID */
9833                                         }
9834                                     }
9835
9836                                     /* Search for Submoduleidentnumber in GSD-file */
9837                                     if((strstr(temp, subModuleStr)) != NULL) {
9838                                         memset (convertStr, 0, sizeof(*convertStr));
9839                                         pch = strstr(temp, subModuleStr);
9840                                         if (pch != NULL && sscanf(pch, "SubmoduleIdentNumber=\"%199[^\"]", convertStr) == 1) {
9841                                             read_submodule_id = (guint32) strtoul (convertStr, NULL, 0);    /* read_submodule_id contains the Value of the SubModuleIdentNumber */
9842
9843                                             /* Find "PROFIsafeSupported" flag of the module in GSD-file */
9844                                             if(read_submodule_id == io_data_object->subModuleIdentNr) {
9845                                                 if((strstr(temp, profisafeStr)) != NULL) {
9846                                                     io_data_object->profisafeSupported = TRUE;   /* flag is in the same line as SubmoduleIdentNr */
9847                                                     break;
9848                                                 }
9849                                                 else {    /* flag is not in the same line as Submoduleidentnumber -> search for it */
9850                                                     while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
9851                                                         if((strstr(temp, profisafeStr)) != NULL) {
9852                                                             io_data_object->profisafeSupported = TRUE;
9853                                                             break;    /* Found the PROFIsafeSupported flag of the module */
9854                                                         }
9855
9856                                                         else if((strstr(temp, ">")) != NULL) {
9857                                                             break;
9858                                                         }
9859                                                     }
9860                                                 }
9861                                             }
9862                                             break;    /* Found the PROFIsafe Module */
9863                                         }
9864                                     }
9865                                 }
9866                             }
9867                         }
9868                     }
9869                 }
9870
9871                 fclose(fp);
9872                 fp = NULL;
9873             }
9874
9875             if(fp != NULL)
9876             {
9877                 fclose(fp);
9878                 fp = NULL;
9879             }
9880
9881             switch (u16SubmoduleProperties & 0x03) {
9882             case(0x00): /* no input and no output data (one Input DataDescription Block follows) */
9883                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9884                 break;
9885             case(0x01): /* input data (one Input DataDescription Block follows) */
9886                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9887                 break;
9888             case(0x02): /* output data (one Output DataDescription Block follows) */
9889                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9890                 break;
9891             case(0x03): /* input and output data (one Input and one Output DataDescription Block follows) */
9892                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9893                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9894                 break;
9895             default: /* will not execute because of the line preceding the switch */
9896                 break;
9897             }
9898
9899             proto_item_append_text(sub_item, ": Subslot:0x%x, Ident:0x%x Properties:0x%x",
9900                 u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleProperties);
9901             proto_item_set_len(sub_item, offset - u32SubStart);
9902         }
9903
9904         proto_item_set_len(api_item, offset - u32ApiStart);
9905     }
9906
9907     return offset;
9908 }
9909
9910
9911 /* dissect the ModuleDiffBlock */
9912 static int
9913 dissect_ModuleDiffBlock_block(tvbuff_t *tvb, int offset,
9914     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9915 {
9916     guint16     u16NumberOfAPIs;
9917     guint32     u32Api;
9918     guint16     u16NumberOfModules;
9919     guint16     u16SlotNr;
9920     guint32     u32ModuleIdentNumber;
9921     guint16     u16ModuleState;
9922     guint16     u16NumberOfSubmodules;
9923     guint16     u16SubslotNr;
9924     guint32     u32SubmoduleIdentNumber;
9925     guint16     u16SubmoduleState;
9926     proto_item *api_item;
9927     proto_tree *api_tree;
9928     guint32     u32ApiStart;
9929     proto_item *module_item;
9930     proto_tree *module_tree;
9931     guint32     u32ModuleStart;
9932     proto_item *sub_item;
9933     proto_tree *sub_tree;
9934     proto_item *submodule_item;
9935     proto_tree *submodule_tree;
9936     guint32     u32SubStart;
9937
9938     conversation_t    *conversation;
9939     stationInfo       *station_info;
9940     wmem_list_frame_t *frame;
9941     moduleDiffInfo    *module_diff_info;
9942     moduleDiffInfo    *cmp_module_diff_info;
9943
9944     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9945         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9946             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9947         return offset;
9948     }
9949
9950     /* NumberOfAPIs */
9951     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9952                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
9953
9954     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
9955
9956     while (u16NumberOfAPIs--) {
9957         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
9958         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
9959         u32ApiStart = offset;
9960
9961         /* API */
9962         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9963                             hf_pn_io_api, &u32Api);
9964         /* NumberOfModules */
9965         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9966                             hf_pn_io_number_of_modules, &u16NumberOfModules);
9967
9968         proto_item_append_text(api_item, ": %u, Modules: %u",
9969             u32Api, u16NumberOfModules);
9970
9971         proto_item_append_text(item, ", Modules:%u", u16NumberOfModules);
9972
9973         while (u16NumberOfModules--) {
9974             module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA);
9975             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
9976             u32ModuleStart = offset;
9977
9978             /* SlotNumber */
9979             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9980                                 hf_pn_io_slot_nr, &u16SlotNr);
9981             /* ModuleIdentNumber */
9982             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep,
9983                                 hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
9984             /* ModuleState */
9985             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9986                                 hf_pn_io_module_state, &u16ModuleState);
9987             /* NumberOfSubmodules */
9988             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9989                                 hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
9990
9991             proto_item_append_text(module_item, ": Slot 0x%x, Ident: 0x%x State: %s Submodules: %u",
9992                 u16SlotNr, u32ModuleIdentNumber,
9993                 val_to_str(u16ModuleState, pn_io_module_state, "(0x%x)"),
9994                 u16NumberOfSubmodules);
9995
9996
9997             if (!pinfo->fd->flags.visited) {
9998                 /* Get current conversation endpoints using MAC addresses */
9999                 conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
10000                 if (conversation == NULL) {
10001                     conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
10002                 }
10003
10004                 station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
10005                 if (station_info != NULL) {
10006                     for (frame = wmem_list_head(station_info->diff_module); frame != NULL; frame = wmem_list_frame_next(frame)) {
10007                         cmp_module_diff_info = (moduleDiffInfo*)wmem_list_frame_data(frame);
10008                         if (cmp_module_diff_info->slotNr == u16SlotNr) {
10009                             /* Found identical existing object */
10010                             break;
10011                         }
10012                     }
10013
10014                     if (frame == NULL) {
10015                         /* new diffModuleInfo data incoming */
10016                         module_diff_info = wmem_new(wmem_file_scope(), moduleDiffInfo);
10017                         module_diff_info->slotNr = u16SlotNr;
10018                         module_diff_info->modulID = u32ModuleIdentNumber;
10019                         wmem_list_append(station_info->diff_module, module_diff_info);
10020                     }
10021                 }
10022             }
10023
10024             proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
10025
10026             while (u16NumberOfSubmodules--) {
10027                 sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
10028                 sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
10029                 u32SubStart = offset;
10030
10031                 /* Subslotnumber */
10032                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10033                                     hf_pn_io_subslot_nr, &u16SubslotNr);
10034                 /* SubmoduleIdentNumber */
10035                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
10036                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
10037                 /* SubmoduleState */
10038                 submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_state, tvb, offset, 2, ENC_BIG_ENDIAN);
10039                 submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_state);
10040                 dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10041                                 hf_pn_io_submodule_state_format_indicator, &u16SubmoduleState);
10042                 if (u16SubmoduleState & 0x8000) {
10043                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10044                                     hf_pn_io_submodule_state_ident_info, &u16SubmoduleState);
10045                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10046                                     hf_pn_io_submodule_state_ar_info, &u16SubmoduleState);
10047                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10048                                     hf_pn_io_submodule_state_diag_info, &u16SubmoduleState);
10049                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10050                                     hf_pn_io_submodule_state_maintenance_demanded, &u16SubmoduleState);
10051                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10052                                     hf_pn_io_submodule_state_maintenance_required, &u16SubmoduleState);
10053                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10054                                     hf_pn_io_submodule_state_qualified_info, &u16SubmoduleState);
10055                     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10056                                     hf_pn_io_submodule_state_add_info, &u16SubmoduleState);
10057                 } else {
10058                     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
10059                                     hf_pn_io_submodule_state_detail, &u16SubmoduleState);
10060                 }
10061
10062                 proto_item_append_text(sub_item, ": Subslot 0x%x, IdentNumber: 0x%x, State: 0x%x",
10063                     u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleState);
10064
10065                 proto_item_set_len(sub_item, offset - u32SubStart);
10066             } /* NumberOfSubmodules */
10067
10068             proto_item_set_len(module_item, offset - u32ModuleStart);
10069         }
10070
10071         proto_item_set_len(api_item, offset - u32ApiStart);
10072     }
10073
10074     return offset;
10075 }
10076
10077
10078 /* dissect the IsochronousModeData block */
10079 static int
10080 dissect_IsochronousModeData_block(tvbuff_t *tvb, int offset,
10081     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10082 {
10083     guint16 u16SlotNr;
10084     guint16 u16SubslotNr;
10085     guint16 u16ControllerApplicationCycleFactor;
10086     guint16 u16TimeDataCycle;
10087     guint32 u32TimeIOInput;
10088     guint32 u32TimeIOOutput;
10089     guint32 u32TimeIOInputValid;
10090     guint32 u32TimeIOOutputValid;
10091
10092
10093     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10094         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10095             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10096         return offset;
10097     }
10098
10099     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
10100
10101     /* SlotNumber */
10102     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10103                         hf_pn_io_slot_nr, &u16SlotNr);
10104     /* Subslotnumber */
10105     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10106                         hf_pn_io_subslot_nr, &u16SubslotNr);
10107
10108     /* ControllerApplicationCycleFactor */
10109     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10110                         hf_pn_io_controller_appl_cycle_factor, &u16ControllerApplicationCycleFactor);
10111     /* TimeDataCycle */
10112     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10113                         hf_pn_io_time_data_cycle, &u16TimeDataCycle);
10114     /* TimeIOInput (ns) */
10115     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10116                         hf_pn_io_time_io_input, &u32TimeIOInput);
10117     /* TimeIOOutput (ns) */
10118     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10119                         hf_pn_io_time_io_output, &u32TimeIOOutput);
10120     /* TimeIOInputValid (ns) */
10121     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10122                         hf_pn_io_time_io_input_valid, &u32TimeIOInputValid);
10123     /* TimeIOOutputValid (ns) */
10124     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10125                         hf_pn_io_time_io_output_valid, &u32TimeIOOutputValid);
10126
10127
10128     return offset+1;
10129 }
10130
10131
10132 /* dissect the MultipleBlockHeader block */
10133 static int
10134 dissect_MultipleBlockHeader_block(tvbuff_t *tvb, int offset,
10135     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
10136     guint16 u16BodyLength)
10137 {
10138     guint32   u32Api;
10139     guint16   u16SlotNr;
10140     guint16   u16SubslotNr;
10141     tvbuff_t *new_tvb;
10142
10143
10144     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10145         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10146             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10147         return offset;
10148     }
10149
10150     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
10151
10152     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10153                     hf_pn_io_api, &u32Api);
10154     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10155                     hf_pn_io_slot_nr, &u16SlotNr);
10156     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10157                     hf_pn_io_subslot_nr, &u16SubslotNr);
10158
10159     proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x",
10160         u32Api, u16SlotNr, u16SubslotNr);
10161
10162     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength-10);
10163     offset = dissect_blocks(new_tvb, 0, pinfo, tree, drep);
10164
10165     /*offset += u16BodyLength;*/
10166
10167     return offset;
10168 }
10169
10170 /* dissect Combined Object Container Content block */
10171 static int
10172 dissect_COContainerContent_block(tvbuff_t *tvb, int offset,
10173     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
10174     guint16 u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
10175 {
10176     guint32    u32Api;
10177     guint16    u16SlotNr;
10178     guint16    u16SubslotNr;
10179
10180     if(u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10181         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10182             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10183         return offset;
10184     }
10185
10186     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
10187
10188     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
10189         hf_pn_io_api, &u32Api);
10190
10191     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10192         hf_pn_io_slot_nr, &u16SlotNr);
10193
10194     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10195         hf_pn_io_subslot_nr, &u16SubslotNr);
10196
10197     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
10198
10199     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10200         hf_pn_io_index, &u16Index);
10201
10202     proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x Index:0x%x",
10203         u32Api, u16SlotNr, u16SubslotNr, u16Index);
10204
10205     if(u16Index != 0x80B0) {
10206         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, u32RecDataLen, ar);
10207     }
10208
10209     return offset;
10210 }
10211
10212
10213 static const gchar *
10214 indexReservedForProfiles(guint16 u16Index)
10215 {
10216     /* "reserved for profiles" */
10217     if (u16Index >= 0xb000 && u16Index <= 0xbfff) {
10218         return "Reserved for Profiles (subslot specific)";
10219     }
10220     if (u16Index >= 0xd000 && u16Index <= 0xdfff) {
10221         return "Reserved for Profiles (slot specific)";
10222     }
10223     if (u16Index >= 0xec00 && u16Index <= 0xefff) {
10224         return "Reserved for Profiles (AR specific)";
10225     }
10226     if (u16Index >= 0xf400 && u16Index <= 0xf7ff) {
10227         return "Reserved for Profiles (API specific)";
10228     }
10229     if (u16Index >= 0xfc00 /* up to 0xffff */) {
10230         return "Reserved for Profiles (device specific)";
10231     }
10232
10233     return NULL;
10234 }
10235
10236
10237 /* dissect the RecordDataReadQuery block */
10238 static int
10239 dissect_RecordDataReadQuery_block(tvbuff_t *tvb, int offset,
10240     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
10241     guint16 u16Index, guint16 u16BodyLength)
10242 {
10243     const gchar *userProfile;
10244
10245
10246     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10247         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10248             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10249         return offset;
10250     }
10251
10252     /* user specified format? */
10253     if (u16Index < 0x8000) {
10254         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, "User Specified Data");
10255         return offset;
10256     }
10257
10258     /* "reserved for profiles"? */
10259     userProfile = indexReservedForProfiles(u16Index);
10260     if (userProfile != NULL) {
10261         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, userProfile);
10262         return offset;
10263     }
10264
10265     return dissect_pn_undecoded(tvb, offset, pinfo, tree, u16BodyLength);
10266 }
10267
10268 /* dissect the RS_GetEvent block */
10269 static int
10270 dissect_RS_GetEvent_block(tvbuff_t *tvb, int offset,
10271     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
10272     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10273 {
10274     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10275         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10276             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10277         return offset;
10278     }
10279     offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep);
10280     return offset;
10281 }
10282
10283 /* dissect the RS_AdjustControl */
10284 static int
10285 dissect_RS_AdjustControl(tvbuff_t *tvb, int offset,
10286     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep,
10287     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
10288 {
10289     guint16 u16ChannelNumber;
10290     guint16 u16SoEMaxScanDelay;
10291     proto_item *sub_item;
10292     proto_tree *sub_tree;
10293     guint8 u8SoEAdjustSpecifierReserved;
10294     guint8 u8SoEAdjustSpecifierIndicent;
10295
10296     switch (*u16RSBlockType) {
10297     case(0xc010): /* SoE_DigitalInputObserver */
10298
10299         /* ChannelNumber */
10300         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10301             hf_pn_io_channel_number, &u16ChannelNumber);
10302
10303         /* SoE_MaxScanDelay */
10304         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10305             hf_pn_io_soe_max_scan_delay, &u16SoEMaxScanDelay);
10306
10307         /* SoE_AdjustSpecifier */
10308         sub_item = proto_tree_add_item(tree, hf_pn_io_soe_adjust_specifier, tvb, offset, 1, ENC_BIG_ENDIAN);
10309         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_adjust_specifier);
10310
10311         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10312             hf_pn_io_soe_adjust_specifier_reserved, &u8SoEAdjustSpecifierReserved);
10313
10314         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10315             hf_pn_io_soe_adjust_specifier_incident, &u8SoEAdjustSpecifierIndicent);
10316
10317         /* Padding 2 + 2 + 1 = 5 */
10318         /* Therefore we need 3 byte padding to make the block u32 aligned */
10319         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 3);
10320         break;
10321         default:
10322         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u16RSBodyLength, "UserData");
10323         break;
10324     }
10325     return offset;
10326 }
10327
10328 /* dissect the RS_AdjustBlock */
10329 static int
10330 dissect_RS_AdjustBlock(tvbuff_t *tvb, int offset,
10331     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
10332 {
10333     proto_item *sub_item;
10334     proto_tree *sub_tree;
10335
10336     guint16 u16RSBodyLength;
10337     guint16 u16RSBlockType;
10338
10339     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_block, tvb, offset, 0, ENC_NA);
10340     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_block);
10341
10342     /* RS_BlockHeader */
10343     offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep,
10344         &u16RSBodyLength, &u16RSBlockType);
10345
10346     /* RS_AdjustControl */
10347     offset = dissect_RS_AdjustControl(tvb, offset, pinfo, sub_tree, drep,
10348         &u16RSBodyLength, &u16RSBlockType);
10349
10350     return offset;
10351 }
10352
10353 /* dissect the RS_AdjustInfo */
10354 static int
10355 dissect_RS_AdjustInfo(tvbuff_t *tvb, int offset,
10356     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
10357 {
10358     proto_item *sub_item;
10359     proto_tree *sub_tree;
10360     guint16    u16NumberofEntries;
10361
10362     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_info, tvb, offset, 0, ENC_NA);
10363     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_info);
10364
10365     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10366         hf_pn_io_number_of_rs_event_info, &u16NumberofEntries);
10367
10368     while (u16NumberofEntries > 0) {
10369         u16NumberofEntries--;
10370         offset = dissect_RS_AdjustBlock(tvb, offset, pinfo, sub_tree, drep);
10371     }
10372     return offset;
10373 }
10374
10375 /* dissect the RS_AdjustObserver block */
10376 static int
10377 dissect_RS_AdjustObserver_block(tvbuff_t *tvb, int offset,
10378     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
10379     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10380 {
10381     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10382         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10383             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10384         return offset;
10385     }
10386     offset = dissect_RS_AdjustInfo(tvb, offset, pinfo, tree, drep);
10387     return offset;
10388 }
10389
10390 static int
10391 dissect_RS_AckInfo(tvbuff_t *tvb, int offset,
10392     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
10393 {
10394     guint16 u16RSSpecifierSequenceNumber;
10395
10396     /* RS_Specifier.SequenceNumber */
10397     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10398         hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber);
10399
10400     return offset;
10401 }
10402
10403 /* dissect the RS_AckEvent block */
10404 static int
10405 dissect_RS_AckEvent_block(tvbuff_t *tvb, int offset,
10406     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
10407     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10408 {
10409     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10410         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10411             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10412         return offset;
10413     }
10414     offset = dissect_RS_AckInfo(tvb, offset, pinfo, tree, drep);
10415     return offset;
10416 }
10417
10418 /* dissect one PN-IO block (depending on the block type) */
10419 static int
10420 dissect_block(tvbuff_t *tvb, int offset,
10421     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
10422 {
10423     guint16     u16BlockType;
10424     guint16     u16BlockLength;
10425     guint8      u8BlockVersionHigh;
10426     guint8      u8BlockVersionLow;
10427     proto_item *sub_item;
10428     proto_tree *sub_tree;
10429     guint32     u32SubStart;
10430     guint16     u16BodyLength;
10431     proto_item *header_item;
10432     proto_tree *header_tree;
10433     gint        remainingBytes;
10434
10435     /* from here, we only have big endian (network byte ordering)!!! */
10436     drep[0] &= ~DREP_LITTLE_ENDIAN;
10437
10438     sub_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10439     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_block);
10440     u32SubStart = offset;
10441
10442     header_item = proto_tree_add_item(sub_tree, hf_pn_io_block_header, tvb, offset, 6, ENC_NA);
10443     header_tree = proto_item_add_subtree(header_item, ett_pn_io_block_header);
10444
10445     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep,
10446                         hf_pn_io_block_type, &u16BlockType);
10447     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep,
10448                         hf_pn_io_block_length, &u16BlockLength);
10449     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep,
10450                         hf_pn_io_block_version_high, &u8BlockVersionHigh);
10451     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep,
10452                         hf_pn_io_block_version_low, &u8BlockVersionLow);
10453
10454     proto_item_append_text(header_item, ": Type=%s, Length=%u(+4), Version=%u.%u",
10455         val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)"),
10456         u16BlockLength, u8BlockVersionHigh, u8BlockVersionLow);
10457
10458     proto_item_set_text(sub_item, "%s",
10459         val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)"));
10460
10461     col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
10462         val_to_str(u16BlockType, pn_io_block_type, "Unknown"));
10463
10464     /* block length is without type and length fields, but with version field */
10465     /* as it's already dissected, remove it */
10466     u16BodyLength = u16BlockLength - 2;
10467     remainingBytes = tvb_reported_length_remaining(tvb, offset);
10468     if (remainingBytes < 0)
10469         remainingBytes = 0;
10470     if (remainingBytes +2 < u16BodyLength)
10471     {
10472         proto_item_append_text(sub_item, " Block_Length: %d greater than remaining Bytes, trying with Blocklen = remaining (%d)", u16BodyLength, remainingBytes);
10473         u16BodyLength = remainingBytes;
10474     }
10475     switch (u16BlockType) {
10476     case(0x0001):
10477     case(0x0002):
10478         dissect_AlarmNotification_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10479             u16BodyLength);
10480         break;
10481     case(0x0008):
10482         dissect_IODWriteReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10483             u16Index, u32RecDataLen, ar);
10484         break;
10485     case(0x0009):
10486         dissect_IODReadReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10487             u16Index, u32RecDataLen, ar);
10488         break;
10489     case(0x0010):
10490         dissect_DiagnosisData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10491             u16BodyLength);
10492         break;
10493     case(0x0012):   /* ExpectedIdentificationData */
10494     case(0x0013):   /* RealIdentificationData */
10495         dissect_IdentificationData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10496         break;
10497     case(0x0014):
10498         dissect_SubstituteValue_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10499             u16BodyLength);
10500         break;
10501     case(0x0015):
10502         dissect_RecordInputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10503         break;
10504     case(0x0016):
10505         dissect_RecordOutputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10506         break;
10507     /*   0x0017 reserved */
10508     case(0x0018):
10509         dissect_ARData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10510         break;
10511     case(0x0019):
10512         dissect_LogData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10513         break;
10514     case(0x001A):
10515         dissect_APIData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10516         break;
10517     case(0x001B):
10518         dissect_SRLData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10519         break;
10520     case(0x0020):
10521         dissect_IandM0_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10522         break;
10523     case(0x0021):
10524         dissect_IandM1_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10525         break;
10526     case(0x0022):
10527         dissect_IandM2_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10528         break;
10529     case(0x0023):
10530         dissect_IandM3_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10531         break;
10532     case(0x0024):
10533         dissect_IandM4_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10534         break;
10535     case(0x0025):
10536         dissect_IandM5_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh,u8BlockVersionLow);
10537         break;
10538     case(0x0030):
10539         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10540         break;
10541     case(0x0031):
10542         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10543         break;
10544     case(0x0032):
10545         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10546         break;
10547     case(0x0034):
10548         dissect_IandM5Data_block(tvb, offset, pinfo, sub_tree, sub_item, drep);
10549         break;
10550     case(0x0035):
10551         dissect_AssetManagementData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10552         break;
10553     case(0x0036):
10554         dissect_AM_FullInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10555         break;
10556     case(0x0037):
10557         dissect_AM_HardwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10558         break;
10559     case(0x0038):
10560         dissect_AM_FirmwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10561         break;
10562     case(0x0101):
10563         dissect_ARBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10564             ar);
10565         break;
10566     case(0x0102):
10567         dissect_IOCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10568             *ar);
10569         break;
10570     case(0x0103):
10571         dissect_AlarmCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10572             *ar);
10573         break;
10574     case(0x0104):
10575         dissect_ExpectedSubmoduleBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10576         break;
10577     case(0x0106):
10578         dissect_MCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10579         break;
10580     case(0x0107):
10581         dissect_SubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10582         break;
10583     case(0x0108):
10584     case(0x8108):
10585         dissect_ARVendorBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10586         break;
10587     case(0x0109):
10588         dissect_IRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10589         break;
10590     case(0x010A):
10591         dissect_SRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10592         break;
10593     case(0x010C):
10594         dissect_RSInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10595         break;
10596     case(0x0110):
10597     case(0x0111):
10598     case(0x0112):
10599     case(0x0113):
10600     case(0x0114):
10601     case(0x0116):
10602     case(0x0117):
10603         dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar);
10604         break;
10605
10606     case(0x0118):
10607         dissect_ControlBlockPrmBegin(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar);
10608         break;
10609
10610     case(0x0119):
10611         dissect_SubmoduleListBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar);
10612         break;
10613
10614     case(0x0200): /* PDPortDataCheck */
10615         dissect_PDPortData_Check_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10616             u16BodyLength);
10617         break;
10618     case(0x0201):
10619         dissect_PDevData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10620         break;
10621     case(0x0202): /*dissect_PDPortData_Adjust_block */
10622         dissect_PDPortData_Adjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10623             u16BodyLength);
10624         break;
10625     case(0x0203):
10626         dissect_PDSyncData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10627         break;
10628     case(0x0204):
10629         dissect_IsochronousModeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10630         break;
10631     case(0x0205):
10632         dissect_PDIRData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10633         break;
10634     case(0x0206):
10635         dissect_PDIRGlobalData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10636         break;
10637     case(0x0207):
10638         dissect_PDIRFrameData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10639             u16BodyLength);
10640         break;
10641     case(0x0208):
10642         dissect_PDIRBeginEndData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10643             u16BodyLength);
10644         break;
10645     case(0x0209):
10646         dissect_AdjustDomainBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10647         break;
10648     case(0x020A):
10649         dissect_CheckPeers_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10650         break;
10651     case(0x020B):
10652         dissect_CheckLineDelay_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10653         break;
10654     case(0x020C):
10655         dissect_CheckMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10656         break;
10657     case(0x020E):
10658         dissect_AdjustMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10659         break;
10660     case(0x020F):
10661         dissect_PDPortDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10662         break;
10663     case(0x0210):
10664         dissect_AdjustMulticastBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10665         break;
10666     case(0x0211):
10667         dissect_PDInterfaceMrpDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10668         break;
10669     case(0x0212):
10670         dissect_PDInterfaceMrpDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10671         break;
10672     case(0x0213):
10673         dissect_PDInterfaceMrpDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10674         break;
10675     case(0x0214):
10676     case(0x0215):
10677         dissect_PDPortMrpData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10678         break;
10679     case(0x0216):
10680         dissect_MrpManagerParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10681         break;
10682     case(0x0217):
10683         dissect_MrpClientParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10684         break;
10685     case(0x0218):
10686         dissect_MrpRTModeManagerData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10687         break;
10688     case(0x0219):
10689         dissect_MrpRingStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10690         break;
10691     case(0x021A):
10692         dissect_MrpRTStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10693         break;
10694     case(0x021B):
10695         dissect_AdjustPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10696         break;
10697     case(0x021C):
10698         dissect_CheckPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10699         break;
10700     case(0x021D):
10701         dissect_MrpRTModeClientData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10702         break;
10703     case(0x021E):
10704         dissect_CheckSyncDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10705         break;
10706     case(0x021F):
10707         dissect_CheckMAUTypeDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10708         break;
10709     case(0x0220):
10710         dissect_PDPortFODataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10711         break;
10712     case(0x0221):
10713         dissect_FiberOpticManufacturerSpecific_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10714         break;
10715     case(0x0222):
10716         dissect_PDPortFODataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10717         break;
10718     case(0x0223):
10719         dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10720         break;
10721     case(0x0224):
10722         dissect_AdjustPeerToPeerBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10723         break;
10724     case(0x0225):
10725         dissect_AdjustDCPBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10726         break;
10727     case(0x0226):
10728         dissect_AdjustPreambleLength_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10729         break;
10730     case(0x0227):
10731         dissect_CheckMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10732         break;
10733     case(0x0228):
10734         dissect_FiberOpticDiagnosisInfo_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10735         break;
10736     case(0x0229):
10737         dissect_AdjustMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10738         break;
10739     case(0x022A):
10740         dissect_PDIRSubframeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10741         break;
10742     case(0x022B):
10743         dissect_PDSubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10744         break;
10745
10746     case(0x0230):
10747         dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10748         break;
10749     case(0x0231):
10750         dissect_MrpInstanceDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10751             break;
10752     case(0x0232):
10753         dissect_MrpInstanceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10754             break;
10755     case(0x0233):
10756         dissect_MrpInstanceDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10757             break;
10758
10759     case(0x0240):
10760         dissect_PDInterfaceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10761         break;
10762     case(0x0250):
10763         dissect_PDInterfaceAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10764         break;
10765     case(0x0251):
10766         dissect_PDPortStatistic_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10767         break;
10768     case(0x0400):
10769         dissect_MultipleBlockHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10770         break;
10771     case(0x0401):
10772         dissect_COContainerContent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u32RecDataLen, ar);
10773         break;
10774     case(0x0500):
10775         dissect_RecordDataReadQuery_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u16BodyLength);
10776         break;
10777     case(0x0600):
10778         dissect_FSHello_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10779         break;
10780     case(0x0601):
10781         dissect_FSParameter_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10782         break;
10783     case(0x0608):
10784         dissect_PDInterfaceFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10785         break;
10786     case(0x010B):
10787     case(0x0609):
10788         dissect_ARFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10789         break;
10790     case(0x0900):
10791         dissect_RS_AdjustObserver_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10792         break;
10793     case(0x0901):
10794         dissect_RS_GetEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10795         break;
10796     case(0x0902):
10797         dissect_RS_AckEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10798         break;
10799     case(0x0f00) :
10800         dissect_Maintenance_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10801         break;
10802     case(0x8001):
10803     case(0x8002):
10804         dissect_Alarm_ack_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10805         break;
10806     case(0x8008):
10807         dissect_IODWriteResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10808             u16Index, u32RecDataLen, ar);
10809         break;
10810     case(0x8009):
10811         dissect_IODReadResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10812             u16Index, u32RecDataLen, ar);
10813         break;
10814     case(0x8101):
10815         dissect_ARBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar);
10816         break;
10817     case(0x8102):
10818         dissect_IOCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar);
10819         break;
10820     case(0x8103):
10821         dissect_AlarmCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar);
10822         break;
10823     case(0x8104):
10824         dissect_ModuleDiffBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10825         break;
10826     case(0x8106):
10827         dissect_ARServerBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10828         break;
10829     case(0x8110):
10830     case(0x8111):
10831     case(0x8112):
10832     case(0x8113):
10833     case(0x8114):
10834     case(0x8116):
10835     case(0x8117):
10836     case(0x8118):
10837         dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar);
10838         break;
10839     default:
10840         dissect_pn_undecoded(tvb, offset, pinfo, sub_tree, u16BodyLength);
10841     }
10842     offset += u16BodyLength;
10843
10844     proto_item_set_len(sub_item, offset - u32SubStart);
10845
10846     return offset;
10847 }
10848
10849
10850 /* dissect any PN-IO block */
10851 static int
10852 dissect_a_block(tvbuff_t *tvb, int offset,
10853     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10854 {
10855     guint16    u16Index = 0;
10856     guint32    u32RecDataLen;
10857     pnio_ar_t *ar       = NULL;
10858
10859     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
10860
10861     if (ar != NULL) {
10862         pnio_ar_info(tvb, pinfo, tree, ar);
10863     }
10864
10865     return offset;
10866 }
10867
10868 /* dissect any number of PN-IO blocks */
10869 static int
10870 dissect_blocks(tvbuff_t *tvb, int offset,
10871     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10872 {
10873     guint16    u16Index = 0;
10874     guint32    u32RecDataLen;
10875     pnio_ar_t *ar       = NULL;
10876
10877
10878     while (tvb_captured_length(tvb) > (guint) offset) {
10879         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
10880         u16Index++;
10881     }
10882
10883     if (ar != NULL) {
10884         pnio_ar_info(tvb, pinfo, tree, ar);
10885     }
10886
10887     return offset;
10888 }
10889
10890
10891 /* dissect a PN-IO (DCE-RPC) request header */
10892 static int
10893 dissect_IPNIO_rqst_header(tvbuff_t *tvb, int offset,
10894     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10895 {
10896     guint32     u32ArgsMax;
10897     guint32     u32ArgsLen;
10898     guint32     u32MaxCount;
10899     guint32     u32Offset;
10900     guint32     u32ArraySize;
10901
10902     proto_item *sub_item;
10903     proto_tree *sub_tree;
10904     guint32     u32SubStart;
10905
10906
10907     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM");
10908
10909     /* args_max */
10910     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10911                         hf_pn_io_args_max, &u32ArgsMax);
10912     /* args_len */
10913     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10914                         hf_pn_io_args_len, &u32ArgsLen);
10915
10916     sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA);
10917     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io);
10918     u32SubStart = offset;
10919
10920     /* RPC array header */
10921     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10922                         hf_pn_io_array_max_count, &u32MaxCount);
10923     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10924                         hf_pn_io_array_offset, &u32Offset);
10925     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10926                         hf_pn_io_array_act_count, &u32ArraySize);
10927
10928     proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u",
10929         u32MaxCount, u32Offset, u32ArraySize);
10930     proto_item_set_len(sub_item, offset - u32SubStart);
10931
10932     return offset;
10933 }
10934
10935
10936 /* dissect a PN-IO (DCE-RPC) response header */
10937 static int
10938 dissect_IPNIO_resp_header(tvbuff_t *tvb, int offset,
10939     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10940 {
10941     guint32     u32ArgsLen;
10942     guint32     u32MaxCount;
10943     guint32     u32Offset;
10944     guint32     u32ArraySize;
10945
10946     proto_item *sub_item;
10947     proto_tree *sub_tree;
10948     guint32     u32SubStart;
10949
10950
10951     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM");
10952
10953     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
10954
10955     /* args_len */
10956     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10957                         hf_pn_io_args_len, &u32ArgsLen);
10958
10959     sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA);
10960     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io);
10961     u32SubStart = offset;
10962
10963     /* RPC array header */
10964     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10965                         hf_pn_io_array_max_count, &u32MaxCount);
10966     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10967                         hf_pn_io_array_offset, &u32Offset);
10968     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10969                         hf_pn_io_array_act_count, &u32ArraySize);
10970
10971     proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u",
10972         u32MaxCount, u32Offset, u32ArraySize);
10973     proto_item_set_len(sub_item, offset - u32SubStart);
10974
10975     return offset;
10976 }
10977
10978
10979 /* dissect a PN-IO request */
10980 static int
10981 dissect_IPNIO_rqst(tvbuff_t *tvb, int offset,
10982     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10983 {
10984
10985     offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep);
10986
10987     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
10988
10989     return offset;
10990 }
10991
10992
10993 /* dissect a PN-IO response */
10994 static int
10995 dissect_IPNIO_resp(tvbuff_t *tvb, int offset,
10996     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10997 {
10998
10999     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
11000
11001     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
11002
11003     return offset;
11004 }
11005
11006 /* dissect a PROFIDrive parameter request */
11007 static int
11008 dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset,
11009     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11010 {
11011     guint8      request_reference;
11012     guint8      request_id;
11013     guint8      do_id;
11014     guint8      no_of_parameters;
11015     guint8      addr_idx;
11016     proto_item *profidrive_item;
11017     proto_tree *profidrive_tree;
11018
11019     profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11020     profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_request);
11021     proto_item_set_text(profidrive_item, "PROFIDrive Parameter Request: ");
11022
11023     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11024                         hf_pn_io_profidrive_request_reference, &request_reference);
11025     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11026                         hf_pn_io_profidrive_request_id, &request_id);
11027     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11028                         hf_pn_io_profidrive_do_id, &do_id);
11029     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11030                         hf_pn_io_profidrive_no_of_parameters, &no_of_parameters);
11031
11032     proto_item_append_text(profidrive_item, "ReqRef:0x%02x, ReqId:%s, DO:%u, NoOfParameters:%u",
11033         request_reference, val_to_str(request_id, pn_io_profidrive_request_id_vals, "Unknown"),
11034         do_id, no_of_parameters);
11035
11036     col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Write Request, ReqRef:0x%02x, %s DO:%u",
11037             request_reference,
11038             request_id==0x01 ? "Read" :
11039             request_id==0x02 ? "Change" :
11040                                "",
11041             do_id);
11042
11043     /* Parameter address list */
11044     for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
11045         guint8 attribute;
11046         guint8 no_of_elems;
11047         guint16 parameter;
11048         guint16 idx;
11049         proto_item *sub_item;
11050         proto_tree *sub_tree;
11051
11052         sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11053         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_address);
11054         proto_item_set_text(sub_item, "Parameter Address %u: ", addr_idx+1);
11055
11056         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11057                             hf_pn_io_profidrive_param_attribute, &attribute);
11058         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11059                             hf_pn_io_profidrive_param_no_of_elems, &no_of_elems);
11060         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
11061                             hf_pn_io_profidrive_param_number, &parameter);
11062         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
11063                             hf_pn_io_profidrive_param_subindex, &idx);
11064
11065         proto_item_append_text(sub_item, "Attr:%s, Elems:%u, Parameter:%u, Index:%u",
11066             val_to_str(attribute, pn_io_profidrive_attribute_vals, "Unknown"), no_of_elems,
11067             parameter, idx);
11068
11069             if (no_of_elems>1) {
11070                 col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d..%d]", parameter, idx, idx+no_of_elems-1);
11071             }
11072             else {
11073                 col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d]", parameter, idx);
11074             }
11075         }
11076
11077     /* in case of change request parameter value list */
11078     if (request_id == 0x02) {
11079         for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
11080             guint8 format;
11081             guint8 no_of_vals;
11082             proto_item *sub_item;
11083             proto_tree *sub_tree;
11084
11085             sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11086             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value);
11087             proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1);
11088
11089             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11090                                 hf_pn_io_profidrive_param_format, &format);
11091             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11092                                 hf_pn_io_profidrive_param_no_of_values, &no_of_vals);
11093
11094             proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u",
11095                 val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals);
11096
11097             while (no_of_vals--)
11098             {
11099                 offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format);
11100             }
11101         }
11102     }
11103
11104     return offset;
11105 }
11106
11107 static int
11108 dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset,
11109     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11110 {
11111     guint8      request_reference;
11112     guint8      response_id;
11113     guint8      do_id;
11114     guint8      no_of_parameters;
11115     proto_item *profidrive_item;
11116     proto_tree *profidrive_tree;
11117
11118     profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11119     profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_response);
11120     proto_item_set_text(profidrive_item, "PROFIDrive Parameter Response: ");
11121
11122     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11123                         hf_pn_io_profidrive_request_reference, &request_reference);
11124     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11125                         hf_pn_io_profidrive_response_id, &response_id);
11126     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11127                         hf_pn_io_profidrive_do_id, &do_id);
11128     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
11129                         hf_pn_io_profidrive_no_of_parameters, &no_of_parameters);
11130
11131     proto_item_append_text(profidrive_item, "ReqRef:0x%02x, RspId:%s, DO:%u, NoOfParameters:%u",
11132         request_reference, val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown"),
11133         do_id, no_of_parameters);
11134
11135     col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Read Response, ReqRef:0x%02x, RspId:%s",
11136                            request_reference,
11137                            val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown response"));
11138     return offset;
11139 }
11140
11141 static int
11142 dissect_RecordDataRead(tvbuff_t *tvb, int offset,
11143     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen)
11144 {
11145     const gchar *userProfile;
11146     pnio_ar_t   *ar = NULL;
11147
11148
11149     /* user specified format? */
11150     if (u16Index < 0x8000) {
11151         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data");
11152         return offset;
11153     }
11154
11155     /* profidrive parameter access response */
11156     if (u16Index == 0xb02e || u16Index == 0xb02f) {
11157         return dissect_ProfiDriveParameterResponse(tvb, offset, pinfo, tree, drep);
11158     }
11159
11160     /* "reserved for profiles"? */
11161     userProfile = indexReservedForProfiles(u16Index);
11162     if (userProfile != NULL) {
11163         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile);
11164         return offset;
11165     }
11166
11167     /* see: pn_io_index */
11168     /* single block only */
11169     switch (u16Index) {
11170     case(0x8010):   /* Maintenance required in channel coding for one subslot */
11171     case(0x8011):   /* Maintenance demanded in channel coding for one subslot */
11172     case(0x8012):   /* Maintenance required in all codings for one subslot */
11173     case(0x8013):   /* Maintenance demanded in all codings for one subslot */
11174     case(0x801e):   /* SubstituteValues for one subslot */
11175     case(0x8028):   /* RecordInputDataObjectElement for one subslot */
11176     case(0x8029):   /* RecordOutputDataObjectElement for one subslot */
11177     case(0x8050):   /* PDInterfaceMrpDataReal for one subslot */
11178     case(0x8051):   /* PDInterfaceMrpDataCheck for one subslot */
11179     case(0x8052):   /* PDInterfaceMrpDataAdjust for one subslot */
11180     case(0x8053):   /* PDPortMrpDataAdjust for one subslot */
11181     case(0x8054):   /* PDPortMrpDataReal for one subslot */
11182     case(0x8060):   /* PDPortFODataReal for one subslot */
11183     case(0x8061):   /* PDPortFODataCheck for one subslot */
11184     case(0x8062):   /* PDPortFODataAdjust for one subslot */
11185     case(0x8070):   /* PDNCDataCheck for one subslot */
11186     case(0x8071):   /* PDPortStatistic for one subslot */
11187     case(0x8080):   /* PDInterfaceDataReal */
11188     case(0x8090):   /* PDInterfaceFSUDataAdjust */
11189     case(0x80CF):   /* RS_AdjustObserver */
11190
11191     case(0xaff0):   /* I&M0 */
11192     case(0xaff1):   /* I&M1 */
11193     case(0xaff2):   /* I&M2 */
11194     case(0xaff3):   /* I&M3 */
11195     case(0xaff4):   /* I&M4 */
11196     case(0xaff5):   /* I&M5 */
11197     case(0xaff6):   /* I&M6 */
11198     case(0xaff7):   /* I&M7 */
11199     case(0xaff8):   /* I&M8 */
11200     case(0xaff9):   /* I&M9 */
11201     case(0xaffa):   /* I&M10 */
11202     case(0xaffb):   /* I&M11 */
11203     case(0xaffc):   /* I&M12 */
11204     case(0xaffd):   /* I&M13 */
11205     case(0xaffe):   /* I&M14 */
11206     case(0xafff):   /* I&M15 */
11207
11208     case(0xc010):   /* Maintenance required in channel coding for one slot */
11209     case(0xc011):   /* Maintenance demanded in channel coding for one slot */
11210     case(0xc012):   /* Maintenance required in all codings for one slot */
11211     case(0xc013):   /* Maintenance demanded in all codings for one slot */
11212
11213     case(0xe002):   /* ModuleDiffBlock for one AR */
11214     case(0xe010):   /* Maintenance required in channel coding for one AR */
11215     case(0xe011):   /* Maintenance demanded in channel coding for one AR */
11216     case(0xe012):   /* Maintenance required in all codings for one AR */
11217     case(0xe013):   /* Maintenance demanded in all codings for one AR */
11218
11219     case(0xf010):   /* Maintenance required in channel coding for one API */
11220     case(0xf011):   /* Maintenance demanded in channel coding for one API */
11221     case(0xf012):   /* Maintenance required in all codings for one API */
11222     case(0xf013):   /* Maintenance demanded in all codings for one API */
11223     case(0xf020):   /* ARData for one API */
11224
11225     case(0xf820):   /* ARData */
11226     case(0xf821):   /* APIData */
11227     case(0xf830):   /* LogData */
11228     case(0xf831):   /* PDevData */
11229     case(0xf880) : /* AssetManagementData */
11230         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11231         break;
11232
11233     case(0xf840):   /* I&M0FilterData */
11234         {
11235             int end_offset = offset + u32RecDataLen;
11236         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11237             if (end_offset > offset)
11238                 offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11239             if (end_offset > offset)
11240                 offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11241         }
11242         break;
11243
11244     case(0xB050):
11245     case(0xB051):
11246     case(0xB060):
11247     case(0xB061):
11248
11249        offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11250         break;
11251
11252
11253     /*** multiple blocks possible ***/
11254     case(0x8000):   /* ExpectedIdentificationData for one subslot */
11255     case(0x8001):   /* RealIdentificationData for one subslot */
11256     case(0x800a):   /* Diagnosis in channel decoding for one subslot */
11257     case(0x800b):   /* Diagnosis in all codings for one subslot */
11258     case(0x800c):   /* Diagnosis, Maintenance, Qualified and Status for one subslot */
11259
11260     case(0x802a):   /* PDPortDataReal */
11261     case(0x802b):   /* PDPortDataCheck */
11262     case(0x802d):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */
11263     case(0x802e):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */
11264     case(0x802f):   /* PDPortDataAdjust */
11265     case(0x8030):   /* IsochronousModeData for one subslot */
11266     case(0x8031):   /* Expected PDSyncData for one subslot with SyncID value 1 */
11267     case(0x8032):
11268     case(0x8033):
11269     case(0x8034):
11270     case(0x8035):
11271     case(0x8036):
11272     case(0x8037):
11273     case(0x8038):
11274     case(0x8039):
11275     case(0x803a):
11276     case(0x803b):
11277     case(0x803c):
11278     case(0x803d):
11279     case(0x803e):
11280     case(0x803f):
11281     case(0x8040):   /* Expected PDSyncData for one subslot with SyncID value 2 ... 30 */
11282     case(0x8041):
11283     case(0x8042):
11284     case(0x8043):
11285     case(0x8044):
11286     case(0x8045):
11287     case(0x8046):
11288     case(0x8047):
11289     case(0x8048):
11290     case(0x8049):
11291     case(0x804a):
11292     case(0x804b):
11293     case(0x804c):
11294     case(0x804d):
11295     case(0x804e):
11296     case(0x804f):   /* Expected PDSyncData for one subslot with SyncID value 31 */
11297     case(0x8072):    /* PDPortStatistic for one subslot */
11298     case(0xc000):   /* ExpectedIdentificationData for one slot */
11299     case(0xc001):   /* RealIdentificationData for one slot */
11300     case(0xc00a):   /* Diagnosis in channel coding for one slot */
11301     case(0xc00b):   /* Diagnosis in all codings for one slot */
11302     case(0xc00c):   /* Diagnosis, Maintenance, Qualified and Status for one slot */
11303
11304     case(0xe000):   /* ExpectedIdentificationData for one AR */
11305     case(0xe001):   /* RealIdentificationData for one AR */
11306     case(0xe00a):   /* Diagnosis in channel decoding for one AR */
11307     case(0xe00b):   /* Diagnosis in all codings for one AR */
11308     case(0xe00c):   /* Diagnosis, Maintenance, Qualified and Status for one AR */
11309     case(0xe030):   /* IsochronousModeData for one AR */
11310     case(0xE060):   /* RS_GetEvent (using RecordDataRead service) */
11311     case(0xf000):   /* RealIdentificationData for one API */
11312     case(0xf00a):   /* Diagnosis in channel decoding for one API */
11313     case(0xf00b):   /* Diagnosis in all codings for one API */
11314     case(0xf00c):   /* Diagnosis, Maintenance, Qualified and Status for one API */
11315     case(0xf80c):   /* Diagnosis, Maintenance, Qualified and Status for one device */
11316     case(0xf841):   /* PDRealData */
11317     case(0xf842):   /* PDExpectedData */
11318         offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
11319         break;
11320     default:
11321         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen);
11322     }
11323
11324     return offset;
11325 }
11326
11327
11328 /* dissect a PN-IO read response */
11329 static int
11330 dissect_IPNIO_Read_resp(tvbuff_t *tvb, int offset,
11331     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11332 {
11333     guint16    u16Index      = 0;
11334     guint32    u32RecDataLen = 0;
11335     pnio_ar_t *ar            = NULL;
11336
11337     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
11338
11339     /* IODReadHeader */
11340     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11341
11342     /* RecordDataRead */
11343     if (u32RecDataLen != 0) {
11344         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11345     }
11346
11347     if (ar != NULL) {
11348         pnio_ar_info(tvb, pinfo, tree, ar);
11349     }
11350
11351     return offset;
11352 }
11353
11354 /* F-Parameter record data object */
11355 static int
11356 dissect_ProfiSafeParameterRequest(tvbuff_t *tvb, int offset,
11357     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, wmem_list_frame_t *frame)
11358 {
11359     proto_item *f_item;
11360     proto_tree *f_tree;
11361     proto_item *flags1_item;
11362     proto_tree *flags1_tree;
11363     proto_item *flags2_item;
11364     proto_tree *flags2_tree;
11365     guint16     src_addr;
11366     guint16     dst_addr;
11367     guint16     wd_time;
11368     guint16     par_crc;
11369     guint32     ipar_crc = 0;
11370     guint8      prm_flag1;
11371     guint8      prm_flag1_chck_seq;
11372     guint8      prm_flag1_chck_ipar;
11373     guint8      prm_flag1_sil;
11374     guint8      prm_flag1_crc_len;
11375     guint8      prm_flag1_crc_seed;
11376     guint8      prm_flag1_reserved;
11377     guint8      prm_flag2;
11378     guint8      prm_flag2_reserved;
11379     guint8      prm_flag2_f_block_id;
11380     guint8      prm_flag2_f_par_version;
11381
11382     conversation_t    *conversation;
11383     stationInfo       *station_info;
11384     ioDataObject      *io_data_object;
11385     wmem_list_frame_t *frame_out;
11386
11387     f_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11388     f_tree = proto_item_add_subtree(f_item, ett_pn_io_profisafe_f_parameter);
11389     proto_item_set_text(f_item, "F-Parameter: ");
11390
11391     flags1_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag1, tvb, offset, 1, ENC_BIG_ENDIAN);
11392     flags1_tree = proto_item_add_subtree(flags1_item, ett_pn_io_profisafe_f_parameter_prm_flag1);
11393
11394     /* dissection of F_Prm_Flag1 */
11395     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11396         hf_pn_io_ps_f_prm_flag1_chck_seq, &prm_flag1_chck_seq);
11397     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11398         hf_pn_io_ps_f_prm_flag1_chck_ipar, &prm_flag1_chck_ipar);
11399     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11400         hf_pn_io_ps_f_prm_flag1_sil, &prm_flag1_sil);
11401     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11402         hf_pn_io_ps_f_prm_flag1_crc_len, &prm_flag1_crc_len);
11403     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11404         hf_pn_io_ps_f_prm_flag1_crc_seed, &prm_flag1_crc_seed);
11405     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11406         hf_pn_io_ps_f_prm_flag1_reserved, &prm_flag1_reserved);
11407     prm_flag1 = prm_flag1_chck_seq|prm_flag1_chck_ipar|prm_flag1_sil|prm_flag1_crc_len|prm_flag1_crc_seed|prm_flag1_reserved;
11408     offset++;
11409
11410     flags2_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag2, tvb, offset, 1, ENC_BIG_ENDIAN);
11411     flags2_tree = proto_item_add_subtree(flags2_item, ett_pn_io_profisafe_f_parameter_prm_flag2);
11412
11413     /* dissection of F_Prm_Flag2 */
11414     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11415         hf_pn_io_ps_f_prm_flag2_reserved, &prm_flag2_reserved);
11416     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11417         hf_pn_io_ps_f_prm_flag2_f_block_id, &prm_flag2_f_block_id);
11418     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11419         hf_pn_io_ps_f_prm_flag2_f_par_version, &prm_flag2_f_par_version);
11420     prm_flag2 = prm_flag2_reserved|prm_flag2_f_block_id|prm_flag2_f_par_version;
11421     offset++;
11422
11423     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11424                     hf_pn_io_ps_f_src_adr, &src_addr);
11425     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11426                     hf_pn_io_ps_f_dest_adr, &dst_addr);
11427     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11428                     hf_pn_io_ps_f_wd_time, &wd_time);
11429
11430     /* Dissection for F_iPar_CRC: see F_Prm_Flag2 -> F_Block_ID */
11431     if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) {
11432         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, f_item, drep,
11433                         hf_pn_io_ps_f_ipar_crc, &ipar_crc);
11434     }
11435
11436     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11437                     hf_pn_io_ps_f_par_crc, &par_crc);
11438
11439
11440     /* Differniate between ipar_crc and no_ipar_crc */
11441     if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) {    /* include ipar_crc display */
11442         col_append_fstr(pinfo->cinfo, COL_INFO,
11443                         ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x,"
11444                          " dst:0x%04x, wd_time:%d, ipar_crc:0x%04x, crc:0x%04x",
11445                         prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc);
11446
11447         proto_item_append_text(f_item, "prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x, dst:0x%04x, wd_time:%d, ipar_crc:0x%04x, par_crc:0x%04x",
11448                 prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc);
11449     }
11450     else {    /* exclude ipar_crc display */
11451         col_append_fstr(pinfo->cinfo, COL_INFO,
11452                         ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x,"
11453                          " dst:0x%04x, wd_time:%d, crc:0x%04x",
11454                         prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc);
11455
11456         proto_item_append_text(f_item, "prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x, dst:0x%04x, wd_time:%d, par_crc:0x%04x",
11457                 prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc);
11458     }
11459
11460     if (!pinfo->fd->flags.visited) {
11461         /* Get current conversation endpoints using MAC addresses */
11462         conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11463         if (conversation == NULL) {
11464             conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11465         }
11466
11467         station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
11468         if (station_info != NULL) {
11469             if (frame != NULL) {
11470                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11471
11472                 io_data_object->f_par_crc1 = par_crc;
11473                 io_data_object->f_src_adr = src_addr;
11474                 io_data_object->f_dest_adr = dst_addr;
11475                 io_data_object->f_crc_seed = prm_flag1 & 0x40;
11476                 if (!(prm_flag1 & 0x10)) {
11477                     if (prm_flag1 & 0x20) {
11478                         io_data_object->f_crc_len = 4;
11479                     } else {
11480                         io_data_object->f_crc_len = 3;
11481                     }
11482                 }
11483             }
11484
11485             /* Find same module within output data to saved data */
11486             for (frame_out = wmem_list_head(station_info->ioobject_data_out); frame_out != NULL; frame_out = wmem_list_frame_next(frame_out)) {
11487                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame_out);
11488                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11489                     io_data_object->profisafeSupported &&               /* Arrayelement has to be PS-Module */
11490                     io_data_object->f_par_crc1 == 0) {                  /* Find following object with no f_par_crc1 */
11491
11492                     io_data_object->f_par_crc1 = par_crc;
11493                     io_data_object->f_src_adr = src_addr;
11494                     io_data_object->f_dest_adr = dst_addr;
11495                     io_data_object->f_crc_seed = prm_flag1 & 0x40;
11496                     if (!(prm_flag1 & 0x10)) {
11497                         if (prm_flag1 & 0x20) {
11498                             io_data_object->f_crc_len = 4;
11499                         } else {
11500                             io_data_object->f_crc_len = 3;
11501                         }
11502                     }
11503
11504                     break;
11505                 }
11506             }
11507         }
11508     }
11509
11510     return offset;
11511 }
11512
11513 static int
11514 dissect_RecordDataWrite(tvbuff_t *tvb, int offset,
11515     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen)
11516 {
11517     conversation_t    *conversation;
11518     stationInfo       *station_info;
11519     wmem_list_frame_t *frame;
11520     ioDataObject      *io_data_object;
11521
11522     const gchar *userProfile;
11523     pnio_ar_t   *ar = NULL;
11524
11525     /* PROFISafe */
11526     /* Get current conversation endpoints using MAC addresses */
11527     conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11528     if (conversation == NULL) {
11529         conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11530     }
11531
11532     station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
11533     if (station_info != NULL) {
11534         if (!pinfo->fd->flags.visited) {
11535             /* Search within the entire existing list for current input object data */
11536             for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) {
11537                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11538                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11539                     io_data_object->profisafeSupported &&               /* Arrayelement has to be PS-Module */
11540                     io_data_object->f_par_crc1 == 0) {                  /* Find following object with no f_par_crc1 */
11541
11542                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11543                 }
11544             }
11545         }
11546         else {
11547             /* User clicked another time the frame to see the data -> PROFIsafe data has already been saved
11548              * Check whether the device contains an PROFIsafe supported submodule.
11549              */
11550
11551             for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) {
11552                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11553                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11554                     io_data_object->profisafeSupported) {               /* Arrayelement has to be PS-Module */
11555
11556                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11557                 }
11558             }
11559
11560             for (frame = wmem_list_head(station_info->ioobject_data_out); frame != NULL; frame = wmem_list_frame_next(frame)) {
11561                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11562                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11563                     io_data_object->profisafeSupported) {               /* Arrayelement has to be PS-Module */
11564
11565                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11566                 }
11567             }
11568         }
11569     }
11570
11571     /* user specified format? */
11572     if (u16Index < 0x8000) {
11573         return dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data");
11574     }
11575
11576     /* profidrive parameter request */
11577     if (u16Index == 0xb02e || u16Index == 0xb02f) {
11578         return dissect_ProfiDriveParameterRequest(tvb, offset, pinfo, tree, drep);
11579     }
11580
11581     /* "reserved for profiles"? */
11582     userProfile = indexReservedForProfiles(u16Index);
11583     if (userProfile != NULL) {
11584         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile);
11585         return offset;
11586     }
11587
11588     /* see: pn_io_index */
11589     switch (u16Index) {
11590     case(0x8020):   /* PDIRSubframeData */
11591     case(0x801e):   /* SubstituteValues for one subslot */
11592     case(0x802b):   /* PDPortDataCheck for one subslot */
11593     case(0x802c):   /* PDirData for one subslot */
11594     case(0x802d):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */
11595     case(0x802e):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */
11596     case(0x802f):   /* PDPortDataAdjust for one subslot */
11597     case(0x8030):   /* IsochronousModeData for one subslot */
11598     case(0x8051):   /* PDInterfaceMrpDataCheck for one subslot */
11599     case(0x8052):   /* PDInterfaceMrpDataAdjust for one subslot */
11600     case(0x8053):   /* PDPortMrpDataAdjust for one subslot */
11601     case(0x8061):   /* PDPortFODataCheck for one subslot */
11602     case(0x8062):   /* PDPortFODataAdjust for one subslot */
11603     case(0x8070):   /* PDNCDataCheck for one subslot */
11604     case(0x8071):   /* PDInterfaceAdjust */
11605     case(0x8090):   /* PDInterfaceFSUDataAdjust */
11606     case(0x80B0):   /* CombinedObjectContainer*/
11607     case(0x80CF):   /* RS_AdjustObserver */
11608     case(0xe030):   /* IsochronousModeData for one AR */
11609     case(0xe050):   /* FastStartUp data for one AR */
11610     case(0xe061):   /* RS_AckEvent (using RecordDataWrite service) */
11611         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11612         break;
11613     default:
11614         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen);
11615     }
11616
11617     return offset;
11618 }
11619
11620 #define PN_IO_MAX_RECURSION_DEPTH 100
11621
11622 static int
11623 dissect_IODWriteReq(tvbuff_t *tvb, int offset,
11624     packet_info *pinfo, proto_tree *tree, guint8 *drep, pnio_ar_t **ar, guint recursion_count)
11625 {
11626     guint16 u16Index = 0;
11627     guint32 u32RecDataLen = 0;
11628
11629     if (++recursion_count >= PN_IO_MAX_RECURSION_DEPTH) {
11630         proto_tree_add_expert(tree, pinfo, &ei_pn_io_max_recursion_depth_reached,
11631                               tvb, 0, 0);
11632         return tvb_captured_length(tvb);
11633     }
11634
11635     /* IODWriteHeader */
11636     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, ar);
11637
11638     /* IODWriteMultipleReq? */
11639     if (u16Index == 0xe040) {
11640         while (tvb_captured_length_remaining(tvb, offset) > 0) {
11641             offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, ar, recursion_count++);
11642         }
11643     } else {
11644         tvbuff_t *new_tvb = tvb_new_subset_length(tvb, offset, u32RecDataLen);
11645         /* RecordDataWrite */
11646         offset += dissect_RecordDataWrite(new_tvb, 0, pinfo, tree, drep, u16Index, u32RecDataLen);
11647
11648         /* Padding */
11649         switch (offset % 4) {
11650         case(3):
11651             offset += 1;
11652             break;
11653         case(2):
11654             offset += 2;
11655             break;
11656         case(1):
11657             offset += 3;
11658             break;
11659         default: /* will not execute because of the line preceding the switch */
11660             break;
11661         }
11662     }
11663
11664     return offset;
11665 }
11666
11667 /* dissect a PN-IO write request */
11668 static int
11669 dissect_IPNIO_Write_rqst(tvbuff_t *tvb, int offset,
11670     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11671 {
11672     pnio_ar_t *ar = NULL;
11673     guint recursion_count = 0;
11674
11675     offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep);
11676
11677     offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count);
11678
11679     if (ar != NULL) {
11680         pnio_ar_info(tvb, pinfo, tree, ar);
11681     }
11682
11683     return offset;
11684 }
11685
11686
11687
11688 static int
11689 dissect_IODWriteRes(tvbuff_t *tvb, int offset,
11690     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11691 {
11692     guint16    u16Index = 0;
11693     guint32    u32RecDataLen;
11694     pnio_ar_t *ar       = NULL;
11695
11696
11697     /* IODWriteResHeader */
11698     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11699
11700     /* IODWriteMultipleRes? */
11701     if (u16Index == 0xe040) {
11702         while (tvb_captured_length_remaining(tvb, offset) > 0) {
11703             offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11704         }
11705     }
11706
11707     if (ar != NULL) {
11708         pnio_ar_info(tvb, pinfo, tree, ar);
11709     }
11710
11711     return offset;
11712 }
11713
11714
11715 /* dissect a PN-IO write response */
11716 static int
11717 dissect_IPNIO_Write_resp(tvbuff_t *tvb, int offset,
11718     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11719 {
11720
11721     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
11722
11723     offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep);
11724
11725     return offset;
11726 }
11727
11728
11729 /* dissect the IOxS (IOCS, IOPS) field */
11730 static int
11731 dissect_PNIO_IOxS(tvbuff_t *tvb, int offset,
11732                   packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex)
11733 {
11734
11735     if (tree) {
11736         guint8      u8IOxS;
11737         proto_item *ioxs_item;
11738         proto_tree *ioxs_tree;
11739
11740         u8IOxS = tvb_get_guint8(tvb, offset);
11741
11742         /* add ioxs subtree */
11743         ioxs_item = proto_tree_add_uint(tree, hfindex, tvb, offset, 1, u8IOxS);
11744         proto_item_append_text(ioxs_item,
11745                                " (%s%s)",
11746                                (u8IOxS & 0x01) ? "another IOxS follows " : "",
11747                                (u8IOxS & 0x80) ? "good" : "bad");
11748         ioxs_tree = proto_item_add_subtree(ioxs_item, ett_pn_io_ioxs);
11749
11750         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_datastate, tvb, offset, 1, u8IOxS);
11751         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_instance,  tvb, offset, 1, u8IOxS);
11752         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_res14,     tvb, offset, 1, u8IOxS);
11753         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_extension, tvb, offset, 1, u8IOxS);
11754     }
11755
11756     return offset + 1;
11757 }
11758
11759
11760 /* dissect a PN-IO Cyclic Service Data Unit (on top of PN-RT protocol) */
11761 static int
11762 dissect_PNIO_C_SDU(tvbuff_t *tvb, int offset,
11763     packet_info *pinfo, proto_tree *tree, guint8 *drep _U_)
11764 {
11765     proto_tree  *data_tree = NULL;
11766     /* gint iTotalLen    = 0; */
11767     /* gint iSubFrameLen = 0; */
11768
11769     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO");
11770
11771     if (tree) {
11772         proto_item *data_item;
11773         data_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb),
11774             "PROFINET IO Cyclic Service Data Unit: %u bytes", tvb_captured_length(tvb));
11775         data_tree = proto_item_add_subtree(data_item, ett_pn_io_rtc);
11776     }
11777
11778     /*dissect_dcerpc_uint16(tvb, offset, pinfo, data_tree, drep, hf_pn_io_packedframe_SFCRC, &u16SFCRC);*/
11779     if (dissect_CSF_SDU_heur(tvb, pinfo, data_tree, NULL))
11780         return(tvb_captured_length(tvb));
11781
11782     /* XXX - dissect the remaining data */
11783     /* this will be one or more DataItems followed by an optional GAP and RTCPadding */
11784     /* as we don't have the required context information to dissect the specific DataItems, */
11785     /* this will be tricky :-( */
11786     /* actual: there may be an IOxS but most case there isn't so better display a data-stream */
11787     /* offset = dissect_PNIO_IOxS(tvb, offset, pinfo, data_tree, drep, hf_pn_io_ioxs);        */
11788     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset),
11789         "User Data (including GAP and RTCPadding)");
11790
11791     return offset;
11792 }
11793
11794
11795 /* dissect a PN-IO RTA PDU (on top of PN-RT protocol) */
11796 static int
11797 dissect_PNIO_RTA(tvbuff_t *tvb, int offset,
11798     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11799 {
11800     guint16     u16AlarmDstEndpoint;
11801     guint16     u16AlarmSrcEndpoint;
11802     guint8      u8PDUType;
11803     guint8      u8PDUVersion;
11804     guint8      u8WindowSize;
11805     guint8      u8Tack;
11806     guint16     u16SendSeqNum;
11807     guint16     u16AckSeqNum;
11808     guint16     u16VarPartLen;
11809     int         start_offset = offset;
11810     guint16     u16Index     = 0;
11811     guint32     u32RecDataLen;
11812     pnio_ar_t  *ar           = NULL;
11813
11814
11815     proto_item *rta_item;
11816     proto_tree *rta_tree;
11817
11818     proto_item *sub_item;
11819     proto_tree *sub_tree;
11820
11821
11822     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-AL");
11823
11824     rta_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb),
11825         "PROFINET IO Alarm");
11826     rta_tree = proto_item_add_subtree(rta_item, ett_pn_io_rta);
11827
11828     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11829                     hf_pn_io_alarm_dst_endpoint, &u16AlarmDstEndpoint);
11830     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11831                     hf_pn_io_alarm_src_endpoint, &u16AlarmSrcEndpoint);
11832
11833     col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: 0x%x, Dst: 0x%x",
11834         u16AlarmSrcEndpoint, u16AlarmDstEndpoint);
11835
11836     /* PDU type */
11837     sub_item = proto_tree_add_item(rta_tree, hf_pn_io_pdu_type, tvb, offset, 1, ENC_NA);
11838     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type);
11839     dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11840                     hf_pn_io_pdu_type_type, &u8PDUType);
11841     u8PDUType &= 0x0F;
11842     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11843                     hf_pn_io_pdu_type_version, &u8PDUVersion);
11844     u8PDUVersion >>= 4;
11845     proto_item_append_text(sub_item, ", Type: %s, Version: %u",
11846         val_to_str(u8PDUType, pn_io_pdu_type, "Unknown"),
11847         u8PDUVersion);
11848
11849     /* additional flags */
11850     sub_item = proto_tree_add_item(rta_tree, hf_pn_io_add_flags, tvb, offset, 1, ENC_NA);
11851     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_add_flags);
11852     dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11853                     hf_pn_io_window_size, &u8WindowSize);
11854     u8WindowSize &= 0x0F;
11855     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11856                     hf_pn_io_tack, &u8Tack);
11857     u8Tack >>= 4;
11858     proto_item_append_text(sub_item, ", Window Size: %u, Tack: %u",
11859         u8WindowSize, u8Tack);
11860
11861     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11862                     hf_pn_io_send_seq_num, &u16SendSeqNum);
11863     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11864                     hf_pn_io_ack_seq_num, &u16AckSeqNum);
11865     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11866                     hf_pn_io_var_part_len, &u16VarPartLen);
11867
11868     switch ( u8PDUType & 0x0F) {
11869     case(1):    /* Data-RTA */
11870         col_append_str(pinfo->cinfo, COL_INFO, ", Data-RTA");
11871         offset = dissect_block(tvb, offset, pinfo, rta_tree, drep, &u16Index, &u32RecDataLen, &ar);
11872         break;
11873     case(2):    /* NACK-RTA */
11874             col_append_str(pinfo->cinfo, COL_INFO, ", NACK-RTA");
11875         /* no additional data */
11876         break;
11877     case(3):    /* ACK-RTA */
11878             col_append_str(pinfo->cinfo, COL_INFO, ", ACK-RTA");
11879         /* no additional data */
11880         break;
11881     case(4):    /* ERR-RTA */
11882             col_append_str(pinfo->cinfo, COL_INFO, ", ERR-RTA");
11883         offset = dissect_PNIO_status(tvb, offset, pinfo, rta_tree, drep);
11884         break;
11885     default:
11886         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb));
11887     }
11888
11889     proto_item_set_len(rta_item, offset - start_offset);
11890
11891     return offset;
11892 }
11893
11894
11895 /* possibly dissect a PN-IO related PN-RT packet */
11896 static gboolean
11897 dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
11898     void *data)
11899 {
11900     guint8   drep_data = 0;
11901     guint8  *drep      = &drep_data;
11902     guint8   u8CBAVersion;
11903     /* the sub tvb will NOT contain the frame_id here! */
11904     guint16  u16FrameID = GPOINTER_TO_UINT(data);
11905     heur_dtbl_entry_t *hdtbl_entry;
11906
11907     /*
11908      * In case the packet is a protocol encoded in the basic PNIO transport stream,
11909      * give that protocol a chance to make a heuristic dissection, before we continue
11910      * to dissect it as a normal PNIO packet.
11911      */
11912     if (dissector_try_heuristic(heur_pn_subdissector_list, tvb, pinfo, tree, &hdtbl_entry, NULL))
11913         return TRUE;
11914
11915     u8CBAVersion = tvb_get_guint8 (tvb, 0);
11916
11917     /* is this a (none DFP) PNIO class 3 data packet? */
11918     /* frame id must be in valid range (cyclic Real-Time, class=3) */
11919     if ((u16FrameID >= 0x0100 && u16FrameID <= 0x06FF) ||   /* RTC3 non redundant */
11920         (u16FrameID >= 0x700 && u16FrameID <= 0x0fff)) {    /* RTC3 redundant */
11921         dissect_PNIO_C_SDU(tvb, 0, pinfo, tree, drep);
11922         return TRUE;
11923     }
11924
11925     /* The following range is reserved for following developments */
11926     /* frame id must be in valid range (Reserved) and
11927      * first byte (CBA version field) has to be != 0x11 */
11928     if (u16FrameID >= 0x1000 && u16FrameID <= 0x7fff && u8CBAVersion != 0x11) {
11929         dissect_PNIO_C_SDU(tvb, 0, pinfo, tree, drep);
11930         return TRUE;
11931     }
11932
11933     /* is this a PNIO class 1 data packet? */
11934     /* frame id must be in valid range (cyclic Real-Time, class=1) and
11935      * first byte (CBA version field) has to be != 0x11 */
11936     if (u16FrameID >= 0x8000 && u16FrameID < 0xbfff && u8CBAVersion != 0x11) {
11937         dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep);
11938         return TRUE;
11939     }
11940
11941     /* is this a PNIO class 1 (legacy) data packet? */
11942     /* frame id must be in valid range (cyclic Real-Time, class=1, legacy) and
11943      * first byte (CBA version field) has to be != 0x11 */
11944     if (u16FrameID >= 0xc000 && u16FrameID < 0xfbff && u8CBAVersion != 0x11) {
11945         dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep);
11946         return TRUE;
11947     }
11948
11949     /* is this a PNIO high priority alarm packet? */
11950     if (u16FrameID == 0xfc01) {
11951         col_set_str(pinfo->cinfo, COL_INFO, "Alarm High");
11952
11953         dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep);
11954         return TRUE;
11955     }
11956
11957     /* is this a PNIO low priority alarm packet? */
11958     if (u16FrameID == 0xfe01) {
11959         col_set_str(pinfo->cinfo, COL_INFO, "Alarm Low");
11960
11961         dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep);
11962         return TRUE;
11963     }
11964
11965     /* this PN-RT packet doesn't seem to be PNIO specific */
11966     return FALSE;
11967 }
11968
11969
11970
11971 static gboolean
11972 pn_io_ar_conv_valid(packet_info *pinfo)
11973 {
11974     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
11975
11976     return ((profinet_type != NULL) && (GPOINTER_TO_UINT(profinet_type) == 10));
11977 }
11978
11979 static gchar *
11980 pn_io_ar_conv_filter(packet_info *pinfo)
11981 {
11982     pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0);
11983     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
11984     char      *buf;
11985     address   controllermac_addr, devicemac_addr;
11986
11987     if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) {
11988         return NULL;
11989     }
11990
11991     set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
11992     set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
11993
11994     buf = g_strdup_printf(
11995         "pn_io.ar_uuid == %s || "                                   /* ARUUID */
11996         "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "   /* Alarm CR (contr -> dev) */
11997         "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",      /* Alarm CR (dev -> contr) */
11998          guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid),
11999         ar->controlleralarmref, address_to_str(pinfo->pool, &controllermac_addr),
12000         ar->devicealarmref, address_to_str(pinfo->pool, &devicemac_addr));
12001     return buf;
12002 }
12003
12004 static gchar *
12005 pn_io_ar_conv_data_filter(packet_info *pinfo)
12006 {
12007     pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0);
12008     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
12009     char      *buf, *controllermac_str, *devicemac_str, *guid_str;
12010     address   controllermac_addr, devicemac_addr;
12011
12012     if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) {
12013         return NULL;
12014     }
12015
12016     set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
12017     set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
12018
12019     controllermac_str = address_to_str(pinfo->pool, &controllermac_addr);
12020     devicemac_str = address_to_str(pinfo->pool, &devicemac_addr);
12021     guid_str = guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid);
12022     if (ar->arType == 0x0010) /* IOCARSingle using RT_CLASS_3 */
12023     {
12024         buf = g_strdup_printf(
12025             "pn_io.ar_uuid == %s || "                                           /* ARUUID */
12026             "(pn_rt.frame_id == 0x%x) || (pn_rt.frame_id == 0x%x) || "
12027             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "           /* Alarm CR (contr -> dev) */
12028             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",              /* Alarm CR (dev -> contr) */
12029             guid_str,
12030             ar->inputframeid, ar->outputframeid,
12031             ar->controlleralarmref, controllermac_str,
12032             ar->devicealarmref, devicemac_str);
12033     }
12034     else
12035     {
12036         buf = g_strdup_printf(
12037             "pn_io.ar_uuid == %s || "                                           /* ARUUID */
12038             "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || "    /* Input CR && dev MAC -> contr MAC */
12039             "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || "    /* Output CR && contr MAC -> dev MAC */
12040             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "           /* Alarm CR (contr -> dev) */
12041             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",              /* Alarm CR (dev -> contr) */
12042             guid_str,
12043             ar->inputframeid, devicemac_str, controllermac_str,
12044             ar->outputframeid, controllermac_str, devicemac_str,
12045             ar->controlleralarmref, controllermac_str,
12046             ar->devicealarmref, devicemac_str);
12047     }
12048     return buf;
12049 }
12050
12051
12052
12053 /* the PNIO dcerpc interface table */
12054 static dcerpc_sub_dissector pn_io_dissectors[] = {
12055     { 0, "Connect",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
12056     { 1, "Release",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
12057     { 2, "Read",          dissect_IPNIO_rqst,       dissect_IPNIO_Read_resp },
12058     { 3, "Write",         dissect_IPNIO_Write_rqst, dissect_IPNIO_Write_resp },
12059     { 4, "Control",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
12060     { 5, "Read Implicit", dissect_IPNIO_rqst,       dissect_IPNIO_Read_resp },
12061     { 0, NULL, NULL, NULL }
12062 };
12063
12064
12065 static void
12066 pnio_cleanup(void) {
12067     g_list_free(pnio_ars);
12068     pnio_ars = NULL;
12069 }
12070
12071
12072 void
12073 proto_register_pn_io (void)
12074 {
12075     static hf_register_info hf[] = {
12076     { &hf_pn_io_opnum,
12077       { "Operation", "pn_io.opnum",
12078         FT_UINT16, BASE_DEC, NULL, 0x0,
12079         NULL, HFILL }
12080     },
12081     { &hf_pn_io_reserved16,
12082       { "Reserved", "pn_io.reserved16",
12083         FT_UINT16, BASE_HEX, NULL, 0x0,
12084         NULL, HFILL }
12085     },
12086     { &hf_pn_io_array,
12087       { "Array", "pn_io.array",
12088         FT_NONE, BASE_NONE, NULL, 0x0,
12089         NULL, HFILL }
12090     },
12091     { &hf_pn_io_status,
12092       { "Status", "pn_io.status",
12093         FT_NONE, BASE_NONE, NULL, 0x0,
12094         NULL, HFILL }
12095     },
12096     { &hf_pn_io_args_max,
12097       { "ArgsMaximum", "pn_io.args_max",
12098         FT_UINT32, BASE_DEC, NULL, 0x0,
12099         NULL, HFILL }
12100     },
12101     { &hf_pn_io_args_len,
12102       { "ArgsLength", "pn_io.args_len",
12103         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12104         NULL, HFILL }
12105     },
12106     { &hf_pn_io_array_max_count,
12107       { "MaximumCount", "pn_io.array_max_count",
12108         FT_UINT32, BASE_DEC, NULL, 0x0,
12109         NULL, HFILL }
12110     },
12111     { &hf_pn_io_array_offset,
12112       { "Offset", "pn_io.array_offset",
12113         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12114         NULL, HFILL }
12115     },
12116     { &hf_pn_io_array_act_count,
12117       { "ActualCount", "pn_io.array_act_count",
12118         FT_UINT32, BASE_DEC, NULL, 0x0,
12119         NULL, HFILL }
12120     },
12121
12122     { &hf_pn_io_ar_data,
12123       { "ARDATA for AR:", "pn_io.ar_data",
12124         FT_NONE, BASE_NONE, 0x0, 0x0,
12125         NULL, HFILL }
12126     },
12127     { &hf_pn_io_ar_type,
12128       { "ARType", "pn_io.ar_type",
12129         FT_UINT16, BASE_HEX, VALS(pn_io_ar_type), 0x0,
12130         NULL, HFILL }
12131     },
12132     { &hf_pn_io_cminitiator_macadd,
12133       { "CMInitiatorMacAdd", "pn_io.cminitiator_mac_add",
12134         FT_ETHER, BASE_NONE, 0x0, 0x0,
12135         NULL, HFILL }
12136     },
12137     { &hf_pn_io_cminitiator_objectuuid,
12138       { "CMInitiatorObjectUUID", "pn_io.cminitiator_uuid",
12139         FT_GUID, BASE_NONE, 0x0, 0x0,
12140         NULL, HFILL }
12141     },
12142         { &hf_pn_io_parameter_server_objectuuid,
12143           { "ParameterServerObjectUUID", "pn_io.parameter_server_objectuuid",
12144             FT_GUID, BASE_NONE, 0x0, 0x0,
12145             NULL, HFILL }
12146         },
12147     { &hf_pn_io_ar_properties,
12148       { "ARProperties", "pn_io.ar_properties",
12149         FT_UINT32, BASE_HEX, NULL, 0x0,
12150         NULL, HFILL }
12151     },
12152     { &hf_pn_io_ar_properties_state,
12153       { "State", "pn_io.ar_properties.state",
12154         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_state), 0x00000007,
12155         NULL, HFILL }
12156     },
12157     { &hf_pn_io_ar_properties_supervisor_takeover_allowed,
12158       { "SupervisorTakeoverAllowed", "pn_io.ar_properties.supervisor_takeover_allowed",
12159         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_supervisor_takeover_allowed), 0x00000008,
12160         NULL, HFILL }
12161     },
12162     { &hf_pn_io_ar_properties_parametrization_server,
12163       { "ParametrizationServer", "pn_io.ar_properties.parametrization_server",
12164         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_parametrization_server), 0x00000010,
12165         NULL, HFILL }
12166     },
12167     { &hf_pn_io_artype_req,
12168         { "ARType", "pn_io.artype_req",
12169            FT_STRING, BASE_NONE, NULL, 0x0,
12170            NULL, HFILL }},
12171     { &hf_pn_io_ar_properties_companion_ar,
12172       { "CompanionAR", "pn_io.ar_properties.companion_ar",
12173         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_companion_ar), 0x00000600,
12174         NULL, HFILL }
12175     },
12176     { &hf_pn_io_ar_properties_achnowledge_companion_ar,
12177       { "AcknowledgeCompanionAR", "pn_io.ar_properties.acknowledge_companion_ar",
12178         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_acknowldege_companion_ar), 0x00000800,
12179         NULL, HFILL }
12180     },
12181     { &hf_pn_io_ar_properties_reserved,
12182       { "Reserved", "pn_io.ar_properties.reserved",
12183         FT_UINT32, BASE_HEX, NULL, 0x1FFFF000,
12184         NULL, HFILL }
12185     },
12186     { &hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode,
12187       { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container",
12188         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_legacy_startupmode), 0x20000000,
12189         NULL, HFILL }
12190     },
12191     { &hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode,
12192     { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container",
12193        FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_advanced_startupmode), 0x20000000,
12194        NULL, HFILL }
12195     },
12196     { &hf_pn_io_arproperties_StartupMode,
12197       { "StartupMode", "pn_io.ar_properties.StartupMode",
12198         FT_UINT32, BASE_HEX, VALS(pn_io_arpropertiesStartupMode), 0x40000000,
12199         NULL, HFILL }
12200     },
12201     { &hf_pn_io_ar_properties_pull_module_alarm_allowed,
12202       { "PullModuleAlarmAllowed", "pn_io.ar_properties.pull_module_alarm_allowed",
12203         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_pull_module_alarm_allowed), 0x80000000,
12204         NULL, HFILL }
12205     },
12206     { &hf_pn_RedundancyInfo,
12207       { "RedundancyInfo.EndPoint", "pn_io.srl_data.redundancyInfo",
12208         FT_UINT16, BASE_HEX, VALS(pn_io_RedundancyInfo), 0x0000003,
12209         NULL, HFILL }
12210     },
12211     { &hf_pn_RedundancyInfo_reserved,
12212       { "RedundancyInfo.reserved", "pn_io.srl_data.redundancyInfoReserved",
12213         FT_UINT16, BASE_HEX, NULL, 0xFFFFFFFC,
12214         NULL, HFILL }
12215     },
12216     { &hf_pn_io_number_of_ARDATAInfo,
12217       { "ARDataInfo.NumberOfEntries", "pn_io.number_of_ARDATAInfo",
12218         FT_UINT16, BASE_DEC, NULL, 0x0,
12219         NULL, HFILL }
12220     },
12221
12222     { &hf_pn_io_cminitiator_activitytimeoutfactor,
12223       { "CMInitiatorActivityTimeoutFactor", "pn_io.cminitiator_activitytimeoutfactor",
12224         FT_UINT16, BASE_DEC, NULL, 0x0,
12225         NULL, HFILL }
12226     },  /* XXX - special values */
12227     { &hf_pn_io_cminitiator_udprtport,
12228       { "CMInitiatorUDPRTPort", "pn_io.cminitiator_udprtport",
12229         FT_UINT16, BASE_HEX, NULL, 0x0,
12230         NULL, HFILL }
12231     },  /* XXX - special values */
12232     { &hf_pn_io_station_name_length,
12233       { "StationNameLength", "pn_io.station_name_length",
12234         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12235         NULL, HFILL }
12236     },
12237     { &hf_pn_io_cminitiator_station_name,
12238       { "CMInitiatorStationName", "pn_io.cminitiator_station_name",
12239         FT_STRING, BASE_NONE, NULL, 0x0,
12240         NULL, HFILL }
12241     },
12242     { &hf_pn_io_parameter_server_station_name,
12243       { "ParameterServerStationName", "pn_io.parameter_server_station_name",
12244         FT_STRING, BASE_NONE, NULL, 0x0,
12245         NULL, HFILL }
12246     },
12247     { &hf_pn_io_cmresponder_macadd,
12248       { "CMResponderMacAdd", "pn_io.cmresponder_macadd",
12249         FT_ETHER, BASE_NONE, 0x0, 0x0,
12250         NULL, HFILL }
12251     },
12252     { &hf_pn_io_cmresponder_udprtport,
12253       { "CMResponderUDPRTPort", "pn_io.cmresponder_udprtport",
12254         FT_UINT16, BASE_HEX, NULL, 0x0,
12255         NULL, HFILL }
12256     },  /* XXX - special values */
12257     { &hf_pn_io_number_of_iocrs,
12258       { "NumberOfIOCRs", "pn_io.number_of_iocrs",
12259         FT_UINT16, BASE_DEC, NULL, 0x0,
12260         NULL, HFILL }
12261     },
12262     { &hf_pn_io_iocr_tree,
12263       { "IOCR", "pn_io.iocr_tree",
12264         FT_NONE, BASE_NONE, NULL, 0x0,
12265         NULL, HFILL }
12266     },
12267     { &hf_pn_io_iocr_type,
12268       { "IOCRType", "pn_io.iocr_type",
12269         FT_UINT16, BASE_HEX, VALS(pn_io_iocr_type), 0x0,
12270         NULL, HFILL }
12271     },
12272     { &hf_pn_io_iocr_reference,
12273       { "IOCRReference", "pn_io.iocr_reference",
12274         FT_UINT16, BASE_HEX, NULL, 0x0,
12275         NULL, HFILL }
12276     },
12277     { &hf_pn_io_iocr_SubframeOffset,
12278       { "-> SubframeOffset", "pn_io.subframe_offset",
12279         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
12280         NULL, HFILL }
12281     },
12282     { &hf_pn_io_iocr_SubframeData,
12283       { "SubframeData", "pn_io.subframe_data",
12284         FT_UINT32, BASE_HEX, NULL, 0x0,
12285         NULL, HFILL }
12286     },
12287     { &hf_pn_io_RedundancyDataHoldFactor,
12288       { "RedundancyDataHoldFactor", "pn_io.RedundancyDataHoldFactor",
12289         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_RedundancyDataHoldFactor), 0x0,
12290         NULL, HFILL }
12291     },
12292     { &hf_pn_io_sr_properties,
12293       { "SRProperties", "pn_io.sr_properties",
12294         FT_UINT32, BASE_HEX, NULL, 0x0,
12295         NULL, HFILL }
12296     },
12297     { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0,
12298       { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR",
12299         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0), 0x01,
12300         NULL, HFILL }
12301     },
12302     { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1,
12303       { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR",
12304         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1), 0x01,
12305         NULL, HFILL }
12306     },
12307     { &hf_pn_io_sr_properties_Reserved_1,
12308       { "Reserved_1", "pn_io.sr_properties.Reserved_1",
12309         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Reserved1), 0x00000002,
12310         NULL, HFILL }
12311     },
12312     { &hf_pn_io_sr_properties_Mode,
12313       { "Mode", "pn_io.sr_properties.Mode",
12314         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Mode), 0x00000004,
12315         NULL, HFILL }
12316     },
12317     { &hf_pn_io_sr_properties_Reserved_2,
12318       { "Reserved_2", "pn_io.sr_properties.Reserved_2",
12319         FT_UINT32, BASE_HEX, NULL, 0x0000FFF8,
12320         NULL, HFILL }
12321     },
12322     { &hf_pn_io_sr_properties_Reserved_3,
12323       { "Reserved_3", "pn_io.sr_properties.Reserved_3",
12324         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
12325         NULL, HFILL }
12326     },
12327     { &hf_pn_io_arvendor_strucidentifier_if0_low,
12328       { "APStructureIdentifier: Vendor specific", "pn_io.structidentifier_api_0_low",
12329         FT_UINT16, BASE_HEX, NULL, 0x0,
12330         NULL, HFILL }
12331     },
12332     { &hf_pn_io_arvendor_strucidentifier_if0_high,
12333       { "APStructureIdentifier: Administrative number for common profiles", "pn_io.structidentifier_api_0_high",
12334         FT_UINT16, BASE_HEX, NULL, 0x0,
12335         NULL, HFILL }
12336     },
12337     { &hf_pn_io_arvendor_strucidentifier_if0_is8000,
12338       { "APStructureIdentifier: Extended identification rules", "pn_io.tructidentifier_api_0_is8000",
12339         FT_UINT16, BASE_HEX, NULL, 0x0,
12340         NULL, HFILL }
12341     },
12342     { &hf_pn_io_arvendor_strucidentifier_not0,
12343     { "APStructureIdentifier: Administrative number for application profiles", "pn_io.tructidentifier_api_not_0",
12344         FT_UINT16, BASE_HEX, NULL, 0x0,
12345         NULL, HFILL }
12346     },
12347     { &hf_pn_io_lt,
12348       { "LT", "pn_io.lt",
12349         FT_UINT16, BASE_HEX, NULL, 0x0,
12350         NULL, HFILL }
12351     },
12352     { &hf_pn_io_iocr_properties,
12353       { "IOCRProperties", "pn_io.iocr_properties",
12354         FT_UINT32, BASE_HEX, NULL, 0x0,
12355         NULL, HFILL }
12356     },
12357     { &hf_pn_io_iocr_properties_rtclass,
12358       { "RTClass", "pn_io.iocr_properties.rtclass",
12359         FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_rtclass), 0x0000000F,
12360         NULL, HFILL }
12361     },
12362     { &hf_pn_io_iocr_properties_reserved_1,
12363       { "Reserved1", "pn_io.iocr_properties.reserved1",
12364         FT_UINT32, BASE_HEX, NULL, 0x00000FF0,
12365         NULL, HFILL }
12366     },
12367     { &hf_pn_io_iocr_properties_media_redundancy,
12368       { "MediaRedundancy", "pn_io.iocr_properties.media_redundancy",
12369         FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_media_redundancy), 0x00000800,
12370         NULL, HFILL }
12371     },
12372     { &hf_pn_io_iocr_properties_reserved_2,
12373       { "Reserved2", "pn_io.iocr_properties.reserved2",
12374         FT_UINT32, BASE_HEX, NULL, 0x00FFF000,
12375         NULL, HFILL }
12376     },
12377     { &hf_pn_io_iocr_properties_reserved_3,
12378       { "Reserved3", "pn_io.iocr_properties.reserved3",
12379         FT_UINT32, BASE_HEX, NULL, 0xF000000,
12380         NULL, HFILL }
12381     },
12382     { &hf_pn_io_iocr_properties_fast_forwarding_mac_adr,
12383       { "FastForwardingMACAdr", "pn_io.iocr_properties.fast_forwarding_mac_adr",
12384         FT_UINT32, BASE_HEX, NULL, 0x20000000,
12385         NULL, HFILL }
12386     },
12387     { &hf_pn_io_iocr_properties_distributed_subframe_watchdog,
12388       { "DistributedSubFrameWatchDog", "pn_io.iocr_properties.distributed_subframe_watchdog",
12389         FT_UINT32, BASE_HEX, NULL, 0x40000000,
12390         NULL, HFILL }
12391     },
12392     { &hf_pn_io_iocr_properties_full_subframe_structure,
12393       { "FullSubFrameStructure", "pn_io.iocr_properties.full_subframe_structure",
12394         FT_UINT32, BASE_HEX, NULL, 0x80000000,
12395         NULL, HFILL }
12396     },
12397     { &hf_pn_io_SFIOCRProperties,
12398       { "SFIOCRProperties", "pn_io.SFIOCRProperties",
12399         FT_UINT32, BASE_HEX, NULL, 0x0,
12400         NULL, HFILL }
12401     },
12402     { &hf_pn_io_DistributedWatchDogFactor,
12403       { "SFIOCRProperties.DistributedWatchDogFactor", "pn_io.SFIOCRProperties.DistributedWatchDogFactor",
12404         FT_UINT32, BASE_HEX, NULL, 0x0FF,
12405         NULL, HFILL }
12406     },
12407     { &hf_pn_io_RestartFactorForDistributedWD,
12408       { "SFIOCRProperties.RestartFactorForDistributedWD", "pn_io.SFIOCRProperties.RestartFactorForDistributedWD",
12409         FT_UINT32, BASE_HEX, NULL, 0xff00,
12410         NULL, HFILL }
12411     },
12412     { &hf_pn_io_SFIOCRProperties_DFPmode,
12413       { "SFIOCRProperties.DFPmode", "pn_io.SFIOCRProperties.DFPmode",
12414         FT_UINT32, BASE_HEX, NULL, 0xFF0000,
12415         NULL, HFILL }
12416     },
12417     { &hf_pn_io_SFIOCRProperties_reserved_1,
12418       { "SFIOCRProperties.reserved_1", "pn_io.SFIOCRProperties.reserved_1",
12419         FT_UINT32, BASE_HEX, NULL, 0x0F000000,
12420         NULL, HFILL }
12421     },
12422     { &hf_pn_io_SFIOCRProperties_reserved_2,
12423       { "SFIOCRProperties.reserved_2", "pn_io.SFIOCRProperties.reserved_2",
12424         FT_UINT32, BASE_HEX, NULL, 0x010000000,
12425         NULL, HFILL }
12426     },
12427     { &hf_pn_io_SFIOCRProperties_DFPType,
12428       { "SFIOCRProperties.DFPType", "pn_io.SFIOCRProperties.DFPType",
12429         FT_UINT32, BASE_HEX,  VALS(pn_io_SFIOCRProperties_DFPType_vals), 0x020000000,
12430         NULL, HFILL }
12431     },
12432     { &hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout,
12433       { "SFIOCRProperties.DFPRedundantPathLayout", "pn_io.SFIOCRProperties.DFPRedundantPathLayout",
12434         FT_UINT32, BASE_HEX, VALS(pn_io_DFPRedundantPathLayout_decode), 0x040000000,
12435         NULL, HFILL }
12436     },
12437     { &hf_pn_io_SFIOCRProperties_SFCRC16,
12438       { "SFIOCRProperties.SFCRC16", "pn_io.SFIOCRProperties.SFCRC16",
12439         FT_UINT32, BASE_HEX, VALS(pn_io_SFCRC16_Decode), 0x080000000,
12440         NULL, HFILL }
12441     },
12442     { &hf_pn_io_data_length,
12443       { "DataLength", "pn_io.data_length",
12444         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12445         NULL, HFILL }
12446     },
12447     { &hf_pn_io_ir_frame_data,
12448       { "Frame data", "pn_io.ir_frame_data",
12449         FT_NONE, BASE_NONE, NULL, 0x0,
12450         NULL, HFILL }
12451     },
12452     { &hf_pn_io_frame_id,
12453       { "FrameID", "pn_io.frame_id",
12454         FT_UINT16, BASE_HEX, NULL, 0x0,
12455         NULL, HFILL }
12456     },
12457     { &hf_pn_io_send_clock_factor,
12458       { "SendClockFactor", "pn_io.send_clock_factor",
12459         FT_UINT16, BASE_DEC, NULL, 0x0,
12460         NULL, HFILL }
12461     }, /* XXX - special values */
12462     { &hf_pn_io_reduction_ratio,
12463       { "ReductionRatio", "pn_io.reduction_ratio",
12464         FT_UINT16, BASE_DEC, NULL, 0x0,
12465         NULL, HFILL }
12466     }, /* XXX - special values */
12467     { &hf_pn_io_phase,
12468       { "Phase", "pn_io.phase",
12469         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12470         NULL, HFILL }
12471     },
12472     { &hf_pn_io_sequence,
12473       { "Sequence", "pn_io.sequence",
12474         FT_UINT16, BASE_DEC, NULL, 0x0,
12475         NULL, HFILL }
12476     },
12477     { &hf_pn_io_frame_send_offset,
12478       { "FrameSendOffset", "pn_io.frame_send_offset",
12479         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12480         NULL, HFILL }
12481     },
12482     { &hf_pn_io_frame_data_properties,
12483       { "FrameDataProperties", "pn_io.frame_data_properties",
12484         FT_UINT32, BASE_HEX, NULL, 0x0,
12485         NULL, HFILL }
12486     },
12487     { &hf_pn_io_frame_data_properties_forwarding_Mode,
12488       { "ForwardingMode", "pn_io.frame_data_properties_forwardingMode",
12489         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_forwardingMode), 0x01,
12490         NULL, HFILL }
12491     },
12492     { &hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd,
12493       { "FastForwardingMulticastMACAdd", "pn_io.frame_data_properties_MulticastMACAdd",
12494         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FFMulticastMACAdd), 0x06,
12495         NULL, HFILL }
12496     },
12497     { &hf_pn_io_frame_data_properties_FragmentMode,
12498       { "FragmentationMode", "pn_io.frame_data_properties_FragMode",
12499         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FragMode), 0x18,
12500         NULL, HFILL }
12501     },
12502     { &hf_pn_io_frame_data_properties_reserved_1,
12503       { "Reserved_1", "pn_io.frame_data.reserved_1",
12504         FT_UINT32, BASE_HEX, NULL, 0x0000FFE0,
12505         NULL, HFILL }
12506     },
12507     { &hf_pn_io_frame_data_properties_reserved_2,
12508       { "Reserved_2", "pn_io.frame_data.reserved_2",
12509         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
12510         NULL, HFILL }
12511     },
12512     { &hf_pn_io_watchdog_factor,
12513       { "WatchdogFactor", "pn_io.watchdog_factor",
12514         FT_UINT16, BASE_DEC, NULL, 0x0,
12515         NULL, HFILL }
12516     },
12517     { &hf_pn_io_data_hold_factor,
12518       { "DataHoldFactor", "pn_io.data_hold_factor",
12519         FT_UINT16, BASE_DEC, NULL, 0x0,
12520         NULL, HFILL }
12521     },
12522     { &hf_pn_io_iocr_tag_header,
12523       { "IOCRTagHeader", "pn_io.iocr_tag_header",
12524         FT_UINT16, BASE_HEX, NULL, 0x0,
12525         NULL, HFILL }
12526     },
12527     { &hf_pn_io_iocr_multicast_mac_add,
12528       { "IOCRMulticastMACAdd", "pn_io.iocr_multicast_mac_add",
12529         FT_ETHER, BASE_NONE, NULL, 0x0,
12530         NULL, HFILL }
12531     },
12532     { &hf_pn_io_number_of_apis,
12533       { "NumberOfAPIs", "pn_io.number_of_apis",
12534         FT_UINT16, BASE_DEC, NULL, 0x0,
12535         NULL, HFILL }
12536     },
12537     { &hf_pn_io_number_of_io_data_objects,
12538       { "NumberOfIODataObjects", "pn_io.number_of_io_data_objects",
12539         FT_UINT16, BASE_DEC, NULL, 0x0,
12540         NULL, HFILL }
12541     },
12542     { &hf_pn_io_number_of_iocs,
12543       { "NumberOfIOCS", "pn_io.number_of_iocs",
12544         FT_UINT16, BASE_DEC, NULL, 0x0,
12545         NULL, HFILL }
12546     },
12547     { &hf_pn_io_iocs_frame_offset,
12548       { "IOCSFrameOffset", "pn_io.iocs_frame_offset",
12549         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12550         NULL, HFILL }
12551     },
12552     { &hf_pn_io_alarmcr_type,
12553       { "AlarmCRType", "pn_io.alarmcr_type",
12554         FT_UINT16, BASE_HEX, VALS(pn_io_alarmcr_type), 0x0,
12555         NULL, HFILL }
12556     },
12557     { &hf_pn_io_alarmcr_properties,
12558       { "AlarmCRProperties", "pn_io.alarmcr_properties",
12559         FT_UINT32, BASE_HEX, NULL, 0x0,
12560         NULL, HFILL }
12561     },
12562     { &hf_pn_io_alarmcr_properties_priority,
12563       { "priority", "pn_io.alarmcr_properties.priority",
12564         FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_priority), 0x00000001,
12565         NULL, HFILL }
12566     },
12567     { &hf_pn_io_alarmcr_properties_transport,
12568       { "Transport", "pn_io.alarmcr_properties.transport",
12569         FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_transport), 0x00000002,
12570         NULL, HFILL }
12571     },
12572     { &hf_pn_io_alarmcr_properties_reserved,
12573       { "Reserved", "pn_io.alarmcr_properties.reserved",
12574         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC,
12575         NULL, HFILL }
12576     },
12577     { &hf_pn_io_rta_timeoutfactor,
12578       { "RTATimeoutFactor", "pn_io.rta_timeoutfactor",
12579         FT_UINT16, BASE_DEC, NULL, 0x0,
12580         NULL, HFILL }
12581     },  /* XXX - special values */
12582     { &hf_pn_io_rta_retries,
12583       { "RTARetries", "pn_io.rta_retries",
12584         FT_UINT16, BASE_DEC, NULL, 0x0,
12585         NULL, HFILL }
12586     },  /* XXX - only values 3 - 15 allowed */
12587     { &hf_pn_io_localalarmref,
12588       { "LocalAlarmReference", "pn_io.localalarmref",
12589         FT_UINT16, BASE_HEX, NULL, 0x0,
12590         NULL, HFILL }
12591     },  /* XXX - special values */
12592     { &hf_pn_io_remotealarmref,
12593       { "RemoteAlarmReference", "pn_io.remotealarmref",
12594         FT_UINT16, BASE_HEX, NULL, 0x0,
12595         NULL, HFILL }
12596     },  /* XXX - special values */
12597     { &hf_pn_io_maxalarmdatalength,
12598       { "MaxAlarmDataLength", "pn_io.maxalarmdatalength",
12599         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12600         NULL, HFILL }
12601     },  /* XXX - only values 200 - 1432 allowed */
12602     { &hf_pn_io_alarmcr_tagheaderhigh,
12603       { "AlarmCRTagHeaderHigh", "pn_io.alarmcr_tagheaderhigh",
12604         FT_UINT16, BASE_HEX, NULL, 0x0,
12605         NULL, HFILL }
12606     },  /* XXX - 16 bitfield! */
12607     { &hf_pn_io_alarmcr_tagheaderlow,
12608       { "AlarmCRTagHeaderLow", "pn_io.alarmcr_tagheaderlow",
12609         FT_UINT16, BASE_HEX, NULL, 0x0,
12610         NULL, HFILL }
12611     },  /* XXX - 16 bitfield!*/
12612     { &hf_pn_io_api_tree,
12613       { "API", "pn_io.api_tree",
12614         FT_NONE, BASE_NONE, NULL, 0x0,
12615         NULL, HFILL }
12616     },
12617     { &hf_pn_io_module_tree,
12618       { "Module", "pn_io.module_tree",
12619         FT_NONE, BASE_NONE, NULL, 0x0,
12620         NULL, HFILL }
12621     },
12622     { &hf_pn_io_submodule_tree,
12623       { "Submodule", "pn_io.submodule_tree",
12624         FT_NONE, BASE_NONE, NULL, 0x0,
12625         NULL, HFILL }
12626     },
12627     { &hf_pn_io_io_data_object,
12628       { "IODataObject", "pn_io.io_data_object",
12629         FT_NONE, BASE_NONE, NULL, 0x0,
12630         NULL, HFILL }
12631     },
12632     { &hf_pn_io_io_data_object_frame_offset,
12633         { "IODataObjectFrameOffset", "pn_io.io_data_object.frame_offset",
12634         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12635         NULL, HFILL }
12636     },
12637     { &hf_pn_io_io_cs,
12638       { "IOCS", "pn_io.io_cs",
12639         FT_NONE, BASE_NONE, NULL, 0x0,
12640         NULL, HFILL }
12641     },
12642     { &hf_pn_io_substitutionmode,
12643       { "Substitutionmode", "pn_io.substitutionmode",
12644         FT_UINT16, BASE_HEX, VALS(pn_io_substitutionmode), 0x0,
12645         NULL, HFILL }
12646     },
12647     { &hf_pn_io_IRData_uuid,
12648       { "IRDataUUID", "pn_io.IRData_uuid",
12649         FT_GUID, BASE_NONE, NULL, 0x0,
12650         NULL, HFILL }
12651     },
12652     { &hf_pn_io_ar_uuid,
12653       { "ARUUID", "pn_io.ar_uuid",
12654         FT_GUID, BASE_NONE, NULL, 0x0,
12655         NULL, HFILL }
12656     },
12657     { &hf_pn_io_target_ar_uuid,
12658       { "TargetARUUID", "pn_io.target_ar_uuid",
12659         FT_GUID, BASE_NONE, NULL, 0x0,
12660         NULL, HFILL }
12661     },
12662     { &hf_pn_io_ar_discriminator,
12663       { "Discriminator", "pn_io.ar_discriminator",
12664         FT_BYTES, BASE_NONE, NULL, 0x0,
12665         NULL, HFILL }
12666     },
12667     { &hf_pn_io_ar_configid,
12668       { "ConfigID", "pn_io.ar_configid",
12669         FT_BYTES, BASE_NONE, NULL, 0x0,
12670         NULL, HFILL }
12671     },
12672     { &hf_pn_io_ar_arnumber,
12673       { "ARnumber", "pn_io.ar_arnumber",
12674         FT_UINT16, BASE_HEX, VALS(pn_io_ar_arnumber), 0x0007,
12675         NULL, HFILL }
12676     },
12677     { &hf_pn_io_ar_arresource,
12678       { "ARresource", "pn_io.ar_arnumber",
12679         FT_UINT16, BASE_HEX, VALS(pn_io_ar_arresource), 0x0018,
12680         NULL, HFILL }
12681     },
12682     { &hf_pn_io_ar_arreserved,
12683       { "ARreserved", "pn_io.ar_arreserved",
12684         FT_UINT16, BASE_HEX, NULL, 0xFFE0,
12685         NULL, HFILL }
12686     },
12687     { &hf_pn_io_ar_selector,
12688       { "Selector", "pn_io.ar_selector",
12689         FT_UINT16, BASE_HEX, NULL, 0x0,
12690         NULL, HFILL }
12691     },
12692     { &hf_pn_io_api,
12693       { "API", "pn_io.api",
12694         FT_UINT32, BASE_HEX, NULL, 0x0,
12695         NULL, HFILL }
12696     },
12697     { &hf_pn_io_slot_nr,
12698       { "SlotNumber", "pn_io.slot_nr",
12699         FT_UINT16, BASE_HEX, NULL, 0x0,
12700         NULL, HFILL }
12701     },
12702     { &hf_pn_io_subslot_nr,
12703       { "SubslotNumber", "pn_io.subslot_nr",
12704         FT_UINT16, BASE_HEX, NULL, 0x0,
12705         NULL, HFILL }
12706     },
12707     { &hf_pn_io_index,
12708       { "Index", "pn_io.index",
12709         FT_UINT16, BASE_HEX, VALS(pn_io_index), 0x0,
12710         NULL, HFILL }
12711     },
12712     { &hf_pn_io_seq_number,
12713       { "SeqNumber", "pn_io.seq_number",
12714         FT_UINT16, BASE_DEC, NULL, 0x0,
12715         NULL, HFILL }
12716     },
12717     { &hf_pn_io_record_data_length,
12718       { "RecordDataLength", "pn_io.record_data_length",
12719         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12720         NULL, HFILL }
12721     },
12722     { &hf_pn_io_add_val1,
12723       { "AdditionalValue1", "pn_io.add_val1",
12724         FT_UINT16, BASE_DEC, NULL, 0x0,
12725         NULL, HFILL }
12726     },
12727     { &hf_pn_io_add_val2,
12728       { "AdditionalValue2", "pn_io.add_val2",
12729         FT_UINT16, BASE_DEC, NULL, 0x0,
12730         NULL, HFILL }
12731     },
12732     { &hf_pn_io_block_header,
12733       { "BlockHeader", "pn_io.block_header",
12734         FT_NONE, BASE_NONE, NULL, 0x0,
12735         NULL, HFILL }
12736     },
12737     { &hf_pn_io_block_type,
12738       { "BlockType", "pn_io.block_type",
12739         FT_UINT16, BASE_HEX, VALS(pn_io_block_type), 0x0,
12740         NULL, HFILL }
12741     },
12742     { &hf_pn_io_block_length,
12743       { "BlockLength", "pn_io.block_length",
12744         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12745         NULL, HFILL }
12746     },
12747     { &hf_pn_io_block_version_high,
12748       { "BlockVersionHigh", "pn_io.block_version_high",
12749         FT_UINT8, BASE_DEC, NULL, 0x0,
12750         NULL, HFILL }
12751     },
12752     { &hf_pn_io_block_version_low,
12753       { "BlockVersionLow", "pn_io.block_version_low",
12754         FT_UINT8, BASE_DEC, NULL, 0x0,
12755         NULL, HFILL }
12756     },
12757     { &hf_pn_io_sessionkey,
12758       { "SessionKey", "pn_io.session_key",
12759         FT_UINT16, BASE_DEC, NULL, 0x0,
12760         NULL, HFILL }
12761     },
12762     { &hf_pn_io_control_command,
12763       { "ControlCommand", "pn_io.control_command",
12764         FT_UINT16, BASE_HEX, NULL, 0x0,
12765         NULL, HFILL }
12766     },
12767     { &hf_pn_io_control_command_reserved,
12768       { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved",
12769         FT_UINT16, BASE_HEX, NULL, 0x0,
12770         NULL, HFILL }
12771     },
12772     { &hf_pn_io_control_command_prmend,
12773       { "PrmEnd", "pn_io.control_command.prmend",
12774         FT_UINT16, BASE_DEC, NULL, 0x0001,
12775         NULL, HFILL }
12776     },
12777     { &hf_pn_io_control_command_applready,
12778       { "ApplicationReady", "pn_io.control_command.applready",
12779         FT_UINT16, BASE_DEC, NULL, 0x0002,
12780         NULL, HFILL }
12781     },
12782     { &hf_pn_io_control_command_release,
12783       { "Release", "pn_io.control_command.release",
12784         FT_UINT16, BASE_DEC, NULL, 0x0004,
12785         NULL, HFILL }
12786     },
12787     { &hf_pn_io_control_command_done,
12788       { "Done", "pn_io.control_command.done",
12789         FT_UINT16, BASE_DEC, NULL, 0x0008,
12790         NULL, HFILL }
12791     },
12792     { &hf_pn_io_control_command_ready_for_companion,
12793       { "ReadyForCompanion", "pn_io.control_command.ready_for_companion",
12794         FT_UINT16, BASE_DEC, NULL, 0x0010,
12795         NULL, HFILL }
12796     },
12797     { &hf_pn_io_control_command_ready_for_rt_class3,
12798       { "ReadyForRT Class 3", "pn_io.control_command.ready_for_rt_class3",
12799         FT_UINT16, BASE_DEC, NULL, 0x0020,
12800         NULL, HFILL }
12801     },
12802     { &hf_pn_io_control_command_prmbegin,
12803       { "PrmBegin", "pn_io.control_command.prmbegin",
12804         FT_UINT16, BASE_DEC, VALS(pn_io_control_properties_prmbegin_vals), 0x0040,
12805         NULL, HFILL }
12806     },
12807     { &hf_pn_io_control_command_reserved_7_15,
12808       { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved_7_15",
12809         FT_UINT16, BASE_HEX, NULL, 0x0FF80,
12810         NULL, HFILL }
12811     },
12812     { &hf_pn_io_control_block_properties,
12813       { "ControlBlockProperties", "pn_io.control_block_properties",
12814         FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_vals), 0x0,
12815         NULL, HFILL }
12816     },
12817     { &hf_pn_io_control_block_properties_applready,
12818       { "ControlBlockProperties", "pn_io.control_block_properties.appl_ready",
12819         FT_UINT16, BASE_HEX, NULL, 0x0,
12820         NULL, HFILL }
12821     },
12822     { &hf_pn_io_control_block_properties_applready0,
12823       { "ApplicationReady", "pn_io.control_block_properties.appl_ready0",
12824         FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_application_ready_vals), 0x0001,
12825         NULL, HFILL }
12826     },
12827     { &hf_pn_io_SubmoduleListEntries,
12828       { "NumberOfEntries", "pn_io.SubmoduleListEntries",
12829         FT_UINT16, BASE_DEC, NULL, 0x0,
12830         NULL, HFILL }
12831     },
12832     { &hf_pn_io_error_code,
12833       { "ErrorCode", "pn_io.error_code",
12834         FT_UINT8, BASE_HEX, VALS(pn_io_error_code), 0x0,
12835         NULL, HFILL }
12836     },
12837     { &hf_pn_io_error_decode,
12838       { "ErrorDecode", "pn_io.error_decode",
12839         FT_UINT8, BASE_HEX, VALS(pn_io_error_decode), 0x0,
12840         NULL, HFILL }
12841     },
12842     { &hf_pn_io_error_code1,
12843       { "ErrorCode1", "pn_io.error_code1",
12844         FT_UINT8, BASE_DEC, VALS(pn_io_error_code1), 0x0,
12845         NULL, HFILL }
12846     },
12847     { &hf_pn_io_error_code2,
12848       { "ErrorCode2", "pn_io.error_code2",
12849         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2), 0x0,
12850         NULL, HFILL }
12851     },
12852     { &hf_pn_io_error_code1_pniorw,
12853       { "ErrorCode1", "pn_io.error_code1",
12854         FT_UINT8, BASE_DEC, VALS(pn_io_error_code1_pniorw), 0x0,
12855         NULL, HFILL }
12856     },
12857     { &hf_pn_io_error_code2_pniorw,
12858       { "ErrorCode2 for PNIORW is user specified!", "pn_io.error_code2",
12859         FT_UINT8, BASE_DEC, NULL, 0x0,
12860         NULL, HFILL }
12861     },
12862     { &hf_pn_io_error_code1_pnio,
12863       { "ErrorCode1", "pn_io.error_code1",
12864         FT_UINT8, BASE_DEC, VALS(pn_io_error_code1_pnio), 0x0,
12865         NULL, HFILL }
12866     },
12867     { &hf_pn_io_error_code2_pnio_1,
12868       { "ErrorCode2", "pn_io.error_code2",
12869         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_1), 0x0,
12870         NULL, HFILL }
12871     },
12872     { &hf_pn_io_error_code2_pnio_2,
12873       { "ErrorCode2", "pn_io.error_code2",
12874         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_2), 0x0,
12875         NULL, HFILL }
12876     },
12877     { &hf_pn_io_error_code2_pnio_3,
12878       { "ErrorCode2", "pn_io.error_code2",
12879         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_3), 0x0,
12880         NULL, HFILL }
12881     },
12882     { &hf_pn_io_error_code2_pnio_4,
12883       { "ErrorCode2", "pn_io.error_code2",
12884         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_4), 0x0,
12885         NULL, HFILL }
12886     },
12887     { &hf_pn_io_error_code2_pnio_5,
12888       { "ErrorCode2", "pn_io.error_code2",
12889         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_5), 0x0,
12890         NULL, HFILL }
12891     },
12892     { &hf_pn_io_error_code2_pnio_6,
12893       { "ErrorCode2", "pn_io.error_code2",
12894         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_6), 0x0,
12895         NULL, HFILL }
12896     },
12897     { &hf_pn_io_error_code2_pnio_7,
12898       { "ErrorCode2", "pn_io.error_code2",
12899         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_7), 0x0,
12900         NULL, HFILL }
12901     },
12902     { &hf_pn_io_error_code2_pnio_8,
12903       { "ErrorCode2", "pn_io.error_code2",
12904         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_8), 0x0,
12905         NULL, HFILL }
12906     },
12907     { &hf_pn_io_error_code2_pnio_13,
12908       { "ErrorCode2", "pn_io.error_code2",
12909         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_13), 0x0,
12910         NULL, HFILL }
12911     },
12912     { &hf_pn_io_error_code2_pnio_20,
12913       { "ErrorCode2", "pn_io.error_code2",
12914         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_20), 0x0,
12915         NULL, HFILL }
12916     },
12917     { &hf_pn_io_error_code2_pnio_21,
12918       { "ErrorCode2", "pn_io.error_code2",
12919         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_21), 0x0,
12920         NULL, HFILL }
12921     },
12922     { &hf_pn_io_error_code2_pnio_22,
12923       { "ErrorCode2", "pn_io.error_code2",
12924         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_22), 0x0,
12925         NULL, HFILL }
12926     },
12927     { &hf_pn_io_error_code2_pnio_23,
12928       { "ErrorCode2", "pn_io.error_code2",
12929         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_23), 0x0,
12930         NULL, HFILL }
12931     },
12932     { &hf_pn_io_error_code2_pnio_40,
12933       { "ErrorCode2", "pn_io.error_code2",
12934         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_40), 0x0,
12935         NULL, HFILL }
12936     },
12937     { &hf_pn_io_error_code2_pnio_60,
12938       { "ErrorCode2", "pn_io.error_code2",
12939         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_60), 0x0,
12940         NULL, HFILL }
12941     },
12942     { &hf_pn_io_error_code2_pnio_61,
12943       { "ErrorCode2", "pn_io.error_code2",
12944         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_61), 0x0,
12945         NULL, HFILL }
12946     },
12947     { &hf_pn_io_error_code2_pnio_62,
12948       { "ErrorCode2", "pn_io.error_code2",
12949         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_62), 0x0,
12950         NULL, HFILL }
12951     },
12952     { &hf_pn_io_error_code2_pnio_63,
12953       { "ErrorCode2", "pn_io.error_code2",
12954         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_63), 0x0,
12955         NULL, HFILL }
12956     },
12957     { &hf_pn_io_error_code2_pnio_64,
12958       { "ErrorCode2", "pn_io.error_code2",
12959         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_64), 0x0,
12960         NULL, HFILL }
12961     },
12962     { &hf_pn_io_error_code2_pnio_65,
12963       { "ErrorCode2", "pn_io.error_code2",
12964         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_65), 0x0,
12965         NULL, HFILL }
12966     },
12967     { &hf_pn_io_error_code2_pnio_66,
12968       { "ErrorCode2", "pn_io.error_code2",
12969         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_66), 0x0,
12970         NULL, HFILL }
12971     },
12972     { &hf_pn_io_error_code2_pnio_70,
12973       { "ErrorCode2", "pn_io.error_code2",
12974         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_70), 0x0,
12975         NULL, HFILL }
12976     },
12977     { &hf_pn_io_error_code2_pnio_71,
12978       { "ErrorCode2", "pn_io.error_code2",
12979         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_71), 0x0,
12980         NULL, HFILL }
12981     },
12982     { &hf_pn_io_error_code2_pnio_72,
12983       { "ErrorCode2", "pn_io.error_code2",
12984         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_72), 0x0,
12985         NULL, HFILL }
12986     },
12987     { &hf_pn_io_error_code2_pnio_73,
12988       { "ErrorCode2", "pn_io.error_code2",
12989         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_73), 0x0,
12990         NULL, HFILL }
12991     },
12992     { &hf_pn_io_error_code2_pnio_74,
12993       { "ErrorCode2", "pn_io.error_code2",
12994         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_74), 0x0,
12995         NULL, HFILL }
12996     },
12997     { &hf_pn_io_error_code2_pnio_75,
12998       { "ErrorCode2", "pn_io.error_code2",
12999         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_75), 0x0,
13000         NULL, HFILL }
13001     },
13002     { &hf_pn_io_error_code2_pnio_76,
13003       { "ErrorCode2", "pn_io.error_code2",
13004         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_76), 0x0,
13005         NULL, HFILL }
13006     },
13007     { &hf_pn_io_error_code2_pnio_77,
13008       { "ErrorCode2", "pn_io.error_code2",
13009         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_77), 0x0,
13010         NULL, HFILL }
13011     },
13012     { &hf_pn_io_error_code2_pnio_253,
13013       { "ErrorCode2", "pn_io.error_code2",
13014         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_253), 0x0,
13015         NULL, HFILL }
13016     },
13017     { &hf_pn_io_error_code2_pnio_255,
13018       { "ErrorCode2", "pn_io.error_code2",
13019         FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_255), 0x0,
13020         NULL, HFILL }
13021     },
13022     { &hf_pn_io_block,
13023       { "Block", "pn_io.block",
13024         FT_NONE, BASE_NONE, NULL, 0x0,
13025         NULL, HFILL }
13026     },
13027     { &hf_pn_io_alarm_type,
13028       { "AlarmType", "pn_io.alarm_type",
13029         FT_UINT16, BASE_HEX, VALS(pn_io_alarm_type), 0x0,
13030         NULL, HFILL }
13031     },
13032     { &hf_pn_io_alarm_specifier,
13033       { "AlarmSpecifier", "pn_io.alarm_specifier",
13034         FT_NONE, BASE_NONE, NULL, 0x0,
13035         NULL, HFILL }
13036     },
13037     { &hf_pn_io_alarm_specifier_sequence,
13038       { "SequenceNumber", "pn_io.alarm_specifier.sequence",
13039         FT_UINT16, BASE_HEX, NULL, 0x07FF,
13040         NULL, HFILL }
13041     },
13042     { &hf_pn_io_alarm_specifier_channel,
13043       { "ChannelDiagnosis", "pn_io.alarm_specifier.channel",
13044         FT_UINT16, BASE_HEX, NULL, 0x0800,
13045         NULL, HFILL }
13046     },
13047     { &hf_pn_io_alarm_specifier_manufacturer,
13048       { "ManufacturerSpecificDiagnosis", "pn_io.alarm_specifier.manufacturer",
13049         FT_UINT16, BASE_HEX, NULL, 0x1000,
13050         NULL, HFILL }
13051     },
13052     { &hf_pn_io_alarm_specifier_submodule,
13053       { "SubmoduleDiagnosisState", "pn_io.alarm_specifier.submodule",
13054         FT_UINT16, BASE_HEX, NULL, 0x2000,
13055         NULL, HFILL }
13056     },
13057     { &hf_pn_io_alarm_specifier_ardiagnosis,
13058       { "ARDiagnosisState", "pn_io.alarm_specifier.ardiagnosis",
13059         FT_UINT16, BASE_HEX, NULL, 0x8000,
13060         NULL, HFILL }
13061     },
13062     { &hf_pn_io_alarm_dst_endpoint,
13063       { "AlarmDstEndpoint", "pn_io.alarm_dst_endpoint",
13064         FT_UINT16, BASE_HEX, NULL, 0x0,
13065         NULL, HFILL }
13066     },
13067     { &hf_pn_io_alarm_src_endpoint,
13068       { "AlarmSrcEndpoint", "pn_io.alarm_src_endpoint",
13069         FT_UINT16, BASE_HEX, NULL, 0x0,
13070         NULL, HFILL }
13071     },
13072     { &hf_pn_io_pdu_type,
13073       { "PDUType", "pn_io.pdu_type",
13074         FT_NONE, BASE_NONE, NULL, 0x0,
13075         NULL, HFILL }
13076     },
13077     { &hf_pn_io_pdu_type_type,
13078       { "Type", "pn_io.pdu_type.type",
13079         FT_UINT8, BASE_HEX, VALS(pn_io_pdu_type), 0x0F,
13080         NULL, HFILL }
13081     },
13082     { &hf_pn_io_pdu_type_version,
13083       { "Version", "pn_io.pdu_type.version",
13084         FT_UINT8, BASE_HEX, NULL, 0xF0,
13085         NULL, HFILL }
13086     },
13087     { &hf_pn_io_add_flags,
13088       { "AddFlags", "pn_io.add_flags",
13089         FT_NONE, BASE_NONE, NULL, 0x0,
13090         NULL, HFILL }
13091     },
13092     { &hf_pn_io_window_size,
13093       { "WindowSize", "pn_io.window_size",
13094         FT_UINT8, BASE_DEC, NULL, 0x0F,
13095         NULL, HFILL }
13096     },
13097     { &hf_pn_io_tack,
13098       { "TACK", "pn_io.tack",
13099         FT_UINT8, BASE_HEX, NULL, 0xF0,
13100         NULL, HFILL }
13101     },
13102     { &hf_pn_io_send_seq_num,
13103       { "SendSeqNum", "pn_io.send_seq_num",
13104         FT_UINT16, BASE_HEX, NULL, 0x0,
13105         NULL, HFILL }
13106     },
13107     { &hf_pn_io_ack_seq_num,
13108       { "AckSeqNum", "pn_io.ack_seq_num",
13109         FT_UINT16, BASE_HEX, NULL, 0x0,
13110         NULL, HFILL }
13111     },
13112     { &hf_pn_io_var_part_len,
13113       { "VarPartLen", "pn_io.var_part_len",
13114         FT_UINT16, BASE_HEX, NULL, 0x0,
13115         NULL, HFILL }
13116     },
13117     { &hf_pn_io_module_ident_number,
13118       { "ModuleIdentNumber", "pn_io.module_ident_number",
13119         FT_UINT32, BASE_HEX, NULL, 0x0,
13120         NULL, HFILL }
13121     },
13122     { &hf_pn_io_submodule_ident_number,
13123       { "SubmoduleIdentNumber", "pn_io.submodule_ident_number",
13124         FT_UINT32, BASE_HEX, NULL, 0x0,
13125         NULL, HFILL }
13126     },
13127
13128     { &hf_pn_io_number_of_modules,
13129       { "NumberOfModules", "pn_io.number_of_modules",
13130         FT_UINT16, BASE_HEX, NULL, 0x0,
13131         NULL, HFILL }
13132     },
13133     { &hf_pn_io_module_properties,
13134       { "ModuleProperties", "pn_io.module_properties",
13135         FT_UINT16, BASE_HEX, NULL, 0x0,
13136         NULL, HFILL }
13137     },
13138     { &hf_pn_io_module_state,
13139       { "ModuleState", "pn_io.module_state",
13140         FT_UINT16, BASE_HEX, VALS(pn_io_module_state), 0x0,
13141         NULL, HFILL }
13142     },
13143     { &hf_pn_io_number_of_submodules,
13144       { "NumberOfSubmodules", "pn_io.number_of_submodules",
13145         FT_UINT16, BASE_DEC, NULL, 0x0,
13146         NULL, HFILL }
13147     },
13148
13149     { &hf_pn_io_submodule_properties,
13150       { "SubmoduleProperties", "pn_io.submodule_properties",
13151         FT_UINT16, BASE_HEX, NULL, 0x0,
13152         NULL, HFILL }
13153     },
13154     { &hf_pn_io_submodule_properties_type,
13155       { "Type", "pn_io.submodule_properties.type",
13156         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_type), 0x0003,
13157         NULL, HFILL }
13158     },
13159     { &hf_pn_io_submodule_properties_shared_input,
13160       { "SharedInput", "pn_io.submodule_properties.shared_input",
13161         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_shared_input), 0x0004,
13162         NULL, HFILL }
13163     },
13164     { &hf_pn_io_submodule_properties_reduce_input_submodule_data_length,
13165       { "ReduceInputSubmoduleDataLength", "pn_io.submodule_properties.reduce_input_submodule_data_length",
13166         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_input_submodule_data_length), 0x0008,
13167         NULL, HFILL }
13168     },
13169     { &hf_pn_io_submodule_properties_reduce_output_submodule_data_length,
13170       { "ReduceOutputSubmoduleDataLength", "pn_io.submodule_properties.reduce_output_submodule_data_length",
13171         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_output_submodule_data_length), 0x0010,
13172         NULL, HFILL }
13173     },
13174     { &hf_pn_io_submodule_properties_discard_ioxs,
13175       { "DiscardIOXS", "pn_io.submodule_properties.discard_ioxs",
13176         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_discard_ioxs), 0x0020,
13177         NULL, HFILL }
13178     },
13179     { &hf_pn_io_submodule_properties_reserved,
13180       { "Reserved", "pn_io.submodule_properties.reserved",
13181         FT_UINT16, BASE_HEX, NULL, 0xFFC0,
13182         NULL, HFILL }
13183     },
13184     { &hf_pn_io_submodule_state,
13185       { "SubmoduleState", "pn_io.submodule_state",
13186         FT_UINT16, BASE_HEX, NULL, 0x0,
13187         NULL, HFILL }
13188     },
13189     { &hf_pn_io_submodule_state_format_indicator,
13190       { "FormatIndicator", "pn_io.submodule_state.format_indicator",
13191         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_format_indicator), 0x8000,
13192         NULL, HFILL }
13193     },
13194     { &hf_pn_io_submodule_state_add_info,
13195       { "AddInfo", "pn_io.submodule_state.add_info",
13196         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_add_info), 0x0007,
13197         NULL, HFILL }
13198     },
13199     { &hf_pn_io_submodule_state_qualified_info,
13200       { "QualifiedInfo", "pn_io.submodule_state.qualified_info",
13201         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_qualified_info), 0x0008,
13202         NULL, HFILL }
13203     },
13204     { &hf_pn_io_submodule_state_maintenance_required,
13205       { "MaintenanceRequired", "pn_io.submodule_state.maintenance_required",
13206         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_required), 0x0010,
13207         NULL, HFILL }
13208     },
13209     { &hf_pn_io_submodule_state_maintenance_demanded,
13210       { "MaintenanceDemanded", "pn_io.submodule_state.maintenance_demanded",
13211         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_demanded), 0x0020,
13212         NULL, HFILL }
13213     },
13214     { &hf_pn_io_submodule_state_diag_info,
13215       { "DiagInfo", "pn_io.submodule_state.diag_info",
13216         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_diag_info), 0x0040,
13217         NULL, HFILL }
13218     },
13219     { &hf_pn_io_submodule_state_ar_info,
13220       { "ARInfo", "pn_io.submodule_state.ar_info",
13221         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ar_info), 0x0780,
13222         NULL, HFILL }
13223     },
13224     { &hf_pn_io_submodule_state_ident_info,
13225       { "IdentInfo", "pn_io.submodule_state.ident_info",
13226         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ident_info), 0x7800,
13227         NULL, HFILL }
13228     },
13229     { &hf_pn_io_submodule_state_detail,
13230       { "Detail", "pn_io.submodule_state.detail",
13231         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_detail), 0x7FFF,
13232         NULL, HFILL }
13233     },
13234     { &hf_pn_io_data_description_tree,
13235       { "DataDescription", "pn_io.data_description_tree",
13236         FT_NONE, BASE_NONE, NULL, 0x0,
13237         NULL, HFILL }
13238     },
13239     { &hf_pn_io_data_description,
13240       { "DataDescription", "pn_io.data_description",
13241         FT_UINT16, BASE_HEX, VALS(pn_io_data_description), 0x0,
13242         NULL, HFILL }
13243     },
13244     { &hf_pn_io_submodule_data_length,
13245       { "SubmoduleDataLength", "pn_io.submodule_data_length",
13246         FT_UINT16, BASE_DEC, NULL, 0x0,
13247         NULL, HFILL }
13248     },
13249     { &hf_pn_io_length_iocs,
13250       { "LengthIOCS", "pn_io.length_iocs",
13251         FT_UINT16, BASE_DEC, NULL, 0x0,
13252         NULL, HFILL }
13253     },
13254     { &hf_pn_io_length_iops,
13255       { "LengthIOPS", "pn_io.length_iops",
13256         FT_UINT16, BASE_DEC, NULL, 0x0,
13257         NULL, HFILL }
13258     },
13259
13260     { &hf_pn_io_iocs,
13261       { "IOCS", "pn_io.ioxs",
13262         FT_UINT8, BASE_HEX, NULL, 0x0,
13263         NULL, HFILL }
13264     },
13265     { &hf_pn_io_iops,
13266       { "IOPS", "pn_io.iops",
13267         FT_UINT8, BASE_HEX, NULL, 0x0,
13268         NULL, HFILL }
13269     },
13270     { &hf_pn_io_ioxs_extension,
13271       { "Extension (1:another IOxS follows/0:no IOxS follows)", "pn_io.ioxs.extension",
13272         FT_UINT8, BASE_HEX, NULL, 0x01,
13273         NULL, HFILL }
13274     },
13275     { &hf_pn_io_ioxs_res14,
13276       { "Reserved (should be zero)", "pn_io.ioxs.res14",
13277         FT_UINT8, BASE_HEX, NULL, 0x1E,
13278         NULL, HFILL }
13279     },
13280     { &hf_pn_io_ioxs_instance,
13281       { "Instance (only valid, if DataState is bad)",
13282         "pn_io.ioxs.instance", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs),
13283         0x60, NULL, HFILL }
13284     },
13285     { &hf_pn_io_ioxs_datastate,
13286       { "DataState (1:good/0:bad)", "pn_io.ioxs.datastate",
13287         FT_UINT8, BASE_HEX, NULL, 0x80,
13288         NULL, HFILL }
13289     },
13290     { &hf_pn_io_address_resolution_properties,
13291       { "AddressResolutionProperties", "pn_io.address_resolution_properties",
13292         FT_UINT32, BASE_HEX, NULL, 0x0,
13293         NULL, HFILL }
13294     },
13295     { &hf_pn_io_mci_timeout_factor,
13296       { "MCITimeoutFactor", "pn_io.mci_timeout_factor",
13297         FT_UINT16, BASE_DEC, NULL, 0x0,
13298         NULL, HFILL }
13299     },
13300     { &hf_pn_io_provider_station_name,
13301       { "ProviderStationName", "pn_io.provider_station_name",
13302         FT_STRING, BASE_NONE, NULL, 0x0,
13303         NULL, HFILL }
13304     },
13305     { &hf_pn_io_user_structure_identifier,
13306       { "UserStructureIdentifier", "pn_io.user_structure_identifier",
13307         FT_UINT16, BASE_HEX, VALS(pn_io_user_structure_identifier), 0x0,
13308         NULL, HFILL }
13309     },
13310     { &hf_pn_io_user_structure_identifier_manf,
13311       { "UserStructureIdentifier manufacturer specific", "pn_io.user_structure_identifier_manf",
13312         FT_UINT16, BASE_HEX, NULL, 0x0,
13313         NULL, HFILL }
13314     },
13315     { &hf_pn_io_ar_properties_reserved_1,
13316         { "Reserved_1", "pn_io.ar_properties.reserved_1",
13317            FT_UINT32, BASE_HEX, NULL, 0x000000E0,
13318            NULL, HFILL }},
13319     { &hf_pn_io_ar_properties_device_access,
13320         { "DeviceAccess", "pn_io.ar_properties.device_access",
13321           FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_DeviceAccess), 0x00000100,
13322           NULL, HFILL }},
13323     { &hf_pn_io_subframe_data,
13324       { "SubFrameData", "pn_io.subframe_data",
13325         FT_UINT32, BASE_HEX, NULL, 0x0,
13326         NULL, HFILL }
13327     },
13328     { &hf_pn_io_subframe_reserved2,
13329       { "Reserved1", "pn_io.subframe_data.reserved2",
13330         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13331         NULL, HFILL }
13332     },
13333     { &hf_pn_io_subframe_data_length,
13334       { "DataLength", "pn_io.subframe_data.data_length",
13335         FT_UINT32, BASE_HEX, NULL, 0x0000FF00,
13336         NULL, HFILL }
13337     },
13338     { &hf_pn_io_subframe_reserved1,
13339       { "Reserved1", "pn_io.subframe_data.reserved1",
13340         FT_UINT32, BASE_HEX, NULL, 0x00000080,
13341         NULL, HFILL }
13342     },
13343     { &hf_pn_io_subframe_data_position,
13344       { "DataPosition", "pn_io.subframe_data.position",
13345         FT_UINT32, BASE_HEX, NULL, 0x0000007F,
13346         NULL, HFILL }
13347     },
13348     { &hf_pn_io_subframe_data_reserved1,
13349       { "Reserved1", "pn_io.subframe_data.reserved_1",
13350         FT_UINT32, BASE_HEX, NULL, 0x00000080,
13351         NULL, HFILL }
13352     },
13353     { &hf_pn_io_subframe_data_reserved2,
13354       { "Reserved1", "pn_io.subframe_data.reserved_2",
13355         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13356         NULL, HFILL }
13357     },
13358     { &hf_pn_io_channel_number,
13359       { "ChannelNumber", "pn_io.channel_number",
13360         FT_UINT16, BASE_HEX, NULL, 0x0,
13361         NULL, HFILL }
13362     },
13363
13364     { &hf_pn_io_channel_properties,
13365       { "ChannelProperties", "pn_io.channel_properties",
13366         FT_UINT16, BASE_HEX, NULL, 0x0,
13367         NULL, HFILL }
13368     },
13369     { &hf_pn_io_channel_properties_type,
13370       { "Type", "pn_io.channel_properties.type",
13371         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_type), 0x00FF,
13372         NULL, HFILL }
13373     },
13374     { &hf_pn_io_channel_properties_accumulative,
13375       { "Accumulative", "pn_io.channel_properties.accumulative",
13376         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_accumulative_vals), 0x0100,
13377         NULL, HFILL }
13378     },
13379     { &hf_pn_io_NumberOfSubframeBlocks,
13380       { "NumberOfSubframeBlocks", "pn_io.NumberOfSubframeBlocks",
13381         FT_UINT16, BASE_DEC, NULL, 0x0,
13382         NULL, HFILL }
13383     },
13384     { &hf_pn_io_channel_properties_maintenance,
13385       { "Maintenance (Severity)", "pn_io.channel_properties.maintenance",
13386         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_maintenance), 0x0600,
13387         NULL, HFILL }
13388     },
13389       { &hf_pn_io_channel_properties_specifier,
13390         { "Specifier", "pn_io.channel_properties.specifier",
13391           FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_specifier), 0x1800,
13392           NULL, HFILL }
13393       },
13394     { &hf_pn_io_channel_properties_direction,
13395       { "Direction", "pn_io.channel_properties.direction",
13396         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_direction), 0xE000,
13397         NULL, HFILL }
13398     },
13399
13400     { &hf_pn_io_channel_error_type,
13401       { "ChannelErrorType", "pn_io.channel_error_type",
13402         FT_UINT16, BASE_HEX, VALS(pn_io_channel_error_type), 0x0,
13403         NULL, HFILL }
13404     },
13405     { &hf_pn_io_ext_channel_error_type0,
13406       { "ExtChannelErrorType", "pn_io.ext_channel_error_type0",
13407         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0), 0x0,
13408         NULL, HFILL }
13409     },
13410     { &hf_pn_io_ext_channel_error_type0x8000,
13411       { "ExtChannelErrorType", "pn_io.ext_channel_error_type0800",
13412         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8000), 0x0,
13413         NULL, HFILL }
13414     },
13415     { &hf_pn_io_ext_channel_error_type0x8001,
13416       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8001",
13417         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8001), 0x0,
13418         NULL, HFILL }
13419     },
13420     { &hf_pn_io_ext_channel_error_type0x8002,
13421       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8002",
13422         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8002), 0x0,
13423         NULL, HFILL }
13424     },
13425     { &hf_pn_io_ext_channel_error_type0x8003,
13426       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8003",
13427         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8003), 0x0,
13428         NULL, HFILL }
13429     },
13430     { &hf_pn_io_ext_channel_error_type0x8004,
13431       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8004",
13432         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8004), 0x0,
13433         NULL, HFILL }
13434     },
13435     { &hf_pn_io_ext_channel_error_type0x8005,
13436       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8005",
13437         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8005), 0x0,
13438         NULL, HFILL }
13439     },
13440     { &hf_pn_io_ext_channel_error_type0x8007,
13441       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8007",
13442         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8007), 0x0,
13443         NULL, HFILL }
13444     },
13445     { &hf_pn_io_ext_channel_error_type0x8008,
13446       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8008",
13447         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8008), 0x0,
13448         NULL, HFILL }
13449     },
13450     { &hf_pn_io_ext_channel_error_type0x800A,
13451       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800A",
13452         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800A), 0x0,
13453         NULL, HFILL }
13454     },
13455     { &hf_pn_io_ext_channel_error_type0x800B,
13456       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800B",
13457         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800B), 0x0,
13458         NULL, HFILL }
13459     },
13460     { &hf_pn_io_ext_channel_error_type0x800C,
13461       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800C",
13462         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800C), 0x0,
13463         NULL, HFILL }
13464     },
13465     { &hf_pn_io_ext_channel_error_type,
13466       { "ExtChannelErrorType", "pn_io.ext_channel_error_type",
13467         FT_UINT16, BASE_HEX, NULL, 0x0,
13468         NULL, HFILL }
13469     },
13470     { &hf_pn_io_ext_channel_add_value,
13471       { "ExtChannelAddValue", "pn_io.ext_channel_add_value",
13472         FT_UINT32, BASE_HEX, NULL, 0x0,
13473         NULL, HFILL }
13474     },
13475     { &hf_pn_io_ptcp_subdomain_id,
13476       { "PTCPSubdomainID", "pn_io.ptcp_subdomain_id",
13477         FT_GUID, BASE_NONE, NULL, 0x0,
13478         NULL, HFILL }
13479     },
13480     { &hf_pn_io_ir_data_id,
13481       { "IRDataID", "pn_io.ir_data_id",
13482         FT_GUID, BASE_NONE, NULL, 0x0,
13483         NULL, HFILL }
13484     },
13485     { &hf_pn_io_max_bridge_delay,
13486       { "MaxBridgeDelay", "pn_io.max_bridge_delay",
13487         FT_UINT32, BASE_DEC, NULL, 0x0,
13488         NULL, HFILL }
13489     },
13490     { &hf_pn_io_number_of_ports,
13491       { "NumberOfPorts", "pn_io.number_of_ports",
13492         FT_UINT32, BASE_DEC, NULL, 0x0,
13493         NULL, HFILL }
13494     },
13495     { &hf_pn_io_max_port_tx_delay,
13496       { "MaxPortTxDelay", "pn_io.max_port_tx_delay",
13497         FT_UINT32, BASE_DEC, NULL, 0x0,
13498         NULL, HFILL }
13499     },
13500     { &hf_pn_io_max_port_rx_delay,
13501       { "MaxPortRxDelay", "pn_io.max_port_rx_delay",
13502         FT_UINT32, BASE_DEC, NULL, 0x0,
13503         NULL, HFILL }
13504     },
13505    { &hf_pn_io_max_line_rx_delay,
13506      { "MaxLineRxDelay", "pn_io.max_line_rx_delay",
13507        FT_UINT32, BASE_DEC, NULL, 0x0,
13508        NULL, HFILL }
13509    },
13510    { &hf_pn_io_yellowtime,
13511      { "YellowTime", "pn_io.yellowtime",
13512        FT_UINT32, BASE_DEC, NULL, 0x0,
13513        NULL, HFILL }
13514    },
13515     { &hf_pn_io_reserved_interval_begin,
13516       { "ReservedIntervalBegin", "pn_io.reserved_interval_begin",
13517         FT_UINT32, BASE_DEC, NULL, 0x0,
13518         NULL, HFILL }
13519     },
13520     { &hf_pn_io_reserved_interval_end,
13521       { "ReservedIntervalEnd", "pn_io.reserved_interval_end",
13522         FT_UINT32, BASE_DEC, NULL, 0x0,
13523         NULL, HFILL }
13524     },
13525     { &hf_pn_io_pllwindow,
13526       { "PLLWindow", "pn_io.pllwindow",
13527         FT_UINT32, BASE_DEC, NULL, 0x0,
13528         NULL, HFILL }
13529     },
13530     { &hf_pn_io_sync_send_factor,
13531       { "SyncSendFactor", "pn_io.sync_send_factor",
13532         FT_UINT32, BASE_DEC, NULL, 0x0,
13533         NULL, HFILL }
13534     },
13535     { &hf_pn_io_sync_properties,
13536       { "SyncProperties", "pn_io.sync_properties",
13537         FT_UINT16, BASE_HEX, NULL, 0x0,
13538         NULL, HFILL }
13539     },
13540     { &hf_pn_io_sync_frame_address,
13541       { "SyncFrameAddress", "pn_io.sync_frame_address",
13542         FT_UINT16, BASE_HEX, NULL, 0x0,
13543         NULL, HFILL }
13544     },
13545     { &hf_pn_io_ptcp_timeout_factor,
13546       { "PTCPTimeoutFactor", "pn_io.ptcp_timeout_factor",
13547         FT_UINT16, BASE_DEC, NULL, 0x0,
13548         NULL, HFILL }
13549     },
13550     { &hf_pn_io_ptcp_takeover_timeout_factor,
13551       { "PTCPTakeoverTimeoutFactor", "pn_io.ptcp_takeover_timeout_factor",
13552         FT_UINT16, BASE_DEC, NULL, 0x0,
13553         NULL, HFILL }
13554     },
13555     { &hf_pn_io_ptcp_master_startup_time,
13556       { "PTCPMasterStartupTime", "pn_io.ptcp_master_startup_time",
13557         FT_UINT16, BASE_DEC, NULL, 0x0,
13558         NULL, HFILL }
13559     },
13560     { &hf_pn_io_ptcp_master_priority_1,
13561       { "PTCP_MasterPriority1", "pn_io.ptcp_master_priority_1",
13562         FT_UINT8, BASE_DEC, NULL, 0x0,
13563         NULL, HFILL }
13564     },
13565     { &hf_pn_io_ptcp_master_priority_2,
13566       { "PTCP_MasterPriority2", "pn_io.ptcp_master_priority_2",
13567         FT_UINT8, BASE_DEC, NULL, 0x0,
13568         NULL, HFILL }
13569     },
13570     { &hf_pn_io_ptcp_length_subdomain_name,
13571       { "PTCPLengthSubdomainName", "pn_io.ptcp_length_subdomain_name",
13572         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13573         NULL, HFILL }
13574     },
13575     { &hf_pn_io_ptcp_subdomain_name,
13576       { "PTCPSubdomainName", "pn_io.ptcp_subdomain_name",
13577         FT_STRING, BASE_NONE, NULL, 0x0,
13578         NULL, HFILL }
13579     },
13580     { &hf_pn_io_MultipleInterfaceMode_NameOfDevice,
13581       { "MultipleInterfaceMode.NameOfDevice", "pn_io.MultipleInterfaceMode_NameOfDevice",
13582         FT_UINT32, BASE_HEX, VALS(pn_io_MultipleInterfaceMode_NameOfDevice), 0x01,
13583         NULL, HFILL }
13584     },
13585     { &hf_pn_io_MultipleInterfaceMode_reserved_1,
13586       { "MultipleInterfaceMode.Reserved_1", "pn_io.MultipleInterfaceMode_reserved_1",
13587         FT_UINT32, BASE_HEX, NULL, 0xFFFE,
13588         NULL, HFILL }
13589     },
13590     { &hf_pn_io_MultipleInterfaceMode_reserved_2,
13591       { "MultipleInterfaceMode.Reserved_2", "pn_io.MultipleInterfaceMode_reserved_2",
13592         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13593         NULL, HFILL }
13594     },
13595     { &hf_pn_io_pdportstatistic_counter_status,
13596       { "CounterStatus", "pn_io.CounterStatus",
13597         FT_UINT16, BASE_HEX, NULL, 0x0,
13598         NULL, HFILL }
13599     },
13600     { &hf_pn_io_pdportstatistic_counter_status_ifInOctets,
13601       { "CounterStatus.ifInOctets", "pn_io.CounterStatus.ifInOctets",
13602         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0001,
13603         NULL, HFILL }
13604     },
13605     { &hf_pn_io_pdportstatistic_counter_status_ifOutOctets,
13606       { "CounterStatus.ifOutOctets", "pn_io.CounterStatus.ifOutOctets",
13607         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0002,
13608          NULL, HFILL }
13609     },
13610     { &hf_pn_io_pdportstatistic_counter_status_ifInDiscards,
13611       { "CounterStatus.ifInDiscards", "pn_io.CounterStatus.ifInDiscards",
13612         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0004,
13613         NULL, HFILL }
13614     },
13615     { &hf_pn_io_pdportstatistic_counter_status_ifOutDiscards,
13616       { "CounterStatus.ifOutDiscards", "pn_io.CounterStatus.ifOutDiscards",
13617         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0008,
13618         NULL, HFILL }
13619     },
13620     { &hf_pn_io_pdportstatistic_counter_status_ifInErrors,
13621       { "CounterStatus.ifInErrors", "pn_io.CounterStatus.ifInErrors",
13622         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0010,
13623         NULL, HFILL }
13624     },
13625     { &hf_pn_io_pdportstatistic_counter_status_ifOutErrors,
13626       { "CounterStatus.ifOutErrors", "pn_io.CounterStatus.ifOutErrors",
13627         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0020,
13628         NULL, HFILL }
13629     },
13630     { &hf_pn_io_pdportstatistic_counter_status_reserved,
13631       { "CounterStatus.Reserved", "pn_io.CounterStatus.Reserved",
13632         FT_UINT16, BASE_HEX, VALS(pn_io_pdportstatistic_counter_status_reserved), 0xFFC0,
13633         NULL, HFILL }
13634     },
13635     { &hf_pn_io_pdportstatistic_ifInOctets,
13636       { "ifInOctets", "pn_io.ifInOctets",
13637         FT_UINT32, BASE_HEX, NULL, 0x0,
13638         NULL, HFILL }
13639     },
13640     { &hf_pn_io_pdportstatistic_ifOutOctets,
13641       { "ifOutOctets", "pn_io.ifOutOctets",
13642         FT_UINT32, BASE_HEX, NULL, 0x0,
13643         NULL, HFILL }
13644     },
13645     { &hf_pn_io_pdportstatistic_ifInDiscards,
13646       { "ifInDiscards", "pn_io.ifInDiscards",
13647         FT_UINT32, BASE_HEX, NULL, 0x0,
13648         NULL, HFILL }
13649     },
13650     { &hf_pn_io_pdportstatistic_ifOutDiscards,
13651       { "ifOutDiscards", "pn_io.ifOutDiscards",
13652         FT_UINT32, BASE_HEX, NULL, 0x0,
13653         NULL, HFILL }
13654     },
13655     { &hf_pn_io_pdportstatistic_ifInErrors,
13656       { "ifInErrors", "pn_io.ifInErrors",
13657         FT_UINT32, BASE_HEX, NULL, 0x0,
13658         NULL, HFILL }
13659     },
13660     { &hf_pn_io_pdportstatistic_ifOutErrors,
13661       { "ifOutErrors", "pn_io.ifOutErrors",
13662         FT_UINT32, BASE_HEX, NULL, 0x0,
13663         NULL, HFILL }
13664     },
13665
13666     { &hf_pn_io_domain_boundary,
13667       { "DomainBoundary", "pn_io.domain_boundary",
13668         FT_UINT32, BASE_HEX, NULL, 0x0,
13669         NULL, HFILL }
13670     },
13671     { &hf_pn_io_domain_boundary_ingress,
13672       { "DomainBoundaryIngress", "pn_io.domain_boundary.ingress",
13673         FT_UINT32, BASE_HEX, NULL, 0x0,
13674         NULL, HFILL }
13675     },
13676     { &hf_pn_io_domain_boundary_egress,
13677       { "DomainBoundaryEgress", "pn_io.domain_boundary.egress",
13678         FT_UINT32, BASE_HEX, NULL, 0x0,
13679         NULL, HFILL }
13680     },
13681     { &hf_pn_io_multicast_boundary,
13682       { "MulticastBoundary", "pn_io.multicast_boundary",
13683         FT_UINT32, BASE_HEX, NULL, 0x0,
13684         NULL, HFILL }
13685     },
13686     { &hf_pn_io_adjust_properties,
13687       { "AdjustProperties", "pn_io.adjust_properties",
13688         FT_UINT16, BASE_HEX, NULL, 0x0,
13689         NULL, HFILL }
13690     },
13691     { &hf_pn_io_PreambleLength,
13692       { "Preamble Length", "pn_io.preamble_length",
13693         FT_UINT16, BASE_DEC_HEX, VALS(pn_io_preamble_length), 0x0,
13694         NULL, HFILL }
13695     },
13696     { &hf_pn_io_mau_type,
13697       { "MAUType", "pn_io.mau_type",
13698         FT_UINT16, BASE_HEX, VALS(pn_io_mau_type), 0x0,
13699         NULL, HFILL }
13700     },
13701     { &hf_pn_io_mau_type_mode,
13702       { "MAUTypeMode", "pn_io.mau_type_mode",
13703         FT_UINT16, BASE_HEX, VALS(pn_io_mau_type_mode), 0x0,
13704         NULL, HFILL }
13705     },
13706     { &hf_pn_io_dcp_boundary_value,
13707     { "DCPBoundary", "pn_io.dcp_boundary_value",
13708         FT_UINT32, BASE_HEX, NULL, 0x0,
13709         NULL, HFILL }
13710     },
13711     { &hf_pn_io_dcp_boundary_value_bit0,
13712       { "DCPBoundary", "pn_io.dcp_boundary_value_bit0",
13713          FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit0), 0x1,
13714          NULL, HFILL }
13715     },
13716     { &hf_pn_io_dcp_boundary_value_bit1,
13717       { "DCPBoundary", "pn_io.dcp_boundary_value_bit1",
13718         FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit1), 0x2,
13719         NULL, HFILL }
13720     },
13721     { &hf_pn_io_dcp_boundary_value_otherbits,
13722       { "DCPBoundary", "pn_io.dcp_boundary_value_otherbits",
13723         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC,
13724         NULL, HFILL }
13725     },
13726     { &hf_pn_io_peer_to_peer_boundary_value,
13727       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value",
13728         FT_UINT32, BASE_HEX, NULL, 0x0,
13729         NULL, HFILL }
13730     },
13731     { &hf_pn_io_peer_to_peer_boundary_value_bit0,
13732       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit0",
13733         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit0), 0x1,
13734         NULL, HFILL }
13735     },
13736     { &hf_pn_io_peer_to_peer_boundary_value_bit1,
13737       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit1",
13738         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit1), 0x2,
13739         NULL, HFILL }
13740     },
13741     { &hf_pn_io_peer_to_peer_boundary_value_bit2,
13742       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit2",
13743         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit2), 0x4,
13744         NULL, HFILL }
13745     },
13746       { &hf_pn_io_peer_to_peer_boundary_value_otherbits,
13747     { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_otherbits",
13748         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF8,
13749         NULL, HFILL }
13750     },
13751     { &hf_pn_io_port_state,
13752       { "PortState", "pn_io.port_state",
13753         FT_UINT16, BASE_HEX, VALS(pn_io_port_state), 0x0,
13754         NULL, HFILL }
13755     },
13756     { &hf_pn_io_line_delay,
13757       { "LineDelay", "pn_io.line_delay",
13758         FT_UINT32, BASE_HEX, NULL, 0x0,
13759         "LineDelay in nanoseconds", HFILL }
13760     },
13761     { &hf_pn_io_line_delay_value,
13762       { "LineDelayValue", "pn_io.line_delay_value",
13763         FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_line_delay_value), 0x7FFFFFFF,
13764         NULL, HFILL }
13765     },
13766     { &hf_pn_io_cable_delay_value,
13767       { "CableDelayValue", "pn_io.cable_delay_value",
13768          FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_cable_delay_value), 0x7FFFFFFF,
13769         NULL, HFILL }
13770     },
13771     { &hf_pn_io_line_delay_format_indicator,
13772       { "LineDelayFormatIndicator", "pn_io.line_delay_format_indicator",
13773         FT_UINT32, BASE_HEX, NULL, 0x80000000,
13774         "LineDelay FormatIndicator", HFILL }
13775     },
13776     { &hf_pn_io_number_of_peers,
13777       { "NumberOfPeers", "pn_io.number_of_peers",
13778         FT_UINT8, BASE_DEC, NULL, 0x0,
13779         NULL, HFILL }
13780     },
13781     { &hf_pn_io_length_peer_port_id,
13782       { "LengthPeerPortID", "pn_io.length_peer_port_id",
13783         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13784         NULL, HFILL }
13785     },
13786     { &hf_pn_io_peer_port_id,
13787       { "PeerPortID", "pn_io.peer_port_id",
13788         FT_STRING, BASE_NONE, NULL, 0x0,
13789         NULL, HFILL }
13790     },
13791     { &hf_pn_io_length_peer_chassis_id,
13792       { "LengthPeerChassisID", "pn_io.length_peer_chassis_id",
13793         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13794         NULL, HFILL }
13795     },
13796     { &hf_pn_io_peer_chassis_id,
13797       { "PeerChassisID", "pn_io.peer_chassis_id",
13798         FT_STRING, BASE_NONE, NULL, 0x0,
13799         NULL, HFILL }
13800     },
13801     { &hf_pn_io_length_own_chassis_id,
13802       { "LengthOwnChassisID", "pn_io.length_own_chassis_id",
13803         FT_UINT8, BASE_DEC, NULL, 0x0,
13804         NULL, HFILL }
13805     },
13806     { &hf_pn_io_own_chassis_id,
13807       { "OwnChassisID", "pn_io.own_chassis_id",
13808         FT_STRING, BASE_NONE, NULL, 0x0,
13809         NULL, HFILL }
13810     },
13811     { &hf_pn_io_length_own_port_id,
13812       { "LengthOwnPortID", "pn_io.length_own_port_id",
13813         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13814         NULL, HFILL }
13815     },
13816     { &hf_pn_io_own_port_id,
13817       { "OwnPortID", "pn_io.own_port_id",
13818         FT_STRING, BASE_NONE, NULL, 0x0,
13819         NULL, HFILL }
13820     },
13821     { &hf_pn_io_peer_macadd,
13822       { "PeerMACAddress", "pn_io.peer_macadd",
13823         FT_ETHER, BASE_NONE, NULL, 0x0,
13824         NULL, HFILL }
13825     },
13826     { &hf_pn_io_macadd,
13827       { "MACAddress", "pn_io.macadd",
13828         FT_ETHER, BASE_NONE, NULL, 0x0,
13829         NULL, HFILL }
13830     },
13831     { &hf_pn_io_media_type,
13832       { "MediaType", "pn_io.media_type",
13833         FT_UINT32, BASE_HEX, VALS(pn_io_media_type), 0x0,
13834         NULL, HFILL }
13835     },
13836
13837     { &hf_pn_io_ethertype,
13838       { "Ethertype", "pn_io.ethertype",
13839         FT_UINT16, BASE_HEX, NULL, 0x0,
13840         NULL, HFILL }
13841     },
13842     { &hf_pn_io_rx_port,
13843       { "RXPort", "pn_io.rx_port",
13844         FT_UINT8, BASE_DEC, NULL, 0x0,
13845         NULL, HFILL }
13846     },
13847     { &hf_pn_io_frame_details,
13848       { "FrameDetails", "pn_io.frame_details",
13849         FT_UINT8, BASE_HEX, NULL, 0x0,
13850         NULL, HFILL }
13851     },
13852     { &hf_pn_io_frame_details_sync_frame,
13853       { "SyncFrame", "pn_io.frame_details.sync_frame",
13854         FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_sync_master_vals), 0x03,
13855         NULL, HFILL }
13856     },
13857     { &hf_pn_io_frame_details_meaning_frame_send_offset,
13858       { "Meaning", "pn_io.frame_details.meaning_frame_send_offset",
13859         FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_meaning_frame_send_offset_vals), 0x0C,
13860         NULL, HFILL }
13861     },
13862     { &hf_pn_io_frame_details_reserved,
13863       { "Reserved", "pn_io.frame_details.reserved",
13864         FT_UINT8, BASE_HEX, NULL, 0xF0,
13865         NULL, HFILL }
13866     },
13867     { &hf_pn_io_nr_of_tx_port_groups,
13868       { "NumberOfTxPortGroups", "pn_io.nr_of_tx_port_groups",
13869         FT_UINT8, BASE_DEC, NULL, 0x0,
13870         NULL, HFILL }
13871     },
13872     { &hf_pn_io_TxPortGroupProperties,
13873       { "TxPortGroupProperties", "pn_io.tx_port_properties",
13874         FT_UINT8, BASE_HEX, NULL, 0x0,
13875         NULL, HFILL }
13876     },
13877     { &hf_pn_io_TxPortGroupProperties_bit0,
13878       { "TxPortLocal", "pn_io.tx_port_properties_bit_0",
13879         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x01,
13880         NULL, HFILL }
13881     },
13882     { &hf_pn_io_TxPortGroupProperties_bit1,
13883       { "TxPort_1", "pn_io.tx_port_properties_bit_1",
13884         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x02,
13885         NULL, HFILL }
13886     },
13887     { &hf_pn_io_TxPortGroupProperties_bit2,
13888       { "TxPort_2", "pn_io.tx_port_properties_bit_2",
13889         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x04,
13890         NULL, HFILL }
13891     },
13892     { &hf_pn_io_TxPortGroupProperties_bit3,
13893       { "TxPort_3", "pn_io.tx_port_properties_bit_3",
13894         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x08,
13895         NULL, HFILL }
13896     },
13897     { &hf_pn_io_TxPortGroupProperties_bit4,
13898       { "TxPort_4", "pn_io.tx_port_properties_bit_4",
13899         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x10,
13900         NULL, HFILL }
13901     },
13902     { &hf_pn_io_TxPortGroupProperties_bit5,
13903       { "TxPort_5", "pn_io.tx_port_properties_bit_5",
13904         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x20,
13905         NULL, HFILL }
13906     },
13907     { &hf_pn_io_TxPortGroupProperties_bit6,
13908       { "TxPort_6", "pn_io.tx_port_properties_bit_6",
13909         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x40,
13910         NULL, HFILL }
13911     },
13912     { &hf_pn_io_TxPortGroupProperties_bit7,
13913       { "TxPort_7", "pn_io.tx_port_properties_bit_7",
13914         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x80,
13915         NULL, HFILL }
13916     },
13917
13918     { &hf_pn_io_start_of_red_frame_id,
13919       { "StartOfRedFrameID", "pn_io.start_of_red_frame_id",
13920         FT_UINT16, BASE_HEX, NULL, 0x0,
13921         NULL, HFILL }
13922     },
13923     { &hf_pn_io_end_of_red_frame_id,
13924       { "EndOfRedFrameID", "pn_io.end_of_red_frame_id",
13925         FT_UINT16, BASE_HEX, NULL, 0x0,
13926         NULL, HFILL }
13927     },
13928     { &hf_pn_io_ir_begin_end_port,
13929       { "Port", "pn_io.ir_begin_end_port",
13930         FT_NONE, BASE_NONE, NULL, 0x0,
13931         NULL, HFILL }
13932     },
13933     { &hf_pn_io_number_of_assignments,
13934       { "NumberOfAssignments", "pn_io.number_of_assignments",
13935         FT_UINT32, BASE_DEC, NULL, 0x0,
13936         NULL, HFILL }
13937     },
13938     { &hf_pn_io_number_of_phases,
13939       { "NumberOfPhases", "pn_io.number_of_phases",
13940         FT_UINT32, BASE_DEC, NULL, 0x0,
13941         NULL, HFILL }
13942     },
13943     { &hf_pn_io_red_orange_period_begin_tx,
13944       { "RedOrangePeriodBegin [TX]", "pn_io.red_orange_period_begin_tx",
13945         FT_UINT32, BASE_DEC, NULL, 0x0,
13946         NULL, HFILL }
13947     },
13948     { &hf_pn_io_orange_period_begin_tx,
13949       { "OrangePeriodBegin [TX]", "pn_io.orange_period_begin_tx",
13950         FT_UINT32, BASE_DEC, NULL, 0x0,
13951         NULL, HFILL }
13952     },
13953     { &hf_pn_io_green_period_begin_tx,
13954       { "GreenPeriodBegin [TX]", "pn_io.green_period_begin_tx",
13955         FT_UINT32, BASE_DEC, NULL, 0x0,
13956         NULL, HFILL }
13957     },
13958     { &hf_pn_io_red_orange_period_begin_rx,
13959       { "RedOrangePeriodBegin [RX]", "pn_io.red_orange_period_begin_rx",
13960         FT_UINT32, BASE_DEC, NULL, 0x0,
13961         NULL, HFILL }
13962     },
13963     { &hf_pn_io_orange_period_begin_rx,
13964       { "OrangePeriodBegin [RX]", "pn_io.orange_period_begin_rx",
13965         FT_UINT32, BASE_DEC, NULL, 0x0,
13966         NULL, HFILL }
13967     },
13968     { &hf_pn_io_green_period_begin_rx,
13969       { "GreenPeriodBegin [RX]", "pn_io.green_period_begin_rx",
13970         FT_UINT32, BASE_DEC, NULL, 0x0,
13971         NULL, HFILL }
13972     },
13973     { &hf_pn_ir_tx_phase_assignment,
13974       { "TXPhaseAssignment", "pn_io.tx_phase_assignment_sub",
13975         FT_NONE, BASE_NONE, NULL, 0x0,
13976         NULL, HFILL }
13977     },
13978     { &hf_pn_io_tx_phase_assignment_begin_value,
13979       { "AssignedValueForReservedBegin", "pn_io.tx_phase_assignment_begin_value",
13980         FT_UINT16, BASE_DEC, NULL, 0x0F,
13981         NULL, HFILL }
13982     },
13983     { &hf_pn_io_tx_phase_assignment_orange_begin,
13984       { "AssignedValueForOrangeBegin", "pn_io.tx_phase_assignment_orange_begin",
13985         FT_UINT16, BASE_DEC, NULL, 0x0F0,
13986         NULL, HFILL }
13987     },
13988     { &hf_pn_io_tx_phase_assignment_end_reserved,
13989       { "AssignedValueForReservedEnd", "pn_io.tx_phase_assignment_end_reserved",
13990         FT_UINT16, BASE_DEC, NULL, 0x0F00,
13991         NULL, HFILL }
13992     },
13993     { &hf_pn_io_tx_phase_assignment_reserved,
13994       { "Reserved should be 0", "pn_io.tx_phase_assignment_reserved",
13995         FT_UINT16, BASE_DEC, NULL, 0x0F000,
13996         NULL, HFILL }
13997     },
13998     { &hf_pn_ir_rx_phase_assignment,
13999       { "RXPhaseAssignment", "pn_io.rx_phase_assignment_sub",
14000         FT_NONE, BASE_NONE, NULL, 0x0,
14001         NULL, HFILL }
14002     },
14003     { &hf_pn_io_slot,
14004       { "Slot", "pn_io.slot",
14005         FT_NONE, BASE_NONE, NULL, 0x0,
14006         NULL, HFILL }
14007     },
14008     { &hf_pn_io_subslot,
14009       { "Subslot", "pn_io.subslot",
14010         FT_NONE, BASE_NONE, NULL, 0x0,
14011         NULL, HFILL }
14012     },
14013     { &hf_pn_io_number_of_slots,
14014       { "NumberOfSlots", "pn_io.number_of_slots",
14015         FT_UINT16, BASE_DEC, NULL, 0x0,
14016         NULL, HFILL }
14017     },
14018     { &hf_pn_io_number_of_subslots,
14019       { "NumberOfSubslots", "pn_io.number_of_subslots",
14020         FT_UINT16, BASE_DEC, NULL, 0x0,
14021         NULL, HFILL }
14022     },
14023     { &hf_pn_io_maintenance_required_power_budget,
14024       { "MaintenanceRequiredPowerBudget", "pn_io.maintenance_required_power_budget",
14025         FT_UINT32, BASE_HEX, NULL, 0x0,
14026         NULL, HFILL }
14027     },
14028     { &hf_pn_io_maintenance_demanded_power_budget,
14029       { "MaintenanceDemandedPowerBudget", "pn_io.maintenance_demanded_power_budget",
14030         FT_UINT32, BASE_HEX, NULL, 0x0,
14031         NULL, HFILL }
14032     },
14033     { &hf_pn_io_error_power_budget,
14034       { "ErrorPowerBudget", "pn_io.error_power_budget",
14035         FT_UINT32, BASE_HEX, NULL, 0x0,
14036         NULL, HFILL }
14037     },
14038     { &hf_pn_io_fiber_optic_type,
14039       { "FiberOpticType", "pn_io.fiber_optic_type",
14040         FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_type), 0x0,
14041         NULL, HFILL }
14042     },
14043     { &hf_pn_io_fiber_optic_cable_type,
14044       { "FiberOpticCableType", "pn_io.fiber_optic_cable_type",
14045         FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_cable_type), 0x0,
14046         NULL, HFILL }
14047     },
14048     { &hf_pn_io_controller_appl_cycle_factor,
14049       { "ControllerApplicationCycleFactor", "pn_io.controller_appl_cycle_factor",
14050         FT_UINT16, BASE_DEC, NULL, 0x0,
14051         NULL, HFILL }
14052     },
14053     { &hf_pn_io_time_data_cycle,
14054       { "TimeDataCycle", "pn_io.time_data_cycle",
14055         FT_UINT16, BASE_DEC, NULL, 0x0,
14056         NULL, HFILL }
14057     },
14058     { &hf_pn_io_time_io_input,
14059       { "TimeIOInput", "pn_io.time_io_input",
14060         FT_UINT32, BASE_DEC, NULL, 0x0,
14061         NULL, HFILL }
14062     },
14063     { &hf_pn_io_time_io_output,
14064       { "TimeIOOutput", "pn_io.time_io_output",
14065         FT_UINT32, BASE_DEC, NULL, 0x0,
14066         NULL, HFILL }
14067     },
14068     { &hf_pn_io_time_io_input_valid,
14069       { "TimeIOInputValid", "pn_io.time_io_input_valid",
14070         FT_UINT32, BASE_DEC, NULL, 0x0,
14071         NULL, HFILL }
14072     },
14073     { &hf_pn_io_time_io_output_valid,
14074       { "TimeIOOutputValid", "pn_io.time_io_output_valid",
14075         FT_UINT32, BASE_DEC, NULL, 0x0,
14076         NULL, HFILL }
14077     },
14078     { &hf_pn_io_maintenance_status,
14079       { "MaintenanceStatus", "pn_io.maintenance_status",
14080         FT_UINT32, BASE_HEX, NULL, 0x0,
14081         NULL, HFILL }
14082     },
14083     { &hf_pn_io_maintenance_status_required,
14084       { "Required", "pn_io.maintenance_status_required",
14085         FT_UINT32, BASE_HEX, NULL, 0x0001,
14086         NULL, HFILL }
14087     },
14088     { &hf_pn_io_maintenance_status_demanded,
14089       { "Demanded", "pn_io.maintenance_status_demanded",
14090         FT_UINT32, BASE_HEX, NULL, 0x0002,
14091         NULL, HFILL }
14092     },
14093     { &hf_pn_io_vendor_id_high,
14094       { "VendorIDHigh", "pn_io.vendor_id_high",
14095         FT_UINT8, BASE_HEX, NULL, 0x0,
14096         NULL, HFILL }
14097     },
14098     { &hf_pn_io_vendor_id_low,
14099       { "VendorIDLow", "pn_io.vendor_id_low",
14100         FT_UINT8, BASE_HEX, NULL, 0x0,
14101         NULL, HFILL }
14102     },
14103     { &hf_pn_io_vendor_block_type,
14104       { "VendorBlockType", "pn_io.vendor_block_type",
14105         FT_UINT16, BASE_HEX, NULL, 0x0,
14106         NULL, HFILL }
14107     },
14108     { &hf_pn_io_order_id,
14109       { "OrderID", "pn_io.order_id",
14110         FT_STRING, BASE_NONE, NULL, 0x0,
14111         NULL, HFILL }
14112     },
14113     { &hf_pn_io_im_serial_number,
14114       { "IMSerialNumber", "pn_io.im_serial_number",
14115         FT_STRING, BASE_NONE, NULL, 0x0,
14116         NULL, HFILL }
14117     },
14118     { &hf_pn_io_im_hardware_revision,
14119       { "IMHardwareRevision", "pn_io.im_hardware_revision",
14120         FT_UINT16, BASE_HEX, NULL, 0x0,
14121         NULL, HFILL }
14122     },
14123       /* XXX - better use a simple char here -> vals */
14124     { &hf_pn_io_im_revision_prefix,
14125       { "IMRevisionPrefix", "pn_io.im_revision_prefix",
14126         FT_CHAR, BASE_HEX, VALS(pn_io_im_revision_prefix_vals), 0x0,
14127         NULL, HFILL }
14128     },
14129     { &hf_pn_io_im_sw_revision_functional_enhancement,
14130       { "IMSWRevisionFunctionalEnhancement", "pn_io.im_sw_revision_functional_enhancement",
14131         FT_UINT8, BASE_HEX, NULL, 0x0,
14132         NULL, HFILL }
14133     },
14134     { &hf_pn_io_im_revision_bugfix,
14135       { "IM_SWRevisionBugFix", "pn_io.im_revision_bugfix",
14136         FT_UINT8, BASE_HEX, NULL, 0x0,
14137         NULL, HFILL }
14138     },
14139     { &hf_pn_io_im_sw_revision_internal_change,
14140       { "IMSWRevisionInternalChange", "pn_io.im_sw_revision_internal_change",
14141         FT_UINT8, BASE_HEX, NULL, 0x0,
14142         NULL, HFILL }
14143     },
14144     { &hf_pn_io_im_revision_counter,
14145       { "IMRevisionCounter", "pn_io.im_revision_counter",
14146         FT_UINT16, BASE_HEX, NULL, 0x0,
14147         NULL, HFILL }
14148     },
14149     { &hf_pn_io_im_profile_id,
14150       { "IMProfileID", "pn_io.im_profile_id",
14151         FT_UINT16, BASE_HEX, NULL, 0x0,
14152         NULL, HFILL }
14153     },
14154     { &hf_pn_io_im_profile_specific_type,
14155       { "IMProfileSpecificType", "pn_io.im_profile_specific_type",
14156         FT_UINT16, BASE_HEX, NULL, 0x0,
14157         NULL, HFILL }
14158     },
14159     { &hf_pn_io_im_version_major,
14160       { "IMVersionMajor", "pn_io.im_version_major",
14161         FT_UINT8, BASE_HEX, NULL, 0x0,
14162         NULL, HFILL }
14163     },
14164     { &hf_pn_io_im_version_minor,
14165       { "IMVersionMinor", "pn_io.im_version_minor",
14166         FT_UINT8, BASE_HEX, NULL, 0x0,
14167         NULL, HFILL }
14168     },
14169     { &hf_pn_io_im_supported,
14170       { "IM_Supported", "pn_io.im_supported",
14171         FT_UINT16, BASE_HEX, NULL, 0x0,
14172         NULL, HFILL }
14173     },
14174     { &hf_pn_io_im_numberofentries,
14175       { "NumberOfEntries", "pn_io.im_numberofentries",
14176         FT_UINT16, BASE_HEX, NULL, 0x0,
14177         NULL, HFILL }
14178     },
14179     { &hf_pn_io_im_annotation,
14180       { "IM Annotation", "pn_io.im_annotation",
14181         FT_STRING, BASE_NONE, NULL, 0x0,
14182         NULL, HFILL }
14183     },
14184     { &hf_pn_io_im_order_id,
14185       { "IM Order ID", "pn_io.im_order_id",
14186         FT_STRING, BASE_NONE, NULL, 0x0,
14187         NULL, HFILL }
14188     },
14189     { &hf_pn_io_number_of_ars,
14190       { "NumberOfARs", "pn_io.number_of_ars",
14191         FT_UINT16, BASE_DEC, NULL, 0x0,
14192         NULL, HFILL }
14193     },
14194     { &hf_pn_io_cycle_counter,
14195       { "CycleCounter", "pn_io.cycle_counter",
14196         FT_UINT16, BASE_DEC, NULL, 0x0,
14197         NULL, HFILL }
14198     },
14199     { &hf_pn_io_data_status,
14200       { "DataStatus", "pn_io.ds",
14201         FT_UINT8, BASE_HEX, 0, 0x0,
14202         NULL, HFILL }
14203     },
14204     { &hf_pn_io_data_status_res67,
14205       { "Reserved (should be zero)", "pn_io.ds_res67",
14206         FT_UINT8, BASE_HEX, 0, 0xc0,
14207         NULL, HFILL }
14208     },
14209     { &hf_pn_io_data_status_ok,
14210       { "StationProblemIndicator (1:Ok/0:Problem)", "pn_io.ds_ok",
14211         FT_UINT8, BASE_HEX, 0, 0x20,
14212         NULL, HFILL }
14213     },
14214     { &hf_pn_io_data_status_operate,
14215       { "ProviderState (1:Run/0:Stop)", "pn_io.ds_operate",
14216         FT_UINT8, BASE_HEX, 0, 0x10,
14217         NULL, HFILL }
14218     },
14219     { &hf_pn_io_data_status_res3,
14220       { "Reserved (should be zero)", "pn_io.ds_res3",
14221         FT_UINT8, BASE_HEX, 0, 0x08,
14222         NULL, HFILL }
14223     },
14224     { &hf_pn_io_data_status_valid,
14225       { "DataValid (1:Valid/0:Invalid)", "pn_io.ds_valid",
14226         FT_UINT8, BASE_HEX, 0, 0x04,
14227         NULL, HFILL }
14228     },
14229     { &hf_pn_io_data_status_res1,
14230       { "primary AR of a given AR-set is present (0:One/ 1:None)", "pn_io.ds_res1",
14231         FT_UINT8, BASE_HEX, 0, 0x02,
14232         NULL, HFILL }
14233     },
14234     { &hf_pn_io_data_status_primary,
14235       { "State (1:Primary/0:Backup)", "pn_io.ds_primary",
14236         FT_UINT8, BASE_HEX, 0, 0x01,
14237         NULL, HFILL }
14238     },
14239     { &hf_pn_io_transfer_status,
14240       { "TransferStatus", "pn_io.transfer_status",
14241         FT_UINT8, BASE_DEC, NULL, 0x0,
14242         NULL, HFILL }
14243     },
14244     { &hf_pn_io_actual_local_time_stamp,
14245       { "ActualLocalTimeStamp", "pn_io.actual_local_time_stamp",
14246         FT_UINT64, BASE_DEC, NULL, 0x0,
14247         NULL, HFILL }
14248     },
14249     { &hf_pn_io_local_time_stamp,
14250       { "LocalTimeStamp", "pn_io.local_time_stamp",
14251         FT_UINT64, BASE_DEC, NULL, 0x0,
14252         NULL, HFILL }
14253     },
14254     { &hf_pn_io_number_of_log_entries,
14255       { "NumberOfLogEntries", "pn_io.number_of_log_entries",
14256         FT_UINT16, BASE_DEC, NULL, 0x0,
14257         NULL, HFILL }
14258     },
14259     { &hf_pn_io_entry_detail,
14260       { "EntryDetail", "pn_io.entry_detail",
14261         FT_UINT32, BASE_DEC, NULL, 0x0,
14262         NULL, HFILL }
14263     },
14264     { &hf_pn_io_ip_address,
14265       { "IPAddress", "pn_io.ip_address",
14266         FT_IPv4, BASE_NONE, NULL, 0x0,
14267         NULL, HFILL }
14268     },
14269     { &hf_pn_io_subnetmask,
14270       { "Subnetmask", "pn_io.subnetmask",
14271         FT_IPv4, BASE_NONE, NULL, 0x0,
14272         NULL, HFILL }
14273     },
14274     { &hf_pn_io_standard_gateway,
14275       { "StandardGateway", "pn_io.standard_gateway",
14276         FT_IPv4, BASE_NONE, NULL, 0x0,
14277         NULL, HFILL }
14278     },
14279
14280     { &hf_pn_io_mrp_domain_uuid,
14281       { "MRP_DomainUUID", "pn_io.mrp_domain_uuid",
14282         FT_GUID, BASE_NONE, NULL, 0x0,
14283         NULL, HFILL }
14284     },
14285     { &hf_pn_io_mrp_role,
14286       { "MRP_Role", "pn_io.mrp_role",
14287         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_role_vals), 0x0,
14288         NULL, HFILL }
14289     },
14290     { &hf_pn_io_mrp_length_domain_name,
14291       { "MRP_LengthDomainName", "pn_io.mrp_length_domain_name",
14292         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
14293         NULL, HFILL }
14294     },
14295     { &hf_pn_io_mrp_domain_name,
14296       { "MRP_DomainName", "pn_io.mrp_domain_name",
14297         FT_STRING, BASE_NONE, NULL, 0x0,
14298         NULL, HFILL }
14299     },
14300     { &hf_pn_io_mrp_instances,
14301       { "NumberOfMrpInstances", "pn_io.mrp_Number_MrpInstances",
14302         FT_UINT8, BASE_DEC, NULL, 0x0,
14303         NULL, HFILL }
14304     },
14305     { &hf_pn_io_mrp_instance,
14306       { "Mrp_Instance", "pn_io.mrp_MrpInstance",
14307         FT_UINT8, BASE_DEC,  VALS(pn_io_mrp_instance_no), 0x0,
14308         NULL, HFILL }
14309     },
14310
14311     { &hf_pn_io_mrp_prio,
14312       { "MRP_Prio", "pn_io.mrp_prio",
14313         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_prio_vals), 0x0,
14314         NULL, HFILL }
14315     },
14316     { &hf_pn_io_mrp_topchgt,
14317       { "MRP_TOPchgT", "pn_io.mrp_topchgt",
14318         FT_UINT16, BASE_DEC, NULL, 0x0,
14319         "time base 10ms", HFILL }
14320     },
14321     { &hf_pn_io_mrp_topnrmax,
14322       { "MRP_TOPNRmax", "pn_io.mrp_topnrmax",
14323         FT_UINT16, BASE_DEC, NULL, 0x0,
14324         "number of iterations", HFILL }
14325     },
14326     { &hf_pn_io_mrp_tstshortt,
14327       { "MRP_TSTshortT", "pn_io.mrp_tstshortt",
14328         FT_UINT16, BASE_DEC, NULL, 0x0,
14329         "time base 1 ms", HFILL }
14330     },
14331     { &hf_pn_io_mrp_tstdefaultt,
14332       { "MRP_TSTdefaultT", "pn_io.mrp_tstdefaultt",
14333         FT_UINT16, BASE_DEC, NULL, 0x0,
14334         "time base 1ms", HFILL }
14335     },
14336     { &hf_pn_io_mrp_tstnrmax,
14337       { "MRP_TSTNRmax", "pn_io.mrp_tstnrmax",
14338         FT_UINT16, BASE_DEC, NULL, 0x0,
14339         "number of outstanding test indications causes ring failure", HFILL }
14340     },
14341     { &hf_pn_io_mrp_check,
14342       { "MRP_Check", "pn_io.mrp_check",
14343         FT_UINT32, BASE_HEX, NULL, 0x0,
14344         NULL, HFILL }
14345     },
14346     { &hf_pn_io_mrp_check_mrm,
14347       { "MRP_Check.MediaRedundancyManager", "pn_io.mrp_check.mrm",
14348         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_mrm_on), 0x01,
14349         NULL, HFILL }
14350     },
14351     { &hf_pn_io_mrp_check_mrpdomain,
14352       { "MRP_Check.MRP_DomainUUID", "pn_io.mrp_check.domainUUID",
14353         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_checkUUID), 0x02,
14354         NULL, HFILL }
14355     },
14356     { &hf_pn_io_mrp_check_reserved_1,
14357       { "MRP_Check.reserved_1", "pn_io.mrp_check_reserved_1",
14358         FT_UINT32, BASE_HEX, NULL, 0x0FFFFFC,
14359         NULL, HFILL }
14360     },
14361     { &hf_pn_io_mrp_check_reserved_2,
14362       { "MRP_Check.reserved_2", "pn_io.mrp_check_reserved_2",
14363         FT_UINT32, BASE_HEX, NULL, 0x0FF000000,
14364         NULL, HFILL }
14365     },
14366     { &hf_pn_io_mrp_rtmode,
14367       { "MRP_RTMode", "pn_io.mrp_rtmode",
14368         FT_UINT32, BASE_HEX, NULL, 0x0,
14369         NULL, HFILL }
14370     },
14371     { &hf_pn_io_mrp_rtmode_rtclass12,
14372       { "RTClass1_2", "pn_io.mrp_rtmode.class1_2",
14373         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass12_vals), 0x00000001,
14374         NULL, HFILL }
14375     },
14376     { &hf_pn_io_mrp_rtmode_rtclass3,
14377       { "RTClass1_3", "pn_io.mrp_rtmode.class3",
14378         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass3_vals), 0x00000002,
14379         NULL, HFILL }
14380     },
14381     { &hf_pn_io_mrp_rtmode_reserved1,
14382       { "Reserved_1", "pn_io.mrp_rtmode.reserved_1",
14383         FT_UINT32, BASE_HEX, NULL, 0x00fffffc,
14384         NULL, HFILL }
14385     },
14386     { &hf_pn_io_mrp_rtmode_reserved2,
14387       { "Reserved_2", "pn_io.mrp_rtmode.reserved_2",
14388         FT_UINT32, BASE_HEX, NULL, 0xff000000,
14389         NULL, HFILL }
14390     },
14391     { &hf_pn_io_mrp_lnkdownt,
14392       { "MRP_LNKdownT", "pn_io.mrp_lnkdownt",
14393         FT_UINT16, BASE_HEX, NULL, 0x0,
14394         "Link down Interval in ms", HFILL }
14395     },
14396     { &hf_pn_io_mrp_lnkupt,
14397       { "MRP_LNKupT", "pn_io.mrp_lnkupt",
14398         FT_UINT16, BASE_HEX, NULL, 0x0,
14399         "Link up Interval in ms", HFILL }
14400     },
14401     { &hf_pn_io_mrp_lnknrmax,
14402       { "MRP_LNKNRmax", "pn_io.mrp_lnknrmax",
14403         FT_UINT16, BASE_HEX, NULL, 0x0,
14404         NULL, HFILL }
14405     },
14406     { &hf_pn_io_mrp_version,
14407       { "MRP_Version", "pn_io.mrp_version",
14408         FT_UINT16, BASE_DEC, NULL, 0x0,
14409         NULL, HFILL }
14410     },
14411     { &hf_pn_io_substitute_active_flag,
14412       { "SubstituteActiveFlag", "pn_io.substitute_active_flag",
14413         FT_UINT16, BASE_HEX, NULL, 0x0,
14414         NULL, HFILL }
14415     },
14416     { &hf_pn_io_length_data,
14417       { "LengthData", "pn_io.length_data",
14418         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
14419         NULL, HFILL }
14420     },
14421     { &hf_pn_io_mrp_ring_state,
14422       { "MRP_RingState", "pn_io.mrp_ring_state",
14423         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_ring_state_vals), 0x0,
14424         NULL, HFILL }
14425     },
14426     { &hf_pn_io_mrp_rt_state,
14427       { "MRP_RTState", "pn_io.mrp_rt_state",
14428         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_rt_state_vals), 0x0,
14429         NULL, HFILL }
14430     },
14431     { &hf_pn_io_im_tag_function,
14432       { "IM_Tag_Function", "pn_io.im_tag_function",
14433         FT_STRING, BASE_NONE, NULL, 0x0,
14434         NULL, HFILL }
14435     },
14436     { &hf_pn_io_im_tag_location,
14437       { "IM_Tag_Location", "pn_io.im_tag_location",
14438         FT_STRING, BASE_NONE, NULL, 0x0,
14439         NULL, HFILL }
14440     },
14441     { &hf_pn_io_im_date,
14442       { "IM_Date", "pn_io.im_date",
14443         FT_STRING, BASE_NONE, NULL, 0x0,
14444         NULL, HFILL }
14445     },
14446     { &hf_pn_io_im_descriptor,
14447       { "IM_Descriptor", "pn_io.im_descriptor",
14448         FT_STRING, BASE_NONE, NULL, 0x0,
14449         NULL, HFILL }
14450     },
14451     { &hf_pn_io_fs_hello_mode,
14452       { "FSHelloMode", "pn_io.fs_hello_mode",
14453         FT_UINT32, BASE_HEX, VALS(pn_io_fs_hello_mode_vals), 0x0,
14454         NULL, HFILL }
14455     },
14456     { &hf_pn_io_fs_hello_interval,
14457       { "FSHelloInterval", "pn_io.fs_hello_interval",
14458         FT_UINT32, BASE_DEC, NULL, 0x0,
14459         "ms before conveying a second DCP_Hello.req", HFILL }
14460     },
14461     { &hf_pn_io_fs_hello_retry,
14462       { "FSHelloRetry", "pn_io.fs_hello_retry",
14463         FT_UINT32, BASE_DEC, NULL, 0x0,
14464         NULL, HFILL }
14465     },
14466     { &hf_pn_io_fs_hello_delay,
14467       { "FSHelloDelay", "pn_io.fs_hello_delay",
14468         FT_UINT32, BASE_DEC, NULL, 0x0,
14469         NULL, HFILL }
14470     },
14471     { &hf_pn_io_fs_parameter_mode,
14472       { "FSParameterMode", "pn_io.fs_parameter_mode",
14473         FT_UINT32, BASE_HEX, VALS(pn_io_fs_parameter_mode_vals), 0x0,
14474         NULL, HFILL }
14475     },
14476     { &hf_pn_io_fs_parameter_uuid,
14477       { "FSParameterUUID", "pn_io.fs_parameter_uuid",
14478         FT_GUID, BASE_NONE, NULL, 0x0,
14479         NULL, HFILL }
14480     },
14481     { &hf_pn_io_check_sync_mode,
14482       { "CheckSyncMode", "pn_io.check_sync_mode",
14483         FT_UINT16, BASE_HEX, NULL, 0x0,
14484         NULL, HFILL }
14485     },
14486     { &hf_pn_io_check_sync_mode_reserved,
14487       { "Reserved", "pn_io.check_sync_mode.reserved",
14488         FT_UINT16, BASE_HEX, NULL, 0xFFFC,
14489         NULL, HFILL }
14490     },
14491     { &hf_pn_io_check_sync_mode_sync_master,
14492       { "SyncMaster", "pn_io.check_sync_mode.sync_master",
14493         FT_UINT16, BASE_HEX, NULL, 0x0002,
14494         NULL, HFILL }
14495     },
14496     { &hf_pn_io_check_sync_mode_cable_delay,
14497       { "CableDelay", "pn_io.check_sync_mode.cable_delay",
14498         FT_UINT16, BASE_HEX, NULL, 0x0001,
14499         NULL, HFILL }
14500     },
14501     /* PROFIsafe F-Parameter */
14502     { &hf_pn_io_ps_f_prm_flag1,
14503       { "F_Prm_Flag1", "pn_io.ps.f_prm_flag1",
14504         FT_UINT8, BASE_HEX, NULL, 0x0,
14505         NULL, HFILL }
14506     },
14507     { &hf_pn_io_ps_f_prm_flag1_chck_seq,
14508       { "F_Check_SeqNr", "pn_io.ps.f_prm_flag1.f_check_seqnr",
14509         FT_UINT8, BASE_HEX, VALS(pn_io_f_check_seqnr), 0x01,
14510         NULL, HFILL }
14511     },
14512     { &hf_pn_io_ps_f_prm_flag1_chck_ipar,
14513       { "F_Check_iPar", "pn_io.ps.f_prm_flag1.f_check_ipar",
14514         FT_UINT8, BASE_HEX, VALS(pn_io_f_check_ipar), 0x02,
14515         NULL, HFILL }
14516     },
14517     { &hf_pn_io_ps_f_prm_flag1_sil,
14518       { "F_SIL", "pn_io.ps.f_prm_flag1.f_sil",
14519         FT_UINT8, BASE_HEX, VALS(pn_io_f_sil), 0xc,
14520         NULL, HFILL }
14521     },
14522     { &hf_pn_io_ps_f_prm_flag1_crc_len,
14523       { "F_CRC_Length", "pn_io.ps.f_prm_flag1.f_crc_len",
14524         FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_len), 0x30,
14525         NULL, HFILL }
14526     },
14527     { &hf_pn_io_ps_f_prm_flag1_crc_seed,
14528         { "F_CRC_Seed", "pn_io.ps.f_prm_flag1.f_crc_seed",
14529         FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_seed), 0x40,
14530         NULL, HFILL }
14531     },
14532     { &hf_pn_io_ps_f_prm_flag1_reserved,
14533       { "Reserved", "pn_io.ps.f_prm_flag1.reserved",
14534         FT_UINT8, BASE_HEX, NULL, 0x80,
14535         NULL, HFILL }
14536     },
14537     { &hf_pn_io_ps_f_prm_flag2,
14538       { "F_Prm_Flag2", "pn_io.ps.f_prm_flag2",
14539         FT_UINT8, BASE_HEX, NULL, 0x0,
14540         NULL, HFILL }
14541     },
14542     { &hf_pn_io_ps_f_prm_flag2_reserved,
14543       { "Reserved", "pn_io.ps.f_prm_flag2.reserved",
14544         FT_UINT8, BASE_HEX, NULL, 0x07,
14545         NULL, HFILL }
14546     },
14547     { &hf_pn_io_ps_f_prm_flag2_f_block_id,
14548       { "F_Block_ID", "pn_io.ps.f_prm_flag2.f_block_id",
14549         FT_UINT8, BASE_HEX, VALS(pn_io_f_block_id), 0x38,
14550         NULL, HFILL }
14551     },
14552     { &hf_pn_io_ps_f_prm_flag2_f_par_version,
14553       { "F_Par_Version", "pn_io.ps.f_prm_flag2.f_par_version",
14554         FT_UINT8, BASE_HEX, VALS(pn_io_f_par_version), 0xC0,
14555         NULL, HFILL }
14556     },
14557     { &hf_pn_io_ps_f_wd_time,
14558       { "F_WD_Time", "pn_io.ps.f_wd_time",
14559         FT_UINT16, BASE_DEC, NULL, 0x0,
14560         NULL, HFILL }
14561     },
14562     { &hf_pn_io_ps_f_ipar_crc,
14563         { "F_iPar_CRC", "pn_io.ps.f_ipar_crc",
14564         FT_UINT32, BASE_DEC, NULL, 0x0,
14565         NULL, HFILL }
14566     },
14567     { &hf_pn_io_ps_f_par_crc,
14568         { "F_Par_CRC", "pn_io.ps.f_par_crc",
14569         FT_UINT16, BASE_DEC, NULL, 0x0,
14570         NULL, HFILL }
14571     },
14572     { &hf_pn_io_ps_f_dest_adr,
14573         { "F_Dest_Add", "pn_io.ps.f_dest_add",
14574         FT_UINT16, BASE_DEC, NULL, 0x0,
14575         NULL, HFILL }
14576     },
14577     { &hf_pn_io_ps_f_src_adr,
14578         { "F_Source_Add", "pn_io.ps.f_source_add",
14579         FT_UINT16, BASE_DEC, NULL, 0x0,
14580         NULL, HFILL }
14581     },
14582     /* profidrive parameter access */
14583     { &hf_pn_io_profidrive_request_reference,
14584       { "RequestReference", "pn_io.profidrive.parameter.request_reference",
14585         FT_UINT8, BASE_HEX, NULL, 0x0,
14586         NULL, HFILL }
14587     },
14588     { &hf_pn_io_profidrive_request_id,
14589       { "RequestID", "pn_io.profidrive.parameter.request_id",
14590         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_request_id_vals), 0x0,
14591         NULL, HFILL }
14592     },
14593     { &hf_pn_io_profidrive_do_id,
14594       { "DO", "pn_io.profidrive.parameter.do",
14595         FT_UINT8, BASE_DEC, NULL, 0x0,
14596         NULL, HFILL }
14597     },
14598     { &hf_pn_io_profidrive_no_of_parameters,
14599       { "NoOfParameters", "pn_io.profidrive.parameter.no_of_parameters",
14600         FT_UINT8, BASE_DEC, NULL, 0x0,
14601         NULL, HFILL }
14602     },
14603     { &hf_pn_io_profidrive_param_attribute,
14604       { "Attribute", "pn_io.profidrive.parameter.attribute",
14605         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_attribute_vals), 0x0,
14606         NULL, HFILL }
14607     },
14608     { &hf_pn_io_profidrive_param_no_of_elems,
14609       { "NoOfElements", "pn_io.profidrive.parameter.no_of_elems",
14610         FT_UINT8, BASE_DEC, NULL, 0x0,
14611         NULL, HFILL }
14612     },
14613     { &hf_pn_io_profidrive_param_number,
14614       { "Parameter", "pn_io.profidrive.parameter.number",
14615         FT_UINT16, BASE_DEC, NULL, 0x0,
14616         NULL, HFILL }
14617     },
14618     { &hf_pn_io_profidrive_param_subindex,
14619       { "Index", "pn_io.profidrive.parameter.index",
14620         FT_UINT16, BASE_DEC, NULL, 0x0,
14621         NULL, HFILL }
14622     },
14623     { &hf_pn_io_profidrive_response_id,
14624       { "ResponseID", "pn_io.profidrive.parameter.response_id",
14625         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_response_id_vals), 0x0,
14626         NULL, HFILL }
14627     },
14628     { &hf_pn_io_profidrive_param_format,
14629       { "Format", "pn_io.profidrive.parameter.format",
14630         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_format_vals), 0x0,
14631         NULL, HFILL }
14632     },
14633     { &hf_pn_io_profidrive_param_no_of_values,
14634       { "NoOfValues", "pn_io.profidrive.parameter.no_of_values",
14635         FT_UINT8, BASE_DEC, NULL, 0x0,
14636         NULL, HFILL }
14637     },
14638     { &hf_pn_io_profidrive_param_value_byte,
14639       { "Value", "pn_io.profidrive.parameter.value_b",
14640         FT_UINT8, BASE_HEX, NULL, 0x0,
14641         NULL, HFILL }
14642     },
14643     { &hf_pn_io_profidrive_param_value_word,
14644       { "Value", "pn_io.profidrive.parameter.value_w",
14645         FT_UINT16, BASE_HEX, NULL, 0x0,
14646         NULL, HFILL }
14647     },
14648     { &hf_pn_io_profidrive_param_value_dword,
14649       { "Value", "pn_io.profidrive.parameter.value_dw",
14650         FT_UINT32, BASE_HEX, NULL, 0x0,
14651         NULL, HFILL }
14652     },
14653     { &hf_pn_io_profidrive_param_value_float,
14654       { "Value", "pn_io.profidrive.parameter.value_float",
14655         FT_FLOAT, BASE_NONE, NULL, 0x0,
14656         NULL, HFILL }
14657     },
14658     { &hf_pn_io_profidrive_param_value_string,
14659       { "Value", "pn_io.profidrive.parameter.value_str",
14660         FT_STRING, BASE_NONE, NULL, 0x0,
14661         NULL, HFILL }
14662     },
14663     { &hf_pn_io_rs_alarm_info_reserved_8_15,
14664       { "RSAlarmInfo.Reserved2", "pn_io.rs_alarm_info_reserved_8_15",
14665         FT_UINT16, BASE_HEX, NULL, 0x0FF00,
14666         NULL, HFILL }
14667     },
14668     { &hf_pn_io_rs_alarm_info_reserved_0_7,
14669       { "RSAlarmInfo.Reserved1", "pn_io.rs_alarm_info_reserved_0_7",
14670         FT_UINT16, BASE_HEX, NULL, 0x000FF,
14671         NULL, HFILL }
14672     },
14673     { &hf_pn_io_rs_alarm_info,
14674         { "RS Alarm Info", "pn_io.rs_alarm_info",
14675           FT_UINT16, BASE_HEX, NULL, 0x0,
14676           NULL, HFILL }
14677     },
14678     { &hf_pn_io_rs_event_info,
14679         { "RS Event Info", "pn_io.rs_event_info",
14680           FT_NONE, BASE_NONE, NULL, 0x0,
14681           NULL, HFILL }
14682     },
14683     { &hf_pn_io_rs_event_block,
14684         { "RS Event Block", "pn_io.rs_event_block",
14685           FT_NONE, BASE_NONE, NULL, 0x0,
14686           NULL, HFILL }
14687     },
14688     { &hf_pn_io_rs_adjust_block,
14689         { "RS Adjust Block", "pn_io.rs_adjust_block",
14690           FT_NONE, BASE_NONE, NULL, 0x0,
14691           NULL, HFILL }
14692     },
14693     { &hf_pn_io_rs_event_data_extension,
14694         { "RS Event Data Extension", "pn_io.rs_event_data_extension",
14695           FT_NONE, BASE_NONE, NULL, 0x0,
14696           NULL, HFILL }
14697     },
14698     { &hf_pn_io_number_of_rs_event_info,
14699         { "RSEventInfo.NumberOfEntries", "pn_io.number_of_rs_event_info",
14700           FT_UINT16, BASE_DEC, NULL, 0x0,
14701           NULL, HFILL }
14702     },
14703     { &hf_pn_io_rs_block_type,
14704         { "RS Block Type", "pn_io.rs_block_type",
14705           FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_rs_block_type), 0x0,
14706           NULL, HFILL }
14707     },
14708     { &hf_pn_io_rs_block_length,
14709         { "RS Block Length", "pn_io.rs_block_length",
14710           FT_UINT16, BASE_HEX, NULL, 0x0,
14711           NULL, HFILL }
14712     },
14713     { &hf_pn_io_rs_specifier,
14714         { "RS_Specifier", "pn_io.rs_specifier",
14715           FT_UINT16, BASE_HEX, NULL, 0x0,
14716           NULL, HFILL }
14717     },
14718     { &hf_pn_io_rs_specifier_sequence,
14719         { "RS_Specifier.SequenceNumber", "pn_io.rs_specifier.sequence",
14720           FT_UINT16, BASE_HEX, NULL, 0x07FF,
14721           NULL, HFILL }
14722     },
14723     { &hf_pn_io_rs_specifier_reserved,
14724         { "RS_Specifier.Reserved", "pn_io.rs_specifier_reserved",
14725           FT_UINT16, BASE_HEX, NULL, 0x3800,
14726           NULL, HFILL }
14727     },
14728     { &hf_pn_io_rs_specifier_specifier,
14729         { "RS_Specifier.Specifier", "pn_io.rs_specifier.specifier",
14730           FT_UINT16, BASE_HEX, VALS(pn_io_rs_specifier_specifier), 0xC000,
14731           NULL, HFILL }
14732     },
14733     { &hf_pn_io_rs_time_stamp,
14734       { "RS_TimeStamp", "pn_io.rs_time_stamp",
14735         FT_BYTES, BASE_NONE, NULL, 0x0,
14736         NULL, HFILL }
14737     },
14738     { &hf_pn_io_rs_time_stamp_status,
14739         { "RS_TimeStamp.Status", "pn_io.rs_time_stamp.status",
14740           FT_UINT16, BASE_HEX, VALS(pn_io_rs_time_stamp_status), 0x0003,
14741           NULL, HFILL }
14742     },
14743     { &hf_pn_io_rs_time_stamp_value,
14744         { "RS_TimeStamp.Value", "pn_io.rs_time_stamp.value",
14745           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
14746           NULL, HFILL }
14747     },
14748     { &hf_pn_io_rs_minus_error,
14749         { "RS_MinusError", "pn_io.rs_minus_error",
14750           FT_UINT16, BASE_HEX, NULL, 0x0,
14751           NULL, HFILL }
14752     },
14753     { &hf_pn_io_rs_plus_error,
14754         { "RS_PlusError", "pn_io.rs_plus_error",
14755           FT_UINT16, BASE_HEX, NULL, 0x0,
14756           NULL, HFILL }
14757     },
14758     { &hf_pn_io_rs_extension_block_type,
14759         { "RS_ExtensionBlockType", "pn_io.rs_extension_block_type",
14760           FT_UINT8, BASE_HEX, NULL, 0x0,
14761           NULL, HFILL }
14762     },
14763     { &hf_pn_io_rs_extension_block_length,
14764         { "RS_ExtensionBlockLength", "pn_io.rs_extension_block_length",
14765           FT_UINT8, BASE_HEX, NULL, 0x0,
14766           NULL, HFILL }
14767     },
14768     { &hf_pn_io_rs_reason_code,
14769         { "RS_ReasonCode", "pn_io.rs_reason_code",
14770           FT_UINT32, BASE_HEX, NULL, 0x0,
14771           NULL, HFILL }
14772     },
14773     { &hf_pn_io_rs_reason_code_reason,
14774         { "RS_ReasonCode.Reason", "pn_io.rs_reason_code.reason",
14775           FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_reason), 0x0000FFFF,
14776           NULL, HFILL }
14777     },
14778     { &hf_pn_io_rs_reason_code_detail,
14779         { "RS_ReasonCode.Detail", "pn_io.rs_reason_code.detail",
14780           FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_detail), 0xFFFF0000,
14781           NULL, HFILL }
14782     },
14783     { &hf_pn_io_rs_domain_identification,
14784         { "RS_DomainIdentification", "pn_io.rs_domain_identification",
14785           FT_BYTES, BASE_NONE, NULL, 0x0,
14786           NULL, HFILL }
14787     },
14788     { &hf_pn_io_rs_master_identification,
14789         { "RS_MasterIdentification", "pn_io.rs_master_identification",
14790           FT_BYTES, BASE_NONE, NULL, 0x0,
14791           NULL, HFILL }
14792     },
14793     { &hf_pn_io_soe_digital_input_current_value,
14794         { "SoE_DigitalInputCurrentValue", "pn_io.soe_digital_input_current_value",
14795           FT_UINT16, BASE_HEX, NULL, 0x0,
14796           NULL, HFILL }
14797     },
14798     { &hf_pn_io_soe_digital_input_current_value_value,
14799         { "SoE_DigitalInputCurrentValue.Value", "pn_io.soe_digital_input_current_value.value",
14800           FT_UINT16, BASE_HEX, VALS(pn_io_soe_digital_input_current_value_value), 0x0001,
14801           NULL, HFILL }
14802     },
14803     { &hf_pn_io_soe_digital_input_current_value_reserved,
14804         { "SoE_DigitalInputCurrentValue.Reserved", "pn_io.soe_digital_input_current_value.reserved",
14805           FT_UINT16, BASE_HEX, NULL, 0xFFFE,
14806           NULL, HFILL }
14807     },
14808     { &hf_pn_io_am_device_identification,
14809         { "AM_DeviceIdentification", "pn_io.am_device_identification",
14810           FT_UINT64, BASE_HEX, NULL, 0x0,
14811           NULL, HFILL }
14812     },
14813     { &hf_pn_io_am_device_identification_device_sub_id,
14814         { "AM_DeviceIdentification.DeviceSubID", "pn_io.am_device_identification.device_sub_id",
14815           FT_UINT64, BASE_HEX, NULL, 0x000000000000FFFF,
14816           NULL, HFILL }
14817     },
14818     { &hf_pn_io_am_device_identification_device_id,
14819         { "AM_DeviceIdentification.DeviceID", "pn_io.am_device_identification.device_id",
14820           FT_UINT64, BASE_HEX, NULL, 0x00000000FFFF0000,
14821           NULL, HFILL }
14822     },
14823     { &hf_pn_io_am_device_identification_vendor_id,
14824         { "AM_DeviceIdentification.VendorID", "pn_io.am_device_identification.vendor_id",
14825           FT_UINT64, BASE_HEX, NULL, 0x0000FFFF00000000,
14826           NULL, HFILL }
14827     },
14828     { &hf_pn_io_am_device_identification_organization,
14829         { "AM_DeviceIdentification.Organization", "pn_io.am_device_identification.organization",
14830           FT_UINT64, BASE_HEX, NULL, 0xFFFF000000000000,
14831           NULL, HFILL }
14832     },
14833     { &hf_pn_io_rs_adjust_info,
14834         { "RS Adjust Info", "pn_io.rs_adjust_info",
14835           FT_NONE, BASE_NONE, NULL, 0x0,
14836           NULL, HFILL }
14837     },
14838     { &hf_pn_io_soe_max_scan_delay,
14839         { "SoE_MaxScanDelay", "pn_io.soe_max_scan_delay",
14840           FT_UINT16, BASE_HEX, NULL, 0x0,
14841           NULL, HFILL }
14842     },
14843     { &hf_pn_io_soe_adjust_specifier,
14844         { "SoE_AdjustSpecifier", "pn_io.soe_adjust_specifier",
14845           FT_UINT8, BASE_HEX, NULL, 0x0,
14846           NULL, HFILL }
14847     },
14848     { &hf_pn_io_soe_adjust_specifier_reserved,
14849         { "SoE_AdjustSpecifier.Reserved", "pn_io.soe_adjust_specifier.reserved",
14850           FT_UINT8, BASE_HEX, NULL, 0x3F,
14851           NULL, HFILL }
14852     },
14853     { &hf_pn_io_soe_adjust_specifier_incident,
14854         { "SoE_AdjustSpecifier.Incident", "pn_io.soe_adjust_specifier.incident",
14855           FT_UINT8, BASE_HEX, VALS(pn_io_soe_adjust_specifier_incident), 0xC0,
14856           NULL, HFILL }
14857     },
14858     { &hf_pn_io_rs_properties,
14859         { "RSProperties", "pn_io.rs_properties",
14860           FT_UINT32, BASE_HEX, NULL, 0x0,
14861           NULL, HFILL }
14862     },
14863     { &hf_pn_io_rs_properties_alarm_transport,
14864         { "RSProperties", "pn_io.rs_properties",
14865           FT_UINT32, BASE_HEX, VALS(pn_io_rs_properties_alarm_transport), 0x00000001,
14866           NULL, HFILL }
14867     },
14868     { &hf_pn_io_rs_properties_reserved1,
14869         { "RSProperties.Reserved1", "pn_io.rs_properties.reserved1",
14870           FT_UINT32, BASE_HEX, NULL, 0x00FFFFFE,
14871           NULL, HFILL }
14872     },
14873     { &hf_pn_io_rs_properties_reserved2,
14874         { "RSProperties.Reserved2", "pn_io.rs_properties.reserved2",
14875           FT_UINT32, BASE_HEX, NULL, 0xFF000000,
14876           NULL, HFILL }
14877     },
14878     { &hf_pn_io_asset_management_info,
14879       { "Asset Management Info", "pn_io.asset_management_info",
14880         FT_NONE, BASE_NONE, NULL, 0x0,
14881         NULL, HFILL }
14882     },
14883     { &hf_pn_io_number_of_asset_management_info,
14884       { "AssetManagementInfo.NumberOfEntries", "pn_io.number_of_asset_management_info",
14885         FT_UINT16, BASE_DEC, NULL, 0x0,
14886         NULL, HFILL }
14887     },
14888     { &hf_pn_io_im_uniqueidentifier,
14889       { "IM_UniqueIdentifier", "pn_io.IM_UniqueIdentifier",
14890         FT_GUID, BASE_NONE, NULL, 0x0,
14891         NULL, HFILL }
14892     },
14893     { &hf_pn_io_am_location_structure,
14894       { "AM_Location.Structure", "pn_io.am_location.structure",
14895          FT_UINT8, BASE_HEX, VALS(pn_io_am_location_structure_vals), 0x0,
14896          NULL, HFILL }
14897     },
14898     { &hf_pn_io_am_location,
14899       { "AM_Location", "pn_io.am_location",
14900         FT_BYTES, BASE_NONE, NULL, 0,
14901         NULL, HFILL }
14902     },
14903     { &hf_pn_io_am_location_level_0,
14904       { "AM_Location Level 0", "pn_io.am_location.level_0",
14905         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14906         NULL, HFILL }
14907     },
14908     { &hf_pn_io_am_location_level_1,
14909       { "AM_Location Level 1", "pn_io.am_location.level_1",
14910         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14911         NULL, HFILL }
14912     },
14913     { &hf_pn_io_am_location_level_2,
14914       { "AM_Location Level 2", "pn_io.am_location.level_2",
14915         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14916         NULL, HFILL }
14917     },
14918     { &hf_pn_io_am_location_level_3,
14919       { "AM_Location Level 3", "pn_io.am_location.level_3",
14920         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14921         NULL, HFILL }
14922     },
14923     { &hf_pn_io_am_location_level_4,
14924       { "AM_Location Level 4", "pn_io.am_location.level_4",
14925         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14926         NULL, HFILL }
14927     },
14928     { &hf_pn_io_am_location_level_5,
14929       { "AM_Location Level 5", "pn_io.am_location.level_5",
14930         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14931         NULL, HFILL }
14932     },
14933     { &hf_pn_io_am_location_level_6,
14934       { "AM_Location Level 6", "pn_io.am_location.level_6",
14935         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14936         NULL, HFILL }
14937     },
14938     { &hf_pn_io_am_location_level_7,
14939       { "AM_Location Level 7", "pn_io.am_location.level_7",
14940         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14941         NULL, HFILL }
14942     },
14943     { &hf_pn_io_am_location_level_8,
14944       { "AM_Location Level 8", "pn_io.am_location.level_8",
14945         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14946         NULL, HFILL }
14947     },
14948     { &hf_pn_io_am_location_level_9,
14949       { "AM_Location Level 9", "pn_io.am_location.level_9",
14950         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14951         NULL, HFILL }
14952     },
14953     { &hf_pn_io_am_location_level_10,
14954       { "AM_Location Level 10", "pn_io.am_location.level_10",
14955         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14956         NULL, HFILL }
14957     },
14958     { &hf_pn_io_am_location_level_11,
14959       { "AM_Location Level 11", "pn_io.am_location.level_11",
14960         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14961         NULL, HFILL }
14962     },
14963     { &hf_pn_io_am_location_reserved1,
14964       { "Reserved 1", "pn_io.am_location.reserved1",
14965         FT_UINT8, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14966         NULL, HFILL }
14967     },
14968     { &hf_pn_io_am_location_reserved2,
14969       { "Reserved 2", "pn_io.am_location.reserved2",
14970         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14971         NULL, HFILL }
14972     },
14973     { &hf_pn_io_am_location_reserved3,
14974       { "Reserved 3", "pn_io.am_location.reserved3",
14975         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14976         NULL, HFILL }
14977     },
14978     { &hf_pn_io_am_location_reserved4,
14979       { "Reserved 3", "pn_io.am_location.reserved4",
14980         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14981         NULL, HFILL }
14982     },
14983     { &hf_pn_io_am_software_revision,
14984       { "AM Software Revision", "pn_io.am_software_revision",
14985         FT_STRING, BASE_NONE, NULL, 0x0,
14986         NULL, HFILL }
14987     },
14988     { &hf_pn_io_am_hardware_revision,
14989       { "AM Hardware Revision", "pn_io.am_hardware_revision",
14990         FT_STRING, BASE_NONE, NULL, 0x0,
14991         NULL, HFILL }
14992     },
14993     { &hf_pn_io_am_type_identification,
14994       { "AM Type Identification", "pn_io.am_type_identification",
14995         FT_UINT16, BASE_HEX, NULL, 0x0,
14996         NULL, HFILL }
14997     },
14998     { &hf_pn_io_mau_type_extension,
14999     { "MAU Type Extension", "pn_io.mau_type_extension",
15000         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_mau_type_extension), 0x0,
15001         NULL, HFILL }
15002     },
15003     };
15004
15005     static gint *ett[] = {
15006         &ett_pn_io,
15007         &ett_pn_io_block,
15008         &ett_pn_io_block_header,
15009         &ett_pn_io_status,
15010         &ett_pn_io_rtc,
15011         &ett_pn_io_rta,
15012         &ett_pn_io_pdu_type,
15013         &ett_pn_io_add_flags,
15014         &ett_pn_io_control_command,
15015         &ett_pn_io_ioxs,
15016         &ett_pn_io_api,
15017         &ett_pn_io_data_description,
15018         &ett_pn_io_module,
15019         &ett_pn_io_submodule,
15020         &ett_pn_io_io_data_object,
15021         &ett_pn_io_io_cs,
15022         &ett_pn_io_ar_properties,
15023         &ett_pn_io_iocr_properties,
15024         &ett_pn_io_submodule_properties,
15025         &ett_pn_io_alarmcr_properties,
15026         &ett_pn_io_submodule_state,
15027         &ett_pn_io_channel_properties,
15028         &ett_pn_io_slot,
15029         &ett_pn_io_subslot,
15030         &ett_pn_io_maintenance_status,
15031         &ett_pn_io_data_status,
15032         &ett_pn_io_iocr,
15033         &ett_pn_io_mrp_rtmode,
15034         &ett_pn_io_control_block_properties,
15035         &ett_pn_io_check_sync_mode,
15036         &ett_pn_io_ir_frame_data,
15037         &ett_pn_FrameDataProperties,
15038         &ett_pn_io_ar_info,
15039         &ett_pn_io_ar_data,
15040         &ett_pn_io_ir_begin_end_port,
15041         &ett_pn_io_ir_tx_phase,
15042         &ett_pn_io_ir_rx_phase,
15043         &ett_pn_io_subframe_data,
15044         &ett_pn_io_SFIOCRProperties,
15045         &ett_pn_io_frame_defails,
15046         &ett_pn_io_profisafe_f_parameter,
15047         &ett_pn_io_profisafe_f_parameter_prm_flag1,
15048         &ett_pn_io_profisafe_f_parameter_prm_flag2,
15049         &ett_pn_io_profidrive_parameter_request,
15050         &ett_pn_io_profidrive_parameter_response,
15051         &ett_pn_io_profidrive_parameter_address,
15052         &ett_pn_io_profidrive_parameter_value,
15053         &ett_pn_io_GroupProperties,
15054         &ett_pn_io_rs_alarm_info,
15055         &ett_pn_io_rs_event_info,
15056         &ett_pn_io_rs_event_block,
15057         &ett_pn_io_rs_adjust_block,
15058         &ett_pn_io_rs_event_data_extension,
15059         &ett_pn_io_rs_specifier,
15060         &ett_pn_io_rs_time_stamp,
15061         &ett_pn_io_am_device_identification,
15062         &ett_pn_io_rs_reason_code,
15063         &ett_pn_io_soe_digital_input_current_value,
15064         &ett_pn_io_rs_adjust_info,
15065         &ett_pn_io_soe_adjust_specifier,
15066         &ett_pn_io_asset_management_info,
15067         &ett_pn_io_asset_management_block,
15068         &ett_pn_io_am_location,
15069         &ett_pn_io_sr_properties,
15070         &ett_pn_io_line_delay,
15071         &ett_pn_io_counter_status,
15072         &ett_pn_io_dcp_boundary,
15073         &ett_pn_io_peer_to_peer_boundary,
15074         &ett_pn_io_mau_type_extension
15075     };
15076
15077     static ei_register_info ei[] = {
15078         { &ei_pn_io_block_version, { "pn_io.block_version.not_implemented", PI_UNDECODED, PI_WARN, "Block version not implemented yet!", EXPFILL }},
15079         { &ei_pn_io_error_code1, { "pn_io.error_code1.expert", PI_UNDECODED, PI_WARN, "Unknown ErrorCode1", EXPFILL }},
15080         { &ei_pn_io_error_code2, { "pn_io.error_code2.expert", PI_UNDECODED, PI_WARN, "Unknown ErrorDecode", EXPFILL }},
15081         { &ei_pn_io_ar_info_not_found, { "pn_io.ar_info_not_found", PI_UNDECODED, PI_NOTE, "IODWriteReq: AR information not found!", EXPFILL }},
15082         { &ei_pn_io_block_length, { "pn_io.block_length.invalid", PI_UNDECODED, PI_WARN, "Block length invalid!", EXPFILL }},
15083         { &ei_pn_io_unsupported, { "pn_io.profidrive.parameter.format.invalid", PI_UNDECODED, PI_WARN, "Unknown Fomatvalue", EXPFILL }},
15084         { &ei_pn_io_mrp_instances, { "pn_io.mrp_Number_MrpInstances.invalid", PI_UNDECODED, PI_WARN, "Number of MrpInstances invalid", EXPFILL }},
15085         { &ei_pn_io_frame_id, { "pn_io.frame_id.changed", PI_UNDECODED, PI_WARN, "FrameID changed", EXPFILL }},
15086         { &ei_pn_io_iocr_type, { "pn_io.iocr_type.unknown", PI_UNDECODED, PI_WARN, "IOCRType undecoded!", EXPFILL }},
15087         { &ei_pn_io_localalarmref, { "pn_io.localalarmref.changed", PI_UNDECODED, PI_WARN, "AlarmCRBlockReq: local alarm ref changed", EXPFILL }},
15088         { &ei_pn_io_nr_of_tx_port_groups, { "pn_io.nr_of_tx_port_groups.not_allowed", PI_PROTOCOL, PI_WARN, "Not allowed value of NumberOfTxPortGroups", EXPFILL }},
15089         { &ei_pn_io_max_recursion_depth_reached, { "pn_io.max_recursion_depth_reached", PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stopping dissection", EXPFILL }}
15090     };
15091
15092     module_t *pnio_module;
15093     expert_module_t* expert_pn_io;
15094
15095     proto_pn_io = proto_register_protocol ("PROFINET IO", "PNIO", "pn_io");
15096
15097     /* Register by name */
15098     register_dissector("pnio", dissect_PNIO_heur, proto_pn_io);
15099
15100     /* Created to remove Decode As confusion */
15101     proto_pn_io_device = proto_register_protocol_in_name_only("PROFINET IO (Device)", "PNIO (Device Interface)", "pn_io_device", proto_pn_io, FT_PROTOCOL);
15102     proto_pn_io_controller = proto_register_protocol_in_name_only("PROFINET IO (Controller)", "PNIO (Controller Interface)", "pn_io_controller", proto_pn_io, FT_PROTOCOL);
15103     proto_pn_io_supervisor = proto_register_protocol_in_name_only("PROFINET IO (Supervisor)", "PNIO (Supervisor Interface)", "pn_io_supervisor", proto_pn_io, FT_PROTOCOL);
15104     proto_pn_io_parameterserver = proto_register_protocol_in_name_only("PROFINET IO (Parameter Server)", "PNIO (Parameter Server Interface)", "pn_io_parameterserver", proto_pn_io, FT_PROTOCOL);
15105     proto_pn_io_implicitar = proto_register_protocol_in_name_only("PROFINET IO (Implicit Ar)", "PNIO (Implicit Ar)", "pn_io_implicitar", proto_pn_io, FT_PROTOCOL);
15106     proto_pn_io_apdu_status = proto_register_protocol_in_name_only("PROFINET IO (Apdu Status)", "PNIO (Apdu Status)", "pn_io_apdu_status", proto_pn_io, FT_PROTOCOL);
15107
15108     proto_register_field_array (proto_pn_io, hf, array_length (hf));
15109     proto_register_subtree_array (ett, array_length (ett));
15110     expert_pn_io = expert_register_protocol(proto_pn_io);
15111     expert_register_field_array(expert_pn_io, ei, array_length(ei));
15112
15113     /* Register preferences */
15114     pnio_module = prefs_register_protocol(proto_pn_io, NULL);
15115     prefs_register_bool_preference(pnio_module, "pnio_ps_selection",
15116         "Enable detailed PROFIsafe dissection",
15117         "Whether the PNIO dissector is allowed to use detailed PROFIsafe dissection of cyclic data frames",
15118         &pnio_ps_selection);
15119     prefs_register_directory_preference(pnio_module, "pnio_ps_networkpath",
15120         "Configuration GSD-File Networkpath",                 /* Title */
15121         "Select your Networkpath to your GSD-Files.",         /* Descreption */
15122         &pnio_ps_networkpath);                                /* Variable to save the GSD-File networkpath */
15123
15124     /* subdissector code */
15125     register_dissector("pn_io", dissect_PNIO_heur, proto_pn_io);
15126     heur_pn_subdissector_list = register_heur_dissector_list("pn_io", proto_pn_io);
15127
15128     /* Initialise RTC1 dissection */
15129     init_pn_io_rtc1(proto_pn_io);
15130
15131     /* Cleanup functions of PNIO protocol */
15132     register_cleanup_routine(pnio_cleanup);
15133
15134     register_conversation_filter("pn_io", "PN-IO AR", pn_io_ar_conv_valid, pn_io_ar_conv_filter);
15135     register_conversation_filter("pn_io", "PN-IO AR (with data)", pn_io_ar_conv_valid, pn_io_ar_conv_data_filter);
15136 }
15137
15138
15139 void
15140 proto_reg_handoff_pn_io (void)
15141 {
15142     /* Register the protocols as dcerpc */
15143     dcerpc_init_uuid (proto_pn_io_device, ett_pn_io, &uuid_pn_io_device, ver_pn_io_device, pn_io_dissectors, hf_pn_io_opnum);
15144     dcerpc_init_uuid (proto_pn_io_controller, ett_pn_io, &uuid_pn_io_controller, ver_pn_io_controller, pn_io_dissectors, hf_pn_io_opnum);
15145     dcerpc_init_uuid (proto_pn_io_supervisor, ett_pn_io, &uuid_pn_io_supervisor, ver_pn_io_supervisor, pn_io_dissectors, hf_pn_io_opnum);
15146     dcerpc_init_uuid (proto_pn_io_parameterserver, ett_pn_io, &uuid_pn_io_parameterserver, ver_pn_io_parameterserver, pn_io_dissectors, hf_pn_io_opnum);
15147     dcerpc_init_uuid (proto_pn_io_implicitar, ett_pn_io, &uuid_pn_io_implicitar, ver_pn_io_implicitar, pn_io_dissectors, hf_pn_io_opnum);
15148
15149     heur_dissector_add("pn_rt", dissect_PNIO_heur, "PROFINET IO", "pn_io_pn_rt", proto_pn_io, HEURISTIC_ENABLE);
15150 }
15151
15152 /*
15153  * Editor modelines
15154  *
15155  * Local Variables:
15156  * c-basic-offset: 4
15157  * tab-width: 8
15158  * indent-tabs-mode: nil
15159  * End:
15160  *
15161  * ex: set shiftwidth=4 tabstop=8 expandtab:
15162  * :indentSize=4:tabSize=8:noTabs=true:
15163  */