MSWSP: add two more Property Sets
[wireshark-wip.git] / epan / dissectors / packet-cipsafety.c
blob6d3c93d63b0cc257245ffccc898a897166310730
1 /* packet-cipsafety.c
2 * Routines for CIP (Common Industrial Protocol) Safety dissection
3 * CIP Safety Home: www.odva.org
5 * Copyright 2011
6 * Michael Mann <mmann@pyramidsolutions.com>
8 * $Id$
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "config.h"
31 #include <epan/packet.h>
32 #include <epan/expert.h>
33 #include <wsutil/pint.h>
34 #include "packet-cip.h"
35 #include "packet-enip.h"
36 #include "packet-cipsafety.h"
39 void proto_register_cipsafety(void);
40 void proto_reg_handoff_cipsafety(void);
41 /* The entry point to the actual disection is: dissect_cipsafety */
43 /* Protocol handle for CIP Safety */
44 static int proto_cipsafety = -1;
45 static int proto_cip_class_s_supervisor = -1;
46 static int proto_cip_class_s_validator = -1;
47 static int proto_cip = -1;
49 static dissector_handle_t cip_class_s_validator_handle;
51 /* CIP Safety field identifiers */
52 static int hf_cipsafety_data = -1;
53 static int hf_cipsafety_mode_byte = -1;
54 static int hf_cipsafety_mode_byte_run_idle = -1;
55 static int hf_cipsafety_mode_byte_not_run_idle = -1;
56 static int hf_cipsafety_mode_byte_tbd_2_bit = -1;
57 static int hf_cipsafety_mode_byte_tbd_2_copy = -1;
58 static int hf_cipsafety_mode_byte_ping_count = -1;
59 static int hf_cipsafety_mode_byte_tbd = -1;
60 static int hf_cipsafety_mode_byte_not_tbd = -1;
61 static int hf_cipsafety_crc_s1 = -1;
62 static int hf_cipsafety_crc_s2 = -1;
63 static int hf_cipsafety_crc_s3 = -1;
64 static int hf_cipsafety_timestamp = -1;
65 static int hf_cipsafety_ack_byte = -1;
66 static int hf_cipsafety_ack_byte_ping_count_reply = -1;
67 static int hf_cipsafety_ack_byte_reserved1 = -1;
68 static int hf_cipsafety_ack_byte_ping_response = -1;
69 static int hf_cipsafety_ack_byte_reserved2 = -1;
70 static int hf_cipsafety_ack_byte_parity_even = -1;
71 static int hf_cipsafety_ack_byte2 = -1;
72 static int hf_cipsafety_consumer_time_value = -1;
73 static int hf_cipsafety_mcast_byte = -1;
74 static int hf_cipsafety_mcast_byte_consumer_num = -1;
75 static int hf_cipsafety_mcast_byte_reserved1 = -1;
76 static int hf_cipsafety_mcast_byte_mai = -1;
77 static int hf_cipsafety_mcast_byte_reserved2 = -1;
78 static int hf_cipsafety_mcast_byte_parity_even = -1;
79 static int hf_cipsafety_mcast_byte2 = -1;
80 static int hf_cipsafety_time_correction = -1;
81 static int hf_cipsafety_crc_s5_0 = -1;
82 static int hf_cipsafety_crc_s5_1 = -1;
83 static int hf_cipsafety_crc_s5_2 = -1;
84 static int hf_cipsafety_complement_data = -1;
86 /* CIP Safety header field identifiers */
87 static int hf_cip_reqrsp = -1;
88 static int hf_cip_data = -1;
90 /* Safety Supervisor header field identifiers */
91 static int hf_cip_ssupervisor_sc = -1;
92 static int hf_cip_ssupervisor_recover_data = -1;
93 static int hf_cip_ssupervisor_perform_diag_data = -1;
94 static int hf_cip_ssupervisor_configure_request_password = -1;
95 static int hf_cip_ssupervisor_configure_request_tunid = -1;
96 static int hf_cip_ssupervisor_configure_request_tunid_ssn_timestamp = -1;
97 static int hf_cip_ssupervisor_configure_request_tunid_ssn_date = -1;
98 static int hf_cip_ssupervisor_configure_request_tunid_ssn_time = -1;
99 static int hf_cip_ssupervisor_configure_request_tunid_macid = -1;
100 static int hf_cip_ssupervisor_configure_request_ounid = -1;
101 static int hf_cip_ssupervisor_configure_request_ounid_ssn_timestamp = -1;
102 static int hf_cip_ssupervisor_configure_request_ounid_ssn_date = -1;
103 static int hf_cip_ssupervisor_configure_request_ounid_ssn_time = -1;
104 static int hf_cip_ssupervisor_configure_request_ounid_macid = -1;
105 static int hf_cip_ssupervisor_validate_configuration_sccrc = -1;
106 static int hf_cip_ssupervisor_validate_configuration_scts_timestamp = -1;
107 static int hf_cip_ssupervisor_validate_configuration_scts_date = -1;
108 static int hf_cip_ssupervisor_validate_configuration_scts_time = -1;
109 static int hf_cip_ssupervisor_validate_configuration_ext_error = -1;
110 static int hf_cip_ssupervisor_set_password_current_password = -1;
111 static int hf_cip_ssupervisor_set_password_new_password = -1;
112 static int hf_cip_ssupervisor_configure_lock_value = -1;
113 static int hf_cip_ssupervisor_configure_lock_password = -1;
114 static int hf_cip_ssupervisor_configure_lock_tunid = -1;
115 static int hf_cip_ssupervisor_configure_lock_tunid_ssn_timestamp = -1;
116 static int hf_cip_ssupervisor_configure_lock_tunid_ssn_date = -1;
117 static int hf_cip_ssupervisor_configure_lock_tunid_ssn_time = -1;
118 static int hf_cip_ssupervisor_configure_lock_tunid_macid = -1;
119 static int hf_cip_ssupervisor_mode_change_value = -1;
120 static int hf_cip_ssupervisor_mode_change_password = -1;
121 static int hf_cip_ssupervisor_reset_type = -1;
122 static int hf_cip_ssupervisor_reset_password = -1;
123 static int hf_cip_ssupervisor_reset_tunid = -1;
124 static int hf_cip_ssupervisor_reset_tunid_tunid_ssn_timestamp = -1;
125 static int hf_cip_ssupervisor_reset_tunid_tunid_ssn_date = -1;
126 static int hf_cip_ssupervisor_reset_tunid_tunid_ssn_time = -1;
127 static int hf_cip_ssupervisor_reset_tunid_macid = -1;
128 static int hf_cip_ssupervisor_reset_attr_bitmap = -1;
129 static int hf_cip_ssupervisor_reset_attr_bitmap_macid = -1;
130 static int hf_cip_ssupervisor_reset_attr_bitmap_baudrate = -1;
131 static int hf_cip_ssupervisor_reset_attr_bitmap_tunid = -1;
132 static int hf_cip_ssupervisor_reset_attr_bitmap_password = -1;
133 static int hf_cip_ssupervisor_reset_attr_bitmap_cfunid = -1;
134 static int hf_cip_ssupervisor_reset_attr_bitmap_ocpunid = -1;
135 static int hf_cip_ssupervisor_reset_attr_bitmap_reserved = -1;
136 static int hf_cip_ssupervisor_reset_attr_bitmap_extended = -1;
137 static int hf_cip_ssupervisor_reset_password_data_size = -1;
138 static int hf_cip_ssupervisor_reset_password_data = -1;
139 static int hf_cip_ssupervisor_propose_tunid_tunid = -1;
140 static int hf_cip_ssupervisor_propose_tunid_tunid_ssn_timestamp = -1;
141 static int hf_cip_ssupervisor_propose_tunid_tunid_ssn_date = -1;
142 static int hf_cip_ssupervisor_propose_tunid_tunid_ssn_time = -1;
143 static int hf_cip_ssupervisor_propose_tunid_tunid_macid = -1;
144 static int hf_cip_ssupervisor_apply_tunid_tunid = -1;
145 static int hf_cip_ssupervisor_apply_tunid_tunid_ssn_timestamp = -1;
146 static int hf_cip_ssupervisor_apply_tunid_tunid_ssn_date = -1;
147 static int hf_cip_ssupervisor_apply_tunid_tunid_ssn_time = -1;
148 static int hf_cip_ssupervisor_apply_tunid_tunid_macid = -1;
150 static int hf_cip_ssupervisor_class_subclass = -1;
151 static int hf_cip_ssupervisor_num_attr = -1;
152 static int hf_cip_ssupervisor_attr_list = -1;
153 static int hf_cip_ssupervisor_manufacture_name = -1;
154 static int hf_cip_ssupervisor_manufacture_model_number = -1;
155 static int hf_cip_ssupervisor_sw_rev_level = -1;
156 static int hf_cip_ssupervisor_hw_rev_level = -1;
157 static int hf_cip_ssupervisor_manufacture_serial_number = -1;
158 static int hf_cip_ssupervisor_device_config = -1;
159 static int hf_cip_ssupervisor_device_status = -1;
160 static int hf_cip_ssupervisor_exception_status = -1;
161 static int hf_cip_ssupervisor_exception_detail_alarm_ced_size = -1;
162 static int hf_cip_ssupervisor_exception_detail_alarm_ced_detail = -1;
163 static int hf_cip_ssupervisor_exception_detail_alarm_ded_size = -1;
164 static int hf_cip_ssupervisor_exception_detail_alarm_ded_detail = -1;
165 static int hf_cip_ssupervisor_exception_detail_alarm_med_size = -1;
166 static int hf_cip_ssupervisor_exception_detail_alarm_med_detail = -1;
167 static int hf_cip_ssupervisor_exception_detail_warning_ced_size = -1;
168 static int hf_cip_ssupervisor_exception_detail_warning_ced_detail = -1;
169 static int hf_cip_ssupervisor_exception_detail_warning_ded_size = -1;
170 static int hf_cip_ssupervisor_exception_detail_warning_ded_detail = -1;
171 static int hf_cip_ssupervisor_exception_detail_warning_med_size = -1;
172 static int hf_cip_ssupervisor_exception_detail_warning_med_detail = -1;
173 static int hf_cip_ssupervisor_alarm_enable = -1;
174 static int hf_cip_ssupervisor_warning_enable = -1;
175 static int hf_cip_ssupervisor_time = -1;
176 static int hf_cip_ssupervisor_clock_power_cycle_behavior = -1;
177 static int hf_cip_ssupervisor_last_maintenance_date = -1;
178 static int hf_cip_ssupervisor_next_scheduled_maintenance_date = -1;
179 static int hf_cip_ssupervisor_scheduled_maintenance_expiration_timer = -1;
180 static int hf_cip_ssupervisor_scheduled_maintenance_expiration_warning_enable = -1;
181 static int hf_cip_ssupervisor_run_hours = -1;
182 static int hf_cip_ssupervisor_configuration_lock = -1;
183 static int hf_cip_ssupervisor_configuration_unid_ssn_timestamp = -1;
184 static int hf_cip_ssupervisor_configuration_unid_ssn_date = -1;
185 static int hf_cip_ssupervisor_configuration_unid_ssn_time = -1;
186 static int hf_cip_ssupervisor_configuration_unid_macid = -1;
187 static int hf_cip_ssupervisor_safety_configuration_id_ssn_timestamp = -1;
188 static int hf_cip_ssupervisor_safety_configuration_id_ssn_date = -1;
189 static int hf_cip_ssupervisor_safety_configuration_id_ssn_time = -1;
190 static int hf_cip_ssupervisor_safety_configuration_id_macid = -1;
191 static int hf_cip_ssupervisor_target_unid_ssn_timestamp = -1;
192 static int hf_cip_ssupervisor_target_unid_ssn_date = -1;
193 static int hf_cip_ssupervisor_target_unid_ssn_time = -1;
194 static int hf_cip_ssupervisor_target_unid_macid = -1;
195 static int hf_cip_ssupervisor_cp_owners_num_entries = -1;
196 static int hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_timestamp = -1;
197 static int hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_date = -1;
198 static int hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_time = -1;
199 static int hf_cip_ssupervisor_output_cp_owners_ocpunid_macid = -1;
200 static int hf_cip_ssupervisor_cp_owners_app_path_size = -1;
201 static int hf_cip_ssupervisor_proposed_tunid_ssn_timestamp = -1;
202 static int hf_cip_ssupervisor_proposed_tunid_ssn_date = -1;
203 static int hf_cip_ssupervisor_proposed_tunid_ssn_time = -1;
204 static int hf_cip_ssupervisor_proposed_tunid_macid = -1;
205 static int hf_cip_ssupervisor_instance_subclass = -1;
208 /* Safety Validator header field identifiers */
209 static int hf_cip_svalidator_sc = -1;
211 static int hf_cip_svalidator_sconn_fault_count = -1;
212 static int hf_cip_svalidator_state = -1;
213 static int hf_cip_svalidator_type = -1;
214 static int hf_cip_svalidator_type_pc = -1;
215 static int hf_cip_svalidator_type_conn_type = -1;
216 static int hf_cip_svalidator_ping_eri = -1;
217 static int hf_cip_svalidator_time_coord_msg_min_mult_size = -1;
218 static int hf_cip_svalidator_time_coord_msg_min_mult_item = -1;
219 static int hf_cip_svalidator_network_time_multiplier_size = -1;
220 static int hf_cip_svalidator_network_time_multiplier_item = -1;
221 static int hf_cip_svalidator_timeout_multiplier_size = -1;
222 static int hf_cip_svalidator_timeout_multiplier_item = -1;
223 static int hf_cip_svalidator_max_consumer_num = -1;
224 static int hf_cip_svalidator_data_conn_inst = -1;
225 static int hf_cip_svalidator_coordination_conn_inst_size = -1;
226 static int hf_cip_svalidator_coordination_conn_inst_item = -1;
227 static int hf_cip_svalidator_correction_conn_inst = -1;
228 static int hf_cip_svalidator_cco_binding = -1;
229 static int hf_cip_svalidator_max_data_age = -1;
230 static int hf_cip_svalidator_error_code = -1;
231 static int hf_cip_svalidator_prod_cons_fault_count_size = -1;
232 static int hf_cip_svalidator_prod_cons_fault_count_item = -1;
234 static int hf_cip_sercosiii_link_snn = -1;
235 static int hf_cip_sercosiii_link_communication_cycle_time = -1;
236 static int hf_cip_sercosiii_link_interface_status = -1;
237 static int hf_cip_sercosiii_link_error_count_mstps = -1;
238 static int hf_cip_sercosiii_link_sercos_address = -1;
239 static int hf_cip_sercosiii_link_error_count_p1 = -1;
240 static int hf_cip_sercosiii_link_error_count_p2 = -1;
242 static int hf_tcpip_snn_timestamp = -1;
243 static int hf_tcpip_snn_date = -1;
244 static int hf_tcpip_snn_time = -1;
246 /* Initialize the subtree pointers */
247 static gint ett_cip_safety = -1;
248 static gint ett_cipsafety_mode_byte = -1;
249 static gint ett_cipsafety_ack_byte = -1;
250 static gint ett_cipsafety_mcast_byte = -1;
252 static gint ett_cip_class_s_supervisor = -1;
253 static gint ett_ssupervisor_rrsc = -1;
254 static gint ett_ssupervisor_cmd_data = -1;
255 static gint ett_ssupervisor_propose_tunid = -1;
256 static gint ett_ssupervisor_propose_tunid_ssn = -1;
257 static gint ett_ssupervisor_configure_request_tunid = -1;
258 static gint ett_ssupervisor_configure_request_tunid_ssn = -1;
259 static gint ett_ssupervisor_configure_request_ounid = -1;
260 static gint ett_ssupervisor_configure_request_ounid_ssn = -1;
261 static gint ett_ssupervisor_configure_lock_tunid = -1;
262 static gint ett_ssupervisor_configure_lock_tunid_ssn = -1;
263 static gint ett_ssupervisor_reset_tunid = -1;
264 static gint ett_ssupervisor_reset_tunid_ssn = -1;
265 static gint ett_ssupervisor_apply_tunid = -1;
266 static gint ett_ssupervisor_apply_tunid_ssn = -1;
267 static gint ett_exception_detail_alarm_common = -1;
268 static gint ett_exception_detail_alarm_device = -1;
269 static gint ett_exception_detail_alarm_manufacturer = -1;
270 static gint ett_exception_detail_warning_common = -1;
271 static gint ett_exception_detail_warning_device = -1;
272 static gint ett_exception_detail_warning_manufacturer = -1;
273 static gint ett_ssupervisor_configuration_unid = -1;
274 static gint ett_ssupervisor_configuration_unid_ssn = -1;
275 static gint ett_ssupervisor_safety_configuration_id = -1;
276 static gint ett_ssupervisor_safety_configuration_id_ssn = -1;
277 static gint ett_ssupervisor_target_unid = -1;
278 static gint ett_ssupervisor_target_unid_ssn = -1;
279 static gint ett_ssupervisor_output_cp_owners = -1;
280 static gint ett_ssupervisor_output_cp_owners_ocpunid = -1;
281 static gint ett_ssupervisor_output_cp_owners_ocpunid_ssn = -1;
282 static gint ett_ssupervisor_proposed_tunid = -1;
283 static gint ett_ssupervisor_proposed_tunid_ssn = -1;
284 static gint ett_cip_ssupervisor_reset_attr_bitmap = -1;
286 static gint ett_cip_class_s_validator = -1;
287 static gint ett_svalidator_rrsc = -1;
288 static gint ett_svalidator_cmd_data = -1;
289 static gint ett_svalidator_type = -1;
291 static expert_field ei_cipsafety_tbd2_not_complemented = EI_INIT;
292 static expert_field ei_cipsafety_tbd_not_copied = EI_INIT;
293 static expert_field ei_cipsafety_run_idle_not_complemented = EI_INIT;
294 static expert_field ei_mal_io = EI_INIT;
295 static expert_field ei_mal_sercosiii_link_error_count_p1p2 = EI_INIT;
296 static expert_field ei_mal_tcpip_ssn = EI_INIT;
298 static expert_field ei_mal_ssupervisor_exception_detail_alarm_ced = EI_INIT;
299 static expert_field ei_mal_ssupervisor_exception_detail_alarm_ded = EI_INIT;
300 static expert_field ei_mal_ssupervisor_exception_detail_alarm_med = EI_INIT;
301 static expert_field ei_mal_ssupervisor_detail_warning_ced = EI_INIT;
302 static expert_field ei_mal_ssupervisor_detail_warning_ded = EI_INIT;
303 static expert_field ei_mal_ssupervisor_detail_warning_med = EI_INIT;
304 static expert_field ei_mal_ssupervisor_configuration_unid = EI_INIT;
305 static expert_field ei_mal_ssupervisor_safety_configuration_id = EI_INIT;
306 static expert_field ei_mal_ssupervisor_target_unid = EI_INIT;
307 static expert_field ei_mal_ssupervisor_cp_owners = EI_INIT;
308 static expert_field ei_mal_ssupervisor_cp_owners_entry = EI_INIT;
309 static expert_field ei_mal_ssupervisor_cp_owners_app_path_size = EI_INIT;
310 static expert_field ei_mal_ssupervisor_proposed_tunid = EI_INIT;
312 static expert_field ei_mal_svalidator_type = EI_INIT;
313 static expert_field ei_mal_svalidator_time_coord_msg_min_mult = EI_INIT;
314 static expert_field ei_mal_svalidator_network_time_multiplier = EI_INIT;
315 static expert_field ei_mal_svalidator_timeout_multiplier = EI_INIT;
316 static expert_field ei_mal_svalidator_coordination_conn_inst = EI_INIT;
317 static expert_field ei_mal_svalidator_prod_cons_fault_count = EI_INIT;
319 const value_string cipsafety_ssn_date_vals[8] = {
321 { 0, "NULL SSN" },
322 { 1, "Manual Setting - Backplane" },
323 { 2, "Manual Setting - ControlNet" },
324 { 4, "Manual Setting - EtherNet/IP" },
325 { 5, "Manual Setting - DeviceNet" },
326 { 6, "Manual Setting - SERCOS III" },
327 { 65535, "No SSN Set" },
329 { 0, NULL }
332 static const true_false_string cip_safety_vals_active_idle = {
333 "Idle",
334 "Active"
337 /* Translate function to string - CIP Service codes for Safety Supervisor */
338 static const value_string cip_sc_vals_ssupervisor[] = {
339 GENERIC_SC_LIST
341 /* Some class specific services */
342 { SC_SSUPER_RECOVER, "Recover" },
343 { SC_SSUPER_PERFORM_DIAGNOSTICS, "Perform Diagnostics" },
344 { SC_SSUPER_CONFIGURE_REQUEST, "Configure Request" },
345 { SC_SSUPER_VALIDATE_CONFIGURATION, "Validate Configuration" },
346 { SC_SSUPER_SET_PASSWORD, "Set Password" },
347 { SC_SSUPER_CONFIGURATION_LOCK, "Configuration (Un)Lock" },
348 { SC_SSUPER_MODE_CHANGE, "Mode Change" },
349 { SC_SSUPER_SAFETY_RESET, "Safety Reset" },
350 { SC_SSUPER_RESET_PASSWORD, "Reset Password" },
351 { SC_SSUPER_PROPOSE_TUNID, "Propose TUNID" },
352 { SC_SSUPER_APPLY_TUNID, "Apply TUNID" },
354 { 0, NULL }
357 #define SC_SVALID_RESET_ERROR 0x4B
359 /* Translate function to string - CIP Service codes for Safety Validator */
360 static const value_string cip_sc_vals_svalidator[] = {
361 GENERIC_SC_LIST
363 /* Some class specific services */
364 { SC_SVALID_RESET_ERROR, "Reset Error" },
366 { 0, NULL }
369 static const value_string cip_ssupervisor_validate_configuration_ext_error_vals[] = {
370 { 1, "CRC mismatch" },
371 { 2, "Invalid Configuration Parameter" },
372 { 3, "TUNID Not Set" },
374 { 0, NULL }
377 static const value_string cip_ssupervisor_lock_vals[] = {
378 { 0, "Unlocked" },
379 { 1, "Locked" },
381 { 0, NULL }
384 static const value_string cip_ssupervisor_change_mode_vals[] = {
385 { 0, "Idle" },
386 { 1, "Executing" },
388 { 0, NULL }
391 static const value_string cip_ssupervisor_device_status_type_vals[] = {
392 { 0, "Undefined" },
393 { 1, "Self-Testing" },
394 { 2, "Idle" },
395 { 3, "Self-Testing Exception" },
396 { 4, "Executing" },
397 { 5, "Abort" },
398 { 6, "Critical Fault" },
399 { 7, "Configuring" },
400 { 8, "Waiting for TUNID" },
402 { 0, NULL }
405 static const value_string cip_ssupervisor_clock_power_cycle_type_vals[] = {
406 { 0, "Clock always resets" },
407 { 1, "Clock in NVS at power down" },
408 { 2, "Clock is battery-backed" },
410 { 0, NULL }
413 static const value_string cip_svalidator_state_vals[] = {
414 { 0, "Unallocated" },
415 { 1, "Initializing" },
416 { 2, "Established" },
417 { 3, "Connection failed" },
419 { 0, NULL }
422 static const value_string cip_svalidator_type_pc_vals[] = {
423 { 0, "Producer" },
424 { 1, "Consumer" },
426 { 0, NULL }
429 static const value_string cip_svalidator_type_conn_type_vals[] = {
430 { 0, "Unallocated" },
431 { 1, "Single-cast" },
432 { 2, "Multi-cast" },
434 { 0, NULL }
437 void
438 dissect_unid(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_item *pi,
439 const char* ssn_name, int hf_ssn_timestamp,
440 int hf_ssn_date, int hf_ssn_time, int hf_macid, gint ett, gint ett_ssn)
442 proto_tree *tree, *ssn_tree;
443 proto_item *ssn_item;
445 tree = proto_item_add_subtree(pi, ett);
447 ssn_item = proto_tree_add_text(tree, tvb, offset, 6, "%s", ssn_name);
448 ssn_tree = proto_item_add_subtree(ssn_item, ett_ssn);
449 dissect_cipsafety_ssn(ssn_tree, tvb, pinfo, offset, hf_ssn_timestamp, hf_ssn_date, hf_ssn_time);
451 proto_tree_add_item(tree, hf_macid, tvb, offset+6, 4, ENC_LITTLE_ENDIAN);
454 void dissect_cipsafety_ssn(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int offset,
455 int hf_real_datetime, int hf_date, int hf_time)
457 guint16 date;
459 date = tvb_get_letohs( tvb, offset);
461 if ((date >= 11688) && (date <= 65534))
463 /* value is an actual timestamp */
464 dissect_cip_date_and_time(tree, tvb, offset, hf_real_datetime);
466 else
468 /* Treated as UINT16 and UINT32 values */
469 proto_tree_add_item(tree, hf_date, tvb, offset, 2, ENC_LITTLE_ENDIAN);
470 proto_tree_add_item(tree, hf_time, tvb, offset+2, 4, ENC_LITTLE_ENDIAN);
474 /************************************************
476 * Dissector for CIP Safety Supervisor Object
478 ************************************************/
479 static void
480 dissect_cip_s_supervisor_data( proto_tree *item_tree,
481 tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
483 proto_item *pi, *rrsc_item;
484 proto_tree *rrsc_tree, *cmd_data_tree, *bitmap_tree;
485 int req_path_size;
486 int temp_data;
487 guint8 service, gen_status, add_stat_size;
488 cip_req_info_t* preq_info;
489 cip_simple_request_info_t req_data;
491 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIPS Supervisor");
493 /* Add Service code & Request/Response tree */
494 service = tvb_get_guint8( tvb, offset );
495 rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
496 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_ssupervisor_rrsc );
498 /* Add Request/Response */
499 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
501 proto_item_append_text( rrsc_item, "%s (%s)",
502 val_to_str( ( service & 0x7F ), cip_sc_vals_ssupervisor , "Unknown Service (0x%02x)"),
503 val_to_str_const( ( service & 0x80 )>>7, cip_sc_rr, "") );
505 /* Add Service code */
506 proto_tree_add_item(rrsc_tree, hf_cip_ssupervisor_sc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
508 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
509 if ((preq_info != NULL) &&
510 (preq_info->ciaData != NULL))
512 memcpy(&req_data, preq_info->ciaData, sizeof(cip_simple_request_info_t));
514 else
516 req_data.iClass = (guint32)-1;
517 req_data.iInstance = (guint32)-1;
518 req_data.iAttribute = (guint32)-1;
519 req_data.iMember = (guint32)-1;
522 if(service & 0x80 )
524 /* Response message */
526 /* Add additional status size */
527 gen_status = tvb_get_guint8( tvb, offset+2 );
528 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
530 /* If there is any command specific data create a sub-tree for it */
531 if( ( item_length-4-add_stat_size ) != 0 )
533 pi = proto_tree_add_text( item_tree,
534 tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
535 cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
537 if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
539 switch (service & 0x7F)
541 case SC_SSUPER_VALIDATE_CONFIGURATION:
542 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_validate_configuration_sccrc,
543 tvb, offset+4+add_stat_size, 4, ENC_LITTLE_ENDIAN);
544 dissect_cipsafety_ssn(cmd_data_tree,
545 tvb, pinfo, offset+4+add_stat_size+4,
546 hf_cip_ssupervisor_validate_configuration_scts_timestamp,
547 hf_cip_ssupervisor_validate_configuration_scts_date,
548 hf_cip_ssupervisor_validate_configuration_scts_time);
549 break;
552 else if ((gen_status == 0xD0) && ((service & 0x7F) == SC_SSUPER_VALIDATE_CONFIGURATION))
554 if (add_stat_size > 0)
556 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_validate_configuration_ext_error,
557 tvb, offset+4, 2, ENC_LITTLE_ENDIAN);
560 else
562 /* Error responses */
564 /* Add data */
565 proto_tree_add_item(cmd_data_tree, hf_cip_data,
566 tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
570 } /* End of if reply */
571 else
573 /* Request message */
575 /* Add service to info column */
576 col_append_str( pinfo->cinfo, COL_INFO,
577 val_to_str( ( service & 0x7F ),
578 cip_sc_vals_ssupervisor , "Unknown Service (0x%02x)") );
579 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
581 /* If there is any command specific data create a sub-tree for it */
582 if( (item_length-req_path_size-2) != 0 )
584 pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
585 "Command Specific Data" );
586 cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
588 /* Check what service code that received */
589 switch (service)
591 case SC_SSUPER_RECOVER:
592 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_recover_data,
593 tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
594 break;
595 case SC_SSUPER_PERFORM_DIAGNOSTICS:
596 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_perform_diag_data,
597 tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
598 break;
599 case SC_SSUPER_CONFIGURE_REQUEST:
600 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_request_password,
601 tvb, offset+2+req_path_size, 16, ENC_NA);
602 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_request_tunid,
603 tvb, offset+2+req_path_size+16, 10, ENC_NA);
604 dissect_unid(tvb, pinfo, offset+2+req_path_size+16, pi, "TUNID SSN",
605 hf_cip_ssupervisor_configure_request_tunid_ssn_timestamp,
606 hf_cip_ssupervisor_configure_request_tunid_ssn_date,
607 hf_cip_ssupervisor_configure_request_tunid_ssn_time,
608 hf_cip_ssupervisor_configure_request_tunid_macid,
609 ett_ssupervisor_configure_request_tunid,
610 ett_ssupervisor_configure_request_tunid_ssn);
611 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_request_ounid,
612 tvb, offset+2+req_path_size+26, 10, ENC_NA);
613 dissect_unid(tvb, pinfo, offset+2+req_path_size+16, pi, "OUNID SSN",
614 hf_cip_ssupervisor_configure_request_ounid_ssn_timestamp,
615 hf_cip_ssupervisor_configure_request_ounid_ssn_date,
616 hf_cip_ssupervisor_configure_request_ounid_ssn_time,
617 hf_cip_ssupervisor_configure_request_ounid_macid,
618 ett_ssupervisor_configure_request_ounid,
619 ett_ssupervisor_configure_request_ounid_ssn);
620 break;
621 case SC_SSUPER_VALIDATE_CONFIGURATION:
622 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_validate_configuration_sccrc,
623 tvb, offset+2+req_path_size, 4, ENC_LITTLE_ENDIAN);
624 dissect_cipsafety_ssn(cmd_data_tree, tvb, pinfo, offset+2+req_path_size+4,
625 hf_cip_ssupervisor_validate_configuration_scts_timestamp,
626 hf_cip_ssupervisor_validate_configuration_scts_date,
627 hf_cip_ssupervisor_validate_configuration_scts_time);
628 break;
629 case SC_SSUPER_SET_PASSWORD:
630 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_set_password_current_password,
631 tvb, offset+2+req_path_size, 16, ENC_NA);
632 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_set_password_new_password,
633 tvb, offset+2+req_path_size+16, 16, ENC_NA);
634 break;
635 case SC_SSUPER_CONFIGURATION_LOCK:
636 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_lock_value,
637 tvb, offset+2+req_path_size+1, 1, ENC_LITTLE_ENDIAN);
638 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_lock_password,
639 tvb, offset+2+req_path_size+1, 16, ENC_NA);
640 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_configure_lock_tunid,
641 tvb, offset+2+req_path_size+17, 10, ENC_NA);
642 dissect_unid(tvb, pinfo, offset+2+req_path_size+17, pi, "TUNID SSN",
643 hf_cip_ssupervisor_configure_lock_tunid_ssn_timestamp,
644 hf_cip_ssupervisor_configure_lock_tunid_ssn_date,
645 hf_cip_ssupervisor_configure_lock_tunid_ssn_time,
646 hf_cip_ssupervisor_configure_lock_tunid_macid,
647 ett_ssupervisor_configure_lock_tunid,
648 ett_ssupervisor_configure_lock_tunid_ssn);
649 break;
650 case SC_SSUPER_MODE_CHANGE:
651 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_mode_change_value,
652 tvb, offset+2+req_path_size+1, 1, ENC_LITTLE_ENDIAN);
653 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_mode_change_password,
654 tvb, offset+2+req_path_size+1, 16, ENC_NA);
655 break;
656 case SC_SSUPER_SAFETY_RESET:
657 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_type,
658 tvb, offset+2+req_path_size+1, 1, ENC_LITTLE_ENDIAN);
659 temp_data = tvb_get_guint8( tvb, offset+2+req_path_size+1 );
660 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_password,
661 tvb, offset+2+req_path_size+1, 16, ENC_NA);
662 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_tunid,
663 tvb, offset+2+req_path_size+17, 10, ENC_NA);
664 dissect_unid(tvb, pinfo, offset+2+req_path_size+17, pi, "TUNID SSN",
665 hf_cip_ssupervisor_reset_tunid_tunid_ssn_timestamp,
666 hf_cip_ssupervisor_reset_tunid_tunid_ssn_date,
667 hf_cip_ssupervisor_reset_tunid_tunid_ssn_time,
668 hf_cip_ssupervisor_reset_tunid_macid,
669 ett_ssupervisor_reset_tunid,
670 ett_ssupervisor_reset_tunid_ssn);
671 /* Attribute bitmap only included on Reset Type 2 */
672 if (temp_data == 2)
674 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_attr_bitmap,
675 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
676 bitmap_tree = proto_item_add_subtree(pi, ett_cip_ssupervisor_reset_attr_bitmap);
677 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_macid,
678 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
679 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_baudrate,
680 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
681 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_tunid,
682 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
683 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_password,
684 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
685 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_cfunid,
686 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
687 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_ocpunid,
688 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
689 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_reserved,
690 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
691 proto_tree_add_item(bitmap_tree, hf_cip_ssupervisor_reset_attr_bitmap_extended,
692 tvb, offset+2+req_path_size+27, 1, ENC_LITTLE_ENDIAN);
694 break;
695 case SC_SSUPER_RESET_PASSWORD:
696 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_password_data_size,
697 tvb, offset+2+req_path_size, 1, ENC_LITTLE_ENDIAN);
698 temp_data = tvb_get_guint8(tvb, offset+2+req_path_size);
699 proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_reset_password_data,
700 tvb, offset+2+req_path_size+1, temp_data, ENC_NA);
701 break;
702 case SC_SSUPER_PROPOSE_TUNID:
703 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_propose_tunid_tunid,
704 tvb, offset+2+req_path_size, 10, ENC_NA);
705 dissect_unid(tvb, pinfo, offset+2+req_path_size, pi, "TUNID SSN",
706 hf_cip_ssupervisor_propose_tunid_tunid_ssn_timestamp,
707 hf_cip_ssupervisor_propose_tunid_tunid_ssn_date,
708 hf_cip_ssupervisor_propose_tunid_tunid_ssn_time,
709 hf_cip_ssupervisor_propose_tunid_tunid_macid,
710 ett_ssupervisor_propose_tunid,
711 ett_ssupervisor_propose_tunid_ssn);
712 break;
713 case SC_SSUPER_APPLY_TUNID:
714 pi = proto_tree_add_item(cmd_data_tree, hf_cip_ssupervisor_apply_tunid_tunid,
715 tvb, offset+2+req_path_size, 10, ENC_NA);
716 dissect_unid(tvb, pinfo, offset+2+req_path_size, pi, "TUNID SSN",
717 hf_cip_ssupervisor_apply_tunid_tunid_ssn_timestamp,
718 hf_cip_ssupervisor_apply_tunid_tunid_ssn_date,
719 hf_cip_ssupervisor_apply_tunid_tunid_ssn_time,
720 hf_cip_ssupervisor_apply_tunid_tunid_macid,
721 ett_ssupervisor_apply_tunid,
722 ett_ssupervisor_apply_tunid_ssn);
723 break;
724 default:
725 proto_tree_add_item(cmd_data_tree, hf_cip_data,
726 tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
729 } /* End of if command-specific data present */
731 } /* End of if-else( request ) */
735 static int
736 dissect_cip_class_s_supervisor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
738 proto_item *ti;
739 proto_tree *class_tree;
741 /* Create display subtree for the protocol */
742 ti = proto_tree_add_item(tree, proto_cip_class_s_supervisor, tvb, 0, -1, ENC_NA);
743 class_tree = proto_item_add_subtree( ti, ett_cip_class_s_supervisor );
745 dissect_cip_s_supervisor_data( class_tree, tvb, 0, tvb_length(tvb), pinfo );
747 return tvb_length(tvb);
750 static int dissect_s_supervisor_exception_detail(proto_tree *tree, proto_item *item, tvbuff_t *tvb, int offset, int hf_size, int hf_data)
752 int size;
754 proto_tree_add_item(tree, hf_size, tvb, offset, 1, ENC_LITTLE_ENDIAN );
755 size = tvb_get_guint8( tvb, offset);
756 proto_tree_add_item(tree, hf_data, tvb, offset+1, size, ENC_NA );
757 proto_item_set_len(item, size+1);
759 return size+1;
762 static int dissect_s_supervisor_exception_detail_alarm(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
763 int offset, int total_len)
765 proto_item *pi;
766 proto_tree *item_tree;
767 int total_size = 0, size;
769 pi = proto_tree_add_text(tree, tvb, offset, 1, "Common Exception Detail");
770 item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_common);
771 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
772 hf_cip_ssupervisor_exception_detail_alarm_ced_size,
773 hf_cip_ssupervisor_exception_detail_alarm_ced_detail);
774 if (size == 0)
776 expert_add_info(pinfo, item, &ei_mal_ssupervisor_exception_detail_alarm_ced);
777 return total_len;
779 total_size += size;
781 pi = proto_tree_add_text(tree, tvb, offset, 1, "Device Exception Detail");
782 item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_device);
783 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
784 hf_cip_ssupervisor_exception_detail_alarm_ded_size,
785 hf_cip_ssupervisor_exception_detail_alarm_ded_detail);
786 if (size == 0)
788 expert_add_info(pinfo, item, &ei_mal_ssupervisor_exception_detail_alarm_ded);
789 return total_len;
791 total_size += size;
793 pi = proto_tree_add_text(tree, tvb, offset, 1, "Manufacturer Exception Detail");
794 item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_manufacturer);
795 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
796 hf_cip_ssupervisor_exception_detail_alarm_med_size,
797 hf_cip_ssupervisor_exception_detail_alarm_med_detail);
798 if (size == 0)
800 expert_add_info(pinfo, item, &ei_mal_ssupervisor_exception_detail_alarm_med);
801 return total_len;
803 total_size += size;
805 return total_size;
808 static int dissect_s_supervisor_exception_detail_warning(packet_info *pinfo, proto_tree *tree, proto_item *item,
809 tvbuff_t *tvb, int offset, int total_len)
811 proto_item *pi;
812 proto_tree *item_tree;
813 int total_size = 0, size;
815 pi = proto_tree_add_text(tree, tvb, offset, 1, "Common Exception Detail");
816 item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_common);
817 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
818 hf_cip_ssupervisor_exception_detail_warning_ced_size,
819 hf_cip_ssupervisor_exception_detail_warning_ced_detail);
820 if (size == 0)
822 expert_add_info(pinfo, item, &ei_mal_ssupervisor_detail_warning_ced);
823 return total_len;
825 total_size += size;
827 pi = proto_tree_add_text(tree, tvb, offset, 1, "Device Exception Detail");
828 item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_device);
829 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
830 hf_cip_ssupervisor_exception_detail_warning_ded_size,
831 hf_cip_ssupervisor_exception_detail_warning_ded_detail);
832 if (size == 0)
834 expert_add_info(pinfo, item, &ei_mal_ssupervisor_detail_warning_ded);
835 return total_len;
837 total_size += size;
839 pi = proto_tree_add_text(tree, tvb, offset, 1, "Manufacturer Exception Detail");
840 item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_manufacturer);
841 size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
842 hf_cip_ssupervisor_exception_detail_warning_med_size,
843 hf_cip_ssupervisor_exception_detail_warning_med_detail);
844 if (size == 0)
846 expert_add_info(pinfo, item, &ei_mal_ssupervisor_detail_warning_med);
847 return total_len;
849 total_size += size;
851 return total_size;
854 static int dissect_s_supervisor_configuration_unid(packet_info *pinfo, proto_tree *tree _U_, proto_item *item,
855 tvbuff_t *tvb, int offset, int total_len)
857 if (total_len < 10)
859 expert_add_info(pinfo, item, &ei_mal_ssupervisor_configuration_unid);
860 return total_len;
863 dissect_unid(tvb, pinfo, offset, item, "CFUNID SSN",
864 hf_cip_ssupervisor_configuration_unid_ssn_timestamp,
865 hf_cip_ssupervisor_configuration_unid_ssn_date,
866 hf_cip_ssupervisor_configuration_unid_ssn_time,
867 hf_cip_ssupervisor_configuration_unid_macid,
868 ett_ssupervisor_configuration_unid,
869 ett_ssupervisor_configuration_unid_ssn);
870 return 10;
873 static int dissect_s_supervisor_safety_configuration_id(packet_info *pinfo, proto_tree *tree _U_, proto_item *item,
874 tvbuff_t *tvb, int offset, int total_len)
876 if (total_len < 10)
878 expert_add_info(pinfo, item, &ei_mal_ssupervisor_safety_configuration_id);
879 return total_len;
882 dissect_unid(tvb, pinfo, offset, item, "SCID SSN",
883 hf_cip_ssupervisor_safety_configuration_id_ssn_timestamp,
884 hf_cip_ssupervisor_safety_configuration_id_ssn_date,
885 hf_cip_ssupervisor_safety_configuration_id_ssn_time,
886 hf_cip_ssupervisor_safety_configuration_id_macid,
887 ett_ssupervisor_safety_configuration_id,
888 ett_ssupervisor_safety_configuration_id_ssn);
889 return 10;
892 static int dissect_s_supervisor_target_unid(packet_info *pinfo, proto_tree *tree _U_, proto_item *item,
893 tvbuff_t *tvb, int offset, int total_len)
895 if (total_len < 10)
897 expert_add_info(pinfo, item, &ei_mal_ssupervisor_target_unid);
898 return total_len;
901 dissect_unid(tvb, pinfo, offset, item, "TUNID SSN",
902 hf_cip_ssupervisor_target_unid_ssn_timestamp,
903 hf_cip_ssupervisor_target_unid_ssn_date,
904 hf_cip_ssupervisor_target_unid_ssn_time,
905 hf_cip_ssupervisor_target_unid_macid,
906 ett_ssupervisor_target_unid,
907 ett_ssupervisor_target_unid_ssn);
908 return 10;
911 static int dissect_s_supervisor_output_connection_point_owners(packet_info *pinfo, proto_tree *tree, proto_item *item,
912 tvbuff_t *tvb, int offset, int total_len)
914 guint16 i, num_entries;
915 proto_item *entry_item, *app_path_item;
916 proto_tree *entry_tree;
917 int attr_len = 0, app_path_size;
919 if (total_len < 2)
921 expert_add_info(pinfo, item, &ei_mal_ssupervisor_cp_owners);
922 return total_len;
925 entry_item = proto_tree_add_item(tree, hf_cip_ssupervisor_cp_owners_num_entries,
926 tvb, offset, 2, ENC_LITTLE_ENDIAN );
927 num_entries = tvb_get_letohs(tvb, offset);
928 attr_len += 2;
930 if (num_entries > 0)
932 entry_tree = proto_item_add_subtree(entry_item, ett_ssupervisor_output_cp_owners);
934 for (i = 0; i < num_entries; i++)
936 if (total_len < attr_len+11)
938 expert_add_info(pinfo, item, &ei_mal_ssupervisor_cp_owners_entry);
939 return total_len;
942 dissect_unid(tvb, pinfo, offset+attr_len, entry_item, "OCPUNID SSN",
943 hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_timestamp,
944 hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_date,
945 hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_time,
946 hf_cip_ssupervisor_output_cp_owners_ocpunid_macid,
947 ett_ssupervisor_output_cp_owners_ocpunid,
948 ett_ssupervisor_output_cp_owners_ocpunid_ssn);
949 attr_len += 10;
951 proto_tree_add_item(entry_tree, hf_cip_ssupervisor_cp_owners_app_path_size,
952 tvb, offset+attr_len, 1, ENC_LITTLE_ENDIAN );
953 app_path_size = tvb_get_guint8( tvb, offset+attr_len);
954 attr_len += 1;
956 if (total_len < attr_len+app_path_size)
958 expert_add_info(pinfo, item, &ei_mal_ssupervisor_cp_owners_app_path_size);
959 return total_len;
962 app_path_item = proto_tree_add_text(entry_tree,
963 tvb, offset+attr_len, app_path_size, "Application Resource: ");
964 dissect_epath( tvb, pinfo, app_path_item, offset+attr_len, app_path_size, FALSE, TRUE, NULL, NULL);
965 attr_len += app_path_size;
969 return attr_len;
972 static int dissect_s_supervisor_proposed_tunid(packet_info *pinfo, proto_tree *tree _U_, proto_item *item,
973 tvbuff_t *tvb, int offset, int total_len)
975 if (total_len < 10)
977 expert_add_info(pinfo, item, &ei_mal_ssupervisor_proposed_tunid);
978 return total_len;
981 dissect_unid(tvb, pinfo, offset, item, "Proposed TUNID SSN",
982 hf_cip_ssupervisor_proposed_tunid_ssn_timestamp,
983 hf_cip_ssupervisor_proposed_tunid_ssn_date,
984 hf_cip_ssupervisor_proposed_tunid_ssn_time,
985 hf_cip_ssupervisor_proposed_tunid_macid,
986 ett_ssupervisor_proposed_tunid,
987 ett_ssupervisor_proposed_tunid_ssn);
988 return 10;
991 /************************************************
993 * Dissector for CIP Safety Validator Object
995 ************************************************/
996 static int dissect_s_validator_type(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
997 int offset, int total_len)
999 proto_item *pi;
1000 proto_tree *item_tree;
1002 if (total_len < 1)
1004 expert_add_info(pinfo, item, &ei_mal_svalidator_type);
1005 return total_len;
1008 pi = proto_tree_add_item(tree, hf_cip_svalidator_type, tvb, offset, 1, ENC_LITTLE_ENDIAN );
1009 item_tree = proto_item_add_subtree(pi, ett_svalidator_type);
1010 proto_tree_add_item(item_tree, hf_cip_svalidator_type_pc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
1011 proto_tree_add_item(item_tree, hf_cip_svalidator_type_conn_type, tvb, offset, 1, ENC_LITTLE_ENDIAN );
1012 return 1;
1015 static int dissect_s_validator_time_coord_msg_min_mult(packet_info *pinfo, proto_tree *tree, proto_item *item,
1016 tvbuff_t *tvb, int offset, int total_len)
1018 int i, size;
1020 proto_tree_add_item(tree, hf_cip_svalidator_time_coord_msg_min_mult_size,
1021 tvb, offset, 1, ENC_LITTLE_ENDIAN );
1022 size = tvb_get_guint8( tvb, offset )*2;
1024 if (total_len < size+1)
1026 expert_add_info(pinfo, item, &ei_mal_svalidator_time_coord_msg_min_mult);
1027 return total_len;
1030 for (i = 0; i < size; i+=2)
1032 proto_tree_add_item(tree, hf_cip_svalidator_time_coord_msg_min_mult_item,
1033 tvb, offset+1+i, 2, ENC_LITTLE_ENDIAN );
1036 return (size+1);
1039 static int dissect_s_validator_network_time_multiplier(packet_info *pinfo, proto_tree *tree, proto_item *item,
1040 tvbuff_t *tvb, int offset, int total_len)
1042 int i, size;
1044 proto_tree_add_item(tree, hf_cip_svalidator_network_time_multiplier_size,
1045 tvb, offset, 1, ENC_LITTLE_ENDIAN );
1046 size = tvb_get_guint8( tvb, offset )*2;
1048 if (total_len < size+1)
1050 expert_add_info(pinfo, item, &ei_mal_svalidator_network_time_multiplier);
1051 return total_len;
1054 for (i = 0; i < size; i+=2)
1056 proto_tree_add_item(tree, hf_cip_svalidator_network_time_multiplier_item,
1057 tvb, offset+1+i, 2, ENC_LITTLE_ENDIAN );
1060 return (size+1);
1063 static int dissect_s_validator_timeout_multiplier(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
1064 int offset, int total_len)
1066 int i, size;
1068 proto_tree_add_item(tree, hf_cip_svalidator_timeout_multiplier_size,
1069 tvb, offset, 1, ENC_LITTLE_ENDIAN );
1070 size = tvb_get_guint8( tvb, offset );
1072 if (total_len < size+1)
1074 expert_add_info(pinfo, item, &ei_mal_svalidator_timeout_multiplier);
1075 return total_len;
1078 for (i = 0; i < size; i++)
1080 proto_tree_add_item(tree, hf_cip_svalidator_timeout_multiplier_item,
1081 tvb, offset+1+i, 1, ENC_LITTLE_ENDIAN );
1084 return (size+1);
1087 static int dissect_s_validator_coordination_conn_inst(packet_info *pinfo, proto_tree *tree, proto_item *item,
1088 tvbuff_t *tvb, int offset, int total_len)
1090 int i, size;
1092 proto_tree_add_item(tree, hf_cip_svalidator_coordination_conn_inst_size,
1093 tvb, offset, 1, ENC_LITTLE_ENDIAN );
1094 size = tvb_get_guint8( tvb, offset )*2;
1096 if (total_len < size+1)
1098 expert_add_info(pinfo, item, &ei_mal_svalidator_coordination_conn_inst);
1099 return total_len;
1102 for (i = 0; i < size; i+=2)
1104 proto_tree_add_item(tree, hf_cip_svalidator_coordination_conn_inst_item,
1105 tvb, offset+1+i, 2, ENC_LITTLE_ENDIAN );
1108 return (size+1);
1111 static int dissect_s_validator_app_data_path(packet_info *pinfo, proto_tree *tree _U_,
1112 proto_item *item, tvbuff_t *tvb, int offset, int total_len)
1114 dissect_epath(tvb, pinfo, item, offset, total_len, FALSE, FALSE, NULL, NULL);
1115 return total_len;
1118 static int dissect_s_validator_prod_cons_fault_count(packet_info *pinfo, proto_tree *tree, proto_item *item,
1119 tvbuff_t *tvb, int offset, int total_len)
1121 int i, size;
1123 proto_tree_add_item(tree, hf_cip_svalidator_prod_cons_fault_count_size,
1124 tvb, offset, 1, ENC_LITTLE_ENDIAN );
1125 size = tvb_get_guint8( tvb, offset );
1127 if (total_len < size+1)
1129 expert_add_info(pinfo, item, &ei_mal_svalidator_prod_cons_fault_count);
1130 return total_len;
1133 for (i = 0; i < size; i++)
1135 proto_tree_add_item(tree, hf_cip_svalidator_prod_cons_fault_count_item,
1136 tvb, offset+1+i, 1, ENC_LITTLE_ENDIAN );
1139 return (size+1);
1142 static void
1143 dissect_cip_s_validator_data( proto_tree *item_tree,
1144 tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
1146 proto_item *pi, *rrsc_item;
1147 proto_tree *rrsc_tree, *cmd_data_tree;
1148 int req_path_size, gaa_offset;
1149 guint8 service, gen_status, add_stat_size;
1150 cip_req_info_t* preq_info;
1151 cip_simple_request_info_t req_data;
1153 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIPS Supervisor");
1155 /* Add Service code & Request/Response tree */
1156 service = tvb_get_guint8( tvb, offset );
1157 rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
1158 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_svalidator_rrsc );
1160 /* Add Request/Response */
1161 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
1163 proto_item_append_text( rrsc_item, "%s (%s)",
1164 val_to_str( ( service & 0x7F ),
1165 cip_sc_vals_svalidator , "Unknown Service (0x%02x)"),
1166 val_to_str_const( ( service & 0x80 )>>7,
1167 cip_sc_rr, "") );
1169 /* Add Service code */
1170 proto_tree_add_item(rrsc_tree, hf_cip_svalidator_sc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
1172 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
1173 if ((preq_info != NULL) &&
1174 (preq_info->ciaData != NULL))
1176 memcpy(&req_data, preq_info->ciaData, sizeof(cip_simple_request_info_t));
1178 else
1180 req_data.iClass = (guint32)-1;
1181 req_data.iInstance = (guint32)-1;
1182 req_data.iAttribute = (guint32)-1;
1183 req_data.iMember = (guint32)-1;
1186 if(service & 0x80 )
1188 /* Response message */
1190 /* Add additional status size */
1191 gen_status = tvb_get_guint8( tvb, offset+2 );
1192 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
1194 /* If there is any command specific data create a sub-tree for it */
1195 if( ( item_length-4-add_stat_size ) != 0 )
1197 pi = proto_tree_add_text( item_tree,
1198 tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
1199 cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
1201 if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
1203 /* Success responses */
1204 if (((service & 0x7F) == SC_GET_ATT_ALL) &&
1205 (req_data.iInstance != (guint32)-1) &&
1206 (req_data.iInstance != 0))
1208 /* Get Attribute All (instance) response */
1209 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_state,
1210 tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN );
1211 gaa_offset = 1;
1212 gaa_offset += dissect_s_validator_type(pinfo, cmd_data_tree, pi,
1213 tvb, offset+4+add_stat_size+gaa_offset, 1);
1214 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_ping_eri,
1215 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1216 gaa_offset += 2;
1217 gaa_offset += dissect_s_validator_time_coord_msg_min_mult(pinfo, cmd_data_tree, pi,
1218 tvb, offset+4+add_stat_size+gaa_offset,
1219 item_length-4-add_stat_size-gaa_offset);
1220 gaa_offset += dissect_s_validator_timeout_multiplier(pinfo, cmd_data_tree, pi,
1221 tvb, offset+4+add_stat_size+gaa_offset,
1222 item_length-4-add_stat_size-gaa_offset);
1223 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_max_consumer_num,
1224 tvb, offset+4+add_stat_size+gaa_offset, 1, ENC_LITTLE_ENDIAN );
1225 gaa_offset += 1;
1226 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_data_conn_inst,
1227 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1228 gaa_offset += 2;
1229 gaa_offset += dissect_s_validator_coordination_conn_inst(pinfo, cmd_data_tree, pi,
1230 tvb, offset+4+add_stat_size+gaa_offset,
1231 item_length-4-add_stat_size-gaa_offset);
1232 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_correction_conn_inst,
1233 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1234 gaa_offset += 2;
1235 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_cco_binding,
1236 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1237 gaa_offset += 2;
1238 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_max_data_age,
1239 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1240 gaa_offset += 2;
1241 gaa_offset += dissect_s_validator_app_data_path(pinfo, cmd_data_tree, pi,
1242 tvb, offset+4+add_stat_size+gaa_offset,
1243 item_length-4-add_stat_size-gaa_offset);
1244 proto_tree_add_item(cmd_data_tree, hf_cip_svalidator_error_code,
1245 tvb, offset+4+add_stat_size+gaa_offset, 2, ENC_LITTLE_ENDIAN );
1246 gaa_offset += 2;
1247 /*gaa_offset +=*/ dissect_s_validator_prod_cons_fault_count(pinfo, cmd_data_tree, pi,
1248 tvb, offset+4+add_stat_size+gaa_offset,
1249 item_length-4-add_stat_size-gaa_offset);
1251 else
1253 /* Add data */
1254 proto_tree_add_item(cmd_data_tree, hf_cip_data,
1255 tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
1258 else
1260 /* Error responses */
1262 /* Add data */
1263 proto_tree_add_item(cmd_data_tree, hf_cip_data,
1264 tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
1265 } /* end of if-else( CI_CRC_SUCCESS ) */
1267 } /* End of if command-specific data present */
1269 } /* End of if reply */
1270 else
1272 /* Request message */
1274 /* Add service to info column */
1275 col_append_str( pinfo->cinfo, COL_INFO,
1276 val_to_str( ( service & 0x7F ),
1277 cip_sc_vals_svalidator , "Unknown Service (0x%02x)") );
1278 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
1280 /* If there is any command specific data create a sub-tree for it */
1281 if( (item_length-req_path_size-2) != 0 )
1283 pi = proto_tree_add_text( item_tree,
1284 tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
1285 cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
1286 proto_tree_add_item(cmd_data_tree, hf_cip_data,
1287 tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
1294 static int
1295 dissect_cip_class_s_validator(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1297 proto_item *ti;
1298 proto_tree *class_tree;
1300 /* Create display subtree for the protocol */
1301 ti = proto_tree_add_item(tree, proto_cip_class_s_validator, tvb, 0, -1, ENC_NA);
1302 class_tree = proto_item_add_subtree( ti, ett_cip_class_s_validator );
1304 dissect_cip_s_validator_data( class_tree, tvb, 0, tvb_length(tvb), pinfo );
1306 return tvb_length(tvb);
1309 static gboolean
1310 dissect_class_svalidator_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1312 unsigned char service, service_code, ioilen, segment;
1313 cip_req_info_t* preq_info;
1314 guint32 classid = 0;
1315 int offset = 0;
1317 service = tvb_get_guint8( tvb, offset );
1318 service_code = service & 0x7F;
1320 /* Handle GetAttributeAll and SetAttributeAll in CCO class */
1321 if (service_code == SC_GET_ATT_ALL)
1323 if (service & 0x80)
1325 /* Service response */
1326 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
1327 if ((preq_info != NULL) &&
1328 (preq_info->dissector == dissector_get_uint_handle( subdissector_class_table, CI_CLS_SAFETY_VALIDATOR)))
1330 call_dissector(preq_info->dissector, tvb, pinfo, tree);
1331 return TRUE;
1334 else
1336 /* Service request */
1337 ioilen = tvb_get_guint8( tvb, offset + 1 );
1338 if (ioilen > 1)
1340 segment = tvb_get_guint8( tvb, offset + 2 );
1341 if (((segment & CI_SEGMENT_TYPE_MASK) == CI_LOGICAL_SEGMENT) &&
1342 ((segment & CI_LOGICAL_SEG_TYPE_MASK) == CI_LOGICAL_SEG_CLASS_ID))
1344 /* Logical Class ID, do a format check */
1345 switch ( segment & CI_LOGICAL_SEG_FORMAT_MASK )
1347 case CI_LOGICAL_SEG_8_BIT:
1348 classid = tvb_get_guint8( tvb, offset + 3 );
1349 break;
1350 case CI_LOGICAL_SEG_16_BIT:
1351 if ( ioilen >= 2 )
1352 classid = tvb_get_letohs( tvb, offset + 4 );
1353 break;
1354 case CI_LOGICAL_SEG_32_BIT:
1355 if ( ioilen >= 3 )
1356 classid = tvb_get_letohl( tvb, offset + 4 );
1357 break;
1362 if (classid == CI_CLS_SAFETY_VALIDATOR)
1364 call_dissector(cip_class_s_validator_handle, tvb, pinfo, tree );
1365 return TRUE;
1371 return FALSE;
1374 /************************************************
1376 * Dissector for CIP Safety I/O Data
1378 ************************************************/
1379 static void
1380 dissect_mode_byte( proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
1382 proto_item *mode_item, *run_idle_item, *tbd_item, *tbd2_item;
1383 proto_tree *mode_tree;
1384 guint8 mode_byte;
1386 mode_byte = tvb_get_guint8(tvb, offset);
1388 /* dissect Mode Byte bits */
1389 mode_item = proto_tree_add_item(tree, hf_cipsafety_mode_byte, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1390 mode_tree = proto_item_add_subtree( mode_item, ett_cipsafety_mode_byte);
1392 proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_ping_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1393 proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_not_tbd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1394 proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_tbd_2_copy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1395 proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_not_run_idle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1396 tbd_item = proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_tbd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1397 tbd2_item = proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_tbd_2_bit, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1398 run_idle_item = proto_tree_add_item(mode_tree, hf_cipsafety_mode_byte_run_idle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1400 /* verify Mode Byte bits */
1401 /* TBD */
1402 if ((((mode_byte & 0x20) >> 5) & 0x01) == (((mode_byte & 0x04) >> 2) & 0x01))
1403 expert_add_info(pinfo, tbd_item, &ei_cipsafety_tbd2_not_complemented);
1405 /* TBD 2 */
1406 if ((((mode_byte & 0x40) >> 6) & 0x01) != (((mode_byte & 0x08) >> 3) & 0x01))
1407 expert_add_info(pinfo, tbd2_item, &ei_cipsafety_tbd_not_copied);
1409 /* Run/Idle */
1410 if ((((mode_byte & 0x80) >> 7) & 0x01) == (((mode_byte & 0x10) >> 4) & 0x01))
1411 expert_add_info(pinfo, run_idle_item, &ei_cipsafety_run_idle_not_complemented);
1414 static void
1415 dissect_ack_byte( proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo _U_)
1417 proto_item *ack_item;
1418 proto_tree *ack_tree;
1419 #if 0 /***** Placeholder reminder to add ack_byte validation */
1420 guint8 ack_byte;
1422 ack_byte = tvb_get_guint8(tvb, offset);
1423 #endif
1424 if (!tree)
1425 return;
1427 /* dissect Ack Byte bits */
1428 ack_item = proto_tree_add_item(tree, hf_cipsafety_ack_byte, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1429 ack_tree = proto_item_add_subtree( ack_item, ett_cipsafety_ack_byte);
1431 proto_tree_add_item(ack_tree, hf_cipsafety_ack_byte_ping_count_reply, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1432 proto_tree_add_item(ack_tree, hf_cipsafety_ack_byte_reserved1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1433 proto_tree_add_item(ack_tree, hf_cipsafety_ack_byte_ping_response, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1434 proto_tree_add_item(ack_tree, hf_cipsafety_ack_byte_reserved2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1435 proto_tree_add_item(ack_tree, hf_cipsafety_ack_byte_parity_even, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1438 static void
1439 dissect_mcast_byte( proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo _U_)
1441 proto_item *mcast_item;
1442 proto_tree *mcast_tree;
1443 #if 0 /*** Placeholder reminder to add mcast_byte validation */
1444 guint8 mcast_byte;
1446 mcast_byte = tvb_get_guint8(tvb, offset);
1447 #endif
1448 /* dissect MCast Byte bits */
1449 mcast_item = proto_tree_add_item(tree, hf_cipsafety_mcast_byte, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1450 mcast_tree = proto_item_add_subtree( mcast_item, ett_cipsafety_mcast_byte);
1452 proto_tree_add_item(mcast_tree, hf_cipsafety_mcast_byte_consumer_num, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1453 proto_tree_add_item(mcast_tree, hf_cipsafety_mcast_byte_reserved1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1454 proto_tree_add_item(mcast_tree, hf_cipsafety_mcast_byte_mai, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1455 proto_tree_add_item(mcast_tree, hf_cipsafety_mcast_byte_reserved2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1456 proto_tree_add_item(mcast_tree, hf_cipsafety_mcast_byte_parity_even, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1459 static void
1460 dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int item_length, packet_info *pinfo)
1462 int base_length, io_data_size;
1463 gboolean multicast = (((pntohl(pinfo->dst.data)) & 0xf0000000) == 0xe0000000);
1464 gboolean server_dir = FALSE;
1465 enum enip_connid_type conn_type = ECIDT_UNKNOWN;
1466 enum cip_safety_format_type format = CIP_SAFETY_BASE_FORMAT;
1467 cip_safety_info_t* safety_info = (cip_safety_info_t*)p_get_proto_data( pinfo->fd, proto_cipsafety, 0 );
1469 /* Make entries in Protocol column and Info column on summary display */
1470 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP Safety");
1472 /* determine the connection type as it affects the fields dissected */
1473 if (safety_info != NULL)
1475 conn_type = safety_info->conn_type;
1476 format = safety_info->format;
1477 server_dir = safety_info->server_dir;
1480 /* compute the base packet length to determine what is actual I/O data */
1481 base_length = multicast ? 12 : 6;
1483 if (((conn_type == ECIDT_O2T) && (server_dir == FALSE)) ||
1484 ((conn_type == ECIDT_T2O) && (server_dir == TRUE)))
1486 /* consumer data */
1487 dissect_ack_byte(tree, tvb, 0, pinfo);
1488 proto_tree_add_item(tree, hf_cipsafety_consumer_time_value, tvb, 1, 2, ENC_LITTLE_ENDIAN);
1490 switch (format)
1492 case CIP_SAFETY_BASE_FORMAT:
1493 proto_tree_add_item(tree, hf_cipsafety_ack_byte2, tvb, 3, 1, ENC_LITTLE_ENDIAN);
1494 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, 4, 2, ENC_LITTLE_ENDIAN);
1495 break;
1496 case CIP_SAFETY_EXTENDED_FORMAT:
1497 proto_tree_add_item(tree, hf_cipsafety_crc_s5_0, tvb, 3, 1, ENC_LITTLE_ENDIAN);
1498 proto_tree_add_item(tree, hf_cipsafety_crc_s5_1, tvb, 4, 1, ENC_LITTLE_ENDIAN);
1499 proto_tree_add_item(tree, hf_cipsafety_crc_s5_2, tvb, 5, 1, ENC_LITTLE_ENDIAN);
1500 break;
1503 else if (((conn_type == ECIDT_O2T) && (server_dir == TRUE)) ||
1504 ((conn_type == ECIDT_T2O) && (server_dir == FALSE)))
1506 /* producer data */
1507 switch (format)
1509 case CIP_SAFETY_BASE_FORMAT:
1510 if (item_length-base_length <= 2)
1512 /* Short Format (1-2 bytes I/O data) */
1513 proto_tree_add_item(tree, hf_cipsafety_data, tvb, 0, item_length-base_length, ENC_NA);
1514 dissect_mode_byte(tree, tvb, item_length-base_length, pinfo);
1516 proto_tree_add_item(tree, hf_cipsafety_crc_s1, tvb, item_length-base_length+1, 1, ENC_LITTLE_ENDIAN);
1517 proto_tree_add_item(tree, hf_cipsafety_crc_s2, tvb, item_length-base_length+2, 1, ENC_LITTLE_ENDIAN);
1518 proto_tree_add_item(tree, hf_cipsafety_timestamp, tvb, item_length-base_length+3, 2, ENC_LITTLE_ENDIAN);
1519 proto_tree_add_item(tree, hf_cipsafety_crc_s1, tvb, item_length-base_length+5, 1, ENC_LITTLE_ENDIAN);
1521 if (multicast)
1523 dissect_mcast_byte(tree, tvb, item_length-6, pinfo);
1524 proto_tree_add_item(tree, hf_cipsafety_time_correction, tvb, item_length-5, 2, ENC_LITTLE_ENDIAN);
1525 proto_tree_add_item(tree, hf_cipsafety_mcast_byte2, tvb, item_length-3, 1, ENC_LITTLE_ENDIAN);
1526 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, item_length-2, 2, ENC_LITTLE_ENDIAN);
1529 else
1531 /* Long Format (3-250 bytes I/O data) */
1532 if (item_length%2 == 1)
1534 /* Malformed packet */
1535 expert_add_info(pinfo, item, &ei_mal_io);
1536 return;
1539 io_data_size = multicast ? ((item_length-14)/2) : ((item_length-8)/2);
1541 proto_tree_add_item(tree, hf_cipsafety_data, tvb, 0, io_data_size, ENC_NA);
1542 dissect_mode_byte(tree, tvb, io_data_size, pinfo);
1543 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, io_data_size+1, 2, ENC_LITTLE_ENDIAN);
1544 proto_tree_add_item(tree, hf_cipsafety_complement_data, tvb, io_data_size+3, io_data_size, ENC_NA);
1545 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, (io_data_size*2)+3, 2, ENC_LITTLE_ENDIAN);
1546 proto_tree_add_item(tree, hf_cipsafety_timestamp, tvb, (io_data_size*2)+5, 2, ENC_LITTLE_ENDIAN);
1547 proto_tree_add_item(tree, hf_cipsafety_crc_s1, tvb, (io_data_size*2)+7, 1, ENC_LITTLE_ENDIAN);
1549 if (multicast)
1551 dissect_mcast_byte(tree, tvb, (io_data_size*2)+5, pinfo);
1552 proto_tree_add_item(tree, hf_cipsafety_time_correction, tvb, (io_data_size*2)+6, 2, ENC_LITTLE_ENDIAN);
1553 proto_tree_add_item(tree, hf_cipsafety_mcast_byte2, tvb, (io_data_size*2)+8, 1, ENC_LITTLE_ENDIAN);
1554 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, (io_data_size*2)+9, 2, ENC_LITTLE_ENDIAN);
1557 break;
1558 case CIP_SAFETY_EXTENDED_FORMAT:
1559 if (item_length-base_length <= 2)
1561 /* Short Format (1-2 bytes I/O data) */
1562 proto_tree_add_item(tree, hf_cipsafety_data, tvb, 0, item_length-base_length, ENC_NA);
1563 dissect_mode_byte(tree, tvb, item_length-base_length, pinfo);
1565 proto_tree_add_item(tree, hf_cipsafety_crc_s5_0, tvb, item_length-base_length+1, 1, ENC_LITTLE_ENDIAN);
1566 proto_tree_add_item(tree, hf_cipsafety_crc_s5_1, tvb, item_length-base_length+2, 1, ENC_LITTLE_ENDIAN);
1567 proto_tree_add_item(tree, hf_cipsafety_timestamp, tvb, item_length-base_length+3, 2, ENC_LITTLE_ENDIAN);
1568 proto_tree_add_item(tree, hf_cipsafety_crc_s5_2, tvb, item_length-base_length+5, 1, ENC_LITTLE_ENDIAN);
1570 if (multicast)
1572 dissect_mcast_byte(tree, tvb, item_length-6, pinfo);
1573 proto_tree_add_item(tree, hf_cipsafety_time_correction, tvb, item_length-5, 2, ENC_LITTLE_ENDIAN);
1574 proto_tree_add_item(tree, hf_cipsafety_crc_s5_0, tvb, item_length-3, 1, ENC_LITTLE_ENDIAN);
1575 proto_tree_add_item(tree, hf_cipsafety_crc_s5_1, tvb, item_length-2, 1, ENC_LITTLE_ENDIAN);
1576 proto_tree_add_item(tree, hf_cipsafety_crc_s5_2, tvb, item_length-1, 1, ENC_LITTLE_ENDIAN);
1579 else
1581 /* Long Format (3-250 bytes I/O data) */
1582 if (item_length%2 == 1)
1584 /* Malformed packet */
1585 expert_add_info(pinfo, item, &ei_mal_io);
1586 return;
1589 io_data_size = multicast ? ((item_length-14)/2) : ((item_length-8)/2);
1591 proto_tree_add_item(tree, hf_cipsafety_data, tvb, 0, io_data_size, ENC_NA);
1592 dissect_mode_byte(tree, tvb, io_data_size, pinfo);
1594 proto_tree_add_item(tree, hf_cipsafety_crc_s3, tvb, io_data_size+1, 2, ENC_LITTLE_ENDIAN);
1595 proto_tree_add_item(tree, hf_cipsafety_complement_data, tvb, io_data_size+3, io_data_size, ENC_NA);
1596 proto_tree_add_item(tree, hf_cipsafety_crc_s5_0, tvb, (io_data_size*2)+3, 1, ENC_LITTLE_ENDIAN);
1597 proto_tree_add_item(tree, hf_cipsafety_crc_s5_1, tvb, (io_data_size*2)+4, 1, ENC_LITTLE_ENDIAN);
1598 proto_tree_add_item(tree, hf_cipsafety_timestamp, tvb, (io_data_size*2)+5, 2, ENC_LITTLE_ENDIAN);
1599 proto_tree_add_item(tree, hf_cipsafety_crc_s5_2, tvb, (io_data_size*2)+7, 1, ENC_LITTLE_ENDIAN);
1601 if (multicast)
1603 dissect_mcast_byte(tree, tvb, (io_data_size*2)+8, pinfo);
1604 proto_tree_add_item(tree, hf_cipsafety_time_correction, tvb, (io_data_size*2)+9, 2, ENC_LITTLE_ENDIAN);
1605 proto_tree_add_item(tree, hf_cipsafety_crc_s5_0, tvb, (io_data_size*2)+11, 1, ENC_LITTLE_ENDIAN);
1606 proto_tree_add_item(tree, hf_cipsafety_crc_s5_1, tvb, (io_data_size*2)+12, 1, ENC_LITTLE_ENDIAN);
1607 proto_tree_add_item(tree, hf_cipsafety_crc_s5_2, tvb, (io_data_size*2)+13, 1, ENC_LITTLE_ENDIAN);
1610 break;
1613 else
1615 /* Shouldn't happen, but at least dissect it as data */
1616 proto_tree_add_item(tree, hf_cipsafety_data, tvb, 0, item_length, ENC_NA);
1620 static void
1621 dissect_cipsafety(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1623 proto_item *ti;
1624 proto_tree *safety_tree;
1626 /* Create display subtree for the protocol */
1627 ti = proto_tree_add_item(tree, proto_cipsafety, tvb, 0, -1, ENC_NA);
1628 safety_tree = proto_item_add_subtree( ti, ett_cip_safety);
1630 dissect_cip_safety_data(safety_tree, ti, tvb, tvb_length(tvb), pinfo );
1633 static int dissect_sercosiii_link_error_count_p1p2(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
1634 int offset, int total_len)
1636 if (total_len < 4)
1638 expert_add_info(pinfo, item, &ei_mal_sercosiii_link_error_count_p1p2);
1639 return total_len;
1642 proto_tree_add_item(tree, hf_cip_sercosiii_link_error_count_p1, tvb, offset, 2, ENC_LITTLE_ENDIAN );
1643 proto_tree_add_item(tree, hf_cip_sercosiii_link_error_count_p2, tvb, offset+2, 2, ENC_LITTLE_ENDIAN );
1644 return 4;
1647 static int dissect_tcpip_ssn(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
1648 int offset, int total_len)
1650 if (total_len < 6)
1652 expert_add_info(pinfo, item, &ei_mal_tcpip_ssn);
1653 return total_len;
1656 dissect_cipsafety_ssn(tree, tvb, pinfo, offset, hf_tcpip_snn_timestamp, hf_tcpip_snn_date, hf_tcpip_snn_time);
1657 return 6;
1660 attribute_info_t cip_safety_attribute_vals[52] = {
1662 /* Safety Supervisor */
1663 {0x39, TRUE, 99, "Subclass", cip_uint, &hf_cip_ssupervisor_class_subclass, NULL},
1664 {0x39, FALSE, 1, "Number of Attributes", cip_usint, &hf_cip_ssupervisor_num_attr, NULL},
1665 {0x39, FALSE, 2, "Attribute List", cip_usint_array, &hf_cip_ssupervisor_attr_list, NULL},
1666 {0x39, FALSE, 5, "Manufacturer Name", cip_short_string, &hf_cip_ssupervisor_manufacture_name, NULL},
1667 {0x39, FALSE, 6, "Manufacturer Model Number", cip_short_string, &hf_cip_ssupervisor_manufacture_model_number, NULL},
1668 {0x39, FALSE, 7, "Software Revision Level", cip_short_string, &hf_cip_ssupervisor_sw_rev_level, NULL},
1669 {0x39, FALSE, 8, "Hardware Revision Level", cip_short_string, &hf_cip_ssupervisor_hw_rev_level, NULL},
1670 {0x39, FALSE, 9, "Manufacturer Serial Number", cip_short_string, &hf_cip_ssupervisor_manufacture_serial_number, NULL},
1671 {0x39, FALSE, 10, "Device Configuration", cip_short_string, &hf_cip_ssupervisor_device_config, NULL},
1672 {0x39, FALSE, 11, "Device Status", cip_usint, &hf_cip_ssupervisor_device_status, NULL},
1673 {0x39, FALSE, 12, "Exception Status", cip_byte, &hf_cip_ssupervisor_exception_status, NULL},
1674 {0x39, FALSE, 13, "Exception Detail Alarm", cip_dissector_func, NULL, dissect_s_supervisor_exception_detail_alarm},
1675 {0x39, FALSE, 14, "Exception Detail Warning", cip_dissector_func, NULL, dissect_s_supervisor_exception_detail_warning},
1676 {0x39, FALSE, 15, "Alarm Enable", cip_bool, &hf_cip_ssupervisor_alarm_enable, NULL},
1677 {0x39, FALSE, 16, "Warning Enable", cip_bool, &hf_cip_ssupervisor_warning_enable, NULL},
1678 {0x39, FALSE, 17, "Time", cip_date_and_time, &hf_cip_ssupervisor_time, NULL},
1679 {0x39, FALSE, 18, "Clock Power Cycle Behavior", cip_usint, &hf_cip_ssupervisor_clock_power_cycle_behavior, NULL},
1680 {0x39, FALSE, 19, "Last Maintenance Date", cip_date, &hf_cip_ssupervisor_last_maintenance_date, NULL},
1681 {0x39, FALSE, 20, "Next Scheduled Maintenance Date", cip_date, &hf_cip_ssupervisor_next_scheduled_maintenance_date, NULL},
1682 {0x39, FALSE, 21, "Scheduled Maintenance Expiration Timer", cip_int, &hf_cip_ssupervisor_scheduled_maintenance_expiration_timer, NULL},
1683 {0x39, FALSE, 22, "Scheduled Maintenance Expiration Warning Enable", cip_bool, &hf_cip_ssupervisor_scheduled_maintenance_expiration_warning_enable, NULL},
1684 {0x39, FALSE, 23, "Run Hours", cip_udint, &hf_cip_ssupervisor_run_hours, NULL},
1685 {0x39, FALSE, 24, "Configuration Lock", cip_bool, &hf_cip_ssupervisor_configuration_lock, NULL},
1686 {0x39, FALSE, 25, "Configuration UNID", cip_dissector_func, NULL, dissect_s_supervisor_configuration_unid},
1687 {0x39, FALSE, 26, "Safety Configuration Identifier", cip_dissector_func, NULL, dissect_s_supervisor_safety_configuration_id},
1688 {0x39, FALSE, 27, "Target UNID", cip_dissector_func, NULL, dissect_s_supervisor_target_unid},
1689 {0x39, FALSE, 28, "Output Connection Point Owners", cip_dissector_func, NULL, dissect_s_supervisor_output_connection_point_owners},
1690 {0x39, FALSE, 29, "Proposed TUNID", cip_dissector_func, NULL, dissect_s_supervisor_proposed_tunid},
1691 {0x39, FALSE, 99, "Subclass", cip_uint, &hf_cip_ssupervisor_instance_subclass, NULL},
1693 /* Safety Validator */
1694 {0x3A, TRUE, 8, "Safety Connection Fault Count", cip_uint, &hf_cip_svalidator_sconn_fault_count, NULL},
1695 {0x3A, FALSE, 1, "Safety Validator State", cip_usint, &hf_cip_svalidator_state, NULL},
1696 {0x3A, FALSE, 2, "Safety Validator Type", cip_dissector_func, NULL, dissect_s_validator_type},
1697 {0x3A, FALSE, 3, "Ping Interval ERI Multiplier", cip_uint, &hf_cip_svalidator_ping_eri, NULL},
1698 {0x3A, FALSE, 4, "Time Coord Msg Min Multiplier", cip_dissector_func, NULL, dissect_s_validator_time_coord_msg_min_mult},
1699 {0x3A, FALSE, 5, "Network Time Expectation Multiplier", cip_dissector_func, NULL, dissect_s_validator_network_time_multiplier},
1700 {0x3A, FALSE, 6, "Timeout Multiplier", cip_dissector_func, NULL, dissect_s_validator_timeout_multiplier},
1701 {0x3A, FALSE, 7, "Max Consumer Number", cip_usint, &hf_cip_svalidator_max_consumer_num, NULL},
1702 {0x3A, FALSE, 8, "Data Connection Instance", cip_uint, &hf_cip_svalidator_data_conn_inst, NULL},
1703 {0x3A, FALSE, 9, "Coordination Connection Instance", cip_dissector_func, NULL, dissect_s_validator_coordination_conn_inst},
1704 {0x3A, FALSE, 10, "Correction Connection Instance", cip_uint, &hf_cip_svalidator_correction_conn_inst, NULL},
1705 {0x3A, FALSE, 11, "CCO Binding", cip_uint, &hf_cip_svalidator_cco_binding, NULL},
1706 {0x3A, FALSE, 12, "Max Data Age", cip_uint, &hf_cip_svalidator_max_data_age, NULL},
1707 {0x3A, FALSE, 13, "Application Data Path", cip_dissector_func, NULL, dissect_s_validator_app_data_path},
1708 {0x3A, FALSE, 14, "Error Code", cip_uint, &hf_cip_svalidator_error_code, NULL},
1709 {0x3A, FALSE, 15, "Producer/Consumer Fault Counters", cip_dissector_func, NULL, dissect_s_validator_prod_cons_fault_count},
1711 /* Sercos III Link */
1712 {0x4C, FALSE, 1, "Safety Network Number", cip_byte_array, &hf_cip_sercosiii_link_snn, NULL},
1713 {0x4C, FALSE, 2, "Communication Cycle Time", cip_dint, &hf_cip_sercosiii_link_communication_cycle_time, NULL},
1714 {0x4C, FALSE, 3, "Interface Status", cip_word, &hf_cip_sercosiii_link_interface_status, NULL},
1715 {0x4C, FALSE, 4, "Error counter MST-P/S", cip_int, &hf_cip_sercosiii_link_error_count_mstps, NULL},
1716 {0x4C, FALSE, 5, "Error counter Port1 and Port2", cip_dissector_func, NULL, dissect_sercosiii_link_error_count_p1p2},
1717 {0x4C, FALSE, 6, "SERCOS address", cip_int, &hf_cip_sercosiii_link_sercos_address, NULL},
1719 /* TCP/IP object (CIP-Safety specific) */
1720 {0xF5, FALSE, 7, "Safety Network Number", cip_dissector_func, NULL, dissect_tcpip_ssn}
1724 * Protocol initialization
1728 * Function name: proto_register_cipsafety
1730 * Purpose: Register the protocol with Wireshark, a script will add this protocol
1731 * to the list of protocols during the build process. This function is where the
1732 * header fields and subtree identifiers are registered.
1734 * Returns: void
1736 void
1737 proto_register_cipsafety(void)
1739 /* This is a list of header fields that can be used in the dissection or
1740 * to use in a filter expression */
1741 static hf_register_info hf[] =
1743 { &hf_cip_reqrsp,
1744 { "Request/Response", "cip.rr",
1745 FT_UINT8, BASE_HEX, VALS(cip_sc_rr), 0x80, "Request or Response message", HFILL }
1747 { &hf_cip_data,
1748 { "Data", "cip.data",
1749 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1752 { &hf_cipsafety_data,
1753 { "Data", "enip.connection_transport_data",
1754 FT_BYTES, BASE_NONE, NULL, 0, "Connection Transport Data", HFILL }
1756 { &hf_cipsafety_mode_byte,
1757 { "Mode Byte", "cipsafety.mode_byte",
1758 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1760 { &hf_cipsafety_mode_byte_ping_count,
1761 { "Ping Count", "cipsafety.mode_byte.ping_count",
1762 FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL }
1764 { &hf_cipsafety_mode_byte_not_tbd,
1765 { "Not TBD Bit", "cipsafety.mode_byte.not_tbd",
1766 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }
1768 { &hf_cipsafety_mode_byte_tbd_2_copy,
1769 { "TBD 2 Bit Copy", "cipsafety.mode_byte.tbd_2_copy",
1770 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }
1772 { &hf_cipsafety_mode_byte_not_run_idle,
1773 { "Not Run/Idle", "cipsafety.mode_byte.not_run_idle",
1774 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }
1776 { &hf_cipsafety_mode_byte_tbd,
1777 { "TBD Bit", "cipsafety.mode_byte.tbd",
1778 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }
1780 { &hf_cipsafety_mode_byte_tbd_2_bit,
1781 { "TBD 2 Bit", "cipsafety.mode_byte.tbd_2_bit",
1782 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }
1784 { &hf_cipsafety_mode_byte_run_idle,
1785 { "Run/Idle", "cipsafety.mode_byte.run_idle",
1786 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }
1788 { &hf_cipsafety_crc_s1,
1789 { "CRC S1", "cipsafety.crc_s1",
1790 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1792 { &hf_cipsafety_crc_s2,
1793 { "CRC S2", "cipsafety.crc_s2",
1794 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1796 { &hf_cipsafety_crc_s3,
1797 { "CRC S3", "cipsafety.crc_s3",
1798 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
1800 { &hf_cipsafety_timestamp,
1801 { "Timestamp", "cipsafety.timestamp",
1802 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
1804 { &hf_cipsafety_ack_byte,
1805 { "ACK Byte", "cipsafety.ack_byte",
1806 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1808 { &hf_cipsafety_ack_byte_ping_count_reply,
1809 { "Ping Count Reply", "cipsafety.ack_byte.ping_count_reply",
1810 FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL }
1812 { &hf_cipsafety_ack_byte_reserved1,
1813 { "Reserved", "cipsafety.ack_byte.reserved1",
1814 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL }
1816 { &hf_cipsafety_ack_byte_ping_response,
1817 { "Ping Response", "cipsafety.ack_byte.ping_response",
1818 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }
1820 { &hf_cipsafety_ack_byte_reserved2,
1821 { "Reserved", "cipsafety.ack_byte.reserved2",
1822 FT_UINT8, BASE_HEX, NULL, 0x70, NULL, HFILL }
1824 { &hf_cipsafety_ack_byte_parity_even,
1825 { "Parity Even", "cipsafety.ack_byte.parity_even",
1826 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }
1828 { &hf_cipsafety_ack_byte2,
1829 { "ACK Byte 2", "cipsafety.ack_byte2",
1830 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1832 { &hf_cipsafety_consumer_time_value,
1833 { "Consumer Time Value", "cipsafety.consumer_time_value",
1834 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
1836 { &hf_cipsafety_mcast_byte,
1837 { "MCAST Byte", "cipsafety.mcast_byte",
1838 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1840 { &hf_cipsafety_mcast_byte_consumer_num,
1841 { "Consumer #", "cipsafety.mcast_byte.consumer_num",
1842 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }
1844 { &hf_cipsafety_mcast_byte_reserved1,
1845 { "Reserved", "cipsafety.mcast_byte.reserved1",
1846 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL }
1848 { &hf_cipsafety_mcast_byte_mai,
1849 { "Multicast Active/Idle", "cipsafety.mcast_byte.active_idle",
1850 FT_BOOLEAN, 8, TFS(&cip_safety_vals_active_idle), 0x20, NULL, HFILL }
1852 { &hf_cipsafety_mcast_byte_reserved2,
1853 { "Reserved", "cipsafety.mcast_byte.reserved2",
1854 FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL }
1856 { &hf_cipsafety_mcast_byte_parity_even,
1857 { "Parity Even", "cipsafety.mcast_byte.parity_even",
1858 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }
1860 { &hf_cipsafety_mcast_byte2,
1861 { "MCAST Byte 2", "cipsafety.mcast_byte2",
1862 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1864 { &hf_cipsafety_time_correction,
1865 { "Time Correction", "cipsafety.time_correction",
1866 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
1868 { &hf_cipsafety_crc_s5_0,
1869 { "CRC S5_0", "cipsafety.crc_s5_0",
1870 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1872 { &hf_cipsafety_crc_s5_1,
1873 { "CRC S5_1", "cipsafety.crc_s5_1",
1874 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1876 { &hf_cipsafety_crc_s5_2,
1877 { "CRC S5_2", "cipsafety.crc_s5_2",
1878 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
1880 { &hf_cipsafety_complement_data,
1881 { "Complement Data", "cipsafety.complement_data",
1882 FT_BYTES, BASE_NONE, NULL, 0, "Connection Transport Data", HFILL }
1885 { &hf_cip_sercosiii_link_snn,
1886 { "Data", "cipsafety.sercosiii_link.snn",
1887 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1889 { &hf_cip_sercosiii_link_communication_cycle_time,
1890 { "Communication Cycle Time", "cipsafety.sercosiii_link.communication_cycle_time",
1891 FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }
1893 { &hf_cip_sercosiii_link_interface_status,
1894 { "Communication Cycle Time", "cipsafety.sercosiii_link.interface_status",
1895 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
1897 { &hf_cip_sercosiii_link_error_count_mstps,
1898 { "Error Counter MST-P/S", "cipsafety.sercosiii_link.error_count_mstps",
1899 FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
1901 { &hf_cip_sercosiii_link_error_count_p1,
1902 { "Error Count Port 1", "cipsafety.sercosiii_link.error_count_p1",
1903 FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
1905 { &hf_cip_sercosiii_link_error_count_p2,
1906 { "Error Count Port 2", "cipsafety.sercosiii_link.error_count_p2",
1907 FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
1909 { &hf_cip_sercosiii_link_sercos_address,
1910 { "SERCOS Address", "cipsafety.sercosiii_link.sercos_address",
1911 FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
1914 { &hf_tcpip_snn_timestamp,
1915 { "Safety Network Number (Timestamp)", "cip.tcpip.snn.timestamp",
1916 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
1918 { &hf_tcpip_snn_date,
1919 { "Safety Network Number (Manual) Date", "cip.tcpip.snn.date",
1920 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
1922 { &hf_tcpip_snn_time,
1923 { "Safety Network Number (Manual) Time", "cip.tcpip.snn.time",
1924 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1928 static hf_register_info hf_ssupervisor[] = {
1929 { &hf_cip_ssupervisor_sc,
1930 { "Service", "cipsafety.ssupervisor.sc",
1931 FT_UINT8, BASE_HEX, VALS(cip_sc_vals_ssupervisor), 0x7F, NULL, HFILL }
1933 { &hf_cip_ssupervisor_recover_data,
1934 { "Data", "cipsafety.ssupervisor.recover.data",
1935 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1937 { &hf_cip_ssupervisor_perform_diag_data,
1938 { "Data", "cipsafety.ssupervisor.perform_diag.data",
1939 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1941 { &hf_cip_ssupervisor_configure_request_password,
1942 { "Password", "cipsafety.ssupervisor.configure_request.password",
1943 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1945 { &hf_cip_ssupervisor_configure_request_tunid,
1946 { "Target UNID", "cipsafety.ssupervisor.configure_request.tunid",
1947 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1949 { &hf_cip_ssupervisor_configure_request_tunid_ssn_timestamp,
1950 { "TUNID SSN Timestamp", "cipsafety.ssupervisor.configure_request.tunid.ssn.timestamp",
1951 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
1953 { &hf_cip_ssupervisor_configure_request_tunid_ssn_date,
1954 { "TUNID SSN (Manual) Date", "cipsafety.ssupervisor.configure_request.tunid.ssn.date",
1955 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
1957 { &hf_cip_ssupervisor_configure_request_tunid_ssn_time,
1958 { "TUNID SSN (Manual) Time", "cipsafety.ssupervisor.configure_request.tunid.ssn.time",
1959 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1961 { &hf_cip_ssupervisor_configure_request_tunid_macid,
1962 { "MAC ID", "cipsafety.ssupervisor.configure_request.tunid.macid",
1963 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1965 { &hf_cip_ssupervisor_configure_request_ounid,
1966 { "Originator UNID", "cipsafety.ssupervisor.configure_request.ounid",
1967 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
1969 { &hf_cip_ssupervisor_configure_request_ounid_ssn_timestamp,
1970 { "OUNID SSN Timestamp", "cipsafety.ssupervisor.configure_request.ounid.ssn.timestamp",
1971 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
1973 { &hf_cip_ssupervisor_configure_request_ounid_ssn_date,
1974 { "OUNID SSN (Manual) Date", "cipsafety.ssupervisor.configure_request.ounid.ssn.date",
1975 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
1977 { &hf_cip_ssupervisor_configure_request_ounid_ssn_time,
1978 { "OUNID SSN (Manual) Time", "cipsafety.ssupervisor.configure_request.ounid.ssn.time",
1979 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1981 { &hf_cip_ssupervisor_configure_request_ounid_macid,
1982 { "MAC ID", "cipsafety.ssupervisor.configure_request.ounid.macid",
1983 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1985 { &hf_cip_ssupervisor_validate_configuration_sccrc,
1986 { "SCCRC", "cipsafety.ssupervisor.validate_configuration.sccrc",
1987 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
1989 { &hf_cip_ssupervisor_validate_configuration_scts_timestamp,
1990 { "SCTS (Timestamp)", "cipsafety.ssupervisor.validate_configuration.scts.timestamp",
1991 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
1993 { &hf_cip_ssupervisor_validate_configuration_scts_date,
1994 { "SCTS (Manual) Date", "cipsafety.ssupervisor.validate_configuration.scts.date",
1995 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
1997 { &hf_cip_ssupervisor_validate_configuration_scts_time,
1998 { "SCTS (Manual) Time", "cipsafety.ssupervisor.validate_configuration.scts.time",
1999 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2001 { &hf_cip_ssupervisor_validate_configuration_ext_error,
2002 { "Extended Error", "cipsafety.ssupervisor.validate_configuration.ext_error",
2003 FT_UINT16, BASE_DEC, VALS(cip_ssupervisor_validate_configuration_ext_error_vals), 0, NULL, HFILL }
2005 { &hf_cip_ssupervisor_set_password_current_password,
2006 { "Current Password", "cipsafety.ssupervisor.set_password.current_pass",
2007 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2009 { &hf_cip_ssupervisor_set_password_new_password,
2010 { "New Password", "cipsafety.ssupervisor.set_password.new_pass",
2011 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2013 { &hf_cip_ssupervisor_configure_lock_value,
2014 { "Lock Value", "cipsafety.ssupervisor.configure_lock.lock",
2015 FT_UINT8, BASE_DEC, VALS(cip_ssupervisor_lock_vals), 0, NULL, HFILL }
2017 { &hf_cip_ssupervisor_configure_lock_password,
2018 { "Password", "cipsafety.ssupervisor.configure_lock.password",
2019 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2021 { &hf_cip_ssupervisor_configure_lock_tunid,
2022 { "Target UNID", "cipsafety.ssupervisor.configure_lock.tunid",
2023 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2025 { &hf_cip_ssupervisor_configure_lock_tunid_ssn_timestamp,
2026 { "TUNID SSN Timestamp", "cipsafety.ssupervisor.configure_lock.tunid.ssn.timestamp",
2027 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2029 { &hf_cip_ssupervisor_configure_lock_tunid_ssn_date,
2030 { "TUNID SSN (Manual) Date", "cipsafety.ssupervisor.configure_lock.tunid.ssn.date",
2031 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2033 { &hf_cip_ssupervisor_configure_lock_tunid_ssn_time,
2034 { "TUNID SSN (Manual) Time", "cipsafety.ssupervisor.configure_lock.tunid.ssn.time",
2035 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2037 { &hf_cip_ssupervisor_configure_lock_tunid_macid,
2038 { "MAC ID", "cipsafety.ssupervisor.configure_lock.tunid.macid",
2039 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2041 { &hf_cip_ssupervisor_mode_change_value,
2042 { "Value", "cipsafety.ssupervisor.mode_change.value",
2043 FT_UINT8, BASE_DEC, VALS(cip_ssupervisor_change_mode_vals), 0, NULL, HFILL }
2045 { &hf_cip_ssupervisor_mode_change_password,
2046 { "Password", "cipsafety.ssupervisor.mode_change.password",
2047 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2049 { &hf_cip_ssupervisor_reset_type,
2050 { "Reset Type", "cipsafety.ssupervisor.reset.type",
2051 FT_UINT8, BASE_DEC, VALS(cip_reset_type_vals), 0, NULL, HFILL }
2053 { &hf_cip_ssupervisor_reset_password,
2054 { "Password", "cipsafety.ssupervisor.reset.password",
2055 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2057 { &hf_cip_ssupervisor_reset_tunid,
2058 { "Target UNID", "cipsafety.ssupervisor.reset.tunid",
2059 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2061 { &hf_cip_ssupervisor_reset_tunid_tunid_ssn_timestamp,
2062 { "TUNID SSN Timestamp", "cipsafety.ssupervisor.reset.tunid.ssn.timestamp",
2063 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2065 { &hf_cip_ssupervisor_reset_tunid_tunid_ssn_date,
2066 { "TUNID SSN (Manual) Date", "cipsafety.ssupervisor.reset.tunid.ssn.date",
2067 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2069 { &hf_cip_ssupervisor_reset_tunid_tunid_ssn_time,
2070 { "TUNID SSN (Manual) Time", "cipsafety.ssupervisor.reset.tunid.ssn.time",
2071 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2073 { &hf_cip_ssupervisor_reset_tunid_macid,
2074 { "MAC ID", "cipsafety.ssupervisor.reset.tunid.macid",
2075 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2077 { &hf_cip_ssupervisor_reset_attr_bitmap,
2078 { "Attribute Bit Map", "cipsafety.ssupervisor.reset.attr_bitmap",
2079 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
2081 { &hf_cip_ssupervisor_reset_attr_bitmap_macid,
2082 { "Preserve MacID", "cipsafety.ssupervisor.reset.attr_bitmap.macid",
2083 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x01, NULL, HFILL }
2085 { &hf_cip_ssupervisor_reset_attr_bitmap_baudrate,
2086 { "Preserve Baud Rate", "cipsafety.ssupervisor.reset.attr_bitmap.baudrate",
2087 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02, NULL, HFILL }
2089 { &hf_cip_ssupervisor_reset_attr_bitmap_tunid,
2090 { "Preserve TUNID", "cipsafety.ssupervisor.reset.attr_bitmap.tunid",
2091 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04, NULL, HFILL }
2093 { &hf_cip_ssupervisor_reset_attr_bitmap_password,
2094 { "Preserve Password", "cipsafety.ssupervisor.reset.attr_bitmap.password",
2095 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08, NULL, HFILL }
2097 { &hf_cip_ssupervisor_reset_attr_bitmap_cfunid,
2098 { "Preserve CFUNID", "cipsafety.ssupervisor.reset.attr_bitmap.cfunid",
2099 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x10, NULL, HFILL }
2101 { &hf_cip_ssupervisor_reset_attr_bitmap_ocpunid,
2102 { "Preserve OPCUNID", "cipsafety.ssupervisor.reset.attr_bitmap.ocpunid",
2103 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x20, NULL, HFILL }
2105 { &hf_cip_ssupervisor_reset_attr_bitmap_reserved,
2106 { "Reserved", "cipsafety.ssupervisor.reset.attr_bitmap.reserved",
2107 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x40, NULL, HFILL }
2109 { &hf_cip_ssupervisor_reset_attr_bitmap_extended,
2110 { "Use Extended Map", "cipsafety.ssupervisor.reset.attr_bitmap.extended",
2111 FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x80, NULL, HFILL }
2113 { &hf_cip_ssupervisor_reset_password_data_size,
2114 { "Data Size", "cipsafety.ssupervisor.reset_password.data_size",
2115 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2117 { &hf_cip_ssupervisor_reset_password_data,
2118 { "Password Data", "cipsafety.ssupervisor.reset_password.password_data",
2119 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2121 { &hf_cip_ssupervisor_propose_tunid_tunid,
2122 { "Target UNID", "cipsafety.ssupervisor.propose_tunid.tunid",
2123 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2125 { &hf_cip_ssupervisor_propose_tunid_tunid_ssn_timestamp,
2126 { "TUNID SSN Timestamp", "cipsafety.ssupervisor.propose_tunid.tunid.ssn.timestamp",
2127 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2129 { &hf_cip_ssupervisor_propose_tunid_tunid_ssn_date,
2130 { "TUNID SSN (Manual) Date", "cipsafety.ssupervisor.propose_tunid.tunid.ssn.date",
2131 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2133 { &hf_cip_ssupervisor_propose_tunid_tunid_ssn_time,
2134 { "TUNID SSN (Manual) Time", "cipsafety.ssupervisor.propose_tunid.tunid.ssn.time",
2135 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2137 { &hf_cip_ssupervisor_propose_tunid_tunid_macid,
2138 { "MAC ID", "cipsafety.ssupervisor.propose_tunid.tunid.macid",
2139 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2141 { &hf_cip_ssupervisor_apply_tunid_tunid,
2142 { "Target UNID", "cipsafety.ssupervisor.apply_tunid.tunid",
2143 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2145 { &hf_cip_ssupervisor_apply_tunid_tunid_ssn_timestamp,
2146 { "TUNID SSN Timestamp", "cipsafety.ssupervisor.apply_tunid.tunid.ssn.timestamp",
2147 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2149 { &hf_cip_ssupervisor_apply_tunid_tunid_ssn_date,
2150 { "TUNID SSN (Manual) Date", "cipsafety.ssupervisor.apply_tunid.tunid.ssn.date",
2151 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2153 { &hf_cip_ssupervisor_apply_tunid_tunid_ssn_time,
2154 { "TUNID SSN (Manual) Time", "cipsafety.ssupervisor.apply_tunid.tunid.ssn.time",
2155 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2157 { &hf_cip_ssupervisor_apply_tunid_tunid_macid,
2158 { "MAC ID", "cipsafety.ssupervisor.apply_tunid.tunid.macid",
2159 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2161 { &hf_cip_ssupervisor_class_subclass,
2162 { "Subclass", "cipsafety.ssupervisor.class_subclass",
2163 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2165 { &hf_cip_ssupervisor_num_attr,
2166 { "Number of Attributes", "cipsafety.ssupervisor.num_attr",
2167 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2169 { &hf_cip_ssupervisor_attr_list,
2170 { "Attributes List Item", "cipsafety.ssupervisor.attr_item",
2171 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2173 { &hf_cip_ssupervisor_manufacture_name,
2174 { "Manufacturer Name", "cipsafety.ssupervisor.manufacture_name",
2175 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2177 { &hf_cip_ssupervisor_manufacture_model_number,
2178 { "Manufacturer Model Number", "cipsafety.ssupervisor.manufacture_model_number",
2179 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2181 { &hf_cip_ssupervisor_sw_rev_level,
2182 { "Software Revision Level", "cipsafety.ssupervisor.sw_rev_level",
2183 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2185 { &hf_cip_ssupervisor_hw_rev_level,
2186 { "Hardware Revision Level", "cipsafety.ssupervisor.hw_rev_level",
2187 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2189 { &hf_cip_ssupervisor_manufacture_serial_number,
2190 { "Manufacturer Serial Number", "cipsafety.ssupervisor.manufacture_serial_number",
2191 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2193 { &hf_cip_ssupervisor_device_config,
2194 { "Device Configuration", "cipsafety.ssupervisor.device_config",
2195 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
2197 { &hf_cip_ssupervisor_device_status,
2198 { "Device Status", "cipsafety.ssupervisor.device_status",
2199 FT_UINT8, BASE_DEC, VALS(cip_ssupervisor_device_status_type_vals), 0, NULL, HFILL }
2201 { &hf_cip_ssupervisor_exception_status,
2202 { "Exception Status", "cipsafety.ssupervisor.exception_status",
2203 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
2205 { &hf_cip_ssupervisor_exception_detail_alarm_ced_size,
2206 { "Common Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_alarm.ced.size",
2207 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2209 { &hf_cip_ssupervisor_exception_detail_alarm_ced_detail,
2210 { "Common Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_alarm.ced.detail",
2211 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2213 { &hf_cip_ssupervisor_exception_detail_alarm_ded_size,
2214 { "Device Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_alarm.ded.size",
2215 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2217 { &hf_cip_ssupervisor_exception_detail_alarm_ded_detail,
2218 { "Device Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_alarm.ded.detail",
2219 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2221 { &hf_cip_ssupervisor_exception_detail_alarm_med_size,
2222 { "Manufacturer Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_alarm.med.size",
2223 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2225 { &hf_cip_ssupervisor_exception_detail_alarm_med_detail,
2226 { "Manufacturer Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_alarm.med.detail",
2227 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2229 { &hf_cip_ssupervisor_exception_detail_warning_ced_size,
2230 { "Common Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_warning.ced.size",
2231 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2233 { &hf_cip_ssupervisor_exception_detail_warning_ced_detail,
2234 { "Common Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_warning.ced.detail",
2235 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2237 { &hf_cip_ssupervisor_exception_detail_warning_ded_size,
2238 { "Device Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_warning.ded.size",
2239 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2241 { &hf_cip_ssupervisor_exception_detail_warning_ded_detail,
2242 { "Device Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_warning.ded.detail",
2243 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2245 { &hf_cip_ssupervisor_exception_detail_warning_med_size,
2246 { "Manufacturer Exeception Detail Size", "cipsafety.ssupervisor.exception_detail_warning.med.size",
2247 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2249 { &hf_cip_ssupervisor_exception_detail_warning_med_detail,
2250 { "Manufacturer Exeception Detail Data", "cipsafety.ssupervisor.exception_detail_warning.med.detail",
2251 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
2253 { &hf_cip_ssupervisor_alarm_enable,
2254 { "Exception Detail Alarm", "cipsafety.ssupervisor.alarm_enable",
2255 FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0, NULL, HFILL }
2257 { &hf_cip_ssupervisor_warning_enable,
2258 { "Exception Detail Warning", "cipsafety.ssupervisor.warning_enable",
2259 FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0, NULL, HFILL }
2261 { &hf_cip_ssupervisor_time,
2262 { "Time", "cipsafety.ssupervisor.time",
2263 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2265 { &hf_cip_ssupervisor_clock_power_cycle_behavior,
2266 { "Clock Power Cycle Behavior", "cipsafety.ssupervisor.clock_power_cycle_behavior",
2267 FT_UINT8, BASE_DEC, VALS(cip_ssupervisor_clock_power_cycle_type_vals), 0, NULL, HFILL }
2269 { &hf_cip_ssupervisor_last_maintenance_date,
2270 { "Last Maintenance Date", "cipsafety.ssupervisor.last_maintenance_date",
2271 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2273 { &hf_cip_ssupervisor_next_scheduled_maintenance_date,
2274 { "Next Scheduled Maintenance Date", "cipsafety.ssupervisor.next_scheduled_maintenance_date",
2275 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2277 { &hf_cip_ssupervisor_scheduled_maintenance_expiration_timer,
2278 { "Scheduled Maintenance Expiration Timer", "cipsafety.ssupervisor.scheduled_maintenance_expiration_timer",
2279 FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
2281 { &hf_cip_ssupervisor_scheduled_maintenance_expiration_warning_enable,
2282 { "Scheduled Maintenance Expiration Warning Enable", "cipsafety.ssupervisor.scheduled_maintenance_expiration_warning",
2283 FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0, NULL, HFILL }
2285 { &hf_cip_ssupervisor_run_hours,
2286 { "Run Hours", "cipsafety.ssupervisor.run_hours",
2287 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }
2289 { &hf_cip_ssupervisor_configuration_lock,
2290 { "Configuration Lock", "cipsafety.ssupervisor.configuration_lock",
2291 FT_UINT8, BASE_DEC, VALS(cip_ssupervisor_lock_vals), 0, NULL, HFILL }
2293 { &hf_cip_ssupervisor_configuration_unid_ssn_timestamp,
2294 { "Configuration UNID SSN Timestamp", "cipsafety.ssupervisor.configuration_unid.ssn.timestamp",
2295 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2297 { &hf_cip_ssupervisor_configuration_unid_ssn_date,
2298 { "Configuration UNID SSN (Manual) Date", "cipsafety.ssupervisor.configuration_unid.ssn.date",
2299 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2301 { &hf_cip_ssupervisor_configuration_unid_ssn_time,
2302 { "Configuration UNID SSN (Manual) Time", "cipsafety.ssupervisor.configuration_unid.ssn.time",
2303 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2305 { &hf_cip_ssupervisor_configuration_unid_macid,
2306 { "Configuration UNID MAC ID", "cipsafety.ssupervisor.configuration_unid.macid",
2307 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2309 { &hf_cip_ssupervisor_safety_configuration_id_ssn_timestamp,
2310 { "Safety Configuration ID SSN Timestamp", "cipsafety.ssupervisor.safety_configuration_id.ssn.timestamp",
2311 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2313 { &hf_cip_ssupervisor_safety_configuration_id_ssn_date,
2314 { "Safety Configuration ID SSN (Manual) Date", "cipsafety.ssupervisor.safety_configuration_id.ssn.date",
2315 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2317 { &hf_cip_ssupervisor_safety_configuration_id_ssn_time,
2318 { "Safety Configuration ID SSN (Manual) Time", "cipsafety.ssupervisor.safety_configuration_id.ssn.time",
2319 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2321 { &hf_cip_ssupervisor_safety_configuration_id_macid,
2322 { "Safety Configuration ID MAC ID", "cipsafety.ssupervisor.safety_configuration_id.macid",
2323 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2325 { &hf_cip_ssupervisor_target_unid_ssn_timestamp,
2326 { "Target UNID SSN Timestamp", "cipsafety.ssupervisor.target_unid.ssn.timestamp",
2327 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2329 { &hf_cip_ssupervisor_target_unid_ssn_date,
2330 { "Target UNID SSN (Manual) Date", "cipsafety.ssupervisor.target_unid.ssn.date",
2331 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2333 { &hf_cip_ssupervisor_target_unid_ssn_time,
2334 { "Target UNID SSN (Manual) Time", "cipsafety.ssupervisor.target_unid.ssn.time",
2335 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2337 { &hf_cip_ssupervisor_target_unid_macid,
2338 { "Target UNID MAC ID", "cipsafety.ssupervisor.target_unid.macid",
2339 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2341 { &hf_cip_ssupervisor_cp_owners_num_entries,
2342 { "Number of Array Entries", "cipsafety.ssupervisor.cp_owners.num_entries",
2343 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2345 { &hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_timestamp,
2346 { "OCPUNID SSN Timestamp", "cipsafety.ssupervisor.cp_owners.ssn.timestamp",
2347 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2349 { &hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_date,
2350 { "OCPUNID SSN (Manual) Date", "cipsafety.ssupervisor.cp_owners.ssn.date",
2351 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2353 { &hf_cip_ssupervisor_output_cp_owners_ocpunid_ssn_time,
2354 { "OCPUNID SSN (Manual) Time", "cipsafety.ssupervisor.cp_owners.ssn.time",
2355 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2357 { &hf_cip_ssupervisor_output_cp_owners_ocpunid_macid,
2358 { "OCPUNID MAC ID", "cipsafety.ssupervisor.cp_owners.ocpunid.macid",
2359 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2361 { &hf_cip_ssupervisor_cp_owners_app_path_size,
2362 { "EPATH Size", "cipsafety.ssupervisor.cp_owners.epath_size",
2363 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2365 { &hf_cip_ssupervisor_proposed_tunid_ssn_timestamp,
2366 { "Proposed TUNID SSN Timestamp", "cipsafety.ssupervisor.proposed_tunid.ssn.timestamp",
2367 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
2369 { &hf_cip_ssupervisor_proposed_tunid_ssn_date,
2370 { "Proposed TUNID SSN (Manual) Date", "cipsafety.ssupervisor.proposed_tunid.ssn.date",
2371 FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }
2373 { &hf_cip_ssupervisor_proposed_tunid_ssn_time,
2374 { "Proposed TUNID SSN (Manual) Time", "cipsafety.ssupervisor.proposed_tunid.ssn.time",
2375 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2377 { &hf_cip_ssupervisor_proposed_tunid_macid,
2378 { "Proposed TUNID MAC ID", "cipsafety.ssupervisor.proposed_tunid.macid",
2379 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
2381 { &hf_cip_ssupervisor_instance_subclass,
2382 { "Subclass", "cipsafety.ssupervisor.instance_subclass",
2383 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2387 static hf_register_info hf_svalidator[] = {
2388 { &hf_cip_svalidator_sc,
2389 { "Service", "cipsafety.svalidator.sc",
2390 FT_UINT8, BASE_HEX, VALS(cip_sc_vals_svalidator), 0x7F, NULL, HFILL }
2393 { &hf_cip_svalidator_sconn_fault_count,
2394 { "Safety Connection Fault Count", "cipsafety.svalidator.sconn_fault_count",
2395 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2397 { &hf_cip_svalidator_state,
2398 { "Safety Validator State", "cipsafety.svalidator.state",
2399 FT_UINT8, BASE_DEC, VALS(cip_svalidator_state_vals), 0, NULL, HFILL }
2401 { &hf_cip_svalidator_type,
2402 { "Safety Validator Type", "cipsafety.svalidator.type",
2403 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
2405 { &hf_cip_svalidator_type_pc,
2406 { "Producer/Consumer", "cipsafety.svalidator.type.pc",
2407 FT_UINT8, BASE_HEX, VALS(cip_svalidator_type_pc_vals), 0x80, NULL, HFILL }
2409 { &hf_cip_svalidator_type_conn_type,
2410 { "Safety Connection Type", "cipsafety.svalidator.type.conn_type",
2411 FT_UINT8, BASE_DEC, VALS(cip_svalidator_type_conn_type_vals), 0x7F, NULL, HFILL }
2413 { &hf_cip_svalidator_ping_eri,
2414 { "Ping Interval EPI Multipler", "cipsafety.svalidator.ping_eri",
2415 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2417 { &hf_cip_svalidator_time_coord_msg_min_mult_size,
2418 { "Time Coord Msg Min Multiplier Size", "cipsafety.svalidator.time_coord_msg_min_mult.size",
2419 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2421 { &hf_cip_svalidator_time_coord_msg_min_mult_item,
2422 { "Time Coord Msg Min Multiplier Item", "cipsafety.svalidator.time_coord_msg_min_mult.item",
2423 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2425 { &hf_cip_svalidator_network_time_multiplier_size,
2426 { "Network Time Expectation Multipler Size", "cipsafety.svalidator.network_time_multiplier.size",
2427 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2429 { &hf_cip_svalidator_network_time_multiplier_item,
2430 { "Network Time Expectation Multipler Item", "cipsafety.svalidator.network_time_multiplier.item",
2431 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2433 { &hf_cip_svalidator_timeout_multiplier_size,
2434 { "Timeout Multiplier Size", "cipsafety.svalidator.timeout_multiplier.size",
2435 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2437 { &hf_cip_svalidator_timeout_multiplier_item,
2438 { "Timeout Multiplier Item", "cipsafety.svalidator.timeout_multiplier.item",
2439 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2441 { &hf_cip_svalidator_max_consumer_num,
2442 { "Max Consumer Number", "cipsafety.svalidator.max_consumer_num",
2443 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2445 { &hf_cip_svalidator_data_conn_inst,
2446 { "Data Connection Instance", "cipsafety.svalidator.data_conn_inst",
2447 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2449 { &hf_cip_svalidator_coordination_conn_inst_size,
2450 { "Coordination Connection Instance Size", "cipsafety.svalidator.coordination_conn_inst.size",
2451 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2453 { &hf_cip_svalidator_coordination_conn_inst_item,
2454 { "Coordination Connection Instance Item", "cipsafety.svalidator.coordination_conn_inst.item",
2455 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2457 { &hf_cip_svalidator_correction_conn_inst,
2458 { "Correction Connection Instance", "cipsafety.svalidator.correction_conn_inst",
2459 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2461 { &hf_cip_svalidator_cco_binding,
2462 { "CCO Binding", "cipsafety.svalidator.cco_binding",
2463 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2465 { &hf_cip_svalidator_max_data_age,
2466 { "Max Data Age", "cipsafety.svalidator.max_data_age",
2467 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2469 { &hf_cip_svalidator_error_code,
2470 { "Error Code", "cipsafety.svalidator.error_code",
2471 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
2473 { &hf_cip_svalidator_prod_cons_fault_count_size,
2474 { "Producer/Consumer Counter Size", "cipsafety.svalidator.prod_cons_fault_count.size",
2475 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2477 { &hf_cip_svalidator_prod_cons_fault_count_item,
2478 { "Producer/Consumer Counter Item", "cipsafety.svalidator.prod_cons_fault_count.item",
2479 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
2483 static gint *ett[] = {
2484 &ett_cip_safety,
2485 &ett_cipsafety_mode_byte,
2486 &ett_cipsafety_ack_byte,
2487 &ett_cipsafety_mcast_byte
2490 static gint *ett_ssupervisor[] = {
2491 &ett_cip_class_s_supervisor,
2492 &ett_ssupervisor_rrsc,
2493 &ett_ssupervisor_cmd_data,
2494 &ett_ssupervisor_propose_tunid,
2495 &ett_ssupervisor_propose_tunid_ssn,
2496 &ett_ssupervisor_configure_request_tunid,
2497 &ett_ssupervisor_configure_request_tunid_ssn,
2498 &ett_ssupervisor_configure_request_ounid,
2499 &ett_ssupervisor_configure_request_ounid_ssn,
2500 &ett_ssupervisor_configure_lock_tunid,
2501 &ett_ssupervisor_configure_lock_tunid_ssn,
2502 &ett_ssupervisor_reset_tunid,
2503 &ett_ssupervisor_reset_tunid_ssn,
2504 &ett_ssupervisor_apply_tunid,
2505 &ett_ssupervisor_apply_tunid_ssn,
2506 &ett_exception_detail_alarm_common,
2507 &ett_exception_detail_alarm_device,
2508 &ett_exception_detail_alarm_manufacturer,
2509 &ett_exception_detail_warning_common,
2510 &ett_exception_detail_warning_device,
2511 &ett_exception_detail_warning_manufacturer,
2512 &ett_ssupervisor_configuration_unid,
2513 &ett_ssupervisor_configuration_unid_ssn,
2514 &ett_ssupervisor_safety_configuration_id,
2515 &ett_ssupervisor_safety_configuration_id_ssn,
2516 &ett_ssupervisor_target_unid,
2517 &ett_ssupervisor_target_unid_ssn,
2518 &ett_ssupervisor_output_cp_owners,
2519 &ett_ssupervisor_output_cp_owners_ocpunid,
2520 &ett_ssupervisor_output_cp_owners_ocpunid_ssn,
2521 &ett_ssupervisor_proposed_tunid,
2522 &ett_ssupervisor_proposed_tunid_ssn,
2523 &ett_cip_ssupervisor_reset_attr_bitmap
2526 static gint *ett_svalidator[] = {
2527 &ett_cip_class_s_validator,
2528 &ett_svalidator_rrsc,
2529 &ett_svalidator_cmd_data,
2530 &ett_svalidator_type
2533 static ei_register_info ei[] = {
2534 { &ei_cipsafety_tbd2_not_complemented, { "cipsafety.tbd2_not_complemented", PI_PROTOCOL, PI_WARN, "TBD_2_bit not complemented", EXPFILL }},
2535 { &ei_cipsafety_tbd_not_copied, { "cipsafety.tbd_not_copied", PI_PROTOCOL, PI_WARN, "TBD bit not copied", EXPFILL }},
2536 { &ei_cipsafety_run_idle_not_complemented, { "cipsafety.run_idle_not_complemented", PI_PROTOCOL, PI_WARN, "Run/Idle bit not complemented", EXPFILL }},
2537 { &ei_mal_io, { "cipsafety.malformed.io", PI_MALFORMED, PI_ERROR, "Malformed CIP Safety I/O packet", EXPFILL }},
2538 { &ei_mal_sercosiii_link_error_count_p1p2, { "cipsafety.malformed.sercosiii_link.error_count_p1p2", PI_MALFORMED, PI_ERROR, "Malformed SERCOS III Attribute 5", EXPFILL }},
2539 { &ei_mal_tcpip_ssn, { "cip.malformed.tcpip.ssn", PI_MALFORMED, PI_ERROR, "Malformed TCP/IP Object Safety Network Number", EXPFILL }},
2542 static ei_register_info ei_ssupervisor[] = {
2543 { &ei_mal_ssupervisor_exception_detail_alarm_ced, { "cipsafety.ssupervisor.malformed.exception_detail_alarm.ced", PI_MALFORMED, PI_ERROR,
2544 "Malformed Safety Supervisor Exception Detail Alarm (Common Exception Detail)", EXPFILL }},
2545 { &ei_mal_ssupervisor_exception_detail_alarm_ded, { "cipsafety.ssupervisor.malformed.exception_detail_alarm.ded", PI_MALFORMED, PI_ERROR,
2546 "Malformed Safety Supervisor Exception Detail Alarm (Device Exception Detail)", EXPFILL }},
2547 { &ei_mal_ssupervisor_exception_detail_alarm_med, { "cipsafety.ssupervisor.malformed.exception_detail_alarm.med", PI_MALFORMED, PI_ERROR,
2548 "Malformed Safety Supervisor Exception Detail Alarm (Manufacturer Exception Detail)", EXPFILL }},
2549 { &ei_mal_ssupervisor_detail_warning_ced, { "cipsafety.ssupervisor.malformed.detail_warning.ced", PI_MALFORMED, PI_ERROR,
2550 "Malformed Safety Supervisor Exception Detail Warning (Common Exception Detail)", EXPFILL }},
2551 { &ei_mal_ssupervisor_detail_warning_ded, { "cipsafety.ssupervisor.malformed.detail_warning.ded", PI_MALFORMED, PI_ERROR,
2552 "Malformed Safety Supervisor Exception Detail Warning (Device Exception Detail)", EXPFILL }},
2553 { &ei_mal_ssupervisor_detail_warning_med, { "cipsafety.ssupervisor.malformed.detail_warning.med", PI_MALFORMED, PI_ERROR,
2554 "Malformed Safety Supervisor Exception Detail Warning (Manufacturer Exception Detail)", EXPFILL }},
2555 { &ei_mal_ssupervisor_configuration_unid, { "cipsafety.ssupervisor.malformed.configuration_unid", PI_MALFORMED, PI_ERROR,
2556 "Malformed Safety Supervisor Configuration UNID", EXPFILL }},
2557 { &ei_mal_ssupervisor_safety_configuration_id, { "cipsafety.ssupervisor.malformed.safety_configuration_id", PI_MALFORMED, PI_ERROR,
2558 "Malformed Safety Supervisor Safety Configuration Identifier", EXPFILL }},
2559 { &ei_mal_ssupervisor_target_unid, { "cipsafety.ssupervisor.malformed.target_unid", PI_MALFORMED, PI_ERROR,
2560 "Malformed Safety Supervisor Target UNID", EXPFILL }},
2561 { &ei_mal_ssupervisor_cp_owners, { "cipsafety.ssupervisor.malformed.cp_owners", PI_MALFORMED, PI_ERROR,
2562 "Malformed Safety Supervisor Output Connection Point Owners", EXPFILL }},
2563 { &ei_mal_ssupervisor_cp_owners_entry, { "cipsafety.ssupervisor.malformed.cp_owners.entry", PI_MALFORMED, PI_ERROR,
2564 "Malformed Safety Supervisor Output Connection Point Owners (UNID)", EXPFILL }},
2565 { &ei_mal_ssupervisor_cp_owners_app_path_size, { "cipsafety.ssupervisor.malformed.cp_owners.app_path_size", PI_MALFORMED, PI_ERROR,
2566 "Malformed Safety Supervisor Output Connection Point Owners (EPATH)", EXPFILL }},
2567 { &ei_mal_ssupervisor_proposed_tunid, { "cipsafety.ssupervisor.malformed.proposed_tunid", PI_MALFORMED, PI_ERROR,
2568 "Malformed Safety Supervisor Proposed TUNID", EXPFILL }},
2571 static ei_register_info ei_svalidator[] = {
2572 { &ei_mal_svalidator_type, { "cipsafety.ssupervisor.malformed.svalidator.type", PI_MALFORMED, PI_ERROR,
2573 "Malformed Safety Validator Type", EXPFILL }},
2574 { &ei_mal_svalidator_time_coord_msg_min_mult, { "cipsafety.ssupervisor.malformed.svalidator.time_coord_msg_min_mult", PI_MALFORMED, PI_ERROR,
2575 "Malformed Safety Validator Time Coord Msg Min Multiplier", EXPFILL }},
2576 { &ei_mal_svalidator_network_time_multiplier, { "cipsafety.ssupervisor.malformed.svalidator.network_time_multiplier", PI_MALFORMED, PI_ERROR,
2577 "Malformed Safety Validator Network Time Expectation Multiplier", EXPFILL }},
2578 { &ei_mal_svalidator_timeout_multiplier, { "cipsafety.ssupervisor.malformed.svalidator.timeout_multiplier", PI_MALFORMED, PI_ERROR,
2579 "Malformed Safety Validator Timeout Multiplier", EXPFILL }},
2580 { &ei_mal_svalidator_coordination_conn_inst, { "cipsafety.ssupervisor.malformed.svalidator.coordination_conn_inst", PI_MALFORMED, PI_ERROR,
2581 "Malformed Safety Validator Coordination Connection Instance", EXPFILL }},
2582 { &ei_mal_svalidator_prod_cons_fault_count, { "cipsafety.ssupervisor.malformed.svalidator.prod_cons_fault_count", PI_MALFORMED, PI_ERROR,
2583 "Malformed Safety Validator Produce/Consume Fault Counters", EXPFILL }},
2586 expert_module_t* expert_cip_safety;
2587 expert_module_t* expert_cip_class_s_supervisor;
2588 expert_module_t* expert_cip_class_s_validator;
2590 /* Create a CIP Safety protocol handle */
2591 proto_cipsafety = proto_register_protocol("Common Industrial Protocol, Safety", "CIP Safety", "cipsafety");
2592 proto_register_field_array(proto_cipsafety, hf, array_length(hf));
2593 proto_register_subtree_array(ett, array_length(ett));
2594 expert_cip_safety = expert_register_protocol(proto_cipsafety);
2595 expert_register_field_array(expert_cip_safety, ei, array_length(ei));
2597 register_dissector( "cipsafety", dissect_cipsafety, proto_cipsafety);
2599 /* Register CIP Safety objects */
2600 proto_cip_class_s_supervisor = proto_register_protocol("CIP Safety Supervisor",
2601 "CIPSSupervisor", "cipssupervisor");
2602 proto_register_field_array(proto_cip_class_s_supervisor, hf_ssupervisor, array_length(hf_ssupervisor));
2603 proto_register_subtree_array(ett_ssupervisor, array_length(ett_ssupervisor));
2604 expert_cip_class_s_supervisor = expert_register_protocol(proto_cip_class_s_supervisor);
2605 expert_register_field_array(expert_cip_class_s_supervisor, ei_ssupervisor, array_length(ei_ssupervisor));
2607 proto_cip_class_s_validator = proto_register_protocol("CIP Safety Validator",
2608 "CIPSValidator", "cipsvalidator");
2609 proto_register_field_array(proto_cip_class_s_validator, hf_svalidator, array_length(hf_svalidator));
2610 proto_register_subtree_array(ett_svalidator, array_length(ett_svalidator));
2611 expert_cip_class_s_validator = expert_register_protocol(proto_cip_class_s_validator);
2612 expert_register_field_array(expert_cip_class_s_validator, ei_svalidator, array_length(ei_svalidator));
2616 * Function name: proto_reg_handoff_cipsafety
2618 * Purpose: This function will setup the automatic dissection of the CIP Safety datagram,
2619 * it is called by Wireshark when the protocol is registered
2621 * Returns: void
2623 void
2624 proto_reg_handoff_cipsafety(void)
2626 dissector_handle_t cip_class_s_supervisor_handle;
2628 /* Create and register dissector handle for Safety Supervisor */
2629 cip_class_s_supervisor_handle = new_create_dissector_handle( dissect_cip_class_s_supervisor, proto_cip_class_s_supervisor );
2630 dissector_add_uint( "cip.class.iface", CI_CLS_SAFETY_SUPERVISOR, cip_class_s_supervisor_handle );
2632 /* Create and register dissector handle for Safety Validator */
2633 cip_class_s_validator_handle = new_create_dissector_handle( dissect_cip_class_s_validator, proto_cip_class_s_validator );
2634 dissector_add_uint( "cip.class.iface", CI_CLS_SAFETY_VALIDATOR, cip_class_s_validator_handle );
2635 heur_dissector_add("cip.sc", dissect_class_svalidator_heur, proto_cip_class_s_validator);
2637 proto_cip = proto_get_id_by_filter_name( "cip" );
2642 * Editor modelines - http://www.wireshark.org/tools/modelines.html
2644 * Local variables:
2645 * c-basic-offset: 3
2646 * tab-width: 8
2647 * indent-tabs-mode: nil
2648 * End:
2650 * ex: set shiftwidth=3 tabstop=8 expandtab:
2651 * :indentSize=3:tabSize=8:noTabs=true: