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  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 /*
12  * The PN-IO protocol is a field bus protocol related to decentralized
13  * periphery and is developed by the PROFIBUS Nutzerorganisation e.V. (PNO),
14  * see: www.profibus.com
15  *
16  *
17  * PN-IO is based on the common DCE-RPC and the "lightweight" PN-RT
18  * (ethernet type 0x8892) protocols.
19  *
20  * The context manager (CM) part is handling context information
21  * (like establishing, ...) and is using DCE-RPC as its underlying
22  * protocol.
23  *
24  * The actual cyclic data transfer and acyclic notification uses the
25  * "lightweight" PN-RT protocol.
26  *
27  * There are some other related PROFINET protocols (e.g. PN-DCP, which is
28  * handling addressing topics).
29  *
30  * Please note: the PROFINET CBA protocol is independent of the PN-IO protocol!
31  */
32 
33 /*
34  * Cyclic PNIO RTC1 Data Dissection:
35  *
36  * To dissect cyclic PNIO RTC1 frames, this plug-in has to collect important module
37  * information out of "Ident OK", "Connect Request" and "Write Response"
38  * frames first. This information will be used within "packet-pn-rtc-one.c" to
39  * dissect PNIO and PROFIsafe RTC1 frames.
40  *
41  * The data of Stationname-, -type and -id will be gained out of
42  * packet-pn-dcp.c. The header packet-pn.h will save those data.
43  *
44  * Overview for cyclic PNIO RTC1 data dissection functions:
45  *   -> dissect_IOCRBlockReq_block     (Save amount of IODataObjects, IOCS)
46  *   -> dissect_DataDescription        (Save important values for cyclic data)
47  *   -> dissect_ExpectedSubmoduleBlockReq_block    (Get GSD information)
48  *   -> dissect_ModuleDiffBlock_block  (Module has different ID)
49  *   -> dissect_ProfiSafeParameterRequest  (Save PROFIsafe parameters)
50  *   -> dissect_RecordDataWrite        (Call ProfiSafeParameterRequest)
51  *   -> pnio_rtc1_cleanup              (Reset routine of saved RTC1 information)
52  */
53 
54 
55 #include "config.h"
56 
57 #include <string.h>
58 #include <glib.h>
59 
60 #include <epan/packet.h>
61 #include <epan/to_str.h>
62 #include <epan/wmem_scopes.h>
63 #include <epan/dissectors/packet-dcerpc.h>
64 #include <epan/expert.h>
65 #include <epan/conversation_filter.h>
66 #include <epan/proto_data.h>
67 
68 #include <wsutil/file_util.h>
69 #include <epan/prefs.h>
70 
71 #include "packet-pn.h"
72 
73 #include <stdio.h>
74 #include <stdlib.h>
75 
76 void proto_register_pn_io(void);
77 void proto_reg_handoff_pn_io(void);
78 
79 
80 #define MAX_NAMELENGTH           200    /* max. length of the given paths */
81 #define F_MESSAGE_TRAILER_4BYTE  4      /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte */
82 #define PN_INPUT_CR              1      /* PROFINET Input Connect Request value */
83 #define PN_INPUT_DATADESCRITPION 1      /* PROFINET Input Data Description value */
84 
85 
86 static int proto_pn_io = -1;
87 static int proto_pn_io_device = -1;
88 static int proto_pn_io_controller = -1;
89 static int proto_pn_io_supervisor = -1;
90 static int proto_pn_io_parameterserver = -1;
91 static int proto_pn_io_implicitar = -1;
92 int proto_pn_io_apdu_status = -1;
93 
94 static int hf_pn_io_opnum = -1;
95 static int hf_pn_io_reserved16 = -1;
96 
97 static int hf_pn_io_array = -1;
98 static int hf_pn_io_args_max = -1;
99 static int hf_pn_io_args_len = -1;
100 static int hf_pn_io_array_max_count = -1;
101 static int hf_pn_io_array_offset = -1;
102 static int hf_pn_io_array_act_count = -1;
103 
104 static int hf_pn_io_ar_type = -1;
105 static int hf_pn_io_artype_req = -1;
106 static int hf_pn_io_cminitiator_macadd = -1;
107 static int hf_pn_io_cminitiator_objectuuid = -1;
108 static int hf_pn_io_parameter_server_objectuuid = -1;
109 static int hf_pn_io_ar_data = -1;
110 static int hf_pn_io_ar_properties = -1;
111 static int hf_pn_io_ar_properties_state = -1;
112 static int hf_pn_io_ar_properties_supervisor_takeover_allowed = -1;
113 static int hf_pn_io_ar_properties_parameterization_server = -1;
114 /* removed within 2.3
115 static int hf_pn_io_ar_properties_data_rate = -1;
116 */
117 static int hf_pn_io_ar_properties_reserved_1 = -1;
118 static int hf_pn_io_ar_properties_device_access = -1;
119 static int hf_pn_io_ar_properties_companion_ar = -1;
120 static int hf_pn_io_ar_properties_achnowledge_companion_ar = -1;
121 static int hf_pn_io_ar_properties_reserved = -1;
122 static int hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode = -1;
123 static int hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode = -1;
124 static int hf_pn_io_ar_properties_pull_module_alarm_allowed = -1;
125 
126 static int hf_pn_RedundancyInfo = -1;
127 static int hf_pn_RedundancyInfo_reserved = -1;
128 static int hf_pn_io_number_of_ARDATAInfo = -1;
129 
130 static int hf_pn_io_cminitiator_activitytimeoutfactor = -1;
131 static int hf_pn_io_cminitiator_udprtport = -1;
132 static int hf_pn_io_station_name_length = -1;
133 static int hf_pn_io_cminitiator_station_name = -1;
134 /* static int hf_pn_io_responder_station_name = -1; */
135 static int hf_pn_io_arproperties_StartupMode = -1;
136 
137 static int hf_pn_io_parameter_server_station_name = -1;
138 
139 static int hf_pn_io_cmresponder_macadd = -1;
140 static int hf_pn_io_cmresponder_udprtport = -1;
141 
142 static int hf_pn_io_number_of_iocrs = -1;
143 static int hf_pn_io_iocr_tree = -1;
144 static int hf_pn_io_iocr_type = -1;
145 static int hf_pn_io_iocr_reference = -1;
146 static int hf_pn_io_iocr_SubframeOffset = -1;
147 static int hf_pn_io_iocr_SubframeData =-1;
148 /* static int hf_pn_io_iocr_txports_port = -1; */
149 /* static int hf_pn_io_iocr_txports_redundantport = -1; */
150 static int hf_pn_io_sr_properties_Reserved_1 = -1;
151 static int hf_pn_io_sr_properties_Mode = -1;
152 static int hf_pn_io_sr_properties_Reserved_2 = -1;
153 static int hf_pn_io_sr_properties_Reserved_3 = -1;
154 static int hf_pn_io_RedundancyDataHoldFactor = -1;
155 static int hf_pn_io_sr_properties = -1;
156 static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0 = -1;
157 static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1 = -1;
158 
159 static int hf_pn_io_arvendor_strucidentifier_if0_low = -1;
160 static int hf_pn_io_arvendor_strucidentifier_if0_high = -1;
161 static int hf_pn_io_arvendor_strucidentifier_if0_is8000= -1;
162 static int hf_pn_io_arvendor_strucidentifier_not0 = -1;
163 
164 static int hf_pn_io_lt = -1;
165 static int hf_pn_io_iocr_properties = -1;
166 static int hf_pn_io_iocr_properties_rtclass = -1;
167 static int hf_pn_io_iocr_properties_reserved_1 = -1;
168 static int hf_pn_io_iocr_properties_media_redundancy = -1;
169 static int hf_pn_io_iocr_properties_reserved_2 = -1;
170 static int hf_pn_io_iocr_properties_reserved_3 = -1;
171 static int hf_pn_io_iocr_properties_fast_forwarding_mac_adr = -1;
172 static int hf_pn_io_iocr_properties_distributed_subframe_watchdog = -1;
173 static int hf_pn_io_iocr_properties_full_subframe_structure = -1;
174 
175 
176 static int hf_pn_io_data_length = -1;
177 static int hf_pn_io_ir_frame_data = -1;
178 static int hf_pn_io_frame_id = -1;
179 static int hf_pn_io_send_clock_factor = -1;
180 static int hf_pn_io_reduction_ratio = -1;
181 static int hf_pn_io_phase = -1;
182 static int hf_pn_io_sequence = -1;
183 static int hf_pn_io_frame_send_offset = -1;
184 static int hf_pn_io_frame_data_properties = -1;
185 static int hf_pn_io_frame_data_properties_forwarding_Mode = -1;
186 static int hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd = -1;
187 static int hf_pn_io_frame_data_properties_FragmentMode = -1;
188 static int hf_pn_io_frame_data_properties_reserved_1 = -1;
189 static int hf_pn_io_frame_data_properties_reserved_2 = -1;
190 static int hf_pn_io_watchdog_factor = -1;
191 static int hf_pn_io_data_hold_factor = -1;
192 static int hf_pn_io_iocr_tag_header = -1;
193 static int hf_pn_io_iocr_multicast_mac_add = -1;
194 static int hf_pn_io_number_of_apis = -1;
195 static int hf_pn_io_number_of_io_data_objects = -1;
196 static int hf_pn_io_io_data_object_frame_offset = -1;
197 static int hf_pn_io_number_of_iocs = -1;
198 static int hf_pn_io_iocs_frame_offset = -1;
199 
200 static int hf_pn_io_SFIOCRProperties = -1;
201 static int hf_pn_io_DistributedWatchDogFactor = -1;
202 static int hf_pn_io_RestartFactorForDistributedWD = -1;
203 static int hf_pn_io_SFIOCRProperties_DFPmode = -1;
204 static int hf_pn_io_SFIOCRProperties_reserved_1 = -1;
205 static int hf_pn_io_SFIOCRProperties_reserved_2 = -1;
206 static int hf_pn_io_SFIOCRProperties_DFPType =-1;
207 static int hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout = -1;
208 static int hf_pn_io_SFIOCRProperties_SFCRC16 = -1;
209 
210 static int hf_pn_io_subframe_data = -1;
211 static int hf_pn_io_subframe_data_reserved1 = -1;
212 static int hf_pn_io_subframe_data_reserved2 = -1;
213 
214 static int hf_pn_io_subframe_data_position = -1;
215 static int hf_pn_io_subframe_reserved1 = -1;
216 static int hf_pn_io_subframe_data_length = -1;
217 static int hf_pn_io_subframe_reserved2 = -1;
218 
219 static int hf_pn_io_alarmcr_type = -1;
220 static int hf_pn_io_alarmcr_properties = -1;
221 static int hf_pn_io_alarmcr_properties_priority = -1;
222 static int hf_pn_io_alarmcr_properties_transport = -1;
223 static int hf_pn_io_alarmcr_properties_reserved = -1;
224 
225 static int hf_pn_io_rta_timeoutfactor = -1;
226 static int hf_pn_io_rta_retries = -1;
227 static int hf_pn_io_localalarmref = -1;
228 static int hf_pn_io_remotealarmref = -1;
229 static int hf_pn_io_maxalarmdatalength = -1;
230 static int hf_pn_io_alarmcr_tagheaderhigh = -1;
231 static int hf_pn_io_alarmcr_tagheaderlow = -1;
232 
233 static int hf_pn_io_IRData_uuid = -1;
234 static int hf_pn_io_ar_uuid = -1;
235 static int hf_pn_io_target_ar_uuid = -1;
236 static int hf_pn_io_ar_discriminator = -1;
237 static int hf_pn_io_ar_configid = -1;
238 static int hf_pn_io_ar_arnumber = -1;
239 static int hf_pn_io_ar_arresource = -1;
240 static int hf_pn_io_ar_arreserved = -1;
241 static int hf_pn_io_ar_selector = -1;
242 static int hf_pn_io_api_tree = -1;
243 static int hf_pn_io_module_tree = -1;
244 static int hf_pn_io_submodule_tree = -1;
245 static int hf_pn_io_io_data_object = -1;
246 /* General module information */
247 static int hf_pn_io_io_cs = -1;
248 
249 static int hf_pn_io_substitutionmode = -1;
250 
251 static int hf_pn_io_api = -1;
252 static int hf_pn_io_slot_nr = -1;
253 static int hf_pn_io_subslot_nr = -1;
254 static int hf_pn_io_index = -1;
255 static int hf_pn_io_seq_number = -1;
256 static int hf_pn_io_record_data_length = -1;
257 static int hf_pn_io_add_val1 = -1;
258 static int hf_pn_io_add_val2 = -1;
259 
260 static int hf_pn_io_block = -1;
261 static int hf_pn_io_block_header = -1;
262 static int hf_pn_io_block_type = -1;
263 static int hf_pn_io_block_length = -1;
264 static int hf_pn_io_block_version_high = -1;
265 static int hf_pn_io_block_version_low = -1;
266 
267 static int hf_pn_io_sessionkey = -1;
268 static int hf_pn_io_control_command = -1;
269 static int hf_pn_io_control_command_prmend = -1;
270 static int hf_pn_io_control_command_applready = -1;
271 static int hf_pn_io_control_command_release = -1;
272 static int hf_pn_io_control_command_done = -1;
273 static int hf_pn_io_control_command_ready_for_companion = -1;
274 static int hf_pn_io_control_command_ready_for_rt_class3 = -1;
275 static int hf_pn_io_control_command_prmbegin = -1;
276 static int hf_pn_io_control_command_reserved_7_15 = -1;
277 static int hf_pn_io_control_block_properties = -1;
278 static int hf_pn_io_control_block_properties_applready = -1;
279 static int hf_pn_io_control_block_properties_applready_bit0 = -1;
280 static int hf_pn_io_control_block_properties_applready_bit1 = -1;
281 static int hf_pn_io_control_block_properties_applready_otherbits = -1;
282 
283 /* static int hf_pn_io_AlarmSequenceNumber = -1; */
284 static int hf_pn_io_control_command_reserved = -1;
285 static int hf_pn_io_SubmoduleListEntries = -1;
286 
287 static int hf_pn_io_alarm_type = -1;
288 static int hf_pn_io_alarm_specifier = -1;
289 static int hf_pn_io_alarm_specifier_sequence = -1;
290 static int hf_pn_io_alarm_specifier_channel = -1;
291 static int hf_pn_io_alarm_specifier_manufacturer = -1;
292 static int hf_pn_io_alarm_specifier_submodule = -1;
293 static int hf_pn_io_alarm_specifier_ardiagnosis = -1;
294 
295 static int hf_pn_io_alarm_dst_endpoint = -1;
296 static int hf_pn_io_alarm_src_endpoint = -1;
297 static int hf_pn_io_pdu_type = -1;
298 static int hf_pn_io_pdu_type_type = -1;
299 static int hf_pn_io_pdu_type_version = -1;
300 static int hf_pn_io_add_flags = -1;
301 static int hf_pn_io_window_size = -1;
302 static int hf_pn_io_tack = -1;
303 static int hf_pn_io_send_seq_num = -1;
304 static int hf_pn_io_ack_seq_num = -1;
305 static int hf_pn_io_var_part_len = -1;
306 
307 static int hf_pn_io_number_of_modules = -1;
308 static int hf_pn_io_module_ident_number = -1;
309 static int hf_pn_io_module_properties = -1;
310 static int hf_pn_io_module_state = -1;
311 static int hf_pn_io_number_of_submodules = -1;
312 static int hf_pn_io_submodule_ident_number = -1;
313 static int hf_pn_io_submodule_properties = -1;
314 static int hf_pn_io_submodule_properties_type = -1;
315 static int hf_pn_io_submodule_properties_shared_input = -1;
316 static int hf_pn_io_submodule_properties_reduce_input_submodule_data_length = -1;
317 static int hf_pn_io_submodule_properties_reduce_output_submodule_data_length = -1;
318 static int hf_pn_io_submodule_properties_discard_ioxs = -1;
319 static int hf_pn_io_submodule_properties_reserved = -1;
320 
321 static int hf_pn_io_submodule_state = -1;
322 static int hf_pn_io_submodule_state_format_indicator = -1;
323 static int hf_pn_io_submodule_state_add_info = -1;
324 static int hf_pn_io_submodule_state_qualified_info = -1;
325 static int hf_pn_io_submodule_state_maintenance_required = -1;
326 static int hf_pn_io_submodule_state_maintenance_demanded = -1;
327 static int hf_pn_io_submodule_state_diag_info = -1;
328 static int hf_pn_io_submodule_state_ar_info = -1;
329 static int hf_pn_io_submodule_state_ident_info = -1;
330 static int hf_pn_io_submodule_state_detail = -1;
331 
332 static int hf_pn_io_data_description_tree = -1;
333 static int hf_pn_io_data_description = -1;
334 static int hf_pn_io_submodule_data_length = -1;
335 static int hf_pn_io_length_iocs = -1;
336 static int hf_pn_io_length_iops = -1;
337 
338 static int hf_pn_io_iocs = -1;
339 static int hf_pn_io_iops = -1;
340 static int hf_pn_io_ioxs_extension = -1;
341 static int hf_pn_io_ioxs_res14 = -1;
342 static int hf_pn_io_ioxs_instance = -1;
343 static int hf_pn_io_ioxs_datastate = -1;
344 
345 static int hf_pn_io_address_resolution_properties = -1;
346 static int hf_pn_io_mci_timeout_factor = -1;
347 static int hf_pn_io_provider_station_name = -1;
348 
349 static int hf_pn_io_user_structure_identifier = -1;
350 static int hf_pn_io_user_structure_identifier_manf = -1;
351 
352 static int hf_pn_io_channel_number = -1;
353 static int hf_pn_io_channel_properties = -1;
354 static int hf_pn_io_channel_properties_type = -1;
355 static int hf_pn_io_channel_properties_accumulative = -1;
356 static int hf_pn_io_channel_properties_maintenance = -1;
357 
358 
359 static int hf_pn_io_NumberOfSubframeBlocks = -1;
360 static int hf_pn_io_channel_properties_specifier = -1;
361 static int hf_pn_io_channel_properties_direction = -1;
362 
363 static int hf_pn_io_channel_error_type = -1;
364 static int hf_pn_io_ext_channel_error_type0 = -1;
365 static int hf_pn_io_ext_channel_error_type0x8000 = -1;
366 static int hf_pn_io_ext_channel_error_type0x8001 = -1;
367 static int hf_pn_io_ext_channel_error_type0x8002 = -1;
368 static int hf_pn_io_ext_channel_error_type0x8003 = -1;
369 static int hf_pn_io_ext_channel_error_type0x8004 = -1;
370 static int hf_pn_io_ext_channel_error_type0x8005 = -1;
371 static int hf_pn_io_ext_channel_error_type0x8007 = -1;
372 static int hf_pn_io_ext_channel_error_type0x8008 = -1;
373 static int hf_pn_io_ext_channel_error_type0x800A = -1;
374 static int hf_pn_io_ext_channel_error_type0x800B = -1;
375 static int hf_pn_io_ext_channel_error_type0x800C = -1;
376 
377 static int hf_pn_io_ext_channel_error_type = -1;
378 
379 static int hf_pn_io_ext_channel_add_value = -1;
380 
381 static int hf_pn_io_ptcp_subdomain_id = -1;
382 static int hf_pn_io_ir_data_id = -1;
383 static int hf_pn_io_max_bridge_delay = -1;
384 static int hf_pn_io_number_of_ports = -1;
385 static int hf_pn_io_max_port_tx_delay = -1;
386 static int hf_pn_io_max_port_rx_delay = -1;
387 
388 static int hf_pn_io_max_line_rx_delay = -1;
389 static int hf_pn_io_yellowtime = -1;
390 static int hf_pn_io_reserved_interval_begin = -1;
391 static int hf_pn_io_reserved_interval_end = -1;
392 static int hf_pn_io_pllwindow = -1;
393 static int hf_pn_io_sync_send_factor = -1;
394 static int hf_pn_io_sync_properties = -1;
395 static int hf_pn_io_sync_frame_address = -1;
396 static int hf_pn_io_ptcp_timeout_factor = -1;
397 static int hf_pn_io_ptcp_takeover_timeout_factor = -1;
398 static int hf_pn_io_ptcp_master_startup_time = -1;
399 static int hf_pn_io_ptcp_master_priority_1 = -1;
400 static int hf_pn_io_ptcp_master_priority_2 = -1;
401 static int hf_pn_io_ptcp_length_subdomain_name = -1;
402 static int hf_pn_io_ptcp_subdomain_name = -1;
403 
404 static int hf_pn_io_MultipleInterfaceMode_NameOfDevice = -1;
405 static int hf_pn_io_MultipleInterfaceMode_reserved_1 = -1;
406 static int hf_pn_io_MultipleInterfaceMode_reserved_2 = -1;
407 /* added Portstatistics */
408 static int hf_pn_io_pdportstatistic_counter_status = -1;
409 static int hf_pn_io_pdportstatistic_counter_status_ifInOctets = -1;
410 static int hf_pn_io_pdportstatistic_counter_status_ifOutOctets = -1;
411 static int hf_pn_io_pdportstatistic_counter_status_ifInDiscards = -1;
412 static int hf_pn_io_pdportstatistic_counter_status_ifOutDiscards = -1;
413 static int hf_pn_io_pdportstatistic_counter_status_ifInErrors = -1;
414 static int hf_pn_io_pdportstatistic_counter_status_ifOutErrors = -1;
415 static int hf_pn_io_pdportstatistic_counter_status_reserved = -1;
416 static int hf_pn_io_pdportstatistic_ifInOctets = -1;
417 static int hf_pn_io_pdportstatistic_ifOutOctets = -1;
418 static int hf_pn_io_pdportstatistic_ifInDiscards = -1;
419 static int hf_pn_io_pdportstatistic_ifOutDiscards = -1;
420 static int hf_pn_io_pdportstatistic_ifInErrors = -1;
421 static int hf_pn_io_pdportstatistic_ifOutErrors = -1;
422 /* end of port statistics */
423 
424 static int hf_pn_io_domain_boundary = -1;
425 static int hf_pn_io_domain_boundary_ingress = -1;
426 static int hf_pn_io_domain_boundary_egress = -1;
427 static int hf_pn_io_multicast_boundary = -1;
428 static int hf_pn_io_adjust_properties = -1;
429 static int hf_pn_io_PreambleLength = -1;
430 static int hf_pn_io_mau_type = -1;
431 static int hf_pn_io_mau_type_mode = -1;
432 static int hf_pn_io_port_state = -1;
433 static int hf_pn_io_link_state_port = -1;
434 static int hf_pn_io_link_state_link = -1;
435 static int hf_pn_io_line_delay = -1;
436 static int hf_pn_io_line_delay_value = -1;
437 static int hf_pn_io_cable_delay_value = -1;
438 static int hf_pn_io_line_delay_format_indicator = -1;
439 static int hf_pn_io_number_of_peers = -1;
440 static int hf_pn_io_length_peer_port_id = -1;
441 static int hf_pn_io_peer_port_id = -1;
442 static int hf_pn_io_length_peer_chassis_id = -1;
443 static int hf_pn_io_peer_chassis_id = -1;
444 static int hf_pn_io_length_own_port_id = -1;
445 static int hf_pn_io_own_port_id = -1;
446 static int hf_pn_io_peer_macadd = -1;
447 static int hf_pn_io_media_type = -1;
448 static int hf_pn_io_macadd = -1;
449 static int hf_pn_io_length_own_chassis_id = -1;
450 static int hf_pn_io_own_chassis_id = -1;
451 
452 static int hf_pn_io_ethertype = -1;
453 static int hf_pn_io_rx_port = -1;
454 static int hf_pn_io_frame_details = -1;
455 static int hf_pn_io_frame_details_sync_frame = -1;
456 static int hf_pn_io_frame_details_meaning_frame_send_offset = -1;
457 static int hf_pn_io_frame_details_reserved = -1;
458 static int hf_pn_io_nr_of_tx_port_groups = -1;
459 static int hf_pn_io_TxPortGroupProperties = -1;
460 static int hf_pn_io_TxPortGroupProperties_bit0 = -1;
461 static int hf_pn_io_TxPortGroupProperties_bit1 = -1;
462 static int hf_pn_io_TxPortGroupProperties_bit2 = -1;
463 static int hf_pn_io_TxPortGroupProperties_bit3 = -1;
464 static int hf_pn_io_TxPortGroupProperties_bit4 = -1;
465 static int hf_pn_io_TxPortGroupProperties_bit5 = -1;
466 static int hf_pn_io_TxPortGroupProperties_bit6 = -1;
467 static int hf_pn_io_TxPortGroupProperties_bit7 = -1;
468 
469 static int hf_pn_io_start_of_red_frame_id = -1;
470 static int hf_pn_io_end_of_red_frame_id = -1;
471 static int hf_pn_io_ir_begin_end_port = -1;
472 static int hf_pn_io_number_of_assignments = -1;
473 static int hf_pn_io_number_of_phases = -1;
474 static int hf_pn_io_red_orange_period_begin_tx = -1;
475 static int hf_pn_io_orange_period_begin_tx = -1;
476 static int hf_pn_io_green_period_begin_tx = -1;
477 static int hf_pn_io_red_orange_period_begin_rx = -1;
478 static int hf_pn_io_orange_period_begin_rx = -1;
479 static int hf_pn_io_green_period_begin_rx = -1;
480 /* static int hf_pn_io_tx_phase_assignment = -1; */
481 static int hf_pn_ir_tx_phase_assignment = -1;
482 static int hf_pn_ir_rx_phase_assignment = -1;
483 static int hf_pn_io_tx_phase_assignment_begin_value = -1;
484 static int hf_pn_io_tx_phase_assignment_orange_begin = -1;
485 static int hf_pn_io_tx_phase_assignment_end_reserved = -1;
486 static int hf_pn_io_tx_phase_assignment_reserved = -1;
487 /* static int hf_pn_io_rx_phase_assignment = -1; */
488 
489 static int hf_pn_io_slot = -1;
490 static int hf_pn_io_subslot = -1;
491 static int hf_pn_io_number_of_slots = -1;
492 static int hf_pn_io_number_of_subslots = -1;
493 
494 /* static int hf_pn_io_maintenance_required_drop_budget = -1; */
495 /* static int hf_pn_io_maintenance_demanded_drop_budget = -1; */
496 /* static int hf_pn_io_error_drop_budget = -1; */
497 
498 static int hf_pn_io_maintenance_required_power_budget = -1;
499 static int hf_pn_io_maintenance_demanded_power_budget = -1;
500 static int hf_pn_io_error_power_budget = -1;
501 
502 static int hf_pn_io_fiber_optic_type = -1;
503 static int hf_pn_io_fiber_optic_cable_type = -1;
504 
505 static int hf_pn_io_controller_appl_cycle_factor = -1;
506 static int hf_pn_io_time_data_cycle = -1;
507 static int hf_pn_io_time_io_input = -1;
508 static int hf_pn_io_time_io_output = -1;
509 static int hf_pn_io_time_io_input_valid = -1;
510 static int hf_pn_io_time_io_output_valid = -1;
511 
512 static int hf_pn_io_maintenance_status = -1;
513 static int hf_pn_io_maintenance_status_required = -1;
514 static int hf_pn_io_maintenance_status_demanded = -1;
515 
516 static int hf_pn_io_vendor_id_high = -1;
517 static int hf_pn_io_vendor_id_low = -1;
518 static int hf_pn_io_vendor_block_type = -1;
519 static int hf_pn_io_order_id = -1;
520 static int hf_pn_io_im_serial_number = -1;
521 static int hf_pn_io_im_hardware_revision = -1;
522 static int hf_pn_io_im_revision_prefix = -1;
523 static int hf_pn_io_im_sw_revision_functional_enhancement = -1;
524 static int hf_pn_io_im_revision_bugfix = -1;
525 static int hf_pn_io_im_sw_revision_internal_change = -1;
526 static int hf_pn_io_im_revision_counter = -1;
527 static int hf_pn_io_im_profile_id = -1;
528 static int hf_pn_io_im_profile_specific_type = -1;
529 static int hf_pn_io_im_version_major = -1;
530 static int hf_pn_io_im_version_minor = -1;
531 static int hf_pn_io_im_supported = -1;
532 static int hf_pn_io_im_numberofentries = -1;
533 static int hf_pn_io_im_annotation = -1;
534 static int hf_pn_io_im_order_id = -1;
535 
536 static int hf_pn_io_number_of_ars = -1;
537 
538 static int hf_pn_io_cycle_counter = -1;
539 static int hf_pn_io_data_status = -1;
540 static int hf_pn_io_data_status_res67 = -1;
541 static int hf_pn_io_data_status_ok = -1;
542 static int hf_pn_io_data_status_operate = -1;
543 static int hf_pn_io_data_status_res3 = -1;
544 static int hf_pn_io_data_status_valid = -1;
545 static int hf_pn_io_data_status_res1 = -1;
546 static int hf_pn_io_data_status_primary = -1;
547 static int hf_pn_io_transfer_status = -1;
548 
549 static int hf_pn_io_actual_local_time_stamp = -1;
550 static int hf_pn_io_number_of_log_entries = -1;
551 static int hf_pn_io_local_time_stamp = -1;
552 static int hf_pn_io_entry_detail = -1;
553 
554 static int hf_pn_io_ip_address = -1;
555 static int hf_pn_io_subnetmask = -1;
556 static int hf_pn_io_standard_gateway = -1;
557 
558 static int hf_pn_io_mrp_domain_uuid = -1;
559 static int hf_pn_io_mrp_role = -1;
560 static int hf_pn_io_mrp_length_domain_name = -1;
561 static int hf_pn_io_mrp_domain_name = -1;
562 static int hf_pn_io_mrp_instances = -1;
563 static int hf_pn_io_mrp_instance = -1;
564 
565 static int hf_pn_io_mrp_prio = -1;
566 static int hf_pn_io_mrp_topchgt = -1;
567 static int hf_pn_io_mrp_topnrmax = -1;
568 static int hf_pn_io_mrp_tstshortt = -1;
569 static int hf_pn_io_mrp_tstdefaultt = -1;
570 static int hf_pn_io_mrp_tstnrmax = -1;
571 static int hf_pn_io_mrp_check = -1;
572 static int hf_pn_io_mrp_check_mrm = -1;
573 static int hf_pn_io_mrp_check_mrpdomain = -1;
574 static int hf_pn_io_mrp_check_reserved_1 = -1;
575 static int hf_pn_io_mrp_check_reserved_2 = -1;
576 
577 static int hf_pn_io_mrp_rtmode = -1;
578 static int hf_pn_io_mrp_rtmode_rtclass12 = -1;
579 static int hf_pn_io_mrp_rtmode_rtclass3 = -1;
580 static int hf_pn_io_mrp_rtmode_reserved1 = -1;
581 static int hf_pn_io_mrp_rtmode_reserved2 = -1;
582 
583 static int hf_pn_io_mrp_lnkdownt = -1;
584 static int hf_pn_io_mrp_lnkupt = -1;
585 static int hf_pn_io_mrp_lnknrmax = -1;
586 static int hf_pn_io_mrp_version = -1;
587 
588 static int hf_pn_io_substitute_active_flag = -1;
589 static int hf_pn_io_length_data = -1;
590 
591 static int hf_pn_io_mrp_ring_state = -1;
592 static int hf_pn_io_mrp_rt_state = -1;
593 
594 static int hf_pn_io_im_tag_function = -1;
595 static int hf_pn_io_im_tag_location = -1;
596 static int hf_pn_io_im_date = -1;
597 static int hf_pn_io_im_descriptor = -1;
598 
599 static int hf_pn_io_fs_hello_mode = -1;
600 static int hf_pn_io_fs_hello_interval = -1;
601 static int hf_pn_io_fs_hello_retry = -1;
602 static int hf_pn_io_fs_hello_delay = -1;
603 
604 static int hf_pn_io_fs_parameter_mode = -1;
605 static int hf_pn_io_fs_parameter_uuid = -1;
606 
607 
608 static int hf_pn_io_check_sync_mode = -1;
609 static int hf_pn_io_check_sync_mode_reserved = -1;
610 static int hf_pn_io_check_sync_mode_sync_master = -1;
611 static int hf_pn_io_check_sync_mode_cable_delay = -1;
612 
613 /* PROFIsafe fParameters */
614 static int hf_pn_io_ps_f_prm_flag1 = -1;
615 static int hf_pn_io_ps_f_prm_flag1_chck_seq = -1;
616 static int hf_pn_io_ps_f_prm_flag1_chck_ipar = -1;
617 static int hf_pn_io_ps_f_prm_flag1_sil = -1;
618 static int hf_pn_io_ps_f_prm_flag1_crc_len = -1;
619 static int hf_pn_io_ps_f_prm_flag1_crc_seed = -1;
620 static int hf_pn_io_ps_f_prm_flag1_reserved = -1;
621 static int hf_pn_io_ps_f_prm_flag2 = -1;
622 static int hf_pn_io_ps_f_wd_time = -1;
623 static int hf_pn_io_ps_f_ipar_crc = -1;
624 static int hf_pn_io_ps_f_par_crc = -1;
625 static int hf_pn_io_ps_f_src_adr = -1;
626 static int hf_pn_io_ps_f_dest_adr = -1;
627 static int hf_pn_io_ps_f_prm_flag2_reserved = -1;
628 static int hf_pn_io_ps_f_prm_flag2_f_block_id = -1;
629 static int hf_pn_io_ps_f_prm_flag2_f_par_version = -1;
630 
631 static int hf_pn_io_profidrive_request_reference = -1;
632 static int hf_pn_io_profidrive_request_id = -1;
633 static int hf_pn_io_profidrive_do_id = -1;
634 static int hf_pn_io_profidrive_no_of_parameters = -1;
635 static int hf_pn_io_profidrive_response_id = -1;
636 static int hf_pn_io_profidrive_param_attribute = -1;
637 static int hf_pn_io_profidrive_param_no_of_elems = -1;
638 static int hf_pn_io_profidrive_param_number = -1;
639 static int hf_pn_io_profidrive_param_subindex = -1;
640 static int hf_pn_io_profidrive_param_format = -1;
641 static int hf_pn_io_profidrive_param_no_of_values = -1;
642 static int hf_pn_io_profidrive_param_value_byte = -1;
643 static int hf_pn_io_profidrive_param_value_word = -1;
644 static int hf_pn_io_profidrive_param_value_dword = -1;
645 static int hf_pn_io_profidrive_param_value_float = -1;
646 static int hf_pn_io_profidrive_param_value_string = -1;
647 static int hf_pn_io_profidrive_param_value_error = -1;
648 static int hf_pn_io_profidrive_param_value_error_sub = -1;
649 
650 
651 /* Sequence of Events - Reporting System Alarm/Event Information */
652 static int hf_pn_io_rs_alarm_info_reserved_0_7 = -1;
653 static int hf_pn_io_rs_alarm_info_reserved_8_15 = -1;
654 static int hf_pn_io_rs_alarm_info = -1;
655 static int hf_pn_io_rs_event_info = -1;
656 static int hf_pn_io_rs_event_block = -1;
657 static int hf_pn_io_rs_adjust_block = -1;
658 static int hf_pn_io_rs_event_data_extension = -1;
659 static int hf_pn_io_number_of_rs_event_info = -1;
660 static int hf_pn_io_rs_block_type = -1;
661 static int hf_pn_io_rs_block_length = -1;
662 static int hf_pn_io_rs_specifier = -1;
663 static int hf_pn_io_rs_specifier_sequence = -1;
664 static int hf_pn_io_rs_specifier_reserved = -1;
665 static int hf_pn_io_rs_specifier_specifier = -1;
666 static int hf_pn_io_rs_time_stamp = -1;
667 static int hf_pn_io_rs_time_stamp_status = -1;
668 static int hf_pn_io_rs_time_stamp_value = -1;
669 static int hf_pn_io_rs_minus_error = -1;
670 static int hf_pn_io_rs_plus_error = -1;
671 static int hf_pn_io_rs_extension_block_type = -1;
672 static int hf_pn_io_rs_extension_block_length = -1;
673 static int hf_pn_io_rs_reason_code = -1;
674 static int hf_pn_io_rs_reason_code_reason = -1;
675 static int hf_pn_io_rs_reason_code_detail = -1;
676 static int hf_pn_io_rs_domain_identification = -1;
677 static int hf_pn_io_rs_master_identification = -1;
678 static int hf_pn_io_soe_digital_input_current_value = -1;
679 static int hf_pn_io_soe_digital_input_current_value_value = -1;
680 static int hf_pn_io_soe_digital_input_current_value_reserved = -1;
681 static int hf_pn_io_am_device_identification = -1;
682 static int hf_pn_io_am_device_identification_device_sub_id = -1;
683 static int hf_pn_io_am_device_identification_device_id = -1;
684 static int hf_pn_io_am_device_identification_vendor_id = -1;
685 static int hf_pn_io_am_device_identification_organization = -1;
686 static int hf_pn_io_rs_adjust_info = -1;
687 static int hf_pn_io_soe_max_scan_delay = -1;
688 static int hf_pn_io_soe_adjust_specifier = -1;
689 static int hf_pn_io_soe_adjust_specifier_reserved = -1;
690 static int hf_pn_io_soe_adjust_specifier_incident = -1;
691 static int hf_pn_io_rs_properties = -1;
692 static int hf_pn_io_rs_properties_alarm_transport = -1;
693 static int hf_pn_io_rs_properties_reserved1 = -1;
694 static int hf_pn_io_rs_properties_reserved2 = -1;
695 
696 static int hf_pn_io_asset_management_info = -1;
697 static int hf_pn_io_number_of_asset_management_info = -1;
698 static int hf_pn_io_im_uniqueidentifier = -1;
699 static int hf_pn_io_am_location_structure = -1;
700 static int hf_pn_io_am_location_level_0 = -1;
701 static int hf_pn_io_am_location_level_1 = -1;
702 static int hf_pn_io_am_location_level_2 = -1;
703 static int hf_pn_io_am_location_level_3 = -1;
704 static int hf_pn_io_am_location_level_4 = -1;
705 static int hf_pn_io_am_location_level_5 = -1;
706 static int hf_pn_io_am_location_level_6 = -1;
707 static int hf_pn_io_am_location_level_7 = -1;
708 static int hf_pn_io_am_location_level_8 = -1;
709 static int hf_pn_io_am_location_level_9 = -1;
710 static int hf_pn_io_am_location_level_10 = -1;
711 static int hf_pn_io_am_location_level_11 = -1;
712 static int hf_pn_io_am_location = -1;
713 static int hf_pn_io_am_location_reserved1 = -1;
714 static int hf_pn_io_am_location_reserved2 = -1;
715 static int hf_pn_io_am_location_reserved3 = -1;
716 static int hf_pn_io_am_location_reserved4 = -1;
717 static int hf_pn_io_am_location_beginslotnum = -1;
718 static int hf_pn_io_am_location_beginsubslotnum = -1;
719 static int hf_pn_io_am_location_endslotnum = -1;
720 static int hf_pn_io_am_location_endsubslotnum = -1;
721 static int hf_pn_io_am_software_revision = -1;
722 static int hf_pn_io_am_hardware_revision = -1;
723 static int hf_pn_io_am_type_identification = -1;
724 static int hf_pn_io_am_reserved = -1;
725 
726 static int hf_pn_io_dcp_boundary_value = -1;
727 static int hf_pn_io_dcp_boundary_value_bit0 = -1;
728 static int hf_pn_io_dcp_boundary_value_bit1 = -1;
729 static int hf_pn_io_dcp_boundary_value_otherbits = -1;
730 
731 static int hf_pn_io_peer_to_peer_boundary_value = -1;
732 static int hf_pn_io_peer_to_peer_boundary_value_bit0 = -1;
733 static int hf_pn_io_peer_to_peer_boundary_value_bit1 = -1;
734 static int hf_pn_io_peer_to_peer_boundary_value_bit2 = -1;
735 static int hf_pn_io_peer_to_peer_boundary_value_otherbits = -1;
736 
737 static int hf_pn_io_mau_type_extension = -1;
738 
739 static int hf_pn_io_pe_operational_mode = -1;
740 
741 /* static int hf_pn_io_packedframe_SFCRC = -1; */
742 static gint ett_pn_io = -1;
743 static gint ett_pn_io_block = -1;
744 static gint ett_pn_io_block_header = -1;
745 static gint ett_pn_io_rtc = -1;
746 static gint ett_pn_io_rta = -1;
747 static gint ett_pn_io_pdu_type = -1;
748 static gint ett_pn_io_add_flags = -1;
749 static gint ett_pn_io_control_command = -1;
750 static gint ett_pn_io_ioxs = -1;
751 static gint ett_pn_io_api = -1;
752 static gint ett_pn_io_data_description = -1;
753 static gint ett_pn_io_module = -1;
754 static gint ett_pn_io_submodule = -1;
755 static gint ett_pn_io_io_data_object = -1;
756 static gint ett_pn_io_io_cs = -1;
757 static gint ett_pn_io_ar_properties = -1;
758 static gint ett_pn_io_iocr_properties = -1;
759 static gint ett_pn_io_submodule_properties = -1;
760 static gint ett_pn_io_alarmcr_properties = -1;
761 static gint ett_pn_io_submodule_state = -1;
762 static gint ett_pn_io_channel_properties = -1;
763 static gint ett_pn_io_slot = -1;
764 static gint ett_pn_io_subslot = -1;
765 static gint ett_pn_io_maintenance_status = -1;
766 static gint ett_pn_io_data_status = -1;
767 static gint ett_pn_io_iocr = -1;
768 static gint ett_pn_io_mrp_rtmode = -1;
769 static gint ett_pn_io_control_block_properties = -1;
770 static gint ett_pn_io_check_sync_mode = -1;
771 static gint ett_pn_io_ir_frame_data = -1;
772 static gint ett_pn_FrameDataProperties = -1;
773 static gint ett_pn_io_ar_info = -1;
774 static gint ett_pn_io_ar_data = -1;
775 static gint ett_pn_io_ir_begin_end_port = -1;
776 static gint ett_pn_io_ir_tx_phase = -1;
777 static gint ett_pn_io_ir_rx_phase = -1;
778 static gint ett_pn_io_subframe_data =-1;
779 static gint ett_pn_io_SFIOCRProperties = -1;
780 static gint ett_pn_io_frame_defails = -1;
781 static gint ett_pn_io_profisafe_f_parameter = -1;
782 static gint ett_pn_io_profisafe_f_parameter_prm_flag1 = -1;
783 static gint ett_pn_io_profisafe_f_parameter_prm_flag2 = -1;
784 static gint ett_pn_io_profidrive_parameter_request = -1;
785 static gint ett_pn_io_profidrive_parameter_response = -1;
786 static gint ett_pn_io_profidrive_parameter_address = -1;
787 static gint ett_pn_io_profidrive_parameter_value = -1;
788 static gint ett_pn_io_rs_alarm_info = -1;
789 static gint ett_pn_io_rs_event_info = -1;
790 static gint ett_pn_io_rs_event_block = -1;
791 static gint ett_pn_io_rs_adjust_block = -1;
792 static gint ett_pn_io_rs_event_data_extension = -1;
793 static gint ett_pn_io_rs_specifier = -1;
794 static gint ett_pn_io_rs_time_stamp = -1;
795 static gint ett_pn_io_am_device_identification = -1;
796 static gint ett_pn_io_rs_reason_code = -1;
797 static gint ett_pn_io_soe_digital_input_current_value = -1;
798 static gint ett_pn_io_rs_adjust_info = -1;
799 static gint ett_pn_io_soe_adjust_specifier = -1;
800 static gint ett_pn_io_sr_properties = -1;
801 static gint ett_pn_io_line_delay = -1;
802 static gint ett_pn_io_counter_status = -1;
803 
804 static gint ett_pn_io_GroupProperties = -1;
805 
806 static gint ett_pn_io_asset_management_info = -1;
807 static gint ett_pn_io_asset_management_block = -1;
808 static gint ett_pn_io_am_location = -1;
809 
810 static gint ett_pn_io_dcp_boundary = -1;
811 static gint ett_pn_io_peer_to_peer_boundary = -1;
812 
813 static gint ett_pn_io_mau_type_extension = -1;
814 
815 static gint ett_pn_io_pe_operational_mode = -1;
816 
817 #define PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH 4
818 #define PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH 2
819 #define PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH 4
820 
821 static expert_field ei_pn_io_block_version = EI_INIT;
822 static expert_field ei_pn_io_block_length = EI_INIT;
823 static expert_field ei_pn_io_unsupported = EI_INIT;
824 static expert_field ei_pn_io_localalarmref = EI_INIT;
825 static expert_field ei_pn_io_mrp_instances = EI_INIT;
826 static expert_field ei_pn_io_ar_info_not_found = EI_INIT;
827 static expert_field ei_pn_io_iocr_type = EI_INIT;
828 static expert_field ei_pn_io_frame_id = EI_INIT;
829 static expert_field ei_pn_io_nr_of_tx_port_groups = EI_INIT;
830 static expert_field ei_pn_io_max_recursion_depth_reached = EI_INIT;
831 
832 static e_guid_t uuid_pn_io_device = { 0xDEA00001, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
833 static guint16  ver_pn_io_device = 1;
834 
835 static e_guid_t uuid_pn_io_controller = { 0xDEA00002, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
836 static guint16  ver_pn_io_controller = 1;
837 
838 static e_guid_t uuid_pn_io_supervisor = { 0xDEA00003, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
839 static guint16  ver_pn_io_supervisor = 1;
840 
841 static e_guid_t uuid_pn_io_parameterserver = { 0xDEA00004, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
842 static guint16  ver_pn_io_parameterserver = 1;
843 
844 /* According to specification:
845  * Value(UUID): 00000000-0000-0000-0000-000000000000
846  * Meaning: Reserved
847  * Use: The value NIL indicates the usage of the implicit AR.
848  */
849 static e_guid_t uuid_pn_io_implicitar = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
850 static guint16  ver_pn_io_implicitar = 1;
851 
852 /* PNIO Preference Variables */
853 gboolean           pnio_ps_selection = TRUE;
854 static const char *pnio_ps_networkpath = "";
855 
856 wmem_list_t       *aruuid_frame_setup_list = NULL;
857 
858 
859 /* Allow heuristic dissection */
860 static heur_dissector_list_t heur_pn_subdissector_list;
861 
862 static const value_string pn_io_block_type[] = {
863     { 0x0000, "Reserved" },
864     { 0x0001, "Alarm Notification High"},
865     { 0x0002, "Alarm Notification Low"},
866     { 0x0008, "IODWriteReqHeader"},
867     { 0x8008, "IODWriteResHeader"},
868     { 0x0009, "IODReadReqHeader"},
869     { 0x8009, "IODReadResHeader"},
870     { 0x0010, "DiagnosisData"},
871     { 0x0011, "Reserved"},
872     { 0x0012, "ExpectedIdentificationData"},
873     { 0x0013, "RealIdentificationData"},
874     { 0x0014, "SubstituteValue"},
875     { 0x0015, "RecordInputDataObjectElement"},
876     { 0x0016, "RecordOutputDataObjectElement"},
877     { 0x0017, "reserved"},
878     { 0x0018, "ARData"},
879     { 0x0019, "LogData"},
880     { 0x001A, "APIData"},
881     { 0x001b, "SRLData"},
882     { 0x0020, "I&M0"},
883     { 0x0021, "I&M1"},
884     { 0x0022, "I&M2"},
885     { 0x0023, "I&M3"},
886     { 0x0024, "I&M4"},
887     { 0x0025, "I&M5"},
888     { 0x0026, "I&M6"},
889     { 0x0027, "I&M7"},
890     { 0x0028, "I&M8"},
891     { 0x0029, "I&M9"},
892     { 0x002A, "I&M10"},
893     { 0x002B, "I&M11"},
894     { 0x002C, "I&M12"},
895     { 0x002D, "I&M13"},
896     { 0x002E, "I&M14"},
897     { 0x002F, "I&M15"},
898     { 0x0030, "I&M0FilterDataSubmodul"},
899     { 0x0031, "I&M0FilterDataModul"},
900     { 0x0032, "I&M0FilterDataDevice"},
901     { 0x0033, "Reserved" },
902     { 0x0034, "I&M5Data"},
903     { 0x0035, "AssetManagementData"},
904     { 0x0036, "AM_FullInformation"},
905     { 0x0037, "AM_HardwareOnlyInformation"},
906     { 0x0038, "AM_FirmwareOnlyInformation" },
907     { 0x8001, "Alarm Ack High"},
908     { 0x8002, "Alarm Ack Low"},
909     { 0x0101, "ARBlockReq"},
910     { 0x8101, "ARBlockRes"},
911     { 0x0102, "IOCRBlockReq"},
912     { 0x8102, "IOCRBlockRes"},
913     { 0x0103, "AlarmCRBlockReq"},
914     { 0x8103, "AlarmCRBlockRes"},
915     { 0x0104, "ExpectedSubmoduleBlockReq"},
916     { 0x8104, "ModuleDiffBlock"},
917     { 0x0105, "PrmServerBlockReq"},
918     { 0x8105, "PrmServerBlockRes"},
919     { 0x0106, "MCRBlockReq"},
920     { 0x8106, "ARServerBlock"},
921     { 0x0107, "SubFrameBlock"},
922     { 0x0108, "ARVendorBlockReq"},
923     { 0x8108, "ARVendorBlockRes"},
924     { 0x0109, "IRInfoBlock"},
925     { 0x010A, "SRInfoBlock"},
926     { 0x010B, "ARFSUBlock"},
927     { 0x010C, "RSInfoBlock"},
928     { 0x0110, "IODControlReq Prm End.req"},
929     { 0x8110, "IODControlRes Prm End.rsp"},
930     { 0x0111, "IODControlReq Prm End.req"},
931     { 0x8111, "IODControlRes Prm End.rsp"},
932     { 0x0112, "IOXBlockReq Application Ready.req"},
933     { 0x8112, "IOXBlockRes Application Ready.rsp"},
934     { 0x0113, "IOXBlockReq Application Ready.req"},
935     { 0x8113, "IOXBlockRes Application Ready.rsp"},
936     { 0x0114, "IODReleaseReq"},
937     { 0x8114, "IODReleaseRes"},
938     { 0x0115, "ARRPCServerBlockReq"},
939     { 0x8115, "ARRPCServerBlockRes"},
940     { 0x0116, "IOXControlReq Ready for Companion.req"},
941     { 0x8116, "IOXControlRes Ready for Companion.rsp"},
942     { 0x0117, "IOXControlReq Ready for RT_CLASS_3.req"},
943     { 0x8117, "IOXControlRes Ready for RT_CLASS_3.rsp"},
944     { 0x0118, "ControlBlockPrmBegin"},
945     { 0x0119, "SubmoduleListBlock"},
946     { 0x8118, "ControlBlockPrmBeginRes"},
947 
948     { 0x0200, "PDPortDataCheck"},
949     { 0x0201, "PDevData"},
950     { 0x0202, "PDPortDataAdjust"},
951     { 0x0203, "PDSyncData"},
952     { 0x0204, "IsochronousModeData"},
953     { 0x0205, "PDIRData"},
954     { 0x0206, "PDIRGlobalData"},
955     { 0x0207, "PDIRFrameData"},
956     { 0x0208, "PDIRBeginEndData"},
957     { 0x0209, "AdjustDomainBoundary"},
958     { 0x020A, "CheckPeers"},
959     { 0x020B, "CheckLineDelay"},
960     { 0x020C, "Checking MAUType"},
961     { 0x020E, "Adjusting MAUType"},
962     { 0x020F, "PDPortDataReal"},
963     { 0x0210, "AdjustMulticastBoundary"},
964     { 0x0211, "PDInterfaceMrpDataAdjust"},
965     { 0x0212, "PDInterfaceMrpDataReal"},
966     { 0x0213, "PDInterfaceMrpDataCheck"},
967     { 0x0214, "PDPortMrpDataAdjust"},
968     { 0x0215, "PDPortMrpDataReal"},
969     { 0x0216, "Media redundancy manager parameters"},
970     { 0x0217, "Media redundancy client parameters"},
971     { 0x0218, "Media redundancy RT mode for manager"},
972     { 0x0219, "Media redundancy ring state data"},
973     { 0x021A, "Media redundancy RT ring state data"},
974     { 0x021B, "Adjust LinkState"},
975     { 0x021C, "Checking LinkState"},
976     { 0x021D, "Media redundancy RT mode for clients"},
977     { 0x021E, "CheckSyncDifference"},
978     { 0x021F, "CheckMAUTypeDifference"},
979     { 0x0220, "PDPortFODataReal"},
980     { 0x0221, "Reading real fiber optic manufacturerspecific data"},
981     { 0x0222, "PDPortFODataAdjust"},
982     { 0x0223, "PDPortFODataCheck"},
983     { 0x0224, "Adjust PeerToPeerBoundary"},
984     { 0x0225, "Adjust DCPBoundary"},
985     { 0x0226, "Adjust PreambleLength"},
986     { 0x0227, "CheckMAUType-Extension"},
987     { 0x0228, "Reading real fiber optic diagnosis data"},
988     { 0x0229, "AdjustMAUType-Extension"},
989     { 0x022A, "PDIRSubframeData"},
990     { 0x022B, "SubframeBlock"},
991     { 0x0230, "PDNCDataCheck"},
992     { 0x0231, "MrpInstanceDataAdjust"},
993     { 0x0232, "MrpInstanceDataReal"},
994     { 0x0233, "MrpInstanceDataCheck"},
995     { 0x0241, "PDRsiInstances"},
996     { 0x0240, "PDInterfaceDataReal"},
997     { 0x0250, "PDInterfaceAdjust"},
998     { 0x0251, "PDPortStatistic"},
999     { 0x0400, "MultipleBlockHeader"},
1000     { 0x0401, "COContainerContent"},
1001     { 0x0500, "RecordDataReadQuery"},
1002     { 0x0600, "FSHello"},
1003     { 0x0601, "FSParameterBlock"},
1004     { 0x0608, "PDInterfaceFSUDataAdjust"},
1005     { 0x0609, "ARFSUDataAdjust"},
1006     { 0x0700, "AutoConfiguration"},
1007     { 0x0701, "AutoConfiguration Communication"},
1008     { 0x0702, "AutoConfiguration Configuration"},
1009     { 0x0810, "PE_EntityFilterData"},
1010     { 0x0811, "PE_EntityStatusData"},
1011     { 0x0900, "RS_AdjustObserver" },
1012     { 0x0901, "RS_GetEvent" },
1013     { 0x0902, "RS_AckEvent" },
1014     { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" },
1015     { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" },
1016 
1017     { 0xB060, "EDD Trace Unit (EDD)" },
1018     { 0xB061, "EDD Trace Unit (EDD)" },
1019 
1020     { 0xB070, "OHA Info (OHA)" },
1021 
1022     { 0x0F00, "MaintenanceItem"},
1023     { 0x0F01, "Upload selected Records within Upload&RetrievalItem"},
1024     { 0x0F02, "iParameterItem"},
1025     { 0x0F03, "Retrieve selected Records within Upload&RetrievalItem"},
1026     { 0x0F04, "Retrieve all Records within Upload&RetrievalItem"},
1027     { 0x0F05, "Signal a PE_OperationalMode change within PE_EnergySavingStatus" },
1028     { 0, NULL }
1029 };
1030 
1031 static const value_string pn_io_alarm_type[] = {
1032     { 0x0000, "Reserved" },
1033     { 0x0001, "Diagnosis" },
1034     { 0x0002, "Process" },
1035     { 0x0003, "Pull" },
1036     { 0x0004, "Plug" },
1037     { 0x0005, "Status" },
1038     { 0x0006, "Update" },
1039     { 0x0007, "Redundancy" },
1040     { 0x0008, "Controlled by supervisor" },
1041     { 0x0009, "Released" },
1042     { 0x000A, "Plug wrong submodule" },
1043     { 0x000B, "Return of submodule" },
1044     { 0x000C, "Diagnosis disappears" },
1045     { 0x000D, "Multicast communication mismatch notification" },
1046     { 0x000E, "Port data change notification" },
1047     { 0x000F, "Sync data changed notification" },
1048     { 0x0010, "Isochronous mode problem notification" },
1049     { 0x0011, "Network component problem notification" },
1050     { 0x0012, "Time data changed notification" },
1051     { 0x0013, "Dynamic Frame Packing problem notification" },
1052     /*0x0014 - 0x001D reserved */
1053     { 0x001E, "Upload and retrieval notification" },
1054     { 0x001F, "Pull module" },
1055     /*0x0020 - 0x007F manufacturer specific */
1056     /*0x0080 - 0x00FF reserved for profiles */
1057     /*0x0100 - 0xFFFF reserved */
1058     { 0, NULL }
1059 };
1060 
1061 static const value_string pn_io_pdu_type[] = {
1062     { 0x01, "Data-RTA-PDU" },
1063     { 0x02, "NACK-RTA-PDU" },
1064     { 0x03, "ACK-RTA-PDU" },
1065     { 0x04, "ERR-RTA-PDU" },
1066     { 0, NULL }
1067 };
1068 
1069 static const value_string hf_pn_io_frame_data_properties_forwardingMode[] = {
1070     { 0x00, "absolute mode" },
1071     { 0x01, "relative mode"},
1072     { 0, NULL }
1073 };
1074 static const value_string hf_pn_io_frame_data_properties_FFMulticastMACAdd[] = {
1075     { 0x00, "Use interface MAC destination unicast address" },
1076     { 0x01, "Use RT_CLASS_3 destination multicast address"},
1077     { 0x02, "Use FastForwardingMulticastMACAdd"},
1078     { 0x03, "reserved"},
1079     { 0, NULL }};
1080 
1081 static const value_string hf_pn_io_frame_data_properties_FragMode[] = {
1082     { 0x00, "No fragmentation" },
1083     { 0x01, "Fragmentation enabled maximum size for static fragmentation 128 bytes"},
1084     { 0x02, "Fragmentation enabled maximum size for static fragmentation 256 bytes"},
1085     { 0x03, "reserved"},
1086     { 0, NULL }};
1087 
1088 static const value_string pn_io_SFIOCRProperties_DFPType_vals[] = {
1089     { 0x00, "DFP_INBOUND" },
1090     { 0x01, "DFP_OUTBOUND" },
1091     { 0, NULL }
1092 };
1093 
1094 static const value_string pn_io_DFPRedundantPathLayout_decode[] = {
1095     { 0x00, "The Frame for the redundant path contains the ordering shown by SubframeData" },
1096     { 0x01, "The Frame for the redundant path contains the inverse ordering shown by SubframeData" },
1097     { 0, NULL }
1098 };
1099 
1100 static const value_string pn_io_SFCRC16_Decode[] = {
1101     { 0x00, "SFCRC16 and SFCycleCounter shall be created or set to zero by the sender and not checked by the receiver" },
1102     { 0x01, "SFCRC16 and SFCycleCounter shall be created by the sender and checked by the receiver." },
1103     { 0, NULL }
1104 };
1105 
1106 static const value_string pn_io_txgroup_state[] = {
1107     { 0x00, "Transmission off" },
1108     { 0x01, "Transmission on " },
1109     { 0, NULL }
1110 };
1111 
1112 static const value_string pn_io_ioxs[] = {
1113     { 0x00 /*  0*/, "detected by subslot" },
1114     { 0x01 /*  1*/, "detected by slot" },
1115     { 0x02 /*  2*/, "detected by IO device" },
1116     { 0x03 /*  3*/, "detected by IO controller" },
1117     { 0, NULL }
1118 };
1119 
1120 
1121 static const value_string pn_io_ar_type[] = {
1122     { 0x0000, "reserved" },
1123     { 0x0001, "IO Controller AR"},
1124     { 0x0002, "reserved" },
1125     { 0x0003, "IOCARCIR" },
1126     { 0x0004, "reserved" },
1127     { 0x0005, "reserved" },
1128     { 0x0006, "IO Supervisor AR / DeviceAccess AR" },
1129     /*0x0007 - 0x000F reserved */
1130     { 0x0010, "IO Controller AR (RT_CLASS_3)" },
1131     /*0x0011 - 0x001F reserved */
1132     { 0x0020, "IO Controller AR (sysred/CiR)" },
1133     /*0x0007 - 0xFFFF reserved */
1134     { 0, NULL }
1135 };
1136 
1137 static const value_string pn_io_iocr_type[] = {
1138     { 0x0000, "reserved" },
1139     { 0x0001, "Input CR" },
1140     { 0x0002, "Output CR" },
1141     { 0x0003, "Multicast Provider CR" },
1142     { 0x0004, "Multicast Consumer CR" },
1143     /*0x0005 - 0xFFFF reserved */
1144     { 0, NULL }
1145 };
1146 
1147 
1148 static const value_string pn_io_data_description[] = {
1149     { 0x0000, "reserved" },
1150     { 0x0001, "Input" },
1151     { 0x0002, "Output" },
1152     { 0x0003, "reserved" },
1153     /*0x0004 - 0xFFFF reserved */
1154     { 0, NULL }
1155 };
1156 
1157 
1158 static const value_string pn_io_module_state[] = {
1159     { 0x0000, "no module" },
1160     { 0x0001, "wrong module" },
1161     { 0x0002, "proper module" },
1162     { 0x0003, "substitute" },
1163     /*0x0004 - 0xFFFF reserved */
1164     { 0, NULL }
1165 };
1166 
1167 static const value_string pn_io_arproperties_state[] = {
1168     { 0x00000000, "Reserved" },
1169     { 0x00000001, "Active" },
1170     { 0x00000002, "reserved" },
1171     { 0x00000003, "reserved" },
1172     { 0x00000004, "reserved" },
1173     { 0x00000005, "reserved" },
1174     { 0x00000006, "reserved" },
1175     { 0x00000007, "reserved" },
1176     { 0, NULL }
1177 };
1178 
1179 static const value_string pn_io_arproperties_supervisor_takeover_allowed[] = {
1180     { 0x00000000, "not allowed" },
1181     { 0x00000001, "allowed" },
1182     { 0, NULL }
1183 };
1184 
1185 static const value_string pn_io_arproperties_parameterization_server[] = {
1186     { 0x00000000, "External PrmServer" },
1187     { 0x00000001, "CM Initiator" },
1188     { 0, NULL }
1189 };
1190 /* BIT 8 */
1191 static const value_string pn_io_arproperties_DeviceAccess[] = {
1192     { 0x00000000, "Only the submodules from the ExpectedSubmoduleBlock are accessible" },
1193     { 0x00000001, "Submodule access is controlled by IO device application" },
1194     { 0, NULL }
1195 };
1196 
1197 /* Bit 9 - 10 */
1198 static const value_string pn_io_arproperties_companion_ar[] = {
1199     { 0x00000000, "Single AR" },
1200     { 0x00000001, "First AR of a companion pair and a companion AR shall follow" },
1201     { 0x00000002, "Companion AR" },
1202     { 0x00000003, "Reserved" },
1203     { 0, NULL }
1204 };
1205 /* REMOVED with 2.3
1206 static const value_string pn_io_arproperties_data_rate[] = {
1207     { 0x00000000, "at least 100 MB/s or more" },
1208     { 0x00000001, "100 MB/s" },
1209     { 0x00000002, "1 GB/s" },
1210     { 0x00000003, "10 GB/s" },
1211     { 0, NULL }
1212 };
1213 */
1214 
1215 /* BIT 11 */
1216 static const value_string pn_io_arproperties_acknowldege_companion_ar[] = {
1217     { 0x00000000, "No companion AR or no acknowledge for the companion AR required" },
1218     { 0x00000001, "Companion AR with acknowledge" },
1219     { 0, NULL }
1220 };
1221 
1222 /* bit 29 for legacy startup mode*/
1223 static const value_string pn_io_arproperties_combined_object_container_with_legacy_startupmode[] = {
1224     { 0x00000000, "CombinedObjectContainer not used" },
1225     { 0x00000001, "Reserved" },
1226     { 0, NULL }
1227 };
1228 
1229 /* bit 29 for advanced statup mode*/
1230 static const value_string pn_io_arproperties_combined_object_container_with_advanced_startupmode[] = {
1231     { 0x00000000, "CombinedObjectContainer not used" },
1232     { 0x00000001, "Usage of CombinedObjectContainer required" },
1233     { 0, NULL }
1234 };
1235 
1236 /* bit 30 */
1237 static const value_string pn_io_arpropertiesStartupMode[] = {
1238     { 0x00000000, "Legacy" },
1239     { 0x00000001, "Advanced" },
1240     { 0, NULL }
1241 };
1242 
1243 /* bit 31 */
1244 static const value_string pn_io_arproperties_pull_module_alarm_allowed[] = {
1245     { 0x00000000, "AlarmType(=Pull) shall signal pulling of submodule and module" },
1246     { 0x00000001, "AlarmType(=Pull) shall signal pulling of submodule" },
1247     { 0, NULL }
1248 };
1249 
1250 static const value_string pn_io_RedundancyInfo[] = {
1251     { 0x00000000, "Reserved" },
1252     { 0x00000001, "The delivering node is the left or below one" },
1253     { 0x00000002, "The delivering node is the right or above one" },
1254     { 0x00000003, "Reserved" },
1255     { 0, NULL }
1256 };
1257 
1258 static const value_string pn_io_iocr_properties_rtclass[] = {
1259     { 0x00000000, "reserved" },
1260     { 0x00000001, "RT_CLASS_1" },
1261     { 0x00000002, "RT_CLASS_2" },
1262     { 0x00000003, "RT_CLASS_3" },
1263     { 0x00000004, "RT_CLASS_UDP" },
1264     /*0x00000005 - 0x00000007 reserved */
1265     { 0, NULL }
1266 };
1267 
1268 static const value_string pn_io_MultipleInterfaceMode_NameOfDevice[] = {
1269     { 0x00000000, "PortID of LLDP contains name of port (Default)" },
1270     { 0x00000001, "PortID of LLDP contains name of port and NameOfStation" },
1271     { 0, NULL }
1272 };
1273 
1274 static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0 =
1275     { "The device shall deliver valid input data", "The IO controller shall not evaluate the input data." };
1276 
1277 static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1 =
1278     { "The device shall deliver valid input data", "The IO device shall mark the data as invalid using APDU_Status.DataStatus.DataValid == Invalid." };
1279 
1280 static const true_false_string tfs_pn_io_sr_properties_Mode =
1281     { "Default The IO device shall use APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid.",
1282       "The IO controller do not support APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid." };
1283 
1284 static const true_false_string tfs_pn_io_sr_properties_Reserved1 =
1285     { "Legacy mode", "Shall be set to zero for this standard." };
1286 
1287 static const value_string pn_io_iocr_properties_media_redundancy[] = {
1288     { 0x00000000, "No media redundant frame transfer" },
1289     { 0x00000001, "Media redundant frame transfer" },
1290     { 0, NULL }
1291 };
1292 
1293 
1294 static const value_string pn_io_submodule_properties_type[] = {
1295     { 0x0000, "no input and no output data" },
1296     { 0x0001, "input data" },
1297     { 0x0002, "output data" },
1298     { 0x0003, "input and output data" },
1299     { 0, NULL }
1300 };
1301 
1302 static const value_string pn_io_submodule_properties_shared_input[] = {
1303     { 0x0000, "IO controller" },
1304     { 0x0001, "IO controller shared" },
1305     { 0, NULL }
1306 };
1307 
1308 static const value_string pn_io_submodule_properties_reduce_input_submodule_data_length[] = {
1309     { 0x0000, "Expected" },
1310     { 0x0001, "Zero" },
1311     { 0, NULL }
1312 };
1313 
1314 static const value_string pn_io_submodule_properties_reduce_output_submodule_data_length[] = {
1315     { 0x0000, "Expected" },
1316     { 0x0001, "Zero" },
1317     { 0, NULL }
1318 };
1319 
1320 static const value_string pn_io_submodule_properties_discard_ioxs[] = {
1321     { 0x0000, "Expected" },
1322     { 0x0001, "Zero" },
1323     { 0, NULL }
1324 };
1325 
1326 static const value_string pn_io_alarmcr_properties_priority[] = {
1327     { 0x0000, "user priority (default)" },
1328     { 0x0001, "use only low priority" },
1329     { 0, NULL }
1330 };
1331 
1332 static const value_string pn_io_alarmcr_properties_transport[] = {
1333     { 0x0000, "RTA_CLASS_1" },
1334     { 0x0001, "RTA_CLASS_UDP" },
1335     { 0, NULL }
1336 };
1337 
1338 
1339 static const value_string pn_io_submodule_state_format_indicator[] = {
1340     { 0x0000, "Coding uses Detail" },
1341     { 0x0001, "Coding uses .IdentInfo, ..." },
1342     { 0, NULL }
1343 };
1344 
1345 static const value_string pn_io_submodule_state_add_info[] = {
1346     { 0x0000, "None" },
1347     { 0x0001, "Takeover not allowed" },
1348     /*0x0002 - 0x0007 reserved */
1349     { 0, NULL }
1350 };
1351 
1352 static const value_string pn_io_submodule_state_qualified_info[] = {
1353     { 0x0000, "No QualifiedInfo available" },
1354     { 0x0001, "QualifiedInfo available" },
1355     { 0, NULL }
1356 };
1357 
1358 static const value_string pn_io_submodule_state_maintenance_required[] = {
1359     { 0x0000, "No MaintenanceRequired available" },
1360     { 0x0001, "MaintenanceRequired available" },
1361     { 0, NULL }
1362 };
1363 
1364 static const value_string pn_io_submodule_state_maintenance_demanded[] = {
1365     { 0x0000, "No MaintenanceDemanded available" },
1366     { 0x0001, "MaintenanceDemanded available" },
1367     { 0, NULL }
1368 };
1369 
1370 static const value_string pn_io_submodule_state_diag_info[] = {
1371     { 0x0000, "No DiagnosisData available" },
1372     { 0x0001, "DiagnosisData available" },
1373     { 0, NULL }
1374 };
1375 
1376 static const value_string pn_io_submodule_state_ar_info[] = {
1377     { 0x0000, "Own" },
1378     { 0x0001, "ApplicationReadyPending (ARP)" },
1379     { 0x0002, "Superordinated Locked (SO)" },
1380     { 0x0003, "Locked By IO Controller (IOC)" },
1381     { 0x0004, "Locked By IO Supervisor (IOS)" },
1382     /*0x0005 - 0x000F reserved */
1383     { 0, NULL }
1384 };
1385 
1386 static const value_string pn_io_submodule_state_ident_info[] = {
1387     { 0x0000, "OK" },
1388     { 0x0001, "Substitute (SU)" },
1389     { 0x0002, "Wrong (WR)" },
1390     { 0x0003, "NoSubmodule (NO)" },
1391     /*0x0004 - 0x000F reserved */
1392     { 0, NULL }
1393 };
1394 
1395 static const value_string pn_io_submodule_state_detail[] = {
1396     { 0x0000, "no submodule" },
1397     { 0x0001, "wrong submodule" },
1398     { 0x0002, "locked by IO controller" },
1399     { 0x0003, "reserved" },
1400     { 0x0004, "application ready pending" },
1401     { 0x0005, "reserved" },
1402     { 0x0006, "reserved" },
1403     { 0x0007, "Substitute" },
1404     /*0x0008 - 0x7FFF reserved */
1405     { 0, NULL }
1406 };
1407 
1408 static const value_string pn_io_substitutionmode[] = {
1409     { 0x0000, "ZERO" },
1410     { 0x0001, "Last value" },
1411     { 0x0002, "Replacement value" },
1412     /*0x0003 - 0xFFFF reserved */
1413     { 0, NULL }
1414 };
1415 
1416 static const value_string pn_io_index[] = {
1417     /*0x0008 - 0x7FFF user specific */
1418 
1419     /* PROFISafe */
1420     { 0x0100, "PROFISafe" },
1421 
1422     /* subslot specific */
1423     { 0x8000, "ExpectedIdentificationData for one subslot" },
1424     { 0x8001, "RealIdentificationData for one subslot" },
1425     /*0x8002 - 0x8009 reserved */
1426     { 0x800A, "Diagnosis in channel coding for one subslot" },
1427     { 0x800B, "Diagnosis in all codings for one subslot" },
1428     { 0x800C, "Diagnosis, Maintenance, Qualified and Status for one subslot" },
1429     /*0x800D - 0x800F reserved */
1430     { 0x8010, "Maintenance required in channel coding for one subslot" },
1431     { 0x8011, "Maintenance demanded in channel coding for one subslot" },
1432     { 0x8012, "Maintenance required in all codings for one subslot" },
1433     { 0x8013, "Maintenance demanded in all codings for one subslot" },
1434     /*0x8014 - 0x801D reserved */
1435     { 0x801E, "SubstituteValues for one subslot" },
1436     /*0x801F - 0x8027 reserved */
1437     { 0x8028, "RecordInputDataObjectElement for one subslot" },
1438     { 0x8029, "RecordOutputDataObjectElement for one subslot" },
1439     { 0x802A, "PDPortDataReal for one subslot" },
1440     { 0x802B, "PDPortDataCheck for one subslot" },
1441     { 0x802C, "PDIRData for one subslot" },
1442     { 0x802D, "Expected PDSyncData for one subslot with SyncID value 0" },
1443     /*0x802E reserved */
1444     { 0x802F, "PDPortDataAdjust for one subslot" },
1445     { 0x8030, "IsochronousModeData for one subslot" },
1446     { 0x8031, "Expected PDSyncData for one subslot with SyncID value 1" },
1447     { 0x8032, "Expected PDSyncData for one subslot with SyncID value 2" },
1448     { 0x8033, "Expected PDSyncData for one subslot with SyncID value 3" },
1449     { 0x8034, "Expected PDSyncData for one subslot with SyncID value 4" },
1450     { 0x8035, "Expected PDSyncData for one subslot with SyncID value 5" },
1451     { 0x8036, "Expected PDSyncData for one subslot with SyncID value 6" },
1452     { 0x8037, "Expected PDSyncData for one subslot with SyncID value 7" },
1453     { 0x8038, "Expected PDSyncData for one subslot with SyncID value 8" },
1454     { 0x8039, "Expected PDSyncData for one subslot with SyncID value 9" },
1455     { 0x803A, "Expected PDSyncData for one subslot with SyncID value 10" },
1456     { 0x803B, "Expected PDSyncData for one subslot with SyncID value 11" },
1457     { 0x803C, "Expected PDSyncData for one subslot with SyncID value 12" },
1458     { 0x803D, "Expected PDSyncData for one subslot with SyncID value 13" },
1459     { 0x803E, "Expected PDSyncData for one subslot with SyncID value 14" },
1460     { 0x803F, "Expected PDSyncData for one subslot with SyncID value 15" },
1461     { 0x8040, "Expected PDSyncData for one subslot with SyncID value 16" },
1462     { 0x8041, "Expected PDSyncData for one subslot with SyncID value 17" },
1463     { 0x8042, "Expected PDSyncData for one subslot with SyncID value 18" },
1464     { 0x8043, "Expected PDSyncData for one subslot with SyncID value 19" },
1465     { 0x8044, "Expected PDSyncData for one subslot with SyncID value 20" },
1466     { 0x8045, "Expected PDSyncData for one subslot with SyncID value 21" },
1467     { 0x8046, "Expected PDSyncData for one subslot with SyncID value 22" },
1468     { 0x8047, "Expected PDSyncData for one subslot with SyncID value 23" },
1469     { 0x8048, "Expected PDSyncData for one subslot with SyncID value 24" },
1470     { 0x8049, "Expected PDSyncData for one subslot with SyncID value 25" },
1471     { 0x804A, "Expected PDSyncData for one subslot with SyncID value 26" },
1472     { 0x804B, "Expected PDSyncData for one subslot with SyncID value 27" },
1473     { 0x804C, "Expected PDSyncData for one subslot with SyncID value 28" },
1474     { 0x804D, "Expected PDSyncData for one subslot with SyncID value 29" },
1475     { 0x804E, "Expected PDSyncData for one subslot with SyncID value 30" },
1476     { 0x804F, "Expected PDSyncData for one subslot with SyncID value 31" },
1477     { 0x8050, "PDInterfaceMrpDataReal for one subslot" },
1478     { 0x8051, "PDInterfaceMrpDataCheck for one subslot" },
1479     { 0x8052, "PDInterfaceMrpDataAdjust for one subslot" },
1480     { 0x8053, "PDPortMrpDataAdjust for one subslot" },
1481     { 0x8054, "PDPortMrpDataReal for one subslot" },
1482     /*0x8055 - 0x805F reserved */
1483     { 0x8060, "PDPortFODataReal for one subslot" },
1484     { 0x8061, "PDPortFODataCheck for one subslot" },
1485     { 0x8062, "PDPortFODataAdjust for one subslot" },
1486     /*0x8063 - 0x806F reserved */
1487     { 0x8070, "PDNCDataCheck for one subslot" },
1488     { 0x8071, "PDInterfaceAdjust for one subslot" },
1489     { 0x8072, "PDPortStatistic for one subslot" },
1490     /*0x8071 - 0x807F reserved */
1491     { 0x8080, "PDInterfaceDataReal" },
1492     /*0x8081 - 0x808F reserved */
1493     { 0x8090, "Expected PDInterfaceFSUDataAdjust" },
1494     /*0x8091 - 0xAFEF reserved except 0x80B0, 0x80AF and 0x80CF*/
1495     { 0x80AF, "PE_EntityStatusData for one subslot" },
1496     { 0x80B0, "CombinedObjectContainer" },
1497     { 0x80CF, "RS_AdjustObserver" },
1498     { 0xAFF0, "I&M0" },
1499     { 0xAFF1, "I&M1" },
1500     { 0xAFF2, "I&M2" },
1501     { 0xAFF3, "I&M3" },
1502     { 0xAFF4, "I&M4" },
1503     { 0xAFF5, "I&M5" },
1504     { 0xAFF6, "I&M6" },
1505     { 0xAFF7, "I&M7" },
1506     { 0xAFF8, "I&M8" },
1507     { 0xAFF9, "I&M9" },
1508     { 0xAFFA, "I&M10" },
1509     { 0xAFFB, "I&M11" },
1510     { 0xAFFC, "I&M12" },
1511     { 0xAFFD, "I&M13" },
1512     { 0xAFFE, "I&M14" },
1513     { 0xAFFF, "I&M15" },
1514     /*0xB000 - 0xB02D reserved for profiles */
1515     { 0xB000, "Sync-Log / RTA SyncID 0 (GSY)" },
1516     { 0xB001, "Sync-Log / RTA SyncID 1 (GSY)" },
1517     { 0xB002, "reserved for profiles" },
1518     { 0xB003, "reserved for profiles" },
1519     { 0xB004, "reserved for profiles" },
1520     { 0xB005, "reserved for profiles" },
1521     { 0xB006, "reserved for profiles" },
1522     { 0xB007, "reserved for profiles" },
1523     { 0xB008, "reserved for profiles" },
1524     { 0xB009, "reserved for profiles" },
1525     { 0xB00A, "reserved for profiles" },
1526     { 0xB00B, "reserved for profiles" },
1527     { 0xB00C, "reserved for profiles" },
1528     { 0xB00D, "reserved for profiles" },
1529     { 0xB00E, "reserved for profiles" },
1530     { 0xB00F, "reserved for profiles" },
1531     { 0xB010, "reserved for profiles" },
1532     { 0xB011, "reserved for profiles" },
1533     { 0xB012, "reserved for profiles" },
1534     { 0xB013, "reserved for profiles" },
1535     { 0xB014, "reserved for profiles" },
1536     { 0xB015, "reserved for profiles" },
1537     { 0xB016, "reserved for profiles" },
1538     { 0xB017, "reserved for profiles" },
1539     { 0xB018, "reserved for profiles" },
1540     { 0xB019, "reserved for profiles" },
1541     { 0xB01A, "reserved for profiles" },
1542     { 0xB01B, "reserved for profiles" },
1543     { 0xB01C, "reserved for profiles" },
1544     { 0xB01D, "reserved for profiles" },
1545     { 0xB01E, "reserved for profiles" },
1546     { 0xB01F, "reserved for profiles" },
1547     { 0xB020, "reserved for profiles" },
1548     { 0xB021, "reserved for profiles" },
1549     { 0xB022, "reserved for profiles" },
1550     { 0xB023, "reserved for profiles" },
1551     { 0xB024, "reserved for profiles" },
1552     { 0xB025, "reserved for profiles" },
1553     { 0xB026, "reserved for profiles" },
1554     { 0xB027, "reserved for profiles" },
1555     { 0xB028, "reserved for profiles" },
1556     { 0xB029, "reserved for profiles" },
1557     { 0xB02A, "reserved for profiles" },
1558     { 0xB02B, "reserved for profiles" },
1559     { 0xB02C, "reserved for profiles" },
1560     { 0xB02D, "reserved for profiles" },
1561     /* PROFIDrive */
1562     { 0xB02E, "PROFIDrive Parameter Access - Local"},
1563     { 0xB02F, "PROFIDrive Parameter Access - Global"},
1564 
1565     /*0xB030 - 0xBFFF reserved for profiles */
1566     { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" },
1567     { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" },
1568 
1569     { 0xB060, "EDD Trace Unit (EDD" },
1570     { 0xB061, "EDD Trace Unit (EDD" },
1571 
1572     { 0xB070, "OHA Info (OHA)" },
1573 
1574 
1575     /* slot specific */
1576     { 0xC000, "ExpectedIdentificationData for one slot" },
1577     { 0xC001, "RealIdentificationData for one slot" },
1578     /*0xC002 - 0xC009 reserved */
1579     { 0xC00A, "Diagnosis in channel coding for one slot" },
1580     { 0xC00B, "Diagnosis in all codings for one slot" },
1581     { 0xC00C, "Diagnosis, Maintenance, Qualified and Status for one slot" },
1582     /*0xC00D - 0xC00F reserved */
1583     { 0xC010, "Maintenance required in channel coding for one slot" },
1584     { 0xC011, "Maintenance demanded in channel coding for one slot" },
1585     { 0xC012, "Maintenance required in all codings for one slot" },
1586     { 0xC013, "Maintenance demanded in all codings for one slot" },
1587     /*0xC014 - 0xCFFF reserved */
1588     /*0xD000 - 0xDFFF reserved for profiles */
1589 
1590     /* AR specific */
1591     { 0xE000, "ExpectedIdentificationData for one AR" },
1592     { 0xE001, "RealIdentificationData for one AR" },
1593     { 0xE002, "ModuleDiffBlock for one AR" },
1594     /*0xE003 - 0xE009 reserved */
1595     { 0xE00A, "Diagnosis in channel coding for one AR" },
1596     { 0xE00B, "Diagnosis in all codings for one AR" },
1597     { 0xE00C, "Diagnosis, Maintenance, Qualified and Status for one AR" },
1598     /*0xE00D - 0xE00F reserved */
1599     { 0xE010, "Maintenance required in channel coding for one AR" },
1600     { 0xE011, "Maintenance demanded in channel coding for one AR" },
1601     { 0xE012, "Maintenance required in all codings for one AR" },
1602     { 0xE013, "Maintenance demanded in all codings for one AR" },
1603     /*0xE014 - 0xE02F reserved */
1604     { 0xE030, "PE_EntityFilterData for one AR" },
1605     { 0xE031, "PE_EntityStatusData for one AR" },
1606     /*0xE032 - 0xE03F reserved */
1607     { 0xE040, "MultipleWrite" },
1608     /*0xE041 - 0xE04F reserved */
1609     { 0xE050, "ARFSUDataAdjust data for one AR" },
1610     /*0xE051 - 0xE05F reserved */
1611     { 0xE060, "RS_GetEvent (using RecordDataRead service)" },
1612     { 0xE061, "RS_AckEvent (using RecordDataWrite service)" },
1613     /*0xEC00 - 0xEFFF reserved */
1614 
1615     /* API specific */
1616     { 0xF000, "RealIdentificationData for one API" },
1617     /*0xF001 - 0xF009 reserved */
1618     { 0xF00A, "Diagnosis in channel coding for one API" },
1619     { 0xF00B, "Diagnosis in all codings for one API" },
1620     { 0xF00C, "Diagnosis, Maintenance, Qualified and Status for one API" },
1621     /*0xF00D - 0xF00F reserved */
1622     { 0xF010, "Maintenance required in channel coding for one API" },
1623     { 0xF011, "Maintenance demanded in channel coding for one API" },
1624     { 0xF012, "Maintenance required in all codings for one API" },
1625     { 0xF013, "Maintenance demanded in all codings for one API" },
1626     /*0xF014 - 0xF01F reserved */
1627     { 0xF020, "ARData for one API" },
1628     /*0xF021 - 0xF3FF reserved */
1629     /*0xF400 - 0xF7FF reserved */
1630 
1631     /* device specific */
1632     /*0xF800 - 0xF80B reserved */
1633     { 0xF80C, "Diagnosis, Maintenance, Qualified and Status for one device" },
1634     /*0xF80D - 0xF81F reserved */
1635     { 0xF820, "ARData" },
1636     { 0xF821, "APIData" },
1637     /*0xF822 - 0xF82F reserved */
1638     { 0xF830, "LogData" },
1639     { 0xF831, "PDevData" },
1640     /*0xF832 - 0xF83F reserved */
1641     { 0xF840, "I&M0FilterData" },
1642     { 0xF841, "PDRealData" },
1643     { 0xF842, "PDExpectedData" },
1644     /*0xF843 - 0xF84F reserved */
1645     { 0xF850, "AutoConfiguration" },
1646     { 0xF870, "PE_EntityFilterData" },
1647     { 0xF871, "PE_EntityStatusData" },
1648     { 0xF880, "AssetManagementData" },
1649     /*0xF851 - 0xFBFF reserved except 0xF880*/
1650     { 0xF8F1, "PDRsiInstances" },
1651     /*0xFC00 - 0xFFFF reserved for profiles */
1652     { 0, NULL }
1653 };
1654 
1655 static const value_string pn_io_user_structure_identifier[] = {
1656     /*0x0000 - 0x7FFF manufacturer specific */
1657     { 0x8000, "ChannelDiagnosis" },
1658     { 0x8001, "Multiple" },
1659     { 0x8002, "ExtChannelDiagnosis" },
1660     { 0x8003, "QualifiedChannelDiagnosis" },
1661     /*0x8004 - 0x80FF reserved */
1662     { 0x8100, "Maintenance" },
1663     /*0x8101 - 0x8FFF reserved  except 8300, 8301, 8302, 8303 */
1664     { 0x8300, "Sequence of events RS_LowWatermark" },
1665     { 0x8301, "Sequence of events RS_Timeout" },
1666     { 0x8302, "Sequence of events RS_Overflow" },
1667     { 0x8303, "Sequence of events RS_Event" },
1668     { 0x8310, "PE_EnergySavingStatus" },
1669     /*0x9000 - 0x9FFF reserved for profiles */
1670     /*0xA000 - 0xFFFF reserved */
1671     { 0, NULL }
1672 };
1673 
1674 static const value_string pn_io_channel_error_type[] = {
1675     { 0x0000, "reserved" },
1676     { 0x0001, "short circuit" },
1677     { 0x0002, "Undervoltage" },
1678     { 0x0003, "Overvoltage" },
1679     { 0x0004, "Overload" },
1680     { 0x0005, "Overtemperature" },
1681     { 0x0006, "line break" },
1682     { 0x0007, "upper limit value exceeded" },
1683     { 0x0008, "lower limit value exceeded" },
1684     { 0x0009, "Error" },
1685     /*0x000A - 0x000F reserved */
1686     { 0x0010, "parameterization fault" },
1687     { 0x0011, "power supply fault" },
1688     { 0x0012, "fuse blown / open" },
1689     { 0x0013, "Manufacturer specific" },
1690     { 0x0014, "ground fault" },
1691     { 0x0015, "reference point lost" },
1692     { 0x0016, "process event lost / sampling error" },
1693     { 0x0017, "threshold warning" },
1694     { 0x0018, "output disabled" },
1695     { 0x0019, "safety event" },
1696     { 0x001A, "external fault" },
1697     /*0x001B - 0x001F manufacturer specific */
1698     /*0x0020 - 0x00FF reserved for common profiles */
1699     /*0x0100 - 0x7FFF manufacturer specific */
1700     { 0x8000, "Data transmission impossible" },
1701     { 0x8001, "Remote mismatch" },
1702     { 0x8002, "Media redundancy mismatch" },
1703     { 0x8003, "Sync mismatch" },
1704     { 0x8004, "IsochronousMode mismatch" },
1705     { 0x8005, "Multicast CR mismatch" },
1706     { 0x8006, "reserved" },
1707     { 0x8007, "Fiber optic mismatch" },
1708     { 0x8008, "Network component function mismatch" },
1709     { 0x8009, "Time mismatch" },
1710     /* added values for IEC version 2.3: */
1711     { 0x800A, "Dynamic frame packing function mismatch" },
1712     { 0x800B, "Media redundancy with planned duplication mismatch"},
1713     { 0x800C, "System redundancy mismatch"},
1714     /* ends */
1715     /*0x800D - 0x8FFF reserved */
1716     /*0x9000 - 0x9FFF reserved for profile */
1717     /*0xA000 - 0xFFFF reserved */
1718     { 0, NULL }
1719 };
1720     /* ExtChannelErrorType for ChannelErrorType 0 - 0x7FFF */
1721 
1722 static const value_string pn_io_ext_channel_error_type0[] = {
1723     /* 0x0000 Reserved */
1724     /* 0x0001 - 0x7FFF Manufacturer specific */
1725     { 0x8000, "Accumulative Info"},
1726     /* 0x8001 - 0x8FFF Reserved */
1727     /* 0x9000 - 0x9FFF Reserved for profiles */
1728     /* 0xA000 - 0xFFFF Reserved */
1729     { 0, NULL }
1730 };
1731 
1732 
1733     /* ExtChannelErrorType for ChannelErrorType "Data transmission impossible" */
1734 static const value_string pn_io_ext_channel_error_type0x8000[] = {
1735     /* 0x0000 Reserved */
1736     /* 0x0001 - 0x7FFF Manufacturer specific */
1737     { 0x8000, "Link State mismatch - Link down"},
1738     { 0x8001, "MAUType mismatch"},
1739     { 0x8002, "Line Delay mismatch"},
1740     /* 0x8003 - 0x8FFF Reserved */
1741     /* 0x9000 - 0x9FFF Reserved for profiles */
1742     /* 0xA000 - 0xFFFF Reserved */
1743     { 0, NULL }
1744 };
1745 
1746     /* ExtChannelErrorType for ChannelErrorType "Remote mismatch" */
1747 static const value_string pn_io_ext_channel_error_type0x8001[] = {
1748     /* 0x0000 Reserved */
1749     /* 0x0001 - 0x7FFF Manufacturer specific */
1750     { 0x8000, "Peer Chassis ID mismatch"},
1751     { 0x8001, "Peer Port ID mismatch"},
1752     { 0x8002, "Peer RT_CLASS_3 mismatch a"},
1753     { 0x8003, "Peer MAUType mismatch"},
1754     { 0x8004, "Peer MRP domain mismatch"},
1755     { 0x8005, "No peer detected"},
1756     { 0x8006, "Reserved"},
1757     { 0x8007, "Peer Line Delay mismatch"},
1758     { 0x8008, "Peer PTCP mismatch b"},
1759     { 0x8009, "Peer Preamble Length mismatch"},
1760     { 0x800A, "Peer Fragmentation mismatch"},
1761     /* 0x800B - 0x8FFF Reserved */
1762     /* 0x9000 - 0x9FFF Reserved for profiles */
1763     /* 0xA000 - 0xFFFF Reserved */
1764     { 0, NULL }
1765 };
1766 
1767     /* ExtChannelErrorType for ChannelErrorType "Media redundancy mismatch" 0x8002 */
1768 static const value_string pn_io_ext_channel_error_type0x8002[] = {
1769     /* 0x0000 Reserved */
1770     /* 0x0001 - 0x7FFF Manufacturer specific */
1771     { 0x8000, "Manager role fail MRP-instance 1"},
1772     { 0x8001, "MRP-instance 1 ring open"},
1773     { 0x8002, "Reserved"},
1774     { 0x8003, "Multiple manager MRP-instance 1"},
1775     { 0x8010, "Manager role fail MRP-instance 2"},
1776     { 0x8011, "MRP-instance 2 ring open"},
1777     { 0x8012, "Reserved"},
1778     { 0x8013, "Multiple manager MRP-instance 2"},
1779     { 0x8020, "Manager role fail MRP-instance 3"},
1780     { 0x8021, "MRP-instance 3 ring open"},
1781     { 0x8023, "Multiple manager MRP-instance 3"},
1782     { 0x8030, "Manager role fail MRP-instance 4"},
1783     { 0x8031, "MRP-instance 4 ring open"},
1784     { 0x8033, "Multiple manager MRP-instance 4"},
1785     { 0x8040, "Manager role fail MRP-instance 5"},
1786     { 0x8041, "MRP-instance 5 ring open"},
1787     { 0x8043, "Multiple manager MRP-instance 5"},
1788     { 0x8050, "Manager role fail MRP-instance 6"},
1789     { 0x8051, "MRP-instance 6 ring open"},
1790     { 0x8053, "Multiple manager MRP-instance 6"},
1791     { 0x8060, "Manager role fail MRP-instance 7"},
1792     { 0x8061, "MRP-instance 7 ring open"},
1793     { 0x8063, "Multiple manager MRP-instance 7"},
1794     { 0x8070, "Manager role fail MRP-instance 8"},
1795     { 0x8071, "MRP-instance 8 ring open"},
1796     { 0x8073, "Multiple manager MRP-instance 8"},
1797     { 0x8080, "Manager role fail MRP-instance 9"},
1798     { 0x8081, "MRP-instance 9 ring open"},
1799     { 0x8083, "Multiple manager MRP-instance 9"},
1800     { 0x8090, "Manager role fail MRP-instance 10"},
1801     { 0x8091, "MRP-instance 10 ring open"},
1802     { 0x8093, "Multiple manager MRP-instance 10"},
1803     { 0x80A0, "Manager role fail MRP-instance 11"},
1804     { 0x80A1, "MRP-instance 11 ring open"},
1805     { 0x80A3, "Multiple manager MRP-instance 11"},
1806     { 0x80B0, "Manager role fail MRP-instance 12"},
1807     { 0x80B1, "MRP-instance 12 ring open"},
1808     { 0x80B3, "Multiple manager MRP-instance 12"},
1809     { 0x80C0, "Manager role fail MRP-instance 13"},
1810     { 0x80C1, "MRP-instance 13 ring open"},
1811     { 0x80C3, "Multiple manager MRP-instance 13"},
1812     { 0x80D0, "Manager role fail MRP-instance 14"},
1813     { 0x80D1, "MRP-instance 14 ring open"},
1814     { 0x80D3, "Multiple manager MRP-instance 14"},
1815     { 0x80E0, "Manager role fail MRP-instance 15"},
1816     { 0x80E1, "MRP-instance 15 ring open"},
1817     { 0x80E3, "Multiple manager MRP-instance 15"},
1818     { 0x80F0, "Manager role fail MRP-instance 16"},
1819     { 0x80F1, "MRP-instance 16 ring open"},
1820     { 0x80F3, "Multiple manager MRP-instance 16"},
1821     /* 0x8004 - 0x8FFF Reserved */
1822     /* 0x9000 - 0x9FFF Reserved for profiles */
1823     /* 0xA000 - 0xFFFF Reserved */
1824     { 0, NULL }
1825 };
1826 
1827     /* ExtChannelErrorType for ChannelErrorType "Sync mismatch" and for ChannelErrorType "Time mismatch" 0x8003 and 0x8009*/
1828 static const value_string pn_io_ext_channel_error_type0x8003[] = {
1829     /* 0x0000 Reserved */
1830     /* 0x0001 - 0x7FFF Manufacturer specific */
1831     { 0x8000, "No sync message received"},
1832     { 0x8001, "- 0x8002 Reserved"},
1833     { 0x8003, "Jitter out of boundary"},
1834     /* 0x8004 - 0x8FFF Reserved */
1835     /* 0x9000 - 0x9FFF Reserved for profiles */
1836     /* 0xA000 - 0xFFFF Reserved */
1837     { 0, NULL }
1838 };
1839 
1840     /*ExtChannelErrorType for ChannelErrorType "Isochronous mode mismatch" 0x8004 */
1841 static const value_string pn_io_ext_channel_error_type0x8004[] = {
1842     /* 0x0000 Reserved */
1843     /* 0x0001 - 0x7FFF Manufacturer specific */
1844     { 0x8000, "Output Time Failure - Output update missing or out of order"},
1845     { 0x8001, "Input Time Failure"},
1846     { 0x8002, "Master Life Sign Failure - Error in MLS update detected"},
1847     /* 0x8003 - 0x8FFF Reserved */
1848     /* 0x9000 - 0x9FFF Reserved for profiles */
1849     /* 0xA000 - 0xFFFF Reserved */
1850     { 0, NULL }
1851 };
1852 
1853     /* ExtChannelErrorType for ChannelErrorType "Multicast CR mismatch" 0x8005 */
1854 static const value_string pn_io_ext_channel_error_type0x8005[] = {
1855     /* 0x0000 Reserved */
1856     /* 0x0001 - 0x7FFF Manufacturer specific */
1857     { 0x8000, "Multicast Consumer CR timed out"},
1858     { 0x8001, "Address resolution failed"},
1859     /* 0x8002 - 0x8FFF Reserved */
1860     /* 0x9000 - 0x9FFF Reserved for profiles */
1861     /* 0xA000 - 0xFFFF Reserved */
1862     { 0, NULL }
1863 };
1864 
1865     /* ExtChannelErrorType for ChannelErrorType "Fiber optic mismatch" 0x8007*/
1866 static const value_string pn_io_ext_channel_error_type0x8007[] = {
1867     /* 0x0000 Reserved */
1868     /* 0x0001 - 0x7FFF Manufacturer specific */
1869     { 0x8000, "Power Budget"},
1870     /* 0x8001 - 0x8FFF Reserved */
1871     /* 0x9000 - 0x9FFF Reserved for profiles */
1872     /* 0xA000 - 0xFFFF Reserved */
1873     { 0, NULL }
1874 };
1875 
1876     /* ExtChannelErrorType for ChannelErrorType "Network component function mismatch" 0x8008 */
1877 static const value_string pn_io_ext_channel_error_type0x8008[] = {
1878     /* 0x0000 Reserved */
1879     /* 0x0001 - 0x7FFF Manufacturer specific */
1880     { 0x8000, "Frame dropped - no resource"},
1881     /* 0x8001 - 0x8FFF Reserved */
1882     /* 0x9000 - 0x9FFF Reserved for profiles */
1883     /* 0xA000 - 0xFFFF Reserved */
1884     { 0, NULL }
1885 };
1886 
1887     /* ExtChannelErrorType for ChannelErrorType "Dynamic Frame Packing function mismatch" 0x800A */
1888 static const value_string pn_io_ext_channel_error_type0x800A[] = {
1889     /* 0x0000 Reserved */
1890     /* 0x0001 - 0x7FFF Manufacturer specific */
1891     /* 0x8000 - 0x80FF Reserved */
1892     { 0x8100, "Frame late error for FrameID (0x0100)"},
1893     /* 0x8101 + 0x8FFE See Equation (56) */
1894     { 0x8FFF, "Frame late error for FrameID (0x0FFF)"},
1895     /* 0x8001 - 0x8FFF Reserved */
1896     /* 0x9000 - 0x9FFF Reserved for profiles */
1897     /* 0xA000 - 0xFFFF Reserved */
1898     { 0, NULL }
1899 };
1900 
1901     /* ExtChannelErrorType for ChannelErrorType "Media redundancy with planned duplication mismatch" 0x800B */
1902 static const value_string pn_io_ext_channel_error_type0x800B[] = {
1903     /* 0x0000 Reserved */
1904     /* 0x0001 - 0x7FFF Manufacturer specific */
1905     /* 0x8000 - 0x86FF Reserved */
1906     { 0x8700, "MRPD duplication void for FrameID (0x0700)"},
1907     /* 0x8701 + 0x8FFE See Equation (57) */
1908     { 0x8FFF, "MRPD duplication void for FrameID (0x0FFF)"},
1909     /* 0x9000 - 0x9FFF Reserved for profiles */
1910     /* 0xA000 - 0xFFFF Reserved */
1911     { 0, NULL }
1912 };
1913 
1914     /* ExtChannelErrorType for ChannelErrorType "System redundancy mismatch" 0x800C */
1915 static const value_string pn_io_ext_channel_error_type0x800C[] = {
1916     /* 0x0000 Reserved */
1917     /* 0x0001 - 0x7FFF Manufacturer specific */
1918     { 0x8000, "System redundancy event"},
1919     /* 0x8001 - 0x8FFF Reserved */
1920     /* 0x9000 - 0x9FFF Reserved for profiles */
1921     /* 0xA000 - 0xFFFF Reserved */
1922     { 0, NULL }
1923 };
1924 
1925 static const value_string pn_io_channel_properties_type[] = {
1926     { 0x0000, "submodule or unspecified" },
1927     { 0x0001, "1 Bit" },
1928     { 0x0002, "2 Bit" },
1929     { 0x0003, "4 Bit" },
1930     { 0x0004, "8 Bit" },
1931     { 0x0005, "16 Bit" },
1932     { 0x0006, "32 Bit" },
1933     { 0x0007, "64 Bit" },
1934     /*0x0008 - 0x00FF reserved */
1935     { 0, NULL }
1936 };
1937 
1938 static const value_string pn_io_channel_properties_accumulative_vals[] = {
1939     { 0x0000, "Channel" },
1940     { 0x0001, "ChannelGroup" },
1941     { 0, NULL }
1942 };
1943 
1944 /* We are reading this as a two bit value, but the spec specifies each bit
1945  * separately. Beware endianness when reading spec
1946  */
1947 static const value_string pn_io_channel_properties_maintenance[] = {
1948     { 0x0000, "Failure" },
1949     { 0x0001, "Maintenance required" },
1950     { 0x0002, "Maintenance demanded" },
1951     { 0x0003, "see QualifiedChannelQualifier" },
1952     { 0, NULL }
1953 };
1954 
1955 static const value_string pn_io_channel_properties_specifier[] = {
1956     { 0x0000, "All subsequent disappears" },
1957     { 0x0001, "Appears" },
1958     { 0x0002, "Disappears" },
1959     { 0x0003, "Disappears but others remain" },
1960     { 0, NULL }
1961 };
1962 
1963 static const value_string pn_io_channel_properties_direction[] = {
1964     { 0x0000, "Manufacturer-specific" },
1965     { 0x0001, "Input" },
1966     { 0x0002, "Output" },
1967     { 0x0003, "Input/Output" },
1968     /*0x0004 - 0x0007 reserved */
1969     { 0, NULL }
1970 };
1971 
1972 static const value_string pn_io_alarmcr_type[] = {
1973     { 0x0000, "reserved" },
1974     { 0x0001, "Alarm CR" },
1975     /*0x0002 - 0xFFFF reserved */
1976     { 0, NULL }
1977 };
1978 
1979 static const value_string pn_io_mau_type[] = {
1980     /*0x0000 - 0x0004 reserved */
1981     { 0x0005, "10BASET" },
1982     /*0x0006 - 0x0009 reserved */
1983     { 0x000A, "10BASETXHD" },
1984     { 0x000B, "10BASETXFD" },
1985     { 0x000C, "10BASEFLHD" },
1986     { 0x000D, "10BASEFLFD" },
1987     { 0x000F, "100BASETXHD" },
1988     { 0x0010, "100BASETXFD" },
1989     { 0x0011, "100BASEFXHD" },
1990     { 0x0012, "100BASEFXFD" },
1991     /*0x0013 - 0x0014 reserved */
1992     { 0x0015, "1000BASEXHD" },
1993     { 0x0016, "1000BASEXFD" },
1994     { 0x0017, "1000BASELXHD" },
1995     { 0x0018, "1000BASELXFD" },
1996     { 0x0019, "1000BASESXHD" },
1997     { 0x001A, "1000BASESXFD" },
1998     /*0x001B - 0x001C reserved */
1999     { 0x001D, "1000BASETHD" },
2000     { 0x001E, "1000BASETFD" },
2001     { 0x001F, "10GigBASEFX" },
2002     /*0x0020 - 0x002D reserved */
2003     { 0x002E, "100BASELX10" },
2004     /*0x002F - 0x0035 reserved */
2005     { 0x0036, "100BASEPXFD" },
2006     /*0x0037 - 0xFFFF reserved */
2007     { 0, NULL }
2008 };
2009 
2010 
2011 static const value_string pn_io_preamble_length[] = {
2012     { 0x0000, "Seven octets Preamble shall be used" },
2013     { 0x0001, "One octet Preamble shall be used" },
2014     /*0x0002 - 0xFFFF reserved */
2015     { 0, NULL }
2016 };
2017 
2018 static const value_string pn_io_mau_type_mode[] = {
2019     { 0x0000, "OFF" },
2020     { 0x0001, "ON" },
2021     /*0x0002 - 0xFFFF reserved */
2022     { 0, NULL }
2023 };
2024 
2025 
2026 static const value_string pn_io_dcp_boundary_value_bit0[] = {
2027     { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-00" },
2028     { 0x01, "Block an outgoing DCP_Identify frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-00" },
2029     { 0, NULL }
2030 };
2031 
2032 static const value_string pn_io_dcp_boundary_value_bit1[] = {
2033     { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-01" },
2034     { 0x01, "Block an outgoing DCP_Hello frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-01" },
2035     { 0, NULL }
2036 };
2037 
2038 static const value_string pn_io_peer_to_peer_boundary_value_bit0[] = {
2039     { 0x00, "The LLDP agent shall send LLDP frames for this port." },
2040     { 0x01, "The LLDP agent shall not send LLDP frames (egress filter)." },
2041     { 0, NULL }
2042 };
2043 
2044 static const value_string pn_io_peer_to_peer_boundary_value_bit1[] = {
2045     { 0x00, "The PTCP ASE shall send PTCP_DELAY request frames for this port." },
2046     { 0x01, "The PTCP ASE shall not send PTCP_DELAY request frames (egress filter)." },
2047     { 0, NULL }
2048 };
2049 
2050 static const value_string pn_io_peer_to_peer_boundary_value_bit2[] = {
2051     { 0x00, "The Time ASE shall send PATH_DELAY request frames for this port." },
2052     { 0x01, "The Time ASE shall not send PATH_DELAY request frames (egress filter)." },
2053     { 0, NULL }
2054 };
2055 
2056 static const range_string pn_io_mau_type_extension[] = {
2057     { 0x0000, 0x0000, "No SubMAUType" },
2058     { 0x0001, 0x00FF, "Reserved" },
2059     { 0x0100, 0x0100, "POF" },
2060     { 0x0101, 0xFFEF, "Reserved for SubMAUType" },
2061     { 0xFFF0, 0xFFFF, "Reserved" },
2062     { 0, 0, NULL }
2063 };
2064 
2065 static const range_string pn_io_pe_operational_mode[] = {
2066     { 0x00, 0x00, "PE_PowerOff" },
2067     { 0x01, 0x1F, "PE_EnergySavingMode" },
2068     { 0x20, 0xEF, "Reserved" },
2069     { 0xF0, 0xF0, "PE_Operate" },
2070     { 0xF1, 0xFD, "Reserved" },
2071     { 0xFE, 0xFE, "PE_SleepModeWOL" },
2072     { 0xFF, 0xFF, "PE_ReadyToOperate" },
2073     { 0, 0, NULL }
2074 };
2075 
2076 static const value_string pn_io_port_state[] = {
2077     { 0x0000, "reserved" },
2078     { 0x0001, "up" },
2079     { 0x0002, "down" },
2080     { 0x0003, "testing" },
2081     { 0x0004, "unknown" },
2082     /*0x0005 - 0xFFFF reserved */
2083     { 0, NULL }
2084 };
2085 
2086 
2087 static const value_string pn_io_link_state_port[] = {
2088     { 0x00, "unknown" },
2089     { 0x01, "disabled/discarding" },
2090     { 0x02, "blocking" },
2091     { 0x03, "listening" },
2092     { 0x04, "learning" },
2093     { 0x05, "forwarding" },
2094     { 0x06, "broken" },
2095     /*0x07 - 0xFF reserved */
2096     { 0, NULL }
2097 };
2098 
2099 
2100 static const value_string pn_io_link_state_link[] = {
2101     { 0x00, "reserved" },
2102     { 0x01, "up" },
2103     { 0x02, "down" },
2104     { 0x03, "testing" },
2105     { 0x04, "unknown" },
2106     { 0x05, "dormant" },
2107     { 0x06, "notpresent" },
2108     { 0x07, "lowerlayerdown" },
2109     /*0x08 - 0xFF reserved */
2110     { 0, NULL }
2111 };
2112 
2113 
2114 static const value_string pn_io_media_type[] = {
2115     { 0x0000, "Unknown" },
2116     { 0x0001, "Copper cable" },
2117     { 0x0002, "Fiber optic cable" },
2118     { 0x0003, "Radio communication" },
2119     /*0x0004 - 0xFFFF reserved */
2120     { 0, NULL }
2121 };
2122 
2123 
2124 static const value_string pn_io_fiber_optic_type[] = {
2125     { 0x0000, "No fiber type adjusted" },
2126     { 0x0001, "9 um single mode fiber" },
2127     { 0x0002, "50 um multi mode fiber" },
2128     { 0x0003, "62,5 um multi mode fiber" },
2129     { 0x0004, "SI-POF, NA=0.5" },
2130     { 0x0005, "SI-PCF, NA=0.36" },
2131     { 0x0006, "LowNA-POF, NA=0.3" },
2132     { 0x0007, "GI-POF" },
2133     /*0x0008 - 0xFFFF reserved */
2134     { 0, NULL }
2135 };
2136 
2137 
2138 static const value_string pn_io_fiber_optic_cable_type[] = {
2139     { 0x0000, "No cable specified" },
2140     { 0x0001, "Inside/outside cable, fixed installation" },
2141     { 0x0002, "Inside/outside cable, flexible installation" },
2142     { 0x0003, "Outdoor cable, fixed installation" },
2143     /*0x0004 - 0xFFFF reserved */
2144     { 0, NULL }
2145 };
2146 
2147 static const value_string pn_io_im_revision_prefix_vals[] = {
2148     { 'V', "V - Officially released version" },
2149     { 'R', "R - Revision" },
2150     { 'P', "P - Prototype" },
2151     { 'U', "U - Under Test (Field Test)" },
2152     { 'T', "T - Test Device" },
2153     /*all others reserved */
2154     { 0, NULL }
2155 };
2156 
2157 
2158 static const value_string pn_io_mrp_role_vals[] = {
2159     { 0x0000, "Media Redundancy disabled" },
2160     { 0x0001, "Media Redundancy Client" },
2161     { 0x0002, "Media Redundancy Manager" },
2162     /*all others reserved */
2163     { 0, NULL }
2164 };
2165 
2166 static const value_string pn_io_mrp_instance_no[] = {
2167     { 0x0000, "MRP_Instance 1" },
2168     { 0x0001, "MRP_Instance 2" },
2169     { 0x0002, "MRP_Instance 3" },
2170     { 0x0003, "MRP_Instance 4" },
2171     { 0x0004, "MRP_Instance 5" },
2172     { 0x0005, "MRP_Instance 6" },
2173     { 0x0006, "MRP_Instance 7" },
2174     { 0x0007, "MRP_Instance 8" },
2175     { 0x0008, "MRP_Instance 9" },
2176     { 0x0009, "MRP_Instance 10" },
2177     { 0x000A, "MRP_Instance 11" },
2178     { 0x000B, "MRP_Instance 12" },
2179     { 0x000C, "MRP_Instance 13" },
2180     { 0x000D, "MRP_Instance 14" },
2181     { 0x000E, "MRP_Instance 15" },
2182     { 0x000F, "MRP_Instance 16" },
2183     /*all others reserved */
2184     { 0, NULL }
2185 };
2186 
2187 static const value_string pn_io_mrp_mrm_on[] = {
2188     { 0x0000, "Disable MediaRedundancyManager diagnosis" },
2189     { 0x0001, "Enable MediaRedundancyManager diagnosis"},
2190     { 0, NULL }
2191 };
2192 static const value_string pn_io_mrp_checkUUID[] = {
2193     { 0x0000, "Disable the check of the MRP_DomainUUID" },
2194     { 0x0001, "Enable the check of the MRP_DomainUUID"},
2195     { 0, NULL }
2196 };
2197 
2198 static const value_string pn_io_mrp_prio_vals[] = {
2199     { 0x0000, "Highest priority redundancy manager" },
2200     /* 0x1000 - 0x7000 High priorities */
2201     { 0x8000, "Default priority for redundancy manager" },
2202     /* 0x9000 - 0xE000 Low priorities */
2203     { 0xF000, "Lowest priority redundancy manager" },
2204     /*all others reserved */
2205     { 0, NULL }
2206 };
2207 
2208 static const value_string pn_io_mrp_rtmode_rtclass12_vals[] = {
2209     { 0x0000, "RT_CLASS_1 and RT_CLASS_2 redundancy mode deactivated" },
2210     { 0x0001, "RT_CLASS_1 and RT_CLASS_2 redundancy mode activated" },
2211     { 0, NULL }
2212 };
2213 
2214 static const value_string pn_io_mrp_rtmode_rtclass3_vals[] = {
2215     { 0x0000, "RT_CLASS_3 redundancy mode deactivated" },
2216     { 0x0001, "RT_CLASS_3 redundancy mode activated" },
2217     { 0, NULL }
2218 };
2219 
2220 static const value_string pn_io_mrp_ring_state_vals[] = {
2221     { 0x0000, "Ring open" },
2222     { 0x0001, "Ring closed" },
2223     { 0, NULL }
2224 };
2225 
2226 static const value_string pn_io_mrp_rt_state_vals[] = {
2227     { 0x0000, "RT media redundancy lost" },
2228     { 0x0001, "RT media redundancy available" },
2229     { 0, NULL }
2230 };
2231 
2232 static const value_string pn_io_control_properties_vals[] = {
2233     { 0x0000, "Reserved" },
2234     { 0, NULL }
2235 };
2236 
2237 static const value_string pn_io_control_properties_prmbegin_vals[] = {
2238     { 0x0000, "No PrmBegin" },
2239     { 0x0001, "The IO controller starts the transmission of the stored start-up parameter" },
2240     { 0, NULL }
2241 };
2242 static const value_string pn_io_control_properties_application_ready_bit0_vals[] = {
2243     { 0x0000, "Wait for explicit ControlCommand.ReadyForCompanion" },
2244     { 0x0001, "Implicit ControlCommand.ReadyForCompanion" },
2245     { 0, NULL }
2246 };
2247 static const value_string pn_io_control_properties_application_ready_bit1_vals[] = {
2248     { 0x0000, "Wait for explicit ControlCommand.ReadyForRT_CLASS_3" },
2249     { 0x0001, "Implicit ControlCommand.ReadyForRT_CLASS_3" },
2250     { 0, NULL }
2251 };
2252 static const value_string pn_io_fs_hello_mode_vals[] = {
2253     { 0x0000, "OFF" },
2254     { 0x0001, "Send req on LinkUp" },
2255     { 0x0002, "Send req on LinkUp after HelloDelay" },
2256     { 0, NULL }
2257 };
2258 
2259 static const value_string pn_io_fs_parameter_mode_vals[] = {
2260     { 0x0000, "OFF" },
2261     { 0x0001, "ON" },
2262     { 0x0002, "Reserved" },
2263     { 0x0003, "Reserved" },
2264     { 0, NULL }
2265 };
2266 
2267 static const value_string pn_io_frame_details_sync_master_vals[] = {
2268     { 0x0000, "No Sync Frame" },
2269     { 0x0001, "Primary sync frame" },
2270     { 0x0002, "Secondary sync frame" },
2271     { 0x0003, "Reserved" },
2272     { 0, NULL }
2273 };
2274 static const value_string pn_io_frame_details_meaning_frame_send_offset_vals[] = {
2275     { 0x0000, "Field FrameSendOffset specifies the point of time for receiving or transmitting a frame " },
2276     { 0x0001, "Field FrameSendOffset specifies the beginning of the RT_CLASS_3 interval within a phase" },
2277     { 0x0002, "Field FrameSendOffset specifies the ending of the RT_CLASS_3 interval within a phase" },
2278     { 0x0003, "Reserved" },
2279     { 0, NULL }
2280 };
2281 
2282 static const value_string pn_io_f_check_seqnr[] = {
2283     { 0x00, "consecutive number not included in crc" },
2284     { 0x01, "consecutive number included in crc" },
2285     { 0, NULL }
2286 };
2287 
2288 static const value_string pn_io_f_check_ipar[] = {
2289     { 0x00, "no check" },
2290     { 0x01, "check" },
2291     { 0, NULL }
2292 };
2293 
2294 static const value_string pn_io_f_sil[] = {
2295     { 0x00, "SIL1" },
2296     { 0x01, "SIL2" },
2297     { 0x02, "SIL3" },
2298     { 0x03, "NoSIL" },
2299     { 0, NULL }
2300 };
2301 
2302 static const value_string pn_io_f_crc_len[] = {
2303     { 0x00, "3 octet CRC" },
2304     { 0x01, "2 octet CRC" },
2305     { 0x02, "4 octet CRC" },
2306     { 0x03, "reserved" },
2307     { 0, NULL }
2308 };
2309 
2310 static const value_string pn_io_f_crc_seed[] = {
2311     { 0x00, "CRC-FP as seed value and counter" },
2312     { 0x01, "'1' as seed value and CRC-FP+/MNR" },
2313     { 0, NULL }
2314 };
2315 
2316 /* F_Block_ID dissection due to ver2.6 specifikation of PI */
2317 static const value_string pn_io_f_block_id[] = {
2318     { 0x00, "No F_WD_Time_2, no F_iPar_CRC" },
2319     { 0x01, "No F_WD_Time_2, F_iPar_CRC" },
2320     { 0x02, "F_WD_Time_2, no F_iPar_CRC" },
2321     { 0x03, "F_WD_Time_2, F_iPar_CRC" },
2322     /* 0x04..0x07 reserved */
2323     /* { 0x00, "Parameter set for F-Host/F-Device relationship" }, */
2324     /* { 0x01, "Additional F_Address parameter block" }, */
2325     /* 0x02..0x07 reserved */
2326     { 0, NULL }
2327 };
2328 
2329 static const value_string pn_io_f_par_version[] = {
2330     { 0x00, "Valid for V1-mode" },
2331     { 0x01, "Valid for V2-mode" },
2332     /* 0x02..0x03 reserved */
2333     { 0, NULL }
2334 };
2335 
2336 static const value_string pn_io_profidrive_request_id_vals[] = {
2337     { 0x00, "Reserved" },
2338     { 0x01, "Read request" },
2339     { 0x02, "Change request" },
2340     { 0, NULL }
2341 };
2342 
2343 static const value_string pn_io_profidrive_response_id_vals[] = {
2344     { 0x00, "Reserved" },
2345     { 0x01, "Positive read response" },
2346     { 0x02, "Positive change response" },
2347     { 0x81, "Negative read response" },
2348     { 0x82, "Negative change response" },
2349     { 0, NULL }
2350 };
2351 
2352 static const value_string pn_io_profidrive_attribute_vals[] = {
2353     { 0x00, "Reserved" },
2354     { 0x10, "Value" },
2355     { 0x20, "Description" },
2356     { 0x30, "Text" },
2357     { 0, NULL }
2358 };
2359 
2360 static const value_string pn_io_profidrive_format_vals[] = {
2361     {0x0, "Zero"},
2362     {0x01, "Boolean" },
2363     {0x02, "Integer8" },
2364     {0x03, "Integer16" },
2365     {0x04, "Integer32" },
2366     {0x05, "Unsigned8" },
2367     {0x06, "Unsigned16" },
2368     {0x07, "Unsigned32" },
2369     {0x08, "Float32" },
2370     {0x09, "VisibleString" },
2371     {0x0A, "OctetString" },
2372     {0x0B, "Binary Date"},
2373     {0x0C, "TimeOfDay" },
2374     {0x0D, "TimeDifference" },
2375     {0x0E, "BitString"},
2376     {0x0F, "Float64"},
2377     {0x10, "UniversalTime"},
2378     {0x11, "FieldbusTime"},
2379     {0x15, "Time Value"},
2380     {0x16, "Bitstring8"},
2381     {0x17, "Bitstring16"},
2382     {0x18, "Bitstring32"},
2383     {0x19, "VisibleString1"},
2384     {0x1A, "VisibleString2"},
2385     {0x1B, "VisibleString4"},
2386     {0x1C, "VisibleString8"},
2387     {0x1D, "VisibleString16"},
2388     {0x1E, "OctetString1"},
2389     {0x1F, "OctetString2"},
2390     {0x20, "OctetString4"},
2391     {0x21, "OctetString8"},
2392     {0x22, "OctetString16"},
2393     {0x23, "BCD"},
2394     {0x24, "UNICODE char"},
2395     {0x25, "CompactBoolean-Array"},
2396     {0x26, "CompactBCDArray"},
2397     {0x27, "UNICODEString"},
2398     {0x28, "BinaryTime0"},
2399     {0x29, "BinaryTime1"},
2400     {0x2A, "BinaryTime2"},
2401     {0x2B, "BinaryTime3"},
2402     {0x2C, "BinaryTime4"},
2403     {0x2D, "BinaryTime5"},
2404     {0x2E, "BinaryTime6"},
2405     {0x2F, "BinaryTime7"},
2406     {0x30, "BinaryTime8"},
2407     {0x31, "BinaryTime9"},
2408     {0x32, "Date"},
2409     {0x33, "BinaryDate2000"},
2410     {0x34, "TimeOfDay without date indication"},
2411     {0x35, "TimeDifference with date indication"},
2412     {0x36, "TimeDifference without date indication"},
2413     {0x37, "Integer64"},
2414     {0x38, "Unsigned64"},
2415     {0x39, "BitString64"},
2416     {0x3A, "NetworkTime"},
2417     {0x3B, "NetworkTime-Difference"},
2418 
2419     {0x40, "Zero" },
2420     {0x41, "Byte" },
2421     {0x42, "Word" },
2422     {0x43, "Dword" },
2423     {0x44, "Error Type" },
2424     {0x65, "Float32+Unsigned8"},
2425     {0x66, "Unsigned8+Unsigned8"},
2426     {0x67, "OctetString2+Unsigned8"},
2427     {0x68, "Unsigned16_S"},
2428     {0x69, "Integer16_S"},
2429     {0x6A, "Unsigned8_S"},
2430     {0x6B, "OctetString_S"},
2431     {0x6E, "F message trailer with 4 octets"},
2432     {0x6F, "F message trailer with 5 octets"},
2433     {0x70, "F message trailer with 6 octets"},
2434     {0x71, "N2 Normalized value (16 bit)"},
2435     {0x72, "N4 Normalized value (32 bit)"},
2436     {0x73, "V2 Bit sequence" },
2437     {0x74, "L2 Nibble"},
2438     {0x75, "R2 Reciprocal time constant"},
2439     {0x76, "T2 Time constant (16 bit)"},
2440     {0x77, "T4 Time constant (32 bit)"},
2441     {0x78, "D2 Time constant"},
2442     {0x79, "E2 Fixed point value (16 bit)"},
2443     {0x7A, "C4 Fixed point value (32 bit)"},
2444     {0x7B, "X2 Normalized value, variable (16bit)"},
2445     {0x7C, "X4 Normalized value, variables (32bit)"},
2446     { 0, NULL }
2447 };
2448 
2449 static const value_string pn_io_profidrive_parameter_resp_errors[] =
2450 {
2451     {0x0, "Disallowed parameter number" },
2452     {0x1, "The parameter value cannot be changed" },
2453     {0x2, "Exceed the upper or lower limit" },
2454     {0x3, "Sub-index error" },
2455     {0x4, "Non-array" },
2456     {0x5, "Incorrect data type" },
2457     {0x6, "Setting is not allowed (can only be reset)" },
2458     {0x7, "The description element cannot be modified" },
2459     {0x8, "Reserved" },
2460     {0x9, "Descriptive data does not exist" },
2461     {0xA, "Reserved" },
2462     {0xB, "No operation priority" },
2463     {0xC, "Reserved" },
2464     {0xD, "Reserved" },
2465     {0xE, "Reserved" },
2466     {0xF, "The text array does not save right" },
2467     {0x11, "The request cannot be executed because of the working status" },
2468     {0x12, "Reserved" },
2469     {0x13, "Reserved" },
2470     {0x14, "Value is not allowed" },
2471     {0x15, "Response timeout" },
2472     {0x16, "Illegal parameter address" },
2473     {0x17, "Illegal parameter format" },
2474     {0x18, "The number of values is inconsistent" },
2475     {0x19, "Axis/DO does not exist" },
2476     {0x20, "The parameter text element cannot be changed" },
2477     {0x21, "No support service" },
2478     {0x22, "Too many parameter requests" },
2479     {0x23, "Only support single parameter access" },
2480     { 0, NULL }
2481 };
2482 static const range_string pn_io_rs_block_type[] = {
2483     /* Following ranges are used for events */
2484     { 0x0000, 0x0000, "reserved" },
2485     { 0x0001, 0x3FFF, "Manufacturer specific" },
2486     { 0x4000, 0x4000, "Stop observer - Observer Status Observer" },
2487     { 0x4001, 0x4001, "Buffer observer - RS_BufferObserver" },
2488     { 0x4002, 0x4002, "Time status observer - RS_TimeStatus" },
2489     { 0x4003, 0x4003, "System redundancy layer observer - RS_SRLObserver" },
2490     { 0x4004, 0x4004, "Source identification observer - RS_SourceIdentification" },
2491     { 0x4005, 0x400F, "reserved" },
2492     { 0x4010, 0x4010, "Digital input observer - SoE_DigitalInputObserver" },
2493     { 0x4011, 0x6FFF, "Reserved for normative usage" },
2494     { 0x7000, 0x7FFF, "Reserved for profile usage" },
2495     /* Following ranges are used for adjust */
2496     { 0x8000, 0x8000, "reserved" },
2497     { 0x8001, 0xBFFF, "Manufacturer specific" },
2498     { 0xC000, 0xC00F, "Reserved for normative usage" },
2499     { 0xC010, 0xC010, "Digital input observer - SoE_DigitalInputObserver" },
2500     { 0xC011, 0xEFFF, "Reserved for normative usage"},
2501     { 0xF000, 0xFFFF, "Reserved for profile usage"},
2502     { 0, 0, NULL }
2503 };
2504 
2505 static const value_string pn_io_rs_specifier_specifier[] = {
2506     { 0x0, "Current value" },
2507     { 0x1, "Appears" },
2508     { 0x2, "Disappears" },
2509     { 0x3, "Reserved" },
2510     { 0, NULL }
2511 };
2512 
2513 static const value_string pn_io_rs_time_stamp_status[] = {
2514     { 0x0, "TimeStamp related to global synchronized time" },
2515     { 0x1, "TimeStamp related to local time" },
2516     { 0x2, "TimeStamp related to local (arbitrary timescale) time" },
2517     { 0, NULL }
2518 };
2519 
2520 static const value_string pn_io_rs_reason_code_reason[] = {
2521     { 0x00000000, "Reserved" },
2522     { 0x00000001, "Observed data status unclear" },
2523     { 0x00000002, "Buffer overrun" },
2524     /* 0x0003 - 0xFFFF Reserved */
2525     { 0, NULL }
2526 };
2527 
2528 static const value_string pn_io_rs_reason_code_detail[] = {
2529     { 0x00000000, "No Detail" },
2530     /* 0x0001 - 0xFFFF Reserved */
2531     { 0, NULL }
2532 };
2533 
2534 static const value_string pn_io_soe_digital_input_current_value_value[] = {
2535     { 0x0, "Digital input is zero" },
2536     { 0x1, "Digital input is one" },
2537     { 0, NULL }
2538 };
2539 
2540 static const value_string pn_io_soe_adjust_specifier_incident[] = {
2541     { 0x00, "Reserved" },
2542     { 0x01, "Rising edge" },
2543     { 0x02, "Falling edge" },
2544     { 0x03, "Reserved" },
2545     { 0, NULL }
2546 };
2547 
2548 static const value_string pn_io_rs_properties_alarm_transport[] = {
2549     { 0x00000000, "Default Reporting system events need to be read by record " },
2550     { 0x00000001, "Reporting system events shall be forwarded to the IOC using the alarm transport" },
2551     { 0, NULL }
2552 };
2553 
2554 static const value_string pn_io_am_location_structure_vals[] = {
2555     { 0x00, "Reserved" },
2556     { 0x01, "Twelve level tree format" },
2557     { 0x02, "Slot - and SubslotNumber format" },
2558     { 0, NULL }
2559 };
2560 
2561 static const range_string pn_io_am_location_level_vals[] = {
2562     { 0x0000, 0x03FE, "Address information to identify a reported node" },
2563     { 0x03FF, 0x03FF, "Level not used" },
2564     { 0, 0, NULL }
2565 };
2566 
2567 static const value_string pn_io_am_location_reserved_vals[] = {
2568     { 0x00, "Reserved" },
2569     { 0, NULL }
2570 };
2571 
2572 static const range_string pn_io_RedundancyDataHoldFactor[] = {
2573     { 0x0000, 0x0002, "Reserved" },
2574     { 0x0003, 0x00C7, "Optional - An expiration of the time leads to an AR termination." },
2575     { 0x00C8, 0xFFFF, "Mandatory - An expiration of the time leads to an AR termination." },
2576     { 0, 0, NULL }
2577 };
2578 
2579 static const value_string pn_io_ar_arnumber[] = {
2580     { 0x0000, "reserved" },
2581     { 0x0001, "1st AR of an ARset" },
2582     { 0x0002, "2nd AR of an ARset" },
2583     { 0x0003, "3rd AR of an ARset" },
2584     { 0x0004, "4th AR of an ARset" },
2585     /*0x0005 - 0xFFFF reserved */
2586     { 0, NULL }
2587 };
2588 
2589 static const value_string pn_io_ar_arresource[] = {
2590     { 0x0000, "reserved" },
2591     { 0x0002, "Communication endpoint shall allocate two ARs for the ARset" },
2592     /*0x0001 and 0x0003 - 0xFFFF reserved */
2593     { 0, NULL }
2594 };
2595 
2596 static const range_string pn_io_line_delay_value[] = {
2597     { 0x00000000, 0x00000000, "Line delay and cable delay unknown" },
2598     { 0x00000001, 0x7FFFFFFF, "Line delay in nanoseconds" },
2599     { 0, 0, NULL }
2600 };
2601 
2602 static const range_string pn_io_cable_delay_value[] = {
2603     { 0x00000000, 0x00000000, "Reserved" },
2604     { 0x00000001, 0x7FFFFFFF, "Cable delay in nanoseconds" },
2605     { 0, 0, NULL }
2606 };
2607 
2608 static const true_false_string pn_io_pdportstatistic_counter_status_contents = {
2609     "The contents of the field are invalid. They shall be set to zero.",
2610     "The contents of the field are valid"
2611 };
2612 
2613 static const value_string pn_io_pdportstatistic_counter_status_reserved[] = {
2614     { 0x00, "Reserved" },
2615     { 0, NULL }
2616 };
2617 
2618 static int
dissect_profidrive_value(tvbuff_t * tvb,gint offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint8 format_val)2619 dissect_profidrive_value(tvbuff_t *tvb, gint offset, packet_info *pinfo,
2620                          proto_tree *tree, guint8 *drep, guint8 format_val)
2621 {
2622     guint32 value32;
2623     guint16 value16;
2624     guint8  value8;
2625 
2626     switch(format_val)
2627     {
2628     case 1:
2629     case 2:
2630     case 5:
2631     case 0x0A:
2632     case 0x41:
2633         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
2634             hf_pn_io_profidrive_param_value_byte, &value8);
2635         break;
2636     case 3:
2637     case 6:
2638     case 0x42:
2639     case 0x73:
2640         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2641             hf_pn_io_profidrive_param_value_word, &value16);
2642         break;
2643     case 4:
2644     case 7:
2645     case 0x43:
2646         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
2647             hf_pn_io_profidrive_param_value_dword, &value32);
2648         break;
2649     case 8:
2650         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
2651             hf_pn_io_profidrive_param_value_float, &value32);
2652         break;
2653     case 9:
2654         {
2655             gint sLen;
2656             sLen = (gint)tvb_strnlen( tvb, offset, -1);
2657             proto_tree_add_item(tree, hf_pn_io_profidrive_param_value_string, tvb, offset, sLen, ENC_ASCII|ENC_NA);
2658             offset = (offset + sLen);
2659             break;
2660         }
2661     default:
2662         offset = offset + 1;
2663         expert_add_info_format(pinfo, tree, &ei_pn_io_unsupported, "Not supported or invalid format %u!", format_val);
2664         break;
2665     }
2666     return(offset);
2667 }
2668 
2669 static GList *pnio_ars;
2670 
2671 typedef struct pnio_ar_s {
2672     /* generic */
2673     e_guid_t     aruuid;
2674     guint16      inputframeid;
2675     guint16      outputframeid;
2676 
2677     /* controller only */
2678     /*const char      controllername[33];*/
2679     guint8       controllermac[6];
2680     guint16      controlleralarmref;
2681 
2682     /* device only */
2683     guint8       devicemac[6];
2684     guint16      devicealarmref;
2685     guint16      arType;
2686 } pnio_ar_t;
2687 
2688 
2689 
2690 static void
pnio_ar_info(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,pnio_ar_t * ar)2691 pnio_ar_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pnio_ar_t *ar)
2692 {
2693     p_add_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0, ar );
2694     p_add_proto_data(pinfo->pool, pinfo, proto_pn_io, 0, GUINT_TO_POINTER(10));
2695 
2696     if (tree) {
2697         proto_item *item;
2698         proto_item *sub_item;
2699         proto_tree *sub_tree;
2700         address   controllermac_addr, devicemac_addr;
2701 
2702         set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
2703         set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
2704 
2705         sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_pn_io_ar_info, &sub_item,
2706             "ARUUID:%s ContrMAC:%s ContrAlRef:0x%x DevMAC:%s DevAlRef:0x%x InCR:0x%x OutCR=0x%x",
2707             guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid),
2708             address_to_str(pinfo->pool, &controllermac_addr), ar->controlleralarmref,
2709             address_to_str(pinfo->pool, &devicemac_addr), ar->devicealarmref,
2710             ar->inputframeid, ar->outputframeid);
2711         proto_item_set_generated(sub_item);
2712 
2713         item = proto_tree_add_guid(sub_tree, hf_pn_io_ar_uuid, tvb, 0, 0, (e_guid_t *) &ar->aruuid);
2714         proto_item_set_generated(item);
2715 
2716         item = proto_tree_add_ether(sub_tree, hf_pn_io_cminitiator_macadd, tvb, 0, 0, ar->controllermac);
2717         proto_item_set_generated(item);
2718         item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->controlleralarmref);
2719         proto_item_set_generated(item);
2720 
2721         item = proto_tree_add_ether(sub_tree, hf_pn_io_cmresponder_macadd, tvb, 0, 0, ar->devicemac);
2722         proto_item_set_generated(item);
2723         item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->devicealarmref);
2724         proto_item_set_generated(item);
2725 
2726         item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->inputframeid);
2727         proto_item_set_generated(item);
2728         item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->outputframeid);
2729         proto_item_set_generated(item);
2730     }
2731 }
2732 
2733 
2734 
2735 
2736 static int dissect_block(tvbuff_t *tvb, int offset,
2737     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar);
2738 
2739 static int dissect_a_block(tvbuff_t *tvb, int offset,
2740     packet_info *pinfo, proto_tree *tree, guint8 *drep);
2741 
2742 static int dissect_PNIO_IOxS(tvbuff_t *tvb, int offset,
2743     packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex);
2744 
2745 
2746 
2747 
2748 
2749 static pnio_ar_t *
pnio_ar_find_by_aruuid(packet_info * pinfo _U_,e_guid_t * aruuid)2750 pnio_ar_find_by_aruuid(packet_info *pinfo _U_, e_guid_t *aruuid)
2751 {
2752     GList     *ars;
2753     pnio_ar_t *ar;
2754 
2755 
2756     /* find pdev */
2757     for(ars = pnio_ars; ars != NULL; ars = g_list_next(ars)) {
2758         ar = (pnio_ar_t *)ars->data;
2759 
2760         if (memcmp(&ar->aruuid, aruuid, sizeof(e_guid_t)) == 0) {
2761             return ar;
2762         }
2763     }
2764 
2765     return NULL;
2766 }
2767 
2768 
2769 static pnio_ar_t *
pnio_ar_new(e_guid_t * aruuid)2770 pnio_ar_new(e_guid_t *aruuid)
2771 {
2772     pnio_ar_t *ar;
2773 
2774 
2775     ar = wmem_new0(wmem_file_scope(), pnio_ar_t);
2776 
2777     memcpy(&ar->aruuid, aruuid, sizeof(e_guid_t));
2778 
2779     ar->controlleralarmref  = 0xffff;
2780     ar->devicealarmref      = 0xffff;
2781 
2782     pnio_ars = g_list_append(pnio_ars, ar);
2783 
2784     return ar;
2785 }
2786 
2787 /* dissect the alarm specifier */
2788 static int
dissect_Alarm_specifier(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)2789 dissect_Alarm_specifier(tvbuff_t *tvb, int offset,
2790     packet_info *pinfo, proto_tree *tree, guint8 *drep)
2791 {
2792     guint16     u16AlarmSpecifierSequence;
2793     guint16     u16AlarmSpecifierChannel;
2794     guint16     u16AlarmSpecifierManufacturer;
2795     guint16     u16AlarmSpecifierSubmodule;
2796     guint16     u16AlarmSpecifierAR;
2797     proto_item *sub_item;
2798     proto_tree *sub_tree;
2799 
2800     /* alarm specifier */
2801     sub_item = proto_tree_add_item(tree, hf_pn_io_alarm_specifier, tvb, offset, 2, ENC_NA);
2802     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type);
2803 
2804     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2805                         hf_pn_io_alarm_specifier_sequence, &u16AlarmSpecifierSequence);
2806     u16AlarmSpecifierSequence &= 0x07FF;
2807     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2808                         hf_pn_io_alarm_specifier_channel, &u16AlarmSpecifierChannel);
2809     u16AlarmSpecifierChannel = (u16AlarmSpecifierChannel &0x0800) >> 11;
2810     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2811                         hf_pn_io_alarm_specifier_manufacturer, &u16AlarmSpecifierManufacturer);
2812     u16AlarmSpecifierManufacturer = (u16AlarmSpecifierManufacturer &0x1000) >> 12;
2813     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2814                         hf_pn_io_alarm_specifier_submodule, &u16AlarmSpecifierSubmodule);
2815     u16AlarmSpecifierSubmodule = (u16AlarmSpecifierSubmodule & 0x2000) >> 13;
2816     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2817                         hf_pn_io_alarm_specifier_ardiagnosis, &u16AlarmSpecifierAR);
2818     u16AlarmSpecifierAR = (u16AlarmSpecifierAR & 0x8000) >> 15;
2819 
2820 
2821     proto_item_append_text(sub_item, ", Sequence: %u, Channel: %u, Manuf: %u, Submodule: %u AR: %u",
2822         u16AlarmSpecifierSequence, u16AlarmSpecifierChannel,
2823         u16AlarmSpecifierManufacturer, u16AlarmSpecifierSubmodule, u16AlarmSpecifierAR);
2824 
2825     return offset;
2826 }
2827 
2828 
2829 /* dissect the alarm header */
2830 static int
dissect_Alarm_header(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep)2831 dissect_Alarm_header(tvbuff_t *tvb, int offset,
2832     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep)
2833 {
2834     guint16 u16AlarmType;
2835     guint32 u32Api;
2836     guint16 u16SlotNr;
2837     guint16 u16SubslotNr;
2838 
2839     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2840                         hf_pn_io_alarm_type, &u16AlarmType);
2841     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
2842                         hf_pn_io_api, &u32Api);
2843     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2844                         hf_pn_io_slot_nr, &u16SlotNr);
2845     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2846                         hf_pn_io_subslot_nr, &u16SubslotNr);
2847 
2848     proto_item_append_text(item, ", %s, API:%u, Slot:0x%x/0x%x",
2849         val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"),
2850         u32Api, u16SlotNr, u16SubslotNr);
2851 
2852     col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, Slot: 0x%x/0x%x",
2853         val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"),
2854         u16SlotNr, u16SubslotNr);
2855 
2856     return offset;
2857 }
2858 
2859 
2860 static int
dissect_ChannelProperties(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep)2861 dissect_ChannelProperties(tvbuff_t *tvb, int offset,
2862     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
2863 {
2864     proto_item *sub_item;
2865     proto_tree *sub_tree;
2866     guint16     u16ChannelProperties;
2867 
2868 
2869     sub_item = proto_tree_add_item(tree, hf_pn_io_channel_properties, tvb, offset, 2, ENC_BIG_ENDIAN);
2870     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_channel_properties);
2871     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2872                     hf_pn_io_channel_properties_direction, &u16ChannelProperties);
2873     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2874                     hf_pn_io_channel_properties_specifier, &u16ChannelProperties);
2875     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2876                     hf_pn_io_channel_properties_maintenance, &u16ChannelProperties);
2877     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2878                     hf_pn_io_channel_properties_accumulative, &u16ChannelProperties);
2879     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2880                     hf_pn_io_channel_properties_type, &u16ChannelProperties);
2881 
2882     return offset;
2883 }
2884 
2885 /* dissect the RS_BlockHeader */
2886 static int
dissect_RS_BlockHeader(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item,guint8 * drep,guint16 * u16RSBodyLength,guint16 * u16RSBlockType)2887 dissect_RS_BlockHeader(tvbuff_t *tvb, int offset,
2888     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep,
2889     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
2890 {
2891     guint16 u16RSBlockLength;
2892     guint8  u8BlockVersionHigh;
2893     guint8  u8BlockVersionLow;
2894 
2895     /* u16RSBlockType is needed for further dissection */
2896     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2897         hf_pn_io_rs_block_type, u16RSBlockType);
2898 
2899     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2900         hf_pn_io_rs_block_length, &u16RSBlockLength);
2901 
2902     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
2903         hf_pn_io_block_version_high, &u8BlockVersionHigh);
2904     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
2905         hf_pn_io_block_version_low, &u8BlockVersionLow);
2906 
2907     proto_item_append_text(item, ": Type=%s, Length=%u(+4), Version=%u.%u",
2908         rval_to_str(*u16RSBlockType, pn_io_rs_block_type, "Unknown (0x%04x)"),
2909         u16RSBlockLength, u8BlockVersionHigh, u8BlockVersionLow);
2910 
2911     /* Block length is without type and length fields, but with version field */
2912     /* as it's already dissected, remove it */
2913     *u16RSBodyLength = u16RSBlockLength - 2;
2914 
2915     /* Padding 2 + 2 + 1 + 1 = 6 */
2916     /* Therefore we need 2 byte padding to make the block u32 aligned */
2917     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
2918 
2919     /* remove padding */
2920     *u16RSBodyLength -= 2;
2921     return offset;
2922 }
2923 
2924 static int
dissect_RS_AddressInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep,guint16 * u16RSBodyLength)2925 dissect_RS_AddressInfo(tvbuff_t *tvb, int offset,
2926     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength)
2927 {
2928     e_guid_t IM_UniqueIdentifier;
2929     guint32  u32Api;
2930     guint16  u16SlotNr;
2931     guint16  u16SubslotNr;
2932     guint16  u16ChannelNumber;
2933 
2934     /* IM_UniqueIdentifier */
2935     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
2936         hf_pn_io_ar_uuid, &IM_UniqueIdentifier);
2937     *u16RSBodyLength -= 16;
2938 
2939     /* API */
2940     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
2941         hf_pn_io_api, &u32Api);
2942     *u16RSBodyLength -= 4;
2943 
2944     /* SlotNumber */
2945     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2946         hf_pn_io_slot_nr, &u16SlotNr);
2947     *u16RSBodyLength -= 2;
2948 
2949     /* SubSlotNumber*/
2950     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2951         hf_pn_io_subslot_nr, &u16SubslotNr);
2952     *u16RSBodyLength -= 2;
2953 
2954     /* Channel Number*/
2955     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
2956         hf_pn_io_channel_number, &u16ChannelNumber);
2957     *u16RSBodyLength -= 2;
2958 
2959     return offset;
2960 }
2961 
2962 /* dissect the RS_EventDataCommon */
2963 static int
dissect_RS_EventDataCommon(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep,guint16 * u16RSBodyLength)2964 dissect_RS_EventDataCommon(tvbuff_t *tvb, int offset,
2965     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength)
2966 {
2967     guint16     u16RSSpecifierSequenceNumber;
2968     guint16     u16RSSpecifierReserved;
2969     guint16     u16RSSpecifierSpecifier;
2970     guint16     u16RSMinorError;
2971     guint16     u16RSPlusError;
2972     proto_item  *sub_item;
2973     proto_tree  *sub_tree;
2974     proto_item  *sub_item_time_stamp;
2975     proto_tree  *sub_tree_time_stamp;
2976     nstime_t    timestamp;
2977     guint16     u16RSTimeStampStatus;
2978 
2979     /* RS_AddressInfo */
2980     offset = dissect_RS_AddressInfo(tvb, offset, pinfo, tree, drep, u16RSBodyLength);
2981 
2982     /* RS_Specifier */
2983     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_specifier, tvb, offset, 2, ENC_BIG_ENDIAN);
2984     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_specifier);
2985 
2986     /* RS_Specifier.SequenceNumber */
2987     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2988         hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber);
2989 
2990     /* RS_Specifier.Reserved */
2991     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2992         hf_pn_io_rs_specifier_reserved, &u16RSSpecifierReserved);
2993 
2994     /* RS_Specifier.Specifier */
2995     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
2996         hf_pn_io_rs_specifier_specifier, &u16RSSpecifierSpecifier);
2997     *u16RSBodyLength -= 2;
2998 
2999     /* RS_TimeStamp */
3000     sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA);
3001     sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp);
3002 
3003     /* RS_TimeStamp.Status */
3004     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep,
3005         hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus);
3006 
3007     /* RS_TimeStamp.TimeStamp */
3008 
3009     /* Start after from 2 bytes Status */
3010     timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2);
3011 
3012     /* Start after from 4 bytes timestamp.secs */
3013     timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8);
3014 
3015     /* Start after from 2 bytes Status and get all 10 bytes */
3016     proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp);
3017     *u16RSBodyLength -= 12;
3018     offset += 12;
3019 
3020     /* RS_MinusError */
3021     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3022         hf_pn_io_rs_minus_error, &u16RSMinorError);
3023     *u16RSBodyLength -= 2;
3024 
3025     /* RS_PlusError */
3026     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3027         hf_pn_io_rs_plus_error, &u16RSPlusError);
3028     *u16RSBodyLength -= 2;
3029 
3030     return offset;
3031 }
3032 
3033 /* dissect the RS_IdentificationInfo */
3034 static int
dissect_RS_IdentificationInfo(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)3035 dissect_RS_IdentificationInfo(tvbuff_t *tvb, int offset,
3036     packet_info *pinfo, proto_tree *tree, guint8 *drep)
3037 {
3038     dcerpc_info di; /* fake dcerpc_info struct */
3039     dcerpc_call_value dcv; /* fake dcerpc_call_value struct */
3040     guint64     u64AMDeviceIdentificationDeviceSubID;
3041     guint64     u64AMDeviceIdentificationDeviceID;
3042     guint64     u64AMDeviceIdentificationVendorID;
3043     guint64     u64AM_DeviceIdentificationOrganization;
3044 
3045     proto_item *sub_item;
3046     proto_tree *sub_tree;
3047 
3048     di.call_data = &dcv;
3049 
3050     sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN);
3051     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification);
3052 
3053     /* AM_DeviceIdentification */
3054     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3055         hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID);
3056     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3057         hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID);
3058     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3059         hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID);
3060     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3061         hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization);
3062 
3063     /* IM_Tag_Function [32] */
3064     proto_tree_add_item(tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII|ENC_NA);
3065     offset += 32;
3066 
3067     /* IM_Tag_Location [22] */
3068     proto_tree_add_item(tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII|ENC_NA);
3069     offset += 22;
3070 
3071     return offset;
3072 }
3073 
3074 /* dissect the RS_EventDataExtension_Data */
3075 static int
dissect_RS_EventDataExtension_Data(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint8 * u8RSExtensionBlockLength,guint16 * u16RSBlockType)3076 dissect_RS_EventDataExtension_Data(tvbuff_t *tvb, int offset,
3077     packet_info *pinfo, proto_tree *tree, guint8 *drep,
3078     guint8 *u8RSExtensionBlockLength, guint16 *u16RSBlockType)
3079 {
3080     guint32     u32RSReasonCodeReason;
3081     guint32     u32RSReasonCodeDetail;
3082     guint8      u8LengthRSDomainIdentification = 16;
3083     guint8      u8LengthRSMasterIdentification = 8;
3084     guint16     u16SoE_DigitalInputCurrentValueValue;
3085     guint16     u16SoE_DigitalInputCurrentValueReserved;
3086 
3087     proto_item *sub_item;
3088     proto_tree *sub_tree;
3089     nstime_t timestamp;
3090     guint16 u16RSTimeStampStatus;
3091     proto_item *sub_item_time_stamp;
3092     proto_tree *sub_tree_time_stamp;
3093 
3094     switch (*u16RSBlockType) {
3095     case(0x4000): /* RS_StopObserver */
3096 
3097         /* RS_BlockType */
3098         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3099         hf_pn_io_rs_block_type, u16RSBlockType);
3100 
3101         /* RS_ReasonCode */
3102         sub_item = proto_tree_add_item(tree, hf_pn_io_rs_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN);
3103         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_reason_code);
3104         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
3105             hf_pn_io_rs_reason_code_reason, &u32RSReasonCodeReason);
3106         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
3107             hf_pn_io_rs_reason_code_detail, &u32RSReasonCodeDetail);
3108         *u8RSExtensionBlockLength -= 6;
3109         break;
3110     case(0x4001): /* RS_BufferObserver */
3111         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3112         *u8RSExtensionBlockLength = 0;
3113         break;
3114     case(0x4002): /* RS_TimeStatus */
3115 
3116         /* Padding 1 + 1 + 16 + 8 = 26  or 1 + 1 + 16 + 8 + 12 = 38 */
3117         /* Therefore we need 2 byte padding to make the block u32 aligned */
3118         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
3119         *u8RSExtensionBlockLength -= 2;
3120 
3121         /* RS_DomainIdentification */
3122         proto_tree_add_item(tree, hf_pn_io_rs_domain_identification, tvb, offset, u8LengthRSDomainIdentification, ENC_NA);
3123         offset += u8LengthRSDomainIdentification;
3124         *u8RSExtensionBlockLength -= 16;
3125 
3126         /* RS_MasterIdentification */
3127         proto_tree_add_item(tree, hf_pn_io_rs_master_identification, tvb, offset, u8LengthRSMasterIdentification, ENC_NA);
3128         offset += u8LengthRSMasterIdentification;
3129         *u8RSExtensionBlockLength -= 8;
3130 
3131         if (*u8RSExtensionBlockLength > 2)
3132         {
3133             /* RS_TimeStamp */
3134             sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA);
3135             sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp);
3136 
3137             /* RS_TimeStamp.Status */
3138             dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep,
3139                 hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus);
3140 
3141             /* RS_TimeStamp.TimeStamp */
3142             timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2); // Start after from 2 bytes Status
3143             timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8);  // Start after from 4 bytes timestamp.secs
3144             // Start after from 2 bytes Status and get all 10 bytes
3145             proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp);
3146             offset += 12;
3147         }
3148         break;
3149     case(0x4003): /* RS_SRLObserver */
3150         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3151         *u8RSExtensionBlockLength = 0;
3152         break;
3153     case(0x4004): /* RS_SourceIdentification */
3154         offset = dissect_RS_IdentificationInfo(tvb, offset, pinfo, tree, drep);
3155         *u8RSExtensionBlockLength = 0;
3156         break;
3157     case(0x4010): /* SoE_DigitalInputObserver */
3158         /* SoE_DigitalInputCurrentValue */
3159         sub_item = proto_tree_add_item(tree, hf_pn_io_soe_digital_input_current_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3160         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_digital_input_current_value);
3161 
3162         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3163         hf_pn_io_soe_digital_input_current_value_value, &u16SoE_DigitalInputCurrentValueValue);
3164         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3165             hf_pn_io_soe_digital_input_current_value_reserved, &u16SoE_DigitalInputCurrentValueReserved);
3166         *u8RSExtensionBlockLength -= 2;
3167         break;
3168     default:
3169         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData");
3170         *u8RSExtensionBlockLength = 0;
3171         break;
3172     }
3173     return offset;
3174 }
3175 
3176 /* dissect the RS_EventDataExtension */
3177 static int
dissect_RS_EventDataExtension(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep,guint16 * u16RSBlockLength,guint16 * u16RSBlockType)3178 dissect_RS_EventDataExtension(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3179     proto_tree *tree, guint8 *drep, guint16 *u16RSBlockLength, guint16 *u16RSBlockType)
3180 {
3181     guint8 u8RSExtensionBlockType;
3182     guint8 u8RSExtensionBlockLength;
3183 
3184     /* RS_ExtensionBlockType */
3185     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3186         hf_pn_io_rs_extension_block_type, &u8RSExtensionBlockType);
3187     *u16RSBlockLength -= 1;
3188 
3189     /* RS_ExtensionBlockLength */
3190     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3191         hf_pn_io_rs_extension_block_length, &u8RSExtensionBlockLength);
3192     *u16RSBlockLength -= 1;
3193 
3194     /* Data*[Padding] * a*/
3195     while (u8RSExtensionBlockLength) {
3196         *u16RSBlockLength -= u8RSExtensionBlockLength;
3197         offset = dissect_RS_EventDataExtension_Data(tvb, offset, pinfo, tree, drep,
3198             &u8RSExtensionBlockLength, u16RSBlockType);
3199     }
3200 
3201     return offset;
3202 }
3203 
3204 /* dissect the RS_EventData */
3205 static int
dissect_RS_EventData(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep,guint16 * u16RSBodyLength,guint16 * u16RSBlockType)3206 dissect_RS_EventData(tvbuff_t *tvb, int offset,
3207     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep,
3208     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
3209 {
3210     proto_item *sub_item;
3211     proto_tree *sub_tree;
3212 
3213     /* RS_EventDataCommon */
3214     offset = dissect_RS_EventDataCommon(tvb, offset, pinfo, tree, drep, u16RSBodyLength);
3215 
3216     /* optional: RS_EventDataExtension */
3217     while (*u16RSBodyLength > 0) {
3218         sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_data_extension, tvb, offset, 0, ENC_NA);
3219         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_data_extension);
3220         offset = dissect_RS_EventDataExtension(tvb, offset, pinfo, sub_tree, drep,
3221             u16RSBodyLength, u16RSBlockType);
3222     }
3223 
3224     return offset;
3225 }
3226 
3227 /* dissect the RS_EventBlock */
3228 static int
dissect_RS_EventBlock(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)3229 dissect_RS_EventBlock(tvbuff_t *tvb, int offset,
3230     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3231 {
3232     proto_item *sub_item;
3233     proto_tree *sub_tree;
3234 
3235     guint16 u16RSBodyLength;
3236     guint16 u16RSBlockType;
3237 
3238     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_block, tvb, offset, 0, ENC_NA);
3239     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_block);
3240 
3241     /* RS_BlockHeader */
3242     offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep,
3243         &u16RSBodyLength, &u16RSBlockType);
3244 
3245     /* RS_EventData */
3246     offset = dissect_RS_EventData(tvb, offset, pinfo, sub_tree, drep,
3247         &u16RSBodyLength, &u16RSBlockType);
3248     return offset;
3249 }
3250 
3251 /* dissect the RS_AlarmInfo */
3252 static int
dissect_RS_AlarmInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)3253 dissect_RS_AlarmInfo(tvbuff_t *tvb, int offset,
3254     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3255 {
3256     proto_item *sub_item;
3257     proto_tree *sub_tree;
3258     guint16    u16RSAlarmInfo;
3259 
3260     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_alarm_info, tvb, offset, 2, ENC_BIG_ENDIAN);
3261     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_alarm_info);
3262 
3263     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3264         hf_pn_io_rs_alarm_info_reserved_0_7, &u16RSAlarmInfo);
3265 
3266     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3267         hf_pn_io_rs_alarm_info_reserved_8_15, &u16RSAlarmInfo);
3268 
3269     return offset;
3270 }
3271 
3272 /* dissect the RS_EventInfo */
3273 static int
dissect_RS_EventInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)3274 dissect_RS_EventInfo(tvbuff_t *tvb, int offset,
3275     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
3276 {
3277     proto_item *sub_item;
3278     proto_tree *sub_tree;
3279     guint16    u16NumberofEntries;
3280 
3281     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_info, tvb, offset, 0, ENC_NA);
3282     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_info);
3283 
3284     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3285         hf_pn_io_number_of_rs_event_info, &u16NumberofEntries);
3286 
3287     while (u16NumberofEntries > 0) {
3288         u16NumberofEntries--;
3289         offset = dissect_RS_EventBlock(tvb, offset, pinfo, sub_tree, drep);
3290     }
3291     return offset;
3292 }
3293 
3294 static int
dissect_AlarmUserStructure(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint16 * body_length,guint16 u16UserStructureIdentifier)3295 dissect_AlarmUserStructure(tvbuff_t *tvb, int offset,
3296     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
3297         guint16 *body_length, guint16 u16UserStructureIdentifier)
3298 {
3299     guint16    u16ChannelNumber;
3300     guint16    u16ChannelErrorType;
3301     guint16    u16ExtChannelErrorType;
3302     guint32    u32ExtChannelAddValue;
3303     guint16    u16Index = 0;
3304     guint32    u32RecDataLen;
3305     pnio_ar_t *ar       = NULL;
3306 
3307 
3308     switch (u16UserStructureIdentifier) {
3309     case(0x8000):   /* ChannelDiagnosisData */
3310         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3311                         hf_pn_io_channel_number, &u16ChannelNumber);
3312         offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
3313         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3314                         hf_pn_io_channel_error_type, &u16ChannelErrorType);
3315         *body_length -= 6;
3316         break;
3317     case(0x8002):   /* ExtChannelDiagnosisData */
3318         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3319                         hf_pn_io_channel_number, &u16ChannelNumber);
3320 
3321         offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
3322 
3323         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3324                         hf_pn_io_channel_error_type, &u16ChannelErrorType);
3325 
3326         if (u16ChannelErrorType < 0x7fff)
3327         {
3328             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3329                         hf_pn_io_ext_channel_error_type0, &u16ExtChannelErrorType);
3330         }
3331         else if (u16ChannelErrorType == 0x8000)
3332         {
3333             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3334                         hf_pn_io_ext_channel_error_type0x8000, &u16ExtChannelErrorType);
3335         }
3336         else if (u16ChannelErrorType == 0x8001)
3337         {
3338             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3339                         hf_pn_io_ext_channel_error_type0x8001, &u16ExtChannelErrorType);
3340         }
3341         else if (u16ChannelErrorType == 0x8002)
3342         {
3343             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3344                         hf_pn_io_ext_channel_error_type0x8002, &u16ExtChannelErrorType);
3345         }
3346         else if ((u16ChannelErrorType == 0x8003)||(u16ChannelErrorType == 0x8009))
3347         {
3348             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3349                         hf_pn_io_ext_channel_error_type0x8003, &u16ExtChannelErrorType);
3350         }
3351         else if (u16ChannelErrorType == 0x8004)
3352         {
3353             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3354                         hf_pn_io_ext_channel_error_type0x8004, &u16ExtChannelErrorType);
3355         }
3356         else if (u16ChannelErrorType == 0x8005)
3357         {
3358             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3359                         hf_pn_io_ext_channel_error_type0x8005, &u16ExtChannelErrorType);
3360         }
3361         else if (u16ChannelErrorType == 0x8007)
3362         {
3363             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3364                         hf_pn_io_ext_channel_error_type0x8007, &u16ExtChannelErrorType);
3365         }
3366         else if (u16ChannelErrorType == 0x8008)
3367         {
3368             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3369                         hf_pn_io_ext_channel_error_type0x8008, &u16ExtChannelErrorType);
3370         }
3371         else if (u16ChannelErrorType == 0x800A)
3372         {
3373             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3374                         hf_pn_io_ext_channel_error_type0x800A, &u16ExtChannelErrorType);
3375         }
3376         else if (u16ChannelErrorType == 0x800B)
3377         {
3378             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3379                         hf_pn_io_ext_channel_error_type0x800B, &u16ExtChannelErrorType);
3380         }
3381         else if (u16ChannelErrorType == 0x800C)
3382         {
3383             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3384                         hf_pn_io_ext_channel_error_type0x800C, &u16ExtChannelErrorType);
3385         }
3386         else
3387         {
3388             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3389                         hf_pn_io_ext_channel_error_type, &u16ExtChannelErrorType);
3390         }
3391         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3392                         hf_pn_io_ext_channel_add_value, &u32ExtChannelAddValue);
3393         *body_length -= 12;
3394         break;
3395     case(0x8100):   /* MaintenanceItem */
3396         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
3397         *body_length -= 12;
3398         break;
3399     case(0x8300): /* RS_AlarmInfo (Reporting System Alarm Information) */
3400     case(0x8301): /* RS_AlarmInfo */
3401     case(0x8302): /* RS_AlarmInfo */
3402         offset = dissect_RS_AlarmInfo(tvb, offset, pinfo, tree, drep);
3403         *body_length = 0;
3404         break;
3405     case(0x8303): /* RS_EventInfo (Reporting System Event Information) */
3406         offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep);
3407         *body_length = 0;
3408         break;
3409     case(0x8310): /* PE_EnergySavingStatus */
3410         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
3411         *body_length = 0;
3412         break;
3413     /* XXX - dissect remaining user structures of [AlarmItem] */
3414     case(0x8001):   /* DiagnosisData */
3415     case(0x8003):   /* QualifiedChannelDiagnosisData */
3416     default:
3417         if (u16UserStructureIdentifier >= 0x8000) {
3418             offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, *body_length);
3419         } else {
3420             offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *body_length, "UserData");
3421         }
3422 
3423         *body_length = 0;
3424     }
3425 
3426     return offset;
3427 }
3428 
3429 
3430 
3431 /* dissect the alarm notification block */
3432 static int
dissect_AlarmNotification_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 body_length)3433 dissect_AlarmNotification_block(tvbuff_t *tvb, int offset,
3434     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
3435     guint16 body_length)
3436 {
3437     guint32 u32ModuleIdentNumber;
3438     guint32 u32SubmoduleIdentNumber;
3439     guint16 u16UserStructureIdentifier;
3440 
3441 
3442     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3443         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3444             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3445         return offset;
3446     }
3447 
3448     offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep);
3449 
3450     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3451                         hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
3452     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3453                         hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
3454 
3455     offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep);
3456 
3457     proto_item_append_text(item, ", Ident:0x%x, SubIdent:0x%x",
3458         u32ModuleIdentNumber, u32SubmoduleIdentNumber);
3459 
3460     body_length -= 20;
3461 
3462     /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */
3463     while (body_length) {
3464         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3465                             hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier);
3466         proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier);
3467         body_length -= 2;
3468 
3469         offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep, &body_length, u16UserStructureIdentifier);
3470     }
3471 
3472     return offset;
3473 }
3474 
3475 
3476 static int
dissect_IandM0_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3477 dissect_IandM0_block(tvbuff_t *tvb, int offset,
3478     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3479 {
3480     guint8   u8VendorIDHigh;
3481     guint8   u8VendorIDLow;
3482     guint16  u16IMHardwareRevision;
3483     guint8   u8SWRevisionPrefix;
3484     guint8   u8IMSWRevisionFunctionalEnhancement;
3485     guint8   u8IMSWRevisionBugFix;
3486     guint8   u8IMSWRevisionInternalChange;
3487     guint16  u16IMRevisionCounter;
3488     guint16  u16IMProfileID;
3489     guint16  u16IMProfileSpecificType;
3490     guint8   u8IMVersionMajor;
3491     guint8   u8IMVersionMinor;
3492     guint16  u16IMSupported;
3493 
3494 
3495     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3496         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3497             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3498         return offset;
3499     }
3500 
3501     /* x8 VendorIDHigh */
3502     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3503                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
3504     /* x8 VendorIDLow */
3505     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3506                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
3507     /* c8[20] OrderID */
3508     proto_tree_add_item (tree, hf_pn_io_order_id, tvb, offset, 20, ENC_ASCII|ENC_NA);
3509     offset += 20;
3510 
3511     /* c8[16] IM_Serial_Number */
3512     proto_tree_add_item (tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII|ENC_NA);
3513     offset += 16;
3514 
3515     /* x16 IM_Hardware_Revision */
3516     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3517                     hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
3518     /* c8 SWRevisionPrefix */
3519     offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep,
3520                     hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
3521     /* x8 IM_SWRevision_Functional_Enhancement */
3522     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3523                     hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
3524     /* x8 IM_SWRevision_Bug_Fix */
3525     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3526                     hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
3527     /* x8 IM_SWRevision_Internal_Change */
3528     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3529                     hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
3530     /* x16 IM_Revision_Counter */
3531     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3532                     hf_pn_io_im_revision_counter, &u16IMRevisionCounter);
3533     /* x16 IM_Profile_ID */
3534     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3535                     hf_pn_io_im_profile_id, &u16IMProfileID);
3536     /* x16 IM_Profile_Specific_Type */
3537     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3538                     hf_pn_io_im_profile_specific_type, &u16IMProfileSpecificType);
3539     /* x8 IM_Version_Major (values) */
3540     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3541                     hf_pn_io_im_version_major, &u8IMVersionMajor);
3542     /* x8 IM_Version_Minor (values) */
3543     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3544                     hf_pn_io_im_version_minor, &u8IMVersionMinor);
3545     /* x16 IM_Supported (bitfield) */
3546     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3547                     hf_pn_io_im_supported, &u16IMSupported);
3548 
3549     return offset;
3550 }
3551 
3552 
3553 static int
dissect_IandM1_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3554 dissect_IandM1_block(tvbuff_t *tvb, int offset,
3555     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3556 {
3557     char *pTagFunction;
3558     char *pTagLocation;
3559 
3560     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3561         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3562             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3563         return offset;
3564     }
3565 
3566     /* IM_Tag_Function [32] */
3567     proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII|ENC_NA, pinfo->pool, &pTagFunction);
3568     offset += 32;
3569 
3570     /* IM_Tag_Location [22] */
3571     proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII|ENC_NA, pinfo->pool, &pTagLocation);
3572     offset += 22;
3573 
3574     proto_item_append_text(item, ": TagFunction:\"%s\", TagLocation:\"%s\"", pTagFunction, pTagLocation);
3575 
3576     return offset;
3577 }
3578 
3579 
3580 static int
dissect_IandM2_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3581 dissect_IandM2_block(tvbuff_t *tvb, int offset,
3582     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3583 {
3584     char *pDate;
3585 
3586     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3587         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3588             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3589         return offset;
3590     }
3591 
3592     /* IM_Date [16] */
3593     proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_date, tvb, offset, 16, ENC_ASCII|ENC_NA, pinfo->pool, &pDate);
3594     offset += 16;
3595 
3596     proto_item_append_text(item, ": Date:\"%s\"", pDate);
3597 
3598     return offset;
3599 }
3600 
3601 
3602 static int
dissect_IandM3_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3603 dissect_IandM3_block(tvbuff_t *tvb, int offset,
3604     packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3605 {
3606     char *pDescriptor;
3607 
3608     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3609         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3610             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3611         return offset;
3612     }
3613 
3614     /* IM_Descriptor [54] */
3615     proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_descriptor, tvb, offset, 54, ENC_ASCII|ENC_NA, pinfo->pool, &pDescriptor);
3616     offset += 54;
3617 
3618     proto_item_append_text(item, ": Descriptor:\"%s\"", pDescriptor);
3619 
3620     return offset;
3621 }
3622 
3623 
3624 static int
dissect_IandM4_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3625 dissect_IandM4_block(tvbuff_t *tvb, int offset,
3626     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3627 {
3628 
3629     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3630         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3631             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3632         return offset;
3633     }
3634 
3635     dissect_pn_user_data(tvb, offset, pinfo, tree, 54, "IM Signature");
3636 
3637     return offset;
3638 }
3639 
3640 static int
dissect_IandM5_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3641 dissect_IandM5_block(tvbuff_t *tvb, int offset,
3642     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3643 {
3644     guint16    u16NumberofEntries;
3645 
3646     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3647         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3648             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3649         return offset;
3650     }
3651 
3652     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_numberofentries, &u16NumberofEntries);
3653 
3654     while(u16NumberofEntries > 0) {
3655         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
3656         u16NumberofEntries--;
3657     }
3658     return offset;
3659 }
3660 
3661 static int
dissect_IandM0FilterData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3662 dissect_IandM0FilterData_block(tvbuff_t *tvb, int offset,
3663     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3664 {
3665     guint16     u16NumberOfAPIs;
3666     guint32     u32Api;
3667     guint16     u16NumberOfModules;
3668     guint16     u16SlotNr;
3669     guint32     u32ModuleIdentNumber;
3670     guint16     u16NumberOfSubmodules;
3671     guint16     u16SubslotNr;
3672     guint32     u32SubmoduleIdentNumber;
3673     proto_item *subslot_item;
3674     proto_tree *subslot_tree;
3675     proto_item *module_item;
3676     proto_tree *module_tree;
3677     guint32     u32ModuleStart;
3678 
3679 
3680     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3681         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3682             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3683         return offset;
3684     }
3685 
3686     /* NumberOfAPIs */
3687     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3688                     hf_pn_io_number_of_apis, &u16NumberOfAPIs);
3689 
3690     while (u16NumberOfAPIs--) {
3691         /* API */
3692         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
3693                         hf_pn_io_api, &u32Api);
3694         /* NumberOfModules */
3695         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3696                         hf_pn_io_number_of_modules, &u16NumberOfModules);
3697 
3698         while (u16NumberOfModules--) {
3699             module_item = proto_tree_add_item(tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
3700             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
3701 
3702             u32ModuleStart = offset;
3703 
3704             /* SlotNumber */
3705             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
3706                             hf_pn_io_slot_nr, &u16SlotNr);
3707             /* ModuleIdentNumber */
3708             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep,
3709                             hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
3710             /* NumberOfSubmodules */
3711             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
3712                             hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
3713 
3714             proto_item_append_text(module_item, ": Slot:%u, Ident:0x%x Submodules:%u",
3715                 u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubmodules);
3716 
3717             while (u16NumberOfSubmodules--) {
3718                 subslot_item = proto_tree_add_item(module_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
3719                 subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot);
3720 
3721                 /* SubslotNumber */
3722                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep,
3723                                     hf_pn_io_subslot_nr, &u16SubslotNr);
3724                 /* SubmoduleIdentNumber */
3725                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep,
3726                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
3727 
3728                 proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x",
3729                     u16SubslotNr, u32SubmoduleIdentNumber);
3730             }
3731 
3732             proto_item_set_len(module_item, offset-u32ModuleStart);
3733         }
3734     }
3735 
3736     return offset;
3737 }
3738 
3739 
3740 static int
dissect_IandM5Data_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep)3741 dissect_IandM5Data_block(tvbuff_t *tvb, int offset,
3742     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
3743 {
3744     guint8     u8VendorIDHigh;
3745     guint8     u8VendorIDLow;
3746     guint16    u16IMHardwareRevision;
3747     guint8     u8SWRevisionPrefix;
3748     guint8     u8IMSWRevisionFunctionalEnhancement;
3749     guint8     u8IMSWRevisionBugFix;
3750     guint8     u8IMSWRevisionInternalChange;
3751 
3752     /* c8[64] IM Annotation */
3753     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII|ENC_NA);
3754     offset += 64;
3755 
3756     /* c8[64] IM Order ID */
3757     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII|ENC_NA);
3758     offset += 64;
3759 
3760     /* x8 VendorIDHigh */
3761     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3762                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
3763     /* x8 VendorIDLow */
3764     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3765                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
3766 
3767     /* c8[16] IM Serial Number */
3768     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII|ENC_NA);
3769     offset += 16;
3770 
3771     /* x16 IM_Hardware_Revision */
3772     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
3773                 hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
3774         /* c8 SWRevisionPrefix */
3775     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3776                 hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
3777     /* x8 IM_SWRevision_Functional_Enhancement */
3778     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3779                 hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
3780     /* x8 IM_SWRevision_Bug_Fix */
3781     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3782                 hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
3783 
3784     /* x8 IM_SWRevision_Internal_Change */
3785     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3786                 hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
3787 
3788     return offset;
3789 }
3790 
3791 static int
dissect_AM_Location(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)3792 dissect_AM_Location(tvbuff_t *tvb, int offset,
3793 packet_info *pinfo, proto_tree *tree, guint8 *drep)
3794 {
3795     proto_item          *sub_item;
3796     proto_tree          *sub_tree;
3797     guint8              am_location_structtype;
3798     int bit_offset;
3799     guint8 am_location_reserved1;
3800     guint16 am_location_begin_slot_number;
3801     guint16 am_location_begin_subslot_number;
3802     guint16 am_location_end_slot_number;
3803     guint16 am_location_end_subslot_number;
3804     guint16 am_location_reserved2;
3805     guint16 am_location_reserved3;
3806     guint16 am_location_reserved4;
3807 
3808     sub_item = proto_tree_add_item(tree, hf_pn_io_am_location, tvb, offset, 16, ENC_NA);
3809     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_location);
3810 
3811     am_location_structtype = tvb_get_guint8(tvb, offset+15);
3812     bit_offset = offset << 3;
3813 
3814     switch (am_location_structtype)
3815     {
3816     case (0x01):
3817 
3818         /* level 11 */
3819         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_11, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3820         bit_offset += 10;
3821 
3822         /* level 10 */
3823         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_10, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3824         bit_offset += 10;
3825 
3826         /* level 9 */
3827         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_9, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3828         bit_offset += 10;
3829 
3830         /* level 8 */
3831         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_8, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3832         bit_offset += 10;
3833 
3834         /* level 7 */
3835         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_7, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3836         bit_offset += 10;
3837 
3838         /* level 6 */
3839         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_6, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3840         bit_offset += 10;
3841 
3842         /* level 5 */
3843         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_5, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3844         bit_offset += 10;
3845 
3846         /* level 4 */
3847         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_4, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3848         bit_offset += 10;
3849 
3850         /* level 3 */
3851         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_3, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3852         bit_offset += 10;
3853 
3854         /* level 2 */
3855         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_2, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3856         bit_offset += 10;
3857 
3858         /* level 1 */
3859         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_1, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3860         bit_offset += 10;
3861 
3862         /* level 0 */
3863         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_0, tvb, bit_offset, 10, ENC_BIG_ENDIAN);
3864         bit_offset += 10;
3865 
3866         /* level 0 */
3867         proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_structure, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
3868 
3869         offset += 16;
3870 
3871         break;
3872     case (0x02):
3873         /* Reserved 4 */
3874         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3875             hf_pn_io_am_location_reserved4, &am_location_reserved4);
3876 
3877         /* Reserved 3 */
3878         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3879             hf_pn_io_am_location_reserved3, &am_location_reserved3);
3880 
3881         /* Reserved 2 */
3882         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3883             hf_pn_io_am_location_reserved2, &am_location_reserved2);
3884 
3885         /* EndSubSlotNumber*/
3886         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3887             hf_pn_io_am_location_endsubslotnum, &am_location_end_subslot_number);
3888 
3889         /* EndSlotNumber*/
3890         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3891             hf_pn_io_am_location_endslotnum, &am_location_end_slot_number);
3892 
3893         /* BeginSubslotNumber */
3894         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3895             hf_pn_io_am_location_beginsubslotnum, &am_location_begin_subslot_number);
3896 
3897         /* BeginSlotNumber */
3898         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
3899             hf_pn_io_am_location_beginslotnum, &am_location_begin_slot_number);
3900 
3901         /* Reserved1 */
3902         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
3903             hf_pn_io_am_location_reserved1, &am_location_reserved1);
3904 
3905         /* Structure */
3906         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
3907             hf_pn_io_am_location_structure, &am_location_structtype);
3908 
3909         break;
3910     default: /* will not execute because of the line preceding the switch */
3911         offset += 16;
3912         break;
3913     }
3914 
3915     return offset;
3916 }
3917 
3918 static int
dissect_IM_software_revision(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)3919 dissect_IM_software_revision(tvbuff_t *tvb, int offset,
3920 packet_info *pinfo, proto_tree *tree, guint8 *drep)
3921 {
3922     guint8   u8SWRevisionPrefix;
3923     guint8   u8IMSWRevisionFunctionalEnhancement;
3924     guint8   u8IMSWRevisionBugFix;
3925     guint8   u8IMSWRevisionInternalChange;
3926 
3927     /* SWRevisionPrefix */
3928     offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep,
3929         hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix);
3930 
3931     /* IM_SWRevision_Functional_Enhancement */
3932     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3933         hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement);
3934 
3935     /* IM_SWRevision_Bug_Fix */
3936     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3937         hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix);
3938 
3939     /* IM_SWRevision_Internal_Change */
3940     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
3941         hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange);
3942 
3943     return offset;
3944 }
3945 
3946 static int
dissect_AM_device_identification(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)3947 dissect_AM_device_identification(tvbuff_t *tvb, int offset,
3948 packet_info *pinfo, proto_tree *tree, guint8 *drep)
3949 {
3950     dcerpc_info di; /* fake dcerpc_info struct */
3951     dcerpc_call_value dcv; /* fake dcerpc_call_value struct */
3952     guint64     u64AMDeviceIdentificationDeviceSubID;
3953     guint64     u64AMDeviceIdentificationDeviceID;
3954     guint64     u64AMDeviceIdentificationVendorID;
3955     guint64     u64AM_DeviceIdentificationOrganization;
3956 
3957     proto_item *sub_item;
3958     proto_tree *sub_tree;
3959 
3960     di.call_data = &dcv;
3961 
3962     sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN);
3963     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification);
3964     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3965         hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID);
3966     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3967         hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID);
3968     dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3969         hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID);
3970     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep,
3971         hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization);
3972 
3973     return offset;
3974 }
3975 
3976 static int
dissect_AM_FullInformation_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)3977 dissect_AM_FullInformation_block(tvbuff_t *tvb, int offset,
3978 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
3979 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
3980 {
3981     e_guid_t IM_UniqueIdentifier;
3982     guint16  u16AM_TypeIdentification;
3983     guint16  u16IMHardwareRevision;
3984 
3985     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
3986         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
3987             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
3988         return offset;
3989     }
3990 
3991     /* align padding */
3992     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
3993 
3994     /* IM_UniqueIdentifier */
3995     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
3996         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
3997 
3998     /* AM_Location */
3999     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4000 
4001     /* IM_Annotation */
4002     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII|ENC_NA);
4003     offset += 64;
4004 
4005     /* IM_OrderID */
4006     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII|ENC_NA);
4007     offset += 64;
4008 
4009     /* AM_SoftwareRevision */
4010     proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII|ENC_NA);
4011     offset += 64;
4012 
4013     /* AM_HardwareRevision */
4014     proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII|ENC_NA);
4015     offset += 64;
4016 
4017     /* IM_Serial_Number */
4018     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII|ENC_NA);
4019     offset += 16;
4020 
4021     /* IM_Software_Revision */
4022     offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep);
4023 
4024     /* AM_DeviceIdentification */
4025     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4026 
4027     /* AM_TypeIdentification */
4028     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4029         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4030 
4031     /* IM_Hardware_Revision */
4032     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4033         hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4034 
4035     return offset;
4036 }
4037 
4038 static int
dissect_AM_HardwareOnlyInformation_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4039 dissect_AM_HardwareOnlyInformation_block(tvbuff_t *tvb, int offset,
4040 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4041 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4042 {
4043     e_guid_t IM_UniqueIdentifier;
4044     guint16  u16AM_TypeIdentification;
4045     guint16  u16IMHardwareRevision;
4046 
4047     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4048         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4049             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4050         return offset;
4051     }
4052 
4053     /* align padding */
4054     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4055 
4056     /* IM_UniqueIdentifier */
4057     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4058         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
4059 
4060     /* AM_Location */
4061     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4062 
4063     /* IM_Annotation */
4064     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA);
4065     offset += 64;
4066 
4067     /* IM_OrderID */
4068     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA);
4069     offset += 64;
4070 
4071     /* AM_HardwareRevision */
4072     proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII | ENC_NA);
4073     offset += 64;
4074 
4075     /* IM_Serial_Number */
4076     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA);
4077     offset += 16;
4078 
4079     /* AM_DeviceIdentification */
4080     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4081 
4082     /* AM_TypeIdentification */
4083     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4084         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4085 
4086     /* IM_Hardware_Revision */
4087     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4088         hf_pn_io_im_hardware_revision, &u16IMHardwareRevision);
4089 
4090     return offset;
4091 }
4092 
4093 static int
dissect_AM_FirmwareOnlyInformation_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4094 dissect_AM_FirmwareOnlyInformation_block(tvbuff_t *tvb, int offset,
4095 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4096 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4097 {
4098     e_guid_t IM_UniqueIdentifier;
4099     guint16  u16AM_TypeIdentification;
4100     guint16  u16AM_Reserved;
4101 
4102     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4103         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4104             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4105         return offset;
4106     }
4107 
4108     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4109 
4110     /* IM_UniqueIdentifier */
4111     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4112         hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier);
4113 
4114     /* AM_Location */
4115     offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep);
4116 
4117     /* IM_Annotation */
4118     proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA);
4119     offset += 64;
4120 
4121     /* IM_OrderID */
4122     proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA);
4123     offset += 64;
4124 
4125     /* AM_SoftwareRevision */
4126     proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII | ENC_NA);
4127     offset += 64;
4128 
4129     /* IM_Serial_Number */
4130     proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA);
4131     offset += 16;
4132 
4133     /* IM_Software_Revision */
4134     offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep);
4135 
4136     /* AM_DeviceIdentification */
4137     offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep);
4138 
4139     /* AM_TypeIdentification */
4140     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4141         hf_pn_io_am_type_identification, &u16AM_TypeIdentification);
4142 
4143     /* AM_Reserved */
4144     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4145         hf_pn_io_am_reserved, &u16AM_Reserved);
4146 
4147     return offset;
4148 }
4149 
4150 /* dissect the AssetManagementInfo */
4151 static int
dissect_AssetManagementInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)4152 dissect_AssetManagementInfo(tvbuff_t *tvb, int offset,
4153 packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
4154 {
4155     proto_item *sub_item;
4156     proto_tree *sub_tree;
4157     guint16    u16NumberofEntries;
4158 
4159     sub_item = proto_tree_add_item(tree, hf_pn_io_asset_management_info, tvb, offset, 0, ENC_NA);
4160     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_asset_management_info);
4161 
4162     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4163         hf_pn_io_number_of_asset_management_info, &u16NumberofEntries);
4164 
4165     while (u16NumberofEntries > 0) {
4166         u16NumberofEntries--;
4167         offset = dissect_a_block(tvb, offset, pinfo, sub_tree, drep);
4168     }
4169     return offset;
4170 }
4171 
4172 /* dissect the AssetManagementData block */
4173 static int
dissect_AssetManagementData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4174 dissect_AssetManagementData_block(tvbuff_t *tvb, int offset,
4175 packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
4176 guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4177 {
4178     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4179         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4180             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4181         return offset;
4182     }
4183     offset = dissect_AssetManagementInfo(tvb, offset, pinfo, tree, drep);
4184     return offset;
4185 }
4186 
4187 /* dissect the IdentificationData block */
4188 static int
dissect_IdentificationData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4189 dissect_IdentificationData_block(tvbuff_t *tvb, int offset,
4190     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4191 {
4192     guint16     u16NumberOfAPIs = 1;
4193     guint32     u32Api;
4194     guint16     u16NumberOfSlots;
4195     guint16     u16SlotNr;
4196     guint32     u32ModuleIdentNumber;
4197     guint16     u16NumberOfSubslots;
4198     guint32     u32SubmoduleIdentNumber;
4199     guint16     u16SubslotNr;
4200     proto_item *slot_item;
4201     proto_tree *slot_tree;
4202     guint32     u32SlotStart;
4203     proto_item *subslot_item;
4204     proto_tree *subslot_tree;
4205 
4206 
4207     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
4208         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4209             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4210         return offset;
4211     }
4212 
4213     if (u8BlockVersionLow == 1) {
4214         /* NumberOfAPIs */
4215         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4216                             hf_pn_io_number_of_apis, &u16NumberOfAPIs);
4217     }
4218 
4219     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
4220 
4221     while (u16NumberOfAPIs--) {
4222         if (u8BlockVersionLow == 1) {
4223             /* API */
4224             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4225                             hf_pn_io_api, &u32Api);
4226         }
4227 
4228         /* NumberOfSlots */
4229         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4230                             hf_pn_io_number_of_slots, &u16NumberOfSlots);
4231 
4232         proto_item_append_text(item, ", Slots:%u", u16NumberOfSlots);
4233 
4234         while (u16NumberOfSlots--) {
4235             slot_item = proto_tree_add_item(tree, hf_pn_io_slot, tvb, offset, 0, ENC_NA);
4236             slot_tree = proto_item_add_subtree(slot_item, ett_pn_io_slot);
4237             u32SlotStart = offset;
4238 
4239             /* SlotNumber */
4240             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep,
4241                                 hf_pn_io_slot_nr, &u16SlotNr);
4242             /* ModuleIdentNumber */
4243             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, slot_tree, drep,
4244                                 hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
4245             /* NumberOfSubslots */
4246             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep,
4247                                 hf_pn_io_number_of_subslots, &u16NumberOfSubslots);
4248 
4249             proto_item_append_text(slot_item, ": SlotNr:%u Ident:0x%x Subslots:%u",
4250                 u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubslots);
4251 
4252             while (u16NumberOfSubslots--) {
4253                 subslot_item = proto_tree_add_item(slot_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA);
4254                 subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot);
4255 
4256                 /* SubslotNumber */
4257                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep,
4258                                     hf_pn_io_subslot_nr, &u16SubslotNr);
4259                 /* SubmoduleIdentNumber */
4260                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep,
4261                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
4262 
4263                 proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x",
4264                     u16SubslotNr, u32SubmoduleIdentNumber);
4265             }
4266 
4267             proto_item_set_len(slot_item, offset-u32SlotStart);
4268         }
4269     }
4270 
4271     return offset;
4272 }
4273 
4274 
4275 /* dissect the substitute value block */
4276 static int
dissect_SubstituteValue_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)4277 dissect_SubstituteValue_block(tvbuff_t *tvb, int offset,
4278     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4279     guint16 u16BodyLength)
4280 {
4281     guint16 u16SubstitutionMode;
4282 
4283     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4284         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4285             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4286         return offset;
4287     }
4288 
4289     /* SubstitutionMode */
4290     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4291                     hf_pn_io_substitutionmode, &u16SubstitutionMode);
4292 
4293 
4294     /* SubstituteDataItem */
4295     /* IOCS */
4296     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
4297     u16BodyLength -= 3;
4298     /* SubstituteDataObjectElement */
4299     dissect_pn_user_data_bytes(tvb, offset, pinfo, tree, u16BodyLength, SUBST_DATA);
4300 
4301     return offset;
4302 }
4303 
4304 
4305 /* dissect the RecordInputDataObjectElement block */
4306 static int
dissect_RecordInputDataObjectElement_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4307 dissect_RecordInputDataObjectElement_block(tvbuff_t *tvb, int offset,
4308     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4309 {
4310     guint8  u8LengthIOCS;
4311     guint8  u8LengthIOPS;
4312     guint16 u16LengthData;
4313 
4314 
4315     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4316         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4317             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4318         return offset;
4319     }
4320 
4321     /* LengthIOCS */
4322     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4323                 hf_pn_io_length_iocs, &u8LengthIOCS);
4324     /* IOCS */
4325     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
4326     /* LengthIOPS */
4327     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4328                 hf_pn_io_length_iops, &u8LengthIOPS);
4329     /* IOPS */
4330     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops);
4331     /* LengthData */
4332     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4333                 hf_pn_io_length_data, &u16LengthData);
4334     /* Data */
4335     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data");
4336 
4337     return offset;
4338 }
4339 
4340 
4341 /* dissect the RecordOutputDataObjectElement block */
4342 static int
dissect_RecordOutputDataObjectElement_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4343 dissect_RecordOutputDataObjectElement_block(tvbuff_t *tvb, int offset,
4344     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4345 {
4346     guint16    u16SubstituteActiveFlag;
4347     guint8     u8LengthIOCS;
4348     guint8     u8LengthIOPS;
4349     guint16    u16LengthData;
4350     guint16    u16Index = 0;
4351     guint32    u32RecDataLen;
4352     pnio_ar_t *ar       = NULL;
4353 
4354 
4355     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4356         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4357             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4358         return offset;
4359     }
4360 
4361     /* SubstituteActiveFlag */
4362     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4363                 hf_pn_io_substitute_active_flag, &u16SubstituteActiveFlag);
4364 
4365     /* LengthIOCS */
4366     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4367                 hf_pn_io_length_iocs, &u8LengthIOCS);
4368     /* LengthIOPS */
4369     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
4370                 hf_pn_io_length_iops, &u8LengthIOPS);
4371     /* LengthData */
4372     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4373                 hf_pn_io_length_data, &u16LengthData);
4374     /* DataItem (IOCS, Data, IOPS) */
4375     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs);
4376 
4377     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data");
4378 
4379     offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops);
4380 
4381     /* SubstituteValue */
4382     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
4383 
4384     return offset;
4385 }
4386 
4387 
4388 /* dissect the alarm acknowledge block */
4389 static int
dissect_Alarm_ack_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4390 dissect_Alarm_ack_block(tvbuff_t *tvb, int offset,
4391     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4392 {
4393     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4394         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4395             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4396         return offset;
4397     }
4398 
4399     col_append_str(pinfo->cinfo, COL_INFO, ", Alarm Ack");
4400 
4401     offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep);
4402 
4403     offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep);
4404 
4405     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
4406 
4407     return offset;
4408 }
4409 
4410 
4411 /* dissect the maintenance block */
4412 static int
dissect_Maintenance_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4413 dissect_Maintenance_block(tvbuff_t *tvb, int offset,
4414     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4415 {
4416     proto_item *sub_item;
4417     proto_tree *sub_tree;
4418     guint32     u32MaintenanceStatus;
4419 
4420 
4421     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4422         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4423             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4424         return offset;
4425     }
4426 
4427     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
4428 
4429     sub_item = proto_tree_add_item(tree, hf_pn_io_maintenance_status, tvb, offset, 4, ENC_BIG_ENDIAN);
4430     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_maintenance_status);
4431 
4432     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
4433                     hf_pn_io_maintenance_status_demanded, &u32MaintenanceStatus);
4434     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
4435                     hf_pn_io_maintenance_status_required, &u32MaintenanceStatus);
4436 
4437     if (u32MaintenanceStatus & 0x0002) {
4438         proto_item_append_text(item, ", Demanded");
4439         proto_item_append_text(sub_item, ", Demanded");
4440     }
4441 
4442     if (u32MaintenanceStatus & 0x0001) {
4443         proto_item_append_text(item, ", Required");
4444         proto_item_append_text(sub_item, ", Required");
4445     }
4446 
4447     return offset;
4448 }
4449 
4450 /* dissect the pe_alarm block */
4451 static int
dissect_PE_Alarm_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4452 dissect_PE_Alarm_block(tvbuff_t* tvb, int offset,
4453     packet_info* pinfo, proto_tree* tree, proto_item* item, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4454 {
4455     proto_item *sub_item;
4456     proto_tree *sub_tree;
4457     guint8     u8PEOperationalMode;
4458 
4459 
4460     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4461         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4462             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4463         return offset;
4464     }
4465 
4466     sub_item = proto_tree_add_item(tree, hf_pn_io_pe_operational_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
4467     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pe_operational_mode);
4468 
4469     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
4470         hf_pn_io_pe_operational_mode, &u8PEOperationalMode);
4471 
4472     return offset;
4473 
4474 }
4475 
4476 /* dissect the read/write header */
4477 static int
dissect_ReadWrite_header(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint16 * u16Index,e_guid_t * aruuid)4478 dissect_ReadWrite_header(tvbuff_t *tvb, int offset,
4479     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint16 *u16Index, e_guid_t *aruuid)
4480 {
4481     guint32 u32Api;
4482     guint16 u16SlotNr;
4483     guint16 u16SubslotNr;
4484     guint16 u16SeqNr;
4485 
4486     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4487                         hf_pn_io_seq_number, &u16SeqNr);
4488 
4489     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4490                         hf_pn_io_ar_uuid, aruuid);
4491 
4492     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4493                         hf_pn_io_api, &u32Api);
4494     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4495                         hf_pn_io_slot_nr, &u16SlotNr);
4496     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4497                         hf_pn_io_subslot_nr, &u16SubslotNr);
4498         /* padding doesn't match offset required for align4 */
4499     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4500     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4501                         hf_pn_io_index, u16Index);
4502 
4503     proto_item_append_text(item, ": Seq:%u, Api:0x%x, Slot:0x%x/0x%x",
4504         u16SeqNr, u32Api, u16SlotNr, u16SubslotNr);
4505 
4506     col_append_fstr(pinfo->cinfo, COL_INFO, ", Api:0x%x, Slot:0x%x/0x%x, Index:%s",
4507         u32Api, u16SlotNr, u16SubslotNr,
4508         val_to_str(*u16Index, pn_io_index, "(0x%x)"));
4509 
4510     return offset;
4511 }
4512 
4513 
4514 /* dissect the write request block */
4515 static int
dissect_IODWriteReqHeader_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 * u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)4516 dissect_IODWriteReqHeader_block(tvbuff_t *tvb, int offset,
4517     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4518     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t ** ar)
4519 {
4520     e_guid_t aruuid;
4521     e_guid_t null_uuid;
4522 
4523     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4524         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4525             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4526         return offset;
4527     }
4528 
4529     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
4530 
4531     /* The value NIL indicates the usage of the implicit AR*/
4532     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
4533 
4534     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4535                         hf_pn_io_record_data_length, u32RecDataLen);
4536 
4537     memset(&null_uuid, 0, sizeof(e_guid_t));
4538     if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) {
4539         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4540                         hf_pn_io_target_ar_uuid, &aruuid);
4541     }
4542 
4543     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24);
4544 
4545     proto_item_append_text(item, ", Len:%u", *u32RecDataLen);
4546 
4547     if (*u32RecDataLen != 0)
4548         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
4549             *u32RecDataLen);
4550 
4551     return offset;
4552 }
4553 
4554 
4555 /* dissect the read request block */
4556 static int
dissect_IODReadReqHeader_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 * u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)4557 dissect_IODReadReqHeader_block(tvbuff_t *tvb, int offset,
4558     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4559     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
4560 {
4561     e_guid_t aruuid;
4562     e_guid_t null_uuid;
4563 
4564     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4565         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4566             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4567         return offset;
4568     }
4569 
4570     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
4571 
4572     /* The value NIL indicates the usage of the implicit AR*/
4573     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
4574 
4575     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4576                         hf_pn_io_record_data_length, u32RecDataLen);
4577 
4578     memset(&null_uuid, 0, sizeof(e_guid_t));
4579     if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) {
4580         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4581                         hf_pn_io_target_ar_uuid, &aruuid);
4582         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 8);
4583     } else {
4584         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24);
4585     }
4586 
4587     proto_item_append_text(item, ", Len:%u", *u32RecDataLen);
4588 
4589     if (*u32RecDataLen != 0)
4590         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
4591             *u32RecDataLen);
4592 
4593     return offset;
4594 }
4595 
4596 
4597 /* dissect the write response block */
4598 static int
dissect_IODWriteResHeader_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 * u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)4599 dissect_IODWriteResHeader_block(tvbuff_t *tvb, int offset,
4600     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4601     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
4602 {
4603     e_guid_t aruuid;
4604     guint16  u16AddVal1;
4605     guint16  u16AddVal2;
4606     guint32  u32Status;
4607 
4608 
4609     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4610         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4611             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4612         return offset;
4613     }
4614 
4615     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
4616 
4617     /* The value NIL indicates the usage of the implicit AR*/
4618     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
4619 
4620     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4621                         hf_pn_io_record_data_length, u32RecDataLen);
4622 
4623     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4624                         hf_pn_io_add_val1, &u16AddVal1);
4625 
4626     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4627                         hf_pn_io_add_val2, &u16AddVal2);
4628 
4629     u32Status = ((drep[0] & DREP_LITTLE_ENDIAN)
4630             ? tvb_get_letohl (tvb, offset)
4631             : tvb_get_ntohl (tvb, offset));
4632 
4633     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
4634 
4635     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 16);
4636 
4637     proto_item_append_text(item, ", Len:%u, Index:0x%x, Status:0x%x, Val1:%u, Val2:%u",
4638         *u32RecDataLen, *u16Index, u32Status, u16AddVal1, u16AddVal2);
4639 
4640     if (*u32RecDataLen != 0)
4641         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
4642             *u32RecDataLen);
4643 
4644     return offset;
4645 }
4646 
4647 
4648 /* dissect the read response block */
4649 static int
dissect_IODReadResHeader_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 * u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)4650 dissect_IODReadResHeader_block(tvbuff_t *tvb, int offset,
4651     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4652     guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
4653 {
4654     e_guid_t aruuid;
4655     guint16  u16AddVal1;
4656     guint16  u16AddVal2;
4657 
4658 
4659     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4660         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4661             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4662         return offset;
4663     }
4664 
4665     offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid);
4666 
4667     /* The value NIL indicates the usage of the implicit AR*/
4668     *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid);
4669 
4670     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
4671                         hf_pn_io_record_data_length, u32RecDataLen);
4672 
4673     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4674                         hf_pn_io_add_val1, &u16AddVal1);
4675 
4676     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4677                         hf_pn_io_add_val2, &u16AddVal2);
4678 
4679     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 20);
4680 
4681     proto_item_append_text(item, ", Len:%u, AddVal1:%u, AddVal2:%u",
4682         *u32RecDataLen, u16AddVal1, u16AddVal2);
4683 
4684     if (*u32RecDataLen != 0)
4685         col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes",
4686             *u32RecDataLen);
4687 
4688     return offset;
4689 }
4690 
4691 
4692 /* dissect the control/connect block */
4693 static int
dissect_ControlConnect_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t ** ar,guint16 blocktype)4694 dissect_ControlConnect_block(tvbuff_t *tvb, int offset,
4695     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4696     pnio_ar_t **ar, guint16 blocktype)
4697 {
4698     e_guid_t    ar_uuid;
4699     guint16     u16SessionKey;
4700     proto_item *sub_item;
4701     proto_tree *sub_tree;
4702     guint16     u16Command;
4703     guint16     u16Properties;
4704 
4705     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4706         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4707             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4708         return offset;
4709     }
4710 
4711     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4712                         hf_pn_io_reserved16, NULL);
4713 
4714     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
4715                         hf_pn_io_ar_uuid, &ar_uuid);
4716 
4717     /* The value NIL indicates the usage of the implicit AR*/
4718     *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid);
4719 
4720     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4721                         hf_pn_io_sessionkey, &u16SessionKey);
4722 
4723     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4724                         hf_pn_io_reserved16, NULL);
4725 
4726     sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN);
4727     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command);
4728 
4729     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4730                         hf_pn_io_control_command_prmend, &u16Command);
4731     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4732                         hf_pn_io_control_command_applready, &u16Command);
4733     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4734                         hf_pn_io_control_command_release, &u16Command);
4735     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4736                         hf_pn_io_control_command_done, &u16Command);
4737     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4738                         hf_pn_io_control_command_ready_for_companion, &u16Command);
4739     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4740                         hf_pn_io_control_command_ready_for_rt_class3, &u16Command);
4741     /* Prm.Begin */
4742     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4743                         hf_pn_io_control_command_prmbegin, &u16Command);
4744 
4745     if (u16Command & 0x0002) {
4746         /* ApplicationReady: special decode */
4747         sub_item = proto_tree_add_item(tree, hf_pn_io_control_block_properties_applready, tvb, offset, 2, ENC_BIG_ENDIAN);
4748         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_block_properties);
4749         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_bit0, &u16Properties);
4750         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_bit1, &u16Properties);
4751         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_otherbits, &u16Properties);
4752     } else {
4753         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4754                             hf_pn_io_control_block_properties, &u16Properties);
4755     }
4756 
4757     proto_item_append_text(item, ": Session:%u, Command:", u16SessionKey);
4758 
4759     if (u16Command & 0x0001) {
4760         proto_item_append_text(sub_item, ", ParameterEnd");
4761         proto_item_append_text(item, " ParameterEnd");
4762         col_append_str(pinfo->cinfo, COL_INFO, ", Command: ParameterEnd");
4763     }
4764     if (u16Command & 0x0002) {
4765         proto_item_append_text(sub_item, ", ApplicationReady");
4766         proto_item_append_text(item, " ApplicationReady");
4767         col_append_str(pinfo->cinfo, COL_INFO, ", Command: ApplicationReady");
4768     }
4769     if (u16Command & 0x0004) {
4770         proto_item_append_text(sub_item, ", Release");
4771         proto_item_append_text(item, " Release");
4772         col_append_str(pinfo->cinfo, COL_INFO, ", Command: Release");
4773     }
4774     if (u16Command & 0x0008) {
4775         proto_item_append_text(sub_item, ", Done");
4776         proto_item_append_text(item, ", Done");
4777         col_append_str(pinfo->cinfo, COL_INFO, ", Command: Done");
4778 
4779         /* When Release Command Done, keep the release frame of corresponding ar & ar uuid */
4780         if (!PINFO_FD_VISITED(pinfo) && blocktype == 0x8114) {
4781 
4782             wmem_list_frame_t* aruuid_frame;
4783             ARUUIDFrame* current_aruuid_frame = NULL;
4784 
4785             if (aruuid_frame_setup_list != NULL) {
4786                 for (aruuid_frame = wmem_list_head(aruuid_frame_setup_list); aruuid_frame != NULL; aruuid_frame = wmem_list_frame_next(aruuid_frame)) {
4787                     current_aruuid_frame = (ARUUIDFrame*)wmem_list_frame_data(aruuid_frame);
4788                     if (current_aruuid_frame->aruuid.data1 == ar_uuid.data1) {
4789                         current_aruuid_frame->releaseframe = pinfo->num;
4790                     }
4791                 }
4792             }
4793         }
4794     }
4795 
4796     proto_item_append_text(item, ", Properties:0x%x", u16Properties);
4797 
4798     return offset;
4799 }
4800 
4801 /* dissect the ControlBlockPrmBegin block */
4802 static int
dissect_ControlBlockPrmBegin(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint32 u32RecDataLen,pnio_ar_t ** ar)4803 dissect_ControlBlockPrmBegin(tvbuff_t *tvb, int offset,
4804     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen,
4805     pnio_ar_t **ar)
4806 {
4807     e_guid_t    ar_uuid;
4808     guint16     u16SessionKey;
4809     guint16     u16Command;
4810     proto_item *sub_item;
4811     proto_tree *sub_tree;
4812 
4813     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4814         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4815             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4816         return offset;
4817     }
4818     if (u32RecDataLen != 28-2) /* must be 28 see specification (version already dissected) */
4819     {
4820         expert_add_info_format(pinfo, item, &ei_pn_io_block_length, "Block length of %u is invalid!", u32RecDataLen);
4821         return offset;
4822     }
4823     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4824 
4825     /* ARUUID */
4826     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &ar_uuid);
4827 
4828     if (!PINFO_FD_VISITED(pinfo)) {
4829         pn_init_append_aruuid_frame_setup_list(ar_uuid, pinfo->num);
4830     }
4831 
4832     /* The value NIL indicates the usage of the implicit AR*/
4833     *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid);
4834 
4835     /* SessionKey */
4836     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey);
4837 
4838     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
4839 
4840     /* ControlCommand */
4841     sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN);
4842     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command);
4843 
4844     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4845                         hf_pn_io_control_command_prmend, &u16Command);
4846     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4847                         hf_pn_io_control_command_applready, &u16Command);
4848     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4849                         hf_pn_io_control_command_release, &u16Command);
4850     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4851                         hf_pn_io_control_command_done, &u16Command);
4852     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4853                         hf_pn_io_control_command_ready_for_companion, &u16Command);
4854     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4855                         hf_pn_io_control_command_ready_for_rt_class3, &u16Command);
4856     /* Prm.Begin */
4857     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4858                         hf_pn_io_control_command_prmbegin, &u16Command);
4859 
4860     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
4861                         hf_pn_io_control_command_reserved_7_15, &u16Command);
4862 
4863     /* ControlBlockProperties.reserved */
4864     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_control_command_reserved, NULL);
4865     return offset;
4866 }
4867 
4868 /* dissect the SubmoduleListBlock  block */
4869 static int
dissect_SubmoduleListBlock(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint32 u32RecDataLen _U_,pnio_ar_t ** ar _U_)4870 dissect_SubmoduleListBlock(tvbuff_t *tvb, int offset,
4871     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen _U_,
4872     pnio_ar_t **ar _U_)
4873 {
4874     guint16 u16Entries;
4875     guint32 u32API;
4876     guint16 u16SlotNumber;
4877     guint16 u16SubSlotNumber;
4878 
4879     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4880         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4881             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4882         return offset;
4883     }
4884 
4885     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_SubmoduleListEntries, &u16Entries);
4886 
4887     while (u16Entries --)
4888     {
4889         /*API */
4890         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32API);
4891         /*SlotNumber */
4892         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNumber);
4893         /* SubSlotNumber */
4894         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubSlotNumber);
4895     }
4896     return offset;
4897 }
4898 
4899 
4900 /* dissect the PDevData block */
4901 static int
dissect_PDevData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4902 dissect_PDevData_block(tvbuff_t *tvb, int offset,
4903     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4904 {
4905 
4906     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4907         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4908             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4909         return offset;
4910     }
4911 
4912     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
4913 
4914     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
4915 
4916     return offset;
4917 }
4918 
4919 /* dissect the AdjustPreambleLength block */
4920 static int
dissect_AdjustPreambleLength_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4921 dissect_AdjustPreambleLength_block(tvbuff_t *tvb, int offset,
4922     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4923 {
4924     guint16 u16AdjustProperties;
4925     guint16 u16PreambleLength;
4926 
4927     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4928         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4929             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4930         return offset;
4931     }
4932 
4933     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
4934 
4935     /* PreambleLength */
4936     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4937         hf_pn_io_PreambleLength, &u16PreambleLength);
4938 
4939 
4940     /* AdjustProperties */
4941     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4942         hf_pn_io_adjust_properties, &u16AdjustProperties);
4943 
4944     return offset;
4945 }
4946 
4947 /* dissect the dissect_CheckMAUTypeExtension_block block */
4948 static int
dissect_CheckMAUTypeExtension_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)4949 dissect_CheckMAUTypeExtension_block(tvbuff_t *tvb, int offset,
4950     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
4951 {
4952     guint16 u16MauTypeExtension;
4953 
4954     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4955         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4956             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4957         return offset;
4958     }
4959 
4960     /* MauTypeExtension */
4961     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension);
4962 
4963     return offset;
4964 }
4965 
4966 /* dissect the PDPortDataAdjust block */
4967 static int
dissect_PDPortData_Adjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)4968 dissect_PDPortData_Adjust_block(tvbuff_t *tvb, int offset,
4969     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
4970     guint16 u16BodyLength)
4971 {
4972     guint16   u16SlotNr;
4973     guint16   u16SubslotNr;
4974     tvbuff_t *new_tvb;
4975 
4976 
4977     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
4978         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
4979             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
4980         return offset;
4981     }
4982 
4983     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
4984 
4985     /* SlotNumber */
4986     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4987                         hf_pn_io_slot_nr, &u16SlotNr);
4988     /* Subslotnumber */
4989     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
4990                         hf_pn_io_subslot_nr, &u16SubslotNr);
4991 
4992     proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr);
4993 
4994     u16BodyLength -= 6;
4995 
4996     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
4997     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
4998     offset += u16BodyLength;
4999 
5000     /* XXX - do we have to free the new_tvb somehow? */
5001 
5002     return offset;
5003 }
5004 
5005 
5006 /* dissect the PDPortDataCheck blocks */
5007 static int
dissect_PDPortData_Check_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)5008 dissect_PDPortData_Check_block(tvbuff_t *tvb, int offset,
5009     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5010     guint16 u16BodyLength)
5011 {
5012     guint16   u16SlotNr;
5013     guint16   u16SubslotNr;
5014     tvbuff_t *new_tvb;
5015 
5016 
5017     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5018         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5019             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5020         return offset;
5021     }
5022 
5023     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5024 
5025     /* SlotNumber */
5026     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5027                         hf_pn_io_slot_nr, &u16SlotNr);
5028     /* Subslotnumber */
5029     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5030                         hf_pn_io_subslot_nr, &u16SubslotNr);
5031 
5032     proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr);
5033 
5034     u16BodyLength -= 6;
5035 
5036     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
5037     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
5038     offset += u16BodyLength;
5039 
5040     /* XXX - do we have to free the new_tvb somehow? */
5041 
5042     return offset;
5043 }
5044 
5045 /* dissect the Line Delay */
5046 static int
dissect_Line_Delay(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint32 * u32LineDelayValue)5047 dissect_Line_Delay(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep,
5048     guint32  *u32LineDelayValue)
5049 {
5050     proto_item *sub_item;
5051     proto_tree *sub_tree;
5052     guint32  u32FormatIndicator;
5053     guint8   isFormatIndicatorEnabled;
5054 
5055     sub_item = proto_tree_add_item(tree, hf_pn_io_line_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
5056     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_line_delay);
5057 
5058     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5059         hf_pn_io_line_delay_format_indicator, &u32FormatIndicator);
5060 
5061     isFormatIndicatorEnabled = (guint8)((u32FormatIndicator >> 31) & 0x01);
5062     if (isFormatIndicatorEnabled)
5063     {
5064         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5065             hf_pn_io_cable_delay_value, u32LineDelayValue);
5066     }
5067     else
5068     {
5069         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5070             hf_pn_io_line_delay_value, u32LineDelayValue);
5071     }
5072 
5073     return offset;
5074 }
5075 
5076 /* dissect the PDPortDataReal blocks */
5077 static int
dissect_PDPortDataReal_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5078 dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset,
5079     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5080 {
5081     guint16  u16SlotNr;
5082     guint16  u16SubslotNr;
5083     guint8   u8LengthOwnPortID;
5084     char    *pOwnPortID;
5085     guint8   u8NumberOfPeers;
5086     guint8   u8I;
5087     guint8   u8LengthPeerPortID;
5088     guint8   u8LengthPeerChassisID;
5089     guint8   mac[6];
5090     guint16  u16MAUType;
5091     guint32  u32DomainBoundary;
5092     guint32  u32MulticastBoundary;
5093     guint8   u8LinkStatePort;
5094     guint8   u8LinkStateLink;
5095     guint32  u32MediaType;
5096     guint32  u32LineDelayValue;
5097 
5098     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5099         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5100             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5101         return offset;
5102     }
5103 
5104     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5105 
5106     /* SlotNumber */
5107     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5108                         hf_pn_io_slot_nr, &u16SlotNr);
5109     /* Subslotnumber */
5110     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5111                         hf_pn_io_subslot_nr, &u16SubslotNr);
5112 
5113     /* LengthOwnPortID */
5114     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5115                         hf_pn_io_length_own_port_id, &u8LengthOwnPortID);
5116     /* OwnPortID */
5117     proto_tree_add_item_ret_display_string (tree, hf_pn_io_own_port_id, tvb, offset, u8LengthOwnPortID, ENC_ASCII|ENC_NA, pinfo->pool, &pOwnPortID);
5118     offset += u8LengthOwnPortID;
5119 
5120     /* NumberOfPeers */
5121     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5122                         hf_pn_io_number_of_peers, &u8NumberOfPeers);
5123     /* Padding */
5124     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5125 
5126     u8I = u8NumberOfPeers;
5127     while (u8I--) {
5128         /* LengthPeerPortID */
5129         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5130                             hf_pn_io_length_peer_port_id, &u8LengthPeerPortID);
5131         /* PeerPortID */
5132         proto_tree_add_item (tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, ENC_ASCII|ENC_NA);
5133         offset += u8LengthPeerPortID;
5134 
5135         /* LengthPeerChassisID */
5136         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5137                             hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID);
5138         /* PeerChassisID */
5139         proto_tree_add_item (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, ENC_ASCII|ENC_NA);
5140         offset += u8LengthPeerChassisID;
5141 
5142         /* Padding */
5143         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5144 
5145         /* LineDelay */
5146         offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelayValue);
5147 
5148         /* PeerMACAddress */
5149         offset = dissect_pn_mac(tvb, offset, pinfo, tree,
5150                             hf_pn_io_peer_macadd, mac);
5151         /* Padding */
5152         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5153     }
5154 
5155     /* MAUType */
5156     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5157                         hf_pn_io_mau_type, &u16MAUType);
5158     /* Padding */
5159     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5160 
5161     /* DomainBoundary */
5162     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5163                         hf_pn_io_domain_boundary, &u32DomainBoundary);
5164     /* MulticastBoundary */
5165     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5166                         hf_pn_io_multicast_boundary, &u32MulticastBoundary);
5167     /* LinkState.Port */
5168     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5169                         hf_pn_io_link_state_port, &u8LinkStatePort);
5170     /* LinkState.Link */
5171     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5172                         hf_pn_io_link_state_link, &u8LinkStateLink);
5173     /* Padding */
5174     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5175 
5176     /* MediaType */
5177     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5178                         hf_pn_io_media_type, &u32MediaType);
5179 
5180     proto_item_append_text(item, ": Slot:0x%x/0x%x, OwnPortID:%s, Peers:%u LinkState.Port:%s LinkState.Link:%s MediaType:%s",
5181         u16SlotNr, u16SubslotNr, pOwnPortID, u8NumberOfPeers,
5182         val_to_str(u8LinkStatePort, pn_io_link_state_port, "0x%x"),
5183         val_to_str(u8LinkStateLink, pn_io_link_state_link, "0x%x"),
5184         val_to_str(u32MediaType, pn_io_media_type, "0x%x"));
5185 
5186     return offset;
5187 }
5188 
5189 
5190 static int
dissect_PDInterfaceMrpDataAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)5191 dissect_PDInterfaceMrpDataAdjust_block(tvbuff_t *tvb, int offset,
5192     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
5193 {
5194     e_guid_t  uuid;
5195     guint16   u16Role;
5196     guint8    u8LengthDomainName;
5197     guint8    u8NumberOfMrpInstances;
5198     int       endoffset = offset + u16BodyLength;
5199 
5200 
5201     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { /* added low version == 1 */
5202         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5203             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5204         return offset;
5205     }
5206 
5207     if (u8BlockVersionLow == 0) /*dissect LowVersion == 0 */
5208     {
5209         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5210 
5211         /* MRP_DomainUUID */
5212         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5213                             hf_pn_io_mrp_domain_uuid, &uuid);
5214         /* MRP_Role */
5215         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5216                         hf_pn_io_mrp_role, &u16Role);
5217         /* Padding */
5218         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5219 
5220         /* MRP_LengthDomainName */
5221         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5222                         hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
5223         /* MRP_DomainName */
5224         /* XXX - IEC 61158-6-10 Edition 4.0 says, in section 5.2.17.2.4 "Coding
5225            of the field MRP_DomainName", that "This field shall be coded as
5226            data type OctetString with 1 to 240 octets according to Table 702
5227            and 4.3.1.4.15.2."
5228 
5229            It then says, in subsection 4.3.1.4.15.2 "Encoding" of section
5230            4.3.1.4.15 "Coding of the field NameOfStationValue", that "This
5231            field shall be coded as data type OctetString with 1 to 240
5232            octets. The definition of IETF RFC 5890 and the following syntax
5233            applies: ..."
5234 
5235            RFC 5890 means Punycode; should we translate the domain name to
5236            UTF-8 and show both the untranslated and translated domain name?
5237 
5238            They don't mention anything about the RFC 1035 encoding of
5239            domain names as mentioned in section 3.1 "Name space definitions",
5240            with the labels being counted strings; does that mean that this
5241            is just an ASCII string to be interpreted as a Punycode Unicode
5242            domain name? */
5243         proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII|ENC_NA);
5244         offset += u8LengthDomainName;
5245 
5246         /* Padding */
5247         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5248         while (endoffset > offset)
5249         {
5250             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5251         }
5252     }
5253     else if (u8BlockVersionLow == 1) /*dissect LowVersion == 1 */
5254     {
5255         /* Padding one byte */
5256         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5257         /* Number of Mrp Instances */
5258         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5259             hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
5260         if (u8NumberOfMrpInstances > 0xf) {
5261              expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
5262             return offset;
5263         }
5264         while(u8NumberOfMrpInstances > 0)
5265         {
5266             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5267             u8NumberOfMrpInstances--;
5268         }
5269     }
5270     return offset;
5271 }
5272 
5273 
5274 static int
dissect_PDInterfaceMrpDataReal_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)5275 dissect_PDInterfaceMrpDataReal_block(tvbuff_t *tvb, int offset,
5276     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
5277 {
5278     e_guid_t  uuid;
5279     guint16   u16Role;
5280     guint16   u16Version;
5281     guint8    u8LengthDomainName;
5282     guint8    u8NumberOfMrpInstances;
5283     int       endoffset = offset + u16BodyLength;
5284 
5285     /* added blockversion 1 */
5286     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 2) {
5287         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5288             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5289         return offset;
5290     }
5291 
5292     if (u8BlockVersionLow < 2) /* dissect low versions 0 and 1 */
5293     {
5294         /* Padding */
5295         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5296 
5297         /* MRP_DomainUUID */
5298         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5299                 hf_pn_io_mrp_domain_uuid, &uuid);
5300         /* MRP_Role */
5301         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5302                 hf_pn_io_mrp_role, &u16Role);
5303 
5304         if (u8BlockVersionLow == 1) {
5305             /* MRP_Version */
5306             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5307                     hf_pn_io_mrp_version, &u16Version);
5308         }
5309         /* MRP_LengthDomainName */
5310         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5311                 hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
5312         /* MRP_DomainName */
5313         /* XXX - see comment earlier about MRP_DomainName */
5314         proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII|ENC_NA);
5315         offset += u8LengthDomainName;
5316 
5317         if (u8BlockVersionLow == 0) {
5318             /* MRP_Version */
5319             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5320                     hf_pn_io_mrp_version, &u16Version);
5321         }
5322         /* Padding */
5323         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5324 
5325         while(endoffset > offset)
5326         {
5327             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5328         }
5329     }
5330     else if (u8BlockVersionLow == 2)
5331     {
5332         /* Padding one byte */
5333         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5334         /* Number of Mrp Instances */
5335         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5336                 hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
5337         if (u8NumberOfMrpInstances > 0xf) {
5338             expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
5339             return offset;
5340         }
5341         while(u8NumberOfMrpInstances > 0)
5342         {
5343             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5344             u8NumberOfMrpInstances--;
5345         }
5346     }
5347     return offset;
5348 }
5349 
5350 
5351 static int
dissect_PDInterfaceMrpDataCheck_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5352 dissect_PDInterfaceMrpDataCheck_block(tvbuff_t *tvb, int offset,
5353     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5354 {
5355     e_guid_t uuid;
5356     guint32 u32Check;
5357     guint8 u8NumberOfMrpInstances;
5358 
5359     /* BlockVersionLow == 1 added */
5360     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
5361         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5362             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5363         return offset;
5364     }
5365     if (u8BlockVersionLow == 0)
5366     {
5367     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5368 
5369     /* MRP_DomainUUID */
5370     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5371                         hf_pn_io_mrp_domain_uuid, &uuid);
5372 
5373     /* MRP_Check */
5374         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5375             hf_pn_io_mrp_check, &u32Check);
5376         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5377             hf_pn_io_mrp_check_mrm, &u32Check);
5378         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5379             hf_pn_io_mrp_check_mrpdomain, &u32Check);
5380         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5381             hf_pn_io_mrp_check_reserved_1, &u32Check);
5382         dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5383             hf_pn_io_mrp_check_reserved_2, &u32Check);
5384         offset +=4; /* MRP_Check (32 bit) done */
5385     }
5386     else if (u8BlockVersionLow == 1)
5387     {
5388         /* Padding one byte */
5389         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5390         /* Number of Mrp Instances */
5391         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5392             hf_pn_io_mrp_instances, &u8NumberOfMrpInstances);
5393         if (u8NumberOfMrpInstances > 0xf) {
5394             expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances);
5395             return offset;
5396         }
5397         while(u8NumberOfMrpInstances > 0)
5398         {
5399             offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
5400             u8NumberOfMrpInstances--;
5401         }
5402     }
5403 
5404     return offset;
5405 }
5406 
5407 
5408 static int
dissect_PDPortMrpData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5409 dissect_PDPortMrpData_block(tvbuff_t *tvb, int offset,
5410     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5411 {
5412     e_guid_t uuid;
5413     guint8  u8MrpInstance;
5414 
5415     /* added BlockVersionLow == 1 */
5416     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
5417         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5418             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5419         return offset;
5420     }
5421     if (u8BlockVersionLow == 0) {
5422     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5423     }
5424     else /*if (u8BlockVersionLow == 1) */
5425     {
5426         /* Padding one byte */
5427         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
5428         /* Mrp Instance */
5429         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5430             hf_pn_io_mrp_instance, &u8MrpInstance);
5431     }
5432     /* MRP_DomainUUID */
5433     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
5434                         hf_pn_io_mrp_domain_uuid, &uuid);
5435     return offset;
5436 }
5437 
5438 
5439 static int
dissect_MrpManagerParams_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5440 dissect_MrpManagerParams_block(tvbuff_t *tvb, int offset,
5441     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5442 {
5443     guint16 u16Prio;
5444     guint16 u16TOPchgT;
5445     guint16 u16TOPNRmax;
5446     guint16 u16TSTshortT;
5447     guint16 u16TSTdefaultT;
5448     guint16 u16TSTNRmax;
5449 
5450 
5451     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5452         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5453             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5454         return offset;
5455     }
5456 
5457     /* MRP_Prio */
5458     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5459                     hf_pn_io_mrp_prio, &u16Prio);
5460     /* MRP_TOPchgT */
5461     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5462                     hf_pn_io_mrp_topchgt, &u16TOPchgT);
5463     /* MRP_TOPNRmax */
5464     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5465                     hf_pn_io_mrp_topnrmax, &u16TOPNRmax);
5466     /* MRP_TSTshortT */
5467     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5468                     hf_pn_io_mrp_tstshortt, &u16TSTshortT);
5469     /* MRP_TSTdefaultT */
5470     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5471                     hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT);
5472     /* MSP_TSTNRmax */
5473     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5474                     hf_pn_io_mrp_tstnrmax, &u16TSTNRmax);
5475     /* Padding */
5476     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5477 
5478     return offset;
5479 }
5480 
5481 
5482 static int
dissect_MrpRTMode(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep)5483 dissect_MrpRTMode(tvbuff_t *tvb, int offset,
5484     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep)
5485 {
5486     proto_item *sub_item;
5487     proto_tree *sub_tree;
5488     guint32     u32RTMode;
5489 
5490 
5491     /* MRP_RTMode */
5492     sub_item = proto_tree_add_item(tree, hf_pn_io_mrp_rtmode, tvb, offset, 4, ENC_BIG_ENDIAN);
5493     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_mrp_rtmode);
5494 
5495     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5496                     hf_pn_io_mrp_rtmode_reserved2, &u32RTMode);
5497     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5498                     hf_pn_io_mrp_rtmode_reserved1, &u32RTMode);
5499     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5500                     hf_pn_io_mrp_rtmode_rtclass3, &u32RTMode);
5501     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
5502                     hf_pn_io_mrp_rtmode_rtclass12, &u32RTMode);
5503 
5504     return offset;
5505 }
5506 
5507 
5508 static int
dissect_MrpRTModeManagerData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5509 dissect_MrpRTModeManagerData_block(tvbuff_t *tvb, int offset,
5510     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5511 {
5512     guint16 u16TSTNRmax;
5513     guint16 u16TSTdefaultT;
5514 
5515 
5516     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5517         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5518             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5519         return offset;
5520     }
5521 
5522     /* MSP_TSTNRmax */
5523     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5524                     hf_pn_io_mrp_tstnrmax, &u16TSTNRmax);
5525     /* MRP_TSTdefaultT */
5526     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5527                     hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT);
5528     /* Padding */
5529     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5530 
5531     /* MRP_RTMode */
5532     offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep);
5533 
5534     return offset;
5535 }
5536 
5537 
5538 static int
dissect_MrpRingStateData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5539 dissect_MrpRingStateData_block(tvbuff_t *tvb, int offset,
5540     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5541 {
5542     guint16 u16RingState;
5543 
5544 
5545     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5546         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5547             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5548         return offset;
5549     }
5550 
5551     /* MRP_RingState */
5552     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5553                     hf_pn_io_mrp_ring_state, &u16RingState);
5554 
5555     return offset;
5556 }
5557 
5558 
5559 static int
dissect_MrpRTStateData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5560 dissect_MrpRTStateData_block(tvbuff_t *tvb, int offset,
5561     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5562 {
5563     guint16 u16RTState;
5564 
5565 
5566     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5567         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5568             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5569         return offset;
5570     }
5571 
5572     /* MRP_RTState */
5573     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5574                     hf_pn_io_mrp_rt_state, &u16RTState);
5575 
5576     return offset;
5577 }
5578 
5579 
5580 static int
dissect_MrpClientParams_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5581 dissect_MrpClientParams_block(tvbuff_t *tvb, int offset,
5582     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5583 {
5584     guint16 u16MRP_LNKdownT;
5585     guint16 u16MRP_LNKupT;
5586     guint16 u16MRP_LNKNRmax;
5587 
5588 
5589     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5590         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5591             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5592         return offset;
5593     }
5594 
5595     /* MRP_LNKdownT */
5596     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5597                     hf_pn_io_mrp_lnkdownt, &u16MRP_LNKdownT);
5598     /* MRP_LNKupT */
5599     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5600                     hf_pn_io_mrp_lnkupt, &u16MRP_LNKupT);
5601     /* MRP_LNKNRmax u16 */
5602     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5603                     hf_pn_io_mrp_lnknrmax, &u16MRP_LNKNRmax);
5604 
5605     return offset;
5606 }
5607 
5608 
5609 static int
dissect_MrpRTModeClientData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5610 dissect_MrpRTModeClientData_block(tvbuff_t *tvb, int offset,
5611     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5612 {
5613     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5614 
5615     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5616         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5617             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5618         return offset;
5619     }
5620 
5621     /* MRP_RTMode */
5622     offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep);
5623 
5624     return offset;
5625 }
5626 
5627 
5628 static int
dissect_CheckSyncDifference_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5629 dissect_CheckSyncDifference_block(tvbuff_t *tvb, int offset,
5630     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5631 {
5632     proto_item *sub_item;
5633     proto_tree *sub_tree;
5634     guint16     u16CheckSyncMode;
5635 
5636 
5637     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5638         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5639             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5640         return offset;
5641     }
5642 
5643     sub_item = proto_tree_add_item(tree, hf_pn_io_check_sync_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
5644     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_check_sync_mode);
5645 
5646     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5647                     hf_pn_io_check_sync_mode_reserved, &u16CheckSyncMode);
5648     dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5649                     hf_pn_io_check_sync_mode_sync_master, &u16CheckSyncMode);
5650     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
5651                     hf_pn_io_check_sync_mode_cable_delay, &u16CheckSyncMode);
5652 
5653 
5654     proto_item_append_text(sub_item, "CheckSyncMode: SyncMaster:%d, CableDelay:%d",
5655         (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1);
5656 
5657     proto_item_append_text(item, " : SyncMaster:%d, CableDelay:%d",
5658         (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1);
5659 
5660     return offset;
5661 }
5662 
5663 
5664 static int
dissect_CheckMAUTypeDifference_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5665 dissect_CheckMAUTypeDifference_block(tvbuff_t *tvb, int offset,
5666     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5667 {
5668     guint16 u16MAUTypeMode;
5669 
5670     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5671         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5672             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5673         return offset;
5674     }
5675 
5676     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5677                     hf_pn_io_mau_type_mode, &u16MAUTypeMode);
5678 
5679     proto_item_append_text(item, ": MAUTypeMode:%s",
5680         val_to_str(u16MAUTypeMode, pn_io_mau_type_mode, "0x%x"));
5681 
5682     return offset;
5683 }
5684 
5685 
5686 /* dissect the AdjustDomainBoundary blocks */
5687 static int
dissect_AdjustDomainBoundary_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5688 dissect_AdjustDomainBoundary_block(tvbuff_t *tvb, int offset,
5689     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5690 {
5691     guint32 u32DomainBoundary;
5692     guint32 u32DomainBoundaryIngress;
5693     guint32 u32DomainBoundaryEgress;
5694     guint16 u16AdjustProperties;
5695 
5696 
5697     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
5698         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5699             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5700         return offset;
5701     }
5702 
5703     /* Padding */
5704     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5705 
5706     switch (u8BlockVersionLow) {
5707         case(0):
5708         /* DomainBoundary */
5709         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5710                             hf_pn_io_domain_boundary, &u32DomainBoundary);
5711         /* AdjustProperties */
5712         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5713                             hf_pn_io_adjust_properties, &u16AdjustProperties);
5714         /* Padding */
5715         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5716 
5717         proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x",
5718             u32DomainBoundary, u16AdjustProperties);
5719 
5720         break;
5721         case(1):
5722         /* DomainBoundaryIngress */
5723         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5724                             hf_pn_io_domain_boundary_ingress, &u32DomainBoundaryIngress);
5725         /* DomainBoundaryEgress */
5726         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5727                             hf_pn_io_domain_boundary_egress, &u32DomainBoundaryEgress);
5728         /* AdjustProperties */
5729         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5730                             hf_pn_io_adjust_properties, &u16AdjustProperties);
5731         /* Padding */
5732         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5733 
5734         proto_item_append_text(item, ": BoundaryIngress:0x%x, BoundaryEgress:0x%x, Properties:0x%x",
5735             u32DomainBoundaryIngress, u32DomainBoundaryEgress, u16AdjustProperties);
5736 
5737         break;
5738         default:
5739         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5740             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5741         return offset;
5742     }
5743 
5744     return offset;
5745 }
5746 
5747 
5748 /* dissect the AdjustMulticastBoundary blocks */
5749 static int
dissect_AdjustMulticastBoundary_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5750 dissect_AdjustMulticastBoundary_block(tvbuff_t *tvb, int offset,
5751     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5752 {
5753     guint32 u32MulticastBoundary;
5754     guint16 u16AdjustProperties;
5755 
5756 
5757     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5758         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5759             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5760         return offset;
5761     }
5762 
5763     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5764 
5765     /* Boundary */
5766     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5767                         hf_pn_io_multicast_boundary, &u32MulticastBoundary);
5768     /* AdjustProperties */
5769     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5770                         hf_pn_io_adjust_properties, &u16AdjustProperties);
5771 
5772     proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x",
5773         u32MulticastBoundary, u16AdjustProperties);
5774 
5775     return offset;
5776 }
5777 
5778 
5779 /* dissect the AdjustMAUType block */
5780 static int
dissect_AdjustMAUType_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5781 dissect_AdjustMAUType_block(tvbuff_t *tvb, int offset,
5782     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5783 {
5784     guint16 u16MAUType;
5785     guint16 u16AdjustProperties;
5786 
5787 
5788     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5789         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5790             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5791         return offset;
5792     }
5793 
5794     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5795 
5796     /* MAUType */
5797     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5798                         hf_pn_io_mau_type, &u16MAUType);
5799     /* AdjustProperties */
5800     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5801                         hf_pn_io_adjust_properties, &u16AdjustProperties);
5802 
5803     proto_item_append_text(item, ": MAUType:%s, Properties:0x%x",
5804         val_to_str(u16MAUType, pn_io_mau_type, "0x%x"),
5805         u16AdjustProperties);
5806 
5807     return offset;
5808 }
5809 
5810 
5811 /* dissect the CheckMAUType block */
5812 static int
dissect_CheckMAUType_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5813 dissect_CheckMAUType_block(tvbuff_t *tvb, int offset,
5814     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5815 {
5816     guint16 u16MAUType;
5817 
5818 
5819     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5820         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5821             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5822         return offset;
5823     }
5824 
5825     /* MAUType */
5826     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5827                         hf_pn_io_mau_type, &u16MAUType);
5828 
5829     proto_item_append_text(item, ": MAUType:%s",
5830         val_to_str(u16MAUType, pn_io_mau_type, "0x%x"));
5831 
5832     return offset;
5833 }
5834 
5835 
5836 /* dissect the CheckLineDelay block */
5837 static int
dissect_CheckLineDelay_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5838 dissect_CheckLineDelay_block(tvbuff_t *tvb, int offset,
5839     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5840 {
5841     guint32 u32LineDelay;
5842 
5843 
5844     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5845         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5846             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5847         return offset;
5848     }
5849 
5850     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5851 
5852     /* LineDelay */
5853     offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelay);
5854 
5855     proto_item_append_text(item, ": LineDelay:%uns", u32LineDelay);
5856 
5857     return offset;
5858 }
5859 
5860 
5861 /* dissect the CheckPeers block */
5862 static int
dissect_CheckPeers_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5863 dissect_CheckPeers_block(tvbuff_t *tvb, int offset,
5864     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5865 {
5866     guint8  u8NumberOfPeers;
5867     guint8  u8I;
5868     guint8  u8LengthPeerPortID;
5869     guint8  u8LengthPeerChassisID;
5870 
5871 
5872     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5873         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5874             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5875         return offset;
5876     }
5877 
5878     /* NumberOfPeers */
5879     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5880                         hf_pn_io_number_of_peers, &u8NumberOfPeers);
5881 
5882     u8I = u8NumberOfPeers;
5883     while (u8I--) {
5884         /* LengthPeerPortID */
5885         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5886                             hf_pn_io_length_peer_port_id, &u8LengthPeerPortID);
5887         /* PeerPortID */
5888         proto_tree_add_item (tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, ENC_ASCII|ENC_NA);
5889         offset += u8LengthPeerPortID;
5890 
5891         /* LengthPeerChassisID */
5892         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
5893                             hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID);
5894         /* PeerChassisID */
5895         proto_tree_add_item (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, ENC_ASCII|ENC_NA);
5896         offset += u8LengthPeerChassisID;
5897     }
5898 
5899     proto_item_append_text(item, ": NumberOfPeers:%u", u8NumberOfPeers);
5900 
5901     return offset;
5902 }
5903 
5904 
5905 /* dissect the AdjustPortState block */
5906 static int
dissect_AdjustPortState_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5907 dissect_AdjustPortState_block(tvbuff_t *tvb, int offset,
5908     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5909 {
5910     guint16 u16PortState;
5911     guint16 u16AdjustProperties;
5912 
5913 
5914     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5915         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5916             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5917         return offset;
5918     }
5919 
5920     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5921 
5922     /* PortState */
5923     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5924                         hf_pn_io_port_state, &u16PortState);
5925     /* AdjustProperties */
5926     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5927                         hf_pn_io_adjust_properties, &u16AdjustProperties);
5928 
5929     proto_item_append_text(item, ": PortState:%s, Properties:0x%x",
5930         val_to_str(u16PortState, pn_io_port_state, "0x%x"),
5931         u16AdjustProperties);
5932 
5933     return offset;
5934 }
5935 
5936 
5937 /* dissect the CheckPortState block */
5938 static int
dissect_CheckPortState_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)5939 dissect_CheckPortState_block(tvbuff_t *tvb, int offset,
5940     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
5941 {
5942     guint16 u16PortState;
5943 
5944 
5945     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5946         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5947             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5948         return offset;
5949     }
5950 
5951     /* PortState */
5952     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
5953                         hf_pn_io_port_state, &u16PortState);
5954 
5955     proto_item_append_text(item, ": %s",
5956         val_to_str(u16PortState, pn_io_port_state, "0x%x"));
5957     return offset;
5958 }
5959 
5960 
5961 /* dissect the PDPortFODataReal block */
5962 static int
dissect_PDPortFODataReal_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)5963 dissect_PDPortFODataReal_block(tvbuff_t *tvb, int offset,
5964     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
5965     guint16 u16BodyLength)
5966 {
5967     guint32    u32FiberOpticType;
5968     guint32    u32FiberOpticCableType;
5969     guint16    u16Index = 0;
5970     guint32    u32RecDataLen;
5971     pnio_ar_t *ar       = NULL;
5972 
5973 
5974     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
5975         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
5976             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
5977         return offset;
5978     }
5979 
5980     /* Padding */
5981     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
5982 
5983     /* FiberOpticType */
5984     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5985                         hf_pn_io_fiber_optic_type, &u32FiberOpticType);
5986 
5987     /* FiberOpticCableType */
5988     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
5989                         hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType);
5990 
5991     /* optional: FiberOpticManufacturerSpecific */
5992     if (u16BodyLength != 10) {
5993         dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
5994     }
5995 
5996     return offset;
5997 }
5998 
5999 
6000 /* dissect the FiberOpticManufacturerSpecific block */
6001 static int
dissect_FiberOpticManufacturerSpecific_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)6002 dissect_FiberOpticManufacturerSpecific_block(tvbuff_t *tvb, int offset,
6003     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
6004     guint16 u16BodyLength)
6005 {
6006     guint8  u8VendorIDHigh;
6007     guint8  u8VendorIDLow;
6008     guint16 u16VendorBlockType;
6009 
6010 
6011     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6012         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6013             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6014         return offset;
6015     }
6016 
6017     /* x8 VendorIDHigh */
6018     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6019                     hf_pn_io_vendor_id_high, &u8VendorIDHigh);
6020     /* x8 VendorIDLow */
6021     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6022                     hf_pn_io_vendor_id_low, &u8VendorIDLow);
6023 
6024     /* VendorBlockType */
6025     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6026                     hf_pn_io_vendor_block_type, &u16VendorBlockType);
6027     /* Data */
6028     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength-4, "Data");
6029 
6030     return offset;
6031 }
6032 
6033 
6034 /* dissect the FiberOpticDiagnosisInfo block */
6035 static int
dissect_FiberOpticDiagnosisInfo_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6036 dissect_FiberOpticDiagnosisInfo_block(tvbuff_t *tvb, int offset,
6037     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6038 {
6039     guint32 u32FiberOpticPowerBudget;
6040 
6041 
6042     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6043         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6044             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6045         return offset;
6046     }
6047 
6048     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
6049 
6050     /* decode the u32FiberOpticPowerBudget better */
6051     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6052                         hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget);
6053 
6054     return offset;
6055 }
6056 
6057 /* dissect the AdjustMAUTypeExtension block */
6058 static int
dissect_AdjustMAUTypeExtension_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6059 dissect_AdjustMAUTypeExtension_block(tvbuff_t *tvb, int offset,
6060     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6061 {
6062     guint16 u16MauTypeExtension;
6063     guint16 u16AdjustProperties;
6064 
6065     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6066         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6067             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6068         return offset;
6069     }
6070 
6071     /* Padding */
6072     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6073 
6074     /* MauTypeExtension */
6075     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension);
6076 
6077     /* Properties */
6078     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6079         hf_pn_io_adjust_properties, &u16AdjustProperties);
6080 
6081     return offset;
6082 }
6083 
6084 /* dissect the PDPortFODataAdjust block */
6085 static int
dissect_PDPortFODataAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6086 dissect_PDPortFODataAdjust_block(tvbuff_t *tvb, int offset,
6087     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6088 {
6089     guint32 u32FiberOpticType;
6090     guint32 u32FiberOpticCableType;
6091 
6092 
6093     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6094         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6095             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6096         return offset;
6097     }
6098 
6099     /* Padding */
6100     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6101 
6102     /* FiberOpticType */
6103     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6104                         hf_pn_io_fiber_optic_type, &u32FiberOpticType);
6105 
6106     /* FiberOpticCableType */
6107     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6108                         hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType);
6109 
6110 /*
6111     proto_item_append_text(item, ": %s",
6112         val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/
6113 
6114     return offset;
6115 }
6116 
6117 
6118 /* dissect the PDPortFODataCheck block */
6119 static int
dissect_PDPortFODataCheck_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6120 dissect_PDPortFODataCheck_block(tvbuff_t *tvb, int offset,
6121     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6122 {
6123     guint32 u32FiberOpticPowerBudget;
6124 
6125 
6126     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6127         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6128             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6129         return offset;
6130     }
6131 
6132     /* Padding */
6133     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6134 
6135     /* MaintenanceRequiredPowerBudget */
6136     /* XXX - decode the u32FiberOpticPowerBudget better */
6137     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6138                         hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget);
6139 
6140     /* MaintenanceDemandedPowerBudget */
6141     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6142                         hf_pn_io_maintenance_demanded_power_budget, &u32FiberOpticPowerBudget);
6143 
6144     /* ErrorPowerBudget */
6145     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6146                         hf_pn_io_error_power_budget, &u32FiberOpticPowerBudget);
6147 
6148 /*
6149     proto_item_append_text(item, ": %s",
6150         val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/
6151 
6152     return offset;
6153 }
6154 
6155 /* dissect the AdjustPeerToPeerBoundary block */
6156 static int
dissect_AdjustPeerToPeerBoundary_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6157 dissect_AdjustPeerToPeerBoundary_block(tvbuff_t *tvb, int offset,
6158     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6159 {
6160     proto_item *sub_item;
6161     proto_tree *sub_tree;
6162     guint32 u32PeerToPeerBoundary;
6163     guint16 u16AdjustProperties;
6164 
6165     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6166         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6167             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6168         return offset;
6169     }
6170 
6171     /* Padding */
6172     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6173 
6174     sub_item = proto_tree_add_item(tree, hf_pn_io_peer_to_peer_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN);
6175     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_peer_to_peer_boundary);
6176 
6177     /* PeerToPeerBoundary.Bit0 */
6178     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit0, &u32PeerToPeerBoundary);
6179 
6180     /* PeerToPeerBoundary.Bit1 */
6181     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit1, &u32PeerToPeerBoundary);
6182 
6183     /* PeerToPeerBoundary.Bit2 */
6184     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit2, &u32PeerToPeerBoundary);
6185 
6186     /* PeerToPeerBoundary.OtherBits */
6187     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_otherbits, &u32PeerToPeerBoundary);
6188 
6189     /* Properties */
6190     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6191         hf_pn_io_adjust_properties, &u16AdjustProperties);
6192 
6193     return offset;
6194 }
6195 
6196 
6197 /* dissect the AdjustDCPBoundary block */
6198 static int
dissect_AdjustDCPBoundary_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6199 dissect_AdjustDCPBoundary_block(tvbuff_t *tvb, int offset,
6200     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6201 {
6202     proto_item *sub_item;
6203     proto_tree *sub_tree;
6204     guint32 u32DcpBoundary;
6205     guint16 u16AdjustProperties;
6206 
6207     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6208         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6209             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6210         return offset;
6211     }
6212 
6213     /* Padding */
6214     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6215 
6216     sub_item = proto_tree_add_item(tree, hf_pn_io_dcp_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN);
6217     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_dcp_boundary);
6218 
6219     /* DcpBoundary.Bit0 */
6220     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit0, &u32DcpBoundary);
6221 
6222     /* DcpBoundary.Bit1 */
6223     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit1, &u32DcpBoundary);
6224 
6225     /* DcpBoundary.OtherBits */
6226     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_otherbits, &u32DcpBoundary);
6227 
6228     /* Properties */
6229     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6230         hf_pn_io_adjust_properties, &u16AdjustProperties);
6231 
6232     return offset;
6233 }
6234 
6235 static int
dissect_MrpInstanceDataAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)6236 dissect_MrpInstanceDataAdjust_block(tvbuff_t *tvb, int offset,
6237     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
6238 {
6239     guint8  u8MrpInstance;
6240     e_guid_t uuid;
6241     guint16 u16Role;
6242     guint8  u8LengthDomainName;
6243     int endoffset = offset + u16BodyLength;
6244 
6245     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6246         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6247             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6248         return offset;
6249     }
6250     /* Padding one byte */
6251     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6252     /* Mrp Instance */
6253     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6254         hf_pn_io_mrp_instance, &u8MrpInstance);
6255     /* MRP_DomainUUID */
6256     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6257         hf_pn_io_mrp_domain_uuid, &uuid);
6258     /* MRP_Role */
6259     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6260                     hf_pn_io_mrp_role, &u16Role);
6261     /* Padding */
6262     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6263     /* MRP_LengthDomainName */
6264     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6265                     hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
6266     /* MRP_DomainName */
6267     /* XXX - see comment earlier about MRP_DomainName */
6268     proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII|ENC_NA);
6269     offset += u8LengthDomainName;
6270     /* Padding */
6271     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6272     while(endoffset > offset)
6273     {
6274         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
6275     }
6276 
6277     return offset;
6278 }
6279 
6280 static int
dissect_MrpInstanceDataReal_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)6281 dissect_MrpInstanceDataReal_block(tvbuff_t *tvb, int offset,
6282     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
6283 {
6284     guint8  u8MrpInstance;
6285     e_guid_t uuid;
6286     guint16 u16Role;
6287     guint16 u16Version;
6288     guint8  u8LengthDomainName;
6289     int     endoffset = offset + u16BodyLength;
6290 
6291     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6292         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6293             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6294         return offset;
6295     }
6296     /* Padding one byte */
6297     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6298     /* Mrp Instance */
6299     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6300         hf_pn_io_mrp_instance, &u8MrpInstance);
6301     /* MRP_DomainUUID */
6302     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6303         hf_pn_io_mrp_domain_uuid, &uuid);
6304     /* MRP_Role */
6305     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6306                     hf_pn_io_mrp_role, &u16Role);
6307     /* MRP_Version */
6308     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6309         hf_pn_io_mrp_version, &u16Version);
6310     /* MRP_LengthDomainName */
6311     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6312                     hf_pn_io_mrp_length_domain_name, &u8LengthDomainName);
6313     /* MRP_DomainName */
6314     /* XXX - see comment earlier about MRP_DomainName */
6315     proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII|ENC_NA);
6316     offset += u8LengthDomainName;
6317     /* Padding */
6318     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6319 
6320     while(endoffset > offset)
6321     {
6322         offset = dissect_a_block(tvb, offset, pinfo, tree, drep);
6323     }
6324     return offset;
6325 }
6326 
6327 static int
dissect_MrpInstanceDataCheck_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength _U_)6328 dissect_MrpInstanceDataCheck_block(tvbuff_t *tvb, int offset,
6329     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_)
6330 {
6331     guint8  u8MrpInstance;
6332     guint32 u32Check;
6333     e_guid_t uuid;
6334 
6335     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6336         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6337             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6338         return offset;
6339     }
6340     /* Padding one byte */
6341     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
6342     /* Mrp Instance */
6343     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6344         hf_pn_io_mrp_instance, &u8MrpInstance);
6345     /* MRP_DomainUUID */
6346     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6347         hf_pn_io_mrp_domain_uuid, &uuid);
6348 
6349     /* MRP_Check */
6350     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6351                           hf_pn_io_mrp_check, &u32Check);
6352     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6353                           hf_pn_io_mrp_check_mrm, &u32Check);
6354     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6355                           hf_pn_io_mrp_check_mrpdomain, &u32Check);
6356     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6357                           hf_pn_io_mrp_check_reserved_1, &u32Check);
6358     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6359                           hf_pn_io_mrp_check_reserved_2, &u32Check);
6360     offset +=4; /* MRP_Check (32 bit) done */
6361 
6362     return offset;
6363 }
6364 
6365 /* PDInterfaceAdjust */
6366 static int
dissect_PDInterfaceAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6367 dissect_PDInterfaceAdjust_block(tvbuff_t *tvb, int offset,
6368  packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6369 {
6370     guint32     u32SMultipleInterfaceMode;
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     /* Padding */
6378     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6379 /* MultipleInterfaceMode */
6380     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6381                         hf_pn_io_MultipleInterfaceMode_NameOfDevice, &u32SMultipleInterfaceMode);
6382     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6383                         hf_pn_io_MultipleInterfaceMode_reserved_1, &u32SMultipleInterfaceMode);
6384     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6385                         hf_pn_io_MultipleInterfaceMode_reserved_2, &u32SMultipleInterfaceMode);
6386     return offset;
6387 }
6388 
6389 /* PDPortStatistic for one subslot */
6390 static int
dissect_PDPortStatistic_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6391 dissect_PDPortStatistic_block(tvbuff_t *tvb, int offset,
6392  packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6393 {
6394     guint32 u32StatValue;
6395     guint16 u16CounterStatus;
6396     proto_item *sub_item;
6397     proto_tree *sub_tree;
6398     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
6399         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6400             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6401         return offset;
6402     }
6403     switch (u8BlockVersionLow) {
6404     case(0):
6405         /* Padding */
6406         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6407     break;
6408     case(1):
6409         sub_item = proto_tree_add_item(tree, hf_pn_io_pdportstatistic_counter_status, tvb, offset, 2, ENC_BIG_ENDIAN);
6410         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_counter_status);
6411         /* bit 0 */
6412         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6413             hf_pn_io_pdportstatistic_counter_status_ifInOctets, &u16CounterStatus);
6414         /* bit 1 */
6415         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6416             hf_pn_io_pdportstatistic_counter_status_ifOutOctets, &u16CounterStatus);
6417         /* bit 2 */
6418         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6419             hf_pn_io_pdportstatistic_counter_status_ifInDiscards, &u16CounterStatus);
6420         /* bit 3 */
6421         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6422             hf_pn_io_pdportstatistic_counter_status_ifOutDiscards, &u16CounterStatus);
6423         /* bit 4 */
6424         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6425             hf_pn_io_pdportstatistic_counter_status_ifInErrors, &u16CounterStatus);
6426         /* bit 5 */
6427         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6428             hf_pn_io_pdportstatistic_counter_status_ifOutErrors, &u16CounterStatus);
6429         /* bit 6-15 */
6430         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
6431             hf_pn_io_pdportstatistic_counter_status_reserved, &u16CounterStatus);
6432     break;
6433     default: /* will not execute because of the line preceding the switch */
6434     break;
6435     }
6436 
6437     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6438                         hf_pn_io_pdportstatistic_ifInOctets, &u32StatValue);
6439     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6440                         hf_pn_io_pdportstatistic_ifOutOctets, &u32StatValue);
6441 
6442     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6443                         hf_pn_io_pdportstatistic_ifInDiscards, &u32StatValue);
6444     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6445                         hf_pn_io_pdportstatistic_ifOutDiscards, &u32StatValue);
6446 
6447     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6448                         hf_pn_io_pdportstatistic_ifInErrors, &u32StatValue);
6449     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6450                         hf_pn_io_pdportstatistic_ifOutErrors, &u32StatValue);
6451 
6452     return offset;
6453 }
6454 
6455 
6456 /* dissect the PDInterfaceDataReal block */
6457 static int
dissect_PDInterfaceDataReal_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6458 dissect_PDInterfaceDataReal_block(tvbuff_t *tvb, int offset,
6459     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6460 {
6461     guint8   u8LengthOwnChassisID;
6462     guint8   mac[6];
6463     guint32  ip;
6464 
6465 
6466     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6467         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6468             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6469         return offset;
6470     }
6471 
6472     /* LengthOwnChassisID */
6473     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6474                         hf_pn_io_length_own_chassis_id, &u8LengthOwnChassisID);
6475     /* OwnChassisID */
6476     proto_tree_add_item (tree, hf_pn_io_own_chassis_id, tvb, offset, u8LengthOwnChassisID, ENC_ASCII|ENC_NA);
6477     offset += u8LengthOwnChassisID;
6478 
6479     /* Padding */
6480     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6481 
6482     /* MACAddressValue */
6483     offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_macadd, mac);
6484 
6485     /* Padding */
6486     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6487 
6488     /* IPAddress */
6489     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_ip_address, &ip);
6490     /*proto_item_append_text(block_item, ", IP: %s", ip_to_str((guint8*)&ip));*/
6491 
6492     /* Subnetmask */
6493     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_subnetmask, &ip);
6494     /*proto_item_append_text(block_item, ", Subnet: %s", ip_to_str((guint8*)&ip));*/
6495 
6496     /* StandardGateway */
6497     offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_standard_gateway, &ip);
6498     /*proto_item_append_text(block_item, ", Router: %s", ip_to_str((guint8*)&ip));*/
6499 
6500 
6501     return offset;
6502 }
6503 
6504 
6505 /* dissect the PDSyncData block */
6506 static int
dissect_PDSyncData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6507 dissect_PDSyncData_block(tvbuff_t *tvb, int offset,
6508     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6509 {
6510     guint16   u16SlotNr;
6511     guint16   u16SubslotNr;
6512     e_guid_t  uuid;
6513     guint32   u32ReservedIntervalBegin;
6514     guint32   u32ReservedIntervalEnd;
6515     guint32   u32PLLWindow;
6516     guint32   u32SyncSendFactor;
6517     guint16   u16SendClockFactor;
6518     guint16   u16SyncProperties;
6519     guint16   u16SyncFrameAddress;
6520     guint16   u16PTCPTimeoutFactor;
6521     guint16   u16PTCPTakeoverTimeoutFactor;
6522     guint16   u16PTCPMasterStartupTime;
6523     guint8    u8MasterPriority1;
6524     guint8    u8MasterPriority2;
6525     guint8    u8LengthSubdomainName;
6526 
6527 
6528     if (u8BlockVersionHigh != 1) {
6529         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6530             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6531         return offset;
6532     }
6533 
6534     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6535 
6536     switch (u8BlockVersionLow) {
6537     case(0):
6538         /* SlotNumber */
6539         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6540                             hf_pn_io_slot_nr, &u16SlotNr);
6541         /* Subslotnumber */
6542         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6543                             hf_pn_io_subslot_nr, &u16SubslotNr);
6544         /* PTCPSubdomainID */
6545         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6546                             hf_pn_io_ptcp_subdomain_id, &uuid);
6547         /* IRDataID */
6548         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6549                             hf_pn_io_ir_data_id, &uuid);
6550         /* ReservedIntervalBegin */
6551         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6552                             hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin);
6553         /* ReservedIntervalEnd */
6554         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6555                             hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd);
6556         /* PLLWindow enum */
6557         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6558                             hf_pn_io_pllwindow, &u32PLLWindow);
6559         /* SyncSendFactor 32 enum */
6560         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6561                             hf_pn_io_sync_send_factor, &u32SyncSendFactor);
6562         /* SendClockFactor 16 */
6563         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6564                             hf_pn_io_send_clock_factor, &u16SendClockFactor);
6565         /* SyncProperties 16 bitfield */
6566         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6567                             hf_pn_io_sync_properties, &u16SyncProperties);
6568         /* SyncFrameAddress 16 bitfield */
6569         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6570                             hf_pn_io_sync_frame_address, &u16SyncFrameAddress);
6571         /* PTCPTimeoutFactor 16 enum */
6572         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6573                             hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor);
6574 
6575         proto_item_append_text(item, ": Slot:0x%x/0x%x, Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u",
6576             u16SlotNr, u16SubslotNr, u32ReservedIntervalBegin, u32ReservedIntervalEnd,
6577             u32PLLWindow, u32SyncSendFactor, u16SendClockFactor);
6578         break;
6579     case(2):
6580         /* PTCPSubdomainID */
6581         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6582                             hf_pn_io_ptcp_subdomain_id, &uuid);
6583         /* ReservedIntervalBegin */
6584         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6585                             hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin);
6586         /* ReservedIntervalEnd */
6587         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6588                             hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd);
6589         /* PLLWindow enum */
6590         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6591                             hf_pn_io_pllwindow, &u32PLLWindow);
6592         /* SyncSendFactor 32 enum */
6593         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6594                             hf_pn_io_sync_send_factor, &u32SyncSendFactor);
6595         /* SendClockFactor 16 */
6596         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6597                             hf_pn_io_send_clock_factor, &u16SendClockFactor);
6598         /* PTCPTimeoutFactor 16 enum */
6599         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6600                             hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor);
6601         /* PTCPTakeoverTimeoutFactor 16 */
6602         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6603                             hf_pn_io_ptcp_takeover_timeout_factor, &u16PTCPTakeoverTimeoutFactor);
6604         /* PTCPMasterStartupTime 16 */
6605         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6606                             hf_pn_io_ptcp_master_startup_time, &u16PTCPMasterStartupTime);
6607         /* SyncProperties 16 bitfield */
6608         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6609                             hf_pn_io_sync_properties, &u16SyncProperties);
6610         /* PTCP_MasterPriority1 */
6611         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6612                             hf_pn_io_ptcp_master_priority_1, &u8MasterPriority1);
6613         /* PTCP_MasterPriority2 */
6614         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6615                             hf_pn_io_ptcp_master_priority_2, &u8MasterPriority2);
6616         /* PTCPLengthSubdomainName */
6617         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep,
6618                             hf_pn_io_ptcp_length_subdomain_name, &u8LengthSubdomainName);
6619         /* PTCPSubdomainName */
6620         /* XXX - another Punycode string */
6621         proto_tree_add_item (tree, hf_pn_io_ptcp_subdomain_name, tvb, offset, u8LengthSubdomainName, ENC_ASCII|ENC_NA);
6622         offset += u8LengthSubdomainName;
6623 
6624         /* Padding */
6625         offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6626 
6627         proto_item_append_text(item, ": Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u",
6628             u32ReservedIntervalBegin, u32ReservedIntervalEnd,
6629             u32PLLWindow, u32SyncSendFactor, u16SendClockFactor);
6630         break;
6631     default:
6632         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6633             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6634     }
6635 
6636     return offset;
6637 }
6638 
6639 
6640 /* dissect the PDIRData block */
6641 static int
dissect_PDIRData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6642 dissect_PDIRData_block(tvbuff_t *tvb, int offset,
6643     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6644 {
6645     guint16    u16SlotNr;
6646     guint16    u16SubslotNr;
6647     guint16    u16Index = 0;
6648     guint32    u32RecDataLen;
6649     pnio_ar_t *ar       = NULL;
6650 
6651     /* versions decoded are High: 1 and LOW 0..2 */
6652     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2 ) ) {
6653         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6654             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6655         return offset;
6656     }
6657 
6658     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6659 
6660     /* SlotNumber */
6661     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6662                         hf_pn_io_slot_nr, &u16SlotNr);
6663     /* Subslotnumber */
6664     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6665                         hf_pn_io_subslot_nr, &u16SubslotNr);
6666 
6667     proto_item_append_text(item, ": Slot:0x%x/0x%x",
6668         u16SlotNr, u16SubslotNr);
6669 
6670     /* PDIRGlobalData */
6671     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6672     if (u8BlockVersionLow == 0) {
6673         /* PDIRFrameData */
6674         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6675     } else if (u8BlockVersionLow == 1) {
6676         /* [PDIRFrameData] */
6677         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6678         /* PDIRBeginEndData */
6679         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6680     }else if (u8BlockVersionLow == 2) {
6681         /* [PDIRFrameData] */
6682         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6683         /* PDIRBeginEndData */
6684         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
6685     }
6686     return offset;
6687 }
6688 
6689 
6690 /* dissect the PDIRGlobalData block */
6691 static int
dissect_PDIRGlobalData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)6692 dissect_PDIRGlobalData_block(tvbuff_t *tvb, int offset,
6693     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
6694 {
6695     e_guid_t uuid;
6696     guint32  u32MaxBridgeDelay;
6697     guint32  u32NumberOfPorts;
6698     guint32  u32MaxPortTxDelay;
6699     guint32  u32MaxPortRxDelay;
6700     guint32  u32MaxLineRxDelay;
6701     guint32  u32YellowTime;
6702     guint32  u32Tmp;
6703 
6704     /* added blockversion 2 */
6705     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2)) {
6706         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6707             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6708         return offset;
6709     }
6710 
6711     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6712 
6713     /* IRDataID */
6714     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
6715                         hf_pn_io_ir_data_id, &uuid);
6716 
6717     if (u8BlockVersionLow <= 2) {
6718         /* MaxBridgeDelay */
6719         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6720                                      hf_pn_io_max_bridge_delay, &u32MaxBridgeDelay);
6721         /* NumberOfPorts */
6722         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6723                                      hf_pn_io_number_of_ports, &u32NumberOfPorts);
6724         u32Tmp = u32NumberOfPorts;
6725 
6726         while (u32Tmp--) {
6727             /* MaxPortTxDelay */
6728             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6729                                          hf_pn_io_max_port_tx_delay, &u32MaxPortTxDelay);
6730             /* MaxPortRxDelay */
6731             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6732                                          hf_pn_io_max_port_rx_delay, &u32MaxPortRxDelay);
6733             if (u8BlockVersionLow >= 2) {
6734                 /* MaxLineRxDelay */
6735                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6736                     hf_pn_io_max_line_rx_delay, &u32MaxLineRxDelay);
6737                 /* YellowTime */
6738                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6739                     hf_pn_io_yellowtime, &u32YellowTime);
6740             }
6741         }
6742         proto_item_append_text(item, ": MaxBridgeDelay:%u, NumberOfPorts:%u",
6743                              u32MaxBridgeDelay, u32NumberOfPorts);
6744 
6745     }
6746     return offset;
6747 }
6748 
6749 
6750 /* dissect the PDIRFrameData block */
6751 static int
dissect_PDIRFrameData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)6752 dissect_PDIRFrameData_block(tvbuff_t *tvb, int offset,
6753     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
6754     guint16 u16BodyLength)
6755 {
6756     guint32     u32FrameSendOffset;
6757     guint32     u32FrameDataProperties;
6758     guint16     u16DataLength;
6759     guint16     u16ReductionRatio;
6760     guint16     u16Phase;
6761     guint16     u16FrameID;
6762     guint16     u16Ethertype;
6763     guint8      u8RXPort;
6764     guint8      u8FrameDetails;
6765     guint8      u8NumberOfTxPortGroups;
6766     guint8      u8TxPortGroupArray;
6767     guint16     u16TxPortGroupArraySize;
6768     guint16     u16EndOffset;
6769     guint16     n = 0;
6770     proto_item *sub_item;
6771     proto_tree *sub_tree;
6772 
6773     /* added low version 1 */
6774     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
6775         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6776             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6777         return offset;
6778     }
6779 
6780     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6781 
6782     u16EndOffset = offset + u16BodyLength -2;
6783     if (u8BlockVersionLow > 0) {
6784         /* for low version 1 FrameDataProperties is added */
6785         sub_item = proto_tree_add_item(tree, hf_pn_io_frame_data_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
6786         sub_tree = proto_item_add_subtree(sub_item, ett_pn_FrameDataProperties);
6787         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6788                               hf_pn_io_frame_data_properties_forwarding_Mode, &u32FrameDataProperties);
6789         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6790                               hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd, &u32FrameDataProperties);
6791         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6792                               hf_pn_io_frame_data_properties_FragmentMode, &u32FrameDataProperties);
6793         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6794                               hf_pn_io_frame_data_properties_reserved_1, &u32FrameDataProperties);
6795         offset =
6796         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
6797                               hf_pn_io_frame_data_properties_reserved_2, &u32FrameDataProperties);
6798     }
6799     /* dissect all IR frame data */
6800     while (offset < u16EndOffset)
6801     {
6802         proto_item *ir_frame_data_sub_item;
6803         proto_tree *ir_frame_data_tree;
6804 
6805         n++;
6806 
6807         /* new subtree for each IR frame */
6808         ir_frame_data_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_frame_data, tvb, offset, 17, ENC_NA);
6809         ir_frame_data_tree     = proto_item_add_subtree(ir_frame_data_sub_item, ett_pn_io_ir_frame_data);
6810 
6811         /* FrameSendOffset */
6812         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_frame_data_tree, drep,
6813                                        hf_pn_io_frame_send_offset, &u32FrameSendOffset);
6814         /* DataLength */
6815         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
6816                                        hf_pn_io_data_length, &u16DataLength);
6817         /* ReductionRatio */
6818         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
6819                                        hf_pn_io_reduction_ratio, &u16ReductionRatio);
6820         /* Phase */
6821         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
6822                                        hf_pn_io_phase, &u16Phase);
6823         /* FrameID */
6824         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
6825                                        hf_pn_io_frame_id, &u16FrameID);
6826 
6827         /* Ethertype */
6828         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep,
6829                                        hf_pn_io_ethertype, &u16Ethertype);
6830         /* RxPort */
6831         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, ir_frame_data_tree, drep,
6832                                       hf_pn_io_rx_port, &u8RXPort);
6833         /* FrameDetails */
6834         sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_frame_details, tvb, offset, 1, ENC_BIG_ENDIAN);
6835         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_frame_defails);
6836         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
6837                              hf_pn_io_frame_details_sync_frame, &u8FrameDetails);
6838         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
6839                              hf_pn_io_frame_details_meaning_frame_send_offset, &u8FrameDetails);
6840         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
6841                              hf_pn_io_frame_details_reserved, &u8FrameDetails);
6842         /* TxPortGroup */
6843         u8NumberOfTxPortGroups = tvb_get_guint8(tvb, offset);
6844         sub_item = proto_tree_add_uint(ir_frame_data_tree, hf_pn_io_nr_of_tx_port_groups,
6845                              tvb, offset, 1, u8NumberOfTxPortGroups);
6846         offset++;
6847         if ((u8NumberOfTxPortGroups > 21) || ((u8NumberOfTxPortGroups & 0x1) !=1)) {
6848             expert_add_info(pinfo, sub_item, &ei_pn_io_nr_of_tx_port_groups);
6849         }
6850 
6851         /* TxPortArray */
6852         u16TxPortGroupArraySize =  (u8NumberOfTxPortGroups + 7 / 8);
6853         sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_TxPortGroupProperties,
6854                              tvb, offset, u16TxPortGroupArraySize, ENC_BIG_ENDIAN);
6855         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_GroupProperties);
6856         while (u16TxPortGroupArraySize > 0)
6857         {
6858             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit0, &u8TxPortGroupArray);
6859             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit1, &u8TxPortGroupArray);
6860             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit2, &u8TxPortGroupArray);
6861             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit3, &u8TxPortGroupArray);
6862             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit4, &u8TxPortGroupArray);
6863             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit5, &u8TxPortGroupArray);
6864             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit6, &u8TxPortGroupArray);
6865             dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit7, &u8TxPortGroupArray);
6866 
6867             offset+=1;
6868             u16TxPortGroupArraySize --;
6869         }
6870 
6871         /* align to next dataset */
6872         offset = dissect_pn_align4(tvb, offset, pinfo, ir_frame_data_tree);
6873 
6874         proto_item_append_text(ir_frame_data_tree, ": Offset:%u, Len:%u, Ratio:%u, Phase:%u, FrameID:0x%04x",
6875                                u32FrameSendOffset, u16DataLength, u16ReductionRatio, u16Phase, u16FrameID);
6876 
6877     }
6878 
6879     proto_item_append_text(item, ": Frames:%u", n);
6880 
6881     return offset;
6882 }
6883 
6884 
6885 static int
dissect_PDIRBeginEndData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)6886 dissect_PDIRBeginEndData_block(tvbuff_t *tvb, int offset,
6887     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
6888     guint16 u16BodyLength)
6889 {
6890     guint16 u16StartOfRedFrameID;
6891     guint16 u16EndOfRedFrameID;
6892     guint32 u32NumberOfPorts;
6893     guint32 u32NumberOfAssignments;
6894     guint32 u32NumberOfPhases;
6895     guint32 u32RedOrangePeriodBegin;
6896     guint32 u32OrangePeriodBegin;
6897     guint32 u32GreenPeriodBegin;
6898     guint16 u16TXPhaseAssignment;
6899     guint16 u16RXPhaseAssignment;
6900     guint32 u32SubStart;
6901     guint32 u32Tmp;
6902     guint32 u32Tmp2;
6903     guint32 u32TxRedOrangePeriodBegin[0x11] = {0};
6904     guint32 u32TxOrangePeriodBegin [0x11]   = {0};
6905     guint32 u32TxGreenPeriodBegin [0x11]    = {0};
6906     guint32 u32RxRedOrangePeriodBegin[0x11] = {0};
6907     guint32 u32RxOrangePeriodBegin [0x11]   = {0};
6908     guint32 u32RxGreenPeriodBegin [0x11]    = {0};
6909     guint32 u32PortIndex;
6910 
6911     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
6912         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
6913             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
6914         return offset;
6915     }
6916 
6917     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
6918 
6919     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6920                     hf_pn_io_start_of_red_frame_id, &u16StartOfRedFrameID);
6921     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
6922                     hf_pn_io_end_of_red_frame_id, &u16EndOfRedFrameID);
6923 
6924     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
6925                         hf_pn_io_number_of_ports, &u32NumberOfPorts);
6926     u32Tmp2 = u32NumberOfPorts;
6927     while (u32Tmp2--) {
6928         proto_item *ir_begin_end_port_sub_item;
6929         proto_tree *ir_begin_end_port_tree;
6930 
6931         /* new subtree for each Port */
6932         ir_begin_end_port_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_begin_end_port, tvb, offset, 0, ENC_NA);
6933         ir_begin_end_port_tree = proto_item_add_subtree(ir_begin_end_port_sub_item, ett_pn_io_ir_begin_end_port);
6934         u32SubStart = offset;
6935 
6936         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6937                             hf_pn_io_number_of_assignments, &u32NumberOfAssignments);
6938         u32Tmp = u32NumberOfAssignments;
6939         u32PortIndex = 0;
6940         if (u32Tmp <= 0x10)
6941         {
6942             while (u32Tmp--) {
6943                 /* TXBeginEndAssignment */
6944                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6945                                                hf_pn_io_red_orange_period_begin_tx, &u32RedOrangePeriodBegin);
6946                 u32TxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin;
6947 
6948                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6949                                                hf_pn_io_orange_period_begin_tx, &u32OrangePeriodBegin);
6950                 u32TxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin;
6951 
6952                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6953                                                hf_pn_io_green_period_begin_tx, &u32GreenPeriodBegin);
6954                 u32TxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin;
6955 
6956                 /* RXBeginEndAssignment */
6957                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6958                                                hf_pn_io_red_orange_period_begin_rx, &u32RedOrangePeriodBegin);
6959                 u32RxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin;
6960 
6961                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6962                                                hf_pn_io_orange_period_begin_rx, &u32OrangePeriodBegin);
6963                 u32RxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin;
6964 
6965                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6966                                                hf_pn_io_green_period_begin_rx, &u32GreenPeriodBegin);
6967                 u32RxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin;
6968 
6969                 u32PortIndex++;
6970             }
6971         }
6972 
6973         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep,
6974                             hf_pn_io_number_of_phases, &u32NumberOfPhases);
6975         u32Tmp = u32NumberOfPhases;
6976         if (u32Tmp <= 0x10)
6977         {
6978             while (u32Tmp--) {
6979                 proto_item *ir_begin_tx_phase_sub_item;
6980                 proto_tree *ir_begin_tx_phase_tree;
6981 
6982                 /* new subtree  for TXPhaseAssignment */
6983                 ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree,
6984                                       hf_pn_ir_tx_phase_assignment, tvb, offset, 0, ENC_NA);
6985                 ir_begin_tx_phase_tree     = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_tx_phase);
6986                 /* bit 0..3 */
6987                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
6988                                       hf_pn_io_tx_phase_assignment_begin_value, &u16TXPhaseAssignment);
6989                 /* bit 4..7 */
6990                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
6991                                       hf_pn_io_tx_phase_assignment_orange_begin, &u16TXPhaseAssignment);
6992                 /* bit 8..11 */
6993                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
6994                                       hf_pn_io_tx_phase_assignment_end_reserved, &u16TXPhaseAssignment);
6995                 /* bit 12..15 */
6996                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
6997                                       hf_pn_io_tx_phase_assignment_reserved, &u16TXPhaseAssignment);
6998 
6999                 proto_item_append_text(ir_begin_tx_phase_sub_item,
7000                                       ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d",
7001                                       u16TXPhaseAssignment,
7002                                       u32TxRedOrangePeriodBegin[u16TXPhaseAssignment & 0x0F],
7003                                       u32TxOrangePeriodBegin[(u16TXPhaseAssignment & 0x0F0) >> 4],
7004                                       u32TxGreenPeriodBegin[(u16TXPhaseAssignment & 0x0F00)>> 8]);
7005 
7006                 /* new subtree  for RXPhaseAssignment */
7007                 ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree,
7008                                       hf_pn_ir_rx_phase_assignment, tvb, offset, 0, ENC_NA);
7009                 ir_begin_tx_phase_tree     = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_rx_phase);
7010                 /* bit 0..3 */
7011                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7012                                       hf_pn_io_tx_phase_assignment_begin_value, &u16RXPhaseAssignment);
7013                 /* bit 4..7 */
7014                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7015                                       hf_pn_io_tx_phase_assignment_orange_begin, &u16RXPhaseAssignment);
7016                 /* bit 8..11 */
7017                 dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7018                                       hf_pn_io_tx_phase_assignment_end_reserved, &u16RXPhaseAssignment);
7019                 /* bit 12..15 */
7020                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep,
7021                                       hf_pn_io_tx_phase_assignment_reserved, &u16RXPhaseAssignment);
7022 
7023                 proto_item_append_text(ir_begin_tx_phase_sub_item,
7024                                       ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d",
7025                                       u16RXPhaseAssignment,
7026                                       u32RxRedOrangePeriodBegin[u16RXPhaseAssignment & 0x0F],
7027                                       u32RxOrangePeriodBegin[(u16RXPhaseAssignment & 0x0F0) >> 4],
7028                                       u32RxGreenPeriodBegin[(u16RXPhaseAssignment & 0x0F00)>> 8]);
7029             }
7030         }
7031         proto_item_append_text(ir_begin_end_port_sub_item, ": Assignments:%u, Phases:%u",
7032             u32NumberOfAssignments, u32NumberOfPhases);
7033 
7034         proto_item_set_len(ir_begin_end_port_sub_item, offset - u32SubStart);
7035     }
7036 
7037     proto_item_append_text(item, ": StartOfRedFrameID: 0x%x, EndOfRedFrameID: 0x%x, Ports: %u",
7038         u16StartOfRedFrameID, u16EndOfRedFrameID, u32NumberOfPorts);
7039 
7040     return offset+u16BodyLength;
7041 }
7042 
7043 
7044 /* dissect the DiagnosisData block */
7045 static int
dissect_DiagnosisData_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 body_length)7046 dissect_DiagnosisData_block(tvbuff_t *tvb, int offset,
7047     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7048     guint16 body_length)
7049 {
7050     guint32 u32Api;
7051     guint16 u16SlotNr;
7052     guint16 u16SubslotNr;
7053     guint16 u16ChannelNumber;
7054     guint16 u16UserStructureIdentifier;
7055     proto_item *sub_item;
7056 
7057 
7058     if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) {
7059         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7060             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7061         return offset;
7062     }
7063 
7064     if (u8BlockVersionLow == 1) {
7065         /* API */
7066     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7067                         hf_pn_io_api, &u32Api);
7068         body_length-=4;
7069     }
7070 
7071     /* SlotNumber */
7072     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7073                     hf_pn_io_slot_nr, &u16SlotNr);
7074     /* Subslotnumber */
7075     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7076                     hf_pn_io_subslot_nr, &u16SubslotNr);
7077     /* ChannelNumber got new ranges: 0..0x7FFF the source is a channel as specified by the manufacturer */
7078     /* fetch u16ChannelNumber */
7079     u16ChannelNumber =  ((drep[0] & DREP_LITTLE_ENDIAN)
7080                             ? tvb_get_letohs(tvb, offset)
7081                             : tvb_get_ntohs(tvb, offset));
7082     if (tree) {
7083         sub_item = proto_tree_add_item(tree,hf_pn_io_channel_number, tvb, offset, 2, DREP_ENC_INTEGER(drep));
7084         if (u16ChannelNumber < 0x8000){ /*  0..0x7FFF the source is a channel  as specified by the manufacturer */
7085              proto_item_append_text(sub_item, " channel number of the diagnosis source");
7086         }
7087         else
7088             if (u16ChannelNumber == 0x8000) /* 0x8000 the whole submodule is the source, */
7089                 proto_item_append_text(sub_item, " (whole) Submodule");
7090             else
7091                 proto_item_append_text(sub_item, " reserved");
7092     }
7093     offset = offset +2; /* Advance behind ChannelNumber */
7094     /* ChannelProperties */
7095     offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep);
7096     body_length-=8;
7097     /* UserStructureIdentifier */
7098     u16UserStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN)
7099                                         ? tvb_get_letohs(tvb, offset)
7100                                         : tvb_get_ntohs(tvb, offset));
7101     if (u16UserStructureIdentifier > 0x7FFF){
7102         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7103                                        hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier);
7104     }
7105     else
7106     { /* range 0x0 to 0x7fff is manufacturer specific */
7107         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7108                                        hf_pn_io_user_structure_identifier_manf, &u16UserStructureIdentifier);
7109     }
7110     proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier);
7111     body_length-=2;
7112 
7113     /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */
7114     while (body_length) {
7115         offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep,
7116             &body_length, u16UserStructureIdentifier);
7117     }
7118     return offset;
7119 }
7120 
7121 
7122 static int
dissect_ARProperties(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_)7123 dissect_ARProperties(tvbuff_t *tvb, int offset,
7124     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_)
7125 {
7126     proto_item *sub_item;
7127     proto_tree *sub_tree;
7128     guint32     u32ARProperties;
7129     guint8      startupMode;
7130 
7131     sub_item = proto_tree_add_item(tree, hf_pn_io_ar_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
7132     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_properties);
7133     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7134                         hf_pn_io_ar_properties_pull_module_alarm_allowed, &u32ARProperties);
7135     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7136                         hf_pn_io_arproperties_StartupMode, &u32ARProperties);
7137     startupMode = (guint8)((u32ARProperties >> 30) & 0x01);
7138     /* Advanced startup mode */
7139     if (startupMode)
7140     {
7141         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7142             hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode, &u32ARProperties);
7143     }
7144     /* Legacy startup mode */
7145     else
7146     {
7147         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7148             hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode, &u32ARProperties);
7149     }
7150     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7151                         hf_pn_io_ar_properties_reserved, &u32ARProperties);
7152     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7153                         hf_pn_io_ar_properties_achnowledge_companion_ar, &u32ARProperties);
7154     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7155                         hf_pn_io_ar_properties_companion_ar, &u32ARProperties);
7156     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7157                         hf_pn_io_ar_properties_device_access, &u32ARProperties);
7158     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7159                         hf_pn_io_ar_properties_reserved_1, &u32ARProperties);
7160 /* removed within 2.3
7161     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7162                         hf_pn_io_ar_properties_data_rate, &u32ARProperties);
7163 */
7164     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7165                         hf_pn_io_ar_properties_parameterization_server, &u32ARProperties);
7166     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7167                         hf_pn_io_ar_properties_supervisor_takeover_allowed, &u32ARProperties);
7168     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7169                         hf_pn_io_ar_properties_state, &u32ARProperties);
7170 
7171     return offset;
7172 }
7173 
7174 
7175 /* dissect the IOCRProperties */
7176 static int
dissect_IOCRProperties(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)7177 dissect_IOCRProperties(tvbuff_t *tvb, int offset,
7178     packet_info *pinfo, proto_tree *tree, guint8 *drep)
7179 {
7180     proto_item *sub_item;
7181     proto_tree *sub_tree;
7182     guint32     u32IOCRProperties;
7183 
7184     sub_item = proto_tree_add_item(tree, hf_pn_io_iocr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
7185     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_iocr_properties);
7186     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7187                     hf_pn_io_iocr_properties_full_subframe_structure, &u32IOCRProperties);
7188     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7189                     hf_pn_io_iocr_properties_distributed_subframe_watchdog, &u32IOCRProperties);
7190     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7191                     hf_pn_io_iocr_properties_fast_forwarding_mac_adr, &u32IOCRProperties);
7192     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7193                     hf_pn_io_iocr_properties_reserved_3, &u32IOCRProperties);
7194     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7195                     hf_pn_io_iocr_properties_reserved_2, &u32IOCRProperties);
7196     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7197                     hf_pn_io_iocr_properties_media_redundancy, &u32IOCRProperties);
7198     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7199                     hf_pn_io_iocr_properties_reserved_1, &u32IOCRProperties);
7200     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7201                     hf_pn_io_iocr_properties_rtclass, &u32IOCRProperties);
7202 
7203     return offset;
7204 }
7205 
7206 
7207 /* dissect the ARData block */
7208 static int
dissect_ARData_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BlockLength)7209 dissect_ARData_block(tvbuff_t *tvb, int offset,
7210     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BlockLength)
7211 {
7212     guint16     u16NumberOfARs;
7213     guint16     u16NumberofEntries;
7214     e_guid_t    aruuid;
7215     e_guid_t    uuid;
7216     guint16     u16ARType;
7217     guint16     u16NameLength;
7218     guint16     u16NumberOfIOCRs;
7219     guint16     u16IOCRType;
7220     guint16     u16FrameID;
7221     guint16     u16CycleCounter;
7222     guint8      u8DataStatus;
7223     guint8      u8TransferStatus;
7224     proto_item *ds_item;
7225     proto_tree *ds_tree;
7226     guint16     u16UDPRTPort;
7227     guint16     u16AlarmCRType;
7228     guint16     u16LocalAlarmReference;
7229     guint16     u16RemoteAlarmReference;
7230     guint16     u16NumberOfAPIs;
7231     guint32     u32Api;
7232     proto_item *iocr_item;
7233     proto_tree *iocr_tree;
7234     proto_item *ar_item;
7235     proto_tree *ar_tree;
7236     guint32     u32IOCRStart;
7237     gint32      i32EndOffset;
7238     guint32     u32ARDataStart;
7239 
7240     /* added BlockversionLow == 1  */
7241     if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) {
7242         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7243             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7244         return offset;
7245     }
7246     i32EndOffset = offset + u16BlockLength;
7247     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7248                     hf_pn_io_number_of_ars, &u16NumberOfARs);
7249     /* BlockversionLow:  0 */
7250     if (u8BlockVersionLow == 0) {
7251         while (u16NumberOfARs--) {
7252             ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA);
7253             ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data);
7254             u32ARDataStart = offset;
7255             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7256                             hf_pn_io_ar_uuid, &aruuid);
7257 
7258             if (!PINFO_FD_VISITED(pinfo)) {
7259                 pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num);
7260             }
7261 
7262             proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(pinfo->pool, (const e_guid_t*) &aruuid));
7263             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7264                         hf_pn_io_ar_type, &u16ARType);
7265             offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep);
7266             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7267                          hf_pn_io_cminitiator_objectuuid, &uuid);
7268             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7269                          hf_pn_io_station_name_length, &u16NameLength);
7270             proto_tree_add_item (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA);
7271             offset += u16NameLength;
7272 
7273             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7274                         hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs);
7275 
7276             while (u16NumberOfIOCRs--) {
7277                 iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA);
7278                 iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr);
7279                 u32IOCRStart = offset;
7280 
7281                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7282                                 hf_pn_io_iocr_type, &u16IOCRType);
7283                 offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep);
7284                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7285                                 hf_pn_io_frame_id, &u16FrameID);
7286 
7287                 proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID);
7288 
7289                 /* add cycle counter */
7290                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7291                                 hf_pn_io_cycle_counter, &u16CycleCounter);
7292 
7293                 u8DataStatus = tvb_get_guint8(tvb, offset);
7294                 u8TransferStatus = tvb_get_guint8(tvb, offset+1);
7295 
7296                 /* add data status subtree */
7297                 ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status,
7298                     tvb, offset, 1, u8DataStatus,
7299                     "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)",
7300                     u8DataStatus,
7301                     (u8DataStatus & 0x04) ? "Valid" : "Invalid",
7302                     (u8DataStatus & 0x01) ? "Primary" : "Backup",
7303                     (u8DataStatus & 0x20) ? "Ok" : "Problem",
7304                     (u8DataStatus & 0x10) ? "Run" : "Stop");
7305                 ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status);
7306                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus);
7307                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus);
7308                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus);
7309                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus);
7310                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus);
7311                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus);
7312                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus);
7313 
7314                 offset++;
7315 
7316                 /* add transfer status */
7317                 if (u8TransferStatus) {
7318                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7319                         offset, 1, u8TransferStatus,
7320                         "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus);
7321                 } else {
7322                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7323                         offset, 1, u8TransferStatus,
7324                         "TransferStatus: 0x%02x (OK)", u8TransferStatus);
7325                 }
7326 
7327                 offset++;
7328 
7329                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7330                                 hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
7331                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7332                                 hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
7333 
7334                 proto_item_set_len(iocr_item, offset - u32IOCRStart);
7335             }
7336 
7337             /* AlarmCRType */
7338             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7339                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
7340             /* LocalAlarmReference */
7341             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7342                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
7343             /* RemoteAlarmReference */
7344             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7345                         hf_pn_io_remotealarmref, &u16RemoteAlarmReference);
7346             /* ParameterServerObjectUUID */
7347             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep,
7348                             hf_pn_io_parameter_server_objectuuid, &uuid);
7349             /* StationNameLength */
7350             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7351                         hf_pn_io_station_name_length, &u16NameLength);
7352             /* ParameterServerStationName */
7353             proto_tree_add_item (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA);
7354             offset += u16NameLength;
7355             /* NumberOfAPIs */
7356             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep,
7357                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7358             /* API */
7359             while (u16NumberOfAPIs--) {
7360                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep,
7361                     hf_pn_io_api, &u32Api);
7362             }
7363             proto_item_set_len(ar_item, offset - u32ARDataStart);
7364         }
7365     }
7366     else
7367     {    /* BlockversionLow == 1 */
7368         while (u16NumberOfARs--) {
7369             ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA);
7370             ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data);
7371             u32ARDataStart = offset;
7372             /*ARUUID */
7373             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_uuid, &aruuid);
7374 
7375             if (!PINFO_FD_VISITED(pinfo)) {
7376                 pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num);
7377             }
7378 
7379             proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(pinfo->pool, (const e_guid_t*) &aruuid));
7380             /* CMInitiatorObjectUUID */
7381             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_objectuuid, &uuid);
7382             /* ParameterServerObjectUUID */
7383             offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_parameter_server_objectuuid, &uuid);
7384             /* ARProperties*/
7385             offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep);
7386             /* ARType*/
7387             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_type, &u16ARType);
7388             /* AlarmCRType */
7389             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType);
7390             /* LocalAlarmReference */
7391             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference);
7392             /* RemoteAlarmReference */
7393             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_remotealarmref, &u16RemoteAlarmReference);
7394             /* InitiatorUDPRTPort*/
7395             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
7396             /* ResponderUDPRTPort*/
7397             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
7398             /* CMInitiatorStationName*/
7399             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength);
7400             proto_tree_add_item (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA);
7401             offset += u16NameLength;
7402             /** align padding! **/
7403             offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree);
7404 
7405             /* StationNameLength */
7406             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength);
7407             if (u16NameLength != 0) {
7408                 /* ParameterServerStationName */
7409                 proto_tree_add_item (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA);
7410                 offset += u16NameLength;
7411             }
7412             else
7413             { /* display no name present */
7414                 proto_tree_add_string (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, " <no ParameterServerStationName present>");
7415             }
7416             /** align padding! **/
7417             offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree);
7418 
7419             /* NumberOfIOCRs*/
7420             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs);
7421             /* align to next 32 bit */
7422             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
7423 
7424             while (u16NumberOfIOCRs--) {
7425                 iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA);
7426                 iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr);
7427                 u32IOCRStart = offset;
7428 
7429                 /* IOCRProperties*/
7430                 offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep);
7431                 /* IOCRType*/
7432                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_iocr_type, &u16IOCRType);
7433                 /* FrameID*/
7434                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_frame_id, &u16FrameID);
7435                 proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID);
7436 
7437                 /* add cycle counter */
7438                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep,
7439                     hf_pn_io_cycle_counter, &u16CycleCounter);
7440 
7441                 u8DataStatus = tvb_get_guint8(tvb, offset);
7442                 u8TransferStatus = tvb_get_guint8(tvb, offset+1);
7443 
7444                 /* add data status subtree */
7445                 ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status,
7446                     tvb, offset, 1, u8DataStatus,
7447                     "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)",
7448                     u8DataStatus,
7449                     (u8DataStatus & 0x04) ? "Valid" : "Invalid",
7450                     (u8DataStatus & 0x01) ? "Primary" : "Backup",
7451                     (u8DataStatus & 0x20) ? "Ok" : "Problem",
7452                     (u8DataStatus & 0x10) ? "Run" : "Stop");
7453                 ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status);
7454                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus);
7455                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus);
7456                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus);
7457                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus);
7458                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus);
7459                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus);
7460                 proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus);
7461 
7462                 offset++;
7463 
7464                 /* add transfer status */
7465                 if (u8TransferStatus) {
7466                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7467                         offset, 1, u8TransferStatus,
7468                         "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus);
7469                 } else {
7470                     proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb,
7471                         offset, 1, u8TransferStatus,
7472                         "TransferStatus: 0x%02x (OK)", u8TransferStatus);
7473                 }
7474                 offset++;
7475                 proto_item_set_len(iocr_item, offset - u32IOCRStart);
7476             }
7477             /* NumberOfAPIs */
7478             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7479             /* align to next 32 bit */
7480             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
7481             /* API */
7482             while (u16NumberOfAPIs--) {
7483                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_api, &u32Api);
7484             }
7485             /* get the number of subblocks an dissect them */
7486             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_ARDATAInfo, &u16NumberofEntries);
7487 
7488             offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2);
7489 
7490             while ((offset < i32EndOffset) && (u16NumberofEntries > 0)) {
7491                 offset = dissect_a_block(tvb, offset, pinfo, ar_tree, drep);
7492                 u16NumberofEntries--;
7493             }
7494             proto_item_set_len(ar_item, offset - u32ARDataStart);
7495         }
7496     }
7497     return offset;
7498 }
7499 
7500 
7501 /* dissect the APIData block */
7502 static int
dissect_APIData_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7503 dissect_APIData_block(tvbuff_t *tvb, int offset,
7504     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7505 {
7506     guint16 u16NumberOfAPIs;
7507     guint32 u32Api;
7508 
7509 
7510     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7511         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7512             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7513         return offset;
7514     }
7515 
7516     /* NumberOfAPIs */
7517     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7518                     hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7519 
7520     while (u16NumberOfAPIs--) {
7521         /* API */
7522         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7523                         hf_pn_io_api, &u32Api);
7524     }
7525 
7526     return offset;
7527 }
7528 
7529 /* dissect the SLRData block */
7530 static int
dissect_SRLData_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7531 dissect_SRLData_block(tvbuff_t *tvb, int offset,
7532     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7533 {
7534     guint16 RedundancyInfo;
7535 
7536     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7537         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7538             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7539         return offset;
7540     }
7541     /* bit 0 ..1  EndPoint1 and EndPoint2*/
7542     dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo, &RedundancyInfo);
7543     /* bit 2 .. 15 reserved */
7544     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo_reserved, &RedundancyInfo);
7545     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7546     return offset;
7547 }
7548 
7549 /* dissect the LogData block */
7550 static int
dissect_LogData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7551 dissect_LogData_block(tvbuff_t *tvb, int offset,
7552     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7553 {
7554     guint64  u64ActualLocaltimeStamp;
7555     guint16  u16NumberOfLogEntries;
7556     guint64  u64LocaltimeStamp;
7557     e_guid_t aruuid;
7558     guint32  u32EntryDetail;
7559     dcerpc_info        di; /* fake dcerpc_info struct */
7560     dcerpc_call_value  call_data;
7561 
7562     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7563         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7564             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7565         return offset;
7566     }
7567 
7568     di.conformant_run = 0;
7569     /* we need di->call_data->flags.NDR64 == 0 */
7570     call_data.flags = 0;
7571     di.call_data = &call_data;
7572     di.dcerpc_procedure_name = "";
7573 
7574     /* ActualLocalTimeStamp */
7575     offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep,
7576                     hf_pn_io_actual_local_time_stamp, &u64ActualLocaltimeStamp);
7577     /* NumberOfLogEntries */
7578     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7579                     hf_pn_io_number_of_log_entries, &u16NumberOfLogEntries);
7580 
7581     while (u16NumberOfLogEntries--) {
7582         /* LocalTimeStamp */
7583         offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep,
7584                         hf_pn_io_local_time_stamp, &u64LocaltimeStamp);
7585         /* ARUUID */
7586         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7587                         hf_pn_io_ar_uuid, &aruuid);
7588 
7589         if (!PINFO_FD_VISITED(pinfo)) {
7590             pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num);
7591         }
7592 
7593         /* PNIOStatus */
7594         offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
7595         /* EntryDetail */
7596     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7597                         hf_pn_io_entry_detail, &u32EntryDetail);
7598     }
7599 
7600     return offset;
7601 }
7602 
7603 
7604 /* dissect the FS Hello block */
7605 static int
dissect_FSHello_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7606 dissect_FSHello_block(tvbuff_t *tvb, int offset,
7607     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7608 {
7609     guint32 u32FSHelloMode;
7610     guint32 u32FSHelloInterval;
7611     guint32 u32FSHelloRetry;
7612     guint32 u32FSHelloDelay;
7613 
7614 
7615     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7616         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7617             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7618         return offset;
7619     }
7620 
7621     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7622 
7623     /* FSHelloMode */
7624     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7625                         hf_pn_io_fs_hello_mode, &u32FSHelloMode);
7626     /* FSHelloInterval */
7627     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7628                         hf_pn_io_fs_hello_interval, &u32FSHelloInterval);
7629     /* FSHelloRetry */
7630     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7631                         hf_pn_io_fs_hello_retry, &u32FSHelloRetry);
7632     /* FSHelloDelay */
7633     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7634                         hf_pn_io_fs_hello_delay, &u32FSHelloDelay);
7635 
7636     proto_item_append_text(item, ": Mode:%s, Interval:%ums, Retry:%u, Delay:%ums",
7637         val_to_str(u32FSHelloMode, pn_io_fs_hello_mode_vals, "0x%x"),
7638         u32FSHelloInterval, u32FSHelloRetry, u32FSHelloDelay);
7639 
7640     return offset;
7641 }
7642 
7643 
7644 /* dissect the FS Parameter block */
7645 static int
dissect_FSParameter_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7646 dissect_FSParameter_block(tvbuff_t *tvb, int offset,
7647     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7648 {
7649     guint32 u32FSParameterMode;
7650     e_guid_t FSParameterUUID;
7651 
7652 
7653     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7654         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7655             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7656         return offset;
7657     }
7658 
7659     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
7660 
7661     /* FSParameterMode */
7662     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
7663                         hf_pn_io_fs_parameter_mode, &u32FSParameterMode);
7664     /* FSParameterUUID */
7665     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
7666                         hf_pn_io_fs_parameter_uuid, &FSParameterUUID);
7667 
7668     proto_item_append_text(item, ": Mode:%s",
7669         val_to_str(u32FSParameterMode, pn_io_fs_parameter_mode_vals, "0x%x"));
7670 
7671     return offset;
7672 }
7673 
7674 
7675 
7676 
7677 /* dissect the FSUDataAdjust block */
7678 static int
dissect_PDInterfaceFSUDataAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)7679 dissect_PDInterfaceFSUDataAdjust_block(tvbuff_t *tvb, int offset,
7680     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7681     guint16 u16BodyLength)
7682 {
7683     tvbuff_t *new_tvb;
7684 
7685 
7686     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7687         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7688             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7689         return offset;
7690     }
7691 
7692     /* Padding */
7693     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
7694 
7695     u16BodyLength -= 2;
7696 
7697     /* sub blocks */
7698     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
7699     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
7700     offset += u16BodyLength;
7701 
7702     return offset;
7703 }
7704 
7705 
7706 /* dissect the ARFSUDataAdjust block */
7707 static int
dissect_ARFSUDataAdjust_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)7708 dissect_ARFSUDataAdjust_block(tvbuff_t *tvb, int offset,
7709     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7710     guint16 u16BodyLength)
7711 {
7712     tvbuff_t *new_tvb;
7713 
7714 
7715     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7716         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7717             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7718         return offset;
7719     }
7720 
7721     /* Padding */
7722     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
7723 
7724     u16BodyLength -= 2;
7725 
7726     /* sub blocks */
7727     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength);
7728     dissect_blocks(new_tvb, 0, pinfo, tree, drep);
7729     offset += u16BodyLength;
7730 
7731     return offset;
7732 }
7733 
7734 /* dissect the PE_EntityFilterData block */
7735 static int
dissect_PE_EntityFilterData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7736 dissect_PE_EntityFilterData_block(tvbuff_t* tvb, int offset,
7737     packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7738 {
7739     guint16     u16NumberOfAPIs;
7740     guint32     u32Api;
7741     guint16     u16NumberOfModules;
7742     guint16     u16SlotNr;
7743     guint32     u32ModuleIdentNumber;
7744     guint16     u16NumberOfSubmodules;
7745     guint16     u16SubslotNr;
7746     guint32     u32SubmoduleIdentNumber;
7747     proto_item* api_item;
7748     proto_tree* api_tree;
7749     guint32     u32ApiStart;
7750     proto_item* module_item;
7751     proto_tree* module_tree;
7752     guint32     u32ModuleStart;
7753     proto_item* sub_item;
7754     proto_tree* sub_tree;
7755     guint32     u32SubStart;
7756 
7757     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7758         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7759             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7760         return offset;
7761     }
7762 
7763     // NumberOfAPIs,
7764     // (API, NumberOfModules, (SlotNumber, ModuleIdentNumber, NumberOfSubmodules, (SubslotNumber, SubmoduleIdentNumber)*)*)*
7765 
7766     /* NumberOfAPIs */
7767     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7768         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7769 
7770     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
7771 
7772     while (u16NumberOfAPIs--) {
7773         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
7774         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
7775         u32ApiStart = offset;
7776 
7777         /* API */
7778         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
7779             hf_pn_io_api, &u32Api);
7780         /* NumberOfModules */
7781         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
7782             hf_pn_io_number_of_modules, &u16NumberOfModules);
7783 
7784         proto_item_append_text(api_item, ": %u, Modules: %u",
7785             u32Api, u16NumberOfModules);
7786 
7787         proto_item_append_text(item, ", Modules:%u", u16NumberOfModules);
7788 
7789         while (u16NumberOfModules--) {
7790             module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA);
7791             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
7792             u32ModuleStart = offset;
7793 
7794             /* SlotNumber */
7795             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
7796                 hf_pn_io_slot_nr, &u16SlotNr);
7797             /* ModuleIdentNumber */
7798             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep,
7799                 hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
7800             /* NumberOfSubmodules */
7801             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
7802                 hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
7803 
7804             proto_item_append_text(module_item, ": Slot 0x%x, Ident: 0x%x Submodules: %u",
7805                 u16SlotNr, u32ModuleIdentNumber,
7806                 u16NumberOfSubmodules);
7807 
7808             proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
7809 
7810             while (u16NumberOfSubmodules--) {
7811                 sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
7812                 sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
7813                 u32SubStart = offset;
7814 
7815                 /* Subslotnumber */
7816                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7817                     hf_pn_io_subslot_nr, &u16SubslotNr);
7818                 /* SubmoduleIdentNumber */
7819                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
7820                     hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
7821 
7822                 proto_item_append_text(sub_item, ": Subslot 0x%x, IdentNumber: 0x%x",
7823                     u16SubslotNr, u32SubmoduleIdentNumber);
7824 
7825                 proto_item_set_len(sub_item, offset - u32SubStart);
7826             } /* NumberOfSubmodules */
7827 
7828             proto_item_set_len(module_item, offset - u32ModuleStart);
7829         }
7830 
7831         proto_item_set_len(api_item, offset - u32ApiStart);
7832     }
7833 
7834 
7835     return offset;
7836 }
7837 
7838 /* dissect the PE_EntityStatusData block */
7839 static int
dissect_PE_EntityStatusData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)7840 dissect_PE_EntityStatusData_block(tvbuff_t* tvb, int offset,
7841     packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
7842 {
7843     guint16     u16NumberOfAPIs;
7844     guint32     u32Api;
7845     guint16     u16NumberOfModules;
7846     guint16     u16SlotNr;
7847     guint16     u16NumberOfSubmodules;
7848     guint16     u16SubslotNr;
7849     proto_item* api_item;
7850     proto_tree* api_tree;
7851     guint32     u32ApiStart;
7852     proto_item* module_item;
7853     proto_tree* module_tree;
7854     guint32     u32ModuleStart;
7855     proto_item* sub_item;
7856     proto_tree* sub_tree;
7857     guint32     u32SubStart;
7858     guint8      u8PEOperationalMode;
7859 
7860     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7861         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7862             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7863         return offset;
7864     }
7865 
7866     // NumberOfAPIs,
7867     // (API, NumberOfModules, (SlotNumber, NumberOfSubmodules, (SubslotNumber, PE_OperationalMode, [Padding] * a)*)*)*
7868 
7869     /* NumberOfAPIs */
7870     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
7871         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
7872 
7873     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
7874 
7875     while (u16NumberOfAPIs--) {
7876         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
7877         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
7878         u32ApiStart = offset;
7879 
7880         /* API */
7881         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
7882             hf_pn_io_api, &u32Api);
7883         /* NumberOfModules */
7884         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
7885             hf_pn_io_number_of_modules, &u16NumberOfModules);
7886 
7887         proto_item_append_text(api_item, ": %u, Modules: %u",
7888             u32Api, u16NumberOfModules);
7889 
7890         proto_item_append_text(item, ", Modules:%u", u16NumberOfModules);
7891 
7892         while (u16NumberOfModules--) {
7893             module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA);
7894             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
7895             u32ModuleStart = offset;
7896 
7897             /* SlotNumber */
7898             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
7899                 hf_pn_io_slot_nr, &u16SlotNr);
7900             /* NumberOfSubmodules */
7901             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
7902                 hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
7903 
7904             proto_item_append_text(module_item, ": Slot 0x%x, Submodules: %u",
7905                 u16SlotNr,
7906                 u16NumberOfSubmodules);
7907 
7908             proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
7909 
7910             while (u16NumberOfSubmodules--) {
7911                 sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
7912                 sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
7913                 u32SubStart = offset;
7914 
7915                 /* Subslotnumber */
7916                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
7917                     hf_pn_io_subslot_nr, &u16SubslotNr);
7918 
7919                 proto_item_append_text(sub_item, ": Subslot 0x%x",
7920                     u16SubslotNr);
7921 
7922                 offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
7923                     hf_pn_io_pe_operational_mode, &u8PEOperationalMode);
7924 
7925                 offset = dissect_pn_padding(tvb, offset, pinfo, sub_tree, 1);
7926 
7927                 proto_item_set_len(sub_item, offset - u32SubStart);
7928             } /* NumberOfSubmodules */
7929 
7930             proto_item_set_len(module_item, offset - u32ModuleStart);
7931         }
7932 
7933         proto_item_set_len(api_item, offset - u32ApiStart);
7934     }
7935 
7936 
7937     return offset;
7938 
7939 }
7940 
7941 static const char *
decode_ARType_spezial(guint16 ARType,guint16 ARAccess)7942 decode_ARType_spezial(guint16 ARType, guint16 ARAccess)
7943 {
7944     if (ARType == 0x0001)
7945         return ("IO Controller AR");
7946     else if (ARType == 0x0003)
7947         return("IO Controller AR");
7948     else if (ARType == 0x0010)
7949         return("IO Controller AR (RT_CLASS_3)");
7950     else if (ARType == 0x0020)
7951         return("IO Controller AR (sysred/CiR)");
7952     else if (ARType == 0x0006)
7953     {
7954         if (ARAccess) /*TRUE */
7955             return("DeviceAccess AR");
7956         else
7957             return("IO Supervisor AR");
7958     }
7959     else
7960         return("reserved");
7961 }
7962 
7963 /* dissect the ARBlockReq */
7964 static int
dissect_ARBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t ** ar)7965 dissect_ARBlockReq_block(tvbuff_t *tvb, int offset,
7966     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
7967     pnio_ar_t ** ar)
7968 {
7969     guint16    u16ARType;
7970     guint32    u32ARProperties;
7971     gboolean   have_aruuid = FALSE;
7972     e_guid_t   aruuid;
7973     e_guid_t   uuid;
7974     guint16    u16SessionKey;
7975     guint8     mac[6];
7976     guint16    u16TimeoutFactor;
7977     guint16    u16UDPRTPort;
7978     guint16    u16NameLength;
7979     char      *pStationName;
7980     pnio_ar_t *par;
7981     proto_item          *sub_item;
7982     proto_tree          *sub_tree;
7983     guint16             u16ArNumber;
7984     guint16             u16ArResource;
7985     guint16             u16ArReserved;
7986     proto_item          *sub_item_selector;
7987     proto_tree          *sub_tree_selector;
7988     conversation_t      *conversation;
7989     apduStatusSwitch    *apdu_status_switch = NULL;
7990 
7991     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
7992         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
7993             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
7994         return offset;
7995     }
7996 
7997     u32ARProperties = ((drep[0] & DREP_LITTLE_ENDIAN)
7998             ? tvb_get_letohl (tvb, offset + 2 + 16 +2 + 6 +12)
7999             : tvb_get_ntohl (tvb, offset + 2 + 16 +2 + 6 +12));
8000 
8001     u16ARType = ((drep[0] & DREP_LITTLE_ENDIAN)
8002                 ? tvb_get_letohs (tvb, offset)
8003                 : tvb_get_ntohs (tvb, offset));
8004 
8005     if (tree) {
8006         proto_tree_add_string_format(tree, hf_pn_io_artype_req, tvb, offset, 2,
8007                         "ARType", "ARType: (0x%04x) %s ",
8008                         u16ARType, decode_ARType_spezial(u16ARType, u32ARProperties));
8009     }
8010     offset = offset + 2;
8011 
8012     if (u16ARType == 0x0020)
8013     {
8014         dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &aruuid);
8015 
8016         sub_item = proto_tree_add_item(tree, hf_pn_io_ar_uuid, tvb, offset, 16, ENC_NA);
8017         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_info);
8018 
8019         proto_tree_add_item(sub_tree, hf_pn_io_ar_discriminator, tvb, offset, 6, ENC_NA);
8020         offset += 6;
8021 
8022         proto_tree_add_item(sub_tree, hf_pn_io_ar_configid, tvb, offset, 8, ENC_NA);
8023         offset += 8;
8024 
8025         sub_item_selector = proto_tree_add_item(sub_tree, hf_pn_io_ar_selector, tvb, offset, 2, ENC_BIG_ENDIAN);
8026         sub_tree_selector = proto_item_add_subtree(sub_item_selector, ett_pn_io_ar_info);
8027         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arnumber, &u16ArNumber);
8028         dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arresource, &u16ArResource);
8029         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arreserved, &u16ArReserved);
8030 
8031         /* When ARType==IOCARSR, then find or create conversation for this frame */
8032         if (!PINFO_FD_VISITED(pinfo)) {
8033             /* Get current conversation endpoints using MAC addresses */
8034             conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_UDP, 0, 0, 0);
8035             if (conversation == NULL) {
8036                 /* Create new conversation, if no "Ident OK" frame as been dissected yet!
8037                  * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
8038                  * All conversations are based on Device MAC as addr1 */
8039                 conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_UDP, 0, 0, 0);
8040             }
8041 
8042             /* Try to get apdu status switch information from the conversation */
8043             apdu_status_switch = (apduStatusSwitch*)conversation_get_proto_data(conversation, proto_pn_io_apdu_status);
8044 
8045             /* If apdu status switch is null, then fill it*/
8046             /* If apdu status switch is not null, then update it*/
8047             if (apdu_status_switch == NULL) {
8048                 /* apdu status switch information is valid for whole file*/
8049                 apdu_status_switch = wmem_new0(wmem_file_scope(), apduStatusSwitch);
8050                 copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr));
8051                 copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr));
8052                 apdu_status_switch->isRedundancyActive = TRUE;
8053                 conversation_add_proto_data(conversation, proto_pn_io_apdu_status, apdu_status_switch);
8054             }
8055             else {
8056                 copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr));
8057                 copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr));
8058                 apdu_status_switch->isRedundancyActive = TRUE;
8059             }
8060         }
8061     }
8062     else
8063     {
8064         offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8065             hf_pn_io_ar_uuid, &aruuid);
8066         have_aruuid = TRUE;
8067     }
8068 
8069     if (!PINFO_FD_VISITED(pinfo)) {
8070         pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num);
8071     }
8072 
8073     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8074                         hf_pn_io_sessionkey, &u16SessionKey);
8075     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8076                         hf_pn_io_cminitiator_macadd, mac);
8077     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8078                         hf_pn_io_cminitiator_objectuuid, &uuid);
8079 
8080 
8081     offset = dissect_ARProperties(tvb, offset, pinfo, tree, item, drep);
8082 
8083     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8084                         hf_pn_io_cminitiator_activitytimeoutfactor, &u16TimeoutFactor);   /* XXX - special values */
8085     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8086                         hf_pn_io_cminitiator_udprtport, &u16UDPRTPort);
8087     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8088                         hf_pn_io_station_name_length, &u16NameLength);
8089 
8090     proto_tree_add_item_ret_display_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA, pinfo->pool, &pStationName);
8091     offset += u16NameLength;
8092 
8093     proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x, Station:%s",
8094         decode_ARType_spezial(u16ARType, u32ARProperties),
8095         u16SessionKey,
8096         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
8097         u16UDPRTPort,
8098         pStationName);
8099 
8100     if (have_aruuid) {
8101         par = pnio_ar_find_by_aruuid(pinfo, &aruuid);
8102         if (par == NULL) {
8103             par = pnio_ar_new(&aruuid);
8104             memcpy( (void *) (&par->controllermac), mac, sizeof(par->controllermac));
8105             par->arType = u16ARType; /* store AR-type for filter generation */
8106             /*strncpy( (char *) (&par->controllername), pStationName, sizeof(par->controllername));*/
8107         } else {
8108             /*expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "ARBlockReq: AR already existing!");*/
8109         }
8110         *ar = par;
8111     } else {
8112         *ar = NULL;
8113     }
8114 
8115     return offset;
8116 }
8117 
8118 
8119 /* dissect the ARBlockRes */
8120 static int
dissect_ARBlockRes_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t ** ar)8121 dissect_ARBlockRes_block(tvbuff_t *tvb, int offset,
8122     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8123     pnio_ar_t **ar)
8124 {
8125     guint16    u16ARType;
8126     e_guid_t   uuid;
8127     guint16    u16SessionKey;
8128     guint8     mac[6];
8129     guint16    u16UDPRTPort;
8130     pnio_ar_t *par;
8131 
8132     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8133         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8134             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8135         return offset;
8136     }
8137 
8138     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8139                         hf_pn_io_ar_type, &u16ARType);
8140     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8141                         hf_pn_io_ar_uuid, &uuid);
8142 
8143 
8144     if (!PINFO_FD_VISITED(pinfo)) {
8145         pn_init_append_aruuid_frame_setup_list(uuid, pinfo->num);
8146     }
8147 
8148     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8149                         hf_pn_io_sessionkey, &u16SessionKey);
8150     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8151                         hf_pn_io_cmresponder_macadd, mac);
8152     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8153                         hf_pn_io_cmresponder_udprtport, &u16UDPRTPort);
8154 
8155     proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x",
8156         val_to_str(u16ARType, pn_io_ar_type, "0x%x"),
8157         u16SessionKey,
8158         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
8159         u16UDPRTPort);
8160 
8161     /* The value NIL indicates the usage of the implicit AR*/
8162     par = pnio_ar_find_by_aruuid(pinfo, &uuid);
8163     if (par != NULL) {
8164         memcpy( (void *) (&par->devicemac), mac, sizeof(par->controllermac));
8165     }
8166     *ar = par;
8167 
8168     return offset;
8169 }
8170 
8171 
8172 /* dissect the IOCRBlockReq */
8173 static int
dissect_IOCRBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t * ar)8174 dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset,
8175     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8176     pnio_ar_t *ar)
8177 {
8178     guint16     u16IOCRType;
8179     guint16     u16IOCRReference;
8180     guint16     u16LT;
8181     guint16     u16DataLength;
8182     guint16     u16FrameID;
8183     guint16     u16SendClockFactor;
8184     guint16     u16ReductionRatio;
8185     guint16     u16Phase;
8186     guint16     u16Sequence;
8187     guint32     u32FrameSendOffset;
8188     guint16     u16WatchdogFactor;
8189     guint16     u16DataHoldFactor;
8190     guint16     u16IOCRTagHeader;
8191     guint8      mac[6];
8192     guint16     u16NumberOfAPIs;
8193     guint32     u32Api;
8194     guint16     u16NumberOfIODataObjects;
8195     guint16     u16SlotNr;
8196     guint16     u16SubslotNr;
8197     guint16     u16IODataObjectFrameOffset;
8198     guint16     u16NumberOfIOCS;
8199     guint16     u16IOCSFrameOffset;
8200     proto_item *api_item;
8201     proto_tree *api_tree;
8202     guint32     u32ApiStart;
8203     guint16     u16Tmp;
8204     proto_item *sub_item;
8205     proto_tree *sub_tree;
8206     guint32     u32SubStart;
8207 
8208     conversation_t    *conversation;
8209     stationInfo       *station_info = NULL;
8210     iocsObject        *iocs_object;
8211     iocsObject        *cmp_iocs_object;
8212     ioDataObject      *io_data_object;
8213     ioDataObject      *cmp_io_data_object;
8214     wmem_list_frame_t *frame;
8215     wmem_list_t       *iocs_list;
8216 
8217     ARUUIDFrame       *current_aruuid_frame = NULL;
8218     guint32            current_aruuid = 0;
8219 
8220     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8221         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8222             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8223         return offset;
8224     }
8225 
8226     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8227                         hf_pn_io_iocr_type, &u16IOCRType);
8228     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8229                         hf_pn_io_iocr_reference, &u16IOCRReference);
8230     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8231                         hf_pn_io_lt, &u16LT);
8232 
8233         offset = dissect_IOCRProperties(tvb, offset, pinfo, tree, drep);
8234 
8235     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8236                         hf_pn_io_data_length, &u16DataLength);
8237     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8238                         hf_pn_io_frame_id, &u16FrameID);
8239     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8240                         hf_pn_io_send_clock_factor, &u16SendClockFactor);
8241     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8242                         hf_pn_io_reduction_ratio, &u16ReductionRatio);
8243     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8244                         hf_pn_io_phase, &u16Phase);
8245     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8246                         hf_pn_io_sequence, &u16Sequence);
8247     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8248                         hf_pn_io_frame_send_offset, &u32FrameSendOffset);
8249     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8250                         hf_pn_io_watchdog_factor, &u16WatchdogFactor);
8251     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8252                         hf_pn_io_data_hold_factor, &u16DataHoldFactor);
8253     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8254                         hf_pn_io_iocr_tag_header, &u16IOCRTagHeader);
8255     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8256                         hf_pn_io_iocr_multicast_mac_add, mac);
8257 
8258     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8259                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
8260 
8261     proto_item_append_text(item, ": %s, Ref:0x%x, Len:%u, FrameID:0x%x, Clock:%u, Ratio:%u, Phase:%u APIs:%u",
8262         val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"),
8263         u16IOCRReference, u16DataLength, u16FrameID,
8264         u16SendClockFactor, u16ReductionRatio, u16Phase, u16NumberOfAPIs);
8265 
8266     while (u16NumberOfAPIs--) {
8267         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
8268         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
8269         u32ApiStart = offset;
8270 
8271         /* API */
8272         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
8273                             hf_pn_io_api, &u32Api);
8274         /* NumberOfIODataObjects */
8275         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
8276                             hf_pn_io_number_of_io_data_objects, &u16NumberOfIODataObjects);
8277 
8278         /* Set global Variant for Number of IO Data Objects */
8279         /* Notice: Handle Input & Output seperate!!! */
8280         if (!PINFO_FD_VISITED(pinfo)) {
8281             /* Get current conversation endpoints using MAC addresses */
8282             conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
8283             if (conversation == NULL) {
8284                 /* Create new conversation, if no "Ident OK" frame as been dissected yet!
8285                  * Need to switch dl_src & dl_dst, as Connect Request is sent by controller and not by device.
8286                  * All conversations are based on Device MAC as addr1 */
8287                 conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
8288             }
8289 
8290             current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
8291 
8292             if (current_aruuid_frame != NULL) {
8293                 current_aruuid = current_aruuid_frame->aruuid.data1;
8294                 if (u16IOCRType == PN_INPUT_CR) {
8295                     current_aruuid_frame->inputframe = u16FrameID;
8296                 }
8297             }
8298 
8299             station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
8300             if (station_info == NULL) {
8301                 station_info = wmem_new0(wmem_file_scope(), stationInfo);
8302                 init_pnio_rtc1_station(station_info);
8303                 conversation_add_proto_data(conversation, current_aruuid, station_info);
8304             }
8305             station_info->ioDataObjectNr += u16NumberOfIODataObjects;
8306 
8307             pn_find_dcp_station_info(station_info, conversation);
8308         }
8309 
8310         u16Tmp = u16NumberOfIODataObjects;
8311         while (u16Tmp--) {
8312             sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_data_object, tvb, offset, 0, ENC_NA);
8313             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_data_object);
8314             u32SubStart = offset;
8315 
8316             /* SlotNumber */
8317             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8318                                 hf_pn_io_slot_nr, &u16SlotNr);
8319             /* Subslotnumber */
8320             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8321                                 hf_pn_io_subslot_nr, &u16SubslotNr);
8322             /* IODataObjectFrameOffset */
8323             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8324                                 hf_pn_io_io_data_object_frame_offset, &u16IODataObjectFrameOffset);
8325 
8326             proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u",
8327                 u16SlotNr, u16SubslotNr, u16IODataObjectFrameOffset);
8328 
8329             proto_item_set_len(sub_item, offset - u32SubStart);
8330 
8331             if (!PINFO_FD_VISITED(pinfo) && station_info != NULL) {
8332                 io_data_object = wmem_new0(wmem_file_scope(), ioDataObject);
8333                 io_data_object->slotNr = u16SlotNr;
8334                 io_data_object->subSlotNr = u16SubslotNr;
8335                 io_data_object->frameOffset = u16IODataObjectFrameOffset;
8336                 /* initial - Will be added later with Write Request */
8337                 io_data_object->f_dest_adr = 0;
8338                 io_data_object->f_par_crc1 = 0;
8339                 io_data_object->f_src_adr = 0;
8340                 io_data_object->f_crc_seed = FALSE;
8341                 io_data_object->f_crc_len = 0;
8342                 /* Reset as a PNIO Connect Request of a known module appears */
8343                 io_data_object->last_sb_cb = 0;
8344                 io_data_object->lastToggleBit = 0;
8345 
8346                 if (u16IOCRType == PN_INPUT_CR) {
8347                     iocs_list = station_info->ioobject_data_in;
8348                 }
8349                 else {
8350                     iocs_list = station_info->ioobject_data_out;
8351                 }
8352 
8353                 for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
8354                     cmp_io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
8355                     if (cmp_io_data_object->slotNr == u16SlotNr && cmp_io_data_object->subSlotNr == u16SubslotNr) {
8356                         /* Found identical existing object */
8357                         break;
8358                     }
8359                 }
8360 
8361                 if (frame == NULL) {
8362                     /* new io_object data incoming */
8363                     wmem_list_append(iocs_list, io_data_object);
8364                 }
8365             }
8366         }
8367 
8368         /* NumberOfIOCS */
8369         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
8370                             hf_pn_io_number_of_iocs, &u16NumberOfIOCS);
8371 
8372         /* Set global Vairant for NumberOfIOCS */
8373         if (!PINFO_FD_VISITED(pinfo)) {
8374             if (station_info != NULL) {
8375                 station_info->iocsNr = u16NumberOfIOCS;
8376             }
8377         }
8378 
8379         u16Tmp = u16NumberOfIOCS;
8380         while (u16Tmp--) {
8381             sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_cs, tvb, offset, 0, ENC_NA);
8382             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_cs);
8383             u32SubStart = offset;
8384 
8385             /* SlotNumber */
8386             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8387                                 hf_pn_io_slot_nr, &u16SlotNr);
8388             /* Subslotnumber */
8389             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8390                                 hf_pn_io_subslot_nr, &u16SubslotNr);
8391             /* IOCSFrameOffset */
8392             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
8393                                 hf_pn_io_iocs_frame_offset, &u16IOCSFrameOffset);
8394 
8395             proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u",
8396                 u16SlotNr, u16SubslotNr, u16IOCSFrameOffset);
8397 
8398             proto_item_set_len(sub_item, offset - u32SubStart);
8399 
8400             if (!PINFO_FD_VISITED(pinfo)) {
8401                 if (station_info != NULL) {
8402                     if (u16IOCRType == PN_INPUT_CR) {
8403                         iocs_list = station_info->iocs_data_in;
8404                     }
8405                     else {
8406                         iocs_list = station_info->iocs_data_out;
8407                     }
8408 
8409                     for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
8410                         cmp_iocs_object = (iocsObject*)wmem_list_frame_data(frame);
8411                         if (cmp_iocs_object->slotNr == u16SlotNr && cmp_iocs_object->subSlotNr == u16SubslotNr) {
8412                             /* Found identical existing object */
8413                             break;
8414                         }
8415                     }
8416 
8417                     if (frame == NULL) {
8418                         /* new iocs_object data incoming */
8419                         iocs_object = wmem_new(wmem_file_scope(), iocsObject);
8420                         iocs_object->slotNr = u16SlotNr;
8421                         iocs_object->subSlotNr = u16SubslotNr;
8422                         iocs_object->frameOffset = u16IOCSFrameOffset;
8423                         wmem_list_append(iocs_list, iocs_object);
8424                     }
8425                 }
8426             }
8427         }
8428 
8429         proto_item_append_text(api_item, ": 0x%x, NumberOfIODataObjects: %u NumberOfIOCS: %u",
8430             u32Api, u16NumberOfIODataObjects, u16NumberOfIOCS);
8431 
8432         proto_item_set_len(api_item, offset - u32ApiStart);
8433     }
8434 
8435     if (ar != NULL) {
8436         switch (u16IOCRType) {
8437         case(1): /* Input CR */
8438             if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) {
8439                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID);
8440             }
8441             ar->inputframeid = u16FrameID;
8442             break;
8443         case(2): /* Output CR */
8444 #if 0
8445             /* will usually contain 0xffff here because the correct framid will be given in the connect.Cnf */
8446             if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) {
8447                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID);
8448             }
8449             ar->outputframeid = u16FrameID;
8450 #endif
8451             break;
8452         default:
8453             expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockReq: IOCRType %u undecoded!", u16IOCRType);
8454         }
8455     } else {
8456         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockReq: no corresponding AR found!");
8457     }
8458 
8459     return offset;
8460 }
8461 
8462 
8463 /* dissect the AlarmCRBlockReq */
8464 static int
dissect_AlarmCRBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t * ar)8465 dissect_AlarmCRBlockReq_block(tvbuff_t *tvb, int offset,
8466     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8467     pnio_ar_t *ar)
8468 {
8469     guint16     u16AlarmCRType;
8470     guint16     u16LT;
8471     guint32     u32AlarmCRProperties;
8472     guint16     u16RTATimeoutFactor;
8473     guint16     u16RTARetries;
8474     guint16     u16LocalAlarmReference;
8475     guint16     u16MaxAlarmDataLength;
8476     guint16     u16AlarmCRTagHeaderHigh;
8477     guint16     u16AlarmCRTagHeaderLow;
8478     proto_item *sub_item;
8479     proto_tree *sub_tree;
8480 
8481 
8482     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8483         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8484             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8485         return offset;
8486     }
8487 
8488     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8489                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
8490     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8491                         hf_pn_io_lt, &u16LT);
8492 
8493     sub_item = proto_tree_add_item(tree, hf_pn_io_alarmcr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
8494     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_alarmcr_properties);
8495     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8496                         hf_pn_io_alarmcr_properties_reserved, &u32AlarmCRProperties);
8497     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8498                         hf_pn_io_alarmcr_properties_transport, &u32AlarmCRProperties);
8499     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8500                         hf_pn_io_alarmcr_properties_priority, &u32AlarmCRProperties);
8501 
8502     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8503                         hf_pn_io_rta_timeoutfactor, &u16RTATimeoutFactor);
8504     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8505                         hf_pn_io_rta_retries, &u16RTARetries);
8506     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8507                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
8508     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8509                         hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength);
8510     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8511                         hf_pn_io_alarmcr_tagheaderhigh, &u16AlarmCRTagHeaderHigh);
8512     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8513                         hf_pn_io_alarmcr_tagheaderlow, &u16AlarmCRTagHeaderLow);
8514 
8515     proto_item_append_text(item, ": %s, LT:0x%x, TFactor:%u, Retries:%u, Ref:0x%x, Len:%u Tag:0x%x/0x%x",
8516         val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"),
8517         u16LT, u16RTATimeoutFactor, u16RTARetries, u16LocalAlarmReference, u16MaxAlarmDataLength,
8518         u16AlarmCRTagHeaderHigh, u16AlarmCRTagHeaderLow);
8519 
8520     if (ar != NULL) {
8521         if (ar->controlleralarmref != 0xffff && ar->controlleralarmref != u16LocalAlarmReference) {
8522             expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockReq: local alarm ref changed from %u to %u!", ar->controlleralarmref, u16LocalAlarmReference);
8523         }
8524         ar->controlleralarmref = u16LocalAlarmReference;
8525     } else {
8526         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockReq: no corresponding AR found!");
8527     }
8528 
8529     return offset;
8530 }
8531 
8532 
8533 /* dissect the AlarmCRBlockRes */
8534 static int
dissect_AlarmCRBlockRes_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t * ar)8535 dissect_AlarmCRBlockRes_block(tvbuff_t *tvb, int offset,
8536     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8537     pnio_ar_t *ar)
8538 {
8539     guint16 u16AlarmCRType;
8540     guint16 u16LocalAlarmReference;
8541     guint16 u16MaxAlarmDataLength;
8542 
8543 
8544     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8545         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8546             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8547         return offset;
8548     }
8549 
8550     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8551                         hf_pn_io_alarmcr_type, &u16AlarmCRType);
8552     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8553                         hf_pn_io_localalarmref, &u16LocalAlarmReference);
8554     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8555                         hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength);
8556 
8557     proto_item_append_text(item, ": %s, Ref:0x%04x, MaxDataLen:%u",
8558         val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"),
8559         u16LocalAlarmReference, u16MaxAlarmDataLength);
8560 
8561     if (ar != NULL) {
8562         if (ar->devicealarmref != 0xffff && ar->devicealarmref != u16LocalAlarmReference) {
8563             expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockRes: local alarm ref changed from %u to %u!", ar->devicealarmref, u16LocalAlarmReference);
8564         }
8565         ar->devicealarmref = u16LocalAlarmReference;
8566     } else {
8567         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockRes: no corresponding AR found!");
8568     }
8569 
8570     return offset;
8571 }
8572 
8573 /* dissect the ARServerBlock */
8574 static int
dissect_ARServerBlock(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)8575 dissect_ARServerBlock(tvbuff_t *tvb, int offset,
8576     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
8577 {
8578     guint16  u16NameLength, u16padding;
8579 
8580     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8581         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8582             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8583         return offset;
8584     }
8585 
8586     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8587                         hf_pn_io_station_name_length, &u16NameLength);
8588 
8589     proto_tree_add_item (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA);
8590     offset += u16NameLength;
8591     /* Padding to next 4 byte alignment in this block */
8592     u16padding = u16BodyLength - (2 + u16NameLength);
8593     if (u16padding > 0)
8594         offset = dissect_pn_padding(tvb, offset, pinfo, tree, u16padding);
8595     return offset;
8596 }
8597 
8598 
8599 
8600 /* dissect the IOCRBlockRes */
8601 static int
dissect_IOCRBlockRes_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,pnio_ar_t * ar)8602 dissect_IOCRBlockRes_block(tvbuff_t *tvb, int offset,
8603     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8604     pnio_ar_t *ar)
8605 {
8606     guint16 u16IOCRType;
8607     guint16 u16IOCRReference;
8608     guint16 u16FrameID;
8609 
8610     ARUUIDFrame *current_aruuid_frame = NULL;
8611 
8612     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8613         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8614             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8615         return offset;
8616     }
8617 
8618     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8619                         hf_pn_io_iocr_type, &u16IOCRType);
8620     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8621                         hf_pn_io_iocr_reference, &u16IOCRReference);
8622     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8623                         hf_pn_io_frame_id, &u16FrameID);
8624 
8625     proto_item_append_text(item, ": %s, Ref:0x%04x, FrameID:0x%04x",
8626         val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"),
8627         u16IOCRReference, u16FrameID);
8628 
8629     if (ar != NULL) {
8630         switch (u16IOCRType) {
8631         case(1): /* Input CR */
8632             if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) {
8633                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID);
8634             }
8635             ar->inputframeid = u16FrameID;
8636             break;
8637         case(2): /* Output CR */
8638             if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) {
8639                 expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID);
8640             }
8641             ar->outputframeid = u16FrameID;
8642             break;
8643         default:
8644             expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockRes: IOCRType %u undecoded!", u16IOCRType);
8645         }
8646     } else {
8647         expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockRes: no corresponding AR found!");
8648     }
8649 
8650     if (!PINFO_FD_VISITED(pinfo)) {
8651         current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
8652         if (current_aruuid_frame != NULL) {
8653             if (u16IOCRType == 1) {
8654                 current_aruuid_frame->inputframe = u16FrameID;
8655             }
8656             else if (u16IOCRType == 2) {
8657                 current_aruuid_frame->outputframe = u16FrameID;
8658             }
8659         }
8660     }
8661 
8662     return offset;
8663 }
8664 
8665 
8666 
8667 /* dissect the MCRBlockReq */
8668 static int
dissect_MCRBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)8669 dissect_MCRBlockReq_block(tvbuff_t *tvb, int offset,
8670     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8671 {
8672     guint16  u16IOCRReference;
8673     guint32  u32AddressResolutionProperties;
8674     guint16  u16MCITimeoutFactor;
8675     guint16  u16NameLength;
8676     char    *pStationName;
8677 
8678 
8679     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8680         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8681             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8682         return offset;
8683     }
8684 
8685     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8686                         hf_pn_io_iocr_reference, &u16IOCRReference);
8687     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
8688                         hf_pn_io_address_resolution_properties, &u32AddressResolutionProperties);
8689     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8690                         hf_pn_io_mci_timeout_factor, &u16MCITimeoutFactor);
8691 
8692     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8693                         hf_pn_io_station_name_length, &u16NameLength);
8694 
8695     proto_tree_add_item_ret_display_string (tree, hf_pn_io_provider_station_name, tvb, offset, u16NameLength, ENC_ASCII|ENC_NA, pinfo->pool, &pStationName);
8696     offset += u16NameLength;
8697 
8698     proto_item_append_text(item, ", CRRef:%u, Properties:0x%x, TFactor:%u, Station:%s",
8699         u16IOCRReference, u32AddressResolutionProperties, u16MCITimeoutFactor, pStationName);
8700 
8701     return offset;
8702 }
8703 
8704 
8705 
8706 /* dissect the SubFrameBlock */
8707 static int
dissect_SubFrameBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)8708 dissect_SubFrameBlock_block(tvbuff_t *tvb, int offset,
8709     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8710     guint16 u16BodyLength)
8711 {
8712     guint16     u16IOCRReference;
8713     guint8      mac[6];
8714     guint32     u32SubFrameData;
8715     guint16     u16Tmp;
8716     proto_item *sub_item;
8717     proto_tree *sub_tree;
8718 
8719 
8720     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8721         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8722             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8723         return offset;
8724     }
8725     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8726 
8727     /* IOCRReference */
8728     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8729                         hf_pn_io_iocr_reference, &u16IOCRReference);
8730 
8731     /* CMInitiatorMACAdd */
8732     offset = dissect_pn_mac(tvb, offset, pinfo, tree,
8733                         hf_pn_io_cminitiator_macadd, mac);
8734 
8735     /* SubFrameData n*32 */
8736     u16BodyLength -= 10;
8737     u16Tmp = u16BodyLength;
8738     do {
8739         sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN);
8740         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data);
8741         /* 31-16 reserved_2 */
8742         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8743                             hf_pn_io_subframe_data_reserved2, &u32SubFrameData);
8744         /* 15- 8 DataLength */
8745         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8746                             hf_pn_io_subframe_data_length, &u32SubFrameData);
8747         /*    7 reserved_1 */
8748         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8749                             hf_pn_io_subframe_data_reserved1, &u32SubFrameData);
8750         /*  6-0 Position */
8751         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8752                             hf_pn_io_subframe_data_position, &u32SubFrameData);
8753 
8754         proto_item_append_text(sub_item, ", Length:%u, Pos:%u",
8755             (u32SubFrameData & 0x0000FF00) >> 8, u32SubFrameData & 0x0000007F);
8756     } while (u16Tmp -= 4);
8757 
8758     proto_item_append_text(item, ", CRRef:%u, %u*Data",
8759         u16IOCRReference, u16BodyLength/4);
8760 
8761     return offset;
8762 }
8763 
8764 /* dissect the (PD)SubFrameBlock  0x022B */
8765 static int
dissect_PDSubFrameBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)8766 dissect_PDSubFrameBlock_block(tvbuff_t *tvb, int offset,
8767     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8768     guint16 u16BodyLength)
8769 {
8770     guint32 u32SFIOCRProperties;
8771     guint32 u32SubFrameData;
8772     guint16 u16FrameID;
8773     proto_item *sub_item;
8774     proto_tree *sub_tree;
8775     guint16 u16RemainingLength;
8776 
8777     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8778         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8779             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8780         return offset;
8781     }
8782     /* FrameID */
8783     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_id, &u16FrameID);
8784     /* SFIOCRProperties */
8785     sub_item = proto_tree_add_item(tree, hf_pn_io_SFIOCRProperties, tvb, offset, PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH, ENC_BIG_ENDIAN);
8786     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_SFIOCRProperties);
8787 
8788     /*    dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties, &u32SFIOCRProperties); */
8789     /* Bit 31: SFIOCRProperties.SFCRC16 */
8790     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_SFCRC16, &u32SFIOCRProperties);
8791 
8792     /* Bit 30: SFIOCRProperties.DFPRedundantPathLayout */
8793     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout, &u32SFIOCRProperties);
8794     /* Bit 29: SFIOCRProperties.DFPRedundantPathLayout */
8795     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPType, &u32SFIOCRProperties);
8796     /* Bit 28 - 29: SFIOCRProperties.reserved_2 */
8797     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_2, &u32SFIOCRProperties);
8798     /* Bit 24 - 27: SFIOCRProperties.reserved_1 */
8799     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_1, &u32SFIOCRProperties);
8800     /* Bit 16 - 23: SFIOCRProperties.DFPmode */
8801     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPmode, &u32SFIOCRProperties);
8802     /*  Bit 8 - 15: SFIOCRProperties.RestartFactorForDistributedWD */
8803     /*      0x00           Mandatory    No restart delay necessary
8804             0x01 - 0x09    Optional    Less than 1 s restart delay
8805             0x0A - 0x50    Mandatory    1 s to 8 s restart delay
8806             0x51 - 0xFF    Optional    More than 8 s restart delay */
8807     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_RestartFactorForDistributedWD, &u32SFIOCRProperties);
8808     /*  bit 0..7 SFIOCRProperties.DistributedWatchDogFactor */
8809     offset = /* it is the last one, so advance! */
8810         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_DistributedWatchDogFactor, &u32SFIOCRProperties);
8811 
8812     /* SubframeData */
8813     u16RemainingLength = u16BodyLength - PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH - PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH;
8814     while (u16RemainingLength >= PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH)
8815     {
8816         guint8 Position,
8817                DataLength;
8818         sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN);
8819         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data);
8820 
8821         /* Bit 0 - 6: SubframeData.Position */
8822         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_position, &u32SubFrameData);
8823         /* Bit 7: SubframeData.reserved_1 */
8824         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved1, &u32SubFrameData);
8825         /* Bit 8 - 15: SubframeData.dataLength */
8826         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_length, &u32SubFrameData);
8827         /* Bit 16 - 31: SubframeData.reserved_2 */
8828         offset =
8829             dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved2, &u32SubFrameData);
8830         Position  = (guint8) (u32SubFrameData & 0x7F);       /* the lower 6 bits */
8831         DataLength =(guint8) ((u32SubFrameData >>8) & 0x0ff); /* bit 8 to 15 */
8832         proto_item_append_text(sub_item, ", Length:%u (0x%x), Pos:%u",
8833             DataLength,DataLength, Position);
8834         u16RemainingLength = u16RemainingLength - 4;
8835     }
8836     return offset;
8837 }
8838 
8839 
8840 /* dissect the IRInfoBlock */
8841 static int
dissect_IRInfoBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength _U_)8842 dissect_IRInfoBlock_block(tvbuff_t *tvb, int offset,
8843     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8844     guint16 u16BodyLength _U_)
8845 {
8846     guint16  u16NumberOfIOCR;
8847     guint16  u16SubframeOffset;
8848     guint32  u32SubframeData;
8849     guint16  u16IOCRReference;
8850     e_guid_t IRDataUUID;
8851 
8852 
8853     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8854         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8855             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8856         return offset;
8857     }
8858     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8859 
8860     offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep,
8861                         hf_pn_io_IRData_uuid, &IRDataUUID);
8862 
8863     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8864 
8865     /* Numbers of IOCRs */
8866     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
8867                         hf_pn_io_number_of_iocrs, &u16NumberOfIOCR);
8868 
8869     while (u16NumberOfIOCR--)
8870     {   /* IOCRReference */
8871         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference);
8872 
8873         /* SubframeOffset 16 */
8874         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeOffset, &u16SubframeOffset);
8875 
8876         /* SubframeData  32 */
8877         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeData, &u32SubframeData);
8878     }
8879     return offset;
8880 }
8881 
8882 /* dissect the SRInfoBlock */
8883 static int
dissect_SRInfoBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength _U_)8884 dissect_SRInfoBlock_block(tvbuff_t *tvb, int offset,
8885     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8886     guint16 u16BodyLength _U_)
8887 {
8888     guint16 u16RedundancyDataHoldFactor;
8889     guint32 u32sr_properties;
8890     guint8 u8SRPropertiesMode;
8891     proto_item *sub_item;
8892     proto_tree *sub_tree;
8893 
8894     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8895         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8896             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8897         return offset;
8898     }
8899     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_RedundancyDataHoldFactor, &u16RedundancyDataHoldFactor);
8900 
8901     u32sr_properties = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN);
8902     sub_item = proto_tree_add_item(tree, hf_pn_io_sr_properties, tvb, offset, 4, ENC_BIG_ENDIAN);
8903     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_sr_properties);
8904 
8905     u8SRPropertiesMode = (guint8)((u32sr_properties >> 2) & 0x01);
8906 
8907     /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 1 */
8908     if (u8SRPropertiesMode)
8909     {
8910         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8911             hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1, &u32sr_properties);
8912     }
8913     /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 0 */
8914     else
8915     {
8916         dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
8917             hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0, &u32sr_properties);
8918     }
8919     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_1, &u32sr_properties);
8920     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Mode, &u32sr_properties);
8921 
8922     dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_2, &u32sr_properties);
8923 
8924     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_3, &u32sr_properties);
8925     return offset;
8926 }
8927 
8928 /* dissect the RSInfoBlock */
8929 static int
dissect_RSInfoBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength _U_)8930 dissect_RSInfoBlock_block(tvbuff_t *tvb, int offset,
8931     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
8932     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_)
8933 {
8934     guint32 u32RSProperties;
8935 
8936     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8937         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8938             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8939         return offset;
8940     }
8941 
8942     /* Padding 2 + 2 + 1 + 1 = 6 */
8943     /* Therefore we need 2 byte padding to make the block u32 aligned */
8944     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
8945 
8946     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties, &u32RSProperties);
8947     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_alarm_transport, &u32RSProperties);
8948     dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved1, &u32RSProperties);
8949     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved2, &u32RSProperties);
8950 
8951     return offset;
8952 }
8953 
8954 /* dissect the PDIRSubframeData block  0x022a */
8955 static int
dissect_PDIRSubframeData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)8956 dissect_PDIRSubframeData_block(tvbuff_t *tvb, int offset,
8957     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
8958 {
8959     guint16     u16NumberOfSubframeBlocks;
8960 
8961     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8962         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8963             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8964         return offset;
8965     }
8966     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_NumberOfSubframeBlocks, &u16NumberOfSubframeBlocks);
8967 
8968     while (u16NumberOfSubframeBlocks --)
8969     {   /* dissect the Subframe Block  */
8970         offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep);
8971     }
8972 
8973     return offset;
8974 }
8975 
8976 static int
dissect_ARVendorBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength _U_)8977 dissect_ARVendorBlockReq_block(tvbuff_t *tvb, int offset,
8978     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
8979     guint16 u16BodyLength _U_)
8980 {
8981     guint16 APStructureIdentifier;
8982     guint32 gu32API;
8983     guint32 guDataBytes;
8984 
8985     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
8986         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
8987             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
8988         return offset;
8989     }
8990     APStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN)
8991                             ? tvb_get_letohs(tvb, offset)
8992                             : tvb_get_ntohs(tvb, offset));
8993 
8994     gu32API = ((drep[0] & DREP_LITTLE_ENDIAN)
8995                 ? tvb_get_letohl(tvb, offset + 2)
8996                 : tvb_get_ntohl (tvb, offset + 2));
8997 
8998     if (tree)
8999     {
9000         if (gu32API == 0)
9001         {
9002             if (APStructureIdentifier <0x8000)
9003             {
9004                 proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_low, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9005             }
9006             else
9007             {
9008                 if (APStructureIdentifier > 0x8000)
9009                 {
9010                     proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_high, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9011                 }
9012                 else /* APStructureIdentifier == 0x8000 */
9013                 {
9014                     proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_is8000, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9015                 }
9016             }
9017         }
9018         else
9019         {
9020             proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_not0, tvb, offset, 2, DREP_ENC_INTEGER(drep));
9021         }
9022         /* API */
9023         proto_tree_add_item(tree, hf_pn_io_api, tvb, offset + 2, 4, DREP_ENC_INTEGER(drep));
9024     }
9025     offset += 6;
9026     if (u16BodyLength < 6 )
9027         return offset; /* there are no user bytes! */
9028     guDataBytes = u16BodyLength - 6;
9029 
9030     dissect_pn_user_data(tvb, offset, pinfo, tree, guDataBytes, "Data ");
9031     return offset;
9032 }
9033 
9034 /* dissect the DataDescription */
9035 static int
dissect_DataDescription(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,ioDataObject * tmp_io_data_object)9036 dissect_DataDescription(tvbuff_t *tvb, int offset,
9037     packet_info *pinfo, proto_tree *tree, guint8 *drep, ioDataObject *tmp_io_data_object)
9038 {
9039     guint16     u16DataDescription;
9040     guint16     u16SubmoduleDataLength;
9041     guint8      u8LengthIOCS;
9042     guint8      u8LengthIOPS;
9043     proto_item *sub_item;
9044     proto_tree *sub_tree;
9045     guint32     u32SubStart;
9046 
9047     conversation_t    *conversation;
9048     stationInfo       *station_info = NULL;
9049     ioDataObject      *io_data_object;
9050     wmem_list_frame_t *frame;
9051     wmem_list_t       *ioobject_list;
9052 
9053     ARUUIDFrame       *current_aruuid_frame = NULL;
9054     guint32            current_aruuid = 0;
9055 
9056     sub_item = proto_tree_add_item(tree, hf_pn_io_data_description_tree, tvb, offset, 0, ENC_NA);
9057     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_data_description);
9058     u32SubStart = offset;
9059 
9060     /* DataDescription */
9061     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9062                     hf_pn_io_data_description, &u16DataDescription);
9063     /* SubmoduleDataLength */
9064     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9065                     hf_pn_io_submodule_data_length, &u16SubmoduleDataLength);
9066     /* LengthIOCS */
9067     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9068                     hf_pn_io_length_iocs, &u8LengthIOCS);
9069     /* LengthIOPS */
9070     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9071                     hf_pn_io_length_iops, &u8LengthIOPS);
9072 
9073     proto_item_append_text(sub_item, ": %s, SubmoduleDataLength: %u, LengthIOCS: %u, u8LengthIOPS: %u",
9074         val_to_str(u16DataDescription, pn_io_data_description, "(0x%x)"),
9075         u16SubmoduleDataLength, u8LengthIOCS, u8LengthIOPS);
9076     proto_item_set_len(sub_item, offset - u32SubStart);
9077 
9078     /* Save new data for IO Data Objects */
9079     if (!PINFO_FD_VISITED(pinfo)) {
9080         /* Get current conversation endpoints using MAC addresses */
9081         conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9082         if (conversation == NULL) {
9083             /* Create new conversation, if no "Ident OK" frame as been dissected yet!
9084              * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
9085              * All conversations are based on Device MAC as addr1 */
9086            conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
9087         }
9088 
9089         current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
9090 
9091         if (current_aruuid_frame != NULL) {
9092             current_aruuid = current_aruuid_frame->aruuid.data1;
9093         }
9094 
9095         station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
9096 
9097         if (station_info != NULL) {
9098             pn_find_dcp_station_info(station_info, conversation);
9099 
9100             if (u16DataDescription == PN_INPUT_DATADESCRITPION) {
9101                 /* INPUT HANDLING */
9102                 ioobject_list = station_info->ioobject_data_in;
9103             }
9104             else {
9105                 /* OUTPUT HANDLING */
9106                 ioobject_list = station_info->ioobject_data_out;
9107             }
9108 
9109             for (frame = wmem_list_head(ioobject_list); frame != NULL; frame = wmem_list_frame_next(frame)) {
9110                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
9111                 if (io_data_object->slotNr == tmp_io_data_object->slotNr && io_data_object->subSlotNr == tmp_io_data_object->subSlotNr) {
9112                     /* Write additional data from dissect_ExpectedSubmoduleBlockReq_block() to corresponding io_data_object */
9113                     io_data_object->moduleIdentNr = tmp_io_data_object->moduleIdentNr;
9114                     io_data_object->subModuleIdentNr = tmp_io_data_object->subModuleIdentNr;
9115                     io_data_object->length = u16SubmoduleDataLength;
9116 
9117                     io_data_object->moduleNameStr = wmem_strdup(wmem_file_scope(), tmp_io_data_object->moduleNameStr);
9118                     io_data_object->profisafeSupported = tmp_io_data_object->profisafeSupported;
9119                     io_data_object->discardIOXS = tmp_io_data_object->discardIOXS;
9120                     io_data_object->amountInGSDML = tmp_io_data_object->amountInGSDML;
9121                     io_data_object->fParameterIndexNr = tmp_io_data_object->fParameterIndexNr;
9122 
9123                     break;
9124                 }
9125             }
9126         }
9127     }
9128 
9129     return offset;
9130 }
9131 
9132 
9133 /* dissect the ExpectedSubmoduleBlockReq */
9134 static int
dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)9135 dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
9136     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9137 {
9138     guint16     u16NumberOfAPIs;
9139     guint32     u32Api;
9140     guint16     u16SlotNr;
9141     guint32     u32ModuleIdentNumber;
9142     guint16     u16ModuleProperties;
9143     guint16     u16NumberOfSubmodules;
9144     guint16     u16SubslotNr;
9145     guint32     u32SubmoduleIdentNumber;
9146     guint16     u16SubmoduleProperties;
9147     proto_item *api_item;
9148     proto_tree *api_tree;
9149     guint32     u32ApiStart;
9150     proto_item *sub_item;
9151     proto_tree *sub_tree;
9152     proto_item *submodule_item;
9153     proto_tree *submodule_tree;
9154     guint32     u32SubStart;
9155 
9156     /* Variable for the search of gsd file */
9157     const char vendorIdStr[] = "VendorID=\"";
9158     const char deviceIdStr[] = "DeviceID=\"";
9159     const char moduleStr[] = "ModuleIdentNumber=\"";
9160     const char subModuleStr[] = "SubmoduleIdentNumber=\"";
9161     const char profisafeStr[] = "PROFIsafeSupported=\"true\"";
9162     const char fParameterStr[] = "<F_ParameterRecordDataItem";
9163     const char fParameterIndexStr[] = "Index=";
9164     const char moduleNameInfo[] = "<Name";
9165     const char moduleValueInfo[] = "Value=\"";
9166 
9167     guint16  searchVendorID = 0;
9168     guint16  searchDeviceID = 0;
9169     gboolean vendorMatch;
9170     gboolean deviceMatch;
9171     conversation_t *conversation;
9172     stationInfo    *station_info = NULL;
9173     ioDataObject   *io_data_object = NULL; /* Used to transfer data to fct. "dissect_DataDescription()" */
9174 
9175     /* Variable for the search of GSD-file */
9176     guint32  read_vendor_id;
9177     guint32  read_device_id;
9178     guint32  read_module_id;
9179     guint32  read_submodule_id;
9180     gboolean gsdmlFoundFlag;
9181     gchar   tmp_moduletext[MAX_NAMELENGTH];
9182     gchar   *convertStr;      /* GSD-file search */
9183     gchar   *pch;             /* helppointer, to save temp. the found Networkpath of GSD-file */
9184     gchar   *puffer;          /* used for fgets() during GSD-file search */
9185     gchar   *temp;            /* used for fgets() during GSD-file search */
9186     gchar   *diropen = NULL;  /* saves the final networkpath to open for GSD-files */
9187     GDir    *dir;
9188     FILE    *fp = NULL;       /* filepointer */
9189     const gchar *filename;    /* saves the found GSD-file name */
9190 
9191     ARUUIDFrame       *current_aruuid_frame = NULL;
9192     guint32            current_aruuid = 0;
9193 
9194     /* Helppointer initial */
9195     convertStr = (gchar*)wmem_alloc(pinfo->pool, MAX_NAMELENGTH);
9196     convertStr[0] = '\0';
9197     pch = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH);
9198     pch[0] = '\0';
9199     puffer = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH);
9200     puffer[0] = '\0';
9201     temp = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH);
9202     temp[0] = '\0';
9203 
9204     /* Initial */
9205     io_data_object = wmem_new0(wmem_file_scope(), ioDataObject);
9206     io_data_object->profisafeSupported = FALSE;
9207     io_data_object->moduleNameStr = (gchar*)wmem_alloc(wmem_file_scope(), MAX_NAMELENGTH);
9208     (void) g_strlcpy(io_data_object->moduleNameStr, "Unknown", MAX_NAMELENGTH);
9209     vendorMatch = FALSE;
9210     deviceMatch = FALSE;
9211     gsdmlFoundFlag = FALSE;
9212 
9213 
9214     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9215         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9216             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9217         return offset;
9218     }
9219 
9220     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9221                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
9222 
9223     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
9224 
9225 
9226     /* Get current conversation endpoints using MAC addresses */
9227     conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9228     if (conversation == NULL) {
9229         /* Create new conversation, if no "Ident OK" frame as been dissected yet!
9230         * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
9231         * All conversations are based on Device MAC as addr1 */
9232         conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
9233     }
9234 
9235     current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
9236 
9237     if (current_aruuid_frame != NULL) {
9238         current_aruuid = current_aruuid_frame->aruuid.data1;
9239     }
9240 
9241     station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
9242 
9243     if (station_info != NULL) {
9244         pn_find_dcp_station_info(station_info, conversation);
9245 
9246         station_info->gsdFound = FALSE;
9247         station_info->gsdPathLength = FALSE;
9248 
9249         /* Set searchVendorID and searchDeviceID for GSDfile search */
9250         searchVendorID = station_info->u16Vendor_id;
9251         searchDeviceID = station_info->u16Device_id;
9252 
9253         /* Use the given GSD-file networkpath of the PNIO-Preference */
9254         if(pnio_ps_networkpath[0] != '\0') {   /* check the length of the given networkpath (array overflow protection) */
9255             station_info->gsdPathLength = TRUE;
9256 
9257             if ((dir = g_dir_open(pnio_ps_networkpath, 0, NULL)) != NULL) {
9258                 /* Find all GSD-files within directory */
9259                 while ((filename = g_dir_read_name(dir)) != NULL) {
9260 
9261                     /* ---- complete the path to open a GSD-file ---- */
9262                     diropen = wmem_strdup_printf(pinfo->pool, "%s" G_DIR_SEPARATOR_S "%s", pnio_ps_networkpath, filename);
9263 
9264                     /* ---- Open the found GSD-file  ---- */
9265                     fp = ws_fopen(diropen, "r");
9266 
9267                     if(fp != NULL) {
9268                         /* ---- Get VendorID & DeviceID ---- */
9269                         while(pn_fgets(puffer, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) {
9270                             /* ----- VendorID ------ */
9271                             if((strstr(puffer, vendorIdStr)) != NULL) {
9272                                 memset (convertStr, 0, sizeof(*convertStr));
9273                                 pch = strstr(puffer, vendorIdStr);
9274                                 if (pch!= NULL && sscanf(pch, "VendorID=\"%199[^\"]", convertStr) == 1) {
9275                                     read_vendor_id = (guint32) strtoul (convertStr, NULL, 0);
9276 
9277                                     if(read_vendor_id == searchVendorID) {
9278                                         vendorMatch = TRUE;        /* found correct VendorID */
9279                                     }
9280                                 }
9281                             }
9282 
9283                             /* ----- DeviceID ------ */
9284                             if((strstr(puffer, deviceIdStr)) != NULL) {
9285                                 memset(convertStr, 0, sizeof(*convertStr));
9286                                 pch = strstr(puffer, deviceIdStr);
9287                                 if (pch != NULL && sscanf(pch, "DeviceID=\"%199[^\"]", convertStr) == 1) {
9288                                     read_device_id = (guint32)strtoul(convertStr, NULL, 0);
9289 
9290                                     if(read_device_id == searchDeviceID) {
9291                                         deviceMatch = TRUE;        /* found correct DeviceID */
9292                                     }
9293                                 }
9294                             }
9295                         }
9296 
9297                         fclose(fp);
9298                         fp = NULL;
9299 
9300                         if(vendorMatch && deviceMatch) {
9301                             break;        /* Found correct GSD-file! -> Break the searchloop */
9302                         }
9303                         else {
9304                             /* Couldn't find the correct GSD-file to the corresponding device */
9305                             vendorMatch = FALSE;
9306                             deviceMatch = FALSE;
9307                             gsdmlFoundFlag = FALSE;
9308                             diropen = "";           /* reset array for next search */
9309                         }
9310                     }
9311                 }
9312 
9313                 g_dir_close(dir);
9314             }
9315 
9316             /* ---- Found the correct GSD-file -> set Flag and save the completed path ---- */
9317             if(vendorMatch && deviceMatch) {
9318                 gsdmlFoundFlag = TRUE;
9319                 station_info->gsdFound = TRUE;
9320                 station_info->gsdLocation = wmem_strdup(wmem_file_scope(), diropen);
9321             }
9322             else {
9323                 /* Copy searchpath to array for a detailed output message in cyclic data dissection */
9324                 station_info->gsdLocation = wmem_strdup_printf(wmem_file_scope(), "%s" G_DIR_SEPARATOR_S "*.xml", pnio_ps_networkpath);
9325             }
9326         }
9327         else {
9328             /* will be used later on in cyclic RTC1 data dissection for detailed output message */
9329             station_info->gsdPathLength = FALSE;
9330         }
9331     }
9332 
9333     while (u16NumberOfAPIs--) {
9334         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
9335         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
9336         u32ApiStart = offset;
9337 
9338         /* API */
9339         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9340                             hf_pn_io_api, &u32Api);
9341         /* SlotNumber */
9342         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9343                             hf_pn_io_slot_nr, &u16SlotNr);
9344         /* ModuleIdentNumber */
9345         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9346                             hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
9347         /* ModuleProperties */
9348         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9349                             hf_pn_io_module_properties, &u16ModuleProperties);
9350         /* NumberOfSubmodules */
9351         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9352                             hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
9353 
9354         proto_item_append_text(api_item, ": %u, Slot:0x%x, IdentNumber:0x%x Properties:0x%x Submodules:%u",
9355             u32Api, u16SlotNr, u32ModuleIdentNumber, u16ModuleProperties, u16NumberOfSubmodules);
9356 
9357         proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
9358 
9359         while (u16NumberOfSubmodules--) {
9360             sub_item = proto_tree_add_item(api_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
9361             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
9362             u32SubStart = offset;
9363 
9364             /* Subslotnumber */
9365             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9366                                 hf_pn_io_subslot_nr, &u16SubslotNr);
9367             /* SubmoduleIdentNumber */
9368             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9369                             hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
9370             /* SubmoduleProperties */
9371             submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_properties, tvb, offset, 2, ENC_BIG_ENDIAN);
9372             submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_properties);
9373             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9374                             hf_pn_io_submodule_properties_reserved, &u16SubmoduleProperties);
9375             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9376                             hf_pn_io_submodule_properties_discard_ioxs, &u16SubmoduleProperties);
9377             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9378                             hf_pn_io_submodule_properties_reduce_output_submodule_data_length, &u16SubmoduleProperties);
9379             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9380                             hf_pn_io_submodule_properties_reduce_input_submodule_data_length, &u16SubmoduleProperties);
9381             dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9382                             hf_pn_io_submodule_properties_shared_input, &u16SubmoduleProperties);
9383             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9384                             hf_pn_io_submodule_properties_type, &u16SubmoduleProperties);
9385 
9386             io_data_object->slotNr = u16SlotNr;
9387             io_data_object->subSlotNr = u16SubslotNr;
9388             io_data_object->moduleIdentNr = u32ModuleIdentNumber;
9389             io_data_object->subModuleIdentNr = u32SubmoduleIdentNumber;
9390             io_data_object->discardIOXS = u16SubmoduleProperties & 0x0020;
9391 
9392             /* Search the moduleID and subModuleID, find if PROFIsafe and also search for F-Par. Indexnumber
9393              * ---------------------------------------------------------------------------------------------
9394              * Speical case: Module has several ModuleIdentNr. in one GSD-file
9395              * Also with the given parameters of wireshark, some modules were completely equal. For this
9396              * special case a compromise for this problem has been made, to set the module name will
9397              * be more generally displayed.
9398              * Also this searchloop will find the F-Parameter Indexnumber, so that Wireshark is able to
9399              * dissect those F-Parameters correctly, as this index can change between the vendors.
9400              */
9401 
9402             io_data_object->amountInGSDML = 0;
9403             io_data_object->fParameterIndexNr = 0;
9404             io_data_object->profisafeSupported = FALSE;
9405 
9406             if (diropen != NULL) {
9407                 fp = ws_fopen(diropen, "r");
9408             }
9409             else {
9410                 fp = NULL;
9411             }
9412             if(fp != NULL && gsdmlFoundFlag) {
9413                 fseek(fp, 0, SEEK_SET);
9414 
9415                 /* Find Indexnumber for fParameter */
9416                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) {
9417                     if((strstr(temp, fParameterStr)) != NULL) {
9418                         memset (convertStr, 0, sizeof(*convertStr));
9419 
9420                         pch = strstr(temp, fParameterIndexStr);
9421                         if (pch != NULL && sscanf(pch, "Index=\"%199[^\"]", convertStr) == 1) {
9422                             io_data_object->fParameterIndexNr = (guint32)strtoul(convertStr, NULL, 0);
9423                         }
9424                         break;    /* found Indexnumber -> break search loop */
9425                     }
9426                 }
9427 
9428                 memset (temp, 0, sizeof(*temp));
9429                 fseek(fp, 0, SEEK_SET);                /* Set filepointer to the beginning */
9430 
9431                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) {
9432                     if((strstr(temp, moduleStr)) != NULL) {                         /* find the String "ModuleIdentNumber=" */
9433                         memset (convertStr, 0, sizeof(*convertStr));
9434                         pch = strstr(temp, moduleStr);                              /* search for "ModuleIdentNumber=\"" within GSD-file */
9435                         if (pch != NULL && sscanf(pch, "ModuleIdentNumber=\"%199[^\"]", convertStr) == 1) {  /* Change format of Value string-->numeric string */
9436                             read_module_id = (guint32)strtoul(convertStr, NULL, 0);     /* Change numeric string --> unsigned long; read_module_id contains the Value of the ModuleIdentNumber */
9437 
9438                             /* If the found ModuleID matches with the wanted ModuleID, search for the Submodule and break */
9439                             if (read_module_id == io_data_object->moduleIdentNr) {
9440                                 ++io_data_object->amountInGSDML;    /* Save the amount of same (!) Module- & SubmoduleIdentNr in one GSD-file */
9441 
9442                                 while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) {
9443                                     if((strstr(temp, moduleNameInfo)) != NULL) {                    /* find the String "<Name" for the TextID */
9444                                         long filePosRecord;
9445 
9446                                         if (sscanf(temp, "%*s TextId=\"%199[^\"]", tmp_moduletext) != 1)        /* saves the correct TextId for the next searchloop */
9447                                             break;
9448 
9449                                         filePosRecord = ftell(fp);            /* save the current position of the filepointer (Offset) */
9450                                         /* ftell() may return -1 for error, don't move fp in this case */
9451                                         if (filePosRecord >= 0) {
9452                                             while (pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL && io_data_object->amountInGSDML == 1) {
9453                                                 /* 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! */
9454                                                 if(((strstr(temp, tmp_moduletext)) != NULL) && ((strstr(temp, moduleValueInfo)) != NULL)) {
9455                                                     pch = strstr(temp, moduleValueInfo);
9456                                                     if (pch != NULL && sscanf(pch, "Value=\"%199[^\"]", io_data_object->moduleNameStr) == 1)
9457                                                         break;    /* Found the name of the module */
9458                                                 }
9459                                             }
9460 
9461                                             fseek(fp, filePosRecord, SEEK_SET);    /* set filepointer to the correct TextID */
9462                                         }
9463                                     }
9464 
9465                                     /* Search for Submoduleidentnumber in GSD-file */
9466                                     if((strstr(temp, subModuleStr)) != NULL) {
9467                                         memset (convertStr, 0, sizeof(*convertStr));
9468                                         pch = strstr(temp, subModuleStr);
9469                                         if (pch != NULL && sscanf(pch, "SubmoduleIdentNumber=\"%199[^\"]", convertStr) == 1) {
9470                                             read_submodule_id = (guint32) strtoul (convertStr, NULL, 0);    /* read_submodule_id contains the Value of the SubModuleIdentNumber */
9471 
9472                                             /* Find "PROFIsafeSupported" flag of the module in GSD-file */
9473                                             if(read_submodule_id == io_data_object->subModuleIdentNr) {
9474                                                 if((strstr(temp, profisafeStr)) != NULL) {
9475                                                     io_data_object->profisafeSupported = TRUE;   /* flag is in the same line as SubmoduleIdentNr */
9476                                                     break;
9477                                                 }
9478                                                 else {    /* flag is not in the same line as Submoduleidentnumber -> search for it */
9479                                                     while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) {
9480                                                         if((strstr(temp, profisafeStr)) != NULL) {
9481                                                             io_data_object->profisafeSupported = TRUE;
9482                                                             break;    /* Found the PROFIsafeSupported flag of the module */
9483                                                         }
9484 
9485                                                         else if((strstr(temp, ">")) != NULL) {
9486                                                             break;
9487                                                         }
9488                                                     }
9489                                                 }
9490                                                 break;    /* Found the PROFIsafe Module */
9491                                             }
9492                                         }
9493                                     }
9494                                 }
9495                             }
9496                         }
9497                     }
9498                 }
9499 
9500                 fclose(fp);
9501                 fp = NULL;
9502             }
9503 
9504             if(fp != NULL)
9505             {
9506                 fclose(fp);
9507                 fp = NULL;
9508             }
9509 
9510             switch (u16SubmoduleProperties & 0x03) {
9511             case(0x00): /* no input and no output data (one Input DataDescription Block follows) */
9512                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9513                 break;
9514             case(0x01): /* input data (one Input DataDescription Block follows) */
9515                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9516                 break;
9517             case(0x02): /* output data (one Output DataDescription Block follows) */
9518                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9519                 break;
9520             case(0x03): /* input and output data (one Input and one Output DataDescription Block follows) */
9521                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9522                 offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object);
9523                 break;
9524             default: /* will not execute because of the line preceding the switch */
9525                 break;
9526             }
9527 
9528             proto_item_append_text(sub_item, ": Subslot:0x%x, Ident:0x%x Properties:0x%x",
9529                 u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleProperties);
9530             proto_item_set_len(sub_item, offset - u32SubStart);
9531         }
9532 
9533         proto_item_set_len(api_item, offset - u32ApiStart);
9534     }
9535 
9536     return offset;
9537 }
9538 
9539 
9540 /* dissect the ModuleDiffBlock */
9541 static int
dissect_ModuleDiffBlock_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)9542 dissect_ModuleDiffBlock_block(tvbuff_t *tvb, int offset,
9543     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9544 {
9545     guint16     u16NumberOfAPIs;
9546     guint32     u32Api;
9547     guint16     u16NumberOfModules;
9548     guint16     u16SlotNr;
9549     guint32     u32ModuleIdentNumber;
9550     guint16     u16ModuleState;
9551     guint16     u16NumberOfSubmodules;
9552     guint16     u16SubslotNr;
9553     guint32     u32SubmoduleIdentNumber;
9554     guint16     u16SubmoduleState;
9555     proto_item *api_item;
9556     proto_tree *api_tree;
9557     guint32     u32ApiStart;
9558     proto_item *module_item;
9559     proto_tree *module_tree;
9560     guint32     u32ModuleStart;
9561     proto_item *sub_item;
9562     proto_tree *sub_tree;
9563     proto_item *submodule_item;
9564     proto_tree *submodule_tree;
9565     guint32     u32SubStart;
9566 
9567     conversation_t    *conversation;
9568     stationInfo       *station_info;
9569     wmem_list_frame_t *frame;
9570     moduleDiffInfo    *module_diff_info;
9571     moduleDiffInfo    *cmp_module_diff_info;
9572 
9573     ARUUIDFrame       *current_aruuid_frame = NULL;
9574     guint32            current_aruuid = 0;
9575 
9576     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9577         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9578             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9579         return offset;
9580     }
9581 
9582     /* NumberOfAPIs */
9583     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9584                         hf_pn_io_number_of_apis, &u16NumberOfAPIs);
9585 
9586     proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs);
9587 
9588     while (u16NumberOfAPIs--) {
9589         api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA);
9590         api_tree = proto_item_add_subtree(api_item, ett_pn_io_api);
9591         u32ApiStart = offset;
9592 
9593         /* API */
9594         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep,
9595                             hf_pn_io_api, &u32Api);
9596         /* NumberOfModules */
9597         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep,
9598                             hf_pn_io_number_of_modules, &u16NumberOfModules);
9599 
9600         proto_item_append_text(api_item, ": %u, Modules: %u",
9601             u32Api, u16NumberOfModules);
9602 
9603         proto_item_append_text(item, ", Modules:%u", u16NumberOfModules);
9604 
9605         while (u16NumberOfModules--) {
9606             module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA);
9607             module_tree = proto_item_add_subtree(module_item, ett_pn_io_module);
9608             u32ModuleStart = offset;
9609 
9610             /* SlotNumber */
9611             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9612                                 hf_pn_io_slot_nr, &u16SlotNr);
9613             /* ModuleIdentNumber */
9614             offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep,
9615                                 hf_pn_io_module_ident_number, &u32ModuleIdentNumber);
9616             /* ModuleState */
9617             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9618                                 hf_pn_io_module_state, &u16ModuleState);
9619             /* NumberOfSubmodules */
9620             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep,
9621                                 hf_pn_io_number_of_submodules, &u16NumberOfSubmodules);
9622 
9623             proto_item_append_text(module_item, ": Slot 0x%x, Ident: 0x%x State: %s Submodules: %u",
9624                 u16SlotNr, u32ModuleIdentNumber,
9625                 val_to_str(u16ModuleState, pn_io_module_state, "(0x%x)"),
9626                 u16NumberOfSubmodules);
9627 
9628 
9629             if (!PINFO_FD_VISITED(pinfo)) {
9630                 /* Get current conversation endpoints using MAC addresses */
9631                 conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9632                 if (conversation == NULL) {
9633                     conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
9634                 }
9635 
9636                 current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
9637 
9638                 if (current_aruuid_frame != NULL) {
9639                     current_aruuid = current_aruuid_frame->aruuid.data1;
9640                 }
9641 
9642                 station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
9643 
9644                 if (station_info != NULL) {
9645                     pn_find_dcp_station_info(station_info, conversation);
9646 
9647                     for (frame = wmem_list_head(station_info->diff_module); frame != NULL; frame = wmem_list_frame_next(frame)) {
9648                         cmp_module_diff_info = (moduleDiffInfo*)wmem_list_frame_data(frame);
9649                         if (cmp_module_diff_info->slotNr == u16SlotNr) {
9650                             /* Found identical existing object */
9651                             break;
9652                         }
9653                     }
9654 
9655                     if (frame == NULL) {
9656                         /* new diffModuleInfo data incoming */
9657                         module_diff_info = wmem_new(wmem_file_scope(), moduleDiffInfo);
9658                         module_diff_info->slotNr = u16SlotNr;
9659                         module_diff_info->modulID = u32ModuleIdentNumber;
9660                         wmem_list_append(station_info->diff_module, module_diff_info);
9661                     }
9662                 }
9663             }
9664 
9665             proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules);
9666 
9667             while (u16NumberOfSubmodules--) {
9668                 sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA);
9669                 sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule);
9670                 u32SubStart = offset;
9671 
9672                 /* Subslotnumber */
9673                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
9674                                     hf_pn_io_subslot_nr, &u16SubslotNr);
9675                 /* SubmoduleIdentNumber */
9676                 offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep,
9677                                 hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber);
9678                 /* SubmoduleState */
9679                 submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_state, tvb, offset, 2, ENC_BIG_ENDIAN);
9680                 submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_state);
9681                 dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9682                                 hf_pn_io_submodule_state_format_indicator, &u16SubmoduleState);
9683                 if (u16SubmoduleState & 0x8000) {
9684                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9685                                     hf_pn_io_submodule_state_ident_info, &u16SubmoduleState);
9686                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9687                                     hf_pn_io_submodule_state_ar_info, &u16SubmoduleState);
9688                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9689                                     hf_pn_io_submodule_state_diag_info, &u16SubmoduleState);
9690                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9691                                     hf_pn_io_submodule_state_maintenance_demanded, &u16SubmoduleState);
9692                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9693                                     hf_pn_io_submodule_state_maintenance_required, &u16SubmoduleState);
9694                     dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9695                                     hf_pn_io_submodule_state_qualified_info, &u16SubmoduleState);
9696                     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9697                                     hf_pn_io_submodule_state_add_info, &u16SubmoduleState);
9698                 } else {
9699                     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep,
9700                                     hf_pn_io_submodule_state_detail, &u16SubmoduleState);
9701                 }
9702 
9703                 proto_item_append_text(sub_item, ": Subslot 0x%x, IdentNumber: 0x%x, State: 0x%x",
9704                     u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleState);
9705 
9706                 proto_item_set_len(sub_item, offset - u32SubStart);
9707             } /* NumberOfSubmodules */
9708 
9709             proto_item_set_len(module_item, offset - u32ModuleStart);
9710         }
9711 
9712         proto_item_set_len(api_item, offset - u32ApiStart);
9713     }
9714 
9715     return offset;
9716 }
9717 
9718 
9719 /* dissect the IsochronousModeData block */
9720 static int
dissect_IsochronousModeData_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item _U_,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)9721 dissect_IsochronousModeData_block(tvbuff_t *tvb, int offset,
9722     packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9723 {
9724     guint16 u16SlotNr;
9725     guint16 u16SubslotNr;
9726     guint16 u16ControllerApplicationCycleFactor;
9727     guint16 u16TimeDataCycle;
9728     guint32 u32TimeIOInput;
9729     guint32 u32TimeIOOutput;
9730     guint32 u32TimeIOInputValid;
9731     guint32 u32TimeIOOutputValid;
9732 
9733 
9734     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9735         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9736             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9737         return offset;
9738     }
9739 
9740     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
9741 
9742     /* SlotNumber */
9743     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9744                         hf_pn_io_slot_nr, &u16SlotNr);
9745     /* Subslotnumber */
9746     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9747                         hf_pn_io_subslot_nr, &u16SubslotNr);
9748 
9749     /* ControllerApplicationCycleFactor */
9750     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9751                         hf_pn_io_controller_appl_cycle_factor, &u16ControllerApplicationCycleFactor);
9752     /* TimeDataCycle */
9753     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9754                         hf_pn_io_time_data_cycle, &u16TimeDataCycle);
9755     /* TimeIOInput (ns) */
9756     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9757                         hf_pn_io_time_io_input, &u32TimeIOInput);
9758     /* TimeIOOutput (ns) */
9759     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9760                         hf_pn_io_time_io_output, &u32TimeIOOutput);
9761     /* TimeIOInputValid (ns) */
9762     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9763                         hf_pn_io_time_io_input_valid, &u32TimeIOInputValid);
9764     /* TimeIOOutputValid (ns) */
9765     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9766                         hf_pn_io_time_io_output_valid, &u32TimeIOOutputValid);
9767 
9768 
9769     return offset+1;
9770 }
9771 
9772 
9773 /* dissect the MultipleBlockHeader block */
9774 static int
dissect_MultipleBlockHeader_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16BodyLength)9775 dissect_MultipleBlockHeader_block(tvbuff_t *tvb, int offset,
9776     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9777     guint16 u16BodyLength)
9778 {
9779     guint32   u32Api;
9780     guint16   u16SlotNr;
9781     guint16   u16SubslotNr;
9782     tvbuff_t *new_tvb;
9783 
9784 
9785     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9786         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9787             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9788         return offset;
9789     }
9790 
9791     offset = dissect_pn_align4(tvb, offset, pinfo, tree);
9792 
9793     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9794                     hf_pn_io_api, &u32Api);
9795     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9796                     hf_pn_io_slot_nr, &u16SlotNr);
9797     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9798                     hf_pn_io_subslot_nr, &u16SubslotNr);
9799 
9800     proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x",
9801         u32Api, u16SlotNr, u16SubslotNr);
9802 
9803     new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength-10);
9804     offset = dissect_blocks(new_tvb, 0, pinfo, tree, drep);
9805 
9806     /*offset += u16BodyLength;*/
9807 
9808     return offset;
9809 }
9810 
9811 /* dissect Combined Object Container Content block */
9812 static int
dissect_COContainerContent_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)9813 dissect_COContainerContent_block(tvbuff_t *tvb, int offset,
9814     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9815     guint16 u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
9816 {
9817     guint32    u32Api;
9818     guint16    u16SlotNr;
9819     guint16    u16SubslotNr;
9820 
9821     if(u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9822         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9823             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9824         return offset;
9825     }
9826 
9827     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9828 
9829     offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep,
9830         hf_pn_io_api, &u32Api);
9831 
9832     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9833         hf_pn_io_slot_nr, &u16SlotNr);
9834 
9835     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9836         hf_pn_io_subslot_nr, &u16SubslotNr);
9837 
9838     offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2);
9839 
9840     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9841         hf_pn_io_index, &u16Index);
9842 
9843     proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x Index:0x%x",
9844         u32Api, u16SlotNr, u16SubslotNr, u16Index);
9845 
9846     if(u16Index != 0x80B0) {
9847         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, u32RecDataLen, ar);
9848     }
9849 
9850     return offset;
9851 }
9852 
9853 
9854 static const gchar *
indexReservedForProfiles(guint16 u16Index)9855 indexReservedForProfiles(guint16 u16Index)
9856 {
9857     /* "reserved for profiles" */
9858     if (u16Index >= 0xb000 && u16Index <= 0xbfff) {
9859         return "Reserved for Profiles (subslot specific)";
9860     }
9861     if (u16Index >= 0xd000 && u16Index <= 0xdfff) {
9862         return "Reserved for Profiles (slot specific)";
9863     }
9864     if (u16Index >= 0xec00 && u16Index <= 0xefff) {
9865         return "Reserved for Profiles (AR specific)";
9866     }
9867     if (u16Index >= 0xf400 && u16Index <= 0xf7ff) {
9868         return "Reserved for Profiles (API specific)";
9869     }
9870     if (u16Index >= 0xfc00 /* up to 0xffff */) {
9871         return "Reserved for Profiles (device specific)";
9872     }
9873 
9874     return NULL;
9875 }
9876 
9877 
9878 /* dissect the RecordDataReadQuery block */
9879 static int
dissect_RecordDataReadQuery_block(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,proto_item * item _U_,guint8 * drep _U_,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow,guint16 u16Index,guint16 u16BodyLength)9880 dissect_RecordDataReadQuery_block(tvbuff_t *tvb, int offset,
9881     packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow,
9882     guint16 u16Index, guint16 u16BodyLength)
9883 {
9884     const gchar *userProfile;
9885 
9886 
9887     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9888         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9889             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9890         return offset;
9891     }
9892 
9893     /* user specified format? */
9894     if (u16Index < 0x8000) {
9895         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, "User Specified Data");
9896         return offset;
9897     }
9898 
9899     /* "reserved for profiles"? */
9900     userProfile = indexReservedForProfiles(u16Index);
9901     if (userProfile != NULL) {
9902         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, userProfile);
9903         return offset;
9904     }
9905 
9906     return dissect_pn_undecoded(tvb, offset, pinfo, tree, u16BodyLength);
9907 }
9908 
9909 /* dissect the RS_GetEvent block */
9910 static int
dissect_RS_GetEvent_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)9911 dissect_RS_GetEvent_block(tvbuff_t *tvb, int offset,
9912     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
9913     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
9914 {
9915     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
9916         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
9917             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
9918         return offset;
9919     }
9920     offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep);
9921     return offset;
9922 }
9923 
9924 /* dissect the RS_AdjustControl */
9925 static int
dissect_RS_AdjustControl(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep,guint16 * u16RSBodyLength,guint16 * u16RSBlockType)9926 dissect_RS_AdjustControl(tvbuff_t *tvb, int offset,
9927     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep,
9928     guint16 *u16RSBodyLength, guint16 *u16RSBlockType)
9929 {
9930     guint16 u16ChannelNumber;
9931     guint16 u16SoEMaxScanDelay;
9932     proto_item *sub_item;
9933     proto_tree *sub_tree;
9934     guint8 u8SoEAdjustSpecifierReserved;
9935     guint8 u8SoEAdjustSpecifierIndicent;
9936 
9937     switch (*u16RSBlockType) {
9938     case(0xc010): /* SoE_DigitalInputObserver */
9939 
9940         /* ChannelNumber */
9941         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9942             hf_pn_io_channel_number, &u16ChannelNumber);
9943 
9944         /* SoE_MaxScanDelay */
9945         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
9946             hf_pn_io_soe_max_scan_delay, &u16SoEMaxScanDelay);
9947 
9948         /* SoE_AdjustSpecifier */
9949         sub_item = proto_tree_add_item(tree, hf_pn_io_soe_adjust_specifier, tvb, offset, 1, ENC_BIG_ENDIAN);
9950         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_adjust_specifier);
9951 
9952         dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9953             hf_pn_io_soe_adjust_specifier_reserved, &u8SoEAdjustSpecifierReserved);
9954 
9955         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
9956             hf_pn_io_soe_adjust_specifier_incident, &u8SoEAdjustSpecifierIndicent);
9957 
9958         /* Padding 2 + 2 + 1 = 5 */
9959         /* Therefore we need 3 byte padding to make the block u32 aligned */
9960         offset = dissect_pn_padding(tvb, offset, pinfo, tree, 3);
9961         break;
9962         default:
9963         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u16RSBodyLength, "UserData");
9964         break;
9965     }
9966     return offset;
9967 }
9968 
9969 /* dissect the RS_AdjustBlock */
9970 static int
dissect_RS_AdjustBlock(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)9971 dissect_RS_AdjustBlock(tvbuff_t *tvb, int offset,
9972     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
9973 {
9974     proto_item *sub_item;
9975     proto_tree *sub_tree;
9976 
9977     guint16 u16RSBodyLength;
9978     guint16 u16RSBlockType;
9979 
9980     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_block, tvb, offset, 0, ENC_NA);
9981     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_block);
9982 
9983     /* RS_BlockHeader */
9984     offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep,
9985         &u16RSBodyLength, &u16RSBlockType);
9986 
9987     /* RS_AdjustControl */
9988     offset = dissect_RS_AdjustControl(tvb, offset, pinfo, sub_tree, drep,
9989         &u16RSBodyLength, &u16RSBlockType);
9990 
9991     return offset;
9992 }
9993 
9994 /* dissect the RS_AdjustInfo */
9995 static int
dissect_RS_AdjustInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)9996 dissect_RS_AdjustInfo(tvbuff_t *tvb, int offset,
9997     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
9998 {
9999     proto_item *sub_item;
10000     proto_tree *sub_tree;
10001     guint16    u16NumberofEntries;
10002 
10003     sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_info, tvb, offset, 0, ENC_NA);
10004     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_info);
10005 
10006     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10007         hf_pn_io_number_of_rs_event_info, &u16NumberofEntries);
10008 
10009     while (u16NumberofEntries > 0) {
10010         u16NumberofEntries--;
10011         offset = dissect_RS_AdjustBlock(tvb, offset, pinfo, sub_tree, drep);
10012     }
10013     return offset;
10014 }
10015 
10016 /* dissect the RS_AdjustObserver block */
10017 static int
dissect_RS_AdjustObserver_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)10018 dissect_RS_AdjustObserver_block(tvbuff_t *tvb, int offset,
10019     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
10020     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10021 {
10022     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10023         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10024             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10025         return offset;
10026     }
10027     offset = dissect_RS_AdjustInfo(tvb, offset, pinfo, tree, drep);
10028     return offset;
10029 }
10030 
10031 static int
dissect_RS_AckInfo(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep)10032 dissect_RS_AckInfo(tvbuff_t *tvb, int offset,
10033     packet_info *pinfo _U_, proto_tree *tree, guint8 *drep)
10034 {
10035     guint16 u16RSSpecifierSequenceNumber;
10036 
10037     /* RS_Specifier.SequenceNumber */
10038     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep,
10039         hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber);
10040 
10041     return offset;
10042 }
10043 
10044 /* dissect the RS_AckEvent block */
10045 static int
dissect_RS_AckEvent_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,proto_item * item,guint8 * drep,guint8 u8BlockVersionHigh,guint8 u8BlockVersionLow)10046 dissect_RS_AckEvent_block(tvbuff_t *tvb, int offset,
10047     packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep,
10048     guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
10049 {
10050     if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) {
10051         expert_add_info_format(pinfo, item, &ei_pn_io_block_version,
10052             "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow);
10053         return offset;
10054     }
10055     offset = dissect_RS_AckInfo(tvb, offset, pinfo, tree, drep);
10056     return offset;
10057 }
10058 
10059 /* dissect one PN-IO block (depending on the block type) */
10060 static int
dissect_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint16 * u16Index,guint32 * u32RecDataLen,pnio_ar_t ** ar)10061 dissect_block(tvbuff_t *tvb, int offset,
10062     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar)
10063 {
10064     guint16     u16BlockType;
10065     guint16     u16BlockLength;
10066     guint8      u8BlockVersionHigh;
10067     guint8      u8BlockVersionLow;
10068     proto_item *sub_item;
10069     proto_tree *sub_tree;
10070     guint32     u32SubStart;
10071     guint16     u16BodyLength;
10072     proto_item *header_item;
10073     proto_tree *header_tree;
10074     gint        remainingBytes;
10075 
10076     /* from here, we only have big endian (network byte ordering)!!! */
10077     drep[0] &= ~DREP_LITTLE_ENDIAN;
10078 
10079     sub_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10080     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_block);
10081     u32SubStart = offset;
10082 
10083     header_item = proto_tree_add_item(sub_tree, hf_pn_io_block_header, tvb, offset, 6, ENC_NA);
10084     header_tree = proto_item_add_subtree(header_item, ett_pn_io_block_header);
10085 
10086     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep,
10087                         hf_pn_io_block_type, &u16BlockType);
10088     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep,
10089                         hf_pn_io_block_length, &u16BlockLength);
10090     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep,
10091                         hf_pn_io_block_version_high, &u8BlockVersionHigh);
10092     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep,
10093                         hf_pn_io_block_version_low, &u8BlockVersionLow);
10094 
10095     proto_item_append_text(header_item, ": Type=%s, Length=%u(+4), Version=%u.%u",
10096         val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)"),
10097         u16BlockLength, u8BlockVersionHigh, u8BlockVersionLow);
10098 
10099     proto_item_set_text(sub_item, "%s",
10100         val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)"));
10101 
10102     col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
10103         val_to_str(u16BlockType, pn_io_block_type, "Unknown"));
10104 
10105     /* block length is without type and length fields, but with version field */
10106     /* as it's already dissected, remove it */
10107     u16BodyLength = u16BlockLength - 2;
10108     remainingBytes = tvb_reported_length_remaining(tvb, offset);
10109     if (remainingBytes < 0)
10110         remainingBytes = 0;
10111     if (remainingBytes +2 < u16BodyLength)
10112     {
10113         proto_item_append_text(sub_item, " Block_Length: %d greater than remaining Bytes, trying with Blocklen = remaining (%d)", u16BodyLength, remainingBytes);
10114         u16BodyLength = remainingBytes;
10115     }
10116     switch (u16BlockType) {
10117     case(0x0001):
10118     case(0x0002):
10119         dissect_AlarmNotification_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10120             u16BodyLength);
10121         break;
10122     case(0x0008):
10123         dissect_IODWriteReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10124             u16Index, u32RecDataLen, ar);
10125         break;
10126     case(0x0009):
10127         dissect_IODReadReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10128             u16Index, u32RecDataLen, ar);
10129         break;
10130     case(0x0010):
10131         dissect_DiagnosisData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10132             u16BodyLength);
10133         break;
10134     case(0x0012):   /* ExpectedIdentificationData */
10135     case(0x0013):   /* RealIdentificationData */
10136         dissect_IdentificationData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10137         break;
10138     case(0x0014):
10139         dissect_SubstituteValue_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10140             u16BodyLength);
10141         break;
10142     case(0x0015):
10143         dissect_RecordInputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10144         break;
10145     case(0x0016):
10146         dissect_RecordOutputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10147         break;
10148     /*   0x0017 reserved */
10149     case(0x0018):
10150         dissect_ARData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10151         break;
10152     case(0x0019):
10153         dissect_LogData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10154         break;
10155     case(0x001A):
10156         dissect_APIData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10157         break;
10158     case(0x001B):
10159         dissect_SRLData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10160         break;
10161     case(0x0020):
10162         dissect_IandM0_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10163         break;
10164     case(0x0021):
10165         dissect_IandM1_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10166         break;
10167     case(0x0022):
10168         dissect_IandM2_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10169         break;
10170     case(0x0023):
10171         dissect_IandM3_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10172         break;
10173     case(0x0024):
10174         dissect_IandM4_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10175         break;
10176     case(0x0025):
10177         dissect_IandM5_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh,u8BlockVersionLow);
10178         break;
10179     case(0x0030):
10180         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10181         break;
10182     case(0x0031):
10183         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10184         break;
10185     case(0x0032):
10186         dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10187         break;
10188     case(0x0034):
10189         dissect_IandM5Data_block(tvb, offset, pinfo, sub_tree, sub_item, drep);
10190         break;
10191     case(0x0035):
10192         dissect_AssetManagementData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10193         break;
10194     case(0x0036):
10195         dissect_AM_FullInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10196         break;
10197     case(0x0037):
10198         dissect_AM_HardwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10199         break;
10200     case(0x0038):
10201         dissect_AM_FirmwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10202         break;
10203     case(0x0101):
10204         dissect_ARBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10205             ar);
10206         break;
10207     case(0x0102):
10208         dissect_IOCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10209             *ar);
10210         break;
10211     case(0x0103):
10212         dissect_AlarmCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10213             *ar);
10214         break;
10215     case(0x0104):
10216         dissect_ExpectedSubmoduleBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10217         break;
10218     case(0x0106):
10219         dissect_MCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10220         break;
10221     case(0x0107):
10222         dissect_SubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10223         break;
10224     case(0x0108):
10225     case(0x8108):
10226         dissect_ARVendorBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10227         break;
10228     case(0x0109):
10229         dissect_IRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10230         break;
10231     case(0x010A):
10232         dissect_SRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10233         break;
10234     case(0x010C):
10235         dissect_RSInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10236         break;
10237     case(0x0110):
10238     case(0x0111):
10239     case(0x0112):
10240     case(0x0113):
10241     case(0x0114):
10242     case(0x0116):
10243     case(0x0117):
10244         dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType);
10245         break;
10246 
10247     case(0x0118):
10248         dissect_ControlBlockPrmBegin(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar);
10249         break;
10250 
10251     case(0x0119):
10252         dissect_SubmoduleListBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar);
10253         break;
10254 
10255     case(0x0200): /* PDPortDataCheck */
10256         dissect_PDPortData_Check_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10257             u16BodyLength);
10258         break;
10259     case(0x0201):
10260         dissect_PDevData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10261         break;
10262     case(0x0202): /*dissect_PDPortData_Adjust_block */
10263         dissect_PDPortData_Adjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10264             u16BodyLength);
10265         break;
10266     case(0x0203):
10267         dissect_PDSyncData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10268         break;
10269     case(0x0204):
10270         dissect_IsochronousModeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10271         break;
10272     case(0x0205):
10273         dissect_PDIRData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10274         break;
10275     case(0x0206):
10276         dissect_PDIRGlobalData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10277         break;
10278     case(0x0207):
10279         dissect_PDIRFrameData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10280             u16BodyLength);
10281         break;
10282     case(0x0208):
10283         dissect_PDIRBeginEndData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10284             u16BodyLength);
10285         break;
10286     case(0x0209):
10287         dissect_AdjustDomainBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10288         break;
10289     case(0x020A):
10290         dissect_CheckPeers_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10291         break;
10292     case(0x020B):
10293         dissect_CheckLineDelay_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10294         break;
10295     case(0x020C):
10296         dissect_CheckMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10297         break;
10298     case(0x020E):
10299         dissect_AdjustMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10300         break;
10301     case(0x020F):
10302         dissect_PDPortDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10303         break;
10304     case(0x0210):
10305         dissect_AdjustMulticastBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10306         break;
10307     case(0x0211):
10308         dissect_PDInterfaceMrpDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10309         break;
10310     case(0x0212):
10311         dissect_PDInterfaceMrpDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10312         break;
10313     case(0x0213):
10314         dissect_PDInterfaceMrpDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10315         break;
10316     case(0x0214):
10317     case(0x0215):
10318         dissect_PDPortMrpData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10319         break;
10320     case(0x0216):
10321         dissect_MrpManagerParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10322         break;
10323     case(0x0217):
10324         dissect_MrpClientParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10325         break;
10326     case(0x0218):
10327         dissect_MrpRTModeManagerData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10328         break;
10329     case(0x0219):
10330         dissect_MrpRingStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10331         break;
10332     case(0x021A):
10333         dissect_MrpRTStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10334         break;
10335     case(0x021B):
10336         dissect_AdjustPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10337         break;
10338     case(0x021C):
10339         dissect_CheckPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10340         break;
10341     case(0x021D):
10342         dissect_MrpRTModeClientData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10343         break;
10344     case(0x021E):
10345         dissect_CheckSyncDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10346         break;
10347     case(0x021F):
10348         dissect_CheckMAUTypeDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10349         break;
10350     case(0x0220):
10351         dissect_PDPortFODataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10352         break;
10353     case(0x0221):
10354         dissect_FiberOpticManufacturerSpecific_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10355         break;
10356     case(0x0222):
10357         dissect_PDPortFODataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10358         break;
10359     case(0x0223):
10360         dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10361         break;
10362     case(0x0224):
10363         dissect_AdjustPeerToPeerBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10364         break;
10365     case(0x0225):
10366         dissect_AdjustDCPBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10367         break;
10368     case(0x0226):
10369         dissect_AdjustPreambleLength_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10370         break;
10371     case(0x0227):
10372         dissect_CheckMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10373         break;
10374     case(0x0228):
10375         dissect_FiberOpticDiagnosisInfo_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10376         break;
10377     case(0x0229):
10378         dissect_AdjustMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10379         break;
10380     case(0x022A):
10381         dissect_PDIRSubframeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10382         break;
10383     case(0x022B):
10384         dissect_PDSubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10385         break;
10386 
10387     case(0x0230):
10388         dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10389         break;
10390     case(0x0231):
10391         dissect_MrpInstanceDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10392             break;
10393     case(0x0232):
10394         dissect_MrpInstanceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10395             break;
10396     case(0x0233):
10397         dissect_MrpInstanceDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10398             break;
10399 
10400     case(0x0240):
10401         dissect_PDInterfaceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10402         break;
10403     case(0x0241) :
10404         dissect_PDRsiInstances_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10405         break;
10406     case(0x0250):
10407         dissect_PDInterfaceAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10408         break;
10409     case(0x0251):
10410         dissect_PDPortStatistic_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10411         break;
10412     case(0x0400):
10413         dissect_MultipleBlockHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10414         break;
10415     case(0x0401):
10416         dissect_COContainerContent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u32RecDataLen, ar);
10417         break;
10418     case(0x0500):
10419         dissect_RecordDataReadQuery_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u16BodyLength);
10420         break;
10421     case(0x0600):
10422         dissect_FSHello_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10423         break;
10424     case(0x0601):
10425         dissect_FSParameter_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10426         break;
10427     case(0x0608):
10428         dissect_PDInterfaceFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10429         break;
10430     case(0x010B):
10431     case(0x0609):
10432         dissect_ARFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10433         break;
10434     case(0x0810):
10435         dissect_PE_EntityFilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10436         break;
10437     case(0x0811):
10438         dissect_PE_EntityStatusData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10439         break;
10440     case(0x0900):
10441         dissect_RS_AdjustObserver_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10442         break;
10443     case(0x0901):
10444         dissect_RS_GetEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10445         break;
10446     case(0x0902):
10447         dissect_RS_AckEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10448         break;
10449     case(0x0f00) :
10450         dissect_Maintenance_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10451         break;
10452     case(0x0f05):
10453         dissect_PE_Alarm_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10454         break;
10455     case(0x8001):
10456     case(0x8002):
10457         dissect_Alarm_ack_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10458         break;
10459     case(0x8008):
10460         dissect_IODWriteResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10461             u16Index, u32RecDataLen, ar);
10462         break;
10463     case(0x8009):
10464         dissect_IODReadResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow,
10465             u16Index, u32RecDataLen, ar);
10466         break;
10467     case(0x8101):
10468         dissect_ARBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar);
10469         break;
10470     case(0x8102):
10471         dissect_IOCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar);
10472         break;
10473     case(0x8103):
10474         dissect_AlarmCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar);
10475         break;
10476     case(0x8104):
10477         dissect_ModuleDiffBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
10478         break;
10479     case(0x8106):
10480         dissect_ARServerBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
10481         break;
10482     case(0x8110):
10483     case(0x8111):
10484     case(0x8112):
10485     case(0x8113):
10486     case(0x8114):
10487     case(0x8116):
10488     case(0x8117):
10489     case(0x8118):
10490         dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType);
10491         break;
10492     default:
10493         dissect_pn_undecoded(tvb, offset, pinfo, sub_tree, u16BodyLength);
10494     }
10495     offset += u16BodyLength;
10496 
10497     proto_item_set_len(sub_item, offset - u32SubStart);
10498 
10499     return offset;
10500 }
10501 
10502 
10503 /* dissect any PN-IO block */
10504 static int
dissect_a_block(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)10505 dissect_a_block(tvbuff_t *tvb, int offset,
10506     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10507 {
10508     guint16    u16Index = 0;
10509     guint32    u32RecDataLen;
10510     pnio_ar_t *ar       = NULL;
10511 
10512     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
10513 
10514     if (ar != NULL) {
10515         pnio_ar_info(tvb, pinfo, tree, ar);
10516     }
10517 
10518     return offset;
10519 }
10520 
10521 /* dissect any number of PN-IO blocks */
10522 int
dissect_blocks(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)10523 dissect_blocks(tvbuff_t *tvb, int offset,
10524     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10525 {
10526     guint16    u16Index = 0;
10527     guint32    u32RecDataLen;
10528     pnio_ar_t *ar       = NULL;
10529 
10530 
10531     while (tvb_captured_length(tvb) > (guint) offset) {
10532         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
10533         u16Index++;
10534     }
10535 
10536     if (ar != NULL) {
10537         pnio_ar_info(tvb, pinfo, tree, ar);
10538     }
10539 
10540     return offset;
10541 }
10542 
10543 
10544 /* dissect a PN-IO (DCE-RPC) request header */
10545 static int
dissect_IPNIO_rqst_header(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)10546 dissect_IPNIO_rqst_header(tvbuff_t *tvb, int offset,
10547     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10548 {
10549     guint32     u32ArgsMax;
10550     guint32     u32ArgsLen;
10551     guint32     u32MaxCount;
10552     guint32     u32Offset;
10553     guint32     u32ArraySize;
10554 
10555     proto_item *sub_item;
10556     proto_tree *sub_tree;
10557     guint32     u32SubStart;
10558 
10559 
10560     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM");
10561 
10562     /* args_max */
10563     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10564                         hf_pn_io_args_max, &u32ArgsMax);
10565     /* args_len */
10566     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10567                         hf_pn_io_args_len, &u32ArgsLen);
10568 
10569     sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA);
10570     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io);
10571     u32SubStart = offset;
10572 
10573     /* RPC array header */
10574     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10575                         hf_pn_io_array_max_count, &u32MaxCount);
10576     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10577                         hf_pn_io_array_offset, &u32Offset);
10578     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10579                         hf_pn_io_array_act_count, &u32ArraySize);
10580 
10581     proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u",
10582         u32MaxCount, u32Offset, u32ArraySize);
10583     proto_item_set_len(sub_item, offset - u32SubStart);
10584 
10585     return offset;
10586 }
10587 
10588 
10589 /* dissect a PN-IO (DCE-RPC) response header */
10590 static int
dissect_IPNIO_resp_header(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)10591 dissect_IPNIO_resp_header(tvbuff_t *tvb, int offset,
10592     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10593 {
10594     guint32     u32ArgsLen;
10595     guint32     u32MaxCount;
10596     guint32     u32Offset;
10597     guint32     u32ArraySize;
10598 
10599     proto_item *sub_item;
10600     proto_tree *sub_tree;
10601     guint32     u32SubStart;
10602 
10603 
10604     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM");
10605 
10606     offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep);
10607 
10608     /* args_len */
10609     offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
10610                         hf_pn_io_args_len, &u32ArgsLen);
10611 
10612     sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA);
10613     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io);
10614     u32SubStart = offset;
10615 
10616     /* RPC array header */
10617     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10618                         hf_pn_io_array_max_count, &u32MaxCount);
10619     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10620                         hf_pn_io_array_offset, &u32Offset);
10621     offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep,
10622                         hf_pn_io_array_act_count, &u32ArraySize);
10623 
10624     proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u",
10625         u32MaxCount, u32Offset, u32ArraySize);
10626     proto_item_set_len(sub_item, offset - u32SubStart);
10627 
10628     return offset;
10629 }
10630 
10631 
10632 /* dissect a PN-IO request */
10633 static int
dissect_IPNIO_rqst(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)10634 dissect_IPNIO_rqst(tvbuff_t *tvb, int offset,
10635     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10636 {
10637 
10638     offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep);
10639 
10640     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
10641 
10642     return offset;
10643 }
10644 
10645 
10646 /* dissect a PN-IO response */
10647 static int
dissect_IPNIO_resp(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)10648 dissect_IPNIO_resp(tvbuff_t *tvb, int offset,
10649     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
10650 {
10651 
10652     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
10653 
10654     offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
10655 
10656     return offset;
10657 }
10658 
10659 /* dissect a PROFIDrive parameter request */
10660 static int
dissect_ProfiDriveParameterRequest(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)10661 dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset,
10662     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10663 {
10664     guint8      request_reference;
10665     guint8      request_id;
10666     guint8      do_id;
10667     guint8      no_of_parameters;
10668     guint8      addr_idx;
10669     proto_item *profidrive_item;
10670     proto_tree *profidrive_tree;
10671 
10672     profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10673     profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_request);
10674     proto_item_set_text(profidrive_item, "PROFIDrive Parameter Request: ");
10675 
10676     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10677                         hf_pn_io_profidrive_request_reference, &request_reference);
10678     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10679                         hf_pn_io_profidrive_request_id, &request_id);
10680     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10681                         hf_pn_io_profidrive_do_id, &do_id);
10682     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10683                         hf_pn_io_profidrive_no_of_parameters, &no_of_parameters);
10684 
10685     proto_item_append_text(profidrive_item, "ReqRef:0x%02x, ReqId:%s, DO:%u, NoOfParameters:%u",
10686         request_reference, val_to_str(request_id, pn_io_profidrive_request_id_vals, "Unknown"),
10687         do_id, no_of_parameters);
10688 
10689     col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Write Request, ReqRef:0x%02x, %s DO:%u",
10690             request_reference,
10691             request_id==0x01 ? "Read" :
10692             request_id==0x02 ? "Change" :
10693                                "",
10694             do_id);
10695 
10696     /* Parameter address list */
10697     for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
10698         guint8 attribute;
10699         guint8 no_of_elems;
10700         guint16 parameter;
10701         guint16 idx;
10702         proto_item *sub_item;
10703         proto_tree *sub_tree;
10704 
10705         sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10706         sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_address);
10707         proto_item_set_text(sub_item, "Parameter Address %u: ", addr_idx+1);
10708 
10709         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10710                             hf_pn_io_profidrive_param_attribute, &attribute);
10711         offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10712                             hf_pn_io_profidrive_param_no_of_elems, &no_of_elems);
10713         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10714                             hf_pn_io_profidrive_param_number, &parameter);
10715         offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10716                             hf_pn_io_profidrive_param_subindex, &idx);
10717 
10718         proto_item_append_text(sub_item, "Attr:%s, Elems:%u, Parameter:%u, Index:%u",
10719             val_to_str(attribute, pn_io_profidrive_attribute_vals, "Unknown"), no_of_elems,
10720             parameter, idx);
10721 
10722             if (no_of_elems>1) {
10723                 col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d..%d]", parameter, idx, idx+no_of_elems-1);
10724             }
10725             else {
10726                 col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d]", parameter, idx);
10727             }
10728         }
10729 
10730     /* in case of change request parameter value list */
10731     if (request_id == 0x02) {
10732         for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
10733             guint8 format;
10734             guint8 no_of_vals;
10735             proto_item *sub_item;
10736             proto_tree *sub_tree;
10737 
10738             sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10739             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value);
10740             proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1);
10741 
10742             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10743                                 hf_pn_io_profidrive_param_format, &format);
10744             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10745                                 hf_pn_io_profidrive_param_no_of_values, &no_of_vals);
10746 
10747             proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u",
10748                 val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals);
10749 
10750             while (no_of_vals--)
10751             {
10752                 offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format);
10753             }
10754         }
10755     }
10756 
10757     return offset;
10758 }
10759 
10760 static int
dissect_ProfiDriveParameterResponse(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)10761 dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset,
10762     packet_info *pinfo, proto_tree *tree, guint8 *drep)
10763 {
10764     guint8      request_reference;
10765     guint8      response_id;
10766     guint8      do_id;
10767     guint8      no_of_parameters;
10768     guint8      addr_idx;
10769     proto_item *profidrive_item;
10770     proto_tree *profidrive_tree;
10771 
10772     profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10773     profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_response);
10774     proto_item_set_text(profidrive_item, "PROFIDrive Parameter Response: ");
10775     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10776                         hf_pn_io_profidrive_request_reference, &request_reference);
10777     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10778                         hf_pn_io_profidrive_response_id, &response_id);
10779     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10780                         hf_pn_io_profidrive_do_id, &do_id);
10781     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep,
10782                         hf_pn_io_profidrive_no_of_parameters, &no_of_parameters);
10783     proto_item_append_text(profidrive_item, "ReqRef:0x%02x, RspId:%s, DO:%u, NoOfParameters:%u",
10784         request_reference, val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown"),
10785         do_id, no_of_parameters);
10786     col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Read Response, ReqRef:0x%02x, RspId:%s",
10787                            request_reference,
10788                            val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown response"));
10789     /* in case of  parameter response value list */
10790     if (response_id == 0x01) {
10791         for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
10792             guint8 format;
10793             guint8 no_of_vals;
10794             proto_item *sub_item;
10795             proto_tree *sub_tree;
10796 
10797             sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10798             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value);
10799             proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1);
10800 
10801             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10802                                 hf_pn_io_profidrive_param_format, &format);
10803             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10804                                 hf_pn_io_profidrive_param_no_of_values, &no_of_vals);
10805 
10806             proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u",
10807                 val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals);
10808 
10809             while (no_of_vals--)
10810             {
10811                 offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format);
10812             }
10813         }
10814     }
10815 
10816     if(response_id == 0x02){
10817         // change parameter response ok, no data
10818     }
10819 
10820     if(response_id == 0x81){
10821          for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
10822             guint8 format;
10823             guint8 no_of_vals;
10824             guint16 value16;
10825             proto_item *sub_item;
10826             proto_tree *sub_tree;
10827 
10828             sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10829             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value);
10830             proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1);
10831 
10832             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10833                                 hf_pn_io_profidrive_param_format, &format);
10834             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10835                                 hf_pn_io_profidrive_param_no_of_values, &no_of_vals);
10836 
10837             proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u",
10838                 val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals);
10839 
10840             if(format == 0x44){
10841 
10842                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10843                                    hf_pn_io_profidrive_param_value_error, &value16);
10844                 if(value16 == 0x23){
10845 
10846                     addr_idx = no_of_parameters;
10847                 }
10848                 while (--no_of_vals)
10849                 {
10850                     switch(value16)
10851                     {
10852                         case 0x1:
10853                         case 0x2:
10854                         case 0x3:
10855                         case 0x6:
10856                         case 0x7:
10857                         case 0x14:
10858                         case 0x20:
10859                             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10860                                     hf_pn_io_profidrive_param_value_error_sub, &value16);
10861                             break;
10862                         default:
10863                             offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, 0x42);
10864                             break;
10865                     }
10866                 }
10867             }else{
10868                 while (no_of_vals--){
10869                     offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format);
10870                 }
10871             }
10872         }
10873     }
10874 
10875     if(response_id == 0x82){
10876 
10877         for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) {
10878             guint8 format;
10879             guint8 no_of_vals;
10880              guint16 value16;
10881             proto_item *sub_item;
10882             proto_tree *sub_tree;
10883 
10884             sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
10885             sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value);
10886             proto_item_set_text(sub_item, "Parameter Change Result %u: ", addr_idx+1);
10887 
10888             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10889                                 hf_pn_io_profidrive_param_format, &format);
10890             offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
10891                                 hf_pn_io_profidrive_param_no_of_values, &no_of_vals);
10892 
10893             proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u",
10894                 val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals);
10895 
10896             if(format == 0x44){
10897 
10898                 offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10899                                    hf_pn_io_profidrive_param_value_error, &value16);
10900 
10901                 if(value16 == 0x23){
10902                     addr_idx = no_of_parameters;
10903                 }
10904 
10905                 while (--no_of_vals)
10906                 {
10907                     switch(value16)
10908                     {
10909                         case 0x1:
10910                         case 0x2:
10911                         case 0x3:
10912                         case 0x6:
10913                         case 0x7:
10914                         case 0x14:
10915                         case 0x20:
10916 
10917                             offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep,
10918                                     hf_pn_io_profidrive_param_value_error_sub, &value16);
10919                             break;
10920                         default:
10921                             offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, 0x42);
10922                             break;
10923                     }
10924 
10925                 }
10926 
10927             }
10928         }
10929     }
10930     return offset;
10931 }
10932 
10933 static int
dissect_RecordDataRead(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint16 u16Index,guint32 u32RecDataLen)10934 dissect_RecordDataRead(tvbuff_t *tvb, int offset,
10935     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen)
10936 {
10937     const gchar *userProfile;
10938     pnio_ar_t   *ar = NULL;
10939 
10940     /* profidrive parameter access response */
10941     if (u16Index == 0xb02e || u16Index == 0xb02f || u16Index == 0x002f) {
10942         return dissect_ProfiDriveParameterResponse(tvb, offset, pinfo, tree, drep);
10943     }
10944 
10945     /* user specified format? */
10946     if (u16Index < 0x8000) {
10947         return dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data");
10948     }
10949 
10950 
10951 
10952     /* "reserved for profiles"? */
10953     userProfile = indexReservedForProfiles(u16Index);
10954     if (userProfile != NULL) {
10955         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile);
10956         return offset;
10957     }
10958 
10959     /* see: pn_io_index */
10960     /* single block only */
10961     switch (u16Index) {
10962     case(0x8010):   /* Maintenance required in channel coding for one subslot */
10963     case(0x8011):   /* Maintenance demanded in channel coding for one subslot */
10964     case(0x8012):   /* Maintenance required in all codings for one subslot */
10965     case(0x8013):   /* Maintenance demanded in all codings for one subslot */
10966     case(0x801e):   /* SubstituteValues for one subslot */
10967     case(0x8028):   /* RecordInputDataObjectElement for one subslot */
10968     case(0x8029):   /* RecordOutputDataObjectElement for one subslot */
10969     case(0x8050):   /* PDInterfaceMrpDataReal for one subslot */
10970     case(0x8051):   /* PDInterfaceMrpDataCheck for one subslot */
10971     case(0x8052):   /* PDInterfaceMrpDataAdjust for one subslot */
10972     case(0x8053):   /* PDPortMrpDataAdjust for one subslot */
10973     case(0x8054):   /* PDPortMrpDataReal for one subslot */
10974     case(0x8060):   /* PDPortFODataReal for one subslot */
10975     case(0x8061):   /* PDPortFODataCheck for one subslot */
10976     case(0x8062):   /* PDPortFODataAdjust for one subslot */
10977     case(0x8070):   /* PDNCDataCheck for one subslot */
10978     case(0x8071):   /* PDPortStatistic for one subslot */
10979     case(0x8080):   /* PDInterfaceDataReal */
10980     case(0x8090):   /* PDInterfaceFSUDataAdjust */
10981     case(0x80AF):   /* PE_EntityStatusData for one subslot */
10982     case(0x80CF):   /* RS_AdjustObserver */
10983 
10984     case(0xaff0):   /* I&M0 */
10985     case(0xaff1):   /* I&M1 */
10986     case(0xaff2):   /* I&M2 */
10987     case(0xaff3):   /* I&M3 */
10988     case(0xaff4):   /* I&M4 */
10989     case(0xaff5):   /* I&M5 */
10990     case(0xaff6):   /* I&M6 */
10991     case(0xaff7):   /* I&M7 */
10992     case(0xaff8):   /* I&M8 */
10993     case(0xaff9):   /* I&M9 */
10994     case(0xaffa):   /* I&M10 */
10995     case(0xaffb):   /* I&M11 */
10996     case(0xaffc):   /* I&M12 */
10997     case(0xaffd):   /* I&M13 */
10998     case(0xaffe):   /* I&M14 */
10999     case(0xafff):   /* I&M15 */
11000 
11001     case(0xc010):   /* Maintenance required in channel coding for one slot */
11002     case(0xc011):   /* Maintenance demanded in channel coding for one slot */
11003     case(0xc012):   /* Maintenance required in all codings for one slot */
11004     case(0xc013):   /* Maintenance demanded in all codings for one slot */
11005 
11006     case(0xe002):   /* ModuleDiffBlock for one AR */
11007     case(0xe010):   /* Maintenance required in channel coding for one AR */
11008     case(0xe011):   /* Maintenance demanded in channel coding for one AR */
11009     case(0xe012):   /* Maintenance required in all codings for one AR */
11010     case(0xe013):   /* Maintenance demanded in all codings for one AR */
11011 
11012     case(0xe030):   /* PE_EntityFilterData for one AR*/
11013     case(0xe031):   /* PE_EntityStatusData for one AR*/
11014 
11015     case(0xf010):   /* Maintenance required in channel coding for one API */
11016     case(0xf011):   /* Maintenance demanded in channel coding for one API */
11017     case(0xf012):   /* Maintenance required in all codings for one API */
11018     case(0xf013):   /* Maintenance demanded in all codings for one API */
11019     case(0xf020):   /* ARData for one API */
11020 
11021     case(0xf820):   /* ARData */
11022     case(0xf821):   /* APIData */
11023     case(0xf830):   /* LogData */
11024     case(0xf831):   /* PDevData */
11025     case(0xf870):   /* PE_EntityFilterData*/
11026     case(0xf871):   /* PE_EntityStatusData*/
11027     case(0xf880) : /* AssetManagementData */
11028     case(0xf8f1):   /* PDRsiInstances */
11029         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11030         break;
11031 
11032     case(0xf840):   /* I&M0FilterData */
11033         {
11034             int end_offset = offset + u32RecDataLen;
11035         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11036             if (end_offset > offset)
11037                 offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11038             if (end_offset > offset)
11039                 offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11040         }
11041         break;
11042 
11043     case(0xB050):
11044     case(0xB051):
11045     case(0xB060):
11046     case(0xB061):
11047 
11048        offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11049         break;
11050 
11051 
11052     /*** multiple blocks possible ***/
11053     case(0x8000):   /* ExpectedIdentificationData for one subslot */
11054     case(0x8001):   /* RealIdentificationData for one subslot */
11055     case(0x800a):   /* Diagnosis in channel decoding for one subslot */
11056     case(0x800b):   /* Diagnosis in all codings for one subslot */
11057     case(0x800c):   /* Diagnosis, Maintenance, Qualified and Status for one subslot */
11058 
11059     case(0x802a):   /* PDPortDataReal */
11060     case(0x802b):   /* PDPortDataCheck */
11061     case(0x802d):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */
11062     case(0x802e):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */
11063     case(0x802f):   /* PDPortDataAdjust */
11064     case(0x8030):   /* IsochronousModeData for one subslot */
11065     case(0x8031):   /* Expected PDSyncData for one subslot with SyncID value 1 */
11066     case(0x8032):
11067     case(0x8033):
11068     case(0x8034):
11069     case(0x8035):
11070     case(0x8036):
11071     case(0x8037):
11072     case(0x8038):
11073     case(0x8039):
11074     case(0x803a):
11075     case(0x803b):
11076     case(0x803c):
11077     case(0x803d):
11078     case(0x803e):
11079     case(0x803f):
11080     case(0x8040):   /* Expected PDSyncData for one subslot with SyncID value 2 ... 30 */
11081     case(0x8041):
11082     case(0x8042):
11083     case(0x8043):
11084     case(0x8044):
11085     case(0x8045):
11086     case(0x8046):
11087     case(0x8047):
11088     case(0x8048):
11089     case(0x8049):
11090     case(0x804a):
11091     case(0x804b):
11092     case(0x804c):
11093     case(0x804d):
11094     case(0x804e):
11095     case(0x804f):   /* Expected PDSyncData for one subslot with SyncID value 31 */
11096     case(0x8072):    /* PDPortStatistic for one subslot */
11097     case(0xc000):   /* ExpectedIdentificationData for one slot */
11098     case(0xc001):   /* RealIdentificationData for one slot */
11099     case(0xc00a):   /* Diagnosis in channel coding for one slot */
11100     case(0xc00b):   /* Diagnosis in all codings for one slot */
11101     case(0xc00c):   /* Diagnosis, Maintenance, Qualified and Status for one slot */
11102 
11103     case(0xe000):   /* ExpectedIdentificationData for one AR */
11104     case(0xe001):   /* RealIdentificationData for one AR */
11105     case(0xe00a):   /* Diagnosis in channel decoding for one AR */
11106     case(0xe00b):   /* Diagnosis in all codings for one AR */
11107     case(0xe00c):   /* Diagnosis, Maintenance, Qualified and Status for one AR */
11108     case(0xE060):   /* RS_GetEvent (using RecordDataRead service) */
11109     case(0xf000):   /* RealIdentificationData for one API */
11110     case(0xf00a):   /* Diagnosis in channel decoding for one API */
11111     case(0xf00b):   /* Diagnosis in all codings for one API */
11112     case(0xf00c):   /* Diagnosis, Maintenance, Qualified and Status for one API */
11113     case(0xf80c):   /* Diagnosis, Maintenance, Qualified and Status for one device */
11114     case(0xf841):   /* PDRealData */
11115     case(0xf842):   /* PDExpectedData */
11116         offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
11117         break;
11118     default:
11119         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen);
11120     }
11121 
11122     return offset;
11123 }
11124 
11125 
11126 /* dissect a PN-IO read response */
11127 static int
dissect_IPNIO_Read_resp(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)11128 dissect_IPNIO_Read_resp(tvbuff_t *tvb, int offset,
11129     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11130 {
11131     guint16    u16Index      = 0;
11132     guint32    u32RecDataLen = 0;
11133     pnio_ar_t *ar            = NULL;
11134 
11135     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
11136 
11137     /* When PNIOStatus is Error */
11138     if (!tvb_captured_length_remaining(tvb, offset))
11139         return offset;
11140 
11141     /* IODReadHeader */
11142     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11143 
11144     /* RecordDataRead */
11145     if (u32RecDataLen != 0) {
11146         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11147     }
11148 
11149     if (ar != NULL) {
11150         pnio_ar_info(tvb, pinfo, tree, ar);
11151     }
11152 
11153     return offset;
11154 }
11155 
11156 /* F-Parameter record data object */
11157 static int
dissect_ProfiSafeParameterRequest(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint16 u16Index,wmem_list_frame_t * frame)11158 dissect_ProfiSafeParameterRequest(tvbuff_t *tvb, int offset,
11159     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, wmem_list_frame_t *frame)
11160 {
11161     proto_item *f_item;
11162     proto_tree *f_tree;
11163     proto_item *flags1_item;
11164     proto_tree *flags1_tree;
11165     proto_item *flags2_item;
11166     proto_tree *flags2_tree;
11167     guint16     src_addr;
11168     guint16     dst_addr;
11169     guint16     wd_time;
11170     guint16     par_crc;
11171     guint32     ipar_crc = 0;
11172     guint8      prm_flag1;
11173     guint8      prm_flag1_chck_seq;
11174     guint8      prm_flag1_chck_ipar;
11175     guint8      prm_flag1_sil;
11176     guint8      prm_flag1_crc_len;
11177     guint8      prm_flag1_crc_seed;
11178     guint8      prm_flag1_reserved;
11179     guint8      prm_flag2;
11180     guint8      prm_flag2_reserved;
11181     guint8      prm_flag2_f_block_id;
11182     guint8      prm_flag2_f_par_version;
11183 
11184     conversation_t    *conversation;
11185     stationInfo       *station_info;
11186     ioDataObject      *io_data_object;
11187     wmem_list_frame_t *frame_out;
11188 
11189     ARUUIDFrame       *current_aruuid_frame = NULL;
11190     guint32            current_aruuid = 0;
11191 
11192     f_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA);
11193     f_tree = proto_item_add_subtree(f_item, ett_pn_io_profisafe_f_parameter);
11194     proto_item_set_text(f_item, "F-Parameter: ");
11195 
11196     flags1_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag1, tvb, offset, 1, ENC_BIG_ENDIAN);
11197     flags1_tree = proto_item_add_subtree(flags1_item, ett_pn_io_profisafe_f_parameter_prm_flag1);
11198 
11199     /* dissection of F_Prm_Flag1 */
11200     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11201         hf_pn_io_ps_f_prm_flag1_chck_seq, &prm_flag1_chck_seq);
11202     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11203         hf_pn_io_ps_f_prm_flag1_chck_ipar, &prm_flag1_chck_ipar);
11204     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11205         hf_pn_io_ps_f_prm_flag1_sil, &prm_flag1_sil);
11206     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11207         hf_pn_io_ps_f_prm_flag1_crc_len, &prm_flag1_crc_len);
11208     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11209         hf_pn_io_ps_f_prm_flag1_crc_seed, &prm_flag1_crc_seed);
11210     dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep,
11211         hf_pn_io_ps_f_prm_flag1_reserved, &prm_flag1_reserved);
11212     prm_flag1 = prm_flag1_chck_seq|prm_flag1_chck_ipar|prm_flag1_sil|prm_flag1_crc_len|prm_flag1_crc_seed|prm_flag1_reserved;
11213     offset++;
11214 
11215     flags2_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag2, tvb, offset, 1, ENC_BIG_ENDIAN);
11216     flags2_tree = proto_item_add_subtree(flags2_item, ett_pn_io_profisafe_f_parameter_prm_flag2);
11217 
11218     /* dissection of F_Prm_Flag2 */
11219     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11220         hf_pn_io_ps_f_prm_flag2_reserved, &prm_flag2_reserved);
11221     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11222         hf_pn_io_ps_f_prm_flag2_f_block_id, &prm_flag2_f_block_id);
11223     dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep,
11224         hf_pn_io_ps_f_prm_flag2_f_par_version, &prm_flag2_f_par_version);
11225     prm_flag2 = prm_flag2_reserved|prm_flag2_f_block_id|prm_flag2_f_par_version;
11226     offset++;
11227 
11228     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11229                     hf_pn_io_ps_f_src_adr, &src_addr);
11230     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11231                     hf_pn_io_ps_f_dest_adr, &dst_addr);
11232     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11233                     hf_pn_io_ps_f_wd_time, &wd_time);
11234 
11235     /* Dissection for F_iPar_CRC: see F_Prm_Flag2 -> F_Block_ID */
11236     if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) {
11237         offset = dissect_dcerpc_uint32(tvb, offset, pinfo, f_item, drep,
11238                         hf_pn_io_ps_f_ipar_crc, &ipar_crc);
11239     }
11240 
11241     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep,
11242                     hf_pn_io_ps_f_par_crc, &par_crc);
11243 
11244 
11245     /* Differniate between ipar_crc and no_ipar_crc */
11246     if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) {    /* include ipar_crc display */
11247         col_append_fstr(pinfo->cinfo, COL_INFO,
11248                         ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x,"
11249                          " dst:0x%04x, wd_time:%d, ipar_crc:0x%04x, crc:0x%04x",
11250                         prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc);
11251 
11252         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",
11253                 prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc);
11254     }
11255     else {    /* exclude ipar_crc display */
11256         col_append_fstr(pinfo->cinfo, COL_INFO,
11257                         ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x,"
11258                          " dst:0x%04x, wd_time:%d, crc:0x%04x",
11259                         prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc);
11260 
11261         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",
11262                 prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc);
11263     }
11264 
11265     if (!PINFO_FD_VISITED(pinfo)) {
11266         /* Get current conversation endpoints using MAC addresses */
11267         conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11268         if (conversation == NULL) {
11269             /* Create new conversation, if no "Ident OK" frame as been dissected yet!
11270              * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
11271              * All conversations are based on Device MAC as addr1 */
11272             conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
11273         }
11274 
11275         current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
11276 
11277         if (current_aruuid_frame != NULL) {
11278             current_aruuid = current_aruuid_frame->aruuid.data1;
11279         }
11280 
11281         station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
11282 
11283         if (station_info != NULL) {
11284             pn_find_dcp_station_info(station_info, conversation);
11285 
11286             if (frame != NULL) {
11287                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11288 
11289                 io_data_object->f_par_crc1 = par_crc;
11290                 io_data_object->f_src_adr = src_addr;
11291                 io_data_object->f_dest_adr = dst_addr;
11292                 io_data_object->f_crc_seed = prm_flag1 & 0x40;
11293                 if (!(prm_flag1 & 0x10)) {
11294                     if (prm_flag1 & 0x20) {
11295                         io_data_object->f_crc_len = 4;
11296                     } else {
11297                         io_data_object->f_crc_len = 3;
11298                     }
11299                 }
11300             }
11301 
11302             /* Find same module within output data to saved data */
11303             for (frame_out = wmem_list_head(station_info->ioobject_data_out); frame_out != NULL; frame_out = wmem_list_frame_next(frame_out)) {
11304                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame_out);
11305                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11306                     io_data_object->profisafeSupported &&               /* Arrayelement has to be PS-Module */
11307                     io_data_object->f_par_crc1 == 0) {                  /* Find following object with no f_par_crc1 */
11308 
11309                     io_data_object->f_par_crc1 = par_crc;
11310                     io_data_object->f_src_adr = src_addr;
11311                     io_data_object->f_dest_adr = dst_addr;
11312                     io_data_object->f_crc_seed = prm_flag1 & 0x40;
11313                     if (!(prm_flag1 & 0x10)) {
11314                         if (prm_flag1 & 0x20) {
11315                             io_data_object->f_crc_len = 4;
11316                         } else {
11317                             io_data_object->f_crc_len = 3;
11318                         }
11319                     }
11320 
11321                     break;
11322                 }
11323             }
11324         }
11325     }
11326 
11327     return offset;
11328 }
11329 
11330 static int
dissect_RecordDataWrite(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint16 u16Index,guint32 u32RecDataLen)11331 dissect_RecordDataWrite(tvbuff_t *tvb, int offset,
11332     packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen)
11333 {
11334     conversation_t    *conversation;
11335     stationInfo       *station_info;
11336     wmem_list_frame_t *frame;
11337     ioDataObject      *io_data_object;
11338 
11339     const gchar *userProfile;
11340     pnio_ar_t   *ar = NULL;
11341 
11342     ARUUIDFrame       *current_aruuid_frame = NULL;
11343     guint32            current_aruuid = 0;
11344 
11345     /* PROFISafe */
11346     /* Get current conversation endpoints using MAC addresses */
11347     conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
11348     if (conversation == NULL) {
11349         /* Create new conversation, if no "Ident OK" frame as been dissected yet!
11350         * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
11351         * All conversations are based on Device MAC as addr1 */
11352         conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
11353     }
11354 
11355     current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo);
11356 
11357     if (current_aruuid_frame != NULL) {
11358         current_aruuid = current_aruuid_frame->aruuid.data1;
11359     }
11360 
11361     station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid);
11362 
11363     if (station_info != NULL) {
11364         pn_find_dcp_station_info(station_info, conversation);
11365 
11366         if (!PINFO_FD_VISITED(pinfo)) {
11367             /* Search within the entire existing list for current input object data */
11368             for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) {
11369                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11370                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11371                     io_data_object->profisafeSupported &&               /* Arrayelement has to be PS-Module */
11372                     io_data_object->f_par_crc1 == 0) {                  /* Find following object with no f_par_crc1 */
11373 
11374                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11375                 }
11376             }
11377         }
11378         else {
11379             /* User clicked another time the frame to see the data -> PROFIsafe data has already been saved
11380              * Check whether the device contains an PROFIsafe supported submodule.
11381              */
11382 
11383             for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) {
11384                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11385                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11386                     io_data_object->profisafeSupported) {               /* Arrayelement has to be PS-Module */
11387 
11388                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11389                 }
11390             }
11391 
11392             for (frame = wmem_list_head(station_info->ioobject_data_out); frame != NULL; frame = wmem_list_frame_next(frame)) {
11393                 io_data_object = (ioDataObject*)wmem_list_frame_data(frame);
11394                 if (u16Index == io_data_object->fParameterIndexNr &&    /* Check F-Parameter Indexnumber */
11395                     io_data_object->profisafeSupported) {               /* Arrayelement has to be PS-Module */
11396 
11397                     return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame);
11398                 }
11399             }
11400         }
11401     }
11402     /* profidrive parameter request */
11403     if (u16Index == 0xb02e || u16Index == 0xb02f || u16Index == 0x002f) {
11404         return dissect_ProfiDriveParameterRequest(tvb, offset, pinfo, tree, drep);
11405     }
11406 
11407     /* user specified format? */
11408     if (u16Index < 0x8000) {
11409         return dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data");
11410     }
11411 
11412 
11413 
11414     /* "reserved for profiles"? */
11415     userProfile = indexReservedForProfiles(u16Index);
11416     if (userProfile != NULL) {
11417         offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile);
11418         return offset;
11419     }
11420 
11421     /* see: pn_io_index */
11422     switch (u16Index) {
11423     case(0x8020):   /* PDIRSubframeData */
11424     case(0x801e):   /* SubstituteValues for one subslot */
11425     case(0x802b):   /* PDPortDataCheck for one subslot */
11426     case(0x802c):   /* PDirData for one subslot */
11427     case(0x802d):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */
11428     case(0x802e):   /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */
11429     case(0x802f):   /* PDPortDataAdjust for one subslot */
11430     case(0x8030):   /* IsochronousModeData for one subslot */
11431     case(0x8051):   /* PDInterfaceMrpDataCheck for one subslot */
11432     case(0x8052):   /* PDInterfaceMrpDataAdjust for one subslot */
11433     case(0x8053):   /* PDPortMrpDataAdjust for one subslot */
11434     case(0x8061):   /* PDPortFODataCheck for one subslot */
11435     case(0x8062):   /* PDPortFODataAdjust for one subslot */
11436     case(0x8070):   /* PDNCDataCheck for one subslot */
11437     case(0x8071):   /* PDInterfaceAdjust */
11438     case(0x8090):   /* PDInterfaceFSUDataAdjust */
11439     case(0x80B0):   /* CombinedObjectContainer*/
11440     case(0x80CF):   /* RS_AdjustObserver */
11441     case(0xaff3):   /* I&M3 */
11442     case(0xe050):   /* FastStartUp data for one AR */
11443     case(0xe061):   /* RS_AckEvent (using RecordDataWrite service) */
11444         offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11445         break;
11446     default:
11447         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen);
11448     }
11449 
11450     return offset;
11451 }
11452 
11453 #define PN_IO_MAX_RECURSION_DEPTH 100
11454 
11455 static int
dissect_IODWriteReq(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,pnio_ar_t ** ar,guint recursion_count)11456 dissect_IODWriteReq(tvbuff_t *tvb, int offset,
11457     packet_info *pinfo, proto_tree *tree, guint8 *drep, pnio_ar_t **ar, guint recursion_count)
11458 {
11459     guint16 u16Index = 0;
11460     guint32 u32RecDataLen = 0;
11461 
11462     if (++recursion_count >= PN_IO_MAX_RECURSION_DEPTH) {
11463         proto_tree_add_expert(tree, pinfo, &ei_pn_io_max_recursion_depth_reached,
11464                               tvb, 0, 0);
11465         return tvb_captured_length(tvb);
11466     }
11467 
11468     /* IODWriteHeader */
11469     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, ar);
11470 
11471     /* IODWriteMultipleReq? */
11472     if (u16Index == 0xe040) {
11473         while (tvb_captured_length_remaining(tvb, offset) > 0) {
11474             offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, ar, recursion_count++);
11475         }
11476     } else {
11477         tvbuff_t *new_tvb = tvb_new_subset_length(tvb, offset, u32RecDataLen);
11478         /* RecordDataWrite */
11479         offset += dissect_RecordDataWrite(new_tvb, 0, pinfo, tree, drep, u16Index, u32RecDataLen);
11480 
11481         /* Padding */
11482         switch (offset % 4) {
11483         case(3):
11484             offset += 1;
11485             break;
11486         case(2):
11487             offset += 2;
11488             break;
11489         case(1):
11490             offset += 3;
11491             break;
11492         default: /* will not execute because of the line preceding the switch */
11493             break;
11494         }
11495     }
11496 
11497     return offset;
11498 }
11499 
11500 /* dissect a PN-IO write request */
11501 static int
dissect_IPNIO_Write_rqst(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)11502 dissect_IPNIO_Write_rqst(tvbuff_t *tvb, int offset,
11503     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11504 {
11505     pnio_ar_t *ar = NULL;
11506     guint recursion_count = 0;
11507 
11508     offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep);
11509 
11510     offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count);
11511 
11512     if (ar != NULL) {
11513         pnio_ar_info(tvb, pinfo, tree, ar);
11514     }
11515 
11516     return offset;
11517 }
11518 
11519 
11520 
11521 static int
dissect_IODWriteRes(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)11522 dissect_IODWriteRes(tvbuff_t *tvb, int offset,
11523     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11524 {
11525     guint16    u16Index = 0;
11526     guint32    u32RecDataLen;
11527     pnio_ar_t *ar       = NULL;
11528 
11529 
11530     /* IODWriteResHeader */
11531     offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11532 
11533     /* IODWriteMultipleRes? */
11534     if (u16Index == 0xe040) {
11535         while (tvb_captured_length_remaining(tvb, offset) > 0) {
11536             offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar);
11537         }
11538     }
11539 
11540     if (ar != NULL) {
11541         pnio_ar_info(tvb, pinfo, tree, ar);
11542     }
11543 
11544     return offset;
11545 }
11546 
11547 
11548 /* dissect a PN-IO write response */
11549 static int
dissect_IPNIO_Write_resp(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,dcerpc_info * di,guint8 * drep)11550 dissect_IPNIO_Write_resp(tvbuff_t *tvb, int offset,
11551     packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
11552 {
11553 
11554     offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep);
11555 
11556     offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep);
11557 
11558     return offset;
11559 }
11560 
11561 
11562 /* dissect any number of PN-RSI blocks */
11563 int
dissect_rsi_blocks(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep,guint32 u32FOpnumOffsetOpnum,int type)11564 dissect_rsi_blocks(tvbuff_t* tvb, int offset,
11565     packet_info* pinfo, proto_tree* tree, guint8* drep, guint32 u32FOpnumOffsetOpnum, int type)
11566 {
11567     pnio_ar_t* ar = NULL;
11568     guint      recursion_count = 0;
11569     guint16    u16Index = 0;
11570     guint32    u32RecDataLen = 0;
11571 
11572 
11573     switch (u32FOpnumOffsetOpnum) {
11574     case(0x0): // Connect request or response
11575         offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
11576         break;
11577     case(0x2): // Read request or response
11578         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11579         break;
11580     case(0x3): // Write request or response
11581         if (type == PDU_TYPE_REQ)
11582             offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count);
11583         else if (type == PDU_TYPE_RSP)
11584             offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep);
11585         break;
11586     case(0x4): // Control request or response
11587         offset = dissect_blocks(tvb, offset, pinfo, tree, drep);
11588         break;
11589     case(0x5): // ReadImplicit request or response
11590         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11591         break;
11592     case(0x6): // ReadConnectionless request or response
11593         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11594         break;
11595     case(0x7): // ReadNotification request or response
11596         offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen);
11597         break;
11598     case(0x8): // PrmWriteMore request or response
11599         if (type == PDU_TYPE_REQ)
11600             offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count);
11601         else if (type == PDU_TYPE_RSP)
11602             offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep);
11603         break;
11604     case(0x9): // PrmWriteEnd request or response
11605         if (type == PDU_TYPE_REQ)
11606             offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count);
11607         else if (type == PDU_TYPE_RSP)
11608             offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep);
11609         break;
11610     default:
11611         col_append_str(pinfo->cinfo, COL_INFO, "Reserved");
11612         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb));
11613         break;
11614     }
11615 
11616     if (ar != NULL) {
11617         pnio_ar_info(tvb, pinfo, tree, ar);
11618     }
11619 
11620     return offset;
11621 }
11622 
11623 
11624 /* dissect the IOxS (IOCS, IOPS) field */
11625 static int
dissect_PNIO_IOxS(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 * drep _U_,int hfindex)11626 dissect_PNIO_IOxS(tvbuff_t *tvb, int offset,
11627                   packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex)
11628 {
11629 
11630     if (tree) {
11631         guint8      u8IOxS;
11632         proto_item *ioxs_item;
11633         proto_tree *ioxs_tree;
11634 
11635         u8IOxS = tvb_get_guint8(tvb, offset);
11636 
11637         /* add ioxs subtree */
11638         ioxs_item = proto_tree_add_uint(tree, hfindex, tvb, offset, 1, u8IOxS);
11639         proto_item_append_text(ioxs_item,
11640                                " (%s%s)",
11641                                (u8IOxS & 0x01) ? "another IOxS follows " : "",
11642                                (u8IOxS & 0x80) ? "good" : "bad");
11643         ioxs_tree = proto_item_add_subtree(ioxs_item, ett_pn_io_ioxs);
11644 
11645         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_datastate, tvb, offset, 1, u8IOxS);
11646         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_instance,  tvb, offset, 1, u8IOxS);
11647         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_res14,     tvb, offset, 1, u8IOxS);
11648         proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_extension, tvb, offset, 1, u8IOxS);
11649     }
11650 
11651     return offset + 1;
11652 }
11653 
11654 
11655 /* dissect a PN-IO Cyclic Service Data Unit (on top of PN-RT protocol) */
11656 static int
dissect_PNIO_C_SDU(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep _U_)11657 dissect_PNIO_C_SDU(tvbuff_t *tvb, int offset,
11658     packet_info *pinfo, proto_tree *tree, guint8 *drep _U_)
11659 {
11660     proto_tree  *data_tree = NULL;
11661     /* gint iTotalLen    = 0; */
11662     /* gint iSubFrameLen = 0; */
11663 
11664     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO");
11665 
11666     if (tree) {
11667         proto_item *data_item;
11668         data_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb),
11669             "PROFINET IO Cyclic Service Data Unit: %u bytes", tvb_captured_length(tvb));
11670         data_tree = proto_item_add_subtree(data_item, ett_pn_io_rtc);
11671     }
11672 
11673     /*dissect_dcerpc_uint16(tvb, offset, pinfo, data_tree, drep, hf_pn_io_packedframe_SFCRC, &u16SFCRC);*/
11674     if (dissect_CSF_SDU_heur(tvb, pinfo, data_tree, NULL))
11675         return(tvb_captured_length(tvb));
11676 
11677     /* XXX - dissect the remaining data */
11678     /* this will be one or more DataItems followed by an optional GAP and RTCPadding */
11679     /* as we don't have the required context information to dissect the specific DataItems, */
11680     /* this will be tricky :-( */
11681     /* actual: there may be an IOxS but most case there isn't so better display a data-stream */
11682     /* offset = dissect_PNIO_IOxS(tvb, offset, pinfo, data_tree, drep, hf_pn_io_ioxs);        */
11683     offset = dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset),
11684         "User Data (including GAP and RTCPadding)");
11685 
11686     return offset;
11687 }
11688 
11689 
11690 /* dissect a PN-IO RTA PDU (on top of PN-RT protocol) */
11691 static int
dissect_PNIO_RTA(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,guint8 * drep)11692 dissect_PNIO_RTA(tvbuff_t *tvb, int offset,
11693     packet_info *pinfo, proto_tree *tree, guint8 *drep)
11694 {
11695     guint16     u16AlarmDstEndpoint;
11696     guint16     u16AlarmSrcEndpoint;
11697     guint8      u8PDUType;
11698     guint8      u8PDUVersion;
11699     guint8      u8WindowSize;
11700     guint8      u8Tack;
11701     guint16     u16SendSeqNum;
11702     guint16     u16AckSeqNum;
11703     guint16     u16VarPartLen;
11704     int         start_offset = offset;
11705     guint16     u16Index     = 0;
11706     guint32     u32RecDataLen;
11707     pnio_ar_t  *ar           = NULL;
11708 
11709 
11710     proto_item *rta_item;
11711     proto_tree *rta_tree;
11712 
11713     proto_item *sub_item;
11714     proto_tree *sub_tree;
11715 
11716 
11717     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-AL");
11718 
11719     rta_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb),
11720         "PROFINET IO Alarm");
11721     rta_tree = proto_item_add_subtree(rta_item, ett_pn_io_rta);
11722 
11723     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11724                     hf_pn_io_alarm_dst_endpoint, &u16AlarmDstEndpoint);
11725     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11726                     hf_pn_io_alarm_src_endpoint, &u16AlarmSrcEndpoint);
11727 
11728     col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: 0x%x, Dst: 0x%x",
11729         u16AlarmSrcEndpoint, u16AlarmDstEndpoint);
11730 
11731     /* PDU type */
11732     sub_item = proto_tree_add_item(rta_tree, hf_pn_io_pdu_type, tvb, offset, 1, ENC_NA);
11733     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type);
11734     dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11735                     hf_pn_io_pdu_type_type, &u8PDUType);
11736     u8PDUType &= 0x0F;
11737     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11738                     hf_pn_io_pdu_type_version, &u8PDUVersion);
11739     u8PDUVersion >>= 4;
11740     proto_item_append_text(sub_item, ", Type: %s, Version: %u",
11741         val_to_str(u8PDUType, pn_io_pdu_type, "Unknown"),
11742         u8PDUVersion);
11743 
11744     /* additional flags */
11745     sub_item = proto_tree_add_item(rta_tree, hf_pn_io_add_flags, tvb, offset, 1, ENC_NA);
11746     sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_add_flags);
11747     dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11748                     hf_pn_io_window_size, &u8WindowSize);
11749     u8WindowSize &= 0x0F;
11750     offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep,
11751                     hf_pn_io_tack, &u8Tack);
11752     u8Tack >>= 4;
11753     proto_item_append_text(sub_item, ", Window Size: %u, Tack: %u",
11754         u8WindowSize, u8Tack);
11755 
11756     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11757                     hf_pn_io_send_seq_num, &u16SendSeqNum);
11758     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11759                     hf_pn_io_ack_seq_num, &u16AckSeqNum);
11760     offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep,
11761                     hf_pn_io_var_part_len, &u16VarPartLen);
11762 
11763     switch ( u8PDUType & 0x0F) {
11764     case(1):    /* Data-RTA */
11765         col_append_str(pinfo->cinfo, COL_INFO, ", Data-RTA");
11766         offset = dissect_block(tvb, offset, pinfo, rta_tree, drep, &u16Index, &u32RecDataLen, &ar);
11767         break;
11768     case(2):    /* NACK-RTA */
11769             col_append_str(pinfo->cinfo, COL_INFO, ", NACK-RTA");
11770         /* no additional data */
11771         break;
11772     case(3):    /* ACK-RTA */
11773             col_append_str(pinfo->cinfo, COL_INFO, ", ACK-RTA");
11774         /* no additional data */
11775         break;
11776     case(4):    /* ERR-RTA */
11777             col_append_str(pinfo->cinfo, COL_INFO, ", ERR-RTA");
11778         offset = dissect_PNIO_status(tvb, offset, pinfo, rta_tree, drep);
11779         break;
11780     default:
11781         offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb));
11782     }
11783 
11784     proto_item_set_len(rta_item, offset - start_offset);
11785 
11786     return offset;
11787 }
11788 
11789 
11790 /* possibly dissect a PN-IO related PN-RT packet */
11791 static gboolean
dissect_PNIO_heur(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)11792 dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
11793     void *data)
11794 {
11795     guint8   drep_data = 0;
11796     guint8  *drep      = &drep_data;
11797     /* the sub tvb will NOT contain the frame_id here! */
11798     guint16  u16FrameID = GPOINTER_TO_UINT(data);
11799     heur_dtbl_entry_t *hdtbl_entry;
11800 
11801     /*
11802      * In case the packet is a protocol encoded in the basic PNIO transport stream,
11803      * give that protocol a chance to make a heuristic dissection, before we continue
11804      * to dissect it as a normal PNIO packet.
11805      */
11806     if (dissector_try_heuristic(heur_pn_subdissector_list, tvb, pinfo, tree, &hdtbl_entry, NULL))
11807         return TRUE;
11808 
11809     /* is this a (none DFP) PNIO class 3 data packet? */
11810     /* frame id must be in valid range (cyclic Real-Time, class=3) */
11811     if ((u16FrameID >= 0x0100 && u16FrameID <= 0x06FF) ||   /* RTC3 non redundant */
11812         (u16FrameID >= 0x700 && u16FrameID <= 0x0fff)) {    /* RTC3 redundant */
11813         dissect_CSF_SDU_heur(tvb, pinfo, tree, data);
11814         return TRUE;
11815     }
11816 
11817     /* The following range is reserved for following developments */
11818     /* frame id must be in valid range (Reserved) and
11819      * first byte (CBA version field) has to be != 0x11 */
11820     if (u16FrameID >= 0x1000 && u16FrameID <= 0x7fff) {
11821         dissect_PNIO_C_SDU(tvb, 0, pinfo, tree, drep);
11822         return TRUE;
11823     }
11824 
11825     /* is this a PNIO class 1 data packet? */
11826     /* frame id must be in valid range (cyclic Real-Time, class=1) and
11827      * first byte (CBA version field) has to be != 0x11 */
11828     if (u16FrameID >= 0x8000 && u16FrameID < 0xbfff) {
11829         dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep, u16FrameID);
11830         return TRUE;
11831     }
11832 
11833     /* is this a PNIO class 1 (legacy) data packet? */
11834     /* frame id must be in valid range (cyclic Real-Time, class=1, legacy) and
11835      * first byte (CBA version field) has to be != 0x11 */
11836     if (u16FrameID >= 0xc000 && u16FrameID < 0xfbff) {
11837         dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep, u16FrameID);
11838         return TRUE;
11839     }
11840 
11841     /* is this a PNIO high priority alarm packet? */
11842     if (u16FrameID == 0xfc01) {
11843         col_set_str(pinfo->cinfo, COL_INFO, "Alarm High");
11844 
11845         dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep);
11846         return TRUE;
11847     }
11848 
11849     /* is this a PNIO low priority alarm packet? */
11850     if (u16FrameID == 0xfe01) {
11851         col_set_str(pinfo->cinfo, COL_INFO, "Alarm Low");
11852 
11853         dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep);
11854         return TRUE;
11855     }
11856 
11857     /* is this a Remote Service Interface (RSI) packet*/
11858     if (u16FrameID == 0xfe02) {
11859         dissect_PNIO_RSI(tvb, 0, pinfo, tree, drep);
11860         return TRUE;
11861     }
11862 
11863     /* this PN-RT packet doesn't seem to be PNIO specific */
11864     return FALSE;
11865 }
11866 
11867 
11868 
11869 static gboolean
pn_io_ar_conv_valid(packet_info * pinfo)11870 pn_io_ar_conv_valid(packet_info *pinfo)
11871 {
11872     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
11873 
11874     return ((profinet_type != NULL) && (GPOINTER_TO_UINT(profinet_type) == 10));
11875 }
11876 
11877 static gchar *
pn_io_ar_conv_filter(packet_info * pinfo)11878 pn_io_ar_conv_filter(packet_info *pinfo)
11879 {
11880     pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0);
11881     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
11882     char      *buf;
11883     address   controllermac_addr, devicemac_addr;
11884 
11885     if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) {
11886         return NULL;
11887     }
11888 
11889     set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
11890     set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
11891 
11892     buf = g_strdup_printf(
11893         "pn_io.ar_uuid == %s || "                                   /* ARUUID */
11894         "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "   /* Alarm CR (contr -> dev) */
11895         "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",      /* Alarm CR (dev -> contr) */
11896          guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid),
11897         ar->controlleralarmref, address_to_str(pinfo->pool, &controllermac_addr),
11898         ar->devicealarmref, address_to_str(pinfo->pool, &devicemac_addr));
11899     return buf;
11900 }
11901 
11902 static gchar *
pn_io_ar_conv_data_filter(packet_info * pinfo)11903 pn_io_ar_conv_data_filter(packet_info *pinfo)
11904 {
11905     pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0);
11906     void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0);
11907     char      *buf, *controllermac_str, *devicemac_str, *guid_str;
11908     address   controllermac_addr, devicemac_addr;
11909 
11910     if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) {
11911         return NULL;
11912     }
11913 
11914     set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac);
11915     set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac);
11916 
11917     controllermac_str = address_to_str(pinfo->pool, &controllermac_addr);
11918     devicemac_str = address_to_str(pinfo->pool, &devicemac_addr);
11919     guid_str = guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid);
11920     if (ar->arType == 0x0010) /* IOCARSingle using RT_CLASS_3 */
11921     {
11922         buf = g_strdup_printf(
11923             "pn_io.ar_uuid == %s || "                                           /* ARUUID */
11924             "(pn_rt.frame_id == 0x%x) || (pn_rt.frame_id == 0x%x) || "
11925             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "           /* Alarm CR (contr -> dev) */
11926             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",              /* Alarm CR (dev -> contr) */
11927             guid_str,
11928             ar->inputframeid, ar->outputframeid,
11929             ar->controlleralarmref, controllermac_str,
11930             ar->devicealarmref, devicemac_str);
11931     }
11932     else
11933     {
11934         buf = g_strdup_printf(
11935             "pn_io.ar_uuid == %s || "                                           /* ARUUID */
11936             "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || "    /* Input CR && dev MAC -> contr MAC */
11937             "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || "    /* Output CR && contr MAC -> dev MAC */
11938             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || "           /* Alarm CR (contr -> dev) */
11939             "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)",              /* Alarm CR (dev -> contr) */
11940             guid_str,
11941             ar->inputframeid, devicemac_str, controllermac_str,
11942             ar->outputframeid, controllermac_str, devicemac_str,
11943             ar->controlleralarmref, controllermac_str,
11944             ar->devicealarmref, devicemac_str);
11945     }
11946     return buf;
11947 }
11948 
11949 
11950 
11951 /* the PNIO dcerpc interface table */
11952 static dcerpc_sub_dissector pn_io_dissectors[] = {
11953     { 0, "Connect",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
11954     { 1, "Release",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
11955     { 2, "Read",          dissect_IPNIO_rqst,       dissect_IPNIO_Read_resp },
11956     { 3, "Write",         dissect_IPNIO_Write_rqst, dissect_IPNIO_Write_resp },
11957     { 4, "Control",       dissect_IPNIO_rqst,       dissect_IPNIO_resp },
11958     { 5, "Read Implicit", dissect_IPNIO_rqst,       dissect_IPNIO_Read_resp },
11959     { 0, NULL, NULL, NULL }
11960 };
11961 
11962 
11963 static void
pnio_cleanup(void)11964 pnio_cleanup(void) {
11965     g_list_free(pnio_ars);
11966     pnio_ars = NULL;
11967 }
11968 
11969 
11970 static void
pnio_setup(void)11971 pnio_setup(void) {
11972     aruuid_frame_setup_list = wmem_list_new(wmem_file_scope());
11973 }
11974 
11975 
11976 void
proto_register_pn_io(void)11977 proto_register_pn_io (void)
11978 {
11979     static hf_register_info hf[] = {
11980     { &hf_pn_io_opnum,
11981       { "Operation", "pn_io.opnum",
11982         FT_UINT16, BASE_DEC, NULL, 0x0,
11983         NULL, HFILL }
11984     },
11985     { &hf_pn_io_reserved16,
11986       { "Reserved", "pn_io.reserved16",
11987         FT_UINT16, BASE_HEX, NULL, 0x0,
11988         NULL, HFILL }
11989     },
11990     { &hf_pn_io_array,
11991       { "Array", "pn_io.array",
11992         FT_NONE, BASE_NONE, NULL, 0x0,
11993         NULL, HFILL }
11994     },
11995     { &hf_pn_io_args_max,
11996       { "ArgsMaximum", "pn_io.args_max",
11997         FT_UINT32, BASE_DEC, NULL, 0x0,
11998         NULL, HFILL }
11999     },
12000     { &hf_pn_io_args_len,
12001       { "ArgsLength", "pn_io.args_len",
12002         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12003         NULL, HFILL }
12004     },
12005     { &hf_pn_io_array_max_count,
12006       { "MaximumCount", "pn_io.array_max_count",
12007         FT_UINT32, BASE_DEC, NULL, 0x0,
12008         NULL, HFILL }
12009     },
12010     { &hf_pn_io_array_offset,
12011       { "Offset", "pn_io.array_offset",
12012         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12013         NULL, HFILL }
12014     },
12015     { &hf_pn_io_array_act_count,
12016       { "ActualCount", "pn_io.array_act_count",
12017         FT_UINT32, BASE_DEC, NULL, 0x0,
12018         NULL, HFILL }
12019     },
12020 
12021     { &hf_pn_io_ar_data,
12022       { "ARDATA for AR:", "pn_io.ar_data",
12023         FT_NONE, BASE_NONE, 0x0, 0x0,
12024         NULL, HFILL }
12025     },
12026     { &hf_pn_io_ar_type,
12027       { "ARType", "pn_io.ar_type",
12028         FT_UINT16, BASE_HEX, VALS(pn_io_ar_type), 0x0,
12029         NULL, HFILL }
12030     },
12031     { &hf_pn_io_cminitiator_macadd,
12032       { "CMInitiatorMacAdd", "pn_io.cminitiator_mac_add",
12033         FT_ETHER, BASE_NONE, 0x0, 0x0,
12034         NULL, HFILL }
12035     },
12036     { &hf_pn_io_cminitiator_objectuuid,
12037       { "CMInitiatorObjectUUID", "pn_io.cminitiator_uuid",
12038         FT_GUID, BASE_NONE, 0x0, 0x0,
12039         NULL, HFILL }
12040     },
12041         { &hf_pn_io_parameter_server_objectuuid,
12042           { "ParameterServerObjectUUID", "pn_io.parameter_server_objectuuid",
12043             FT_GUID, BASE_NONE, 0x0, 0x0,
12044             NULL, HFILL }
12045         },
12046     { &hf_pn_io_ar_properties,
12047       { "ARProperties", "pn_io.ar_properties",
12048         FT_UINT32, BASE_HEX, NULL, 0x0,
12049         NULL, HFILL }
12050     },
12051     { &hf_pn_io_ar_properties_state,
12052       { "State", "pn_io.ar_properties.state",
12053         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_state), 0x00000007,
12054         NULL, HFILL }
12055     },
12056     { &hf_pn_io_ar_properties_supervisor_takeover_allowed,
12057       { "SupervisorTakeoverAllowed", "pn_io.ar_properties.supervisor_takeover_allowed",
12058         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_supervisor_takeover_allowed), 0x00000008,
12059         NULL, HFILL }
12060     },
12061     { &hf_pn_io_ar_properties_parameterization_server,
12062       { "ParameterizationServer", "pn_io.ar_properties.parameterization_server",
12063         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_parameterization_server), 0x00000010,
12064         NULL, HFILL }
12065     },
12066     { &hf_pn_io_artype_req,
12067         { "ARType", "pn_io.artype_req",
12068            FT_STRING, BASE_NONE, NULL, 0x0,
12069            NULL, HFILL }},
12070     { &hf_pn_io_ar_properties_companion_ar,
12071       { "CompanionAR", "pn_io.ar_properties.companion_ar",
12072         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_companion_ar), 0x00000600,
12073         NULL, HFILL }
12074     },
12075     { &hf_pn_io_ar_properties_achnowledge_companion_ar,
12076       { "AcknowledgeCompanionAR", "pn_io.ar_properties.acknowledge_companion_ar",
12077         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_acknowldege_companion_ar), 0x00000800,
12078         NULL, HFILL }
12079     },
12080     { &hf_pn_io_ar_properties_reserved,
12081       { "Reserved", "pn_io.ar_properties.reserved",
12082         FT_UINT32, BASE_HEX, NULL, 0x1FFFF000,
12083         NULL, HFILL }
12084     },
12085     { &hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode,
12086       { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container",
12087         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_legacy_startupmode), 0x20000000,
12088         NULL, HFILL }
12089     },
12090     { &hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode,
12091     { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container",
12092        FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_advanced_startupmode), 0x20000000,
12093        NULL, HFILL }
12094     },
12095     { &hf_pn_io_arproperties_StartupMode,
12096       { "StartupMode", "pn_io.ar_properties.StartupMode",
12097         FT_UINT32, BASE_HEX, VALS(pn_io_arpropertiesStartupMode), 0x40000000,
12098         NULL, HFILL }
12099     },
12100     { &hf_pn_io_ar_properties_pull_module_alarm_allowed,
12101       { "PullModuleAlarmAllowed", "pn_io.ar_properties.pull_module_alarm_allowed",
12102         FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_pull_module_alarm_allowed), 0x80000000,
12103         NULL, HFILL }
12104     },
12105     { &hf_pn_RedundancyInfo,
12106       { "RedundancyInfo.EndPoint", "pn_io.srl_data.redundancyInfo",
12107         FT_UINT16, BASE_HEX, VALS(pn_io_RedundancyInfo), 0x0003,
12108         NULL, HFILL }
12109     },
12110     { &hf_pn_RedundancyInfo_reserved,
12111       { "RedundancyInfo.reserved", "pn_io.srl_data.redundancyInfoReserved",
12112         FT_UINT16, BASE_HEX, NULL, 0xFFFFFFFC,
12113         NULL, HFILL }
12114     },
12115     { &hf_pn_io_number_of_ARDATAInfo,
12116       { "ARDataInfo.NumberOfEntries", "pn_io.number_of_ARDATAInfo",
12117         FT_UINT16, BASE_DEC, NULL, 0x0,
12118         NULL, HFILL }
12119     },
12120 
12121     { &hf_pn_io_cminitiator_activitytimeoutfactor,
12122       { "CMInitiatorActivityTimeoutFactor", "pn_io.cminitiator_activitytimeoutfactor",
12123         FT_UINT16, BASE_DEC, NULL, 0x0,
12124         NULL, HFILL }
12125     },  /* XXX - special values */
12126     { &hf_pn_io_cminitiator_udprtport,
12127       { "CMInitiatorUDPRTPort", "pn_io.cminitiator_udprtport",
12128         FT_UINT16, BASE_HEX, NULL, 0x0,
12129         NULL, HFILL }
12130     },  /* XXX - special values */
12131     { &hf_pn_io_station_name_length,
12132       { "StationNameLength", "pn_io.station_name_length",
12133         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12134         NULL, HFILL }
12135     },
12136     { &hf_pn_io_cminitiator_station_name,
12137       { "CMInitiatorStationName", "pn_io.cminitiator_station_name",
12138         FT_STRING, BASE_NONE, NULL, 0x0,
12139         NULL, HFILL }
12140     },
12141     { &hf_pn_io_parameter_server_station_name,
12142       { "ParameterServerStationName", "pn_io.parameter_server_station_name",
12143         FT_STRING, BASE_NONE, NULL, 0x0,
12144         NULL, HFILL }
12145     },
12146     { &hf_pn_io_cmresponder_macadd,
12147       { "CMResponderMacAdd", "pn_io.cmresponder_macadd",
12148         FT_ETHER, BASE_NONE, 0x0, 0x0,
12149         NULL, HFILL }
12150     },
12151     { &hf_pn_io_cmresponder_udprtport,
12152       { "CMResponderUDPRTPort", "pn_io.cmresponder_udprtport",
12153         FT_UINT16, BASE_HEX, NULL, 0x0,
12154         NULL, HFILL }
12155     },  /* XXX - special values */
12156     { &hf_pn_io_number_of_iocrs,
12157       { "NumberOfIOCRs", "pn_io.number_of_iocrs",
12158         FT_UINT16, BASE_DEC, NULL, 0x0,
12159         NULL, HFILL }
12160     },
12161     { &hf_pn_io_iocr_tree,
12162       { "IOCR", "pn_io.iocr_tree",
12163         FT_NONE, BASE_NONE, NULL, 0x0,
12164         NULL, HFILL }
12165     },
12166     { &hf_pn_io_iocr_type,
12167       { "IOCRType", "pn_io.iocr_type",
12168         FT_UINT16, BASE_HEX, VALS(pn_io_iocr_type), 0x0,
12169         NULL, HFILL }
12170     },
12171     { &hf_pn_io_iocr_reference,
12172       { "IOCRReference", "pn_io.iocr_reference",
12173         FT_UINT16, BASE_HEX, NULL, 0x0,
12174         NULL, HFILL }
12175     },
12176     { &hf_pn_io_iocr_SubframeOffset,
12177       { "-> SubframeOffset", "pn_io.subframe_offset",
12178         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
12179         NULL, HFILL }
12180     },
12181     { &hf_pn_io_iocr_SubframeData,
12182       { "SubframeData", "pn_io.subframe_data",
12183         FT_UINT32, BASE_HEX, NULL, 0x0,
12184         NULL, HFILL }
12185     },
12186     { &hf_pn_io_RedundancyDataHoldFactor,
12187       { "RedundancyDataHoldFactor", "pn_io.RedundancyDataHoldFactor",
12188         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_RedundancyDataHoldFactor), 0x0,
12189         NULL, HFILL }
12190     },
12191     { &hf_pn_io_sr_properties,
12192       { "SRProperties", "pn_io.sr_properties",
12193         FT_UINT32, BASE_HEX, NULL, 0x0,
12194         NULL, HFILL }
12195     },
12196     { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0,
12197       { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR",
12198         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0), 0x01,
12199         NULL, HFILL }
12200     },
12201     { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1,
12202       { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR",
12203         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1), 0x01,
12204         NULL, HFILL }
12205     },
12206     { &hf_pn_io_sr_properties_Reserved_1,
12207       { "Reserved_1", "pn_io.sr_properties.Reserved_1",
12208         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Reserved1), 0x00000002,
12209         NULL, HFILL }
12210     },
12211     { &hf_pn_io_sr_properties_Mode,
12212       { "Mode", "pn_io.sr_properties.Mode",
12213         FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Mode), 0x00000004,
12214         NULL, HFILL }
12215     },
12216     { &hf_pn_io_sr_properties_Reserved_2,
12217       { "Reserved_2", "pn_io.sr_properties.Reserved_2",
12218         FT_UINT32, BASE_HEX, NULL, 0x0000FFF8,
12219         NULL, HFILL }
12220     },
12221     { &hf_pn_io_sr_properties_Reserved_3,
12222       { "Reserved_3", "pn_io.sr_properties.Reserved_3",
12223         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
12224         NULL, HFILL }
12225     },
12226     { &hf_pn_io_arvendor_strucidentifier_if0_low,
12227       { "APStructureIdentifier: Vendor specific", "pn_io.structidentifier_api_0_low",
12228         FT_UINT16, BASE_HEX, NULL, 0x0,
12229         NULL, HFILL }
12230     },
12231     { &hf_pn_io_arvendor_strucidentifier_if0_high,
12232       { "APStructureIdentifier: Administrative number for common profiles", "pn_io.structidentifier_api_0_high",
12233         FT_UINT16, BASE_HEX, NULL, 0x0,
12234         NULL, HFILL }
12235     },
12236     { &hf_pn_io_arvendor_strucidentifier_if0_is8000,
12237       { "APStructureIdentifier: Extended identification rules", "pn_io.tructidentifier_api_0_is8000",
12238         FT_UINT16, BASE_HEX, NULL, 0x0,
12239         NULL, HFILL }
12240     },
12241     { &hf_pn_io_arvendor_strucidentifier_not0,
12242     { "APStructureIdentifier: Administrative number for application profiles", "pn_io.tructidentifier_api_not_0",
12243         FT_UINT16, BASE_HEX, NULL, 0x0,
12244         NULL, HFILL }
12245     },
12246     { &hf_pn_io_lt,
12247       { "LT", "pn_io.lt",
12248         FT_UINT16, BASE_HEX, NULL, 0x0,
12249         NULL, HFILL }
12250     },
12251     { &hf_pn_io_iocr_properties,
12252       { "IOCRProperties", "pn_io.iocr_properties",
12253         FT_UINT32, BASE_HEX, NULL, 0x0,
12254         NULL, HFILL }
12255     },
12256     { &hf_pn_io_iocr_properties_rtclass,
12257       { "RTClass", "pn_io.iocr_properties.rtclass",
12258         FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_rtclass), 0x0000000F,
12259         NULL, HFILL }
12260     },
12261     { &hf_pn_io_iocr_properties_reserved_1,
12262       { "Reserved1", "pn_io.iocr_properties.reserved1",
12263         FT_UINT32, BASE_HEX, NULL, 0x00000FF0,
12264         NULL, HFILL }
12265     },
12266     { &hf_pn_io_iocr_properties_media_redundancy,
12267       { "MediaRedundancy", "pn_io.iocr_properties.media_redundancy",
12268         FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_media_redundancy), 0x00000800,
12269         NULL, HFILL }
12270     },
12271     { &hf_pn_io_iocr_properties_reserved_2,
12272       { "Reserved2", "pn_io.iocr_properties.reserved2",
12273         FT_UINT32, BASE_HEX, NULL, 0x00FFF000,
12274         NULL, HFILL }
12275     },
12276     { &hf_pn_io_iocr_properties_reserved_3,
12277       { "Reserved3", "pn_io.iocr_properties.reserved3",
12278         FT_UINT32, BASE_HEX, NULL, 0xF000000,
12279         NULL, HFILL }
12280     },
12281     { &hf_pn_io_iocr_properties_fast_forwarding_mac_adr,
12282       { "FastForwardingMACAdr", "pn_io.iocr_properties.fast_forwarding_mac_adr",
12283         FT_UINT32, BASE_HEX, NULL, 0x20000000,
12284         NULL, HFILL }
12285     },
12286     { &hf_pn_io_iocr_properties_distributed_subframe_watchdog,
12287       { "DistributedSubFrameWatchDog", "pn_io.iocr_properties.distributed_subframe_watchdog",
12288         FT_UINT32, BASE_HEX, NULL, 0x40000000,
12289         NULL, HFILL }
12290     },
12291     { &hf_pn_io_iocr_properties_full_subframe_structure,
12292       { "FullSubFrameStructure", "pn_io.iocr_properties.full_subframe_structure",
12293         FT_UINT32, BASE_HEX, NULL, 0x80000000,
12294         NULL, HFILL }
12295     },
12296     { &hf_pn_io_SFIOCRProperties,
12297       { "SFIOCRProperties", "pn_io.SFIOCRProperties",
12298         FT_UINT32, BASE_HEX, NULL, 0x0,
12299         NULL, HFILL }
12300     },
12301     { &hf_pn_io_DistributedWatchDogFactor,
12302       { "SFIOCRProperties.DistributedWatchDogFactor", "pn_io.SFIOCRProperties.DistributedWatchDogFactor",
12303         FT_UINT32, BASE_HEX, NULL, 0x0FF,
12304         NULL, HFILL }
12305     },
12306     { &hf_pn_io_RestartFactorForDistributedWD,
12307       { "SFIOCRProperties.RestartFactorForDistributedWD", "pn_io.SFIOCRProperties.RestartFactorForDistributedWD",
12308         FT_UINT32, BASE_HEX, NULL, 0xff00,
12309         NULL, HFILL }
12310     },
12311     { &hf_pn_io_SFIOCRProperties_DFPmode,
12312       { "SFIOCRProperties.DFPmode", "pn_io.SFIOCRProperties.DFPmode",
12313         FT_UINT32, BASE_HEX, NULL, 0xFF0000,
12314         NULL, HFILL }
12315     },
12316     { &hf_pn_io_SFIOCRProperties_reserved_1,
12317       { "SFIOCRProperties.reserved_1", "pn_io.SFIOCRProperties.reserved_1",
12318         FT_UINT32, BASE_HEX, NULL, 0x0F000000,
12319         NULL, HFILL }
12320     },
12321     { &hf_pn_io_SFIOCRProperties_reserved_2,
12322       { "SFIOCRProperties.reserved_2", "pn_io.SFIOCRProperties.reserved_2",
12323         FT_UINT32, BASE_HEX, NULL, 0x10000000,
12324         NULL, HFILL }
12325     },
12326     { &hf_pn_io_SFIOCRProperties_DFPType,
12327       { "SFIOCRProperties.DFPType", "pn_io.SFIOCRProperties.DFPType",
12328         FT_UINT32, BASE_HEX,  VALS(pn_io_SFIOCRProperties_DFPType_vals), 0x20000000,
12329         NULL, HFILL }
12330     },
12331     { &hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout,
12332       { "SFIOCRProperties.DFPRedundantPathLayout", "pn_io.SFIOCRProperties.DFPRedundantPathLayout",
12333         FT_UINT32, BASE_HEX, VALS(pn_io_DFPRedundantPathLayout_decode), 0x40000000,
12334         NULL, HFILL }
12335     },
12336     { &hf_pn_io_SFIOCRProperties_SFCRC16,
12337       { "SFIOCRProperties.SFCRC16", "pn_io.SFIOCRProperties.SFCRC16",
12338         FT_UINT32, BASE_HEX, VALS(pn_io_SFCRC16_Decode), 0x80000000,
12339         NULL, HFILL }
12340     },
12341     { &hf_pn_io_data_length,
12342       { "DataLength", "pn_io.data_length",
12343         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12344         NULL, HFILL }
12345     },
12346     { &hf_pn_io_ir_frame_data,
12347       { "Frame data", "pn_io.ir_frame_data",
12348         FT_NONE, BASE_NONE, NULL, 0x0,
12349         NULL, HFILL }
12350     },
12351     { &hf_pn_io_frame_id,
12352       { "FrameID", "pn_io.frame_id",
12353         FT_UINT16, BASE_HEX, NULL, 0x0,
12354         NULL, HFILL }
12355     },
12356     { &hf_pn_io_send_clock_factor,
12357       { "SendClockFactor", "pn_io.send_clock_factor",
12358         FT_UINT16, BASE_DEC, NULL, 0x0,
12359         NULL, HFILL }
12360     }, /* XXX - special values */
12361     { &hf_pn_io_reduction_ratio,
12362       { "ReductionRatio", "pn_io.reduction_ratio",
12363         FT_UINT16, BASE_DEC, NULL, 0x0,
12364         NULL, HFILL }
12365     }, /* XXX - special values */
12366     { &hf_pn_io_phase,
12367       { "Phase", "pn_io.phase",
12368         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12369         NULL, HFILL }
12370     },
12371     { &hf_pn_io_sequence,
12372       { "Sequence", "pn_io.sequence",
12373         FT_UINT16, BASE_DEC, NULL, 0x0,
12374         NULL, HFILL }
12375     },
12376     { &hf_pn_io_frame_send_offset,
12377       { "FrameSendOffset", "pn_io.frame_send_offset",
12378         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12379         NULL, HFILL }
12380     },
12381     { &hf_pn_io_frame_data_properties,
12382       { "FrameDataProperties", "pn_io.frame_data_properties",
12383         FT_UINT32, BASE_HEX, NULL, 0x0,
12384         NULL, HFILL }
12385     },
12386     { &hf_pn_io_frame_data_properties_forwarding_Mode,
12387       { "ForwardingMode", "pn_io.frame_data_properties_forwardingMode",
12388         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_forwardingMode), 0x01,
12389         NULL, HFILL }
12390     },
12391     { &hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd,
12392       { "FastForwardingMulticastMACAdd", "pn_io.frame_data_properties_MulticastMACAdd",
12393         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FFMulticastMACAdd), 0x06,
12394         NULL, HFILL }
12395     },
12396     { &hf_pn_io_frame_data_properties_FragmentMode,
12397       { "FragmentationMode", "pn_io.frame_data_properties_FragMode",
12398         FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FragMode), 0x18,
12399         NULL, HFILL }
12400     },
12401     { &hf_pn_io_frame_data_properties_reserved_1,
12402       { "Reserved_1", "pn_io.frame_data.reserved_1",
12403         FT_UINT32, BASE_HEX, NULL, 0x0000FFE0,
12404         NULL, HFILL }
12405     },
12406     { &hf_pn_io_frame_data_properties_reserved_2,
12407       { "Reserved_2", "pn_io.frame_data.reserved_2",
12408         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
12409         NULL, HFILL }
12410     },
12411     { &hf_pn_io_watchdog_factor,
12412       { "WatchdogFactor", "pn_io.watchdog_factor",
12413         FT_UINT16, BASE_DEC, NULL, 0x0,
12414         NULL, HFILL }
12415     },
12416     { &hf_pn_io_data_hold_factor,
12417       { "DataHoldFactor", "pn_io.data_hold_factor",
12418         FT_UINT16, BASE_DEC, NULL, 0x0,
12419         NULL, HFILL }
12420     },
12421     { &hf_pn_io_iocr_tag_header,
12422       { "IOCRTagHeader", "pn_io.iocr_tag_header",
12423         FT_UINT16, BASE_HEX, NULL, 0x0,
12424         NULL, HFILL }
12425     },
12426     { &hf_pn_io_iocr_multicast_mac_add,
12427       { "IOCRMulticastMACAdd", "pn_io.iocr_multicast_mac_add",
12428         FT_ETHER, BASE_NONE, NULL, 0x0,
12429         NULL, HFILL }
12430     },
12431     { &hf_pn_io_number_of_apis,
12432       { "NumberOfAPIs", "pn_io.number_of_apis",
12433         FT_UINT16, BASE_DEC, NULL, 0x0,
12434         NULL, HFILL }
12435     },
12436     { &hf_pn_io_number_of_io_data_objects,
12437       { "NumberOfIODataObjects", "pn_io.number_of_io_data_objects",
12438         FT_UINT16, BASE_DEC, NULL, 0x0,
12439         NULL, HFILL }
12440     },
12441     { &hf_pn_io_number_of_iocs,
12442       { "NumberOfIOCS", "pn_io.number_of_iocs",
12443         FT_UINT16, BASE_DEC, NULL, 0x0,
12444         NULL, HFILL }
12445     },
12446     { &hf_pn_io_iocs_frame_offset,
12447       { "IOCSFrameOffset", "pn_io.iocs_frame_offset",
12448         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12449         NULL, HFILL }
12450     },
12451     { &hf_pn_io_alarmcr_type,
12452       { "AlarmCRType", "pn_io.alarmcr_type",
12453         FT_UINT16, BASE_HEX, VALS(pn_io_alarmcr_type), 0x0,
12454         NULL, HFILL }
12455     },
12456     { &hf_pn_io_alarmcr_properties,
12457       { "AlarmCRProperties", "pn_io.alarmcr_properties",
12458         FT_UINT32, BASE_HEX, NULL, 0x0,
12459         NULL, HFILL }
12460     },
12461     { &hf_pn_io_alarmcr_properties_priority,
12462       { "priority", "pn_io.alarmcr_properties.priority",
12463         FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_priority), 0x00000001,
12464         NULL, HFILL }
12465     },
12466     { &hf_pn_io_alarmcr_properties_transport,
12467       { "Transport", "pn_io.alarmcr_properties.transport",
12468         FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_transport), 0x00000002,
12469         NULL, HFILL }
12470     },
12471     { &hf_pn_io_alarmcr_properties_reserved,
12472       { "Reserved", "pn_io.alarmcr_properties.reserved",
12473         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC,
12474         NULL, HFILL }
12475     },
12476     { &hf_pn_io_rta_timeoutfactor,
12477       { "RTATimeoutFactor", "pn_io.rta_timeoutfactor",
12478         FT_UINT16, BASE_DEC, NULL, 0x0,
12479         NULL, HFILL }
12480     },  /* XXX - special values */
12481     { &hf_pn_io_rta_retries,
12482       { "RTARetries", "pn_io.rta_retries",
12483         FT_UINT16, BASE_DEC, NULL, 0x0,
12484         NULL, HFILL }
12485     },  /* XXX - only values 3 - 15 allowed */
12486     { &hf_pn_io_localalarmref,
12487       { "LocalAlarmReference", "pn_io.localalarmref",
12488         FT_UINT16, BASE_HEX, NULL, 0x0,
12489         NULL, HFILL }
12490     },  /* XXX - special values */
12491     { &hf_pn_io_remotealarmref,
12492       { "RemoteAlarmReference", "pn_io.remotealarmref",
12493         FT_UINT16, BASE_HEX, NULL, 0x0,
12494         NULL, HFILL }
12495     },  /* XXX - special values */
12496     { &hf_pn_io_maxalarmdatalength,
12497       { "MaxAlarmDataLength", "pn_io.maxalarmdatalength",
12498         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12499         NULL, HFILL }
12500     },  /* XXX - only values 200 - 1432 allowed */
12501     { &hf_pn_io_alarmcr_tagheaderhigh,
12502       { "AlarmCRTagHeaderHigh", "pn_io.alarmcr_tagheaderhigh",
12503         FT_UINT16, BASE_HEX, NULL, 0x0,
12504         NULL, HFILL }
12505     },  /* XXX - 16 bitfield! */
12506     { &hf_pn_io_alarmcr_tagheaderlow,
12507       { "AlarmCRTagHeaderLow", "pn_io.alarmcr_tagheaderlow",
12508         FT_UINT16, BASE_HEX, NULL, 0x0,
12509         NULL, HFILL }
12510     },  /* XXX - 16 bitfield!*/
12511     { &hf_pn_io_api_tree,
12512       { "API", "pn_io.api_tree",
12513         FT_NONE, BASE_NONE, NULL, 0x0,
12514         NULL, HFILL }
12515     },
12516     { &hf_pn_io_module_tree,
12517       { "Module", "pn_io.module_tree",
12518         FT_NONE, BASE_NONE, NULL, 0x0,
12519         NULL, HFILL }
12520     },
12521     { &hf_pn_io_submodule_tree,
12522       { "Submodule", "pn_io.submodule_tree",
12523         FT_NONE, BASE_NONE, NULL, 0x0,
12524         NULL, HFILL }
12525     },
12526     { &hf_pn_io_io_data_object,
12527       { "IODataObject", "pn_io.io_data_object",
12528         FT_NONE, BASE_NONE, NULL, 0x0,
12529         NULL, HFILL }
12530     },
12531     { &hf_pn_io_io_data_object_frame_offset,
12532         { "IODataObjectFrameOffset", "pn_io.io_data_object.frame_offset",
12533         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12534         NULL, HFILL }
12535     },
12536     { &hf_pn_io_io_cs,
12537       { "IOCS", "pn_io.io_cs",
12538         FT_NONE, BASE_NONE, NULL, 0x0,
12539         NULL, HFILL }
12540     },
12541     { &hf_pn_io_substitutionmode,
12542       { "Substitutionmode", "pn_io.substitutionmode",
12543         FT_UINT16, BASE_HEX, VALS(pn_io_substitutionmode), 0x0,
12544         NULL, HFILL }
12545     },
12546     { &hf_pn_io_IRData_uuid,
12547       { "IRDataUUID", "pn_io.IRData_uuid",
12548         FT_GUID, BASE_NONE, NULL, 0x0,
12549         NULL, HFILL }
12550     },
12551     { &hf_pn_io_ar_uuid,
12552       { "ARUUID", "pn_io.ar_uuid",
12553         FT_GUID, BASE_NONE, NULL, 0x0,
12554         NULL, HFILL }
12555     },
12556     { &hf_pn_io_target_ar_uuid,
12557       { "TargetARUUID", "pn_io.target_ar_uuid",
12558         FT_GUID, BASE_NONE, NULL, 0x0,
12559         NULL, HFILL }
12560     },
12561     { &hf_pn_io_ar_discriminator,
12562       { "Discriminator", "pn_io.ar_discriminator",
12563         FT_BYTES, BASE_NONE, NULL, 0x0,
12564         NULL, HFILL }
12565     },
12566     { &hf_pn_io_ar_configid,
12567       { "ConfigID", "pn_io.ar_configid",
12568         FT_BYTES, BASE_NONE, NULL, 0x0,
12569         NULL, HFILL }
12570     },
12571     { &hf_pn_io_ar_arnumber,
12572       { "ARnumber", "pn_io.ar_arnumber",
12573         FT_UINT16, BASE_HEX, VALS(pn_io_ar_arnumber), 0x0007,
12574         NULL, HFILL }
12575     },
12576     { &hf_pn_io_ar_arresource,
12577       { "ARresource", "pn_io.ar_arresource",
12578         FT_UINT16, BASE_HEX, VALS(pn_io_ar_arresource), 0x0018,
12579         NULL, HFILL }
12580     },
12581     { &hf_pn_io_ar_arreserved,
12582       { "ARreserved", "pn_io.ar_arreserved",
12583         FT_UINT16, BASE_HEX, NULL, 0xFFE0,
12584         NULL, HFILL }
12585     },
12586     { &hf_pn_io_ar_selector,
12587       { "Selector", "pn_io.ar_selector",
12588         FT_UINT16, BASE_HEX, NULL, 0x0,
12589         NULL, HFILL }
12590     },
12591     { &hf_pn_io_api,
12592       { "API", "pn_io.api",
12593         FT_UINT32, BASE_HEX, NULL, 0x0,
12594         NULL, HFILL }
12595     },
12596     { &hf_pn_io_slot_nr,
12597       { "SlotNumber", "pn_io.slot_nr",
12598         FT_UINT16, BASE_HEX, NULL, 0x0,
12599         NULL, HFILL }
12600     },
12601     { &hf_pn_io_subslot_nr,
12602       { "SubslotNumber", "pn_io.subslot_nr",
12603         FT_UINT16, BASE_HEX, NULL, 0x0,
12604         NULL, HFILL }
12605     },
12606     { &hf_pn_io_index,
12607       { "Index", "pn_io.index",
12608         FT_UINT16, BASE_HEX, VALS(pn_io_index), 0x0,
12609         NULL, HFILL }
12610     },
12611     { &hf_pn_io_seq_number,
12612       { "SeqNumber", "pn_io.seq_number",
12613         FT_UINT16, BASE_DEC, NULL, 0x0,
12614         NULL, HFILL }
12615     },
12616     { &hf_pn_io_record_data_length,
12617       { "RecordDataLength", "pn_io.record_data_length",
12618         FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
12619         NULL, HFILL }
12620     },
12621     { &hf_pn_io_add_val1,
12622       { "AdditionalValue1", "pn_io.add_val1",
12623         FT_UINT16, BASE_DEC, NULL, 0x0,
12624         NULL, HFILL }
12625     },
12626     { &hf_pn_io_add_val2,
12627       { "AdditionalValue2", "pn_io.add_val2",
12628         FT_UINT16, BASE_DEC, NULL, 0x0,
12629         NULL, HFILL }
12630     },
12631     { &hf_pn_io_block_header,
12632       { "BlockHeader", "pn_io.block_header",
12633         FT_NONE, BASE_NONE, NULL, 0x0,
12634         NULL, HFILL }
12635     },
12636     { &hf_pn_io_block_type,
12637       { "BlockType", "pn_io.block_type",
12638         FT_UINT16, BASE_HEX, VALS(pn_io_block_type), 0x0,
12639         NULL, HFILL }
12640     },
12641     { &hf_pn_io_block_length,
12642       { "BlockLength", "pn_io.block_length",
12643         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
12644         NULL, HFILL }
12645     },
12646     { &hf_pn_io_block_version_high,
12647       { "BlockVersionHigh", "pn_io.block_version_high",
12648         FT_UINT8, BASE_DEC, NULL, 0x0,
12649         NULL, HFILL }
12650     },
12651     { &hf_pn_io_block_version_low,
12652       { "BlockVersionLow", "pn_io.block_version_low",
12653         FT_UINT8, BASE_DEC, NULL, 0x0,
12654         NULL, HFILL }
12655     },
12656     { &hf_pn_io_sessionkey,
12657       { "SessionKey", "pn_io.session_key",
12658         FT_UINT16, BASE_DEC, NULL, 0x0,
12659         NULL, HFILL }
12660     },
12661     { &hf_pn_io_control_command,
12662       { "ControlCommand", "pn_io.control_command",
12663         FT_UINT16, BASE_HEX, NULL, 0x0,
12664         NULL, HFILL }
12665     },
12666     { &hf_pn_io_control_command_reserved,
12667       { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved",
12668         FT_UINT16, BASE_HEX, NULL, 0x0,
12669         NULL, HFILL }
12670     },
12671     { &hf_pn_io_control_command_prmend,
12672       { "PrmEnd", "pn_io.control_command.prmend",
12673         FT_UINT16, BASE_DEC, NULL, 0x0001,
12674         NULL, HFILL }
12675     },
12676     { &hf_pn_io_control_command_applready,
12677       { "ApplicationReady", "pn_io.control_command.applready",
12678         FT_UINT16, BASE_DEC, NULL, 0x0002,
12679         NULL, HFILL }
12680     },
12681     { &hf_pn_io_control_command_release,
12682       { "Release", "pn_io.control_command.release",
12683         FT_UINT16, BASE_DEC, NULL, 0x0004,
12684         NULL, HFILL }
12685     },
12686     { &hf_pn_io_control_command_done,
12687       { "Done", "pn_io.control_command.done",
12688         FT_UINT16, BASE_DEC, NULL, 0x0008,
12689         NULL, HFILL }
12690     },
12691     { &hf_pn_io_control_command_ready_for_companion,
12692       { "ReadyForCompanion", "pn_io.control_command.ready_for_companion",
12693         FT_UINT16, BASE_DEC, NULL, 0x0010,
12694         NULL, HFILL }
12695     },
12696     { &hf_pn_io_control_command_ready_for_rt_class3,
12697       { "ReadyForRT Class 3", "pn_io.control_command.ready_for_rt_class3",
12698         FT_UINT16, BASE_DEC, NULL, 0x0020,
12699         NULL, HFILL }
12700     },
12701     { &hf_pn_io_control_command_prmbegin,
12702       { "PrmBegin", "pn_io.control_command.prmbegin",
12703         FT_UINT16, BASE_DEC, VALS(pn_io_control_properties_prmbegin_vals), 0x0040,
12704         NULL, HFILL }
12705     },
12706     { &hf_pn_io_control_command_reserved_7_15,
12707       { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved_7_15",
12708         FT_UINT16, BASE_HEX, NULL, 0x0FF80,
12709         NULL, HFILL }
12710     },
12711     { &hf_pn_io_control_block_properties,
12712       { "ControlBlockProperties", "pn_io.control_block_properties",
12713         FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_vals), 0x0,
12714         NULL, HFILL }
12715     },
12716     { &hf_pn_io_control_block_properties_applready,
12717       { "ControlBlockProperties", "pn_io.control_block_properties.appl_ready",
12718         FT_UINT16, BASE_HEX, NULL, 0x0,
12719         NULL, HFILL }
12720     },
12721     { &hf_pn_io_control_block_properties_applready_bit0,
12722       { "ApplicationReady.Bit0", "pn_io.control_block_properties.appl_ready_bit0",
12723         FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_application_ready_bit0_vals), 0x0001,
12724         NULL, HFILL }
12725     },
12726     { &hf_pn_io_control_block_properties_applready_bit1,
12727       { "ApplicationReady.Bit1", "pn_io.control_block_properties.appl_ready_bit1",
12728       FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_application_ready_bit1_vals), 0x0002,
12729     NULL, HFILL }
12730     },
12731     { &hf_pn_io_control_block_properties_applready_otherbits,
12732       { "ApplicationReady.Bit2-15(reserved)", "pn_io.control_block_properties.appl_ready_otherbits",
12733       FT_UINT16, BASE_HEX, NULL, 0xFFFC,
12734     NULL, HFILL }
12735     },
12736     { &hf_pn_io_SubmoduleListEntries,
12737       { "NumberOfEntries", "pn_io.SubmoduleListEntries",
12738         FT_UINT16, BASE_DEC, NULL, 0x0,
12739         NULL, HFILL }
12740     },
12741     { &hf_pn_io_block,
12742       { "Block", "pn_io.block",
12743         FT_NONE, BASE_NONE, NULL, 0x0,
12744         NULL, HFILL }
12745     },
12746     { &hf_pn_io_alarm_type,
12747       { "AlarmType", "pn_io.alarm_type",
12748         FT_UINT16, BASE_HEX, VALS(pn_io_alarm_type), 0x0,
12749         NULL, HFILL }
12750     },
12751     { &hf_pn_io_alarm_specifier,
12752       { "AlarmSpecifier", "pn_io.alarm_specifier",
12753         FT_NONE, BASE_NONE, NULL, 0x0,
12754         NULL, HFILL }
12755     },
12756     { &hf_pn_io_alarm_specifier_sequence,
12757       { "SequenceNumber", "pn_io.alarm_specifier.sequence",
12758         FT_UINT16, BASE_HEX, NULL, 0x07FF,
12759         NULL, HFILL }
12760     },
12761     { &hf_pn_io_alarm_specifier_channel,
12762       { "ChannelDiagnosis", "pn_io.alarm_specifier.channel",
12763         FT_UINT16, BASE_HEX, NULL, 0x0800,
12764         NULL, HFILL }
12765     },
12766     { &hf_pn_io_alarm_specifier_manufacturer,
12767       { "ManufacturerSpecificDiagnosis", "pn_io.alarm_specifier.manufacturer",
12768         FT_UINT16, BASE_HEX, NULL, 0x1000,
12769         NULL, HFILL }
12770     },
12771     { &hf_pn_io_alarm_specifier_submodule,
12772       { "SubmoduleDiagnosisState", "pn_io.alarm_specifier.submodule",
12773         FT_UINT16, BASE_HEX, NULL, 0x2000,
12774         NULL, HFILL }
12775     },
12776     { &hf_pn_io_alarm_specifier_ardiagnosis,
12777       { "ARDiagnosisState", "pn_io.alarm_specifier.ardiagnosis",
12778         FT_UINT16, BASE_HEX, NULL, 0x8000,
12779         NULL, HFILL }
12780     },
12781     { &hf_pn_io_alarm_dst_endpoint,
12782       { "AlarmDstEndpoint", "pn_io.alarm_dst_endpoint",
12783         FT_UINT16, BASE_HEX, NULL, 0x0,
12784         NULL, HFILL }
12785     },
12786     { &hf_pn_io_alarm_src_endpoint,
12787       { "AlarmSrcEndpoint", "pn_io.alarm_src_endpoint",
12788         FT_UINT16, BASE_HEX, NULL, 0x0,
12789         NULL, HFILL }
12790     },
12791     { &hf_pn_io_pdu_type,
12792       { "PDUType", "pn_io.pdu_type",
12793         FT_NONE, BASE_NONE, NULL, 0x0,
12794         NULL, HFILL }
12795     },
12796     { &hf_pn_io_pdu_type_type,
12797       { "Type", "pn_io.pdu_type.type",
12798         FT_UINT8, BASE_HEX, VALS(pn_io_pdu_type), 0x0F,
12799         NULL, HFILL }
12800     },
12801     { &hf_pn_io_pdu_type_version,
12802       { "Version", "pn_io.pdu_type.version",
12803         FT_UINT8, BASE_HEX, NULL, 0xF0,
12804         NULL, HFILL }
12805     },
12806     { &hf_pn_io_add_flags,
12807       { "AddFlags", "pn_io.add_flags",
12808         FT_NONE, BASE_NONE, NULL, 0x0,
12809         NULL, HFILL }
12810     },
12811     { &hf_pn_io_window_size,
12812       { "WindowSize", "pn_io.window_size",
12813         FT_UINT8, BASE_DEC, NULL, 0x0F,
12814         NULL, HFILL }
12815     },
12816     { &hf_pn_io_tack,
12817       { "TACK", "pn_io.tack",
12818         FT_UINT8, BASE_HEX, NULL, 0xF0,
12819         NULL, HFILL }
12820     },
12821     { &hf_pn_io_send_seq_num,
12822       { "SendSeqNum", "pn_io.send_seq_num",
12823         FT_UINT16, BASE_HEX, NULL, 0x0,
12824         NULL, HFILL }
12825     },
12826     { &hf_pn_io_ack_seq_num,
12827       { "AckSeqNum", "pn_io.ack_seq_num",
12828         FT_UINT16, BASE_HEX, NULL, 0x0,
12829         NULL, HFILL }
12830     },
12831     { &hf_pn_io_var_part_len,
12832       { "VarPartLen", "pn_io.var_part_len",
12833         FT_UINT16, BASE_HEX, NULL, 0x0,
12834         NULL, HFILL }
12835     },
12836     { &hf_pn_io_module_ident_number,
12837       { "ModuleIdentNumber", "pn_io.module_ident_number",
12838         FT_UINT32, BASE_HEX, NULL, 0x0,
12839         NULL, HFILL }
12840     },
12841     { &hf_pn_io_submodule_ident_number,
12842       { "SubmoduleIdentNumber", "pn_io.submodule_ident_number",
12843         FT_UINT32, BASE_HEX, NULL, 0x0,
12844         NULL, HFILL }
12845     },
12846 
12847     { &hf_pn_io_number_of_modules,
12848       { "NumberOfModules", "pn_io.number_of_modules",
12849         FT_UINT16, BASE_HEX, NULL, 0x0,
12850         NULL, HFILL }
12851     },
12852     { &hf_pn_io_module_properties,
12853       { "ModuleProperties", "pn_io.module_properties",
12854         FT_UINT16, BASE_HEX, NULL, 0x0,
12855         NULL, HFILL }
12856     },
12857     { &hf_pn_io_module_state,
12858       { "ModuleState", "pn_io.module_state",
12859         FT_UINT16, BASE_HEX, VALS(pn_io_module_state), 0x0,
12860         NULL, HFILL }
12861     },
12862     { &hf_pn_io_number_of_submodules,
12863       { "NumberOfSubmodules", "pn_io.number_of_submodules",
12864         FT_UINT16, BASE_DEC, NULL, 0x0,
12865         NULL, HFILL }
12866     },
12867 
12868     { &hf_pn_io_submodule_properties,
12869       { "SubmoduleProperties", "pn_io.submodule_properties",
12870         FT_UINT16, BASE_HEX, NULL, 0x0,
12871         NULL, HFILL }
12872     },
12873     { &hf_pn_io_submodule_properties_type,
12874       { "Type", "pn_io.submodule_properties.type",
12875         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_type), 0x0003,
12876         NULL, HFILL }
12877     },
12878     { &hf_pn_io_submodule_properties_shared_input,
12879       { "SharedInput", "pn_io.submodule_properties.shared_input",
12880         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_shared_input), 0x0004,
12881         NULL, HFILL }
12882     },
12883     { &hf_pn_io_submodule_properties_reduce_input_submodule_data_length,
12884       { "ReduceInputSubmoduleDataLength", "pn_io.submodule_properties.reduce_input_submodule_data_length",
12885         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_input_submodule_data_length), 0x0008,
12886         NULL, HFILL }
12887     },
12888     { &hf_pn_io_submodule_properties_reduce_output_submodule_data_length,
12889       { "ReduceOutputSubmoduleDataLength", "pn_io.submodule_properties.reduce_output_submodule_data_length",
12890         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_output_submodule_data_length), 0x0010,
12891         NULL, HFILL }
12892     },
12893     { &hf_pn_io_submodule_properties_discard_ioxs,
12894       { "DiscardIOXS", "pn_io.submodule_properties.discard_ioxs",
12895         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_discard_ioxs), 0x0020,
12896         NULL, HFILL }
12897     },
12898     { &hf_pn_io_submodule_properties_reserved,
12899       { "Reserved", "pn_io.submodule_properties.reserved",
12900         FT_UINT16, BASE_HEX, NULL, 0xFFC0,
12901         NULL, HFILL }
12902     },
12903     { &hf_pn_io_submodule_state,
12904       { "SubmoduleState", "pn_io.submodule_state",
12905         FT_UINT16, BASE_HEX, NULL, 0x0,
12906         NULL, HFILL }
12907     },
12908     { &hf_pn_io_submodule_state_format_indicator,
12909       { "FormatIndicator", "pn_io.submodule_state.format_indicator",
12910         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_format_indicator), 0x8000,
12911         NULL, HFILL }
12912     },
12913     { &hf_pn_io_submodule_state_add_info,
12914       { "AddInfo", "pn_io.submodule_state.add_info",
12915         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_add_info), 0x0007,
12916         NULL, HFILL }
12917     },
12918     { &hf_pn_io_submodule_state_qualified_info,
12919       { "QualifiedInfo", "pn_io.submodule_state.qualified_info",
12920         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_qualified_info), 0x0008,
12921         NULL, HFILL }
12922     },
12923     { &hf_pn_io_submodule_state_maintenance_required,
12924       { "MaintenanceRequired", "pn_io.submodule_state.maintenance_required",
12925         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_required), 0x0010,
12926         NULL, HFILL }
12927     },
12928     { &hf_pn_io_submodule_state_maintenance_demanded,
12929       { "MaintenanceDemanded", "pn_io.submodule_state.maintenance_demanded",
12930         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_demanded), 0x0020,
12931         NULL, HFILL }
12932     },
12933     { &hf_pn_io_submodule_state_diag_info,
12934       { "DiagInfo", "pn_io.submodule_state.diag_info",
12935         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_diag_info), 0x0040,
12936         NULL, HFILL }
12937     },
12938     { &hf_pn_io_submodule_state_ar_info,
12939       { "ARInfo", "pn_io.submodule_state.ar_info",
12940         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ar_info), 0x0780,
12941         NULL, HFILL }
12942     },
12943     { &hf_pn_io_submodule_state_ident_info,
12944       { "IdentInfo", "pn_io.submodule_state.ident_info",
12945         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ident_info), 0x7800,
12946         NULL, HFILL }
12947     },
12948     { &hf_pn_io_submodule_state_detail,
12949       { "Detail", "pn_io.submodule_state.detail",
12950         FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_detail), 0x7FFF,
12951         NULL, HFILL }
12952     },
12953     { &hf_pn_io_data_description_tree,
12954       { "DataDescription", "pn_io.data_description_tree",
12955         FT_NONE, BASE_NONE, NULL, 0x0,
12956         NULL, HFILL }
12957     },
12958     { &hf_pn_io_data_description,
12959       { "DataDescription", "pn_io.data_description",
12960         FT_UINT16, BASE_HEX, VALS(pn_io_data_description), 0x0,
12961         NULL, HFILL }
12962     },
12963     { &hf_pn_io_submodule_data_length,
12964       { "SubmoduleDataLength", "pn_io.submodule_data_length",
12965         FT_UINT16, BASE_DEC, NULL, 0x0,
12966         NULL, HFILL }
12967     },
12968     { &hf_pn_io_length_iocs,
12969       { "LengthIOCS", "pn_io.length_iocs",
12970         FT_UINT16, BASE_DEC, NULL, 0x0,
12971         NULL, HFILL }
12972     },
12973     { &hf_pn_io_length_iops,
12974       { "LengthIOPS", "pn_io.length_iops",
12975         FT_UINT16, BASE_DEC, NULL, 0x0,
12976         NULL, HFILL }
12977     },
12978 
12979     { &hf_pn_io_iocs,
12980       { "IOCS", "pn_io.ioxs",
12981         FT_UINT8, BASE_HEX, NULL, 0x0,
12982         NULL, HFILL }
12983     },
12984     { &hf_pn_io_iops,
12985       { "IOPS", "pn_io.iops",
12986         FT_UINT8, BASE_HEX, NULL, 0x0,
12987         NULL, HFILL }
12988     },
12989     { &hf_pn_io_ioxs_extension,
12990       { "Extension (1:another IOxS follows/0:no IOxS follows)", "pn_io.ioxs.extension",
12991         FT_UINT8, BASE_HEX, NULL, 0x01,
12992         NULL, HFILL }
12993     },
12994     { &hf_pn_io_ioxs_res14,
12995       { "Reserved (should be zero)", "pn_io.ioxs.res14",
12996         FT_UINT8, BASE_HEX, NULL, 0x1E,
12997         NULL, HFILL }
12998     },
12999     { &hf_pn_io_ioxs_instance,
13000       { "Instance (only valid, if DataState is bad)",
13001         "pn_io.ioxs.instance", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs),
13002         0x60, NULL, HFILL }
13003     },
13004     { &hf_pn_io_ioxs_datastate,
13005       { "DataState (1:good/0:bad)", "pn_io.ioxs.datastate",
13006         FT_UINT8, BASE_HEX, NULL, 0x80,
13007         NULL, HFILL }
13008     },
13009     { &hf_pn_io_address_resolution_properties,
13010       { "AddressResolutionProperties", "pn_io.address_resolution_properties",
13011         FT_UINT32, BASE_HEX, NULL, 0x0,
13012         NULL, HFILL }
13013     },
13014     { &hf_pn_io_mci_timeout_factor,
13015       { "MCITimeoutFactor", "pn_io.mci_timeout_factor",
13016         FT_UINT16, BASE_DEC, NULL, 0x0,
13017         NULL, HFILL }
13018     },
13019     { &hf_pn_io_provider_station_name,
13020       { "ProviderStationName", "pn_io.provider_station_name",
13021         FT_STRING, BASE_NONE, NULL, 0x0,
13022         NULL, HFILL }
13023     },
13024     { &hf_pn_io_user_structure_identifier,
13025       { "UserStructureIdentifier", "pn_io.user_structure_identifier",
13026         FT_UINT16, BASE_HEX, VALS(pn_io_user_structure_identifier), 0x0,
13027         NULL, HFILL }
13028     },
13029     { &hf_pn_io_user_structure_identifier_manf,
13030       { "UserStructureIdentifier manufacturer specific", "pn_io.user_structure_identifier_manf",
13031         FT_UINT16, BASE_HEX, NULL, 0x0,
13032         NULL, HFILL }
13033     },
13034     { &hf_pn_io_ar_properties_reserved_1,
13035         { "Reserved_1", "pn_io.ar_properties.reserved_1",
13036            FT_UINT32, BASE_HEX, NULL, 0x000000E0,
13037            NULL, HFILL }},
13038     { &hf_pn_io_ar_properties_device_access,
13039         { "DeviceAccess", "pn_io.ar_properties.device_access",
13040           FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_DeviceAccess), 0x00000100,
13041           NULL, HFILL }},
13042     { &hf_pn_io_subframe_data,
13043       { "SubFrameData", "pn_io.subframe_data",
13044         FT_UINT32, BASE_HEX, NULL, 0x0,
13045         NULL, HFILL }
13046     },
13047     { &hf_pn_io_subframe_reserved2,
13048       { "Reserved1", "pn_io.subframe_data.reserved2",
13049         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13050         NULL, HFILL }
13051     },
13052     { &hf_pn_io_subframe_data_length,
13053       { "DataLength", "pn_io.subframe_data.data_length",
13054         FT_UINT32, BASE_HEX, NULL, 0x0000FF00,
13055         NULL, HFILL }
13056     },
13057     { &hf_pn_io_subframe_reserved1,
13058       { "Reserved1", "pn_io.subframe_data.reserved1",
13059         FT_UINT32, BASE_HEX, NULL, 0x00000080,
13060         NULL, HFILL }
13061     },
13062     { &hf_pn_io_subframe_data_position,
13063       { "DataPosition", "pn_io.subframe_data.position",
13064         FT_UINT32, BASE_HEX, NULL, 0x0000007F,
13065         NULL, HFILL }
13066     },
13067     { &hf_pn_io_subframe_data_reserved1,
13068       { "Reserved1", "pn_io.subframe_data.reserved_1",
13069         FT_UINT32, BASE_HEX, NULL, 0x00000080,
13070         NULL, HFILL }
13071     },
13072     { &hf_pn_io_subframe_data_reserved2,
13073       { "Reserved1", "pn_io.subframe_data.reserved_2",
13074         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13075         NULL, HFILL }
13076     },
13077     { &hf_pn_io_channel_number,
13078       { "ChannelNumber", "pn_io.channel_number",
13079         FT_UINT16, BASE_HEX, NULL, 0x0,
13080         NULL, HFILL }
13081     },
13082 
13083     { &hf_pn_io_channel_properties,
13084       { "ChannelProperties", "pn_io.channel_properties",
13085         FT_UINT16, BASE_HEX, NULL, 0x0,
13086         NULL, HFILL }
13087     },
13088     { &hf_pn_io_channel_properties_type,
13089       { "Type", "pn_io.channel_properties.type",
13090         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_type), 0x00FF,
13091         NULL, HFILL }
13092     },
13093     { &hf_pn_io_channel_properties_accumulative,
13094       { "Accumulative", "pn_io.channel_properties.accumulative",
13095         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_accumulative_vals), 0x0100,
13096         NULL, HFILL }
13097     },
13098     { &hf_pn_io_NumberOfSubframeBlocks,
13099       { "NumberOfSubframeBlocks", "pn_io.NumberOfSubframeBlocks",
13100         FT_UINT16, BASE_DEC, NULL, 0x0,
13101         NULL, HFILL }
13102     },
13103     { &hf_pn_io_channel_properties_maintenance,
13104       { "Maintenance (Severity)", "pn_io.channel_properties.maintenance",
13105         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_maintenance), 0x0600,
13106         NULL, HFILL }
13107     },
13108       { &hf_pn_io_channel_properties_specifier,
13109         { "Specifier", "pn_io.channel_properties.specifier",
13110           FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_specifier), 0x1800,
13111           NULL, HFILL }
13112       },
13113     { &hf_pn_io_channel_properties_direction,
13114       { "Direction", "pn_io.channel_properties.direction",
13115         FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_direction), 0xE000,
13116         NULL, HFILL }
13117     },
13118 
13119     { &hf_pn_io_channel_error_type,
13120       { "ChannelErrorType", "pn_io.channel_error_type",
13121         FT_UINT16, BASE_HEX, VALS(pn_io_channel_error_type), 0x0,
13122         NULL, HFILL }
13123     },
13124     { &hf_pn_io_ext_channel_error_type0,
13125       { "ExtChannelErrorType", "pn_io.ext_channel_error_type0",
13126         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0), 0x0,
13127         NULL, HFILL }
13128     },
13129     { &hf_pn_io_ext_channel_error_type0x8000,
13130       { "ExtChannelErrorType", "pn_io.ext_channel_error_type0800",
13131         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8000), 0x0,
13132         NULL, HFILL }
13133     },
13134     { &hf_pn_io_ext_channel_error_type0x8001,
13135       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8001",
13136         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8001), 0x0,
13137         NULL, HFILL }
13138     },
13139     { &hf_pn_io_ext_channel_error_type0x8002,
13140       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8002",
13141         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8002), 0x0,
13142         NULL, HFILL }
13143     },
13144     { &hf_pn_io_ext_channel_error_type0x8003,
13145       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8003",
13146         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8003), 0x0,
13147         NULL, HFILL }
13148     },
13149     { &hf_pn_io_ext_channel_error_type0x8004,
13150       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8004",
13151         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8004), 0x0,
13152         NULL, HFILL }
13153     },
13154     { &hf_pn_io_ext_channel_error_type0x8005,
13155       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8005",
13156         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8005), 0x0,
13157         NULL, HFILL }
13158     },
13159     { &hf_pn_io_ext_channel_error_type0x8007,
13160       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8007",
13161         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8007), 0x0,
13162         NULL, HFILL }
13163     },
13164     { &hf_pn_io_ext_channel_error_type0x8008,
13165       { "ExtChannelErrorType", "pn_io.ext_channel_error_type8008",
13166         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8008), 0x0,
13167         NULL, HFILL }
13168     },
13169     { &hf_pn_io_ext_channel_error_type0x800A,
13170       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800A",
13171         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800A), 0x0,
13172         NULL, HFILL }
13173     },
13174     { &hf_pn_io_ext_channel_error_type0x800B,
13175       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800B",
13176         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800B), 0x0,
13177         NULL, HFILL }
13178     },
13179     { &hf_pn_io_ext_channel_error_type0x800C,
13180       { "ExtChannelErrorType", "pn_io.ext_channel_error_type800C",
13181         FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800C), 0x0,
13182         NULL, HFILL }
13183     },
13184     { &hf_pn_io_ext_channel_error_type,
13185       { "ExtChannelErrorType", "pn_io.ext_channel_error_type",
13186         FT_UINT16, BASE_HEX, NULL, 0x0,
13187         NULL, HFILL }
13188     },
13189     { &hf_pn_io_ext_channel_add_value,
13190       { "ExtChannelAddValue", "pn_io.ext_channel_add_value",
13191         FT_UINT32, BASE_HEX, NULL, 0x0,
13192         NULL, HFILL }
13193     },
13194     { &hf_pn_io_ptcp_subdomain_id,
13195       { "PTCPSubdomainID", "pn_io.ptcp_subdomain_id",
13196         FT_GUID, BASE_NONE, NULL, 0x0,
13197         NULL, HFILL }
13198     },
13199     { &hf_pn_io_ir_data_id,
13200       { "IRDataID", "pn_io.ir_data_id",
13201         FT_GUID, BASE_NONE, NULL, 0x0,
13202         NULL, HFILL }
13203     },
13204     { &hf_pn_io_max_bridge_delay,
13205       { "MaxBridgeDelay", "pn_io.max_bridge_delay",
13206         FT_UINT32, BASE_DEC, NULL, 0x0,
13207         NULL, HFILL }
13208     },
13209     { &hf_pn_io_number_of_ports,
13210       { "NumberOfPorts", "pn_io.number_of_ports",
13211         FT_UINT32, BASE_DEC, NULL, 0x0,
13212         NULL, HFILL }
13213     },
13214     { &hf_pn_io_max_port_tx_delay,
13215       { "MaxPortTxDelay", "pn_io.max_port_tx_delay",
13216         FT_UINT32, BASE_DEC, NULL, 0x0,
13217         NULL, HFILL }
13218     },
13219     { &hf_pn_io_max_port_rx_delay,
13220       { "MaxPortRxDelay", "pn_io.max_port_rx_delay",
13221         FT_UINT32, BASE_DEC, NULL, 0x0,
13222         NULL, HFILL }
13223     },
13224    { &hf_pn_io_max_line_rx_delay,
13225      { "MaxLineRxDelay", "pn_io.max_line_rx_delay",
13226        FT_UINT32, BASE_DEC, NULL, 0x0,
13227        NULL, HFILL }
13228    },
13229    { &hf_pn_io_yellowtime,
13230      { "YellowTime", "pn_io.yellowtime",
13231        FT_UINT32, BASE_DEC, NULL, 0x0,
13232        NULL, HFILL }
13233    },
13234     { &hf_pn_io_reserved_interval_begin,
13235       { "ReservedIntervalBegin", "pn_io.reserved_interval_begin",
13236         FT_UINT32, BASE_DEC, NULL, 0x0,
13237         NULL, HFILL }
13238     },
13239     { &hf_pn_io_reserved_interval_end,
13240       { "ReservedIntervalEnd", "pn_io.reserved_interval_end",
13241         FT_UINT32, BASE_DEC, NULL, 0x0,
13242         NULL, HFILL }
13243     },
13244     { &hf_pn_io_pllwindow,
13245       { "PLLWindow", "pn_io.pllwindow",
13246         FT_UINT32, BASE_DEC, NULL, 0x0,
13247         NULL, HFILL }
13248     },
13249     { &hf_pn_io_sync_send_factor,
13250       { "SyncSendFactor", "pn_io.sync_send_factor",
13251         FT_UINT32, BASE_DEC, NULL, 0x0,
13252         NULL, HFILL }
13253     },
13254     { &hf_pn_io_sync_properties,
13255       { "SyncProperties", "pn_io.sync_properties",
13256         FT_UINT16, BASE_HEX, NULL, 0x0,
13257         NULL, HFILL }
13258     },
13259     { &hf_pn_io_sync_frame_address,
13260       { "SyncFrameAddress", "pn_io.sync_frame_address",
13261         FT_UINT16, BASE_HEX, NULL, 0x0,
13262         NULL, HFILL }
13263     },
13264     { &hf_pn_io_ptcp_timeout_factor,
13265       { "PTCPTimeoutFactor", "pn_io.ptcp_timeout_factor",
13266         FT_UINT16, BASE_DEC, NULL, 0x0,
13267         NULL, HFILL }
13268     },
13269     { &hf_pn_io_ptcp_takeover_timeout_factor,
13270       { "PTCPTakeoverTimeoutFactor", "pn_io.ptcp_takeover_timeout_factor",
13271         FT_UINT16, BASE_DEC, NULL, 0x0,
13272         NULL, HFILL }
13273     },
13274     { &hf_pn_io_ptcp_master_startup_time,
13275       { "PTCPMasterStartupTime", "pn_io.ptcp_master_startup_time",
13276         FT_UINT16, BASE_DEC, NULL, 0x0,
13277         NULL, HFILL }
13278     },
13279     { &hf_pn_io_ptcp_master_priority_1,
13280       { "PTCP_MasterPriority1", "pn_io.ptcp_master_priority_1",
13281         FT_UINT8, BASE_DEC, NULL, 0x0,
13282         NULL, HFILL }
13283     },
13284     { &hf_pn_io_ptcp_master_priority_2,
13285       { "PTCP_MasterPriority2", "pn_io.ptcp_master_priority_2",
13286         FT_UINT8, BASE_DEC, NULL, 0x0,
13287         NULL, HFILL }
13288     },
13289     { &hf_pn_io_ptcp_length_subdomain_name,
13290       { "PTCPLengthSubdomainName", "pn_io.ptcp_length_subdomain_name",
13291         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13292         NULL, HFILL }
13293     },
13294     { &hf_pn_io_ptcp_subdomain_name,
13295       { "PTCPSubdomainName", "pn_io.ptcp_subdomain_name",
13296         FT_STRING, BASE_NONE, NULL, 0x0,
13297         NULL, HFILL }
13298     },
13299     { &hf_pn_io_MultipleInterfaceMode_NameOfDevice,
13300       { "MultipleInterfaceMode.NameOfDevice", "pn_io.MultipleInterfaceMode_NameOfDevice",
13301         FT_UINT32, BASE_HEX, VALS(pn_io_MultipleInterfaceMode_NameOfDevice), 0x01,
13302         NULL, HFILL }
13303     },
13304     { &hf_pn_io_MultipleInterfaceMode_reserved_1,
13305       { "MultipleInterfaceMode.Reserved_1", "pn_io.MultipleInterfaceMode_reserved_1",
13306         FT_UINT32, BASE_HEX, NULL, 0xFFFE,
13307         NULL, HFILL }
13308     },
13309     { &hf_pn_io_MultipleInterfaceMode_reserved_2,
13310       { "MultipleInterfaceMode.Reserved_2", "pn_io.MultipleInterfaceMode_reserved_2",
13311         FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
13312         NULL, HFILL }
13313     },
13314     { &hf_pn_io_pdportstatistic_counter_status,
13315       { "CounterStatus", "pn_io.CounterStatus",
13316         FT_UINT16, BASE_HEX, NULL, 0x0,
13317         NULL, HFILL }
13318     },
13319     { &hf_pn_io_pdportstatistic_counter_status_ifInOctets,
13320       { "CounterStatus.ifInOctets", "pn_io.CounterStatus.ifInOctets",
13321         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0001,
13322         NULL, HFILL }
13323     },
13324     { &hf_pn_io_pdportstatistic_counter_status_ifOutOctets,
13325       { "CounterStatus.ifOutOctets", "pn_io.CounterStatus.ifOutOctets",
13326         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0002,
13327          NULL, HFILL }
13328     },
13329     { &hf_pn_io_pdportstatistic_counter_status_ifInDiscards,
13330       { "CounterStatus.ifInDiscards", "pn_io.CounterStatus.ifInDiscards",
13331         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0004,
13332         NULL, HFILL }
13333     },
13334     { &hf_pn_io_pdportstatistic_counter_status_ifOutDiscards,
13335       { "CounterStatus.ifOutDiscards", "pn_io.CounterStatus.ifOutDiscards",
13336         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0008,
13337         NULL, HFILL }
13338     },
13339     { &hf_pn_io_pdportstatistic_counter_status_ifInErrors,
13340       { "CounterStatus.ifInErrors", "pn_io.CounterStatus.ifInErrors",
13341         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0010,
13342         NULL, HFILL }
13343     },
13344     { &hf_pn_io_pdportstatistic_counter_status_ifOutErrors,
13345       { "CounterStatus.ifOutErrors", "pn_io.CounterStatus.ifOutErrors",
13346         FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0020,
13347         NULL, HFILL }
13348     },
13349     { &hf_pn_io_pdportstatistic_counter_status_reserved,
13350       { "CounterStatus.Reserved", "pn_io.CounterStatus.Reserved",
13351         FT_UINT16, BASE_HEX, VALS(pn_io_pdportstatistic_counter_status_reserved), 0xFFC0,
13352         NULL, HFILL }
13353     },
13354     { &hf_pn_io_pdportstatistic_ifInOctets,
13355       { "ifInOctets", "pn_io.ifInOctets",
13356         FT_UINT32, BASE_HEX, NULL, 0x0,
13357         NULL, HFILL }
13358     },
13359     { &hf_pn_io_pdportstatistic_ifOutOctets,
13360       { "ifOutOctets", "pn_io.ifOutOctets",
13361         FT_UINT32, BASE_HEX, NULL, 0x0,
13362         NULL, HFILL }
13363     },
13364     { &hf_pn_io_pdportstatistic_ifInDiscards,
13365       { "ifInDiscards", "pn_io.ifInDiscards",
13366         FT_UINT32, BASE_HEX, NULL, 0x0,
13367         NULL, HFILL }
13368     },
13369     { &hf_pn_io_pdportstatistic_ifOutDiscards,
13370       { "ifOutDiscards", "pn_io.ifOutDiscards",
13371         FT_UINT32, BASE_HEX, NULL, 0x0,
13372         NULL, HFILL }
13373     },
13374     { &hf_pn_io_pdportstatistic_ifInErrors,
13375       { "ifInErrors", "pn_io.ifInErrors",
13376         FT_UINT32, BASE_HEX, NULL, 0x0,
13377         NULL, HFILL }
13378     },
13379     { &hf_pn_io_pdportstatistic_ifOutErrors,
13380       { "ifOutErrors", "pn_io.ifOutErrors",
13381         FT_UINT32, BASE_HEX, NULL, 0x0,
13382         NULL, HFILL }
13383     },
13384 
13385     { &hf_pn_io_domain_boundary,
13386       { "DomainBoundary", "pn_io.domain_boundary",
13387         FT_UINT32, BASE_HEX, NULL, 0x0,
13388         NULL, HFILL }
13389     },
13390     { &hf_pn_io_domain_boundary_ingress,
13391       { "DomainBoundaryIngress", "pn_io.domain_boundary.ingress",
13392         FT_UINT32, BASE_HEX, NULL, 0x0,
13393         NULL, HFILL }
13394     },
13395     { &hf_pn_io_domain_boundary_egress,
13396       { "DomainBoundaryEgress", "pn_io.domain_boundary.egress",
13397         FT_UINT32, BASE_HEX, NULL, 0x0,
13398         NULL, HFILL }
13399     },
13400     { &hf_pn_io_multicast_boundary,
13401       { "MulticastBoundary", "pn_io.multicast_boundary",
13402         FT_UINT32, BASE_HEX, NULL, 0x0,
13403         NULL, HFILL }
13404     },
13405     { &hf_pn_io_adjust_properties,
13406       { "AdjustProperties", "pn_io.adjust_properties",
13407         FT_UINT16, BASE_HEX, NULL, 0x0,
13408         NULL, HFILL }
13409     },
13410     { &hf_pn_io_PreambleLength,
13411       { "Preamble Length", "pn_io.preamble_length",
13412         FT_UINT16, BASE_DEC_HEX, VALS(pn_io_preamble_length), 0x0,
13413         NULL, HFILL }
13414     },
13415     { &hf_pn_io_mau_type,
13416       { "MAUType", "pn_io.mau_type",
13417         FT_UINT16, BASE_HEX, VALS(pn_io_mau_type), 0x0,
13418         NULL, HFILL }
13419     },
13420     { &hf_pn_io_mau_type_mode,
13421       { "MAUTypeMode", "pn_io.mau_type_mode",
13422         FT_UINT16, BASE_HEX, VALS(pn_io_mau_type_mode), 0x0,
13423         NULL, HFILL }
13424     },
13425     { &hf_pn_io_dcp_boundary_value,
13426     { "DCPBoundary", "pn_io.dcp_boundary_value",
13427         FT_UINT32, BASE_HEX, NULL, 0x0,
13428         NULL, HFILL }
13429     },
13430     { &hf_pn_io_dcp_boundary_value_bit0,
13431       { "DCPBoundary", "pn_io.dcp_boundary_value_bit0",
13432          FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit0), 0x1,
13433          NULL, HFILL }
13434     },
13435     { &hf_pn_io_dcp_boundary_value_bit1,
13436       { "DCPBoundary", "pn_io.dcp_boundary_value_bit1",
13437         FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit1), 0x2,
13438         NULL, HFILL }
13439     },
13440     { &hf_pn_io_dcp_boundary_value_otherbits,
13441       { "DCPBoundary", "pn_io.dcp_boundary_value_otherbits",
13442         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC,
13443         NULL, HFILL }
13444     },
13445     { &hf_pn_io_peer_to_peer_boundary_value,
13446       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value",
13447         FT_UINT32, BASE_HEX, NULL, 0x0,
13448         NULL, HFILL }
13449     },
13450     { &hf_pn_io_peer_to_peer_boundary_value_bit0,
13451       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit0",
13452         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit0), 0x1,
13453         NULL, HFILL }
13454     },
13455     { &hf_pn_io_peer_to_peer_boundary_value_bit1,
13456       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit1",
13457         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit1), 0x2,
13458         NULL, HFILL }
13459     },
13460     { &hf_pn_io_peer_to_peer_boundary_value_bit2,
13461       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit2",
13462         FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit2), 0x4,
13463         NULL, HFILL }
13464     },
13465     { &hf_pn_io_peer_to_peer_boundary_value_otherbits,
13466       { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_otherbits",
13467         FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF8,
13468         NULL, HFILL }
13469     },
13470     { &hf_pn_io_port_state,
13471       { "PortState", "pn_io.port_state",
13472         FT_UINT16, BASE_HEX, VALS(pn_io_port_state), 0x0,
13473         NULL, HFILL }
13474     },
13475     { &hf_pn_io_link_state_port,
13476       { "LinkState.Port", "pn_io.link_state_port",
13477         FT_UINT8, BASE_HEX, VALS(pn_io_link_state_port), 0x0,
13478         NULL, HFILL }
13479     },
13480     { &hf_pn_io_link_state_link,
13481       { "LinkState.Link", "pn_io.link_state_link",
13482         FT_UINT8, BASE_HEX, VALS(pn_io_link_state_link), 0x0,
13483         NULL, HFILL }
13484     },
13485     { &hf_pn_io_line_delay,
13486       { "LineDelay", "pn_io.line_delay",
13487         FT_UINT32, BASE_HEX, NULL, 0x0,
13488         "LineDelay in nanoseconds", HFILL }
13489     },
13490     { &hf_pn_io_line_delay_value,
13491       { "LineDelayValue", "pn_io.line_delay_value",
13492         FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_line_delay_value), 0x7FFFFFFF,
13493         NULL, HFILL }
13494     },
13495     { &hf_pn_io_cable_delay_value,
13496       { "CableDelayValue", "pn_io.cable_delay_value",
13497          FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_cable_delay_value), 0x7FFFFFFF,
13498         NULL, HFILL }
13499     },
13500     { &hf_pn_io_line_delay_format_indicator,
13501       { "LineDelayFormatIndicator", "pn_io.line_delay_format_indicator",
13502         FT_UINT32, BASE_HEX, NULL, 0x80000000,
13503         "LineDelay FormatIndicator", HFILL }
13504     },
13505     { &hf_pn_io_number_of_peers,
13506       { "NumberOfPeers", "pn_io.number_of_peers",
13507         FT_UINT8, BASE_DEC, NULL, 0x0,
13508         NULL, HFILL }
13509     },
13510     { &hf_pn_io_length_peer_port_id,
13511       { "LengthPeerPortID", "pn_io.length_peer_port_id",
13512         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13513         NULL, HFILL }
13514     },
13515     { &hf_pn_io_peer_port_id,
13516       { "PeerPortID", "pn_io.peer_port_id",
13517         FT_STRING, BASE_NONE, NULL, 0x0,
13518         NULL, HFILL }
13519     },
13520     { &hf_pn_io_length_peer_chassis_id,
13521       { "LengthPeerChassisID", "pn_io.length_peer_chassis_id",
13522         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13523         NULL, HFILL }
13524     },
13525     { &hf_pn_io_peer_chassis_id,
13526       { "PeerChassisID", "pn_io.peer_chassis_id",
13527         FT_STRING, BASE_NONE, NULL, 0x0,
13528         NULL, HFILL }
13529     },
13530     { &hf_pn_io_length_own_chassis_id,
13531       { "LengthOwnChassisID", "pn_io.length_own_chassis_id",
13532         FT_UINT8, BASE_DEC, NULL, 0x0,
13533         NULL, HFILL }
13534     },
13535     { &hf_pn_io_own_chassis_id,
13536       { "OwnChassisID", "pn_io.own_chassis_id",
13537         FT_STRING, BASE_NONE, NULL, 0x0,
13538         NULL, HFILL }
13539     },
13540     { &hf_pn_io_length_own_port_id,
13541       { "LengthOwnPortID", "pn_io.length_own_port_id",
13542         FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
13543         NULL, HFILL }
13544     },
13545     { &hf_pn_io_own_port_id,
13546       { "OwnPortID", "pn_io.own_port_id",
13547         FT_STRING, BASE_NONE, NULL, 0x0,
13548         NULL, HFILL }
13549     },
13550     { &hf_pn_io_peer_macadd,
13551       { "PeerMACAddress", "pn_io.peer_macadd",
13552         FT_ETHER, BASE_NONE, NULL, 0x0,
13553         NULL, HFILL }
13554     },
13555     { &hf_pn_io_macadd,
13556       { "MACAddress", "pn_io.macadd",
13557         FT_ETHER, BASE_NONE, NULL, 0x0,
13558         NULL, HFILL }
13559     },
13560     { &hf_pn_io_media_type,
13561       { "MediaType", "pn_io.media_type",
13562         FT_UINT32, BASE_HEX, VALS(pn_io_media_type), 0x0,
13563         NULL, HFILL }
13564     },
13565 
13566     { &hf_pn_io_ethertype,
13567       { "Ethertype", "pn_io.ethertype",
13568         FT_UINT16, BASE_HEX, NULL, 0x0,
13569         NULL, HFILL }
13570     },
13571     { &hf_pn_io_rx_port,
13572       { "RXPort", "pn_io.rx_port",
13573         FT_UINT8, BASE_DEC, NULL, 0x0,
13574         NULL, HFILL }
13575     },
13576     { &hf_pn_io_frame_details,
13577       { "FrameDetails", "pn_io.frame_details",
13578         FT_UINT8, BASE_HEX, NULL, 0x0,
13579         NULL, HFILL }
13580     },
13581     { &hf_pn_io_frame_details_sync_frame,
13582       { "SyncFrame", "pn_io.frame_details.sync_frame",
13583         FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_sync_master_vals), 0x03,
13584         NULL, HFILL }
13585     },
13586     { &hf_pn_io_frame_details_meaning_frame_send_offset,
13587       { "Meaning", "pn_io.frame_details.meaning_frame_send_offset",
13588         FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_meaning_frame_send_offset_vals), 0x0C,
13589         NULL, HFILL }
13590     },
13591     { &hf_pn_io_frame_details_reserved,
13592       { "Reserved", "pn_io.frame_details.reserved",
13593         FT_UINT8, BASE_HEX, NULL, 0xF0,
13594         NULL, HFILL }
13595     },
13596     { &hf_pn_io_nr_of_tx_port_groups,
13597       { "NumberOfTxPortGroups", "pn_io.nr_of_tx_port_groups",
13598         FT_UINT8, BASE_DEC, NULL, 0x0,
13599         NULL, HFILL }
13600     },
13601     { &hf_pn_io_TxPortGroupProperties,
13602       { "TxPortGroupProperties", "pn_io.tx_port_properties",
13603         FT_UINT8, BASE_HEX, NULL, 0x0,
13604         NULL, HFILL }
13605     },
13606     { &hf_pn_io_TxPortGroupProperties_bit0,
13607       { "TxPortLocal", "pn_io.tx_port_properties_bit_0",
13608         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x01,
13609         NULL, HFILL }
13610     },
13611     { &hf_pn_io_TxPortGroupProperties_bit1,
13612       { "TxPort_1", "pn_io.tx_port_properties_bit_1",
13613         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x02,
13614         NULL, HFILL }
13615     },
13616     { &hf_pn_io_TxPortGroupProperties_bit2,
13617       { "TxPort_2", "pn_io.tx_port_properties_bit_2",
13618         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x04,
13619         NULL, HFILL }
13620     },
13621     { &hf_pn_io_TxPortGroupProperties_bit3,
13622       { "TxPort_3", "pn_io.tx_port_properties_bit_3",
13623         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x08,
13624         NULL, HFILL }
13625     },
13626     { &hf_pn_io_TxPortGroupProperties_bit4,
13627       { "TxPort_4", "pn_io.tx_port_properties_bit_4",
13628         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x10,
13629         NULL, HFILL }
13630     },
13631     { &hf_pn_io_TxPortGroupProperties_bit5,
13632       { "TxPort_5", "pn_io.tx_port_properties_bit_5",
13633         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x20,
13634         NULL, HFILL }
13635     },
13636     { &hf_pn_io_TxPortGroupProperties_bit6,
13637       { "TxPort_6", "pn_io.tx_port_properties_bit_6",
13638         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x40,
13639         NULL, HFILL }
13640     },
13641     { &hf_pn_io_TxPortGroupProperties_bit7,
13642       { "TxPort_7", "pn_io.tx_port_properties_bit_7",
13643         FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x80,
13644         NULL, HFILL }
13645     },
13646 
13647     { &hf_pn_io_start_of_red_frame_id,
13648       { "StartOfRedFrameID", "pn_io.start_of_red_frame_id",
13649         FT_UINT16, BASE_HEX, NULL, 0x0,
13650         NULL, HFILL }
13651     },
13652     { &hf_pn_io_end_of_red_frame_id,
13653       { "EndOfRedFrameID", "pn_io.end_of_red_frame_id",
13654         FT_UINT16, BASE_HEX, NULL, 0x0,
13655         NULL, HFILL }
13656     },
13657     { &hf_pn_io_ir_begin_end_port,
13658       { "Port", "pn_io.ir_begin_end_port",
13659         FT_NONE, BASE_NONE, NULL, 0x0,
13660         NULL, HFILL }
13661     },
13662     { &hf_pn_io_number_of_assignments,
13663       { "NumberOfAssignments", "pn_io.number_of_assignments",
13664         FT_UINT32, BASE_DEC, NULL, 0x0,
13665         NULL, HFILL }
13666     },
13667     { &hf_pn_io_number_of_phases,
13668       { "NumberOfPhases", "pn_io.number_of_phases",
13669         FT_UINT32, BASE_DEC, NULL, 0x0,
13670         NULL, HFILL }
13671     },
13672     { &hf_pn_io_red_orange_period_begin_tx,
13673       { "RedOrangePeriodBegin [TX]", "pn_io.red_orange_period_begin_tx",
13674         FT_UINT32, BASE_DEC, NULL, 0x0,
13675         NULL, HFILL }
13676     },
13677     { &hf_pn_io_orange_period_begin_tx,
13678       { "OrangePeriodBegin [TX]", "pn_io.orange_period_begin_tx",
13679         FT_UINT32, BASE_DEC, NULL, 0x0,
13680         NULL, HFILL }
13681     },
13682     { &hf_pn_io_green_period_begin_tx,
13683       { "GreenPeriodBegin [TX]", "pn_io.green_period_begin_tx",
13684         FT_UINT32, BASE_DEC, NULL, 0x0,
13685         NULL, HFILL }
13686     },
13687     { &hf_pn_io_red_orange_period_begin_rx,
13688       { "RedOrangePeriodBegin [RX]", "pn_io.red_orange_period_begin_rx",
13689         FT_UINT32, BASE_DEC, NULL, 0x0,
13690         NULL, HFILL }
13691     },
13692     { &hf_pn_io_orange_period_begin_rx,
13693       { "OrangePeriodBegin [RX]", "pn_io.orange_period_begin_rx",
13694         FT_UINT32, BASE_DEC, NULL, 0x0,
13695         NULL, HFILL }
13696     },
13697     { &hf_pn_io_green_period_begin_rx,
13698       { "GreenPeriodBegin [RX]", "pn_io.green_period_begin_rx",
13699         FT_UINT32, BASE_DEC, NULL, 0x0,
13700         NULL, HFILL }
13701     },
13702     { &hf_pn_ir_tx_phase_assignment,
13703       { "TXPhaseAssignment", "pn_io.tx_phase_assignment_sub",
13704         FT_NONE, BASE_NONE, NULL, 0x0,
13705         NULL, HFILL }
13706     },
13707     { &hf_pn_io_tx_phase_assignment_begin_value,
13708       { "AssignedValueForReservedBegin", "pn_io.tx_phase_assignment_begin_value",
13709         FT_UINT16, BASE_DEC, NULL, 0x0F,
13710         NULL, HFILL }
13711     },
13712     { &hf_pn_io_tx_phase_assignment_orange_begin,
13713       { "AssignedValueForOrangeBegin", "pn_io.tx_phase_assignment_orange_begin",
13714         FT_UINT16, BASE_DEC, NULL, 0x0F0,
13715         NULL, HFILL }
13716     },
13717     { &hf_pn_io_tx_phase_assignment_end_reserved,
13718       { "AssignedValueForReservedEnd", "pn_io.tx_phase_assignment_end_reserved",
13719         FT_UINT16, BASE_DEC, NULL, 0x0F00,
13720         NULL, HFILL }
13721     },
13722     { &hf_pn_io_tx_phase_assignment_reserved,
13723       { "Reserved should be 0", "pn_io.tx_phase_assignment_reserved",
13724         FT_UINT16, BASE_DEC, NULL, 0x0F000,
13725         NULL, HFILL }
13726     },
13727     { &hf_pn_ir_rx_phase_assignment,
13728       { "RXPhaseAssignment", "pn_io.rx_phase_assignment_sub",
13729         FT_NONE, BASE_NONE, NULL, 0x0,
13730         NULL, HFILL }
13731     },
13732     { &hf_pn_io_slot,
13733       { "Slot", "pn_io.slot",
13734         FT_NONE, BASE_NONE, NULL, 0x0,
13735         NULL, HFILL }
13736     },
13737     { &hf_pn_io_subslot,
13738       { "Subslot", "pn_io.subslot",
13739         FT_NONE, BASE_NONE, NULL, 0x0,
13740         NULL, HFILL }
13741     },
13742     { &hf_pn_io_number_of_slots,
13743       { "NumberOfSlots", "pn_io.number_of_slots",
13744         FT_UINT16, BASE_DEC, NULL, 0x0,
13745         NULL, HFILL }
13746     },
13747     { &hf_pn_io_number_of_subslots,
13748       { "NumberOfSubslots", "pn_io.number_of_subslots",
13749         FT_UINT16, BASE_DEC, NULL, 0x0,
13750         NULL, HFILL }
13751     },
13752     { &hf_pn_io_maintenance_required_power_budget,
13753       { "MaintenanceRequiredPowerBudget", "pn_io.maintenance_required_power_budget",
13754         FT_UINT32, BASE_HEX, NULL, 0x0,
13755         NULL, HFILL }
13756     },
13757     { &hf_pn_io_maintenance_demanded_power_budget,
13758       { "MaintenanceDemandedPowerBudget", "pn_io.maintenance_demanded_power_budget",
13759         FT_UINT32, BASE_HEX, NULL, 0x0,
13760         NULL, HFILL }
13761     },
13762     { &hf_pn_io_error_power_budget,
13763       { "ErrorPowerBudget", "pn_io.error_power_budget",
13764         FT_UINT32, BASE_HEX, NULL, 0x0,
13765         NULL, HFILL }
13766     },
13767     { &hf_pn_io_fiber_optic_type,
13768       { "FiberOpticType", "pn_io.fiber_optic_type",
13769         FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_type), 0x0,
13770         NULL, HFILL }
13771     },
13772     { &hf_pn_io_fiber_optic_cable_type,
13773       { "FiberOpticCableType", "pn_io.fiber_optic_cable_type",
13774         FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_cable_type), 0x0,
13775         NULL, HFILL }
13776     },
13777     { &hf_pn_io_controller_appl_cycle_factor,
13778       { "ControllerApplicationCycleFactor", "pn_io.controller_appl_cycle_factor",
13779         FT_UINT16, BASE_DEC, NULL, 0x0,
13780         NULL, HFILL }
13781     },
13782     { &hf_pn_io_time_data_cycle,
13783       { "TimeDataCycle", "pn_io.time_data_cycle",
13784         FT_UINT16, BASE_DEC, NULL, 0x0,
13785         NULL, HFILL }
13786     },
13787     { &hf_pn_io_time_io_input,
13788       { "TimeIOInput", "pn_io.time_io_input",
13789         FT_UINT32, BASE_DEC, NULL, 0x0,
13790         NULL, HFILL }
13791     },
13792     { &hf_pn_io_time_io_output,
13793       { "TimeIOOutput", "pn_io.time_io_output",
13794         FT_UINT32, BASE_DEC, NULL, 0x0,
13795         NULL, HFILL }
13796     },
13797     { &hf_pn_io_time_io_input_valid,
13798       { "TimeIOInputValid", "pn_io.time_io_input_valid",
13799         FT_UINT32, BASE_DEC, NULL, 0x0,
13800         NULL, HFILL }
13801     },
13802     { &hf_pn_io_time_io_output_valid,
13803       { "TimeIOOutputValid", "pn_io.time_io_output_valid",
13804         FT_UINT32, BASE_DEC, NULL, 0x0,
13805         NULL, HFILL }
13806     },
13807     { &hf_pn_io_maintenance_status,
13808       { "MaintenanceStatus", "pn_io.maintenance_status",
13809         FT_UINT32, BASE_HEX, NULL, 0x0,
13810         NULL, HFILL }
13811     },
13812     { &hf_pn_io_maintenance_status_required,
13813       { "Required", "pn_io.maintenance_status_required",
13814         FT_UINT32, BASE_HEX, NULL, 0x0001,
13815         NULL, HFILL }
13816     },
13817     { &hf_pn_io_maintenance_status_demanded,
13818       { "Demanded", "pn_io.maintenance_status_demanded",
13819         FT_UINT32, BASE_HEX, NULL, 0x0002,
13820         NULL, HFILL }
13821     },
13822     { &hf_pn_io_vendor_id_high,
13823       { "VendorIDHigh", "pn_io.vendor_id_high",
13824         FT_UINT8, BASE_HEX, NULL, 0x0,
13825         NULL, HFILL }
13826     },
13827     { &hf_pn_io_vendor_id_low,
13828       { "VendorIDLow", "pn_io.vendor_id_low",
13829         FT_UINT8, BASE_HEX, NULL, 0x0,
13830         NULL, HFILL }
13831     },
13832     { &hf_pn_io_vendor_block_type,
13833       { "VendorBlockType", "pn_io.vendor_block_type",
13834         FT_UINT16, BASE_HEX, NULL, 0x0,
13835         NULL, HFILL }
13836     },
13837     { &hf_pn_io_order_id,
13838       { "OrderID", "pn_io.order_id",
13839         FT_STRING, BASE_NONE, NULL, 0x0,
13840         NULL, HFILL }
13841     },
13842     { &hf_pn_io_im_serial_number,
13843       { "IMSerialNumber", "pn_io.im_serial_number",
13844         FT_STRING, BASE_NONE, NULL, 0x0,
13845         NULL, HFILL }
13846     },
13847     { &hf_pn_io_im_hardware_revision,
13848       { "IMHardwareRevision", "pn_io.im_hardware_revision",
13849         FT_UINT16, BASE_HEX, NULL, 0x0,
13850         NULL, HFILL }
13851     },
13852       /* XXX - better use a simple char here -> vals */
13853     { &hf_pn_io_im_revision_prefix,
13854       { "IMRevisionPrefix", "pn_io.im_revision_prefix",
13855         FT_CHAR, BASE_HEX, VALS(pn_io_im_revision_prefix_vals), 0x0,
13856         NULL, HFILL }
13857     },
13858     { &hf_pn_io_im_sw_revision_functional_enhancement,
13859       { "IMSWRevisionFunctionalEnhancement", "pn_io.im_sw_revision_functional_enhancement",
13860         FT_UINT8, BASE_HEX, NULL, 0x0,
13861         NULL, HFILL }
13862     },
13863     { &hf_pn_io_im_revision_bugfix,
13864       { "IM_SWRevisionBugFix", "pn_io.im_revision_bugfix",
13865         FT_UINT8, BASE_HEX, NULL, 0x0,
13866         NULL, HFILL }
13867     },
13868     { &hf_pn_io_im_sw_revision_internal_change,
13869       { "IMSWRevisionInternalChange", "pn_io.im_sw_revision_internal_change",
13870         FT_UINT8, BASE_HEX, NULL, 0x0,
13871         NULL, HFILL }
13872     },
13873     { &hf_pn_io_im_revision_counter,
13874       { "IMRevisionCounter", "pn_io.im_revision_counter",
13875         FT_UINT16, BASE_HEX, NULL, 0x0,
13876         NULL, HFILL }
13877     },
13878     { &hf_pn_io_im_profile_id,
13879       { "IMProfileID", "pn_io.im_profile_id",
13880         FT_UINT16, BASE_HEX, NULL, 0x0,
13881         NULL, HFILL }
13882     },
13883     { &hf_pn_io_im_profile_specific_type,
13884       { "IMProfileSpecificType", "pn_io.im_profile_specific_type",
13885         FT_UINT16, BASE_HEX, NULL, 0x0,
13886         NULL, HFILL }
13887     },
13888     { &hf_pn_io_im_version_major,
13889       { "IMVersionMajor", "pn_io.im_version_major",
13890         FT_UINT8, BASE_HEX, NULL, 0x0,
13891         NULL, HFILL }
13892     },
13893     { &hf_pn_io_im_version_minor,
13894       { "IMVersionMinor", "pn_io.im_version_minor",
13895         FT_UINT8, BASE_HEX, NULL, 0x0,
13896         NULL, HFILL }
13897     },
13898     { &hf_pn_io_im_supported,
13899       { "IM_Supported", "pn_io.im_supported",
13900         FT_UINT16, BASE_HEX, NULL, 0x0,
13901         NULL, HFILL }
13902     },
13903     { &hf_pn_io_im_numberofentries,
13904       { "NumberOfEntries", "pn_io.im_numberofentries",
13905         FT_UINT16, BASE_HEX, NULL, 0x0,
13906         NULL, HFILL }
13907     },
13908     { &hf_pn_io_im_annotation,
13909       { "IM Annotation", "pn_io.im_annotation",
13910         FT_STRING, BASE_NONE, NULL, 0x0,
13911         NULL, HFILL }
13912     },
13913     { &hf_pn_io_im_order_id,
13914       { "IM Order ID", "pn_io.im_order_id",
13915         FT_STRING, BASE_NONE, NULL, 0x0,
13916         NULL, HFILL }
13917     },
13918     { &hf_pn_io_number_of_ars,
13919       { "NumberOfARs", "pn_io.number_of_ars",
13920         FT_UINT16, BASE_DEC, NULL, 0x0,
13921         NULL, HFILL }
13922     },
13923     { &hf_pn_io_cycle_counter,
13924       { "CycleCounter", "pn_io.cycle_counter",
13925         FT_UINT16, BASE_DEC, NULL, 0x0,
13926         NULL, HFILL }
13927     },
13928     { &hf_pn_io_data_status,
13929       { "DataStatus", "pn_io.ds",
13930         FT_UINT8, BASE_HEX, 0, 0x0,
13931         NULL, HFILL }
13932     },
13933     { &hf_pn_io_data_status_res67,
13934       { "Reserved (should be zero)", "pn_io.ds_res67",
13935         FT_UINT8, BASE_HEX, 0, 0xc0,
13936         NULL, HFILL }
13937     },
13938     { &hf_pn_io_data_status_ok,
13939       { "StationProblemIndicator (1:Ok/0:Problem)", "pn_io.ds_ok",
13940         FT_UINT8, BASE_HEX, 0, 0x20,
13941         NULL, HFILL }
13942     },
13943     { &hf_pn_io_data_status_operate,
13944       { "ProviderState (1:Run/0:Stop)", "pn_io.ds_operate",
13945         FT_UINT8, BASE_HEX, 0, 0x10,
13946         NULL, HFILL }
13947     },
13948     { &hf_pn_io_data_status_res3,
13949       { "Reserved (should be zero)", "pn_io.ds_res3",
13950         FT_UINT8, BASE_HEX, 0, 0x08,
13951         NULL, HFILL }
13952     },
13953     { &hf_pn_io_data_status_valid,
13954       { "DataValid (1:Valid/0:Invalid)", "pn_io.ds_valid",
13955         FT_UINT8, BASE_HEX, 0, 0x04,
13956         NULL, HFILL }
13957     },
13958     { &hf_pn_io_data_status_res1,
13959       { "primary AR of a given AR-set is present (0:One/ 1:None)", "pn_io.ds_res1",
13960         FT_UINT8, BASE_HEX, 0, 0x02,
13961         NULL, HFILL }
13962     },
13963     { &hf_pn_io_data_status_primary,
13964       { "State (1:Primary/0:Backup)", "pn_io.ds_primary",
13965         FT_UINT8, BASE_HEX, 0, 0x01,
13966         NULL, HFILL }
13967     },
13968     { &hf_pn_io_transfer_status,
13969       { "TransferStatus", "pn_io.transfer_status",
13970         FT_UINT8, BASE_DEC, NULL, 0x0,
13971         NULL, HFILL }
13972     },
13973     { &hf_pn_io_actual_local_time_stamp,
13974       { "ActualLocalTimeStamp", "pn_io.actual_local_time_stamp",
13975         FT_UINT64, BASE_DEC, NULL, 0x0,
13976         NULL, HFILL }
13977     },
13978     { &hf_pn_io_local_time_stamp,
13979       { "LocalTimeStamp", "pn_io.local_time_stamp",
13980         FT_UINT64, BASE_DEC, NULL, 0x0,
13981         NULL, HFILL }
13982     },
13983     { &hf_pn_io_number_of_log_entries,
13984       { "NumberOfLogEntries", "pn_io.number_of_log_entries",
13985         FT_UINT16, BASE_DEC, NULL, 0x0,
13986         NULL, HFILL }
13987     },
13988     { &hf_pn_io_entry_detail,
13989       { "EntryDetail", "pn_io.entry_detail",
13990         FT_UINT32, BASE_DEC, NULL, 0x0,
13991         NULL, HFILL }
13992     },
13993     { &hf_pn_io_ip_address,
13994       { "IPAddress", "pn_io.ip_address",
13995         FT_IPv4, BASE_NONE, NULL, 0x0,
13996         NULL, HFILL }
13997     },
13998     { &hf_pn_io_subnetmask,
13999       { "Subnetmask", "pn_io.subnetmask",
14000         FT_IPv4, BASE_NONE, NULL, 0x0,
14001         NULL, HFILL }
14002     },
14003     { &hf_pn_io_standard_gateway,
14004       { "StandardGateway", "pn_io.standard_gateway",
14005         FT_IPv4, BASE_NONE, NULL, 0x0,
14006         NULL, HFILL }
14007     },
14008 
14009     { &hf_pn_io_mrp_domain_uuid,
14010       { "MRP_DomainUUID", "pn_io.mrp_domain_uuid",
14011         FT_GUID, BASE_NONE, NULL, 0x0,
14012         NULL, HFILL }
14013     },
14014     { &hf_pn_io_mrp_role,
14015       { "MRP_Role", "pn_io.mrp_role",
14016         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_role_vals), 0x0,
14017         NULL, HFILL }
14018     },
14019     { &hf_pn_io_mrp_length_domain_name,
14020       { "MRP_LengthDomainName", "pn_io.mrp_length_domain_name",
14021         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
14022         NULL, HFILL }
14023     },
14024     { &hf_pn_io_mrp_domain_name,
14025       { "MRP_DomainName", "pn_io.mrp_domain_name",
14026         FT_STRING, BASE_NONE, NULL, 0x0,
14027         NULL, HFILL }
14028     },
14029     { &hf_pn_io_mrp_instances,
14030       { "NumberOfMrpInstances", "pn_io.mrp_Number_MrpInstances",
14031         FT_UINT8, BASE_DEC, NULL, 0x0,
14032         NULL, HFILL }
14033     },
14034     { &hf_pn_io_mrp_instance,
14035       { "Mrp_Instance", "pn_io.mrp_MrpInstance",
14036         FT_UINT8, BASE_DEC,  VALS(pn_io_mrp_instance_no), 0x0,
14037         NULL, HFILL }
14038     },
14039 
14040     { &hf_pn_io_mrp_prio,
14041       { "MRP_Prio", "pn_io.mrp_prio",
14042         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_prio_vals), 0x0,
14043         NULL, HFILL }
14044     },
14045     { &hf_pn_io_mrp_topchgt,
14046       { "MRP_TOPchgT", "pn_io.mrp_topchgt",
14047         FT_UINT16, BASE_DEC, NULL, 0x0,
14048         "time base 10ms", HFILL }
14049     },
14050     { &hf_pn_io_mrp_topnrmax,
14051       { "MRP_TOPNRmax", "pn_io.mrp_topnrmax",
14052         FT_UINT16, BASE_DEC, NULL, 0x0,
14053         "number of iterations", HFILL }
14054     },
14055     { &hf_pn_io_mrp_tstshortt,
14056       { "MRP_TSTshortT", "pn_io.mrp_tstshortt",
14057         FT_UINT16, BASE_DEC, NULL, 0x0,
14058         "time base 1 ms", HFILL }
14059     },
14060     { &hf_pn_io_mrp_tstdefaultt,
14061       { "MRP_TSTdefaultT", "pn_io.mrp_tstdefaultt",
14062         FT_UINT16, BASE_DEC, NULL, 0x0,
14063         "time base 1ms", HFILL }
14064     },
14065     { &hf_pn_io_mrp_tstnrmax,
14066       { "MRP_TSTNRmax", "pn_io.mrp_tstnrmax",
14067         FT_UINT16, BASE_DEC, NULL, 0x0,
14068         "number of outstanding test indications causes ring failure", HFILL }
14069     },
14070     { &hf_pn_io_mrp_check,
14071       { "MRP_Check", "pn_io.mrp_check",
14072         FT_UINT32, BASE_HEX, NULL, 0x0,
14073         NULL, HFILL }
14074     },
14075     { &hf_pn_io_mrp_check_mrm,
14076       { "MRP_Check.MediaRedundancyManager", "pn_io.mrp_check.mrm",
14077         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_mrm_on), 0x01,
14078         NULL, HFILL }
14079     },
14080     { &hf_pn_io_mrp_check_mrpdomain,
14081       { "MRP_Check.MRP_DomainUUID", "pn_io.mrp_check.domainUUID",
14082         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_checkUUID), 0x02,
14083         NULL, HFILL }
14084     },
14085     { &hf_pn_io_mrp_check_reserved_1,
14086       { "MRP_Check.reserved_1", "pn_io.mrp_check_reserved_1",
14087         FT_UINT32, BASE_HEX, NULL, 0x0FFFFFC,
14088         NULL, HFILL }
14089     },
14090     { &hf_pn_io_mrp_check_reserved_2,
14091       { "MRP_Check.reserved_2", "pn_io.mrp_check_reserved_2",
14092         FT_UINT32, BASE_HEX, NULL, 0x0FF000000,
14093         NULL, HFILL }
14094     },
14095     { &hf_pn_io_mrp_rtmode,
14096       { "MRP_RTMode", "pn_io.mrp_rtmode",
14097         FT_UINT32, BASE_HEX, NULL, 0x0,
14098         NULL, HFILL }
14099     },
14100     { &hf_pn_io_mrp_rtmode_rtclass12,
14101       { "RTClass1_2", "pn_io.mrp_rtmode.class1_2",
14102         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass12_vals), 0x00000001,
14103         NULL, HFILL }
14104     },
14105     { &hf_pn_io_mrp_rtmode_rtclass3,
14106       { "RTClass1_3", "pn_io.mrp_rtmode.class3",
14107         FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass3_vals), 0x00000002,
14108         NULL, HFILL }
14109     },
14110     { &hf_pn_io_mrp_rtmode_reserved1,
14111       { "Reserved_1", "pn_io.mrp_rtmode.reserved_1",
14112         FT_UINT32, BASE_HEX, NULL, 0x00fffffc,
14113         NULL, HFILL }
14114     },
14115     { &hf_pn_io_mrp_rtmode_reserved2,
14116       { "Reserved_2", "pn_io.mrp_rtmode.reserved_2",
14117         FT_UINT32, BASE_HEX, NULL, 0xff000000,
14118         NULL, HFILL }
14119     },
14120     { &hf_pn_io_mrp_lnkdownt,
14121       { "MRP_LNKdownT", "pn_io.mrp_lnkdownt",
14122         FT_UINT16, BASE_HEX, NULL, 0x0,
14123         "Link down Interval in ms", HFILL }
14124     },
14125     { &hf_pn_io_mrp_lnkupt,
14126       { "MRP_LNKupT", "pn_io.mrp_lnkupt",
14127         FT_UINT16, BASE_HEX, NULL, 0x0,
14128         "Link up Interval in ms", HFILL }
14129     },
14130     { &hf_pn_io_mrp_lnknrmax,
14131       { "MRP_LNKNRmax", "pn_io.mrp_lnknrmax",
14132         FT_UINT16, BASE_HEX, NULL, 0x0,
14133         "number of iterations", HFILL }
14134     },
14135     { &hf_pn_io_mrp_version,
14136       { "MRP_Version", "pn_io.mrp_version",
14137         FT_UINT16, BASE_DEC, NULL, 0x0,
14138         NULL, HFILL }
14139     },
14140     { &hf_pn_io_substitute_active_flag,
14141       { "SubstituteActiveFlag", "pn_io.substitute_active_flag",
14142         FT_UINT16, BASE_HEX, NULL, 0x0,
14143         NULL, HFILL }
14144     },
14145     { &hf_pn_io_length_data,
14146       { "LengthData", "pn_io.length_data",
14147         FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
14148         NULL, HFILL }
14149     },
14150     { &hf_pn_io_mrp_ring_state,
14151       { "MRP_RingState", "pn_io.mrp_ring_state",
14152         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_ring_state_vals), 0x0,
14153         NULL, HFILL }
14154     },
14155     { &hf_pn_io_mrp_rt_state,
14156       { "MRP_RTState", "pn_io.mrp_rt_state",
14157         FT_UINT16, BASE_HEX, VALS(pn_io_mrp_rt_state_vals), 0x0,
14158         NULL, HFILL }
14159     },
14160     { &hf_pn_io_im_tag_function,
14161       { "IM_Tag_Function", "pn_io.im_tag_function",
14162         FT_STRING, BASE_NONE, NULL, 0x0,
14163         NULL, HFILL }
14164     },
14165     { &hf_pn_io_im_tag_location,
14166       { "IM_Tag_Location", "pn_io.im_tag_location",
14167         FT_STRING, BASE_NONE, NULL, 0x0,
14168         NULL, HFILL }
14169     },
14170     { &hf_pn_io_im_date,
14171       { "IM_Date", "pn_io.im_date",
14172         FT_STRING, BASE_NONE, NULL, 0x0,
14173         NULL, HFILL }
14174     },
14175     { &hf_pn_io_im_descriptor,
14176       { "IM_Descriptor", "pn_io.im_descriptor",
14177         FT_STRING, BASE_NONE, NULL, 0x0,
14178         NULL, HFILL }
14179     },
14180     { &hf_pn_io_fs_hello_mode,
14181       { "FSHelloMode", "pn_io.fs_hello_mode",
14182         FT_UINT32, BASE_HEX, VALS(pn_io_fs_hello_mode_vals), 0x0,
14183         NULL, HFILL }
14184     },
14185     { &hf_pn_io_fs_hello_interval,
14186       { "FSHelloInterval", "pn_io.fs_hello_interval",
14187         FT_UINT32, BASE_DEC, NULL, 0x0,
14188         "ms before conveying a second DCP_Hello.req", HFILL }
14189     },
14190     { &hf_pn_io_fs_hello_retry,
14191       { "FSHelloRetry", "pn_io.fs_hello_retry",
14192         FT_UINT32, BASE_DEC, NULL, 0x0,
14193         NULL, HFILL }
14194     },
14195     { &hf_pn_io_fs_hello_delay,
14196       { "FSHelloDelay", "pn_io.fs_hello_delay",
14197         FT_UINT32, BASE_DEC, NULL, 0x0,
14198         NULL, HFILL }
14199     },
14200     { &hf_pn_io_fs_parameter_mode,
14201       { "FSParameterMode", "pn_io.fs_parameter_mode",
14202         FT_UINT32, BASE_HEX, VALS(pn_io_fs_parameter_mode_vals), 0x0,
14203         NULL, HFILL }
14204     },
14205     { &hf_pn_io_fs_parameter_uuid,
14206       { "FSParameterUUID", "pn_io.fs_parameter_uuid",
14207         FT_GUID, BASE_NONE, NULL, 0x0,
14208         NULL, HFILL }
14209     },
14210     { &hf_pn_io_check_sync_mode,
14211       { "CheckSyncMode", "pn_io.check_sync_mode",
14212         FT_UINT16, BASE_HEX, NULL, 0x0,
14213         NULL, HFILL }
14214     },
14215     { &hf_pn_io_check_sync_mode_reserved,
14216       { "Reserved", "pn_io.check_sync_mode.reserved",
14217         FT_UINT16, BASE_HEX, NULL, 0xFFFC,
14218         NULL, HFILL }
14219     },
14220     { &hf_pn_io_check_sync_mode_sync_master,
14221       { "SyncMaster", "pn_io.check_sync_mode.sync_master",
14222         FT_UINT16, BASE_HEX, NULL, 0x0002,
14223         NULL, HFILL }
14224     },
14225     { &hf_pn_io_check_sync_mode_cable_delay,
14226       { "CableDelay", "pn_io.check_sync_mode.cable_delay",
14227         FT_UINT16, BASE_HEX, NULL, 0x0001,
14228         NULL, HFILL }
14229     },
14230     /* PROFIsafe F-Parameter */
14231     { &hf_pn_io_ps_f_prm_flag1,
14232       { "F_Prm_Flag1", "pn_io.ps.f_prm_flag1",
14233         FT_UINT8, BASE_HEX, NULL, 0x0,
14234         NULL, HFILL }
14235     },
14236     { &hf_pn_io_ps_f_prm_flag1_chck_seq,
14237       { "F_Check_SeqNr", "pn_io.ps.f_prm_flag1.f_check_seqnr",
14238         FT_UINT8, BASE_HEX, VALS(pn_io_f_check_seqnr), 0x01,
14239         NULL, HFILL }
14240     },
14241     { &hf_pn_io_ps_f_prm_flag1_chck_ipar,
14242       { "F_Check_iPar", "pn_io.ps.f_prm_flag1.f_check_ipar",
14243         FT_UINT8, BASE_HEX, VALS(pn_io_f_check_ipar), 0x02,
14244         NULL, HFILL }
14245     },
14246     { &hf_pn_io_ps_f_prm_flag1_sil,
14247       { "F_SIL", "pn_io.ps.f_prm_flag1.f_sil",
14248         FT_UINT8, BASE_HEX, VALS(pn_io_f_sil), 0xc,
14249         NULL, HFILL }
14250     },
14251     { &hf_pn_io_ps_f_prm_flag1_crc_len,
14252       { "F_CRC_Length", "pn_io.ps.f_prm_flag1.f_crc_len",
14253         FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_len), 0x30,
14254         NULL, HFILL }
14255     },
14256     { &hf_pn_io_ps_f_prm_flag1_crc_seed,
14257         { "F_CRC_Seed", "pn_io.ps.f_prm_flag1.f_crc_seed",
14258         FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_seed), 0x40,
14259         NULL, HFILL }
14260     },
14261     { &hf_pn_io_ps_f_prm_flag1_reserved,
14262       { "Reserved", "pn_io.ps.f_prm_flag1.reserved",
14263         FT_UINT8, BASE_HEX, NULL, 0x80,
14264         NULL, HFILL }
14265     },
14266     { &hf_pn_io_ps_f_prm_flag2,
14267       { "F_Prm_Flag2", "pn_io.ps.f_prm_flag2",
14268         FT_UINT8, BASE_HEX, NULL, 0x0,
14269         NULL, HFILL }
14270     },
14271     { &hf_pn_io_ps_f_prm_flag2_reserved,
14272       { "Reserved", "pn_io.ps.f_prm_flag2.reserved",
14273         FT_UINT8, BASE_HEX, NULL, 0x07,
14274         NULL, HFILL }
14275     },
14276     { &hf_pn_io_ps_f_prm_flag2_f_block_id,
14277       { "F_Block_ID", "pn_io.ps.f_prm_flag2.f_block_id",
14278         FT_UINT8, BASE_HEX, VALS(pn_io_f_block_id), 0x38,
14279         NULL, HFILL }
14280     },
14281     { &hf_pn_io_ps_f_prm_flag2_f_par_version,
14282       { "F_Par_Version", "pn_io.ps.f_prm_flag2.f_par_version",
14283         FT_UINT8, BASE_HEX, VALS(pn_io_f_par_version), 0xC0,
14284         NULL, HFILL }
14285     },
14286     { &hf_pn_io_ps_f_wd_time,
14287       { "F_WD_Time", "pn_io.ps.f_wd_time",
14288         FT_UINT16, BASE_DEC, NULL, 0x0,
14289         NULL, HFILL }
14290     },
14291     { &hf_pn_io_ps_f_ipar_crc,
14292         { "F_iPar_CRC", "pn_io.ps.f_ipar_crc",
14293         FT_UINT32, BASE_DEC, NULL, 0x0,
14294         NULL, HFILL }
14295     },
14296     { &hf_pn_io_ps_f_par_crc,
14297         { "F_Par_CRC", "pn_io.ps.f_par_crc",
14298         FT_UINT16, BASE_DEC, NULL, 0x0,
14299         NULL, HFILL }
14300     },
14301     { &hf_pn_io_ps_f_dest_adr,
14302         { "F_Dest_Add", "pn_io.ps.f_dest_add",
14303         FT_UINT16, BASE_DEC, NULL, 0x0,
14304         NULL, HFILL }
14305     },
14306     { &hf_pn_io_ps_f_src_adr,
14307         { "F_Source_Add", "pn_io.ps.f_source_add",
14308         FT_UINT16, BASE_DEC, NULL, 0x0,
14309         NULL, HFILL }
14310     },
14311     /* profidrive parameter access */
14312     { &hf_pn_io_profidrive_request_reference,
14313       { "RequestReference", "pn_io.profidrive.parameter.request_reference",
14314         FT_UINT8, BASE_HEX, NULL, 0x0,
14315         NULL, HFILL }
14316     },
14317     { &hf_pn_io_profidrive_request_id,
14318       { "RequestID", "pn_io.profidrive.parameter.request_id",
14319         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_request_id_vals), 0x0,
14320         NULL, HFILL }
14321     },
14322     { &hf_pn_io_profidrive_do_id,
14323       { "DO", "pn_io.profidrive.parameter.do",
14324         FT_UINT8, BASE_DEC, NULL, 0x0,
14325         NULL, HFILL }
14326     },
14327     { &hf_pn_io_profidrive_no_of_parameters,
14328       { "NoOfParameters", "pn_io.profidrive.parameter.no_of_parameters",
14329         FT_UINT8, BASE_DEC, NULL, 0x0,
14330         NULL, HFILL }
14331     },
14332     { &hf_pn_io_profidrive_param_attribute,
14333       { "Attribute", "pn_io.profidrive.parameter.attribute",
14334         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_attribute_vals), 0x0,
14335         NULL, HFILL }
14336     },
14337     { &hf_pn_io_profidrive_param_no_of_elems,
14338       { "NoOfElements", "pn_io.profidrive.parameter.no_of_elems",
14339         FT_UINT8, BASE_DEC, NULL, 0x0,
14340         NULL, HFILL }
14341     },
14342     { &hf_pn_io_profidrive_param_number,
14343       { "Parameter", "pn_io.profidrive.parameter.number",
14344         FT_UINT16, BASE_DEC, NULL, 0x0,
14345         NULL, HFILL }
14346     },
14347     { &hf_pn_io_profidrive_param_subindex,
14348       { "Index", "pn_io.profidrive.parameter.index",
14349         FT_UINT16, BASE_DEC, NULL, 0x0,
14350         NULL, HFILL }
14351     },
14352     { &hf_pn_io_profidrive_response_id,
14353       { "ResponseID", "pn_io.profidrive.parameter.response_id",
14354         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_response_id_vals), 0x0,
14355         NULL, HFILL }
14356     },
14357     { &hf_pn_io_profidrive_param_format,
14358       { "Format", "pn_io.profidrive.parameter.format",
14359         FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_format_vals), 0x0,
14360         NULL, HFILL }
14361     },
14362     { &hf_pn_io_profidrive_param_value_error,
14363       { "Error Number", "pn_io.profidrive.parameter.error_num",
14364         FT_UINT16, BASE_HEX, VALS(pn_io_profidrive_parameter_resp_errors), 0x0,
14365         NULL, HFILL }
14366     },
14367     { &hf_pn_io_profidrive_param_value_error_sub,
14368       { "Error Subindex", "pn_io.profidrive.parameter.error_subindex",
14369         FT_UINT16, BASE_HEX, NULL, 0x0,
14370         NULL, HFILL }
14371     },
14372     { &hf_pn_io_profidrive_param_no_of_values,
14373       { "NoOfValues", "pn_io.profidrive.parameter.no_of_values",
14374         FT_UINT8, BASE_DEC, NULL, 0x0,
14375         NULL, HFILL }
14376     },
14377     { &hf_pn_io_profidrive_param_value_byte,
14378       { "Value", "pn_io.profidrive.parameter.value_b",
14379         FT_UINT8, BASE_HEX, NULL, 0x0,
14380         NULL, HFILL }
14381     },
14382     { &hf_pn_io_profidrive_param_value_word,
14383       { "Value", "pn_io.profidrive.parameter.value_w",
14384         FT_UINT16, BASE_HEX, NULL, 0x0,
14385         NULL, HFILL }
14386     },
14387     { &hf_pn_io_profidrive_param_value_dword,
14388       { "Value", "pn_io.profidrive.parameter.value_dw",
14389         FT_UINT32, BASE_HEX, NULL, 0x0,
14390         NULL, HFILL }
14391     },
14392     { &hf_pn_io_profidrive_param_value_float,
14393       { "Value", "pn_io.profidrive.parameter.value_float",
14394         FT_FLOAT, BASE_NONE, NULL, 0x0,
14395         NULL, HFILL }
14396     },
14397     { &hf_pn_io_profidrive_param_value_string,
14398       { "Value", "pn_io.profidrive.parameter.value_str",
14399         FT_STRING, BASE_NONE, NULL, 0x0,
14400         NULL, HFILL }
14401     },
14402     { &hf_pn_io_rs_alarm_info_reserved_8_15,
14403       { "RSAlarmInfo.Reserved2", "pn_io.rs_alarm_info_reserved_8_15",
14404         FT_UINT16, BASE_HEX, NULL, 0x0FF00,
14405         NULL, HFILL }
14406     },
14407     { &hf_pn_io_rs_alarm_info_reserved_0_7,
14408       { "RSAlarmInfo.Reserved1", "pn_io.rs_alarm_info_reserved_0_7",
14409         FT_UINT16, BASE_HEX, NULL, 0x000FF,
14410         NULL, HFILL }
14411     },
14412     { &hf_pn_io_rs_alarm_info,
14413         { "RS Alarm Info", "pn_io.rs_alarm_info",
14414           FT_UINT16, BASE_HEX, NULL, 0x0,
14415           NULL, HFILL }
14416     },
14417     { &hf_pn_io_rs_event_info,
14418         { "RS Event Info", "pn_io.rs_event_info",
14419           FT_NONE, BASE_NONE, NULL, 0x0,
14420           NULL, HFILL }
14421     },
14422     { &hf_pn_io_rs_event_block,
14423         { "RS Event Block", "pn_io.rs_event_block",
14424           FT_NONE, BASE_NONE, NULL, 0x0,
14425           NULL, HFILL }
14426     },
14427     { &hf_pn_io_rs_adjust_block,
14428         { "RS Adjust Block", "pn_io.rs_adjust_block",
14429           FT_NONE, BASE_NONE, NULL, 0x0,
14430           NULL, HFILL }
14431     },
14432     { &hf_pn_io_rs_event_data_extension,
14433         { "RS Event Data Extension", "pn_io.rs_event_data_extension",
14434           FT_NONE, BASE_NONE, NULL, 0x0,
14435           NULL, HFILL }
14436     },
14437     { &hf_pn_io_number_of_rs_event_info,
14438         { "RSEventInfo.NumberOfEntries", "pn_io.number_of_rs_event_info",
14439           FT_UINT16, BASE_DEC, NULL, 0x0,
14440           NULL, HFILL }
14441     },
14442     { &hf_pn_io_rs_block_type,
14443         { "RS Block Type", "pn_io.rs_block_type",
14444           FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_rs_block_type), 0x0,
14445           NULL, HFILL }
14446     },
14447     { &hf_pn_io_rs_block_length,
14448         { "RS Block Length", "pn_io.rs_block_length",
14449           FT_UINT16, BASE_HEX, NULL, 0x0,
14450           NULL, HFILL }
14451     },
14452     { &hf_pn_io_rs_specifier,
14453         { "RS_Specifier", "pn_io.rs_specifier",
14454           FT_UINT16, BASE_HEX, NULL, 0x0,
14455           NULL, HFILL }
14456     },
14457     { &hf_pn_io_rs_specifier_sequence,
14458         { "RS_Specifier.SequenceNumber", "pn_io.rs_specifier.sequence",
14459           FT_UINT16, BASE_HEX, NULL, 0x07FF,
14460           NULL, HFILL }
14461     },
14462     { &hf_pn_io_rs_specifier_reserved,
14463         { "RS_Specifier.Reserved", "pn_io.rs_specifier_reserved",
14464           FT_UINT16, BASE_HEX, NULL, 0x3800,
14465           NULL, HFILL }
14466     },
14467     { &hf_pn_io_rs_specifier_specifier,
14468         { "RS_Specifier.Specifier", "pn_io.rs_specifier.specifier",
14469           FT_UINT16, BASE_HEX, VALS(pn_io_rs_specifier_specifier), 0xC000,
14470           NULL, HFILL }
14471     },
14472     { &hf_pn_io_rs_time_stamp,
14473       { "RS_TimeStamp", "pn_io.rs_time_stamp",
14474         FT_BYTES, BASE_NONE, NULL, 0x0,
14475         NULL, HFILL }
14476     },
14477     { &hf_pn_io_rs_time_stamp_status,
14478         { "RS_TimeStamp.Status", "pn_io.rs_time_stamp.status",
14479           FT_UINT16, BASE_HEX, VALS(pn_io_rs_time_stamp_status), 0x0003,
14480           NULL, HFILL }
14481     },
14482     { &hf_pn_io_rs_time_stamp_value,
14483         { "RS_TimeStamp.Value", "pn_io.rs_time_stamp.value",
14484           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
14485           NULL, HFILL }
14486     },
14487     { &hf_pn_io_rs_minus_error,
14488         { "RS_MinusError", "pn_io.rs_minus_error",
14489           FT_UINT16, BASE_HEX, NULL, 0x0,
14490           NULL, HFILL }
14491     },
14492     { &hf_pn_io_rs_plus_error,
14493         { "RS_PlusError", "pn_io.rs_plus_error",
14494           FT_UINT16, BASE_HEX, NULL, 0x0,
14495           NULL, HFILL }
14496     },
14497     { &hf_pn_io_rs_extension_block_type,
14498         { "RS_ExtensionBlockType", "pn_io.rs_extension_block_type",
14499           FT_UINT8, BASE_HEX, NULL, 0x0,
14500           NULL, HFILL }
14501     },
14502     { &hf_pn_io_rs_extension_block_length,
14503         { "RS_ExtensionBlockLength", "pn_io.rs_extension_block_length",
14504           FT_UINT8, BASE_HEX, NULL, 0x0,
14505           NULL, HFILL }
14506     },
14507     { &hf_pn_io_rs_reason_code,
14508         { "RS_ReasonCode", "pn_io.rs_reason_code",
14509           FT_UINT32, BASE_HEX, NULL, 0x0,
14510           NULL, HFILL }
14511     },
14512     { &hf_pn_io_rs_reason_code_reason,
14513         { "RS_ReasonCode.Reason", "pn_io.rs_reason_code.reason",
14514           FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_reason), 0x0000FFFF,
14515           NULL, HFILL }
14516     },
14517     { &hf_pn_io_rs_reason_code_detail,
14518         { "RS_ReasonCode.Detail", "pn_io.rs_reason_code.detail",
14519           FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_detail), 0xFFFF0000,
14520           NULL, HFILL }
14521     },
14522     { &hf_pn_io_rs_domain_identification,
14523         { "RS_DomainIdentification", "pn_io.rs_domain_identification",
14524           FT_BYTES, BASE_NONE, NULL, 0x0,
14525           NULL, HFILL }
14526     },
14527     { &hf_pn_io_rs_master_identification,
14528         { "RS_MasterIdentification", "pn_io.rs_master_identification",
14529           FT_BYTES, BASE_NONE, NULL, 0x0,
14530           NULL, HFILL }
14531     },
14532     { &hf_pn_io_soe_digital_input_current_value,
14533         { "SoE_DigitalInputCurrentValue", "pn_io.soe_digital_input_current_value",
14534           FT_UINT16, BASE_HEX, NULL, 0x0,
14535           NULL, HFILL }
14536     },
14537     { &hf_pn_io_soe_digital_input_current_value_value,
14538         { "SoE_DigitalInputCurrentValue.Value", "pn_io.soe_digital_input_current_value.value",
14539           FT_UINT16, BASE_HEX, VALS(pn_io_soe_digital_input_current_value_value), 0x0001,
14540           NULL, HFILL }
14541     },
14542     { &hf_pn_io_soe_digital_input_current_value_reserved,
14543         { "SoE_DigitalInputCurrentValue.Reserved", "pn_io.soe_digital_input_current_value.reserved",
14544           FT_UINT16, BASE_HEX, NULL, 0xFFFE,
14545           NULL, HFILL }
14546     },
14547     { &hf_pn_io_am_device_identification,
14548         { "AM_DeviceIdentification", "pn_io.am_device_identification",
14549           FT_UINT64, BASE_HEX, NULL, 0x0,
14550           NULL, HFILL }
14551     },
14552     { &hf_pn_io_am_device_identification_device_sub_id,
14553         { "AM_DeviceIdentification.DeviceSubID", "pn_io.am_device_identification.device_sub_id",
14554           FT_UINT64, BASE_HEX, NULL, 0x000000000000FFFF,
14555           NULL, HFILL }
14556     },
14557     { &hf_pn_io_am_device_identification_device_id,
14558         { "AM_DeviceIdentification.DeviceID", "pn_io.am_device_identification.device_id",
14559           FT_UINT64, BASE_HEX, NULL, 0x00000000FFFF0000,
14560           NULL, HFILL }
14561     },
14562     { &hf_pn_io_am_device_identification_vendor_id,
14563         { "AM_DeviceIdentification.VendorID", "pn_io.am_device_identification.vendor_id",
14564           FT_UINT64, BASE_HEX, NULL, 0x0000FFFF00000000,
14565           NULL, HFILL }
14566     },
14567     { &hf_pn_io_am_device_identification_organization,
14568         { "AM_DeviceIdentification.Organization", "pn_io.am_device_identification.organization",
14569           FT_UINT64, BASE_HEX, NULL, 0xFFFF000000000000,
14570           NULL, HFILL }
14571     },
14572     { &hf_pn_io_rs_adjust_info,
14573         { "RS Adjust Info", "pn_io.rs_adjust_info",
14574           FT_NONE, BASE_NONE, NULL, 0x0,
14575           NULL, HFILL }
14576     },
14577     { &hf_pn_io_soe_max_scan_delay,
14578         { "SoE_MaxScanDelay", "pn_io.soe_max_scan_delay",
14579           FT_UINT16, BASE_HEX, NULL, 0x0,
14580           NULL, HFILL }
14581     },
14582     { &hf_pn_io_soe_adjust_specifier,
14583         { "SoE_AdjustSpecifier", "pn_io.soe_adjust_specifier",
14584           FT_UINT8, BASE_HEX, NULL, 0x0,
14585           NULL, HFILL }
14586     },
14587     { &hf_pn_io_soe_adjust_specifier_reserved,
14588         { "SoE_AdjustSpecifier.Reserved", "pn_io.soe_adjust_specifier.reserved",
14589           FT_UINT8, BASE_HEX, NULL, 0x3F,
14590           NULL, HFILL }
14591     },
14592     { &hf_pn_io_soe_adjust_specifier_incident,
14593         { "SoE_AdjustSpecifier.Incident", "pn_io.soe_adjust_specifier.incident",
14594           FT_UINT8, BASE_HEX, VALS(pn_io_soe_adjust_specifier_incident), 0xC0,
14595           NULL, HFILL }
14596     },
14597     { &hf_pn_io_rs_properties,
14598         { "RSProperties", "pn_io.rs_properties",
14599           FT_UINT32, BASE_HEX, NULL, 0x0,
14600           NULL, HFILL }
14601     },
14602     { &hf_pn_io_rs_properties_alarm_transport,
14603         { "RSProperties", "pn_io.rs_properties",
14604           FT_UINT32, BASE_HEX, VALS(pn_io_rs_properties_alarm_transport), 0x00000001,
14605           NULL, HFILL }
14606     },
14607     { &hf_pn_io_rs_properties_reserved1,
14608         { "RSProperties.Reserved1", "pn_io.rs_properties.reserved1",
14609           FT_UINT32, BASE_HEX, NULL, 0x00FFFFFE,
14610           NULL, HFILL }
14611     },
14612     { &hf_pn_io_rs_properties_reserved2,
14613         { "RSProperties.Reserved2", "pn_io.rs_properties.reserved2",
14614           FT_UINT32, BASE_HEX, NULL, 0xFF000000,
14615           NULL, HFILL }
14616     },
14617     { &hf_pn_io_asset_management_info,
14618       { "Asset Management Info", "pn_io.asset_management_info",
14619         FT_NONE, BASE_NONE, NULL, 0x0,
14620         NULL, HFILL }
14621     },
14622     { &hf_pn_io_number_of_asset_management_info,
14623       { "AssetManagementInfo.NumberOfEntries", "pn_io.number_of_asset_management_info",
14624         FT_UINT16, BASE_DEC, NULL, 0x0,
14625         NULL, HFILL }
14626     },
14627     { &hf_pn_io_im_uniqueidentifier,
14628       { "IM_UniqueIdentifier", "pn_io.IM_UniqueIdentifier",
14629         FT_GUID, BASE_NONE, NULL, 0x0,
14630         NULL, HFILL }
14631     },
14632     { &hf_pn_io_am_location_structure,
14633       { "AM_Location.Structure", "pn_io.am_location.structure",
14634          FT_UINT8, BASE_HEX, VALS(pn_io_am_location_structure_vals), 0x0,
14635          NULL, HFILL }
14636     },
14637     { &hf_pn_io_am_location,
14638       { "AM_Location", "pn_io.am_location",
14639         FT_BYTES, BASE_NONE, NULL, 0,
14640         NULL, HFILL }
14641     },
14642     { &hf_pn_io_am_location_level_0,
14643       { "AM_Location Level 0", "pn_io.am_location.level_0",
14644         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14645         NULL, HFILL }
14646     },
14647     { &hf_pn_io_am_location_level_1,
14648       { "AM_Location Level 1", "pn_io.am_location.level_1",
14649         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14650         NULL, HFILL }
14651     },
14652     { &hf_pn_io_am_location_level_2,
14653       { "AM_Location Level 2", "pn_io.am_location.level_2",
14654         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14655         NULL, HFILL }
14656     },
14657     { &hf_pn_io_am_location_level_3,
14658       { "AM_Location Level 3", "pn_io.am_location.level_3",
14659         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14660         NULL, HFILL }
14661     },
14662     { &hf_pn_io_am_location_level_4,
14663       { "AM_Location Level 4", "pn_io.am_location.level_4",
14664         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14665         NULL, HFILL }
14666     },
14667     { &hf_pn_io_am_location_level_5,
14668       { "AM_Location Level 5", "pn_io.am_location.level_5",
14669         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14670         NULL, HFILL }
14671     },
14672     { &hf_pn_io_am_location_level_6,
14673       { "AM_Location Level 6", "pn_io.am_location.level_6",
14674         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14675         NULL, HFILL }
14676     },
14677     { &hf_pn_io_am_location_level_7,
14678       { "AM_Location Level 7", "pn_io.am_location.level_7",
14679         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14680         NULL, HFILL }
14681     },
14682     { &hf_pn_io_am_location_level_8,
14683       { "AM_Location Level 8", "pn_io.am_location.level_8",
14684         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14685         NULL, HFILL }
14686     },
14687     { &hf_pn_io_am_location_level_9,
14688       { "AM_Location Level 9", "pn_io.am_location.level_9",
14689         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14690         NULL, HFILL }
14691     },
14692     { &hf_pn_io_am_location_level_10,
14693       { "AM_Location Level 10", "pn_io.am_location.level_10",
14694         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14695         NULL, HFILL }
14696     },
14697     { &hf_pn_io_am_location_level_11,
14698       { "AM_Location Level 11", "pn_io.am_location.level_11",
14699         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0,
14700         NULL, HFILL }
14701     },
14702     { &hf_pn_io_am_location_reserved1,
14703       { "AM_Location.Reserved1", "pn_io.am_location.reserved1",
14704         FT_UINT8, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14705         NULL, HFILL }
14706     },
14707     { &hf_pn_io_am_location_reserved2,
14708       { "AM_Location.Reserved2", "pn_io.am_location.reserved2",
14709         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14710         NULL, HFILL }
14711     },
14712     { &hf_pn_io_am_location_reserved3,
14713       { "AM_Location.Reserved3", "pn_io.am_location.reserved3",
14714         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14715         NULL, HFILL }
14716     },
14717     { &hf_pn_io_am_location_reserved4,
14718       { "AM_Location.Reserved4", "pn_io.am_location.reserved4",
14719         FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0,
14720         NULL, HFILL }
14721     },
14722     { &hf_pn_io_am_location_beginslotnum,
14723       { "AM_Location.BeginSlotNumber", "pn_io.slot_nr",
14724         FT_UINT16, BASE_HEX, NULL, 0x0,
14725         NULL, HFILL }
14726     },
14727     { &hf_pn_io_am_location_beginsubslotnum,
14728       { "AM_Location.BeginSubSlotNumber", "pn_io.subslot_nr",
14729         FT_UINT16, BASE_HEX, NULL, 0x0,
14730         NULL, HFILL }
14731     },
14732     { &hf_pn_io_am_location_endslotnum,
14733       { "AM_Location.EndSlotNumber", "pn_io.slot_nr",
14734         FT_UINT16, BASE_HEX, NULL, 0x0,
14735         NULL, HFILL }
14736     },
14737     { &hf_pn_io_am_location_endsubslotnum,
14738       { "AM_Location.EndSubSlotNumber", "pn_io.subslot_nr",
14739         FT_UINT16, BASE_HEX, NULL, 0x0,
14740         NULL, HFILL }
14741     },
14742     { &hf_pn_io_am_software_revision,
14743       { "AM Software Revision", "pn_io.am_software_revision",
14744         FT_STRING, BASE_NONE, NULL, 0x0,
14745         NULL, HFILL }
14746     },
14747     { &hf_pn_io_am_hardware_revision,
14748       { "AM Hardware Revision", "pn_io.am_hardware_revision",
14749         FT_STRING, BASE_NONE, NULL, 0x0,
14750         NULL, HFILL }
14751     },
14752     { &hf_pn_io_am_type_identification,
14753       { "AM Type Identification", "pn_io.am_type_identification",
14754         FT_UINT16, BASE_HEX, NULL, 0x0,
14755         NULL, HFILL }
14756     },
14757     { &hf_pn_io_am_reserved,
14758       { "AM Reserved", "pn_io.am_reserved",
14759         FT_UINT16, BASE_HEX, NULL, 0x0,
14760         NULL, HFILL }
14761     },
14762     { &hf_pn_io_mau_type_extension,
14763     { "MAUTypeExtension", "pn_io.mau_type_extension",
14764         FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_mau_type_extension), 0x0,
14765         NULL, HFILL }
14766     },
14767     { &hf_pn_io_pe_operational_mode,
14768     { "PE_OperationalMode", "pn_io.pe_operationalmode",
14769        FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_pe_operational_mode), 0x0,
14770        NULL, HFILL }
14771     },
14772     };
14773 
14774     static gint *ett[] = {
14775         &ett_pn_io,
14776         &ett_pn_io_block,
14777         &ett_pn_io_block_header,
14778         &ett_pn_io_rtc,
14779         &ett_pn_io_rta,
14780         &ett_pn_io_pdu_type,
14781         &ett_pn_io_add_flags,
14782         &ett_pn_io_control_command,
14783         &ett_pn_io_ioxs,
14784         &ett_pn_io_api,
14785         &ett_pn_io_data_description,
14786         &ett_pn_io_module,
14787         &ett_pn_io_submodule,
14788         &ett_pn_io_io_data_object,
14789         &ett_pn_io_io_cs,
14790         &ett_pn_io_ar_properties,
14791         &ett_pn_io_iocr_properties,
14792         &ett_pn_io_submodule_properties,
14793         &ett_pn_io_alarmcr_properties,
14794         &ett_pn_io_submodule_state,
14795         &ett_pn_io_channel_properties,
14796         &ett_pn_io_slot,
14797         &ett_pn_io_subslot,
14798         &ett_pn_io_maintenance_status,
14799         &ett_pn_io_data_status,
14800         &ett_pn_io_iocr,
14801         &ett_pn_io_mrp_rtmode,
14802         &ett_pn_io_control_block_properties,
14803         &ett_pn_io_check_sync_mode,
14804         &ett_pn_io_ir_frame_data,
14805         &ett_pn_FrameDataProperties,
14806         &ett_pn_io_ar_info,
14807         &ett_pn_io_ar_data,
14808         &ett_pn_io_ir_begin_end_port,
14809         &ett_pn_io_ir_tx_phase,
14810         &ett_pn_io_ir_rx_phase,
14811         &ett_pn_io_subframe_data,
14812         &ett_pn_io_SFIOCRProperties,
14813         &ett_pn_io_frame_defails,
14814         &ett_pn_io_profisafe_f_parameter,
14815         &ett_pn_io_profisafe_f_parameter_prm_flag1,
14816         &ett_pn_io_profisafe_f_parameter_prm_flag2,
14817         &ett_pn_io_profidrive_parameter_request,
14818         &ett_pn_io_profidrive_parameter_response,
14819         &ett_pn_io_profidrive_parameter_address,
14820         &ett_pn_io_profidrive_parameter_value,
14821         &ett_pn_io_GroupProperties,
14822         &ett_pn_io_rs_alarm_info,
14823         &ett_pn_io_rs_event_info,
14824         &ett_pn_io_rs_event_block,
14825         &ett_pn_io_rs_adjust_block,
14826         &ett_pn_io_rs_event_data_extension,
14827         &ett_pn_io_rs_specifier,
14828         &ett_pn_io_rs_time_stamp,
14829         &ett_pn_io_am_device_identification,
14830         &ett_pn_io_rs_reason_code,
14831         &ett_pn_io_soe_digital_input_current_value,
14832         &ett_pn_io_rs_adjust_info,
14833         &ett_pn_io_soe_adjust_specifier,
14834         &ett_pn_io_asset_management_info,
14835         &ett_pn_io_asset_management_block,
14836         &ett_pn_io_am_location,
14837         &ett_pn_io_sr_properties,
14838         &ett_pn_io_line_delay,
14839         &ett_pn_io_counter_status,
14840         &ett_pn_io_dcp_boundary,
14841         &ett_pn_io_peer_to_peer_boundary,
14842         &ett_pn_io_mau_type_extension,
14843         &ett_pn_io_pe_operational_mode
14844     };
14845 
14846     static ei_register_info ei[] = {
14847         { &ei_pn_io_block_version, { "pn_io.block_version.not_implemented", PI_UNDECODED, PI_WARN, "Block version not implemented yet!", EXPFILL }},
14848         { &ei_pn_io_ar_info_not_found, { "pn_io.ar_info_not_found", PI_UNDECODED, PI_NOTE, "IODWriteReq: AR information not found!", EXPFILL }},
14849         { &ei_pn_io_block_length, { "pn_io.block_length.invalid", PI_UNDECODED, PI_WARN, "Block length invalid!", EXPFILL }},
14850         { &ei_pn_io_unsupported, { "pn_io.profidrive.parameter.format.invalid", PI_UNDECODED, PI_WARN, "Unknown Formatvalue", EXPFILL }},
14851         { &ei_pn_io_mrp_instances, { "pn_io.mrp_Number_MrpInstances.invalid", PI_UNDECODED, PI_WARN, "Number of MrpInstances invalid", EXPFILL }},
14852         { &ei_pn_io_frame_id, { "pn_io.frame_id.changed", PI_UNDECODED, PI_WARN, "FrameID changed", EXPFILL }},
14853         { &ei_pn_io_iocr_type, { "pn_io.iocr_type.unknown", PI_UNDECODED, PI_WARN, "IOCRType undecoded!", EXPFILL }},
14854         { &ei_pn_io_localalarmref, { "pn_io.localalarmref.changed", PI_UNDECODED, PI_WARN, "AlarmCRBlockReq: local alarm ref changed", EXPFILL }},
14855         { &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 }},
14856         { &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 }}
14857     };
14858 
14859     module_t *pnio_module;
14860     expert_module_t* expert_pn_io;
14861 
14862     proto_pn_io = proto_register_protocol ("PROFINET IO", "PNIO", "pn_io");
14863 
14864     /* Register by name */
14865     register_dissector("pnio", dissect_PNIO_heur, proto_pn_io);
14866 
14867     /* Created to remove Decode As confusion */
14868     proto_pn_io_device = proto_register_protocol_in_name_only("PROFINET IO (Device)", "PNIO (Device Interface)", "pn_io_device", proto_pn_io, FT_PROTOCOL);
14869     proto_pn_io_controller = proto_register_protocol_in_name_only("PROFINET IO (Controller)", "PNIO (Controller Interface)", "pn_io_controller", proto_pn_io, FT_PROTOCOL);
14870     proto_pn_io_supervisor = proto_register_protocol_in_name_only("PROFINET IO (Supervisor)", "PNIO (Supervisor Interface)", "pn_io_supervisor", proto_pn_io, FT_PROTOCOL);
14871     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);
14872     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);
14873     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);
14874 
14875     proto_register_field_array (proto_pn_io, hf, array_length (hf));
14876     proto_register_subtree_array (ett, array_length (ett));
14877     expert_pn_io = expert_register_protocol(proto_pn_io);
14878     expert_register_field_array(expert_pn_io, ei, array_length(ei));
14879 
14880     /* Register preferences */
14881     pnio_module = prefs_register_protocol(proto_pn_io, NULL);
14882     prefs_register_bool_preference(pnio_module, "pnio_ps_selection",
14883         "Enable detailed PROFIsafe dissection",
14884         "Whether the PNIO dissector is allowed to use detailed PROFIsafe dissection of cyclic data frames",
14885         &pnio_ps_selection);
14886     prefs_register_directory_preference(pnio_module, "pnio_ps_networkpath",
14887         "Configuration GSD-File Networkpath",                 /* Title */
14888         "Select your Networkpath to your GSD-Files.",         /* Descreption */
14889         &pnio_ps_networkpath);                                /* Variable to save the GSD-File networkpath */
14890 
14891     /* subdissector code */
14892     register_dissector("pn_io", dissect_PNIO_heur, proto_pn_io);
14893     heur_pn_subdissector_list = register_heur_dissector_list("pn_io", proto_pn_io);
14894 
14895     /* Initialise RTC1 dissection */
14896     init_pn_io_rtc1(proto_pn_io);
14897 
14898     /* Initialise RSI dissection */
14899     init_pn_rsi(proto_pn_io);
14900 
14901     /* Init functions of PNIO protocol */
14902     register_init_routine(pnio_setup);
14903 
14904     /* Cleanup functions of PNIO protocol */
14905     register_cleanup_routine(pnio_cleanup);
14906 
14907     register_conversation_filter("pn_io", "PN-IO AR", pn_io_ar_conv_valid, pn_io_ar_conv_filter);
14908     register_conversation_filter("pn_io", "PN-IO AR (with data)", pn_io_ar_conv_valid, pn_io_ar_conv_data_filter);
14909 }
14910 
14911 
14912 void
proto_reg_handoff_pn_io(void)14913 proto_reg_handoff_pn_io (void)
14914 {
14915     /* Register the protocols as dcerpc */
14916     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);
14917     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);
14918     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);
14919     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);
14920     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);
14921 
14922     heur_dissector_add("pn_rt", dissect_PNIO_heur, "PROFINET IO", "pn_io_pn_rt", proto_pn_io, HEURISTIC_ENABLE);
14923 }
14924 
14925 /*
14926  * Editor modelines
14927  *
14928  * Local Variables:
14929  * c-basic-offset: 4
14930  * tab-width: 8
14931  * indent-tabs-mode: nil
14932  * End:
14933  *
14934  * ex: set shiftwidth=4 tabstop=8 expandtab:
14935  * :indentSize=4:tabSize=8:noTabs=true:
14936  */
14937