HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-cip.c
blob131467ee6af013a079283ddc4092a4628a923b03
1 /* packet-cip.c
2 * Routines for Common Industrial Protocol (CIP) dissection
3 * CIP Home: www.odva.org
5 * Copyright 2004
6 * Magnus Hansson <mah@hms.se>
7 * Joakim Wiberg <jow@hms.se>
9 * Added support for Connection Configuration Object
10 * ryan wamsley * Copyright 2007
12 * Object dependend services based on IOI
13 * Jan Bartels, Siempelkamp Maschinen- und Anlagenbau GmbH & Co. KG
14 * Copyright 2007
16 * Improved support for CoCo, CM, MB objects
17 * Heuristic object support for common services
18 * Michael Mann * Copyright 2011
20 * $Id$
22 * Wireshark - Network traffic analyzer
23 * By Gerald Combs <gerald@wireshark.org>
24 * Copyright 1998 Gerald Combs
26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License
28 * as published by the Free Software Foundation; either version 2
29 * of the License, or (at your option) any later version.
31 * This program is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU General Public License for more details.
36 * You should have received a copy of the GNU General Public License
37 * along with this program; if not, write to the Free Software
38 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
41 #include "config.h"
43 #include <glib.h>
45 #include <epan/packet.h>
46 #include <epan/expert.h>
47 #include <epan/wmem/wmem.h>
48 #include "packet-cip.h"
49 #include "packet-enip.h"
50 #include "packet-cipsafety.h"
51 #include "packet-mbtcp.h"
53 #define ENIP_CIP_INTERFACE 0
55 void proto_register_cip(void);
56 void proto_reg_handoff_cip(void);
58 typedef struct mr_mult_req_info {
59 guint8 service;
60 int num_services;
61 cip_req_info_t *requests;
62 } mr_mult_req_info_t;
64 static dissector_handle_t cip_class_generic_handle;
65 static dissector_handle_t cip_class_cm_handle;
66 static dissector_handle_t modbus_handle;
67 static dissector_handle_t cip_class_cco_handle;
68 static heur_dissector_list_t heur_subdissector_service;
70 /* Initialize the protocol and registered fields */
71 static int proto_cip = -1;
72 static int proto_cip_class_generic = -1;
73 static int proto_cip_class_cm = -1;
74 static int proto_cip_class_mb = -1;
75 static int proto_cip_class_cco = -1;
76 static int proto_enip = -1;
77 static int proto_modbus = -1;
79 static int hf_cip_data = -1;
80 static int hf_cip_service = -1;
81 static int hf_cip_service_code = -1;
82 static int hf_cip_reqrsp = -1;
83 static int hf_cip_epath = -1;
84 static int hf_cip_genstat = -1;
85 static int hf_cip_addstat_size = -1;
86 static int hf_cip_add_stat = -1;
87 static int hf_cip_request_path_size = -1;
89 static int hf_cip_cm_sc = -1;
90 static int hf_cip_cm_genstat = -1;
91 static int hf_cip_cm_addstat_size = -1;
92 static int hf_cip_cm_add_status = -1;
93 static int hf_cip_cm_ext_status = -1;
94 static int hf_cip_cm_priority = -1;
95 static int hf_cip_cm_tick_time = -1;
96 static int hf_cip_cm_timeout_tick = -1;
97 static int hf_cip_cm_timeout = -1;
98 static int hf_cip_cm_ot_connid = -1;
99 static int hf_cip_cm_to_connid = -1;
100 static int hf_cip_cm_conn_serial_num = -1;
101 static int hf_cip_cm_orig_serial_num = -1;
102 static int hf_cip_cm_vendor = -1;
103 static int hf_cip_cm_timeout_multiplier = -1;
104 static int hf_cip_cm_ot_rpi = -1;
105 static int hf_cip_cm_ot_net_params32 = -1;
106 static int hf_cip_cm_ot_net_params16 = -1;
107 static int hf_cip_cm_to_rpi = -1;
108 static int hf_cip_cm_to_net_params32 = -1;
109 static int hf_cip_cm_to_net_params16 = -1;
110 static int hf_cip_cm_transport_type_trigger = -1;
111 static int hf_cip_cm_conn_path_size = -1;
112 static int hf_cip_cm_ot_api = -1;
113 static int hf_cip_cm_to_api = -1;
114 static int hf_cip_cm_app_reply_size = -1;
115 static int hf_cip_cm_app_reply_data = -1;
116 static int hf_cip_cm_consumer_number = -1;
117 static int hf_cip_cm_targ_vendor_id = -1;
118 static int hf_cip_cm_targ_dev_serial_num = -1;
119 static int hf_cip_cm_targ_conn_serial_num = -1;
120 static int hf_cip_cm_initial_timestamp = -1;
121 static int hf_cip_cm_initial_rollover = -1;
122 static int hf_cip_cm_remain_path_size = -1;
123 static int hf_cip_cm_msg_req_size = -1;
124 static int hf_cip_cm_route_path_size = -1;
125 static int hf_cip_cm_fwo_con_size = -1;
126 static int hf_cip_cm_lfwo_con_size = -1;
127 static int hf_cip_cm_fwo_fixed_var = -1;
128 static int hf_cip_cm_lfwo_fixed_var = -1;
129 static int hf_cip_cm_fwo_prio = -1;
130 static int hf_cip_cm_lfwo_prio = -1;
131 static int hf_cip_cm_fwo_typ = -1;
132 static int hf_cip_cm_lfwo_typ = -1;
133 static int hf_cip_cm_fwo_own = -1;
134 static int hf_cip_cm_lfwo_own = -1;
135 static int hf_cip_cm_fwo_dir = -1;
136 static int hf_cip_cm_fwo_trigg = -1;
137 static int hf_cip_cm_fwo_class = -1;
138 static int hf_cip_cm_gco_conn = -1;
139 static int hf_cip_cm_gco_coo_conn = -1;
140 static int hf_cip_cm_gco_roo_conn = -1;
141 static int hf_cip_cm_gco_last_action = -1;
142 static int hf_cip_cm_ext112_ot_rpi_type = -1;
143 static int hf_cip_cm_ext112_to_rpi_type = -1;
144 static int hf_cip_cm_ext112_ot_rpi = -1;
145 static int hf_cip_cm_ext112_to_rpi = -1;
146 static int hf_cip_cm_ext126_size = -1;
147 static int hf_cip_cm_ext127_size = -1;
148 static int hf_cip_cm_ext128_size = -1;
150 static int hf_cip_mb_sc = -1;
151 static int hf_cip_mb_read_coils_start_addr = -1;
152 static int hf_cip_mb_read_coils_num_coils = -1;
153 static int hf_cip_mb_read_coils_data = -1;
154 static int hf_cip_mb_read_discrete_inputs_start_addr = -1;
155 static int hf_cip_mb_read_discrete_inputs_num_inputs = -1;
156 static int hf_cip_mb_read_discrete_inputs_data = -1;
157 static int hf_cip_mb_read_holding_register_start_addr = -1;
158 static int hf_cip_mb_read_holding_register_num_registers = -1;
159 static int hf_cip_mb_read_holding_register_data = -1;
160 static int hf_cip_mb_read_input_register_start_addr = -1;
161 static int hf_cip_mb_read_input_register_num_registers = -1;
162 static int hf_cip_mb_read_input_register_data = -1;
163 static int hf_cip_mb_write_coils_start_addr = -1;
164 static int hf_cip_mb_write_coils_outputs_forced = -1;
165 static int hf_cip_mb_write_coils_num_coils = -1;
166 static int hf_cip_mb_write_coils_data = -1;
167 static int hf_cip_mb_write_registers_start_addr = -1;
168 static int hf_cip_mb_write_registers_outputs_forced = -1;
169 static int hf_cip_mb_write_registers_num_registers = -1;
170 static int hf_cip_mb_write_registers_data = -1;
171 static int hf_cip_mb_data = -1;
173 static int hf_cip_cco_con_type = -1;
174 static int hf_cip_cco_ot_rtf = -1;
175 static int hf_cip_cco_to_rtf = -1;
176 static int hf_cip_cco_sc = -1;
177 static int hf_cip_cco_format_number = -1;
178 static int hf_cip_cco_edit_signature = -1;
179 static int hf_cip_cco_con_flags = -1;
180 static int hf_cip_cco_tdi_vendor = -1;
181 static int hf_cip_cco_tdi_devtype = -1;
182 static int hf_cip_cco_tdi_prodcode = -1;
183 static int hf_cip_cco_tdi_compatibility = -1;
184 static int hf_cip_cco_tdi_comp_bit = -1;
185 static int hf_cip_cco_tdi_majorrev = -1;
186 static int hf_cip_cco_tdi_minorrev = -1;
187 static int hf_cip_cco_pdi_vendor = -1;
188 static int hf_cip_cco_pdi_devtype = -1;
189 static int hf_cip_cco_pdi_prodcode = -1;
190 static int hf_cip_cco_pdi_compatibility = -1;
191 static int hf_cip_cco_pdi_comp_bit = -1;
192 static int hf_cip_cco_pdi_majorrev = -1;
193 static int hf_cip_cco_pdi_minorrev = -1;
194 static int hf_cip_cco_cs_data_index = -1;
195 static int hf_cip_cco_ot_rpi = -1;
196 static int hf_cip_cco_to_rpi = -1;
197 static int hf_cip_cco_ot_net_param16 = -1;
198 static int hf_cip_cco_to_net_param16 = -1;
199 static int hf_cip_cco_fwo_own = -1;
200 static int hf_cip_cco_fwo_typ = -1;
201 static int hf_cip_cco_fwo_prio = -1;
202 static int hf_cip_cco_fwo_fixed_var = -1;
203 static int hf_cip_cco_fwo_con_size = -1;
204 static int hf_cip_cco_ot_net_param32 = -1;
205 static int hf_cip_cco_to_net_param32 = -1;
206 static int hf_cip_cco_lfwo_own = -1;
207 static int hf_cip_cco_lfwo_typ = -1;
208 static int hf_cip_cco_lfwo_prio = -1;
209 static int hf_cip_cco_lfwo_fixed_var = -1;
210 static int hf_cip_cco_lfwo_con_size = -1;
211 static int hf_cip_cco_conn_path_size = -1;
212 static int hf_cip_cco_proxy_config_size = -1;
213 static int hf_cip_cco_target_config_size = -1;
214 static int hf_cip_cco_iomap_format_number = -1;
215 static int hf_cip_cco_iomap_size = -1;
216 static int hf_cip_cco_connection_disable = -1;
217 static int hf_cip_cco_net_conn_param_attr = -1;
218 static int hf_cip_cco_timeout_multiplier = -1;
219 static int hf_cip_cco_transport_type_trigger = -1;
220 static int hf_cip_cco_fwo_dir = -1;
221 static int hf_cip_cco_fwo_trigger = -1;
222 static int hf_cip_cco_fwo_class = -1;
223 static int hf_cip_cco_proxy_config_data = -1;
224 static int hf_cip_cco_target_config_data = -1;
225 static int hf_cip_cco_iomap_attribute = -1;
226 static int hf_cip_cco_safety = -1;
227 static int hf_cip_cco_change_type = -1;
229 static int hf_cip_path_segment = -1;
230 static int hf_cip_path_segment_type = -1;
231 static int hf_cip_port_ex_link_addr = -1;
232 static int hf_cip_port = -1;
233 static int hf_cip_link_address_size = -1;
234 static int hf_cip_link_address_byte = -1;
235 static int hf_cip_link_address_string = -1;
236 static int hf_cip_logical_seg_type = -1;
237 static int hf_cip_logical_seg_format = -1;
238 static int hf_cip_class8 = -1;
239 static int hf_cip_class16 = -1;
240 static int hf_cip_class32 = -1;
241 static int hf_cip_instance8 = -1;
242 static int hf_cip_instance16 = -1;
243 static int hf_cip_instance32 = -1;
244 static int hf_cip_member8 = -1;
245 static int hf_cip_member16 = -1;
246 static int hf_cip_member32 = -1;
247 static int hf_cip_attribute8 = -1;
248 static int hf_cip_attribute16 = -1;
249 static int hf_cip_attribute32 = -1;
250 static int hf_cip_conpoint8 = -1;
251 static int hf_cip_conpoint16 = -1;
252 static int hf_cip_conpoint32 = -1;
253 static int hf_cip_ekey_format = -1;
254 static int hf_cip_ekey_vendor = -1;
255 static int hf_cip_ekey_devtype = -1;
256 static int hf_cip_ekey_prodcode = -1;
257 static int hf_cip_ekey_compatibility = -1;
258 static int hf_cip_ekey_comp_bit = -1;
259 static int hf_cip_ekey_majorrev = -1;
260 static int hf_cip_ekey_minorrev = -1;
261 static int hf_cip_data_seg_type = -1;
262 static int hf_cip_data_seg_size = -1;
263 static int hf_cip_data_seg_item = -1;
264 static int hf_cip_symbol = -1;
265 static int hf_cip_network_seg_type = -1;
266 static int hf_cip_seg_schedule = -1;
267 static int hf_cip_seg_fixed_tag = -1;
268 static int hf_cip_seg_prod_inhibit_time = -1;
269 static int hf_cip_seg_network_size = -1;
270 static int hf_cip_seg_safety_format = -1;
271 static int hf_cip_seg_safety_reserved = -1;
272 static int hf_cip_seg_safety_configuration_crc = -1;
273 static int hf_cip_seg_safety_configuration_timestamp = -1;
274 static int hf_cip_seg_safety_configuration_date = -1;
275 static int hf_cip_seg_safety_configuration_time = -1;
276 static int hf_cip_seg_safety_time_correction_epi = -1;
277 static int hf_cip_seg_safety_time_correction_net_params = -1;
278 static int hf_cip_seg_safety_time_correction_own = -1;
279 static int hf_cip_seg_safety_time_correction_typ = -1;
280 static int hf_cip_seg_safety_time_correction_prio = -1;
281 static int hf_cip_seg_safety_time_correction_fixed_var = -1;
282 static int hf_cip_seg_safety_time_correction_con_size = -1;
283 static int hf_cip_seg_safety_tunid = -1;
284 static int hf_cip_seg_safety_tunid_ssn_timestamp = -1;
285 static int hf_cip_seg_safety_tunid_ssn_date = -1;
286 static int hf_cip_seg_safety_tunid_ssn_time = -1;
287 static int hf_cip_seg_safety_tunid_macid = -1;
288 static int hf_cip_seg_safety_ounid = -1;
289 static int hf_cip_seg_safety_ounid_ssn_timestamp = -1;
290 static int hf_cip_seg_safety_ounid_ssn_date = -1;
291 static int hf_cip_seg_safety_ounid_ssn_time = -1;
292 static int hf_cip_seg_safety_ounid_macid = -1;
293 static int hf_cip_seg_safety_ping_eri_multiplier = -1;
294 static int hf_cip_seg_safety_time_coord_msg_min_multiplier = -1;
295 static int hf_cip_seg_safety_network_time_expected_multiplier = -1;
296 static int hf_cip_seg_safety_timeout_multiplier = -1;
297 static int hf_cip_seg_safety_max_consumer_number = -1;
298 static int hf_cip_seg_safety_conn_param_crc = -1;
299 static int hf_cip_seg_safety_time_correction_conn_id = -1;
300 static int hf_cip_seg_safety_max_fault_number = -1;
301 static int hf_cip_seg_safety_init_timestamp = -1;
302 static int hf_cip_seg_safety_init_rollover = -1;
303 static int hf_cip_seg_safety_data = -1;
304 static int hf_cip_class_rev = -1;
305 static int hf_cip_class_max_inst32 = -1;
306 static int hf_cip_class_num_inst32 = -1;
307 static int hf_cip_reserved8 = -1;
308 /* static int hf_cip_reserved16 = -1; */
309 static int hf_cip_reserved24 = -1;
310 static int hf_cip_pad8 = -1;
312 static int hf_cip_sc_get_attr_list_attr_count = -1;
313 static int hf_cip_sc_get_attr_list_attr_item = -1;
314 static int hf_cip_sc_get_attr_list_attr_status = -1;
315 static int hf_cip_sc_get_attr_list_attr_data = -1;
316 static int hf_cip_sc_set_attr_list_attr_count = -1;
317 static int hf_cip_sc_set_attr_list_attr_item = -1;
318 static int hf_cip_sc_set_attr_list_attr_status = -1;
319 static int hf_cip_sc_set_attr_list_attr_data = -1;
320 static int hf_cip_sc_reset_param = -1;
321 static int hf_cip_sc_get_attribute_all_data = -1;
322 static int hf_cip_sc_set_attribute_all_data = -1;
323 static int hf_cip_sc_reset_data = -1;
324 static int hf_cip_sc_start_data = -1;
325 static int hf_cip_sc_stop_data = -1;
326 static int hf_cip_sc_create_instance = -1;
327 static int hf_cip_sc_create_data = -1;
328 static int hf_cip_sc_delete_data = -1;
329 static int hf_cip_sc_mult_serv_pack_num_services = -1;
330 static int hf_cip_sc_mult_serv_pack_offset = -1;
331 static int hf_cip_sc_mult_serv_pack_num_replies = -1;
332 static int hf_cip_sc_apply_attributes_data = -1;
333 static int hf_cip_sc_set_attr_single_data = -1;
334 static int hf_cip_sc_get_attr_single_data = -1;
335 static int hf_cip_find_next_object_max_instance = -1;
336 static int hf_cip_find_next_object_num_instances = -1;
337 static int hf_cip_find_next_object_instance_item = -1;
338 static int hf_cip_sc_restore_data = -1;
339 static int hf_cip_sc_save_data = -1;
340 static int hf_cip_sc_noop_data = -1;
341 static int hf_cip_sc_get_member_data = -1;
342 static int hf_cip_sc_set_member_data = -1;
343 static int hf_cip_sc_insert_member_data = -1;
344 static int hf_cip_sc_remove_member_data = -1;
345 static int hf_cip_sc_group_sync_is_sync = -1;
346 static int hf_cip_sc_group_sync_data = -1;
348 /* Parsed Attributes */
349 static int hf_id_vendor_id = -1;
350 static int hf_id_device_type = -1;
351 static int hf_id_produce_code = -1;
352 static int hf_id_major_rev = -1;
353 static int hf_id_minor_rev = -1;
354 static int hf_id_status = -1;
355 static int hf_id_serial_number = -1;
356 static int hf_id_product_name = -1;
357 static int hf_msg_rout_num_classes = -1;
358 static int hf_msg_rout_classes = -1;
359 static int hf_msg_rout_num_available = -1;
360 static int hf_msg_rout_num_active = -1;
361 static int hf_msg_rout_active_connections = -1;
362 static int hf_conn_mgr_open_requests = -1;
363 static int hf_conn_mgr_open_format_rejects = -1;
364 static int hf_conn_mgr_open_resource_rejects = -1;
365 static int hf_conn_mgr_other_open_rejects = -1;
366 static int hf_conn_mgr_close_requests = -1;
367 static int hf_conn_close_format_requests = -1;
368 static int hf_conn_mgr_close_other_requests = -1;
369 static int hf_conn_mgr_conn_timouts = -1;
370 static int hf_time_sync_ptp_enable = -1;
371 static int hf_time_sync_is_synchronized = -1;
372 static int hf_time_sync_sys_time_micro = -1;
373 static int hf_time_sync_sys_time_nano = -1;
374 static int hf_time_sync_offset_from_master = -1;
375 static int hf_time_sync_max_offset_from_master = -1;
376 static int hf_time_sync_mean_path_delay_to_master = -1;
377 static int hf_time_sync_gm_clock_clock_id = -1;
378 static int hf_time_sync_gm_clock_clock_class = -1;
379 static int hf_time_sync_gm_clock_time_accuracy = -1;
380 static int hf_time_sync_gm_clock_offset_scaled_log_variance = -1;
381 static int hf_time_sync_gm_clock_current_utc_offset = -1;
382 static int hf_time_sync_gm_clock_time_property_flags = -1;
383 static int hf_time_sync_gm_clock_time_property_flags_leap61 = -1;
384 static int hf_time_sync_gm_clock_time_property_flags_leap59 = -1;
385 static int hf_time_sync_gm_clock_time_property_flags_current_utc_valid = -1;
386 static int hf_time_sync_gm_clock_time_property_flags_ptp_timescale = -1;
387 static int hf_time_sync_gm_clock_time_property_flags_time_traceable = -1;
388 static int hf_time_sync_gm_clock_time_property_flags_freq_traceable = -1;
389 static int hf_time_sync_gm_clock_time_source = -1;
390 static int hf_time_sync_gm_clock_priority1 = -1;
391 static int hf_time_sync_gm_clock_priority2 = -1;
392 static int hf_time_sync_parent_clock_clock_id = -1;
393 static int hf_time_sync_parent_clock_port_number = -1;
394 static int hf_time_sync_parent_clock_observed_offset_scaled_log_variance = -1;
395 static int hf_time_sync_parent_clock_observed_phase_change_rate = -1;
396 static int hf_time_sync_local_clock_clock_id = -1;
397 static int hf_time_sync_local_clock_clock_class = -1;
398 static int hf_time_sync_local_clock_time_accuracy = -1;
399 static int hf_time_sync_local_clock_offset_scaled_log_variance = -1;
400 static int hf_time_sync_local_clock_current_utc_offset = -1;
401 static int hf_time_sync_local_clock_time_property_flags = -1;
402 static int hf_time_sync_local_clock_time_property_flags_leap61 = -1;
403 static int hf_time_sync_local_clock_time_property_flags_leap59 = -1;
404 static int hf_time_sync_local_clock_time_property_flags_current_utc_valid = -1;
405 static int hf_time_sync_local_clock_time_property_flags_ptp_timescale = -1;
406 static int hf_time_sync_local_clock_time_property_flags_time_traceable = -1;
407 static int hf_time_sync_local_clock_time_property_flags_freq_traceable = -1;
408 static int hf_time_sync_local_clock_time_source = -1;
409 static int hf_time_sync_num_ports = -1;
410 static int hf_time_sync_port_state_info_num_ports = -1;
411 static int hf_time_sync_port_state_info_port_num = -1;
412 static int hf_time_sync_port_state_info_port_state = -1;
413 static int hf_time_sync_port_enable_cfg_num_ports = -1;
414 static int hf_time_sync_port_enable_cfg_port_num = -1;
415 static int hf_time_sync_port_enable_cfg_port_enable = -1;
416 static int hf_time_sync_port_log_announce_num_ports = -1;
417 static int hf_time_sync_port_log_announce_port_num = -1;
418 static int hf_time_sync_port_log_announce_interval = -1;
419 static int hf_time_sync_port_log_sync_num_ports = -1;
420 static int hf_time_sync_port_log_sync_port_num = -1;
421 static int hf_time_sync_port_log_sync_port_log_sync_interval = -1;
422 static int hf_time_sync_priority1 = -1;
423 static int hf_time_sync_priority2 = -1;
424 static int hf_time_sync_domain_number = -1;
425 static int hf_time_sync_clock_type = -1;
426 static int hf_time_sync_clock_type_ordinary = -1;
427 static int hf_time_sync_clock_type_boundary = -1;
428 static int hf_time_sync_clock_type_end_to_end = -1;
429 static int hf_time_sync_clock_type_management = -1;
430 static int hf_time_sync_clock_type_slave_only = -1;
431 static int hf_time_sync_manufacture_id_oui = -1;
432 static int hf_time_sync_manufacture_id_reserved = -1;
433 static int hf_time_sync_prod_desc_size = -1;
434 static int hf_time_sync_prod_desc_str = -1;
435 static int hf_time_sync_revision_data_size = -1;
436 static int hf_time_sync_revision_data_str = -1;
437 static int hf_time_sync_user_desc_size = -1;
438 static int hf_time_sync_user_desc_str = -1;
439 static int hf_time_sync_port_profile_id_info_num_ports = -1;
440 static int hf_time_sync_port_profile_id_info_port_num = -1;
441 static int hf_time_sync_port_profile_id_info_profile_id = -1;
442 static int hf_time_sync_port_phys_addr_info_num_ports = -1;
443 static int hf_time_sync_port_phys_addr_info_port_num = -1;
444 static int hf_time_sync_port_phys_addr_info_phys_proto = -1;
445 static int hf_time_sync_port_phys_addr_info_addr_size = -1;
446 /* static int hf_time_sync_port_phys_addr_info_phys_addr = -1; */
447 static int hf_time_sync_port_proto_addr_info_num_ports = -1;
448 static int hf_time_sync_port_proto_addr_info_port_num = -1;
449 static int hf_time_sync_port_proto_addr_info_network_proto = -1;
450 static int hf_time_sync_port_proto_addr_info_addr_size = -1;
451 static int hf_time_sync_port_proto_addr_info_port_proto_addr = -1;
452 static int hf_time_sync_steps_removed = -1;
453 static int hf_time_sync_sys_time_and_offset_time = -1;
454 static int hf_time_sync_sys_time_and_offset_offset = -1;
456 /* Initialize the subtree pointers */
457 static gint ett_cip = -1;
458 static gint ett_cip_class_generic = -1;
459 static gint ett_cip_class_cm = -1;
460 static gint ett_cip_class_mb = -1;
461 static gint ett_cip_class_cco = -1;
463 static gint ett_path = -1;
464 static gint ett_path_seg = -1;
465 static gint ett_ekey_path = -1;
466 static gint ett_mcsc = -1;
467 static gint ett_cia_path = -1;
468 static gint ett_data_seg = -1;
469 static gint ett_data_seg_data = -1;
470 static gint ett_port_path = -1;
471 static gint ett_network_seg = -1;
472 static gint ett_network_seg_safety = -1;
473 static gint ett_network_seg_safety_time_correction_net_params = -1;
474 static gint ett_cip_seg_safety_tunid = -1;
475 static gint ett_cip_seg_safety_tunid_ssn = -1;
476 static gint ett_cip_seg_safety_ounid = -1;
477 static gint ett_cip_seg_safety_ounid_ssn = -1;
479 static gint ett_rrsc = -1;
480 static gint ett_status_item = -1;
481 static gint ett_add_status_item = -1;
482 static gint ett_cmd_data = -1;
484 static gint ett_cip_get_attribute_list = -1;
485 static gint ett_cip_get_attribute_list_item = -1;
486 static gint ett_cip_set_attribute_list = -1;
487 static gint ett_cip_set_attribute_list_item = -1;
488 static gint ett_cip_mult_service_packet = -1;
490 static gint ett_cm_rrsc = -1;
491 static gint ett_cm_ncp = -1;
492 static gint ett_cm_mes_req = -1;
493 static gint ett_cm_cmd_data = -1;
494 static gint ett_cm_ttt = -1;
495 static gint ett_cm_add_status_item = -1;
496 static gint ett_cip_cm_pid = -1;
497 static gint ett_cip_cm_safety = -1;
499 static gint ett_mb_rrsc = -1;
500 static gint ett_mb_cmd_data = -1;
502 static gint ett_cco_iomap = -1;
503 static gint ett_cco_con_status = -1;
504 static gint ett_cco_con_flag = -1;
505 static gint ett_cco_tdi = -1;
506 static gint ett_cco_pdi = -1;
507 static gint ett_cco_ncp = -1;
508 static gint ett_cco_rrsc = -1;
509 static gint ett_cco_cmd_data = -1;
510 static gint ett_cco_ttt = -1;
512 static gint ett_time_sync_gm_clock_flags = -1;
513 static gint ett_time_sync_local_clock_flags = -1;
514 static gint ett_time_sync_port_state_info = -1;
515 static gint ett_time_sync_port_enable_cfg = -1;
516 static gint ett_time_sync_port_log_announce = -1;
517 static gint ett_time_sync_port_log_sync = -1;
518 static gint ett_time_sync_clock_type = -1;
519 static gint ett_time_sync_port_profile_id_info = -1;
520 static gint ett_time_sync_port_phys_addr_info = -1;
521 static gint ett_time_sync_port_proto_addr_info = -1;
523 static expert_field ei_mal_identity_revision = EI_INIT;
524 static expert_field ei_mal_msg_rout_num_classes = EI_INIT;
525 static expert_field ei_mal_time_sync_gm_clock = EI_INIT;
526 static expert_field ei_mal_time_sync_parent_clock = EI_INIT;
527 static expert_field ei_mal_time_sync_local_clock = EI_INIT;
528 static expert_field ei_mal_time_sync_port_state_info = EI_INIT;
529 static expert_field ei_mal_time_sync_port_state_info_ports = EI_INIT;
530 static expert_field ei_mal_time_sync_port_enable_cfg = EI_INIT;
531 static expert_field ei_mal_time_sync_port_enable_cfg_ports = EI_INIT;
532 static expert_field ei_mal_time_sync_port_log_announce = EI_INIT;
533 static expert_field ei_mal_time_sync_port_log_announce_ports = EI_INIT;
534 static expert_field ei_mal_time_sync_port_log_sync = EI_INIT;
535 static expert_field ei_mal_time_sync_port_log_sync_ports = EI_INIT;
536 static expert_field ei_mal_time_sync_clock_type = EI_INIT;
537 static expert_field ei_mal_time_sync_manufacture_id = EI_INIT;
538 static expert_field ei_mal_time_sync_prod_desc = EI_INIT;
539 static expert_field ei_mal_time_sync_prod_desc_64 = EI_INIT;
540 static expert_field ei_mal_time_sync_prod_desc_size = EI_INIT;
541 static expert_field ei_mal_time_sync_revision_data = EI_INIT;
542 static expert_field ei_mal_time_sync_revision_data_32 = EI_INIT;
543 static expert_field ei_mal_time_sync_revision_data_size = EI_INIT;
544 static expert_field ei_mal_time_sync_user_desc = EI_INIT;
545 static expert_field ei_mal_time_sync_user_desc_128 = EI_INIT;
546 static expert_field ei_mal_time_sync_user_desc_size = EI_INIT;
547 static expert_field ei_mal_time_sync_port_profile_id_info = EI_INIT;
548 static expert_field ei_mal_time_sync_port_profile_id_info_ports = EI_INIT;
549 static expert_field ei_mal_time_sync_port_phys_addr_info = EI_INIT;
550 static expert_field ei_mal_time_sync_port_phys_addr_info_ports = EI_INIT;
551 static expert_field ei_mal_time_sync_port_proto_addr_info = EI_INIT;
552 static expert_field ei_mal_time_sync_port_proto_addr_info_ports = EI_INIT;
553 static expert_field ei_mal_time_sync_sys_time_and_offset = EI_INIT;
554 static expert_field ei_proto_log_seg_format = EI_INIT;
555 static expert_field ei_mal_incomplete_epath = EI_INIT;
556 static expert_field ei_proto_electronic_key_format = EI_INIT;
557 static expert_field ei_proto_special_segment_format = EI_INIT;
558 static expert_field ei_proto_log_seg_type = EI_INIT;
559 static expert_field ei_proto_log_sub_seg_type = EI_INIT;
560 static expert_field ei_proto_seg_type = EI_INIT;
561 static expert_field ei_proto_unsupported_datatype = EI_INIT;
562 static expert_field ei_mal_serv_gal = EI_INIT;
563 static expert_field ei_mal_serv_gal_count = EI_INIT;
564 static expert_field ei_mal_serv_sal = EI_INIT;
565 static expert_field ei_mal_serv_sal_count = EI_INIT;
566 static expert_field ei_mal_msp_services = EI_INIT;
567 static expert_field ei_mal_msp_inv_offset = EI_INIT;
568 static expert_field ei_mal_msp_missing_services = EI_INIT;
569 static expert_field ei_mal_msp_resp_offset = EI_INIT;
570 static expert_field ei_mal_serv_find_next_object = EI_INIT;
571 static expert_field ei_mal_serv_find_next_object_count = EI_INIT;
572 static expert_field ei_mal_rpi_no_data = EI_INIT;
573 static expert_field ei_mal_inv_config_size = EI_INIT;
574 static expert_field ei_mal_ot_size = EI_INIT;
575 static expert_field ei_mal_to_size = EI_INIT;
578 dissector_table_t subdissector_class_table;
579 static dissector_table_t subdissector_symbol_table;
581 /* Translate function to string - CIP Service codes */
582 static const value_string cip_sc_vals[] = {
583 GENERIC_SC_LIST
585 { 0, NULL }
588 /* Translate function to string - CIP Service codes for CM */
589 static const value_string cip_sc_vals_cm[] = {
590 GENERIC_SC_LIST
592 /* Some class specific services */
593 { SC_CM_FWD_CLOSE, "Forward Close" },
594 { SC_CM_FWD_OPEN, "Forward Open" },
595 { SC_CM_UNCON_SEND, "Unconnected Send" },
596 { SC_CM_LARGE_FWD_OPEN, "Large Forward Open" },
597 { SC_CM_GET_CONN_OWNER, "Get Connection Owner" },
599 { 0, NULL }
602 /* Translate function to string - CIP Service codes for MB */
603 static const value_string cip_sc_vals_mb[] = {
604 GENERIC_SC_LIST
606 /* Some class specific services */
607 { SC_MB_READ_DISCRETE_INPUTS, "Read Discrete" },
608 { SC_MB_READ_COILS, "Read Coils" },
609 { SC_MB_READ_INPUT_REGISTERS, "Read Input Registers" },
610 { SC_MB_READ_HOLDING_REGISTERS, "Read Holding Registers" },
611 { SC_MB_WRITE_COILS, "Write Coils" },
612 { SC_MB_WRITE_HOLDING_REGISTERS, "Write Holding Registers" },
613 { SC_MB_PASSTHROUGH, "Modbus Passthrough" },
615 { 0, NULL }
618 /* Translate function to string - CIP Service codes for CCO */
619 static const value_string cip_sc_vals_cco[] = {
620 GENERIC_SC_LIST
622 /* Some class specific services */
623 { SC_CCO_KICK_TIMER, "Kick Timer" },
624 { SC_CCO_OPEN_CONN, "Open Connection" },
625 { SC_CCO_CLOSE_CONN, "Close Connection" },
626 { SC_CCO_STOP_CONN, "Stop Connection" },
627 { SC_CCO_CHANGE_START, "Change Start" },
628 { SC_CCO_GET_STATUS, "Get Status" },
629 { SC_CCO_CHANGE_COMPLETE, "Change Complete" },
630 { SC_CCO_AUDIT_CHANGE, "Audit Changes" },
632 { 0, NULL }
635 /* Translate function to string - CIP Request/Response */
636 const value_string cip_sc_rr[] = {
637 { 0, "Request" },
638 { 1, "Response" },
640 { 0, NULL }
643 /* Translate function to string - Compatibility */
644 static const value_string cip_com_bit_vals[] = {
645 { 0, "Bit Cleared" },
646 { 1, "Bit Set" },
648 { 0, NULL }
651 const value_string cip_reset_type_vals[] = {
652 { 0, "Cycle Power" },
653 { 1, "Factory Default" },
654 { 2, "Keep Communication Parameters" },
656 { 0, NULL }
659 /* Translate function to string - Connection priority */
660 static const value_string cip_con_prio_vals[] = {
661 { 0, "Low Priority" },
662 { 1, "High Priority" },
663 { 2, "Scheduled" },
664 { 3, "Urgent" },
666 { 0, NULL }
669 /* Translate function to string - Connection size fixed or variable */
670 static const value_string cip_con_fw_vals[] = {
671 { 0, "Fixed" },
672 { 1, "Variable" },
674 { 0, NULL }
677 /* Translate function to string - Connection owner */
678 static const value_string cip_con_owner_vals[] = {
679 { 0, "Exclusive" },
680 { 1, "Redundant" },
682 { 0, NULL }
685 /* Translate function to string - Connection direction */
686 static const value_string cip_con_dir_vals[] = {
687 { 0, "Client" },
688 { 1, "Server" },
690 { 0, NULL }
693 /* Translate function to string - Connection type*/
694 static const value_string cip_con_vals[] = {
695 { 0, "Originator" },
696 { 1, "Target" },
698 { 0, NULL }
701 /* Translate function to string - Production trigger */
702 static const value_string cip_con_trigg_vals[] = {
703 { 0, "Cyclic" },
704 { 1, "Change-Of-State" },
705 { 2, "Application Object" },
707 { 0, NULL }
710 /* Translate function to string - Transport class */
711 static const value_string cip_con_class_vals[] = {
712 { 0, "0" },
713 { 1, "1" },
714 { 2, "2" },
715 { 3, "3" },
717 { 0, NULL }
720 /* Translate function to string - Connection type */
721 static const value_string cip_con_type_vals[] = {
722 { CONN_TYPE_NULL, "Null" },
723 { CONN_TYPE_MULTICAST, "Multicast" },
724 { CONN_TYPE_P2P, "Point to Point" },
725 { CONN_TYPE_RESERVED, "Reserved" },
727 { 0, NULL }
730 /* Translate function to string - Timeout Multiplier */
731 static const value_string cip_con_time_mult_vals[] = {
732 { 0, "*4" },
733 { 1, "*8" },
734 { 2, "*16" },
735 { 3, "*32" },
736 { 4, "*64" },
737 { 5, "*128" },
738 { 6, "*256" },
739 { 7, "*512" },
741 { 0, NULL }
744 /* Translate function to string - Connection Last Action */
745 static const value_string cip_con_last_action_vals[] = {
746 { 0, "No Owner" },
747 { 1, "Owner Is Idle Mode" },
748 { 2, "Owner Is Run Mode" },
749 { 255, "Implementation not supported" },
751 { 0, NULL }
754 /* Translate function to string - real time transfer format type */
755 static const value_string cip_con_rtf_vals[] = {
756 { 0, "32-bit Header" },
757 { 1, "Zero data length idle mode"},
758 { 2, "Modeless" },
759 { 3, "Heartbeat" },
760 { 5, "Safety" },
762 { 0, NULL }
765 /* Translate function to string - CCO change type */
766 static const value_string cip_cco_change_type_vals[] = {
767 { 0, "Full" },
768 { 1, "Incremental" },
770 { 0, NULL }
773 static const value_string cip_time_sync_clock_class_vals[] = {
774 { 6, "Primary Reference" },
775 { 7, "Primary Reference (Hold)" },
776 { 52, "Degraded Reference A (Master only)" },
777 { 187, "Degraded Reference B (Master/Slave)" },
778 { 248, "Default" },
779 { 255, "Slave Only" },
781 { 0, NULL }
784 static const value_string cip_time_sync_time_accuracy_vals[] = {
785 { 0x20, "Accurate to within 25ns" },
786 { 0x21, "Accurate to within 100ns" },
787 { 0x22, "Accurate to within 250ns" },
788 { 0x23, "Accurate to within 1us" },
789 { 0x24, "Accurate to within 2.5us" },
790 { 0x25, "Accurate to within 10us" },
791 { 0x26, "Accurate to within 25us" },
792 { 0x27, "Accurate to within 100us" },
793 { 0x28, "Accurate to within 250us" },
794 { 0x29, "Accurate to within 1ms" },
795 { 0x2A, "Accurate to within 2.5ms" },
796 { 0x2B, "Accurate to within 10ms" },
797 { 0x2C, "Accurate to within 25ms" },
798 { 0x2D, "Accurate to within 100ms" },
799 { 0x2E, "Accurate to within 250ms" },
800 { 0x2F, "Accurate to within 1s" },
801 { 0x30, "Accurate to within 10s" },
802 { 0x31, "Accurate to >10s" },
803 { 0, NULL }
806 static const value_string cip_time_sync_time_source_vals[] = {
807 { 0x10, "Atomic Clock" },
808 { 0x20, "GPS" },
809 { 0x30, "Terrestrial Radio" },
810 { 0x40, "PTP" },
811 { 0x50, "NTP" },
812 { 0x60, "Hand Set" },
813 { 0x90, "Other" },
814 { 0xA0, "Internal Oscillator" },
815 { 0, NULL }
818 static const value_string cip_time_sync_port_state_vals[] = {
819 { 1, "INITIALIZING" },
820 { 2, "FAULTY" },
821 { 3, "DISABLED" },
822 { 4, "LISTENING" },
823 { 5, "PRE_MASTER" },
824 { 6, "MASTER" },
825 { 7, "PASSIVE" },
826 { 8, "UNCALIBRATED" },
827 { 9, "SLAVE" },
828 { 0, NULL }
831 static const value_string cip_time_sync_network_protocol_vals[] = {
832 { 1, "UDP/IPv4" },
833 { 2, "UDP/IPv6" },
834 { 3, "IEEE 802.3" },
835 { 4, "DeviceNet" },
836 { 5, "ControlNet" },
837 { 0xFFFF, "Local or Unknown protocol" },
838 { 0, NULL }
842 static const value_string cip_path_seg_vals[] = {
843 { ((CI_PORT_SEGMENT>>5)&7), "Port Segment" },
844 { ((CI_LOGICAL_SEGMENT>>5)&7), "Logical Segment" },
845 { ((CI_NETWORK_SEGMENT>>5)&7), "Network Segment" },
846 { ((CI_SYMBOLIC_SEGMENT>>5)&7), "Symbolic Segment" },
847 { ((CI_DATA_SEGMENT>>5)&7), "Data Segment" },
848 { 5, "Constructed Data Type" },
849 { 6, "Elementary Data Type" },
850 { 7, "Reserved" },
852 { 0, NULL }
855 static const value_string cip_logical_segment_type_vals[] = {
856 { ((CI_LOGICAL_SEG_CLASS_ID>>2)&7), "Class ID" },
857 { ((CI_LOGICAL_SEG_INST_ID>>2)&7), "Instance ID" },
858 { ((CI_LOGICAL_SEG_MBR_ID>>2)&7), "Member ID" },
859 { ((CI_LOGICAL_SEG_CON_POINT>>2)&7), "Connection Point" },
860 { ((CI_LOGICAL_SEG_ATTR_ID>>2)&7), "Attribute ID" },
861 { ((CI_LOGICAL_SEG_SPECIAL>>2)&7), "Special" },
862 { ((CI_LOGICAL_SEG_SERV_ID>>2)&7), "Service ID" },
863 { ((CI_LOGICAL_SEG_RES_1>>2)&7), "Reserved" },
865 { 0, NULL }
868 static const value_string cip_logical_segment_format_vals[] = {
869 { CI_LOGICAL_SEG_8_BIT, "8-bit Logical Segment" },
870 { CI_LOGICAL_SEG_16_BIT, "16-bit Logical Segment" },
871 { CI_LOGICAL_SEG_32_BIT, "32-bit Logical Segment" },
872 { CI_LOGICAL_SEG_RES_2, "Reserved" },
874 { 0, NULL }
877 static const value_string cip_logical_seg_vals[] = {
878 {((CI_LOGICAL_SEG_CLASS_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_8_BIT), "8-Bit Class Segment"},
879 {((CI_LOGICAL_SEG_CLASS_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_16_BIT), "16-Bit Class Segment"},
880 {((CI_LOGICAL_SEG_CLASS_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_32_BIT), "32-Bit Class Segment"},
882 {((CI_LOGICAL_SEG_INST_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_8_BIT), "8-Bit Instance Segment"},
883 {((CI_LOGICAL_SEG_INST_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_16_BIT), "16-Bit Instance Segment"},
884 {((CI_LOGICAL_SEG_INST_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_32_BIT), "32-Bit Instance Segment"},
886 {((CI_LOGICAL_SEG_MBR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_8_BIT), "8-Bit Member Segment"},
887 {((CI_LOGICAL_SEG_MBR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_16_BIT), "16-Bit Member Segment"},
888 {((CI_LOGICAL_SEG_MBR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_32_BIT), "32-Bit Member Segment"},
890 {((CI_LOGICAL_SEG_CON_POINT & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_8_BIT), "8-Bit Connection Point Segment"},
891 {((CI_LOGICAL_SEG_CON_POINT & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_16_BIT), "16-Bit Connection Point Segment"},
892 {((CI_LOGICAL_SEG_CON_POINT & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_32_BIT), "32-Bit Connection Point Segment"},
894 {((CI_LOGICAL_SEG_ATTR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_8_BIT), "8-Bit Attribute Segment"},
895 {((CI_LOGICAL_SEG_ATTR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_16_BIT), "16-Bit Attribute Segment"},
896 {((CI_LOGICAL_SEG_ATTR_ID & CI_LOGICAL_SEG_TYPE_MASK)|CI_LOGICAL_SEG_32_BIT), "32-Bit Attribute Segment"},
898 {CI_LOGICAL_SEG_SPECIAL, "Electronic Key Segment"},
900 { 0, NULL }
903 static const value_string cip_data_segment_type_vals[] = {
904 {CI_DATA_SEG_SIMPLE, "Simple Data Segment"},
905 {CI_DATA_SEG_SYMBOL, "ANSI Extended Symbol Segment"},
907 { 0, NULL }
910 static const value_string cip_network_segment_type_vals[] = {
911 {CI_NETWORK_SEG_SCHEDULE, "Schedule Segment"},
912 {CI_NETWORK_SEG_FIXED_TAG, "Fixed Tag Segment"},
913 {CI_NETWORK_SEG_PROD_INHI, "Production Inhibit Time"},
914 {CI_NETWORK_SEG_SAFETY, "Safety Segment"},
915 {CI_NETWORK_SEG_EXTENDED, "Extended Network Segment"},
917 { 0, NULL }
920 static const value_string cip_safety_segment_format_type_vals[] = {
921 {0, "Target Format"},
922 {1, "Router Format"},
923 {2, "Extended Format"},
925 { 0, NULL }
928 static const value_string cip_cm_rpi_type_vals[] = {
929 {0, "RPI acceptable"},
930 {1, "Unspecified"},
931 {2, "Minimum acceptable RPI"},
932 {3, "Maximum acceptable RPI"},
933 {4, "Required RPI to correct mismatch"},
935 { 0, NULL }
938 /* Translate function to string - CIP General Status codes */
939 static const value_string cip_gs_vals[] = {
940 { CI_GRC_SUCCESS, "Success" },
941 { CI_GRC_FAILURE, "Connection failure" },
942 { CI_GRC_NO_RESOURCE, "Resource unavailable" },
943 { CI_GRC_BAD_DATA, "Invalid parameter value" },
944 { CI_GRC_BAD_PATH, "Path segment error" },
945 { CI_GRC_BAD_CLASS_INSTANCE, "Path destination unknown" },
946 { CI_GRC_PARTIAL_DATA, "Partial transfer" },
947 { CI_GRC_CONN_LOST, "Connection lost" },
948 { CI_GRC_BAD_SERVICE, "Service not supported" },
949 { CI_GRC_BAD_ATTR_DATA, "Invalid attribute value" },
950 { CI_GRC_ATTR_LIST_ERROR, "Attribute list error" },
951 { CI_GRC_ALREADY_IN_MODE, "Already in requested mode/state" },
952 { CI_GRC_BAD_OBJ_MODE, "Object state conflict" },
953 { CI_GRC_OBJ_ALREADY_EXISTS, "Object already exists" },
954 { CI_GRC_ATTR_NOT_SETTABLE, "Attribute not settable" },
955 { CI_GRC_PERMISSION_DENIED, "Privilege violation" },
956 { CI_GRC_DEV_IN_WRONG_STATE, "Device state conflict" },
957 { CI_GRC_REPLY_DATA_TOO_LARGE,"Reply data too large" },
958 { CI_GRC_FRAGMENT_PRIMITIVE, "Fragmentation of a primitive value" },
959 { CI_GRC_CONFIG_TOO_SMALL, "Not enough data" },
960 { CI_GRC_UNDEFINED_ATTR, "Attribute not supported" },
961 { CI_GRC_CONFIG_TOO_BIG, "Too much data" },
962 { CI_GRC_OBJ_DOES_NOT_EXIST, "Object does not exist" },
963 { CI_GRC_NO_FRAGMENTATION, "Service fragmentation sequence not in progress" },
964 { CI_GRC_DATA_NOT_SAVED, "No stored attribute data" },
965 { CI_GRC_DATA_WRITE_FAILURE, "Store operation failure" },
966 { CI_GRC_REQUEST_TOO_LARGE, "Routing failure, request packet too large" },
967 { CI_GRC_RESPONSE_TOO_LARGE, "Routing failure, response packet too large" },
968 { CI_GRC_MISSING_LIST_DATA, "Missing attribute list entry data" },
969 { CI_GRC_INVALID_LIST_STATUS, "Invalid attribute value list" },
970 { CI_GRC_SERVICE_ERROR, "Embedded service error" },
971 { CI_GRC_CONN_RELATED_FAILURE,"Vendor specific error" },
972 { CI_GRC_INVALID_PARAMETER, "Invalid parameter" },
973 { CI_GRC_WRITE_ONCE_FAILURE, "Write-once value or medium already written" },
974 { CI_GRC_INVALID_REPLY, "Invalid reply received" },
975 { CI_GRC_BUFFER_OVERFLOW, "Buffer overflow" },
976 { CI_GRC_MESSAGE_FORMAT, "Invalid message format" },
977 { CI_GRC_BAD_KEY_IN_PATH, "Key failure in path" },
978 { CI_GRC_BAD_PATH_SIZE, "Path size invalid" },
979 { CI_GRC_UNEXPECTED_ATTR, "Unexpected attribute in list" },
980 { CI_GRC_INVALID_MEMBER, "Invalid Member ID" },
981 { CI_GRC_MEMBER_NOT_SETTABLE, "Member not settable" },
982 { CI_GRC_G2_SERVER_FAILURE, "Group 2 only server general failure" },
983 { CI_GRC_UNKNOWN_MB_ERROR, "Unknown Modbus error" },
984 { CI_GRC_ATTRIBUTE_NOT_GET, "Attribute not gettable" },
986 { 0, NULL }
989 value_string_ext cip_gs_vals_ext = VALUE_STRING_EXT_INIT(cip_gs_vals);
991 /* Connection Manager Extended Status codes */
992 #define CM_ES_DUP_FWD_OPEN 0x100
993 #define CM_ES_CLASS_AND_TRIGGER 0x103
994 #define CM_ES_OWNERSHIP_CONFLICT 0x106
995 #define CM_ES_TARGET_CONN_NOT_FOUND 0x107
996 #define CM_ES_INVALID_NET_CONN_PARAM 0x108
997 #define CM_ES_INVALID_CONNECTION_SIZE 0x109
998 #define CM_ES_TARGET_CONNECTION_NOT_CONFIGURED 0x110
999 #define CM_ES_RPI_NOT_SUPPORTED 0x111
1000 #define CM_ES_RPI_NOT_ACCEPTABLE 0x112
1001 #define CM_ES_OUT_OF_CONNECTIONS 0x113
1002 #define CM_ES_VENDOR_ID_OR_PRODUCT_CODE_MISMATCH 0x114
1003 #define CM_ES_DEVICE_TYPE_MISMATCH 0x115
1004 #define CM_ES_REVISION_MISMATCH 0x116
1005 #define CM_ES_INVALID_PROD_CONS_APP_PATH 0x117
1006 #define CM_ES_INVALID_OR_INCONSISTENT_CONF_APP_PATH 0x118
1007 #define CM_ES_NON_LISTEN_ONLY_CONN_NOT_OPENED 0x119
1008 #define CM_ES_TARGET_OBJECT_OUT_OF_CONNECTIONS 0x11A
1009 #define CM_ES_RPI_SMALLER_THAN_PROD_INHIBIT_TIME 0x11B
1010 #define CM_ES_TRANSPORT_CLASS_NOT_SUPPORTED 0x11C
1011 #define CM_ES_PRODUCTION_TRIGGER_NOT_SUPPORTED 0x11D
1012 #define CM_ES_DIRECTION_NOT_SUPPORTED 0x11E
1013 #define CM_ES_INVALID_OT_NET_CONN_FIX_VAR 0x11F
1014 #define CM_ES_INVALID_TO_NET_CONN_FIX_VAR 0x120
1015 #define CM_ES_INVALID_OT_NET_CONN_PRIORITY 0x121
1016 #define CM_ES_INVALID_TO_NET_CONN_PRIORITY 0x122
1017 #define CM_ES_INVALID_OT_NET_CONN_TYPE 0x123
1018 #define CM_ES_INVALID_TO_NET_CONN_TYPE 0x124
1019 #define CM_ES_INVALID_OT_NET_CONN_REDUNDANT_OWNER 0x125
1020 #define CM_ES_INVALID_CONFIGURATION_SIZE 0x126
1021 #define CM_ES_INVALID_OT_SIZE 0x127
1022 #define CM_ES_INVALID_TO_SIZE 0x128
1023 #define CM_ES_INVALID_CONFIGURATION_APP_PATH 0x129
1024 #define CM_ES_INVALID_CONSUMING_APP_PATH 0x12A
1025 #define CM_ES_INVALID_PRODUCING_APP_PATH 0x12B
1026 #define CM_ES_CONFIGURATION_SYMBOL_NOT_EXIST 0x12C
1027 #define CM_ES_CONSUMING_SYMBOL_NOT_EXIST 0x12D
1028 #define CM_ES_PRODUCING_SYMBOL_NOT_EXIST 0x12E
1029 #define CM_ES_INCONSISTENT_APP_PATH_COMBO 0x12F
1030 #define CM_ES_INCONSISTENT_CONSUME_DATA_FORMAT 0x130
1031 #define CM_ES_INCONSISTENT_PRODUCE_DATA_FORMAT 0x131
1032 #define CM_ES_NULL_FORWARD_OPEN_NOT_SUPPORTED 0x132
1033 #define CM_ES_CONNECTION_TIMED_OUT 0x203
1034 #define CM_ES_UNCONNECTED_REQUEST_TIMED_OUT 0x204
1035 #define CM_ES_PARAMETER_ERROR_IN_UNCONNECTED_REQUEST 0x205
1036 #define CM_ES_MESSAGE_TOO_LARGE_FOR_UNCONNECTED_SEND 0x206
1037 #define CM_ES_UNCONNECTED_ACK_WITHOUT_REPLY 0x207
1038 #define CM_ES_NO_BUFFER_MEMORY_AVAILABLE 0x301
1039 #define CM_ES_NETWORK_BANDWIDTH_NOT_AVAIL_FOR_DATA 0x302
1040 #define CM_ES_NO_CONSUMED_CONN_ID_FILTER_AVAILABLE 0x303
1041 #define CM_ES_NOT_CONFIGURED_TO_SEND_SCHEDULED_DATA 0x304
1042 #define CM_ES_SCHEDULE_SIGNATURE_MISMATCH 0x305
1043 #define CM_ES_SCHEDULE_SIGNATURE_VALIDATION_NOT_POSS 0x306
1044 #define CM_ES_PORT_NOT_AVAILABLE 0x311
1045 #define CM_ES_LINK_ADDRESS_NOT_VALID 0x312
1046 #define CM_ES_INVALID_SEGMENT_IN_CONN_PATH 0x315
1047 #define CM_ES_FWD_CLOSE_CONN_PATH_MISMATCH 0x316
1048 #define CM_ES_SCHEDULING_NOT_SPECIFIED 0x317
1049 #define CM_ES_LINK_ADDRESS_TO_SELF_INVALID 0x318
1050 #define CM_ES_SECONDARY_RESOURCES_UNAVAILABLE 0x319
1051 #define CM_ES_RACK_CONNECTION_ALREADY_ESTABLISHED 0x31A
1052 #define CM_ES_MODULE_CONNECTION_ALREADY_ESTABLISHED 0x31B
1053 #define CM_ES_MISCELLANEOUS 0x31C
1054 #define CM_ES_REDUNDANT_CONNECTION_MISMATCH 0x31D
1055 #define CM_ES_NO_CONSUMER_RES_AVAIL_IN_PROD_MODULE 0x31E
1056 #define CM_ES_NO_CONSUMER_RES_CONF_IN_PROD_MODULE 0x31F
1057 #define CM_ES_NETWORK_LINK_OFFLINE 0x800
1058 #define CM_ES_INCOMPATIBLE_MULTICAST_RPI 0x801
1059 #define CM_ES_INVALID_SAFETY_CONN_SIZE 0x802
1060 #define CM_ES_INVALID_SAFETY_CONN_FORMAT 0x803
1061 #define CM_ES_INVALID_TIME_CORRECTION_CONN_PARAM 0x804
1062 #define CM_ES_INVALID_PING_INTERVAL_EPI_MULTIPLIER 0x805
1063 #define CM_ES_TIME_COORDINATION_MSG_MIN_MULTIPLIER 0x806
1064 #define CM_ES_NETWORK_TIME_EXPECTATION_MULTIPLIER 0x807
1065 #define CM_ES_TIMEOUT_MULTIPLIER 0x808
1066 #define CM_ES_INVALID_MAX_CONSUMER_NUMBER 0x809
1067 #define CM_ES_INVALID_CPCRC 0x80A
1068 #define CM_ES_TIME_CORRECTION_CONN_ID_INVALID 0x80B
1069 #define CM_ES_SCID_MISMATCH 0x80C
1070 #define CM_ES_TUNID_NOT_SET 0x80D
1071 #define CM_ES_TUNID_MISMATCH 0x80E
1072 #define CM_ES_CONFIGURATION_OPERATION_NOT_ALLOWED 0x80F
1073 #define CM_ES_NO_TARGET_APP_DATA_AVAILABLE 0x810
1074 #define CM_ES_NO_ORIG_APP_DATA_AVAILABLE 0x811
1075 #define CM_ES_NODE_ADDRESS_CHANGED_AFTER_SCHEDULED 0x812
1076 #define CM_ES_NOT_CONFIGURED_MULTICAST 0x813
1077 #define CM_ES_INVALID_PROD_CONS_DATA_FORMAT 0x814
1079 /* Translate function to string - CIP General Status codes */
1080 static const value_string cip_cm_ext_st_vals[] = {
1081 { CM_ES_DUP_FWD_OPEN, "Connection in use or duplicate Forward Open" },
1082 { CM_ES_CLASS_AND_TRIGGER, "Transport class and trigger combination not supported" },
1083 { CM_ES_OWNERSHIP_CONFLICT, "Ownership conflict" },
1084 { CM_ES_TARGET_CONN_NOT_FOUND, "Target connection not found" },
1085 { CM_ES_INVALID_NET_CONN_PARAM, "Invalid network connection parameter" },
1086 { CM_ES_INVALID_CONNECTION_SIZE, "Invalid connection size" },
1087 { CM_ES_TARGET_CONNECTION_NOT_CONFIGURED, "Target for connection not configured" },
1088 { CM_ES_RPI_NOT_SUPPORTED, "RPI not supported" },
1089 { CM_ES_RPI_NOT_ACCEPTABLE, "RPI value(s) not acceptable" },
1090 { CM_ES_OUT_OF_CONNECTIONS, "Out of connections" },
1091 { CM_ES_VENDOR_ID_OR_PRODUCT_CODE_MISMATCH, "Vendor ID or product code mismatch" },
1092 { CM_ES_DEVICE_TYPE_MISMATCH, "Device type mismatch" },
1093 { CM_ES_REVISION_MISMATCH, "Revision mismatch" },
1094 { CM_ES_INVALID_PROD_CONS_APP_PATH, "Invalid produced or consumed application path" },
1095 { CM_ES_INVALID_OR_INCONSISTENT_CONF_APP_PATH, "Invalid or inconsistent configuration application path" },
1096 { CM_ES_NON_LISTEN_ONLY_CONN_NOT_OPENED, "Non-listen only connection not opened" },
1097 { CM_ES_TARGET_OBJECT_OUT_OF_CONNECTIONS, "Target object out of connections" },
1098 { CM_ES_RPI_SMALLER_THAN_PROD_INHIBIT_TIME, "RPI is smaller than the production inhibit time" },
1099 { CM_ES_TRANSPORT_CLASS_NOT_SUPPORTED, "Transport class not supported" },
1100 { CM_ES_PRODUCTION_TRIGGER_NOT_SUPPORTED, "Production trigger not supported" },
1101 { CM_ES_DIRECTION_NOT_SUPPORTED, "Direction not supported" },
1102 { CM_ES_INVALID_OT_NET_CONN_FIX_VAR, "Invalid O->T Fixed/Variable" },
1103 { CM_ES_INVALID_TO_NET_CONN_FIX_VAR, "Invalid T->O Fixed/Variable" },
1104 { CM_ES_INVALID_OT_NET_CONN_PRIORITY, "Invalid O->T Priority" },
1105 { CM_ES_INVALID_TO_NET_CONN_PRIORITY, "Invalid T->O Priority" },
1106 { CM_ES_INVALID_OT_NET_CONN_TYPE, "Invalid O->T connection type" },
1107 { CM_ES_INVALID_TO_NET_CONN_TYPE, "Invalid T->O connection type" },
1108 { CM_ES_INVALID_OT_NET_CONN_REDUNDANT_OWNER, "Invalid O->T redundant owner" },
1109 { CM_ES_INVALID_CONFIGURATION_SIZE, "Invalid configuration size" },
1110 { CM_ES_INVALID_OT_SIZE, "Invalid O->T size" },
1111 { CM_ES_INVALID_TO_SIZE, "Invalid T->O size" },
1112 { CM_ES_INVALID_CONFIGURATION_APP_PATH, "Invalid configuration application path" },
1113 { CM_ES_INVALID_CONSUMING_APP_PATH, "Invalid consuming application path" },
1114 { CM_ES_INVALID_PRODUCING_APP_PATH, "Invalid producing application path" },
1115 { CM_ES_CONFIGURATION_SYMBOL_NOT_EXIST, "Configuration symbol does not exist" },
1116 { CM_ES_CONSUMING_SYMBOL_NOT_EXIST, "Consuming symbol does not exist" },
1117 { CM_ES_PRODUCING_SYMBOL_NOT_EXIST, "Producing symbol does not exist" },
1118 { CM_ES_INCONSISTENT_APP_PATH_COMBO, "Inconsistent application path combination" },
1119 { CM_ES_INCONSISTENT_CONSUME_DATA_FORMAT, "Inconsistent consume data format" },
1120 { CM_ES_INCONSISTENT_PRODUCE_DATA_FORMAT, "Inconsistent produce data format" },
1121 { CM_ES_NULL_FORWARD_OPEN_NOT_SUPPORTED, "NULL ForwardOpen not supported" },
1122 { CM_ES_CONNECTION_TIMED_OUT, "Connection timed out" },
1123 { CM_ES_UNCONNECTED_REQUEST_TIMED_OUT, "Unconnected request timed out" },
1124 { CM_ES_PARAMETER_ERROR_IN_UNCONNECTED_REQUEST, "Parameter error in unconnected request" },
1125 { CM_ES_MESSAGE_TOO_LARGE_FOR_UNCONNECTED_SEND, "Message too large for UnconnectedSend" },
1126 { CM_ES_UNCONNECTED_ACK_WITHOUT_REPLY, "Unconnected acknowledged without reply" },
1127 { CM_ES_NO_BUFFER_MEMORY_AVAILABLE, "No buffer memory available" },
1128 { CM_ES_NETWORK_BANDWIDTH_NOT_AVAIL_FOR_DATA, "Network bandwidth not available for data" },
1129 { CM_ES_NO_CONSUMED_CONN_ID_FILTER_AVAILABLE, "No consumed connection ID filter available" },
1130 { CM_ES_NOT_CONFIGURED_TO_SEND_SCHEDULED_DATA, "Not confgured to send scheduled priority data" },
1131 { CM_ES_SCHEDULE_SIGNATURE_MISMATCH, "Schedule signature mismatch" },
1132 { CM_ES_SCHEDULE_SIGNATURE_VALIDATION_NOT_POSS, "Schedule signature validation not possible" },
1133 { CM_ES_PORT_NOT_AVAILABLE, "Port not available" },
1134 { CM_ES_LINK_ADDRESS_NOT_VALID, "Link address not valid" },
1135 { CM_ES_INVALID_SEGMENT_IN_CONN_PATH, "Invalid segment in connection path" },
1136 { CM_ES_FWD_CLOSE_CONN_PATH_MISMATCH, "ForwardClose connection path mismatch" },
1137 { CM_ES_SCHEDULING_NOT_SPECIFIED, "Scheduling not specified" },
1138 { CM_ES_LINK_ADDRESS_TO_SELF_INVALID, "Link address to self invalid" },
1139 { CM_ES_SECONDARY_RESOURCES_UNAVAILABLE, "Secondary resources unavailable" },
1140 { CM_ES_RACK_CONNECTION_ALREADY_ESTABLISHED, "Rack connection already established" },
1141 { CM_ES_MODULE_CONNECTION_ALREADY_ESTABLISHED, "Module connection already established" },
1142 { CM_ES_MISCELLANEOUS, "Miscellaneous" },
1143 { CM_ES_REDUNDANT_CONNECTION_MISMATCH, "Redundant connection mismatch" },
1144 { CM_ES_NO_CONSUMER_RES_AVAIL_IN_PROD_MODULE, "No more user configurable link consumer resources available in the producing module" },
1145 { CM_ES_NO_CONSUMER_RES_CONF_IN_PROD_MODULE, "No more user configurable link consumer resources configured in the producing module" },
1146 { CM_ES_NETWORK_LINK_OFFLINE, "Network link offline" },
1147 { CM_ES_INCOMPATIBLE_MULTICAST_RPI, "Incompatible Multicast RPI" },
1148 { CM_ES_INVALID_SAFETY_CONN_SIZE, "Invalid Safety Connection Size" },
1149 { CM_ES_INVALID_SAFETY_CONN_FORMAT, "Invalid Safety Connection Format" },
1150 { CM_ES_INVALID_TIME_CORRECTION_CONN_PARAM, "Invalid Time Correction Connection Parameters" },
1151 { CM_ES_INVALID_PING_INTERVAL_EPI_MULTIPLIER, "Invalid Ping Interval EPI Multiplier" },
1152 { CM_ES_TIME_COORDINATION_MSG_MIN_MULTIPLIER, "Time Coordination Msg Min Multiplier" },
1153 { CM_ES_NETWORK_TIME_EXPECTATION_MULTIPLIER, "Network Time Expectation Multiplier" },
1154 { CM_ES_TIMEOUT_MULTIPLIER, "Timeout Multiplier" },
1155 { CM_ES_INVALID_MAX_CONSUMER_NUMBER, "Invalid Max Consumer Number" },
1156 { CM_ES_INVALID_CPCRC, "Invalid CPCRC" },
1157 { CM_ES_TIME_CORRECTION_CONN_ID_INVALID, "Time Correction Connection ID Invalid" },
1158 { CM_ES_SCID_MISMATCH, "SCID Mismatch" },
1159 { CM_ES_TUNID_NOT_SET, "TUNID not set" },
1160 { CM_ES_TUNID_MISMATCH, "TUNID Mismatch" },
1161 { CM_ES_CONFIGURATION_OPERATION_NOT_ALLOWED, "Configuration operation not allowed" },
1162 { CM_ES_NO_TARGET_APP_DATA_AVAILABLE, "No target application data available" },
1163 { CM_ES_NO_ORIG_APP_DATA_AVAILABLE, "No originator application data available" },
1164 { CM_ES_NODE_ADDRESS_CHANGED_AFTER_SCHEDULED, "Node address has changed since the network was scheduled" },
1165 { CM_ES_NOT_CONFIGURED_MULTICAST, "Not configured for off-subnet multicast" },
1166 { CM_ES_INVALID_PROD_CONS_DATA_FORMAT, "Invalid produce/consume data format" },
1168 { 0, NULL }
1171 value_string_ext cip_cm_ext_st_vals_ext = VALUE_STRING_EXT_INIT(cip_cm_ext_st_vals);
1173 /* Translate Vendor IDs */
1174 static const value_string cip_vendor_vals[] = {
1175 { 0, "Reserved" },
1176 { 1, "Rockwell Automation/Allen-Bradley" },
1177 { 2, "Namco Controls Corp." },
1178 { 3, "Honeywell Inc." },
1179 { 4, "Parker Hannifin Corp. (Veriflo Division)" },
1180 { 5, "Rockwell Automation/Reliance Elec." },
1181 { 6, "Reserved" },
1182 { 7, "SMC Corporation" },
1183 { 8, "Molex Incorporated" },
1184 { 9, "Western Reserve Controls Corp." },
1185 { 10, "Advanced Micro Controls Inc. (AMCI)" },
1186 { 11, "ASCO Pneumatic Controls" },
1187 { 12, "Banner Engineering Corp." },
1188 { 13, "Belden Wire & Cable Company" },
1189 { 14, "Cooper Interconnect" },
1190 { 15, "Reserved" },
1191 { 16, "Daniel Woodhead Co. (Woodhead Connectivity)" },
1192 { 17, "Dearborn Group Inc." },
1193 { 18, "Reserved" },
1194 { 19, "Helm Instrument Company" },
1195 { 20, "Huron Net Works" },
1196 { 21, "Lumberg, Inc." },
1197 { 22, "Online Development Inc.(Automation Value)" },
1198 { 23, "Vorne Industries, Inc." },
1199 { 24, "ODVA Special Reserve" },
1200 { 25, "Reserved" },
1201 { 26, "Festo Corporation" },
1202 { 27, "Reserved" },
1203 { 28, "Reserved" },
1204 { 29, "Reserved" },
1205 { 30, "Unico, Inc." },
1206 { 31, "Ross Controls" },
1207 { 32, "Reserved" },
1208 { 33, "Reserved" },
1209 { 34, "Hohner Corp." },
1210 { 35, "Micro Mo Electronics, Inc." },
1211 { 36, "MKS Instruments, Inc." },
1212 { 37, "Yaskawa Electric America formerly Magnetek Drives" },
1213 { 38, "Reserved" },
1214 { 39, "AVG Automation (Uticor)" },
1215 { 40, "Wago Corporation" },
1216 { 41, "Kinetics (Unit Instruments)" },
1217 { 42, "IMI Norgren Limited" },
1218 { 43, "BALLUFF, Inc." },
1219 { 44, "Yaskawa Electric America, Inc." },
1220 { 45, "Eurotherm Controls Inc" },
1221 { 46, "ABB Industrial Systems" },
1222 { 47, "Omron Corporation" },
1223 { 48, "TURCk, Inc." },
1224 { 49, "Grayhill Inc." },
1225 { 50, "Real Time Automation (C&ID)" },
1226 { 51, "Reserved" },
1227 { 52, "Numatics, Inc." },
1228 { 53, "Lutze, Inc." },
1229 { 54, "Reserved" },
1230 { 55, "Reserved" },
1231 { 56, "Softing GmbH" },
1232 { 57, "Pepperl + Fuchs" },
1233 { 58, "Spectrum Controls, Inc." },
1234 { 59, "D.I.P. Inc. MKS Inst." },
1235 { 60, "Applied Motion Products, Inc." },
1236 { 61, "Sencon Inc." },
1237 { 62, "High Country Tek" },
1238 { 63, "SWAC Automation Consult GmbH" },
1239 { 64, "Clippard Instrument Laboratory" },
1240 { 65, "Reserved" },
1241 { 66, "Reserved" },
1242 { 67, "Reserved" },
1243 { 68, "Eaton Electrical" },
1244 { 69, "Reserved" },
1245 { 70, "Reserved" },
1246 { 71, "Toshiba International Corp." },
1247 { 72, "Control Technology Incorporated" },
1248 { 73, "TCS (NZ) Ltd." },
1249 { 74, "Hitachi, Ltd." },
1250 { 75, "ABB Robotics Products AB" },
1251 { 76, "NKE Corporation" },
1252 { 77, "Rockwell Software, Inc." },
1253 { 78, "Escort Memory Systems (A Datalogic Group Co.)" },
1254 { 79, "Reserved" },
1255 { 80, "Industrial Devices Corporation" },
1256 { 81, "IXXAT Automation GmbH" },
1257 { 82, "Mitsubishi Electric Automation, Inc." },
1258 { 83, "OPTO-22" },
1259 { 84, "Reserved" },
1260 { 85, "Reserved" },
1261 { 86, "Horner Electric" },
1262 { 87, "Burkert Werke GmbH & Co. KG" },
1263 { 88, "Reserved" },
1264 { 89, "Industrial Indexing Systems, Inc." },
1265 { 90, "HMS Industrial Networks AB" },
1266 { 91, "Robicon" },
1267 { 92, "Helix Technology (Granville-Phillips)" },
1268 { 93, "Arlington Laboratory" },
1269 { 94, "Advantech Co. Ltd." },
1270 { 95, "Square D Company" },
1271 { 96, "Digital Electronics Corp." },
1272 { 97, "Danfoss" },
1273 { 98, "Reserved" },
1274 { 99, "Reserved" },
1275 { 100, "Bosch Rexroth Corporation, Pneumatics" },
1276 { 101, "Applied Materials, Inc." },
1277 { 102, "Showa Electric Wire & Cable Co." },
1278 { 103, "Pacific Scientific (API Controls Inc.)" },
1279 { 104, "Sharp Manufacturing Systems Corp." },
1280 { 105, "Olflex Wire & Cable, Inc." },
1281 { 106, "Reserved" },
1282 { 107, "Unitrode" },
1283 { 108, "Beckhoff Automation GmbH" },
1284 { 109, "National Instruments" },
1285 { 110, "Mykrolis Corporations (Millipore)" },
1286 { 111, "International Motion Controls Corp." },
1287 { 112, "Reserved" },
1288 { 113, "SEG Kempen GmbH" },
1289 { 114, "Reserved" },
1290 { 115, "Reserved" },
1291 { 116, "MTS Systems Corp." },
1292 { 117, "Krones, Inc" },
1293 { 118, "Reserved" },
1294 { 119, "EXOR Electronic R & D" },
1295 { 120, "SIEI S.p.A." },
1296 { 121, "KUKA Roboter GmbH" },
1297 { 122, "Reserved" },
1298 { 123, "SEC (Samsung Electronics Co., Ltd)" },
1299 { 124, "Binary Electronics Ltd" },
1300 { 125, "Flexible Machine Controls" },
1301 { 126, "Reserved" },
1302 { 127, "ABB Inc. (Entrelec)" },
1303 { 128, "MAC Valves, Inc." },
1304 { 129, "Auma Actuators Inc" },
1305 { 130, "Toyoda Machine Works, Ltd" },
1306 { 131, "Reserved" },
1307 { 132, "Reserved" },
1308 { 133, "Balogh T.A.G., Corporation" },
1309 { 134, "TR Systemtechnik GmbH" },
1310 { 135, "UNIPULSE Corporation" },
1311 { 136, "Reserved" },
1312 { 137, "Reserved" },
1313 { 138, "Conxall Corporation Inc." },
1314 { 139, "Reserved" },
1315 { 140, "Reserved" },
1316 { 141, "Kuramo Electric Co., Ltd." },
1317 { 142, "Creative Micro Designs" },
1318 { 143, "GE Industrial Systems" },
1319 { 144, "Leybold Vacuum GmbH" },
1320 { 145, "Siemens Energy & Automation/Drives" },
1321 { 146, "Kodensha Ltd" },
1322 { 147, "Motion Engineering, Inc." },
1323 { 148, "Honda Engineering Co., Ltd" },
1324 { 149, "EIM Valve Controls" },
1325 { 150, "Melec Inc." },
1326 { 151, "Sony Manufacturing Systems Corporation" },
1327 { 152, "North American Mfg." },
1328 { 153, "WATLOW" },
1329 { 154, "Japan Radio Co., Ltd" },
1330 { 155, "NADEX Co., Ltd" },
1331 { 156, "Ametek Automation & Process Technologies" },
1332 { 157, "Reserved" },
1333 { 158, "KVASER AB" },
1334 { 159, "IDEC IZUMI Corporation" },
1335 { 160, "Mitsubishi Heavy Industries Ltd" },
1336 { 161, "Mitsubishi Electric Corporation" },
1337 { 162, "Horiba-STEC Inc." },
1338 { 163, "esd electronic system design gmbh" },
1339 { 164, "DAIHEN Corporation" },
1340 { 165, "Tyco Valves & Controls/Keystone" },
1341 { 166, "EBARA Corporation" },
1342 { 167, "Reserved" },
1343 { 168, "Reserved" },
1344 { 169, "Hokuyo Electric Co. Ltd" },
1345 { 170, "Pyramid Solutions, Inc." },
1346 { 171, "Denso Wave Incorporated" },
1347 { 172, "HLS Hard-Line Solutions Inc" },
1348 { 173, "Caterpillar, Inc." },
1349 { 174, "PDL Electronics Ltd." },
1350 { 175, "Reserved" },
1351 { 176, "Red Lion Controls" },
1352 { 177, "ANELVA Corporation" },
1353 { 178, "Toyo Denki Seizo KK" },
1354 { 179, "Sanyo Denki Co., Ltd" },
1355 { 180, "Advanced Energy Japan K.K. (Aera Japan)" },
1356 { 181, "Pilz GmbH & Co" },
1357 { 182, "Marsh Bellofram-Bellofram PCD Division" },
1358 { 183, "Reserved" },
1359 { 184, "M-SYSTEM Co. Ltd" },
1360 { 185, "Nissin Electric Co., Ltd" },
1361 { 186, "Hitachi Metals Ltd." },
1362 { 187, "Oriental Motor Company" },
1363 { 188, "A&D Co., Ltd" },
1364 { 189, "Phasetronics, Inc." },
1365 { 190, "Cummins Engine Company" },
1366 { 191, "Deltron Inc." },
1367 { 192, "Geneer Corporation" },
1368 { 193, "Anatol Automation, Inc." },
1369 { 194, "Reserved" },
1370 { 195, "Reserved" },
1371 { 196, "Medar, Inc." },
1372 { 197, "Comdel Inc." },
1373 { 198, "Advanced Energy Industries, Inc" },
1374 { 199, "Reserved" },
1375 { 200, "DAIDEN Co., Ltd" },
1376 { 201, "CKD Corporation" },
1377 { 202, "Toyo Electric Corporation" },
1378 { 203, "Reserved" },
1379 { 204, "AuCom Electronics Ltd" },
1380 { 205, "Shinko Electric Co., Ltd" },
1381 { 206, "Vector Informatik GmbH" },
1382 { 207, "Reserved" },
1383 { 208, "Moog Inc." },
1384 { 209, "Contemporary Controls" },
1385 { 210, "Tokyo Sokki Kenkyujo Co., Ltd" },
1386 { 211, "Schenck-AccuRate, Inc." },
1387 { 212, "The Oilgear Company" },
1388 { 213, "Reserved" },
1389 { 214, "ASM Japan K.K." },
1390 { 215, "HIRATA Corp." },
1391 { 216, "SUNX Limited" },
1392 { 217, "Meidensha Corp." },
1393 { 218, "NIDEC SANKYO CORPORATION (Sankyo Seiki Mfg. Co., Ltd)" },
1394 { 219, "KAMRO Corp." },
1395 { 220, "Nippon System Development Co., Ltd" },
1396 { 221, "EBARA Technologies Inc." },
1397 { 222, "Reserved" },
1398 { 223, "Reserved" },
1399 { 224, "SG Co., Ltd" },
1400 { 225, "Vaasa Institute of Technology" },
1401 { 226, "MKS Instruments (ENI Technology)" },
1402 { 227, "Tateyama System Laboratory Co., Ltd." },
1403 { 228, "QLOG Corporation" },
1404 { 229, "Matric Limited Inc." },
1405 { 230, "NSD Corporation" },
1406 { 231, "Reserved" },
1407 { 232, "Sumitomo Wiring Systems, Ltd" },
1408 { 233, "Group 3 Technology Ltd" },
1409 { 234, "CTI Cryogenics" },
1410 { 235, "POLSYS CORP" },
1411 { 236, "Ampere Inc." },
1412 { 237, "Reserved" },
1413 { 238, "Simplatroll Ltd" },
1414 { 239, "Reserved" },
1415 { 240, "Reserved" },
1416 { 241, "Leading Edge Design" },
1417 { 242, "Humphrey Products" },
1418 { 243, "Schneider Automation, Inc." },
1419 { 244, "Westlock Controls Corp." },
1420 { 245, "Nihon Weidmuller Co., Ltd" },
1421 { 246, "Brooks Instrument (Div. of Emerson)" },
1422 { 247, "Reserved" },
1423 { 248, " Moeller GmbH" },
1424 { 249, "Varian Vacuum Products" },
1425 { 250, "Yokogawa Electric Corporation" },
1426 { 251, "Electrical Design Daiyu Co., Ltd" },
1427 { 252, "Omron Software Co., Ltd" },
1428 { 253, "BOC Edwards" },
1429 { 254, "Control Technology Corporation" },
1430 { 255, "Bosch Rexroth" },
1431 { 256, "Turck" },
1432 { 257, "Control Techniques PLC" },
1433 { 258, "Hardy Instruments, Inc." },
1434 { 259, "LS Industrial Systems" },
1435 { 260, "E.O.A. Systems Inc." },
1436 { 261, "Reserved" },
1437 { 262, "New Cosmos Electric Co., Ltd." },
1438 { 263, "Sense Eletronica LTDA" },
1439 { 264, "Xycom, Inc." },
1440 { 265, "Baldor Electric" },
1441 { 266, "Reserved" },
1442 { 267, "Patlite Corporation" },
1443 { 268, "Reserved" },
1444 { 269, "Mogami Wire & Cable Corporation" },
1445 { 270, "Welding Technology Corporation (WTC)" },
1446 { 271, "Reserved" },
1447 { 272, "Deutschmann Automation GmbH" },
1448 { 273, "ICP Panel-Tec Inc." },
1449 { 274, "Bray Controls USA" },
1450 { 275, "Reserved" },
1451 { 276, "Status Technologies" },
1452 { 277, "Trio Motion Technology Ltd" },
1453 { 278, "Sherrex Systems Ltd" },
1454 { 279, "Adept Technology, Inc." },
1455 { 280, "Spang Power Electronics" },
1456 { 281, "Reserved" },
1457 { 282, "Acrosser Technology Co., Ltd" },
1458 { 283, "Hilscher GmbH" },
1459 { 284, "IMAX Corporation" },
1460 { 285, "Electronic Innovation, Inc. (Falter Engineering)" },
1461 { 286, "Netlogic Inc." },
1462 { 287, "Bosch Rexroth Corporation, Indramat" },
1463 { 288, "Reserved" },
1464 { 289, "Reserved" },
1465 { 290, "Murata Machinery Ltd." },
1466 { 291, "MTT Company Ltd." },
1467 { 292, "Kanematsu Semiconductor Corp." },
1468 { 293, "Takebishi Electric Sales Co." },
1469 { 294, "Tokyo Electron Device Ltd" },
1470 { 295, "PFU Limited" },
1471 { 296, "Hakko Automation Co., Ltd." },
1472 { 297, "Advanet Inc." },
1473 { 298, "Tokyo Electron Software Technologies Ltd." },
1474 { 299, "Reserved" },
1475 { 300, "Shinagawa Electric Wire Co., Ltd." },
1476 { 301, "Yokogawa M&C Corporation" },
1477 { 302, "KONAN Electric Co., Ltd." },
1478 { 303, "Binar Elektronik AB" },
1479 { 304, "Furukawa Electric Co." },
1480 { 305, "Cooper Energy Services" },
1481 { 306, "Schleicher GmbH & Co." },
1482 { 307, "Hirose Electric Co., Ltd" },
1483 { 308, "Western Servo Design Inc." },
1484 { 309, "Prosoft Technology" },
1485 { 310, "Reserved" },
1486 { 311, "Towa Shoko Co., Ltd" },
1487 { 312, "Kyopal Co., Ltd" },
1488 { 313, "Extron Co." },
1489 { 314, "Wieland Electric GmbH" },
1490 { 315, "SEW Eurodrive GmbH" },
1491 { 316, "Aera Corporation" },
1492 { 317, "STA Reutlingen" },
1493 { 318, "Reserved" },
1494 { 319, "Fuji Electric Co., Ltd." },
1495 { 320, "Reserved" },
1496 { 321, "Reserved" },
1497 { 322, "ifm efector, inc." },
1498 { 323, "Reserved" },
1499 { 324, "IDEACOD-Hohner Automation S.A." },
1500 { 325, "CommScope Inc." },
1501 { 326, "GE Fanuc Automation North America, Inc." },
1502 { 327, "Matsushita Electric Industrial Co., Ltd" },
1503 { 328, "Okaya Electronics Corporation" },
1504 { 329, "KASHIYAMA Industries, Ltd" },
1505 { 330, "JVC" },
1506 { 331, "Interface Corporation" },
1507 { 332, "Grape Systems Inc." },
1508 { 333, "Reserved" },
1509 { 334, "Reserved" },
1510 { 335, "Toshiba IT & Control Systems Corporation" },
1511 { 336, "Sanyo Machine Works, Ltd." },
1512 { 337, "Vansco Electronics Ltd." },
1513 { 338, "Dart Container Corp." },
1514 { 339, "Livingston & Co., Inc." },
1515 { 340, "Alfa Laval LKM as" },
1516 { 341, "BF ENTRON Ltd. (British Federal)" },
1517 { 342, "Bekaert Engineering NV" },
1518 { 343, "Ferran Scientific Inc." },
1519 { 344, "KEBA AG" },
1520 { 345, "Endress + Hauser" },
1521 { 346, "Reserved" },
1522 { 347, "ABB ALSTOM Power UK Ltd. (EGT)" },
1523 { 348, "Berger Lahr GmbH" },
1524 { 349, "Reserved" },
1525 { 350, "Federal Signal Corp." },
1526 { 351, "Kawasaki Robotics (USA), Inc." },
1527 { 352, "Bently Nevada Corporation" },
1528 { 353, "Reserved" },
1529 { 354, "FRABA Posital GmbH" },
1530 { 355, "Elsag Bailey, Inc." },
1531 { 356, "Fanuc Robotics America" },
1532 { 357, "Reserved" },
1533 { 358, "Surface Combustion, Inc." },
1534 { 359, "Reserved" },
1535 { 360, "AILES Electronics Ind. Co., Ltd." },
1536 { 361, "Wonderware Corporation" },
1537 { 362, "Particle Measuring Systems, Inc." },
1538 { 363, "Reserved" },
1539 { 364, "Reserved" },
1540 { 365, "BITS Co., Ltd" },
1541 { 366, "Japan Aviation Electronics Industry Ltd" },
1542 { 367, "Keyence Corporation" },
1543 { 368, "Kuroda Precision Industries Ltd." },
1544 { 369, "Mitsubishi Electric Semiconductor Application" },
1545 { 370, "Nippon Seisen Cable, Ltd." },
1546 { 371, "Omron ASO Co., Ltd" },
1547 { 372, "Seiko Seiki Co., Ltd." },
1548 { 373, "Sumitomo Heavy Industries, Ltd." },
1549 { 374, "Tango Computer Service Corporation" },
1550 { 375, "Technology Service, Inc." },
1551 { 376, "Toshiba Information Systems (Japan) Corporation" },
1552 { 377, "TOSHIBA Schneider Inverter Corporation" },
1553 { 378, "Toyooki Kogyo Co., Ltd." },
1554 { 379, "XEBEC" },
1555 { 380, "Madison Cable Corporation" },
1556 { 381, "Hitati Engineering & Services Co., Ltd" },
1557 { 382, "TEM-TECH Lab Co., Ltd" },
1558 { 383, "International Laboratory Corporation" },
1559 { 384, "Dyadic Systems Co., Ltd." },
1560 { 385, "SETO Electronics Industry Co., Ltd" },
1561 { 386, "Tokyo Electron Kyushu Limited" },
1562 { 387, "KEI System Co., Ltd" },
1563 { 388, "Reserved" },
1564 { 389, "Asahi Engineering Co., Ltd" },
1565 { 390, "Contrex Inc." },
1566 { 391, "Paradigm Controls Ltd." },
1567 { 392, "Reserved" },
1568 { 393, "Ohm Electric Co., Ltd." },
1569 { 394, "RKC Instrument Inc." },
1570 { 395, "Suzuki Motor Corporation" },
1571 { 396, "Custom Servo Motors Inc." },
1572 { 397, "PACE Control Systems" },
1573 { 398, "Reserved" },
1574 { 399, "Reserved" },
1575 { 400, "LINTEC Co., Ltd." },
1576 { 401, "Hitachi Cable Ltd." },
1577 { 402, "BUSWARE Direct" },
1578 { 403, "Eaton Electric B.V. (former Holec Holland N.V.)" },
1579 { 404, "VAT Vakuumventile AG" },
1580 { 405, "Scientific Technologies Incorporated" },
1581 { 406, "Alfa Instrumentos Eletronicos Ltda" },
1582 { 407, "TWK Elektronik GmbH" },
1583 { 408, "ABB Welding Systems AB" },
1584 { 409, "BYSTRONIC Maschinen AG" },
1585 { 410, "Kimura Electric Co., Ltd" },
1586 { 411, "Nissei Plastic Industrial Co., Ltd" },
1587 { 412, "Reserved" },
1588 { 413, "Kistler-Morse Corporation" },
1589 { 414, "Proteous Industries Inc." },
1590 { 415, "IDC Corporation" },
1591 { 416, "Nordson Corporation" },
1592 { 417, "Rapistan Systems" },
1593 { 418, "LP-Elektronik GmbH" },
1594 { 419, "GERBI & FASE S.p.A.(Fase Saldatura)" },
1595 { 420, "Phoenix Digital Corporation" },
1596 { 421, "Z-World Engineering" },
1597 { 422, "Honda R&D Co., Ltd." },
1598 { 423, "Bionics Instrument Co., Ltd." },
1599 { 424, "Teknic, Inc." },
1600 { 425, "R.Stahl, Inc." },
1601 { 426, "Reserved" },
1602 { 427, "Ryco Graphic Manufacturing Inc." },
1603 { 428, "Giddings & Lewis, Inc." },
1604 { 429, "Koganei Corporation" },
1605 { 430, "Reserved" },
1606 { 431, "Nichigoh Communication Electric Wire Co., Ltd." },
1607 { 432, "Reserved" },
1608 { 433, "Fujikura Ltd." },
1609 { 434, "AD Link Technology Inc." },
1610 { 435, "StoneL Corporation" },
1611 { 436, "Computer Optical Products, Inc." },
1612 { 437, "CONOS Inc." },
1613 { 438, "Erhardt + Leimer GmbH" },
1614 { 439, "UNIQUE Co. Ltd" },
1615 { 440, "Roboticsware, Inc." },
1616 { 441, "Nachi Fujikoshi Corporation" },
1617 { 442, "Hengstler GmbH" },
1618 { 443, "Reserved" },
1619 { 444, "SUNNY GIKEN Inc." },
1620 { 445, "Lenze Drive Systems GmbH" },
1621 { 446, "CD Systems B.V." },
1622 { 447, "FMT/Aircraft Gate Support Systems AB" },
1623 { 448, "Axiomatic Technologies Corp" },
1624 { 449, "Embedded System Products, Inc." },
1625 { 450, "Reserved" },
1626 { 451, "Mencom Corporation" },
1627 { 452, "Reserved" },
1628 { 453, "Matsushita Welding Systems Co., Ltd." },
1629 { 454, "Dengensha Mfg. Co. Ltd." },
1630 { 455, "Quinn Systems Ltd." },
1631 { 456, "Tellima Technology Ltd" },
1632 { 457, "MDT, Software" },
1633 { 458, "Taiwan Keiso Co., Ltd" },
1634 { 459, "Pinnacle Systems" },
1635 { 460, "Ascom Hasler Mailing Sys" },
1636 { 461, "INSTRUMAR Limited" },
1637 { 462, "Reserved" },
1638 { 463, "Navistar International Transportation Corp" },
1639 { 464, "Huettinger Elektronik GmbH + Co. KG" },
1640 { 465, "OCM Technology Inc." },
1641 { 466, "Professional Supply Inc." },
1642 { 467, "Control Solutions" },
1643 { 468, "Baumer IVO GmbH & Co. KG" },
1644 { 469, "Worcester Controls Corporation" },
1645 { 470, "Pyramid Technical Consultants, Inc." },
1646 { 471, "Reserved" },
1647 { 472, "Apollo Fire Detectors Limited" },
1648 { 473, "Avtron Manufacturing, Inc." },
1649 { 474, "Reserved" },
1650 { 475, "Tokyo Keiso Co., Ltd." },
1651 { 476, "Daishowa Swiki Co., Ltd." },
1652 { 477, "Kojima Instruments Inc." },
1653 { 478, "Shimadzu Corporation" },
1654 { 479, "Tatsuta Electric Wire & Cable Co., Ltd." },
1655 { 480, "MECS Corporation" },
1656 { 481, "Tahara Electric" },
1657 { 482, "Koyo Electronics" },
1658 { 483, "Clever Devices" },
1659 { 484, "GCD Hardware & Software GmbH" },
1660 { 485, "Reserved" },
1661 { 486, "Miller Electric Mfg Co." },
1662 { 487, "GEA Tuchenhagen GmbH" },
1663 { 488, "Riken Keiki Co., LTD" },
1664 { 489, "Keisokugiken Corporation" },
1665 { 490, "Fuji Machine Mfg. Co., Ltd" },
1666 { 491, "Reserved" },
1667 { 492, "Nidec-Shimpo Corp." },
1668 { 493, "UTEC Corporation" },
1669 { 494, "Sanyo Electric Co. Ltd." },
1670 { 495, "Reserved" },
1671 { 496, "Reserved" },
1672 { 497, "Okano Electric Wire Co. Ltd" },
1673 { 498, "Shimaden Co. Ltd." },
1674 { 499, "Teddington Controls Ltd" },
1675 { 500, "Reserved" },
1676 { 501, "VIPA GmbH" },
1677 { 502, "Warwick Manufacturing Group" },
1678 { 503, "Danaher Controls" },
1679 { 504, "Reserved" },
1680 { 505, "Reserved" },
1681 { 506, "American Science & Engineering" },
1682 { 507, "Accutron Controls International Inc." },
1683 { 508, "Norcott Technologies Ltd" },
1684 { 509, "TB Woods, Inc" },
1685 { 510, "Proportion-Air, Inc." },
1686 { 511, "SICK Stegmann GmbH" },
1687 { 512, "Reserved" },
1688 { 513, "Edwards Signaling" },
1689 { 514, "Sumitomo Metal Industries, Ltd" },
1690 { 515, "Cosmo Instruments Co., Ltd." },
1691 { 516, "Denshosha Co., Ltd." },
1692 { 517, "Kaijo Corp." },
1693 { 518, "Michiproducts Co., Ltd." },
1694 { 519, "Miura Corporation" },
1695 { 520, "TG Information Network Co., Ltd." },
1696 { 521, "Fujikin , Inc." },
1697 { 522, "Estic Corp." },
1698 { 523, "GS Hydraulic Sales" },
1699 { 524, "Reserved" },
1700 { 525, "MTE Limited" },
1701 { 526, "Hyde Park Electronics, Inc." },
1702 { 527, "Pfeiffer Vacuum GmbH" },
1703 { 528, "Cyberlogic Technologies" },
1704 { 529, "OKUMA Corporation FA Systems Division" },
1705 { 530, "Reserved" },
1706 { 531, "Hitachi Kokusai Electric Co., Ltd." },
1707 { 532, "SHINKO TECHNOS Co., Ltd." },
1708 { 533, "Itoh Electric Co., Ltd." },
1709 { 534, "Colorado Flow Tech Inc." },
1710 { 535, "Love Controls Division/Dwyer Inst." },
1711 { 536, "Alstom Drives and Controls" },
1712 { 537, "The Foxboro Company" },
1713 { 538, "Tescom Corporation" },
1714 { 539, "Reserved" },
1715 { 540, "Atlas Copco Controls UK" },
1716 { 541, "Reserved" },
1717 { 542, "Autojet Technologies" },
1718 { 543, "Prima Electronics S.p.A." },
1719 { 544, "PMA GmbH" },
1720 { 545, "Shimafuji Electric Co., Ltd" },
1721 { 546, "Oki Electric Industry Co., Ltd" },
1722 { 547, "Kyushu Matsushita Electric Co., Ltd" },
1723 { 548, "Nihon Electric Wire & Cable Co., Ltd" },
1724 { 549, "Tsuken Electric Ind Co., Ltd" },
1725 { 550, "Tamadic Co." },
1726 { 551, "MAATEL SA" },
1727 { 552, "OKUMA America" },
1728 { 553, "Control Techniques PLC-NA" },
1729 { 554, "TPC Wire & Cable" },
1730 { 555, "ATI Industrial Automation" },
1731 { 556, "Microcontrol (Australia) Pty Ltd" },
1732 { 557, "Serra Soldadura, S.A." },
1733 { 558, "Southwest Research Institute" },
1734 { 559, "Cabinplant International" },
1735 { 560, "Sartorius Mechatronics T&H GmbH" },
1736 { 561, "Comau S.p.A. Robotics & Final Assembly Division" },
1737 { 562, "Phoenix Contact" },
1738 { 563, "Yokogawa MAT Corporation" },
1739 { 564, "asahi sangyo co., ltd." },
1740 { 565, "Reserved" },
1741 { 566, "Akita Myotoku Ltd." },
1742 { 567, "OBARA Corp." },
1743 { 568, "Suetron Electronic GmbH" },
1744 { 569, "Reserved" },
1745 { 570, "Serck Controls Limited" },
1746 { 571, "Fairchild Industrial Products Company" },
1747 { 572, "ARO S.A." },
1748 { 573, "M2C GmbH" },
1749 { 574, "Shin Caterpillar Mitsubishi Ltd." },
1750 { 575, "Santest Co., Ltd." },
1751 { 576, "Cosmotechs Co., Ltd." },
1752 { 577, "Hitachi Electric Systems" },
1753 { 578, "Smartscan Ltd" },
1754 { 579, "Woodhead Software & Electronics France" },
1755 { 580, "Athena Controls, Inc." },
1756 { 581, "Syron Engineering & Manufacturing, Inc." },
1757 { 582, "Asahi Optical Co., Ltd." },
1758 { 583, "Sansha Electric Mfg. Co., Ltd." },
1759 { 584, "Nikki Denso Co., Ltd." },
1760 { 585, "Star Micronics, Co., Ltd." },
1761 { 586, "Ecotecnia Socirtat Corp." },
1762 { 587, "AC Technology Corp." },
1763 { 588, "West Instruments Limited" },
1764 { 589, "NTI Limited" },
1765 { 590, "Delta Computer Systems, Inc." },
1766 { 591, "FANUC Ltd." },
1767 { 592, "Hearn-Gu Lee" },
1768 { 593, "ABB Automation Products" },
1769 { 594, "Orion Machinery Co., Ltd." },
1770 { 595, "Reserved" },
1771 { 596, "Wire-Pro, Inc." },
1772 { 597, "Beijing Huakong Technology Co. Ltd." },
1773 { 598, "Yokoyama Shokai Co., Ltd." },
1774 { 599, "Toyogiken Co., Ltd." },
1775 { 600, "Coester Equipamentos Eletronicos Ltda." },
1776 { 601, "Reserved" },
1777 { 602, "Electroplating Engineers of Japan Ltd." },
1778 { 603, "ROBOX S.p.A." },
1779 { 604, "Spraying Systems Company" },
1780 { 605, "Benshaw Inc." },
1781 { 606, "ZPA-DP A.S." },
1782 { 607, "Wired Rite Systems" },
1783 { 608, "Tandis Research, Inc." },
1784 { 609, "SSD Drives GmbH" },
1785 { 610, "ULVAC Japan Ltd." },
1786 { 611, "DYNAX Corporation" },
1787 { 612, "Nor-Cal Products, Inc." },
1788 { 613, "Aros Electronics AB" },
1789 { 614, "Jun-Tech Co., Ltd." },
1790 { 615, "HAN-MI Co. Ltd." },
1791 { 616, "uniNtech (formerly SungGi Internet)" },
1792 { 617, "Hae Pyung Electronics Reserch Institute" },
1793 { 618, "Milwaukee Electronics" },
1794 { 619, "OBERG Industries" },
1795 { 620, "Parker Hannifin/Compumotor Division" },
1796 { 621, "TECHNO DIGITAL CORPORATION" },
1797 { 622, "Network Supply Co., Ltd." },
1798 { 623, "Union Electronics Co., Ltd." },
1799 { 624, "Tritronics Services PM Ltd." },
1800 { 625, "Rockwell Automation-Sprecher+Schuh" },
1801 { 626, "Matsushita Electric Industrial Co., Ltd/Motor Co." },
1802 { 627, "Rolls-Royce Energy Systems, Inc." },
1803 { 628, "JEONGIL INTERCOM CO., LTD" },
1804 { 629, "Interroll Corp." },
1805 { 630, "Hubbell Wiring Device-Kellems (Delaware)" },
1806 { 631, "Intelligent Motion Systems" },
1807 { 632, "Reserved" },
1808 { 633, "INFICON AG" },
1809 { 634, "Hirschmann, Inc." },
1810 { 635, "The Siemon Company" },
1811 { 636, "YAMAHA Motor Co. Ltd." },
1812 { 637, "aska corporation" },
1813 { 638, "Woodhead Connectivity" },
1814 { 639, "Trimble AB" },
1815 { 640, "Murrelektronik GmbH" },
1816 { 641, "Creatrix Labs, Inc." },
1817 { 642, "TopWorx" },
1818 { 643, "Kumho Industrial Co., Ltd." },
1819 { 644, "Wind River Systems, Inc." },
1820 { 645, "Bihl & Wiedemann GmbH" },
1821 { 646, "Harmonic Drive Systems Inc." },
1822 { 647, "Rikei Corporation" },
1823 { 648, "BL Autotec, Ltd." },
1824 { 649, "Hana Information & Technology Co., Ltd." },
1825 { 650, "Seoil Electric Co., Ltd." },
1826 { 651, "Fife Corporation" },
1827 { 652, "Shanghai Electrical Apparatus Research Institute" },
1828 { 653, "Reserved" },
1829 { 654, "Parasense Development Centre" },
1830 { 655, "Reserved" },
1831 { 656, "Reserved" },
1832 { 657, "Six Tau S.p.A." },
1833 { 658, "Aucos GmbH" },
1834 { 659, "Rotork Controls" },
1835 { 660, "Automationdirect.com" },
1836 { 661, "Thermo BLH" },
1837 { 662, "System Controls, Ltd." },
1838 { 663, "Univer S.p.A." },
1839 { 664, "MKS-Tenta Technology" },
1840 { 665, "Lika Electronic SNC" },
1841 { 666, "Mettler-Toledo, Inc." },
1842 { 667, "DXL USA Inc." },
1843 { 668, "Rockwell Automation/Entek IRD Intl." },
1844 { 669, "Nippon Otis Elevator Company" },
1845 { 670, "Sinano Electric, Co., Ltd." },
1846 { 671, "Sony Manufacturing Systems" },
1847 { 672, "Reserved" },
1848 { 673, "Contec Co., Ltd." },
1849 { 674, "Automated Solutions" },
1850 { 675, "Controlweigh" },
1851 { 676, "Reserved" },
1852 { 677, "Fincor Electronics" },
1853 { 678, "Cognex Corporation" },
1854 { 679, "Qualiflow" },
1855 { 680, "Weidmuller, Inc." },
1856 { 681, "Morinaga Milk Industry Co., Ltd." },
1857 { 682, "Takagi Industrial Co., Ltd." },
1858 { 683, "Wittenstein AG" },
1859 { 684, "Sena Technologies, Inc." },
1860 { 685, "Reserved" },
1861 { 686, "APV Products Unna" },
1862 { 687, "Creator Teknisk Utvedkling AB" },
1863 { 688, "Reserved" },
1864 { 689, "Mibu Denki Industrial Co., Ltd." },
1865 { 690, "Takamastsu Machineer Section" },
1866 { 691, "Startco Engineering Ltd." },
1867 { 692, "Reserved" },
1868 { 693, "Holjeron" },
1869 { 694, "ALCATEL High Vacuum Technology" },
1870 { 695, "Taesan LCD Co., Ltd." },
1871 { 696, "POSCON" },
1872 { 697, "VMIC" },
1873 { 698, "Matsushita Electric Works, Ltd." },
1874 { 699, "IAI Corporation" },
1875 { 700, "Horst GmbH" },
1876 { 701, "MicroControl GmbH & Co." },
1877 { 702, "Leine & Linde AB" },
1878 { 703, "Reserved" },
1879 { 704, "EC Elettronica Srl" },
1880 { 705, "VIT Software HB" },
1881 { 706, "Bronkhorst High-Tech B.V." },
1882 { 707, "Optex Co., Ltd." },
1883 { 708, "Yosio Electronic Co." },
1884 { 709, "Terasaki Electric Co., Ltd." },
1885 { 710, "Sodick Co., Ltd." },
1886 { 711, "MTS Systems Corporation-Automation Division" },
1887 { 712, "Mesa Systemtechnik" },
1888 { 713, "SHIN HO SYSTEM Co., Ltd." },
1889 { 714, "Goyo Electronics Co, Ltd." },
1890 { 715, "Loreme" },
1891 { 716, "SAB Brockskes GmbH & Co. KG" },
1892 { 717, "Trumpf Laser GmbH + Co. KG" },
1893 { 718, "Niigata Electronic Instruments Co., Ltd." },
1894 { 719, "Yokogawa Digital Computer Corporation" },
1895 { 720, "O.N. Electronic Co., Ltd." },
1896 { 721, "Industrial Control Communication, Inc." },
1897 { 722, "ABB, Inc." },
1898 { 723, "ElectroWave USA, Inc." },
1899 { 724, "Industrial Network Controls, LLC" },
1900 { 725, "KDT Systems Co., Ltd." },
1901 { 726, "SEFA Technology Inc." },
1902 { 727, "Nippon POP Rivets and Fasteners Ltd." },
1903 { 728, "Yamato Scale Co., Ltd." },
1904 { 729, "Zener Electric" },
1905 { 730, "GSE Scale Systems" },
1906 { 731, "ISAS (Integrated Switchgear & Sys. Pty Ltd)" },
1907 { 732, "Beta LaserMike Limited" },
1908 { 733, "TOEI Electric Co., Ltd." },
1909 { 734, "Hakko Electronics Co., Ltd" },
1910 { 735, "Reserved" },
1911 { 736, "RFID, Inc." },
1912 { 737, "Adwin Corporation" },
1913 { 738, "Osaka Vacuum, Ltd." },
1914 { 739, "A-Kyung Motion, Inc." },
1915 { 740, "Camozzi S.P. A." },
1916 { 741, "Crevis Co., LTD" },
1917 { 742, "Rice Lake Weighing Systems" },
1918 { 743, "Linux Network Services" },
1919 { 744, "KEB Antriebstechnik GmbH" },
1920 { 745, "Hagiwara Electric Co., Ltd." },
1921 { 746, "Glass Inc. International" },
1922 { 747, "Reserved" },
1923 { 748, "DVT Corporation" },
1924 { 749, "Woodward Governor" },
1925 { 750, "Mosaic Systems, Inc." },
1926 { 751, "Laserline GmbH" },
1927 { 752, "COM-TEC, Inc." },
1928 { 753, "Weed Instrument" },
1929 { 754, "Prof-face European Technology Center" },
1930 { 755, "Fuji Automation Co., Ltd." },
1931 { 756, "Matsutame Co., Ltd." },
1932 { 757, "Hitachi Via Mechanics, Ltd." },
1933 { 758, "Dainippon Screen Mfg. Co. Ltd." },
1934 { 759, "FLS Automation A/S" },
1935 { 760, "ABB Stotz Kontakt GmbH" },
1936 { 761, "Technical Marine Service" },
1937 { 762, "Advanced Automation Associates, Inc." },
1938 { 763, "Baumer Ident GmbH" },
1939 { 764, "Tsubakimoto Chain Co." },
1940 { 765, "Reserved" },
1941 { 766, "Furukawa Co., Ltd." },
1942 { 767, "Active Power" },
1943 { 768, "CSIRO Mining Automation" },
1944 { 769, "Matrix Integrated Systems" },
1945 { 770, "Digitronic Automationsanlagen GmbH" },
1946 { 771, "SICK STEGMANN Inc." },
1947 { 772, "TAE-Antriebstechnik GmbH" },
1948 { 773, "Electronic Solutions" },
1949 { 774, "Rocon L.L.C." },
1950 { 775, "Dijitized Communications Inc." },
1951 { 776, "Asahi Organic Chemicals Industry Co., Ltd." },
1952 { 777, "Hodensha" },
1953 { 778, "Harting, Inc. NA" },
1954 { 779, "Kubler GmbH" },
1955 { 780, "Yamatake Corporation" },
1956 { 781, "JEOL" },
1957 { 782, "Yamatake Industrial Systems Co., Ltd." },
1958 { 783, "HAEHNE Elektronische Messgerate GmbH" },
1959 { 784, "Ci Technologies Pty Ltd (for Pelamos Industries)" },
1960 { 785, "N. SCHLUMBERGER & CIE" },
1961 { 786, "Teijin Seiki Co., Ltd." },
1962 { 787, "DAIKIN Industries, Ltd" },
1963 { 788, "RyuSyo Industrial Co., Ltd." },
1964 { 789, "SAGINOMIYA SEISAKUSHO, INC." },
1965 { 790, "Seishin Engineering Co., Ltd." },
1966 { 791, "Japan Support System Ltd." },
1967 { 792, "Decsys" },
1968 { 793, "Metronix Messgerate u. Elektronik GmbH" },
1969 { 794, "Reserved" },
1970 { 795, "Vaccon Company, Inc." },
1971 { 796, "Siemens Energy & Automation, Inc." },
1972 { 797, "Ten X Technology, Inc." },
1973 { 798, "Tyco Electronics" },
1974 { 799, "Delta Power Electronics Center" },
1975 { 800, "Denker" },
1976 { 801, "Autonics Corporation" },
1977 { 802, "JFE Electronic Engineering Pty. Ltd." },
1978 { 803, "Reserved" },
1979 { 804, "Electro-Sensors, Inc." },
1980 { 805, "Digi International, Inc." },
1981 { 806, "Texas Instruments" },
1982 { 807, "ADTEC Plasma Technology Co., Ltd" },
1983 { 808, "SICK AG" },
1984 { 809, "Ethernet Peripherals, Inc." },
1985 { 810, "Animatics Corporation" },
1986 { 811, "Reserved" },
1987 { 812, "Process Control Corporation" },
1988 { 813, "SystemV. Inc." },
1989 { 814, "Danaher Motion SRL" },
1990 { 815, "SHINKAWA Sensor Technology, Inc." },
1991 { 816, "Tesch GmbH & Co. KG" },
1992 { 817, "Reserved" },
1993 { 818, "Trend Controls Systems Ltd." },
1994 { 819, "Guangzhou ZHIYUAN Electronic Co., Ltd." },
1995 { 820, "Mykrolis Corporation" },
1996 { 821, "Bethlehem Steel Corporation" },
1997 { 822, "KK ICP" },
1998 { 823, "Takemoto Denki Corporation" },
1999 { 824, "The Montalvo Corporation" },
2000 { 825, "Reserved" },
2001 { 826, "LEONI Special Cables GmbH" },
2002 { 827, "Reserved" },
2003 { 828, "ONO SOKKI CO.,LTD." },
2004 { 829, "Rockwell Samsung Automation" },
2005 { 830, "SHINDENGEN ELECTRIC MFG. CO. LTD" },
2006 { 831, "Origin Electric Co. Ltd." },
2007 { 832, "Quest Technical Solutions, Inc." },
2008 { 833, "LS Cable, Ltd." },
2009 { 834, "Enercon-Nord Electronic GmbH" },
2010 { 835, "Northwire Inc." },
2011 { 836, "Engel Elektroantriebe GmbH" },
2012 { 837, "The Stanley Works" },
2013 { 838, "Celesco Transducer Products, Inc." },
2014 { 839, "Chugoku Electric Wire and Cable Co." },
2015 { 840, "Kongsberg Simrad AS" },
2016 { 841, "Panduit Corporation" },
2017 { 842, "Spellman High Voltage Electronics Corp." },
2018 { 843, "Kokusai Electric Alpha Co., Ltd." },
2019 { 844, "Brooks Automation, Inc." },
2020 { 845, "ANYWIRE CORPORATION" },
2021 { 846, "Honda Electronics Co. Ltd" },
2022 { 847, "REO Elektronik AG" },
2023 { 848, "Fusion UV Systems, Inc." },
2024 { 849, "ASI Advanced Semiconductor Instruments GmbH" },
2025 { 850, "Datalogic, Inc." },
2026 { 851, "SoftPLC Corporation" },
2027 { 852, "Dynisco Instruments LLC" },
2028 { 853, "WEG Industrias SA" },
2029 { 854, "Frontline Test Equipment, Inc." },
2030 { 855, "Tamagawa Seiki Co., Ltd." },
2031 { 856, "Multi Computing Co., Ltd." },
2032 { 857, "RVSI" },
2033 { 858, "Commercial Timesharing Inc." },
2034 { 859, "Tennessee Rand Automation LLC" },
2035 { 860, "Wacogiken Co., Ltd" },
2036 { 861, "Reflex Integration Inc." },
2037 { 862, "Siemens AG, A&D PI Flow Instruments" },
2038 { 863, "G. Bachmann Electronic GmbH" },
2039 { 864, "NT International" },
2040 { 865, "Schweitzer Engineering Laboratories" },
2041 { 866, "ATR Industrie-Elektronik GmbH Co." },
2042 { 867, "PLASMATECH Co., Ltd" },
2043 { 868, "Reserved" },
2044 { 869, "GEMU GmbH & Co. KG" },
2045 { 870, "Alcorn McBride Inc." },
2046 { 871, "MORI SEIKI CO., LTD" },
2047 { 872, "NodeTech Systems Ltd" },
2048 { 873, "Emhart Teknologies" },
2049 { 874, "Cervis, Inc." },
2050 { 875, "FieldServer Technologies (Div Sierra Monitor Corp)" },
2051 { 876, "NEDAP Power Supplies" },
2052 { 877, "Nippon Sanso Corporation" },
2053 { 878, "Mitomi Giken Co., Ltd." },
2054 { 879, "PULS GmbH" },
2055 { 880, "Reserved" },
2056 { 881, "Japan Control Engineering Ltd" },
2057 { 882, "Embedded Systems Korea (Former Zues Emtek Co Ltd.)" },
2058 { 883, "Automa SRL" },
2059 { 884, "Harms+Wende GmbH & Co KG" },
2060 { 885, "SAE-STAHL GmbH" },
2061 { 886, "Microwave Data Systems" },
2062 { 887, "Bernecker + Rainer Industrie-Elektronik GmbH" },
2063 { 888, "Hiprom Technologies" },
2064 { 889, "Reserved" },
2065 { 890, "Nitta Corporation" },
2066 { 891, "Kontron Modular Computers GmbH" },
2067 { 892, "Marlin Controls" },
2068 { 893, "ELCIS s.r.l." },
2069 { 894, "Acromag, Inc." },
2070 { 895, "Avery Weigh-Tronix" },
2071 { 896, "Reserved" },
2072 { 897, "Reserved" },
2073 { 898, "Reserved" },
2074 { 899, "Practicon Ltd" },
2075 { 900, "Schunk GmbH & Co. KG" },
2076 { 901, "MYNAH Technologies" },
2077 { 902, "Defontaine Groupe" },
2078 { 903, "Emerson Process Management Power & Water Solutions" },
2079 { 904, "F.A. Elec" },
2080 { 905, "Hottinger Baldwin Messtechnik GmbH" },
2081 { 906, "Coreco Imaging, Inc." },
2082 { 907, "London Electronics Ltd." },
2083 { 908, "HSD SpA" },
2084 { 909, "Comtrol Corporation" },
2085 { 910, "TEAM, S.A. (Tecnica Electronica de Automatismo Y Medida)" },
2086 { 911, "MAN B&W Diesel Ltd. Regulateurs Europa" },
2087 { 912, "Reserved" },
2088 { 913, "Reserved" },
2089 { 914, "Micro Motion, Inc." },
2090 { 915, "Eckelmann AG" },
2091 { 916, "Hanyoung Nux" },
2092 { 917, "Ransburg Industrial Finishing KK" },
2093 { 918, "Kun Hung Electric Co. Ltd." },
2094 { 919, "Brimos wegbebakening b.v." },
2095 { 920, "Nitto Seiki Co., Ltd" },
2096 { 921, "PPT Vision, Inc." },
2097 { 922, "Yamazaki Machinery Works" },
2098 { 923, "SCHMIDT Technology GmbH" },
2099 { 924, "Parker Hannifin SpA (SBC Division)" },
2100 { 925, "HIMA Paul Hildebrandt GmbH" },
2101 { 926, "RivaTek, Inc." },
2102 { 927, "Misumi Corporation" },
2103 { 928, "GE Multilin" },
2104 { 929, "Measurement Computing Corporation" },
2105 { 930, "Jetter AG" },
2106 { 931, "Tokyo Electronics Systems Corporation" },
2107 { 932, "Togami Electric Mfg. Co., Ltd." },
2108 { 933, "HK Systems" },
2109 { 934, "CDA Systems Ltd." },
2110 { 935, "Aerotech Inc." },
2111 { 936, "JVL Industrie Elektronik A/S" },
2112 { 937, "NovaTech Process Solutions LLC" },
2113 { 938, "Reserved" },
2114 { 939, "Cisco Systems" },
2115 { 940, "Grid Connect" },
2116 { 941, "ITW Automotive Finishing" },
2117 { 942, "HanYang System" },
2118 { 943, "ABB K.K. Technical Center" },
2119 { 944, "Taiyo Electric Wire & Cable Co., Ltd." },
2120 { 945, "Reserved" },
2121 { 946, "SEREN IPS INC" },
2122 { 947, "Belden CDT Electronics Division" },
2123 { 948, "ControlNet International" },
2124 { 949, "Gefran S.P.A." },
2125 { 950, "Jokab Safety AB" },
2126 { 951, "SUMITA OPTICAL GLASS, INC." },
2127 { 952, "Biffi Italia srl" },
2128 { 953, "Beck IPC GmbH" },
2129 { 954, "Copley Controls Corporation" },
2130 { 955, "Fagor Automation S. Coop." },
2131 { 956, "DARCOM" },
2132 { 957, "Frick Controls (div. of York International)" },
2133 { 958, "SymCom, Inc." },
2134 { 959, "Infranor" },
2135 { 960, "Kyosan Cable, Ltd." },
2136 { 961, "Varian Vacuum Technologies" },
2137 { 962, "Messung Systems" },
2138 { 963, "Xantrex Technology, Inc." },
2139 { 964, "StarThis Inc." },
2140 { 965, "Chiyoda Co., Ltd." },
2141 { 966, "Flowserve Corporation" },
2142 { 967, "Spyder Controls Corp." },
2143 { 968, "IBA AG" },
2144 { 969, "SHIMOHIRA ELECTRIC MFG.CO.,LTD" },
2145 { 970, "Reserved" },
2146 { 971, "Siemens L&A" },
2147 { 972, "Micro Innovations AG" },
2148 { 973, "Switchgear & Instrumentation" },
2149 { 974, "PRE-TECH CO., LTD." },
2150 { 975, "National Semiconductor" },
2151 { 976, "Invensys Process Systems" },
2152 { 977, "Ametek HDR Power Systems" },
2153 { 978, "Reserved" },
2154 { 979, "TETRA-K Corporation" },
2155 { 980, "C & M Corporation" },
2156 { 981, "Siempelkamp Maschinen" },
2157 { 982, "Reserved" },
2158 { 983, "Daifuku America Corporation" },
2159 { 984, "Electro-Matic Products Inc." },
2160 { 985, "BUSSAN MICROELECTRONICS CORP." },
2161 { 986, "ELAU AG" },
2162 { 987, "Hetronic USA" },
2163 { 988, "NIIGATA POWER SYSTEMS Co., Ltd." },
2164 { 989, "Software Horizons Inc." },
2165 { 990, "B3 Systems, Inc." },
2166 { 991, "Moxa Networking Co., Ltd." },
2167 { 992, "Reserved" },
2168 { 993, "S4 Integration" },
2169 { 994, "Elettro Stemi S.R.L." },
2170 { 995, "AquaSensors" },
2171 { 996, "Ifak System GmbH" },
2172 { 997, "SANKEI MANUFACTURING Co.,LTD." },
2173 { 998, "Emerson Network Power Co., Ltd." },
2174 { 999, "Fairmount Automation, Inc." },
2175 { 1000, "Bird Electronic Corporation" },
2176 { 1001, "Nabtesco Corporation" },
2177 { 1002, "AGM Electronics, Inc." },
2178 { 1003, "ARCX Inc." },
2179 { 1004, "DELTA I/O Co." },
2180 { 1005, "Chun IL Electric Ind. Co." },
2181 { 1006, "N-Tron" },
2182 { 1007, "Nippon Pneumatics/Fludics System CO.,LTD." },
2183 { 1008, "DDK Ltd." },
2184 { 1009, "Seiko Epson Corporation" },
2185 { 1010, "Halstrup-Walcher GmbH" },
2186 { 1011, "ITT" },
2187 { 1012, "Ground Fault Systems bv" },
2188 { 1013, "Scolari Engineering S.p.A." },
2189 { 1014, "Vialis Traffic bv" },
2190 { 1015, "Weidmueller Interface GmbH & Co. KG" },
2191 { 1016, "Shanghai Sibotech Automation Co. Ltd" },
2192 { 1017, "AEG Power Supply Systems GmbH" },
2193 { 1018, "Komatsu Electronics Inc." },
2194 { 1019, "Souriau" },
2195 { 1020, "Baumuller Chicago Corp." },
2196 { 1021, "J. Schmalz GmbH" },
2197 { 1022, "SEN Corporation" },
2198 { 1023, "Korenix Technology Co. Ltd" },
2199 { 1024, "Cooper Power Tools" },
2200 { 1025, "INNOBIS" },
2201 { 1026, "Shinho System" },
2202 { 1027, "Xm Services Ltd." },
2203 { 1028, "KVC Co., Ltd." },
2204 { 1029, "Sanyu Seiki Co., Ltd." },
2205 { 1030, "TuxPLC" },
2206 { 1031, "Northern Network Solutions" },
2207 { 1032, "Converteam GmbH" },
2208 { 1033, "Symbol Technologies" },
2209 { 1034, "S-TEAM Lab" },
2210 { 1035, "Maguire Products, Inc." },
2211 { 1036, "AC&T" },
2212 { 1037, "MITSUBISHI HEAVY INDUSTRIES, LTD. KOBE SHIPYARD & MACHINERY WORKS" },
2213 { 1038, "Hurletron Inc." },
2214 { 1039, "Chunichi Denshi Co., Ltd" },
2215 { 1040, "Cardinal Scale Mfg. Co." },
2216 { 1041, "BTR NETCOM via RIA Connect, Inc." },
2217 { 1042, "Base2" },
2218 { 1043, "ASRC Aerospace" },
2219 { 1044, "Beijing Stone Automation" },
2220 { 1045, "Changshu Switchgear Manufacture Ltd." },
2221 { 1046, "METRONIX Corp." },
2222 { 1047, "WIT" },
2223 { 1048, "ORMEC Systems Corp." },
2224 { 1049, "ASATech (China) Inc." },
2225 { 1050, "Controlled Systems Limited" },
2226 { 1051, "Mitsubishi Heavy Ind. Digital System Co., Ltd. (M.H.I.)" },
2227 { 1052, "Electrogrip" },
2228 { 1053, "TDS Automation" },
2229 { 1054, "T&C Power Conversion, Inc." },
2230 { 1055, "Robostar Co., Ltd" },
2231 { 1056, "Scancon A/S" },
2232 { 1057, "Haas Automation, Inc." },
2233 { 1058, "Eshed Technology" },
2234 { 1059, "Delta Electronic Inc." },
2235 { 1060, "Innovasic Semiconductor" },
2236 { 1061, "SoftDEL Systems Limited" },
2237 { 1062, "FiberFin, Inc." },
2238 { 1063, "Nicollet Technologies Corp." },
2239 { 1064, "B.F. Systems" },
2240 { 1065, "Empire Wire and Supply LLC" },
2241 { 1066, "Reserved" },
2242 { 1067, "Elmo Motion Control LTD" },
2243 { 1068, "Reserved" },
2244 { 1069, "Asahi Keiki Co., Ltd." },
2245 { 1070, "Joy Mining Machinery" },
2246 { 1071, "MPM Engineering Ltd" },
2247 { 1072, "Wolke Inks & Printers GmbH" },
2248 { 1073, "Mitsubishi Electric Engineering Co., Ltd." },
2249 { 1074, "COMET AG" },
2250 { 1075, "Real Time Objects & Systems, LLC" },
2251 { 1076, "MISCO Refractometer" },
2252 { 1077, "JT Engineering Inc." },
2253 { 1078, "Automated Packing Systems" },
2254 { 1079, "Niobrara R&D Corp." },
2255 { 1080, "Garmin Ltd." },
2256 { 1081, "Japan Mobile Platform Co., Ltd" },
2257 { 1082, "Advosol Inc." },
2258 { 1083, "ABB Global Services Limited" },
2259 { 1084, "Sciemetric Instruments Inc." },
2260 { 1085, "Tata Elxsi Ltd." },
2261 { 1086, "TPC Mechatronics, Co., Ltd." },
2262 { 1087, "Cooper Bussmann" },
2263 { 1088, "Trinite Automatisering B.V." },
2264 { 1089, "Peek Traffic B.V." },
2265 { 1090, "Acrison, Inc" },
2266 { 1091, "Applied Robotics, Inc." },
2267 { 1092, "FireBus Systems, Inc." },
2268 { 1093, "Beijing Sevenstar Huachuang Electronics" },
2269 { 1094, "Magnetek" },
2270 { 1095, "Microscan" },
2271 { 1096, "Air Water Inc." },
2272 { 1097, "Sensopart Industriesensorik GmbH" },
2273 { 1098, "Tiefenbach Control Systems GmbH" },
2274 { 1099, "INOXPA S.A" },
2275 { 1100, "Zurich University of Applied Sciences" },
2276 { 1101, "Ethernet Direct" },
2277 { 1102, "GSI-Micro-E Systems" },
2278 { 1103, "S-Net Automation Co., Ltd." },
2279 { 1104, "Power Electronics S.L." },
2280 { 1105, "Renesas Technology Corp." },
2281 { 1106, "NSWCCD-SSES" },
2282 { 1107, "Porter Engineering Ltd." },
2283 { 1108, "Meggitt Airdynamics, Inc." },
2284 { 1109, "Inductive Automation" },
2285 { 1110, "Neural ID" },
2286 { 1111, "EEPod LLC" },
2287 { 1112, "Hitachi Industrial Equipment Systems Co., Ltd." },
2288 { 1113, "Salem Automation" },
2289 { 1114, "port GmbH" },
2290 { 1115, "B & PLUS" },
2291 { 1116, "Graco Inc." },
2292 { 1117, "Altera Corporation" },
2293 { 1118, "Technology Brewing Corporation" },
2294 { 1121, "CSE Servelec" },
2295 { 1124, "Fluke Networks" },
2296 { 1125, "Tetra Pak Packaging Solutions SPA" },
2297 { 1126, "Racine Federated, Inc." },
2298 { 1127, "Pureron Japan Co., Ltd." },
2299 { 1130, "Brother Industries, Ltd." },
2300 { 1132, "Leroy Automation" },
2301 { 1134, "THK CO., LTD." },
2302 { 1137, "TR-Electronic GmbH" },
2303 { 1138, "ASCON S.p.A." },
2304 { 1139, "Toledo do Brasil Industria de Balancas Ltda." },
2305 { 1140, "Bucyrus DBT Europe GmbH" },
2306 { 1141, "Emerson Process Management Valve Automation" },
2307 { 1142, "Alstom Transport" },
2308 { 1144, "Matrox Electronic Systems" },
2309 { 1145, "Littelfuse" },
2310 { 1146, "PLASMART, Inc." },
2311 { 1147, "Miyachi Corporation" },
2312 { 1150, "Promess Incorporated" },
2313 { 1151, "COPA-DATA GmbH" },
2314 { 1152, "Precision Engine Controls Corporation" },
2315 { 1153, "Alga Automacao e controle LTDA" },
2316 { 1154, "U.I. Lapp GmbH" },
2317 { 1155, "ICES" },
2318 { 1156, "Philips Lighting bv" },
2319 { 1157, "Aseptomag AG" },
2320 { 1158, "ARC Informatique" },
2321 { 1159, "Hesmor GmbH" },
2322 { 1160, "Kobe Steel, Ltd." },
2323 { 1161, "FLIR Systems" },
2324 { 1162, "Simcon A/S" },
2325 { 1163, "COPALP" },
2326 { 1164, "Zypcom, Inc." },
2327 { 1165, "Swagelok" },
2328 { 1166, "Elspec" },
2329 { 1167, "ITT Water & Wastewater AB" },
2330 { 1168, "Kunbus GmbH Industrial Communication" },
2331 { 1170, "Performance Controls, Inc." },
2332 { 1171, "ACS Motion Control, Ltd." },
2333 { 1173, "IStar Technology Limited" },
2334 { 1174, "Alicat Scientific, Inc." },
2335 { 1176, "ADFweb.com SRL" },
2336 { 1177, "Tata Consultancy Services Limited" },
2337 { 1178, "CXR Ltd." },
2338 { 1179, "Vishay Nobel AB" },
2339 { 1181, "SolaHD" },
2340 { 1182, "Endress+Hauser" },
2341 { 1183, "Bartec GmbH" },
2342 { 1185, "AccuSentry, Inc." },
2343 { 1186, "Exlar Corporation" },
2344 { 1187, "ILS Technology" },
2345 { 1188, "Control Concepts Inc." },
2346 { 1190, "Procon Engineering Limited" },
2347 { 1191, "Hermary Opto Electronics Inc." },
2348 { 1192, "Q-Lambda" },
2349 { 1194, "VAMP Ltd" },
2350 { 1195, "FlexLink" },
2351 { 1196, "Office FA.com Co., Ltd." },
2352 { 1197, "SPMC (Changzhou) Co. Ltd." },
2353 { 1198, "Anton Paar GmbH" },
2354 { 1199, "Zhuzhou CSR Times Electric Co., Ltd." },
2355 { 1200, "DeStaCo" },
2356 { 1201, "Synrad, Inc" },
2357 { 1202, "Bonfiglioli Vectron GmbH" },
2358 { 1203, "Pivotal Systems" },
2359 { 1204, "TKSCT" },
2360 { 1205, "Randy Nuernberger" },
2361 { 1206, "CENTRALP" },
2362 { 1207, "Tengen Group" },
2363 { 1208, "OES, Inc." },
2364 { 1209, "Actel Corporation" },
2365 { 1210, "Monaghan Engineering, Inc." },
2366 { 1211, "wenglor sensoric gmbh" },
2367 { 1212, "HSA Systems" },
2368 { 1213, "MK Precision Co., Ltd." },
2369 { 1214, "Tappan Wire and Cable" },
2370 { 1215, "Heinzmann GmbH & Co. KG" },
2371 { 1216, "Process Automation International Ltd." },
2372 { 1217, "Secure Crossing" },
2373 { 1218, "SMA Railway Technology GmbH" },
2374 { 1219, "FMS Force Measuring Systems AG" },
2375 { 1220, "ABT Endustri Enerji Sistemleri Sanayi Tic. Ltd. Sti." },
2376 { 1221, "MagneMotion Inc." },
2377 { 1222, "STS Co., Ltd." },
2378 { 1223, "MERAK SIC, SA" },
2379 { 1224, "ABOUNDI, Inc." },
2380 { 1225, "Rosemount Inc." },
2381 { 1226, "GEA FES, Inc." },
2382 { 1227, "TMG Technologie und Engineering GmbH" },
2383 { 1228, "embeX GmbH" },
2384 { 1229, "GH Electrotermia, S.A." },
2385 { 1230, "Tolomatic" },
2386 { 1231, "Dukane" },
2387 { 1232, "Elco (Tian Jin) Electronics Co., Ltd." },
2388 { 1233, "Jacobs Automation" },
2389 { 1234, "Noda Radio Frequency Technologies Co., Ltd." },
2390 { 1235, "MSC Tuttlingen GmbH" },
2391 { 1236, "Hitachi Cable Manchester" },
2392 { 1237, "ACOREL SAS" },
2393 { 1238, "Global Engineering Solutions Co., Ltd." },
2394 { 1239, "ALTE Transportation, S.L." },
2395 { 1240, "Penko Engineering B.V." },
2397 { 0, NULL }
2400 value_string_ext cip_vendor_vals_ext = VALUE_STRING_EXT_INIT(cip_vendor_vals);
2403 /* Translate Device Profile's */
2404 static const value_string cip_devtype_vals[] = {
2405 { 0x00, "Generic Device (deprecated)" },
2406 { 0x02, "AC Drive" },
2407 { 0x03, "Motor Overload" },
2408 { 0x04, "Limit Switch" },
2409 { 0x05, "Inductive Proximity Switch" },
2410 { 0x06, "Photoelectric Sensor" },
2411 { 0x07, "General Purpose Discrete I/O" },
2412 { 0x09, "Resolver" },
2413 { 0x0C, "Communications Adapter" },
2414 { 0x0E, "Programmable Logic Controller" },
2415 { 0x10, "Position Controller", },
2416 { 0x13, "DC Drive" },
2417 { 0x15, "Contactor", },
2418 { 0x16, "Motor Starter", },
2419 { 0x17, "Soft Start", },
2420 { 0x18, "Human-Machine Interface" },
2421 { 0x1A, "Mass Flow Controller" },
2422 { 0x1B, "Pneumatic Valve" },
2423 { 0x1C, "Vacuum Pressure Gauge" },
2424 { 0x1D, "Process Control Value" },
2425 { 0x1E, "Residual Gas Analyzer" },
2426 { 0x1F, "DC Power Generator" },
2427 { 0x20, "RF Power Generator" },
2428 { 0x21, "Turbomolecular Vacuum Pump" },
2429 { 0x22, "Encoder" },
2430 { 0x23, "Safety Discrete I/O Device" },
2431 { 0x24, "Fluid Flow Controller" },
2432 { 0x25, "CIP Motion Drive" },
2433 { 0x26, "CompoNet Repeater" },
2434 { 0x27, "Mass Flow Controller, Enhanced" },
2435 { 0x28, "CIP Modbus Device" },
2436 { 0x29, "CIP Modbus Translator" },
2437 { 0x2A, "Safety Analog I/O Device" },
2438 { 0x2B, "Generic Device (keyable)" },
2439 { 0x2C, "Managed Switch" },
2440 { 0x32, "ControlNet Physical Layer Component" },
2442 { 0, NULL }
2445 value_string_ext cip_devtype_vals_ext = VALUE_STRING_EXT_INIT(cip_devtype_vals);
2447 /* Translate class names */
2448 static const value_string cip_class_names_vals[] = {
2449 { 0x01, "Identity Object" },
2450 { 0x02, "Message Router" },
2451 { 0x03, "DeviceNet Object" },
2452 { 0x04, "Assembly Object" },
2453 { 0x05, "Connection Object" },
2454 { 0x06, "Connection Manager" },
2455 { 0x07, "Register Object" },
2456 { 0x08, "Discrete Input Point Object" },
2457 { 0x09, "Discrete Output Point Object" },
2458 { 0x0A, "Analog Input Point Object" },
2459 { 0x0B, "Analog Output Point Object" },
2460 { 0x0E, "Presence Sensing Object" },
2461 { 0x0F, "Parameter Object" },
2462 { 0x10, "Parameter Group Object" },
2463 { 0x12, "Group Object" },
2464 { 0x1D, "Discrete Input Group Object" },
2465 { 0x1E, "Discrete Output Group Object" },
2466 { 0x1F, "Discrete Group Object" },
2467 { 0x20, "Analog Input Group Object" },
2468 { 0x21, "Analog Output Group Object" },
2469 { 0x22, "Analog Group Object" },
2470 { 0x23, "Position Sensor Object" },
2471 { 0x24, "Position Controller Supervisor Object" },
2472 { 0x25, "Position Controller Object" },
2473 { 0x26, "Block Sequencer Object" },
2474 { 0x27, "Command Block Object" },
2475 { 0x28, "Motor Data Object" },
2476 { 0x29, "Control Supervisor Object" },
2477 { 0x2A, "AC/DC Drive Object" },
2478 { 0x2B, "Acknowledge Handler Object" },
2479 { 0x2C, "Overload Object" },
2480 { 0x2D, "Softstart Object" },
2481 { 0x2E, "Selection Object" },
2482 { 0x30, "S-Device Supervisor Object" },
2483 { 0x31, "S-Analog Sensor Object" },
2484 { 0x32, "S-Analog Actuator Object" },
2485 { 0x33, "S-Single Stage Controller Object" },
2486 { 0x34, "S-Gas Calibration Object" },
2487 { 0x35, "Trip Point Object" },
2488 { 0x37, "File Object" },
2489 { 0x38, "S-Partial Pressure Object" },
2490 { 0x39, "Safety Supervisor Object" },
2491 { 0x3A, "Safety Validator Object" },
2492 { 0x3B, "Safety Discrete Output Point Object" },
2493 { 0x3C, "Safety Discrete Output Group Object" },
2494 { 0x3D, "Safety Discrete Input Point Object" },
2495 { 0x3E, "Safety Discrete Input Group Object" },
2496 { 0x3F, "Safety Dual Channel Output Object" },
2497 { 0x40, "S-Sensor Calibration Object" },
2498 { 0x41, "Event Log Object" },
2499 { 0x42, "Motion Axis Object" },
2500 { 0x43, "Time Sync Object" },
2501 { 0x44, "Modbus Object" },
2502 { 0x45, "Originator Connection List Object" },
2503 { 0x46, "Modbus Serial Link Object" },
2504 { 0x47, "Device Level Ring (DLR) Object" },
2505 { 0x48, "QoS Object" },
2506 { 0x49, "Safety Analog Input Point Object" },
2507 { 0x4A, "Safety Analog Input Group Object" },
2508 { 0x4B, "Safety Dual Channel Analog Input Object" },
2509 { 0x4C, "Sercos III Link Object" },
2510 { 0x4D, "Target Connection List Object" },
2511 { 0x4E, "Base Energy Object" },
2512 { 0x4F, "Electrical Energy Object" },
2513 { 0x50, "Non-Electrical Energy Object" },
2514 { 0x51, "Base Switch Object" },
2515 { 0x52, "SNMP Object" },
2516 { 0x53, "Power Management Object" },
2517 { 0x54, "RSTP Bridge Object" },
2518 { 0x55, "RSTP Port Object" },
2519 { 0xF0, "ControlNet Object" },
2520 { 0xF1, "ControlNet Keeper Object" },
2521 { 0xF2, "ControlNet Scheduling Object" },
2522 { 0xF3, "Connection Configuration Object" },
2523 { 0xF4, "Port Object" },
2524 { 0xF5, "TCP/IP Interface Object" },
2525 { 0xF6, "EtherNet Link Object" },
2526 { 0xF7, "CompoNet Object" },
2527 { 0xF8, "CompoNet Repeater Object" },
2529 { 0, NULL }
2532 value_string_ext cip_class_names_vals_ext = VALUE_STRING_EXT_INIT(cip_class_names_vals);
2534 static void add_cip_service_to_info_column(packet_info *pinfo, guint8 service, const value_string* service_vals)
2536 cip_req_info_t *preq_info;
2538 preq_info = (cip_req_info_t*)p_get_proto_data( pinfo->fd, proto_cip, 0 );
2540 if ((preq_info == NULL) || (preq_info->isUnconnectedSend == FALSE))
2542 /* Add service to info column */
2543 col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s",
2544 val_to_str( service & 0x7F,
2545 service_vals, "Unknown Service (0x%02x)") );
2546 col_set_fence(pinfo->cinfo, COL_INFO);
2548 else
2550 col_append_str( pinfo->cinfo, COL_INFO,
2551 val_to_str(service & 0x7F,
2552 service_vals, "Unknown Service (0x%02x)") );
2553 col_set_fence(pinfo->cinfo, COL_INFO);
2554 /* Make sure it's only set once */
2555 preq_info->isUnconnectedSend = FALSE;
2559 static int dissect_id_revision(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2560 int offset, int total_len)
2562 if (total_len < 2)
2564 expert_add_info(pinfo, item, &ei_mal_identity_revision);
2565 return total_len;
2568 proto_tree_add_item( tree, hf_id_major_rev, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2569 proto_tree_add_item( tree, hf_id_minor_rev, tvb, offset+1, 1, ENC_LITTLE_ENDIAN);
2570 return 2;
2573 static int dissect_msg_rout_num_classes(packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, tvbuff_t *tvb,
2574 int offset, int total_len _U_)
2576 guint16 i, num_classes;
2578 num_classes = tvb_get_letohs( tvb, offset);
2579 proto_tree_add_item( tree, hf_msg_rout_num_classes, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2581 if (total_len < (2+(num_classes*2)))
2583 expert_add_info(pinfo, item, &ei_mal_msg_rout_num_classes);
2584 return total_len;
2587 for (i = 0; i < num_classes; i++)
2588 proto_tree_add_item( tree, hf_msg_rout_classes, tvb, offset+2+(i*2), 2, ENC_LITTLE_ENDIAN);
2590 return (2+(num_classes*2));
2593 static int dissect_time_sync_grandmaster_clock(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2594 int offset, int total_len)
2596 proto_item* ti;
2597 proto_tree* flag_tree;
2599 if (total_len < 24)
2601 expert_add_info(pinfo, item, &ei_mal_time_sync_gm_clock);
2602 return total_len;
2605 proto_tree_add_item( tree, hf_time_sync_gm_clock_clock_id, tvb, offset, 8, ENC_NA);
2606 proto_tree_add_item( tree, hf_time_sync_gm_clock_clock_class, tvb, offset+8, 2, ENC_LITTLE_ENDIAN);
2607 proto_tree_add_item( tree, hf_time_sync_gm_clock_time_accuracy, tvb, offset+10, 2, ENC_LITTLE_ENDIAN);
2608 proto_tree_add_item( tree, hf_time_sync_gm_clock_offset_scaled_log_variance, tvb, offset+12, 2, ENC_LITTLE_ENDIAN);
2609 proto_tree_add_item( tree, hf_time_sync_gm_clock_current_utc_offset, tvb, offset+14, 2, ENC_LITTLE_ENDIAN);
2611 ti = proto_tree_add_item( tree, hf_time_sync_gm_clock_time_property_flags, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2612 flag_tree = proto_item_add_subtree(ti, ett_time_sync_gm_clock_flags);
2613 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_leap61, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2614 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_leap59, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2615 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_current_utc_valid, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2616 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_ptp_timescale, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2617 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_time_traceable, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2618 proto_tree_add_item( flag_tree, hf_time_sync_gm_clock_time_property_flags_freq_traceable, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2620 proto_tree_add_item( tree, hf_time_sync_gm_clock_time_source, tvb, offset+18, 2, ENC_LITTLE_ENDIAN);
2621 proto_tree_add_item( tree, hf_time_sync_gm_clock_priority1, tvb, offset+20, 2, ENC_LITTLE_ENDIAN);
2622 proto_tree_add_item( tree, hf_time_sync_gm_clock_priority2, tvb, offset+22, 2, ENC_LITTLE_ENDIAN);
2623 return 24;
2626 static int dissect_time_sync_parent_clock(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2627 int offset, int total_len)
2629 if (total_len < 16)
2631 expert_add_info(pinfo, item, &ei_mal_time_sync_parent_clock);
2632 return total_len;
2635 proto_tree_add_item( tree, hf_time_sync_parent_clock_clock_id, tvb, offset, 8, ENC_NA);
2636 proto_tree_add_item( tree, hf_time_sync_parent_clock_port_number, tvb, offset+8, 2, ENC_LITTLE_ENDIAN);
2637 proto_tree_add_item( tree, hf_time_sync_parent_clock_observed_offset_scaled_log_variance, tvb, offset+10, 2, ENC_LITTLE_ENDIAN);
2638 proto_tree_add_item( tree, hf_time_sync_parent_clock_observed_phase_change_rate, tvb, offset+12, 4, ENC_LITTLE_ENDIAN);
2639 return 16;
2642 static int dissect_time_sync_local_clock(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2643 int offset, int total_len)
2645 proto_item* ti;
2646 proto_tree* flag_tree;
2648 if (total_len < 20)
2650 expert_add_info(pinfo, item, &ei_mal_time_sync_local_clock);
2651 return total_len;
2654 proto_tree_add_item( tree, hf_time_sync_local_clock_clock_id, tvb, offset, 8, ENC_NA);
2655 proto_tree_add_item( tree, hf_time_sync_local_clock_clock_class, tvb, offset+8, 2, ENC_LITTLE_ENDIAN);
2656 proto_tree_add_item( tree, hf_time_sync_local_clock_time_accuracy, tvb, offset+10, 2, ENC_LITTLE_ENDIAN);
2657 proto_tree_add_item( tree, hf_time_sync_local_clock_offset_scaled_log_variance, tvb, offset+12, 2, ENC_LITTLE_ENDIAN);
2658 proto_tree_add_item( tree, hf_time_sync_local_clock_current_utc_offset, tvb, offset+14, 2, ENC_LITTLE_ENDIAN);
2660 ti = proto_tree_add_item( tree, hf_time_sync_local_clock_time_property_flags, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2661 flag_tree = proto_item_add_subtree(ti, ett_time_sync_local_clock_flags);
2662 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_leap61, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2663 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_leap59, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2664 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_current_utc_valid, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2665 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_ptp_timescale, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2666 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_time_traceable, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2667 proto_tree_add_item( flag_tree, hf_time_sync_local_clock_time_property_flags_freq_traceable, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
2669 proto_tree_add_item( tree, hf_time_sync_local_clock_time_source, tvb, offset+18, 2, ENC_LITTLE_ENDIAN);
2670 return 20;
2673 static int dissect_time_sync_port_state_info(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2674 int offset, int total_len)
2676 guint16 i, num_ports;
2677 proto_item* ti;
2678 proto_tree* port_tree;
2680 if (total_len < 2)
2682 expert_add_info(pinfo, item, &ei_mal_time_sync_port_state_info);
2683 return total_len;
2686 num_ports = tvb_get_letohs( tvb, offset);
2687 proto_tree_add_item( tree, hf_time_sync_port_state_info_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2689 if (2+num_ports*4 < total_len)
2691 expert_add_info(pinfo, item, &ei_mal_time_sync_port_state_info_ports);
2692 return total_len;
2695 for (i = 0; i < num_ports; i++)
2697 ti = proto_tree_add_text(tree, NULL, offset+2+i*4, 4, "Port #%d", i+1);
2698 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_state_info);
2699 proto_tree_add_item(port_tree, hf_time_sync_port_state_info_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
2700 proto_tree_add_item(port_tree, hf_time_sync_port_state_info_port_state, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
2703 return 2+num_ports*4;
2706 static int dissect_time_sync_port_enable_cfg(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2707 int offset, int total_len)
2709 guint16 i, num_ports;
2710 proto_item* ti;
2711 proto_tree* port_tree;
2713 if (total_len < 2)
2715 expert_add_info(pinfo, item, &ei_mal_time_sync_port_enable_cfg);
2716 return total_len;
2719 num_ports = tvb_get_letohs( tvb, offset);
2720 proto_tree_add_item( tree, hf_time_sync_port_enable_cfg_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2722 if (2+num_ports*4 < total_len)
2724 expert_add_info(pinfo, item, &ei_mal_time_sync_port_enable_cfg_ports);
2725 return total_len;
2728 for (i = 0; i < num_ports; i++)
2730 ti = proto_tree_add_text(tree, NULL, offset+2+i*4, 4, "Port #%d", i+1);
2731 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_enable_cfg);
2732 proto_tree_add_item(port_tree, hf_time_sync_port_enable_cfg_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
2733 proto_tree_add_item(port_tree, hf_time_sync_port_enable_cfg_port_enable, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
2736 return 2+num_ports*4;
2739 static int dissect_time_sync_port_log_announce(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2740 int offset, int total_len)
2742 guint16 i, num_ports;
2743 proto_item* ti;
2744 proto_tree* port_tree;
2746 if (total_len < 2)
2748 expert_add_info(pinfo, item, &ei_mal_time_sync_port_log_announce);
2749 return total_len;
2752 num_ports = tvb_get_letohs( tvb, offset);
2753 proto_tree_add_item( tree, hf_time_sync_port_log_announce_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2755 if (2+num_ports*4 < total_len)
2757 expert_add_info(pinfo, item, &ei_mal_time_sync_port_log_announce_ports);
2758 return total_len;
2761 for (i = 0; i < num_ports; i++)
2763 ti = proto_tree_add_text(tree, NULL, offset+2+i*4, 4, "Port #%d", i+1);
2764 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_log_announce);
2765 proto_tree_add_item(port_tree, hf_time_sync_port_log_announce_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
2766 proto_tree_add_item(port_tree, hf_time_sync_port_log_announce_interval, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
2769 return 2+num_ports*4;
2772 static int dissect_time_sync_port_log_sync(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2773 int offset, int total_len)
2775 guint16 i, num_ports;
2776 proto_item* ti;
2777 proto_tree* port_tree;
2779 if (total_len < 2)
2781 expert_add_info(pinfo, item, &ei_mal_time_sync_port_log_sync);
2782 return total_len;
2785 num_ports = tvb_get_letohs( tvb, offset);
2786 proto_tree_add_item( tree, hf_time_sync_port_log_sync_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2788 if (2+num_ports*4 < total_len)
2790 expert_add_info(pinfo, item, &ei_mal_time_sync_port_log_sync_ports);
2791 return total_len;
2794 for (i = 0; i < num_ports; i++)
2796 ti = proto_tree_add_text(tree, NULL, offset+2+i*4, 4, "Port #%d", i+1);
2797 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_log_sync);
2798 proto_tree_add_item(port_tree, hf_time_sync_port_log_sync_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
2799 proto_tree_add_item(port_tree, hf_time_sync_port_log_sync_port_log_sync_interval, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
2802 return 2+num_ports*4;
2805 static int dissect_time_sync_clock_type(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2806 int offset, int total_len)
2808 proto_item* ti;
2809 proto_tree* flag_tree;
2811 if (total_len < 2)
2813 expert_add_info(pinfo, item, &ei_mal_time_sync_clock_type);
2814 return total_len;
2817 ti = proto_tree_add_item( tree, hf_time_sync_clock_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2818 flag_tree = proto_item_add_subtree(ti, ett_time_sync_clock_type);
2819 proto_tree_add_item( flag_tree, hf_time_sync_clock_type_management, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2820 proto_tree_add_item( flag_tree, hf_time_sync_clock_type_end_to_end, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2821 proto_tree_add_item( flag_tree, hf_time_sync_clock_type_boundary, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2822 proto_tree_add_item( flag_tree, hf_time_sync_clock_type_ordinary, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2823 proto_tree_add_item( flag_tree, hf_time_sync_clock_type_slave_only, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2825 return 2;
2828 static int dissect_time_sync_manufacture_id(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2829 int offset, int total_len)
2831 if (total_len < 4)
2833 expert_add_info(pinfo, item, &ei_mal_time_sync_manufacture_id);
2834 return total_len;
2837 proto_tree_add_item( tree, hf_time_sync_manufacture_id_oui, tvb, offset, 3, ENC_LITTLE_ENDIAN);
2838 proto_tree_add_item( tree, hf_time_sync_manufacture_id_reserved, tvb, offset+3, 1, ENC_LITTLE_ENDIAN);
2839 return 4;
2842 static int dissect_time_sync_prod_desc(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2843 int offset, int total_len)
2845 guint32 size;
2847 if (total_len < 4)
2849 expert_add_info(pinfo, item, &ei_mal_time_sync_prod_desc);
2850 return total_len;
2853 size = tvb_get_letohl( tvb, offset);
2854 proto_tree_add_item( tree, hf_time_sync_prod_desc_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2856 if (size > 64)
2858 expert_add_info(pinfo, item, &ei_mal_time_sync_prod_desc_64);
2859 return total_len;
2862 if ((int)(size+4) < total_len)
2864 expert_add_info(pinfo, item, &ei_mal_time_sync_prod_desc_size);
2865 return total_len;
2868 proto_tree_add_item( tree, hf_time_sync_prod_desc_str, tvb, offset+4, size, ENC_ASCII|ENC_NA);
2869 return size+4;
2872 static int dissect_time_sync_revision_data(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2873 int offset, int total_len)
2875 guint32 size;
2877 if (total_len < 4)
2879 expert_add_info(pinfo, item, &ei_mal_time_sync_revision_data);
2880 return total_len;
2883 size = tvb_get_letohl( tvb, offset);
2884 proto_tree_add_item( tree, hf_time_sync_revision_data_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2886 if (size > 32)
2888 expert_add_info(pinfo, item, &ei_mal_time_sync_revision_data_32);
2889 return total_len;
2892 if ((int)(size+4) < total_len)
2894 expert_add_info(pinfo, item, &ei_mal_time_sync_revision_data_size);
2895 return total_len;
2898 proto_tree_add_item( tree, hf_time_sync_revision_data_str, tvb, offset+4, size, ENC_ASCII|ENC_NA);
2899 return size+4;
2902 static int dissect_time_sync_user_desc(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2903 int offset, int total_len)
2905 guint32 size;
2907 if (total_len < 4)
2909 expert_add_info(pinfo, item, &ei_mal_time_sync_user_desc);
2910 return total_len;
2913 size = tvb_get_letohl( tvb, offset);
2914 proto_tree_add_item( tree, hf_time_sync_user_desc_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2916 if (size > 128)
2918 expert_add_info(pinfo, item, &ei_mal_time_sync_user_desc_128);
2919 return total_len;
2922 if ((int)(size+4) < total_len)
2924 expert_add_info(pinfo, item, &ei_mal_time_sync_user_desc_size);
2925 return total_len;
2928 proto_tree_add_item( tree, hf_time_sync_user_desc_str, tvb, offset+4, size, ENC_ASCII|ENC_NA);
2929 return size+4;
2932 static int dissect_time_sync_port_profile_id_info(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2933 int offset, int total_len)
2935 guint16 i, num_ports;
2936 proto_item* ti;
2937 proto_tree* port_tree;
2939 if (total_len < 2)
2941 expert_add_info(pinfo, item, &ei_mal_time_sync_port_profile_id_info);
2942 return total_len;
2945 num_ports = tvb_get_letohs( tvb, offset);
2946 proto_tree_add_item( tree, hf_time_sync_port_profile_id_info_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2948 if (2+num_ports*10 < total_len)
2950 expert_add_info(pinfo, item, &ei_mal_time_sync_port_profile_id_info_ports);
2951 return total_len;
2954 for (i = 0; i < num_ports; i++)
2956 ti = proto_tree_add_text(tree, NULL, offset+2+i*10, 10, "Port #%d", i+1);
2957 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_profile_id_info);
2958 proto_tree_add_item(port_tree, hf_time_sync_port_profile_id_info_port_num, tvb, offset+2+i*10, 2, ENC_LITTLE_ENDIAN);
2959 proto_tree_add_item(port_tree, hf_time_sync_port_profile_id_info_profile_id, tvb, offset+4+i*10, 8, ENC_NA);
2962 return 2+num_ports*10;
2965 static int dissect_time_sync_port_phys_addr_info(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
2966 int offset, int total_len)
2968 guint16 i, num_ports;
2969 proto_item* ti;
2970 proto_tree* port_tree;
2972 if (total_len < 2)
2974 expert_add_info(pinfo, item, &ei_mal_time_sync_port_phys_addr_info);
2975 return total_len;
2978 num_ports = tvb_get_letohs( tvb, offset);
2979 proto_tree_add_item( tree, hf_time_sync_port_phys_addr_info_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2981 if (2+num_ports*36 < total_len)
2983 expert_add_info(pinfo, item, &ei_mal_time_sync_port_phys_addr_info_ports);
2984 return total_len;
2987 for (i = 0; i < num_ports; i++)
2989 ti = proto_tree_add_text(tree, NULL, offset+2+i*36, 36, "Port #%d", i+1);
2990 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_phys_addr_info);
2991 proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_port_num, tvb, offset+2+i*36, 2, ENC_LITTLE_ENDIAN);
2992 proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_phys_proto, tvb, offset+4+i*36, 16, ENC_NA);
2993 proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_addr_size, tvb, offset+20+i*36, 2, ENC_LITTLE_ENDIAN);
2994 proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_phys_proto, tvb, offset+22+i*36, 16, ENC_NA);
2997 return 2+num_ports*36;
3000 static int dissect_time_sync_port_proto_addr_info(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
3001 int offset, int total_len)
3003 guint16 i, num_ports;
3004 proto_item* ti;
3005 proto_tree* port_tree;
3007 if (total_len < 2)
3009 expert_add_info(pinfo, item, &ei_mal_time_sync_port_proto_addr_info);
3010 return total_len;
3013 num_ports = tvb_get_letohs( tvb, offset);
3014 proto_tree_add_item( tree, hf_time_sync_port_proto_addr_info_num_ports, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3016 if (2+num_ports*22 < total_len)
3018 expert_add_info(pinfo, item, &ei_mal_time_sync_port_proto_addr_info_ports);
3019 return total_len;
3022 for (i = 0; i < num_ports; i++)
3024 ti = proto_tree_add_text(tree, NULL, offset+2+i*22, 22, "Port #%d", i+1);
3025 port_tree = proto_item_add_subtree(ti, ett_time_sync_port_proto_addr_info);
3026 proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_port_num, tvb, offset+2+i*22, 2, ENC_LITTLE_ENDIAN);
3027 proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_network_proto, tvb, offset+4+i*22, 2, ENC_LITTLE_ENDIAN);
3028 proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_addr_size, tvb, offset+6+i*22, 2, ENC_LITTLE_ENDIAN);
3029 proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_port_proto_addr, tvb, offset+8+i*22, 16, ENC_NA);
3032 return 2+num_ports*22;
3035 static int dissect_time_sync_sys_time_and_offset(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
3036 int offset, int total_len)
3038 if (total_len < 16)
3040 expert_add_info(pinfo, item, &ei_mal_time_sync_sys_time_and_offset);
3041 return total_len;
3044 proto_tree_add_item( tree, hf_time_sync_sys_time_and_offset_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
3045 proto_tree_add_item( tree, hf_time_sync_sys_time_and_offset_offset, tvb, offset+8, 8, ENC_LITTLE_ENDIAN);
3046 return 16;
3050 static attribute_info_t cip_attribute_vals[] = {
3052 /* Identity Object */
3053 {0x01, FALSE, 1, "Vendor ID", cip_uint, &hf_id_vendor_id, NULL},
3054 {0x01, FALSE, 2, "Device Type", cip_uint, &hf_id_device_type, NULL},
3055 {0x01, FALSE, 3, "Product Code", cip_uint, &hf_id_produce_code, NULL},
3056 {0x01, FALSE, 4, "Revision", cip_dissector_func, NULL, dissect_id_revision},
3057 {0x01, FALSE, 5, "Status", cip_word, &hf_id_status, NULL},
3058 {0x01, FALSE, 6, "Serial Number", cip_udint, &hf_id_serial_number, NULL},
3059 {0x01, FALSE, 7, "Product Name", cip_short_string, &hf_id_product_name, NULL},
3061 /* Message Router Object */
3062 {0x02, FALSE, 1, "Object List", cip_dissector_func, NULL, dissect_msg_rout_num_classes},
3063 {0x02, FALSE, 2, "Number Available", cip_uint, &hf_msg_rout_num_available, NULL},
3064 {0x02, FALSE, 3, "Number Active", cip_uint, &hf_msg_rout_num_active, NULL},
3065 {0x02, FALSE, 4, "Active Connections", cip_uint_array, &hf_msg_rout_active_connections, NULL},
3067 /* Connection Manager Object */
3068 {0x06, FALSE, 1, "Open Requests", cip_uint, &hf_conn_mgr_open_requests, NULL},
3069 {0x06, FALSE, 2, "Open Format Rejects", cip_uint, &hf_conn_mgr_open_format_rejects, NULL},
3070 {0x06, FALSE, 3, "Open Resource Rejects", cip_uint, &hf_conn_mgr_open_resource_rejects, NULL},
3071 {0x06, FALSE, 4, "Other Open Rejects", cip_uint, &hf_conn_mgr_other_open_rejects, NULL},
3072 {0x06, FALSE, 5, "Close Requests", cip_uint, &hf_conn_mgr_close_requests, NULL},
3073 {0x06, FALSE, 6, "Close Format Requests", cip_uint, &hf_conn_close_format_requests, NULL},
3074 {0x06, FALSE, 7, "Close Other Requests", cip_uint, &hf_conn_mgr_close_other_requests, NULL},
3075 {0x06, FALSE, 8, "Connection Timeouts", cip_uint, &hf_conn_mgr_conn_timouts, NULL},
3077 /* Time Sync Object */
3078 {0x43, FALSE, 1, "PTP Enable", cip_bool, &hf_time_sync_ptp_enable, NULL},
3079 {0x43, FALSE, 2, "Is Synchronized", cip_bool, &hf_time_sync_is_synchronized, NULL},
3080 {0x43, FALSE, 3, "System Time (Microseconds)", cip_ulint, &hf_time_sync_sys_time_micro, NULL},
3081 {0x43, FALSE, 4, "System Time (Nanoseconds)", cip_ulint, &hf_time_sync_sys_time_nano, NULL},
3082 {0x43, FALSE, 5, "Offset from Master", cip_lint, &hf_time_sync_offset_from_master, NULL},
3083 {0x43, FALSE, 6, "Max Offset from Master", cip_ulint, &hf_time_sync_max_offset_from_master, NULL},
3084 {0x43, FALSE, 7, "Mean Path Delay To Master", cip_lint, &hf_time_sync_mean_path_delay_to_master, NULL},
3085 {0x43, FALSE, 8, "Grand Master Clock Info", cip_dissector_func, NULL, dissect_time_sync_grandmaster_clock},
3086 {0x43, FALSE, 9, "Parent Clock Info", cip_dissector_func, NULL, dissect_time_sync_parent_clock},
3087 {0x43, FALSE, 10, "Local Clock Info", cip_dissector_func, NULL, dissect_time_sync_local_clock},
3088 {0x43, FALSE, 11, "Number of Ports", cip_uint, &hf_time_sync_num_ports, NULL},
3089 {0x43, FALSE, 12, "Port State Info", cip_dissector_func, NULL, dissect_time_sync_port_state_info},
3090 {0x43, FALSE, 13, "Port Enable Cfg", cip_dissector_func, NULL, dissect_time_sync_port_enable_cfg},
3091 {0x43, FALSE, 14, "Port Log Announcement Interval Cfg", cip_dissector_func, NULL, dissect_time_sync_port_log_announce},
3092 {0x43, FALSE, 15, "Port Log Sync Interval Cfg", cip_dissector_func, NULL, dissect_time_sync_port_log_sync},
3093 {0x43, FALSE, 16, "Priority1", cip_usint, &hf_time_sync_priority1, NULL},
3094 {0x43, FALSE, 17, "Priority2", cip_usint, &hf_time_sync_priority2, NULL},
3095 {0x43, FALSE, 18, "Domain number", cip_usint, &hf_time_sync_domain_number, NULL},
3096 {0x43, FALSE, 19, "Clock Type", cip_dissector_func, NULL, dissect_time_sync_clock_type},
3097 {0x43, FALSE, 20, "Manufacture Identity", cip_dissector_func, NULL, dissect_time_sync_manufacture_id},
3098 {0x43, FALSE, 21, "Product Description", cip_dissector_func, NULL, dissect_time_sync_prod_desc},
3099 {0x43, FALSE, 22, "Revision Data", cip_dissector_func, NULL, dissect_time_sync_revision_data},
3100 {0x43, FALSE, 23, "User Description", cip_dissector_func, NULL, dissect_time_sync_user_desc},
3101 {0x43, FALSE, 24, "Port Profile Identity Info", cip_dissector_func, NULL, dissect_time_sync_port_profile_id_info},
3102 {0x43, FALSE, 25, "Port Physical Address Info", cip_dissector_func, NULL, dissect_time_sync_port_phys_addr_info},
3103 {0x43, FALSE, 26, "Port Protocol Address Info", cip_dissector_func, NULL, dissect_time_sync_port_proto_addr_info},
3104 {0x43, FALSE, 27, "Steps Removed", cip_uint, &hf_time_sync_steps_removed, NULL},
3105 {0x43, FALSE, 28, "System Time and Offset", cip_dissector_func, NULL, dissect_time_sync_sys_time_and_offset},
3109 typedef struct attribute_val_array {
3110 size_t size;
3111 attribute_info_t* attrs;
3112 } attribute_val_array_t;
3114 static attribute_val_array_t all_attribute_vals[] = {
3115 {sizeof(cip_attribute_vals)/sizeof(attribute_info_t), cip_attribute_vals},
3116 {sizeof(enip_attribute_vals)/sizeof(attribute_info_t), enip_attribute_vals},
3117 {sizeof(cip_safety_attribute_vals)/sizeof(attribute_info_t), cip_safety_attribute_vals}
3120 static void
3121 dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info *pinfo, cip_req_info_t *preq_info );
3123 static attribute_info_t* cip_get_attribute(guint class_id, guint instance, guint attribute)
3125 size_t i, j;
3126 attribute_val_array_t* att_array;
3127 attribute_info_t* pattr;
3129 for (i = 0; i < sizeof(all_attribute_vals)/sizeof(attribute_val_array_t); i++)
3131 att_array = &all_attribute_vals[i];
3132 for (j = 0; j < att_array->size; j++)
3134 pattr = &att_array->attrs[j];
3135 if ((pattr->class_id == class_id) &&
3136 (instance != (guint)-1) &&
3137 (((instance == 0) && (pattr->class_instance == TRUE)) || ((instance != 0) && (pattr->class_instance == FALSE))) &&
3138 (pattr->attribute == attribute))
3140 return pattr;
3145 return NULL;
3148 static gboolean
3149 dissect_cia(tvbuff_t *tvb, int offset, int* pathpos, unsigned char segment_type,
3150 gboolean generate, gboolean packed, packet_info *pinfo, proto_item *epath_item,
3151 proto_item *item, proto_tree *tree, proto_item *path_item, proto_item ** ret_item,
3152 const char* segment_name, const value_string* vals, int* value,
3153 int hf8, int hf16, int hf32)
3155 int temp_data;
3156 wmem_strbuf_t *strbuf;
3158 switch (segment_type)
3160 case CI_LOGICAL_SEG_8_BIT:
3161 temp_data = tvb_get_guint8( tvb, offset + *pathpos + 1 );
3163 if ( generate )
3165 *ret_item = proto_tree_add_uint(item, hf8, NULL, 0, 0, temp_data );
3166 PROTO_ITEM_SET_GENERATED(*ret_item);
3168 else
3170 *ret_item = proto_tree_add_item(tree, hf8, tvb, offset + *pathpos + 1, 1, ENC_LITTLE_ENDIAN);
3173 if (vals == NULL)
3175 proto_item_append_text( epath_item, "%s: 0x%02X", segment_name, temp_data);
3177 else
3179 strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name);
3180 wmem_strbuf_append(strbuf, ": 0x%02X");
3182 proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) );
3185 if (value != NULL)
3186 *value = temp_data;
3188 proto_item_set_len( item, 2);
3189 proto_item_set_len( path_item, 2);
3190 (*pathpos) += 2;
3191 break;
3192 case CI_LOGICAL_SEG_16_BIT:
3193 if (packed)
3195 temp_data = tvb_get_letohs( tvb, offset + *pathpos + 1 );
3197 else
3199 temp_data = tvb_get_letohs( tvb, offset + *pathpos + 2 );
3202 if ( generate )
3204 *ret_item = proto_tree_add_uint(tree, hf16, NULL, 0, 0, temp_data );
3205 PROTO_ITEM_SET_GENERATED(*ret_item);
3207 else
3209 if (packed)
3211 *ret_item = proto_tree_add_item( tree, hf16, tvb, offset + *pathpos + 1, 2, ENC_LITTLE_ENDIAN);
3213 else
3215 *ret_item = proto_tree_add_item( tree, hf16, tvb, offset + *pathpos + 2, 2, ENC_LITTLE_ENDIAN);
3219 if (vals == NULL)
3221 proto_item_append_text( epath_item, "%s: 0x%04X", segment_name, temp_data);
3223 else
3225 strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name);
3226 wmem_strbuf_append(strbuf, ": 0x%04X");
3228 proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) );
3231 if (value != NULL)
3232 *value = temp_data;
3234 if (packed)
3236 proto_item_set_len( item, 3);
3237 proto_item_set_len( path_item, 3);
3238 (*pathpos) += 3;
3240 else
3242 proto_item_set_len( item, 4);
3243 proto_item_set_len( path_item, 4);
3244 (*pathpos) += 4;
3246 break;
3247 case CI_LOGICAL_SEG_32_BIT:
3248 if (packed)
3250 temp_data = tvb_get_letohl( tvb, offset + *pathpos + 1 );
3252 else
3254 temp_data = tvb_get_letohl( tvb, offset + *pathpos + 2 );
3257 if ( generate )
3259 *ret_item = proto_tree_add_uint(tree, hf32, NULL, 0, 0, temp_data );
3260 PROTO_ITEM_SET_GENERATED(*ret_item);
3262 else
3264 if (packed)
3266 *ret_item = proto_tree_add_item( tree, hf32, tvb, offset + *pathpos + 1, 4, ENC_LITTLE_ENDIAN);
3268 else
3270 *ret_item = proto_tree_add_item( tree, hf32, tvb, offset + *pathpos + 2, 4, ENC_LITTLE_ENDIAN);
3274 if (vals == NULL)
3276 proto_item_append_text( epath_item, "%s: 0x%08X", segment_name, temp_data);
3278 else
3280 strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name);
3281 wmem_strbuf_append(strbuf, ": 0x%08X");
3283 proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) );
3286 if (value != NULL)
3287 *value = temp_data;
3289 if (packed)
3291 proto_item_set_len( item, 5);
3292 proto_item_set_len( path_item, 5);
3293 (*pathpos) += 5;
3295 else
3297 proto_item_set_len( item, 6);
3298 proto_item_set_len( path_item, 6);
3299 (*pathpos) += 6;
3301 break;
3302 default:
3303 expert_add_info(pinfo, epath_item, &ei_proto_log_seg_format);
3304 return FALSE;
3307 return TRUE;
3310 /* Dissect Device ID structure */
3311 static void
3312 dissect_deviceid(tvbuff_t *tvb, int offset, proto_tree *tree,
3313 int hf_vendor, int hf_devtype, int hf_prodcode,
3314 int hf_compatibility, int hf_comp_bit, int hf_majrev, int hf_minrev)
3316 guint compatibility;
3317 proto_item *compatibility_item;
3318 proto_item *compatibility_tree;
3320 proto_tree_add_item(tree, hf_vendor, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3321 proto_tree_add_item(tree, hf_devtype, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
3322 proto_tree_add_item(tree, hf_prodcode, tvb, offset+4, 2, ENC_LITTLE_ENDIAN);
3324 /* Major revision/Compatibility */
3325 compatibility = tvb_get_guint8( tvb, offset+6);
3327 /* Add Major revision/Compatibility tree */
3328 compatibility_item = proto_tree_add_uint_format_value(tree, hf_compatibility,
3329 tvb, offset+6, 1, compatibility, "%s, Major Revision: %d",
3330 val_to_str_const( ( compatibility & 0x80 )>>7, cip_com_bit_vals , "" ),
3331 compatibility & 0x7F);
3332 compatibility_tree = proto_item_add_subtree(compatibility_item, ett_mcsc);
3334 proto_tree_add_item(compatibility_tree, hf_comp_bit, tvb, offset+6, 1, ENC_LITTLE_ENDIAN );
3335 proto_tree_add_item(compatibility_tree, hf_majrev, tvb, offset+6, 1, ENC_LITTLE_ENDIAN );
3336 proto_tree_add_item(tree, hf_minrev, tvb, offset+7, 1, ENC_LITTLE_ENDIAN );
3339 static void
3340 dissect_net_param16(tvbuff_t *tvb, int offset, proto_tree *tree,
3341 int hf_net_param16, int hf_owner, int hf_type,
3342 int hf_priority, int hf_fixed_var, int hf_con_size, gint ncp_ett)
3344 proto_item *net_param_item;
3345 proto_tree *net_param_tree;
3347 net_param_item = proto_tree_add_item(tree, hf_net_param16, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3348 net_param_tree = proto_item_add_subtree(net_param_item, ncp_ett);
3350 /* Add the data to the tree */
3351 proto_tree_add_item(net_param_tree, hf_owner, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3352 proto_tree_add_item(net_param_tree, hf_type, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3353 proto_tree_add_item(net_param_tree, hf_priority, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3354 proto_tree_add_item(net_param_tree, hf_fixed_var, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3355 proto_tree_add_item(net_param_tree, hf_con_size, tvb, offset, 2, ENC_LITTLE_ENDIAN );
3358 static void
3359 dissect_net_param32(tvbuff_t *tvb, int offset, proto_tree *tree,
3360 int hf_net_param16, int hf_owner, int hf_type,
3361 int hf_priority, int hf_fixed_var, int hf_con_size, gint ncp_ett)
3363 proto_item *net_param_item;
3364 proto_tree *net_param_tree;
3366 net_param_item = proto_tree_add_item(tree, hf_net_param16, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3367 net_param_tree = proto_item_add_subtree(net_param_item, ncp_ett);
3369 /* Add the data to the tree */
3370 proto_tree_add_item(net_param_tree, hf_owner, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3371 proto_tree_add_item(net_param_tree, hf_type, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3372 proto_tree_add_item(net_param_tree, hf_priority, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3373 proto_tree_add_item(net_param_tree, hf_fixed_var, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3374 proto_tree_add_item(net_param_tree, hf_con_size, tvb, offset, 4, ENC_LITTLE_ENDIAN );
3377 static void
3378 dissect_transport_type_trigger(tvbuff_t *tvb, int offset, proto_tree *tree,
3379 int hf_ttt, int hf_direction, int hf_trigger, int hf_class, gint ett)
3381 proto_item *ttt_item;
3382 proto_tree *ttt_tree;
3384 ttt_item = proto_tree_add_item(tree, hf_ttt, tvb, offset, 1, ENC_LITTLE_ENDIAN );
3385 ttt_tree = proto_item_add_subtree(ttt_item, ett);
3387 proto_tree_add_item(ttt_tree, hf_direction, tvb, offset, 1, ENC_LITTLE_ENDIAN );
3388 proto_tree_add_item(ttt_tree, hf_trigger, tvb, offset, 1, ENC_LITTLE_ENDIAN );
3389 proto_tree_add_item(ttt_tree, hf_class, tvb, offset, 1, ENC_LITTLE_ENDIAN );
3392 /* Dissect EPATH */
3393 void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, int offset, int path_length,
3394 gboolean generate, gboolean packed, cip_simple_request_info_t* req_data, cip_safety_epath_info_t* safety)
3396 int pathpos, temp_data, temp_data2, seg_size, i;
3397 unsigned char segment_type, opt_link_size;
3398 proto_tree *path_tree, *port_tree, *net_tree;
3399 proto_tree *cia_tree, *ds_tree, *ds_data_tree, *path_seg_tree, *safety_tree;
3400 proto_item *it, *cia_item, *cia_ret_item, *port_item, *ds_item, *ds_data_item;
3401 proto_item *net_item, *hidden_item, *path_seg_item, *safety_item;
3403 attribute_info_t* att_info;
3405 /* Create a sub tree for the epath */
3406 path_tree = proto_item_add_subtree( epath_item, ett_path );
3408 /* can't populate req_data unless it's there */
3409 if (req_data != NULL)
3411 req_data->iClass = (guint32)-1;
3412 req_data->iInstance = (guint32)-1;
3413 req_data->iAttribute = (guint32)-1;
3414 req_data->iMember = (guint32)-1;
3416 if (safety != NULL)
3417 safety->safety_seg = FALSE;
3419 if ( !generate )
3421 hidden_item = proto_tree_add_item(path_tree, hf_cip_epath,
3422 tvb, offset, path_length, ENC_NA );
3423 PROTO_ITEM_SET_HIDDEN(hidden_item);
3426 pathpos = 0;
3428 while( pathpos < path_length )
3430 if (tvb_reported_length_remaining(tvb, offset + pathpos) <= 0)
3432 expert_add_info(pinfo, epath_item, &ei_mal_incomplete_epath);
3433 return;
3436 /* Get segement type */
3437 segment_type = tvb_get_guint8( tvb, offset + pathpos );
3439 if ( generate )
3441 path_seg_item = proto_tree_add_uint(path_tree, hf_cip_path_segment, NULL, 0, 0, segment_type );
3442 PROTO_ITEM_SET_GENERATED(path_seg_item);
3443 path_seg_tree = proto_item_add_subtree( path_seg_item, ett_path_seg );
3444 it = proto_tree_add_uint(path_seg_tree, hf_cip_path_segment_type, NULL, 0, 0, segment_type&CI_SEGMENT_TYPE_MASK);
3445 PROTO_ITEM_SET_GENERATED(it);
3447 else
3449 path_seg_item = proto_tree_add_item(path_tree, hf_cip_path_segment, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN);
3450 path_seg_tree = proto_item_add_subtree( path_seg_item, ett_path_seg );
3451 proto_tree_add_item(path_seg_tree, hf_cip_path_segment_type, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN);
3454 /* Determine the segment type */
3456 switch( segment_type & CI_SEGMENT_TYPE_MASK )
3458 case CI_PORT_SEGMENT:
3459 /* Add Extended Link Address flag & Port Identifier*/
3460 if ( generate )
3462 it = proto_tree_add_boolean(path_seg_tree, hf_cip_port_ex_link_addr, NULL, 0, 0, segment_type & CI_PORT_SEG_EX_LINK_ADDRESS);
3463 PROTO_ITEM_SET_GENERATED(it);
3464 it = proto_tree_add_uint(path_seg_tree, hf_cip_port, NULL, 0, 0, ( segment_type & 0x0F ) );
3465 PROTO_ITEM_SET_GENERATED(it);
3466 port_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "Port Segment");
3467 PROTO_ITEM_SET_GENERATED(port_item);
3469 else
3471 proto_tree_add_item(path_seg_tree, hf_cip_port_ex_link_addr, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN );
3472 proto_tree_add_item(path_seg_tree, hf_cip_port, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN);
3473 port_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "Port Segment");
3476 proto_item_append_text( path_seg_item, " (Port Segment)");
3477 proto_item_append_text( epath_item, "Port: %d", ( segment_type & CI_PORT_SEG_PORT_ID_MASK ) );
3478 port_tree = proto_item_add_subtree( port_item, ett_port_path );
3480 if( segment_type & CI_PORT_SEG_EX_LINK_ADDRESS )
3482 opt_link_size = tvb_get_guint8( tvb, offset + pathpos + 1 );
3484 if ( generate )
3486 /* Add size of extended link address */
3487 it = proto_tree_add_uint(port_tree, hf_cip_link_address_size, NULL, 0, 0, opt_link_size);
3488 PROTO_ITEM_SET_GENERATED(it);
3489 /* Add extended link address */
3490 it = proto_tree_add_string(port_tree, hf_cip_link_address_string, NULL, 0, 0, tvb_format_text(tvb, offset+pathpos+2, opt_link_size) );
3491 PROTO_ITEM_SET_GENERATED(it);
3493 else
3495 proto_tree_add_item( port_tree, hf_cip_link_address_size, tvb, offset+pathpos+1, 1, ENC_LITTLE_ENDIAN );
3496 proto_tree_add_item( port_tree, hf_cip_link_address_string, tvb, offset+pathpos+2, opt_link_size, ENC_ASCII|ENC_NA );
3499 proto_item_append_text( epath_item, ", Address: %s", tvb_format_text(tvb, offset+pathpos+2, opt_link_size) );
3501 /* Pad byte */
3502 if( opt_link_size % 2 )
3504 proto_item_set_len( port_item, 3 + opt_link_size );
3505 proto_item_set_len( path_seg_item, 3 + opt_link_size );
3506 pathpos += (3 + opt_link_size);
3508 else
3510 proto_item_set_len( port_item, 2 + opt_link_size );
3511 proto_item_set_len( path_seg_item, 2 + opt_link_size );
3512 pathpos += (2 + opt_link_size);
3515 else
3517 /* Add Link Address */
3518 if ( generate )
3520 it = proto_tree_add_uint(port_tree, hf_cip_link_address_byte, NULL, 0, 0, tvb_get_guint8( tvb, offset + pathpos + 1 ) );
3521 PROTO_ITEM_SET_GENERATED(it);
3523 else
3525 proto_tree_add_item(port_tree, hf_cip_link_address_byte, tvb, offset+pathpos+1, 1, ENC_LITTLE_ENDIAN );
3528 proto_item_append_text( epath_item, ", Address: %d",tvb_get_guint8( tvb, offset + pathpos + 1 ) );
3530 proto_item_set_len( port_item, 2 );
3531 proto_item_set_len( path_seg_item, 2);
3532 pathpos += 2;
3535 break;
3537 case CI_LOGICAL_SEGMENT:
3539 /* Logical segment, determine the logical type */
3540 if ( generate )
3542 it = proto_tree_add_uint(path_seg_tree, hf_cip_logical_seg_type, NULL, 0, 0, segment_type & CI_LOGICAL_SEG_TYPE_MASK);
3543 PROTO_ITEM_SET_GENERATED(it);
3544 if ((segment_type & CI_LOGICAL_SEG_TYPE_MASK) <= CI_LOGICAL_SEG_ATTR_ID)
3546 it = proto_tree_add_uint(path_seg_tree, hf_cip_logical_seg_format, NULL, 0, 0, segment_type & CI_LOGICAL_SEG_FORMAT_MASK);
3547 PROTO_ITEM_SET_GENERATED(it);
3549 cia_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved"));
3550 PROTO_ITEM_SET_GENERATED(cia_item);
3552 else
3554 proto_tree_add_item(path_seg_tree, hf_cip_logical_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN );
3555 if ((segment_type & CI_LOGICAL_SEG_TYPE_MASK) <= CI_LOGICAL_SEG_ATTR_ID)
3556 proto_tree_add_item(path_seg_tree, hf_cip_logical_seg_format, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN);
3557 cia_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved"));
3560 proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved"));
3561 cia_tree = proto_item_add_subtree( cia_item, ett_cia_path );
3563 switch( segment_type & CI_LOGICAL_SEG_TYPE_MASK )
3565 case CI_LOGICAL_SEG_CLASS_ID:
3566 if (dissect_cia(tvb, offset, &pathpos, segment_type & CI_LOGICAL_SEG_FORMAT_MASK, generate, packed, pinfo,
3567 epath_item, cia_item, cia_tree, path_seg_item, &cia_ret_item,
3568 "Class", cip_class_names_vals, (req_data == NULL) ? NULL : &req_data->iClass,
3569 hf_cip_class8, hf_cip_class16, hf_cip_class32) == FALSE)
3570 return;
3571 break;
3573 case CI_LOGICAL_SEG_INST_ID:
3574 if (dissect_cia(tvb, offset, &pathpos, segment_type & CI_LOGICAL_SEG_FORMAT_MASK, generate, packed, pinfo,
3575 epath_item, cia_item, cia_tree, path_seg_item, &cia_ret_item,
3576 "Instance", NULL, (req_data == NULL) ? NULL : &req_data->iInstance,
3577 hf_cip_instance8, hf_cip_instance16, hf_cip_instance32) == FALSE)
3578 return;
3579 break;
3581 case CI_LOGICAL_SEG_MBR_ID:
3582 if (dissect_cia(tvb, offset, &pathpos, segment_type & CI_LOGICAL_SEG_FORMAT_MASK, generate, packed, pinfo,
3583 epath_item, cia_item, cia_tree, path_seg_item, &cia_ret_item,
3584 "Member", NULL, (req_data == NULL) ? NULL : &req_data->iMember,
3585 hf_cip_member8, hf_cip_member16, hf_cip_member32) == FALSE)
3586 return;
3587 break;
3589 case CI_LOGICAL_SEG_ATTR_ID:
3590 if (dissect_cia(tvb, offset, &pathpos, segment_type & CI_LOGICAL_SEG_FORMAT_MASK, generate, packed, pinfo,
3591 epath_item, cia_item, cia_tree, path_seg_item, &cia_ret_item,
3592 "Attribute", NULL, (req_data == NULL) ? NULL : &req_data->iAttribute,
3593 hf_cip_attribute8, hf_cip_attribute16, hf_cip_attribute32) == FALSE)
3594 return;
3596 if (req_data != NULL)
3598 att_info = cip_get_attribute(req_data->iClass, req_data->iInstance,
3599 req_data->iAttribute);
3600 if (att_info != NULL)
3602 proto_item_append_text(cia_ret_item, " (%s)", att_info->text);
3603 proto_item_append_text(epath_item, " (%s)", att_info->text);
3606 break;
3608 case CI_LOGICAL_SEG_CON_POINT:
3609 if (dissect_cia(tvb, offset, &pathpos, segment_type & CI_LOGICAL_SEG_FORMAT_MASK, generate, packed, pinfo,
3610 epath_item, cia_item, cia_tree, path_seg_item, &cia_ret_item,
3611 "Connection Point", NULL, NULL,
3612 hf_cip_conpoint8, hf_cip_conpoint16, hf_cip_conpoint32) == FALSE)
3613 return;
3614 break;
3616 case CI_LOGICAL_SEG_SPECIAL:
3618 /* Logical Special ID, the only logical format specified is electronic key */
3619 if( ( segment_type & CI_LOGICAL_SEG_FORMAT_MASK ) == CI_LOGICAL_SEG_E_KEY )
3621 /* Get the Key Format */
3622 temp_data = tvb_get_guint8( tvb, offset + pathpos + 1 );
3624 if( temp_data == CI_E_KEY_FORMAT_VAL )
3626 proto_item_set_len(path_seg_item, 10);
3627 proto_item_set_len(cia_item, 10);
3628 proto_tree_add_item( cia_tree, hf_cip_ekey_format, tvb, offset + pathpos+1, 1, ENC_LITTLE_ENDIAN);
3630 /* dissect the device ID */
3631 dissect_deviceid(tvb, offset + pathpos + 2, cia_tree,
3632 hf_cip_ekey_vendor, hf_cip_ekey_devtype, hf_cip_ekey_prodcode,
3633 hf_cip_ekey_compatibility, hf_cip_ekey_comp_bit, hf_cip_ekey_majorrev, hf_cip_ekey_minorrev);
3635 /* Add "summary" information to parent item */
3636 temp_data = tvb_get_letohs( tvb, offset + pathpos + 2 );
3637 proto_item_append_text( cia_tree, " (VendorID: 0x%04X", temp_data );
3638 temp_data = tvb_get_letohs( tvb, offset + pathpos + 4 );
3639 proto_item_append_text( cia_tree, ", DevTyp: 0x%04X", temp_data );
3640 temp_data = tvb_get_guint8( tvb, offset + pathpos + 8 );
3641 temp_data2 = tvb_get_guint8( tvb, offset + pathpos + 9 );
3643 proto_item_append_text(cia_tree, ", %d.%d)", ( temp_data & 0x7F ), temp_data2 );
3644 proto_item_append_text(epath_item, "[Key]" );
3646 pathpos += 10;
3648 else
3650 expert_add_info(pinfo, epath_item, &ei_proto_electronic_key_format);
3651 return;
3654 else
3656 expert_add_info(pinfo, epath_item, &ei_proto_special_segment_format);
3657 return;
3659 break;
3661 default:
3662 expert_add_info(pinfo, epath_item, &ei_proto_log_seg_type);
3663 return;
3665 } /* end of switch( segment_type & CI_LOGICAL_SEG_TYPE_MASK ) */
3666 break;
3668 case CI_DATA_SEGMENT:
3670 /* Data segment, determine the logical type */
3671 if ( generate )
3673 it = proto_tree_add_uint(path_seg_tree, hf_cip_data_seg_type, NULL, 0, 0, segment_type & CI_DATA_SEG_TYPE_MASK);
3674 PROTO_ITEM_SET_GENERATED(it);
3675 ds_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved"));
3676 PROTO_ITEM_SET_GENERATED(ds_item);
3678 else
3680 proto_tree_add_item(path_seg_tree, hf_cip_data_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN );
3681 ds_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved"));
3684 proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved"));
3685 ds_tree = proto_item_add_subtree( ds_item, ett_data_seg );
3687 switch( segment_type & CI_DATA_SEG_TYPE_MASK)
3689 case CI_DATA_SEG_SIMPLE:
3690 /* Segment size */
3691 seg_size = tvb_get_guint8( tvb, offset + pathpos+1 )*2;
3693 proto_tree_add_uint_format_value(ds_tree, hf_cip_data_seg_size,
3694 tvb, offset + pathpos+1, 1, seg_size, "%d (words)", seg_size/2);
3696 /* Segment data */
3697 if( seg_size != 0 )
3699 ds_data_item = proto_tree_add_text( ds_tree, tvb, offset + pathpos+2, 0, "Data" );
3700 ds_data_tree = proto_item_add_subtree( ds_data_item, ett_data_seg_data );
3702 for( i=0; i < seg_size/2; i ++ )
3703 proto_tree_add_item(ds_data_tree, hf_cip_data_seg_item, tvb, offset + pathpos+2+(i*2), 2, ENC_LITTLE_ENDIAN );
3705 proto_item_set_len(ds_data_item, seg_size);
3708 proto_item_set_len( ds_item, 2 + seg_size );
3709 proto_item_set_len( path_seg_item, 2 + seg_size );
3710 pathpos += (2 + seg_size);
3712 proto_item_append_text(epath_item, "[Data]" );
3713 break;
3715 case CI_DATA_SEG_SYMBOL:
3717 /* ANSI extended symbol segment */
3719 /* Segment size */
3720 seg_size = tvb_get_guint8( tvb, offset + pathpos+1 );
3721 if ( generate )
3723 it = proto_tree_add_uint(ds_tree, hf_cip_data_seg_type, NULL, 0, 0, seg_size);
3724 PROTO_ITEM_SET_GENERATED(it);
3726 else
3727 proto_tree_add_item(ds_tree, hf_cip_data_seg_size, tvb, offset + pathpos+1, 1, ENC_LITTLE_ENDIAN );
3729 /* Segment data */
3730 if( seg_size != 0 )
3732 if ( generate )
3734 it = proto_tree_add_string(ds_tree, hf_cip_symbol, NULL, 0, 0, tvb_format_text(tvb, offset + pathpos + 2, seg_size));
3735 PROTO_ITEM_SET_GENERATED(it);
3737 else
3738 proto_tree_add_item( ds_tree, hf_cip_symbol, tvb, offset + pathpos + 2, seg_size, ENC_ASCII|ENC_NA );
3740 proto_item_append_text(epath_item, "%s", tvb_format_text(tvb, offset + pathpos + 2, seg_size));
3743 /* Check for pad byte */
3744 if( seg_size %2 )
3745 seg_size++;
3747 if ( !generate )
3749 proto_item_set_len( ds_item, 2 + seg_size );
3750 proto_item_set_len( path_seg_item, 2 + seg_size );
3752 pathpos += (2 + seg_size);
3754 break;
3756 default:
3757 expert_add_info(pinfo, epath_item, &ei_proto_log_sub_seg_type);
3758 return;
3760 } /* End of switch sub-type */
3762 break;
3764 case CI_NETWORK_SEGMENT:
3766 /* Network segment -Determine the segment sub-type */
3767 if ( generate )
3769 it = proto_tree_add_uint(path_seg_tree, hf_cip_network_seg_type, NULL, 0, 0, segment_type & CI_NETWORK_SEG_TYPE_MASK);
3770 PROTO_ITEM_SET_GENERATED(it);
3771 net_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved"));
3772 PROTO_ITEM_SET_GENERATED(net_item);
3774 else
3776 proto_tree_add_item(path_seg_tree, hf_cip_network_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN );
3777 net_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved"));
3780 proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved"));
3781 net_tree = proto_item_add_subtree( net_item, ett_network_seg );
3783 switch( segment_type & CI_NETWORK_SEG_TYPE_MASK )
3785 case CI_NETWORK_SEG_SCHEDULE:
3786 proto_tree_add_item(net_tree, hf_cip_seg_schedule, tvb, offset+pathpos+1, 1, ENC_LITTLE_ENDIAN );
3788 proto_item_set_len( net_item, 2);
3789 proto_item_set_len( path_seg_item, 2);
3790 pathpos += 2;
3791 break;
3793 case CI_NETWORK_SEG_FIXED_TAG:
3794 proto_tree_add_item(net_tree, hf_cip_seg_fixed_tag, tvb, offset+pathpos+1, 1, ENC_LITTLE_ENDIAN );
3796 proto_item_set_len( net_item, 2);
3797 proto_item_set_len( path_seg_item, 2);
3798 pathpos += 2;
3799 break;
3801 case CI_NETWORK_SEG_PROD_INHI:
3803 temp_data = tvb_get_guint8( tvb, offset + pathpos + 1 );
3804 proto_tree_add_uint_format_value(net_tree, hf_cip_seg_prod_inhibit_time,
3805 tvb, offset + pathpos+1, 1, temp_data, "%dms", temp_data);
3807 proto_item_set_len( net_item, 2);
3808 proto_item_set_len( path_seg_item, 2);
3809 pathpos += 2;
3810 break;
3812 case CI_NETWORK_SEG_SAFETY:
3813 proto_item_append_text(epath_item, "[Safety]" );
3815 /* Segment size */
3816 seg_size = tvb_get_guint8( tvb, offset + pathpos+1 )*2;
3817 proto_tree_add_uint_format_value(net_tree, hf_cip_seg_network_size,
3818 tvb, offset + pathpos+1, 1, seg_size/2, "%d (words)", seg_size/2);
3820 proto_tree_add_item(net_tree, hf_cip_seg_safety_format, tvb, offset+pathpos+2, 1, ENC_LITTLE_ENDIAN );
3821 /* Safety Network Segment Format */
3822 temp_data = tvb_get_guint8( tvb, offset + pathpos + 2 );
3823 if (temp_data < 3)
3825 safety_item = proto_tree_add_text(net_tree, tvb, offset + pathpos+3, seg_size-1, "%s", val_to_str_const(temp_data, cip_safety_segment_format_type_vals, "Reserved"));
3826 safety_tree = proto_item_add_subtree( safety_item, ett_network_seg_safety );
3827 switch (temp_data)
3829 case 0:
3830 /* Target Format */
3831 if (safety != NULL)
3832 safety->format = CIP_SAFETY_BASE_FORMAT;
3834 proto_tree_add_item(safety_tree, hf_cip_seg_safety_reserved, tvb, offset+pathpos+3, 1, ENC_LITTLE_ENDIAN );
3835 proto_tree_add_item(safety_tree, hf_cip_seg_safety_configuration_crc, tvb, offset+pathpos+4, 4, ENC_LITTLE_ENDIAN );
3836 dissect_cipsafety_ssn(safety_tree, tvb, pinfo, offset+pathpos+8, hf_cip_seg_safety_configuration_timestamp, hf_cip_seg_safety_configuration_date, hf_cip_seg_safety_configuration_time);
3837 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_correction_epi, tvb, offset+pathpos+14, 4, ENC_LITTLE_ENDIAN );
3838 dissect_net_param16(tvb, offset+pathpos+18, safety_tree,
3839 hf_cip_seg_safety_time_correction_net_params, hf_cip_seg_safety_time_correction_own,
3840 hf_cip_seg_safety_time_correction_typ, hf_cip_seg_safety_time_correction_prio,
3841 hf_cip_seg_safety_time_correction_fixed_var, hf_cip_seg_safety_time_correction_con_size,
3842 ett_network_seg_safety_time_correction_net_params);
3843 it = proto_tree_add_item(safety_tree, hf_cip_seg_safety_tunid, tvb, offset+pathpos+20, 10, ENC_NA);
3844 dissect_unid(tvb, pinfo, offset+pathpos+20, it, "Target UNID SNN", hf_cip_seg_safety_tunid_ssn_timestamp,
3845 hf_cip_seg_safety_tunid_ssn_date, hf_cip_seg_safety_tunid_ssn_time, hf_cip_seg_safety_tunid_macid,
3846 ett_cip_seg_safety_tunid, ett_cip_seg_safety_tunid_ssn);
3847 it = proto_tree_add_item(safety_tree, hf_cip_seg_safety_ounid, tvb, offset+pathpos+30, 10, ENC_NA);
3848 dissect_unid(tvb, pinfo, offset+pathpos+30, it, "Originator UNID SSN", hf_cip_seg_safety_ounid_ssn_timestamp,
3849 hf_cip_seg_safety_ounid_ssn_date, hf_cip_seg_safety_ounid_ssn_time, hf_cip_seg_safety_ounid_macid,
3850 ett_cip_seg_safety_ounid, ett_cip_seg_safety_ounid_ssn);
3851 proto_tree_add_item(safety_tree, hf_cip_seg_safety_ping_eri_multiplier, tvb, offset+pathpos+40, 2, ENC_LITTLE_ENDIAN );
3852 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_coord_msg_min_multiplier, tvb, offset+pathpos+42, 2, ENC_LITTLE_ENDIAN );
3853 proto_tree_add_item(safety_tree, hf_cip_seg_safety_network_time_expected_multiplier, tvb, offset+pathpos+44, 2, ENC_LITTLE_ENDIAN );
3854 proto_tree_add_item(safety_tree, hf_cip_seg_safety_timeout_multiplier, tvb, offset+pathpos+46, 1, ENC_LITTLE_ENDIAN );
3855 proto_tree_add_item(safety_tree, hf_cip_seg_safety_max_consumer_number, tvb, offset+pathpos+47, 1, ENC_LITTLE_ENDIAN );
3856 proto_tree_add_item(safety_tree, hf_cip_seg_safety_conn_param_crc, tvb, offset+pathpos+48, 4, ENC_LITTLE_ENDIAN );
3857 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_correction_conn_id, tvb, offset+pathpos+52, 4, ENC_LITTLE_ENDIAN );
3858 break;
3859 case 1:
3860 /* Router Format */
3861 if (safety != NULL)
3862 safety->format = CIP_SAFETY_BASE_FORMAT;
3864 proto_tree_add_item(safety_tree, hf_cip_seg_safety_reserved, tvb, offset+pathpos+3, 1, ENC_LITTLE_ENDIAN );
3865 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_correction_conn_id, tvb, offset+pathpos+4, 4, ENC_LITTLE_ENDIAN );
3866 proto_tree_add_item(safety_tree, hf_cip_seg_safety_ping_eri_multiplier, tvb, offset+pathpos+8, 2, ENC_LITTLE_ENDIAN );
3867 dissect_net_param16(tvb, offset+pathpos+10, safety_tree,
3868 hf_cip_seg_safety_time_correction_net_params, hf_cip_seg_safety_time_correction_own,
3869 hf_cip_seg_safety_time_correction_typ, hf_cip_seg_safety_time_correction_prio,
3870 hf_cip_seg_safety_time_correction_fixed_var, hf_cip_seg_safety_time_correction_con_size,
3871 ett_network_seg_safety_time_correction_net_params);
3872 break;
3873 case 2:
3874 /* Extended Format */
3875 if (safety != NULL)
3876 safety->format = CIP_SAFETY_EXTENDED_FORMAT;
3878 proto_tree_add_item(safety_tree, hf_cip_seg_safety_reserved, tvb, offset+pathpos+3, 1, ENC_LITTLE_ENDIAN );
3879 proto_tree_add_item(safety_tree, hf_cip_seg_safety_configuration_crc, tvb, offset+pathpos+4, 4, ENC_LITTLE_ENDIAN );
3880 dissect_cipsafety_ssn(safety_tree, tvb, pinfo, offset+pathpos+8, hf_cip_seg_safety_configuration_timestamp, hf_cip_seg_safety_configuration_date, hf_cip_seg_safety_configuration_time);
3881 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_correction_epi, tvb, offset+pathpos+14, 4, ENC_LITTLE_ENDIAN );
3882 dissect_net_param16(tvb, offset+pathpos+18, safety_tree,
3883 hf_cip_seg_safety_time_correction_net_params, hf_cip_seg_safety_time_correction_own,
3884 hf_cip_seg_safety_time_correction_typ, hf_cip_seg_safety_time_correction_prio,
3885 hf_cip_seg_safety_time_correction_fixed_var, hf_cip_seg_safety_time_correction_con_size,
3886 ett_network_seg_safety_time_correction_net_params);
3887 it = proto_tree_add_item(safety_tree, hf_cip_seg_safety_tunid, tvb, offset+pathpos+20, 10, ENC_NA);
3888 dissect_unid(tvb, pinfo, offset+pathpos+20, it, "Target UNID SNN", hf_cip_seg_safety_tunid_ssn_timestamp,
3889 hf_cip_seg_safety_tunid_ssn_date, hf_cip_seg_safety_tunid_ssn_time, hf_cip_seg_safety_tunid_macid,
3890 ett_cip_seg_safety_tunid, ett_cip_seg_safety_tunid_ssn);
3891 it = proto_tree_add_item(safety_tree, hf_cip_seg_safety_ounid, tvb, offset+pathpos+30, 10, ENC_NA);
3892 dissect_unid(tvb, pinfo, offset+pathpos+30, it, "Originator UNID SSN", hf_cip_seg_safety_ounid_ssn_timestamp,
3893 hf_cip_seg_safety_ounid_ssn_date, hf_cip_seg_safety_ounid_ssn_time, hf_cip_seg_safety_ounid_macid,
3894 ett_cip_seg_safety_ounid, ett_cip_seg_safety_ounid_ssn);
3895 proto_tree_add_item(safety_tree, hf_cip_seg_safety_ping_eri_multiplier, tvb, offset+pathpos+40, 2, ENC_LITTLE_ENDIAN );
3896 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_coord_msg_min_multiplier, tvb, offset+pathpos+42, 2, ENC_LITTLE_ENDIAN );
3897 proto_tree_add_item(safety_tree, hf_cip_seg_safety_network_time_expected_multiplier, tvb, offset+pathpos+44, 2, ENC_LITTLE_ENDIAN );
3898 proto_tree_add_item(safety_tree, hf_cip_seg_safety_timeout_multiplier, tvb, offset+pathpos+46, 1, ENC_LITTLE_ENDIAN );
3899 proto_tree_add_item(safety_tree, hf_cip_seg_safety_max_consumer_number, tvb, offset+pathpos+47, 1, ENC_LITTLE_ENDIAN );
3900 proto_tree_add_item(safety_tree, hf_cip_seg_safety_max_fault_number, tvb, offset+pathpos+48, 2, ENC_LITTLE_ENDIAN );
3901 proto_tree_add_item(safety_tree, hf_cip_seg_safety_conn_param_crc, tvb, offset+pathpos+50, 4, ENC_LITTLE_ENDIAN );
3902 proto_tree_add_item(safety_tree, hf_cip_seg_safety_time_correction_conn_id, tvb, offset+pathpos+54, 4, ENC_LITTLE_ENDIAN );
3903 proto_tree_add_item(safety_tree, hf_cip_seg_safety_init_timestamp, tvb, offset+pathpos+58, 2, ENC_LITTLE_ENDIAN );
3904 proto_tree_add_item(safety_tree, hf_cip_seg_safety_init_rollover, tvb, offset+pathpos+60, 2, ENC_LITTLE_ENDIAN );
3905 break;
3908 else
3910 proto_tree_add_item(net_tree, hf_cip_seg_safety_data, tvb, offset+pathpos+3, seg_size-1, ENC_NA );
3913 if (safety != NULL)
3914 safety->safety_seg = TRUE;
3916 proto_item_set_len( net_item, seg_size+2);
3917 proto_item_set_len( path_seg_item, seg_size+2);
3918 pathpos += (seg_size+2);
3919 break;
3921 default:
3922 expert_add_info(pinfo, epath_item, &ei_proto_log_sub_seg_type);
3923 return;
3925 } /* End of switch sub-type */
3927 break;
3929 default:
3930 expert_add_info(pinfo, epath_item, &ei_proto_seg_type);
3931 return;
3933 } /* end of switch( segment_type & CI_SEGMENT_TYPE_MASK ) */
3935 /* Next path segment */
3936 if( pathpos < path_length )
3937 proto_item_append_text( epath_item, ", " );
3939 } /* end of while( pathpos < path_length ) */
3941 } /* end of dissect_epath() */
3943 /* Number of seconds between Jan 1, 1970 00:00:00 epoch and CIP's epoch time of Jan 1, 1972 00:00:00 */
3944 #define CIP_TIMEBASE 63003600
3946 void dissect_cip_date_and_time(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_datetime)
3948 nstime_t computed_time;
3949 guint16 num_days_since_1972;
3950 guint32 num_ms_today;
3952 num_days_since_1972 = tvb_get_letohs( tvb, offset);
3953 num_ms_today = tvb_get_letohl( tvb, offset+2 );
3955 if ((num_days_since_1972 != 0) || (num_ms_today != 0))
3957 computed_time.secs = CIP_TIMEBASE+(num_days_since_1972*60*60*24);
3958 computed_time.secs += num_ms_today/1000;
3959 computed_time.nsecs = (num_ms_today%1000)*1000000;
3961 else
3963 computed_time.secs = 0;
3964 computed_time.nsecs = 0;
3967 proto_tree_add_time(tree, hf_datetime, tvb, offset, 6, &computed_time);
3970 static int
3971 dissect_cip_attribute(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
3972 attribute_info_t* attr, int offset, int total_len)
3974 int i, temp_data, temp_time, hour, min, sec, ms,
3975 consumed = 0;
3976 time_t computed_time;
3977 struct tm* date;
3978 char date_str[20];
3980 /* sanity check */
3981 if (((attr->datatype == cip_dissector_func) && (attr->pdissect == NULL)) ||
3982 ((attr->datatype != cip_dissector_func) && (attr->phf == NULL)))
3984 DISSECTOR_ASSERT(0);
3985 return total_len;
3988 switch (attr->datatype)
3990 case cip_bool:
3991 case cip_usint:
3992 case cip_sint:
3993 case cip_byte:
3994 proto_tree_add_item(tree, *(attr->phf), tvb, offset, 1, ENC_LITTLE_ENDIAN);
3995 consumed = 1;
3996 break;
3997 case cip_uint:
3998 case cip_int:
3999 case cip_word:
4000 case cip_itime:
4001 proto_tree_add_item(tree, *(attr->phf), tvb, offset, 2, ENC_LITTLE_ENDIAN);
4002 consumed = 2;
4003 break;
4004 case cip_byte_array:
4005 proto_tree_add_item(tree, *(attr->phf), tvb, offset, total_len, ENC_NA);
4006 consumed = total_len;
4007 break;
4008 case cip_usint_array:
4009 for (i = 0; i < total_len; i++)
4010 proto_tree_add_item(tree, *(attr->phf), tvb, offset, total_len, ENC_NA);
4011 consumed = total_len;
4012 break;
4013 case cip_uint_array:
4014 for (i = 0; i < total_len; i+=2)
4015 proto_tree_add_item(tree, *(attr->phf), tvb, offset+i, 2, ENC_LITTLE_ENDIAN);
4016 consumed = i;
4017 break;
4018 case cip_udint:
4019 case cip_dint:
4020 case cip_dword:
4021 case cip_real:
4022 case cip_time:
4023 case cip_ftime:
4024 proto_tree_add_item(tree, *(attr->phf), tvb, offset, 4, ENC_LITTLE_ENDIAN);
4025 consumed = 4;
4026 break;
4027 case cip_ulint:
4028 case cip_lint:
4029 case cip_lword:
4030 case cip_lreal:
4031 case cip_ltime:
4032 proto_tree_add_item(tree, *(attr->phf), tvb, offset, 8, ENC_LITTLE_ENDIAN);
4033 consumed = 8;
4034 break;
4035 case cip_short_string:
4036 temp_data = tvb_get_guint8( tvb, offset );
4037 proto_tree_add_item(tree, *(attr->phf), tvb, offset+1, temp_data, ENC_ASCII|ENC_NA);
4038 consumed = 1+temp_data;
4039 break;
4040 case cip_string:
4041 temp_data = tvb_get_letohs( tvb, offset );
4042 proto_tree_add_item(tree, *(attr->phf), tvb, offset+2, temp_data, ENC_ASCII|ENC_NA);
4043 consumed = 2+temp_data;
4044 break;
4045 case cip_dissector_func:
4046 consumed = attr->pdissect(pinfo, tree, item, tvb, offset, total_len);
4047 break;
4048 case cip_date_and_time:
4049 dissect_cip_date_and_time(tree, tvb, offset, *(attr->phf));
4050 consumed = 6;
4051 break;
4052 case cip_date:
4053 temp_data = tvb_get_letohs( tvb, offset);
4054 /* Convert to nstime epoch */
4055 computed_time = CIP_TIMEBASE+(temp_data*60*60*24);
4056 date = gmtime(&computed_time);
4057 strftime(date_str, 20, "%b %d, %Y", date);
4058 proto_tree_add_uint_format_value(tree, *(attr->phf), tvb, offset, 2, temp_data, "%s", date_str);
4059 consumed = 2;
4060 break;
4061 case cip_time_of_day:
4062 temp_time = temp_data = tvb_get_letohl( tvb, offset);
4063 hour = temp_time/(60*60*1000);
4064 temp_time %= (60*60*1000);
4065 min = temp_time/(60*1000);
4066 temp_time %= (60*1000);
4067 sec = temp_time/1000;
4068 ms = temp_time%1000;
4069 proto_tree_add_uint_format_value(tree, *(attr->phf), tvb, offset, 4, temp_data, "%02d:%02d:%02d.%03d", hour, min, sec, ms);
4070 consumed = 4;
4071 break;
4072 case cip_string2:
4073 case cip_stringN:
4074 case cip_stringi:
4075 /* CURRENTLY NOT SUPPORTED */
4076 expert_add_info(pinfo, item, &ei_proto_unsupported_datatype);
4077 consumed = total_len;
4078 break;
4081 return consumed;
4084 /************************************************
4086 * Dissector for generic CIP object
4088 ************************************************/
4090 static void
4091 dissect_cip_generic_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo, proto_item *ti )
4093 proto_item *pi;
4094 proto_tree *cmd_data_tree;
4095 int req_path_size;
4096 unsigned char add_stat_size;
4097 guint8 service = tvb_get_guint8( tvb, offset );
4099 if (service & 0x80)
4101 /* Response message */
4102 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
4104 /* If there is any command specific data create a sub-tree for it */
4105 if( ( item_length-4-add_stat_size ) != 0 )
4107 pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
4108 cmd_data_tree = proto_item_add_subtree( pi, ett_cmd_data );
4110 /* Add data */
4111 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
4113 else
4115 PROTO_ITEM_SET_HIDDEN( ti );
4118 } /* End of if reply */
4119 else
4121 /* Request message */
4123 add_cip_service_to_info_column(pinfo, service, cip_sc_vals);
4125 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
4127 /* If there is any command specific data creat a sub-tree for it */
4128 if( (item_length-req_path_size-2) != 0 )
4130 pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
4131 cmd_data_tree = proto_item_add_subtree( pi, ett_cmd_data );
4133 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
4135 else
4137 PROTO_ITEM_SET_HIDDEN( ti );
4138 } /* End of if command-specific data present */
4140 } /* End of if-else( request ) */
4142 } /* End of dissect_cip_generic_data() */
4144 static int
4145 dissect_cip_class_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4147 proto_item *ti;
4148 proto_tree *class_tree;
4150 /* Create display subtree for the protocol */
4151 ti = proto_tree_add_item(tree, proto_cip_class_generic, tvb, 0, -1, ENC_NA);
4152 class_tree = proto_item_add_subtree( ti, ett_cip_class_generic );
4154 dissect_cip_generic_data( class_tree, tvb, 0, tvb_length(tvb), pinfo, ti );
4156 return tvb_length(tvb);
4159 static void
4160 dissect_cip_set_attribute_single_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4161 int offset, cip_simple_request_info_t* req_data)
4163 attribute_info_t* attr;
4165 attr = cip_get_attribute(req_data->iClass, req_data->iInstance, req_data->iAttribute);
4166 if (attr != NULL)
4168 dissect_cip_attribute(pinfo, tree, item, tvb, attr, offset, tvb_reported_length_remaining(tvb, offset));
4170 else
4172 proto_tree_add_item(tree, hf_cip_sc_set_attr_single_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4176 static void
4177 dissect_cip_get_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4178 int offset, cip_simple_request_info_t* req_data)
4180 int i, att_count, att_value;
4181 attribute_info_t* pattribute;
4182 proto_item *att_list, *att_item;
4183 proto_tree* att_tree;
4185 /* Get attribute list request */
4186 if (tvb_reported_length_remaining(tvb, offset) < 2)
4188 expert_add_info(pinfo, item, &ei_mal_serv_gal);
4189 return;
4192 /* Add number of attributes */
4193 att_count = tvb_get_letohs( tvb, offset);
4194 proto_tree_add_item(tree, hf_cip_sc_get_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4196 /* Add Attribute List */
4197 att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*2, "Attribute List" );
4198 att_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
4200 for( i=0; i < att_count; i++ )
4202 att_value = tvb_get_letohs( tvb, offset+2);
4203 att_item = proto_tree_add_item(att_tree, hf_cip_sc_get_attr_list_attr_item, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
4204 pattribute = cip_get_attribute(req_data->iClass, req_data->iInstance, att_value);
4205 if (pattribute != NULL)
4206 proto_item_append_text(att_item, " (%s)", pattribute->text);
4208 offset += 2;
4209 if ((tvb_reported_length_remaining(tvb, offset+2) < 2) && (i < att_count-1))
4211 expert_add_info(pinfo, att_list, &ei_mal_serv_gal_count);
4212 break;
4217 static void
4218 dissect_cip_set_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4219 int offset, cip_simple_request_info_t* req_data)
4221 int i, start_offset, att_count,
4222 att_value, att_size;
4223 attribute_info_t* attr;
4224 proto_item *att_list, *att_item;
4225 proto_tree *att_tree, *att_list_tree;
4227 /* Get attribute list request */
4228 if (tvb_reported_length_remaining(tvb, offset) < 2)
4230 expert_add_info(pinfo, item, &ei_mal_serv_sal);
4231 return;
4234 /* Add number of attributes */
4235 att_count = tvb_get_letohs( tvb, offset);
4236 proto_tree_add_item(tree, hf_cip_sc_set_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4238 /* Add Attribute List */
4239 att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
4240 att_list_tree = proto_item_add_subtree( att_list, ett_cip_set_attribute_list);
4241 offset += 2;
4242 start_offset = offset;
4244 for( i=0; i < att_count; i++ )
4246 att_value = tvb_get_letohs( tvb, offset);
4247 att_item = proto_tree_add_item(att_list_tree, hf_cip_sc_set_attr_list_attr_item, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4248 att_tree = proto_item_add_subtree( att_item, ett_cip_set_attribute_list_item);
4249 offset += 2;
4251 attr = cip_get_attribute(req_data->iClass, req_data->iInstance, att_value);
4252 if (attr != NULL)
4254 proto_item_append_text(att_item, " (%s)", attr->text);
4255 /* provide attribute data */
4256 att_size = dissect_cip_attribute(pinfo, att_tree, att_item, tvb, attr, offset, tvb_reported_length_remaining(tvb, offset));
4257 offset += att_size;
4258 proto_item_set_len(att_item, att_size+4);
4260 else
4262 /* Can't find the attribute, treat the rest of the request as raw data */
4263 proto_tree_add_item(att_tree, hf_cip_sc_set_attr_list_attr_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4266 if ((tvb_reported_length_remaining(tvb, offset) < 2) && (i < att_count-1))
4268 expert_add_info(pinfo, att_list, &ei_mal_serv_sal_count);
4269 break;
4273 proto_item_set_len(att_list, offset-start_offset );
4276 static void
4277 dissect_cip_multiple_service_packet_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset)
4279 proto_item *mult_serv_item, *ti;
4280 proto_tree *mult_serv_tree;
4281 int i, num_services, serv_offset, prev_offset = 0;
4282 cip_req_info_t *cip_req_info, *mr_single_req_info;
4283 mr_mult_req_info_t *mr_mult_req_info = NULL;
4285 /* Add number of services */
4286 num_services = tvb_get_letohs( tvb, offset);
4287 ti = proto_tree_add_item(tree, hf_cip_sc_mult_serv_pack_num_services, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4289 /* Ensure a rough sanity check */
4290 if (num_services*2 > tvb_reported_length_remaining(tvb, offset+2))
4292 expert_add_info(pinfo, ti, &ei_mal_msp_services);
4294 else
4296 /* Add services */
4297 cip_req_info = (cip_req_info_t*)p_get_proto_data( pinfo->fd, proto_cip, 0 );
4298 if ( cip_req_info )
4300 if ( cip_req_info->pData == NULL )
4302 mr_mult_req_info = wmem_new(wmem_file_scope(), mr_mult_req_info_t);
4303 mr_mult_req_info->service = SC_MULT_SERV_PACK;
4304 mr_mult_req_info->num_services = num_services;
4305 mr_mult_req_info->requests = (cip_req_info_t *)wmem_alloc0(wmem_file_scope(), sizeof(cip_req_info_t)*num_services);
4306 cip_req_info->pData = mr_mult_req_info;
4308 else
4310 mr_mult_req_info = (mr_mult_req_info_t*)cip_req_info->pData;
4311 if ( mr_mult_req_info && mr_mult_req_info->num_services != num_services )
4312 mr_mult_req_info = NULL;
4317 for( i=0; i < num_services; i++ )
4319 int serv_length;
4320 tvbuff_t *next_tvb;
4322 serv_offset = tvb_get_letohs( tvb, offset+2+(i*2) );
4324 if (tvb_reported_length_remaining(tvb, serv_offset) <= 0)
4326 expert_add_info(pinfo, item, &ei_mal_msp_inv_offset);
4327 continue;
4330 if( i == (num_services-1) )
4332 /* Last service to add */
4333 serv_length = tvb_reported_length_remaining(tvb, offset)-serv_offset;
4335 else
4337 serv_length = tvb_get_letohs( tvb, offset+2+((i+1)*2) ) - serv_offset;
4340 mult_serv_item = proto_tree_add_text(tree, tvb, offset+serv_offset, serv_length, "Service Packet #%d", i+1 );
4341 mult_serv_tree = proto_item_add_subtree(mult_serv_item, ett_cip_mult_service_packet );
4342 proto_tree_add_item(mult_serv_tree, hf_cip_sc_mult_serv_pack_offset, tvb, offset+2+(i*2) , 2, ENC_LITTLE_ENDIAN);
4344 /* Make sure the offset is valid */
4345 if ((tvb_reported_length_remaining(tvb, serv_offset) <= 0) ||
4346 (tvb_reported_length_remaining(tvb, serv_offset+serv_length) <= 0) ||
4347 (serv_length <= 0) ||
4348 (prev_offset >= serv_offset))
4350 expert_add_info(pinfo, mult_serv_item, &ei_mal_msp_inv_offset);
4351 prev_offset = serv_offset;
4352 continue;
4354 prev_offset = serv_offset;
4357 ** We call our selves again to disect embedded packet
4360 col_append_str( pinfo->cinfo, COL_INFO, ", ");
4362 next_tvb = tvb_new_subset(tvb, offset+serv_offset, serv_length, serv_length);
4364 if ( mr_mult_req_info )
4366 mr_single_req_info = mr_mult_req_info->requests + i;
4367 dissect_cip_data(mult_serv_tree, next_tvb, 0, pinfo, mr_single_req_info );
4369 else
4371 dissect_cip_data(mult_serv_tree, next_tvb, 0, pinfo, NULL );
4377 static int
4378 dissect_cip_generic_service_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cip_simple_request_info_t* req_data)
4380 proto_item *cmd_data_item;
4381 int req_path_size,
4382 offset = 0;
4383 proto_tree *cmd_data_tree;
4384 guint8 service = tvb_get_guint8( tvb, offset ) & 0x7F;
4386 add_cip_service_to_info_column(pinfo, service, cip_sc_vals);
4388 /* Create service tree */
4389 cmd_data_item = proto_tree_add_text(tree, tvb, 0, tvb_length(tvb), "%s",
4390 val_to_str(service, cip_sc_vals , "Unknown Service (0x%02x)"));
4391 proto_item_append_text(cmd_data_item, " (Request)");
4392 cmd_data_tree = proto_item_add_subtree( cmd_data_item, ett_cmd_data );
4394 req_path_size = tvb_get_guint8( tvb, offset+1);
4395 offset += ((req_path_size*2)+2);
4396 if (tvb_reported_length_remaining(tvb, offset) <= 0)
4397 return tvb_reported_length(tvb);
4399 switch(service)
4401 case SC_GET_ATT_ALL:
4402 proto_tree_add_item(cmd_data_tree, hf_cip_sc_get_attribute_all_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4403 break;
4404 case SC_SET_ATT_ALL:
4405 proto_tree_add_item(cmd_data_tree, hf_cip_sc_set_attribute_all_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4406 break;
4407 case SC_GET_ATT_LIST:
4408 dissect_cip_get_attribute_list_req(tvb, pinfo, cmd_data_tree, cmd_data_item, offset, req_data);
4409 break;
4410 case SC_SET_ATT_LIST:
4411 dissect_cip_set_attribute_list_req(tvb, pinfo, cmd_data_tree, cmd_data_item, offset, req_data);
4412 break;
4413 case SC_RESET:
4414 proto_tree_add_item(cmd_data_tree, hf_cip_sc_reset_param, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4415 proto_tree_add_item(cmd_data_tree, hf_cip_sc_reset_data, tvb, offset+1, tvb_reported_length_remaining(tvb, offset+1), ENC_NA);
4416 break;
4417 case SC_START:
4418 proto_tree_add_item(cmd_data_tree, hf_cip_sc_start_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4419 break;
4420 case SC_STOP:
4421 proto_tree_add_item(cmd_data_tree, hf_cip_sc_stop_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4422 break;
4423 case SC_CREATE:
4424 proto_tree_add_item(cmd_data_tree, hf_cip_sc_create_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4425 break;
4426 case SC_DELETE:
4427 proto_tree_add_item(cmd_data_tree, hf_cip_sc_delete_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4428 break;
4429 case SC_MULT_SERV_PACK:
4430 dissect_cip_multiple_service_packet_req(tvb, pinfo, cmd_data_tree, cmd_data_item, offset);
4431 break;
4432 case SC_APPLY_ATTRIBUTES:
4433 proto_tree_add_item(cmd_data_tree, hf_cip_sc_apply_attributes_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4434 break;
4435 case SC_GET_ATT_SINGLE:
4436 proto_tree_add_item(cmd_data_tree, hf_cip_sc_get_attr_single_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4437 break;
4438 case SC_SET_ATT_SINGLE:
4439 dissect_cip_set_attribute_single_req(tvb, pinfo, cmd_data_tree, cmd_data_item, offset, req_data);
4440 break;
4441 case SC_FIND_NEXT_OBJ_INST:
4442 proto_tree_add_item(cmd_data_tree, hf_cip_find_next_object_max_instance, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4443 break;
4444 case SC_RESTOR:
4445 proto_tree_add_item(cmd_data_tree, hf_cip_sc_restore_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4446 break;
4447 case SC_SAVE:
4448 proto_tree_add_item(cmd_data_tree, hf_cip_sc_save_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4449 break;
4450 case SC_NO_OP:
4451 proto_tree_add_item(cmd_data_tree, hf_cip_sc_noop_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4452 break;
4453 case SC_GET_MEMBER:
4454 proto_tree_add_item(cmd_data_tree, hf_cip_sc_get_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4455 break;
4456 case SC_SET_MEMBER:
4457 proto_tree_add_item(cmd_data_tree, hf_cip_sc_set_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4458 break;
4459 case SC_INSERT_MEMBER:
4460 proto_tree_add_item(cmd_data_tree, hf_cip_sc_insert_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4461 break;
4462 case SC_REMOVE_MEMBER:
4463 proto_tree_add_item(cmd_data_tree, hf_cip_sc_remove_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4464 break;
4465 case SC_GROUP_SYNC:
4466 proto_tree_add_item(cmd_data_tree, hf_cip_sc_group_sync_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4467 break;
4470 return tvb_length(tvb);
4473 static void
4474 dissect_cip_get_attribute_list_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4475 int offset, cip_simple_request_info_t* req_data)
4477 int i, start_offset, att_count,
4478 att_value, att_status;
4479 guint att_size;
4480 attribute_info_t* attr;
4481 proto_item *att_list, *att_item;
4482 proto_tree *att_tree, *att_list_tree;
4484 /* Get attribute list request */
4485 if (tvb_reported_length_remaining(tvb, offset) < 2)
4487 expert_add_info(pinfo, item, &ei_mal_serv_gal);
4488 return;
4491 /* Add number of attributes */
4492 att_count = tvb_get_letohs( tvb, offset);
4493 proto_tree_add_item(tree, hf_cip_sc_get_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4495 /* Add Attribute List */
4496 att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
4497 att_list_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
4498 offset += 2;
4499 start_offset = offset;
4501 for( i=0; i < att_count; i++ )
4503 att_value = tvb_get_letohs( tvb, offset);
4504 att_item = proto_tree_add_item(att_list_tree, hf_cip_sc_get_attr_list_attr_item, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4505 att_tree = proto_item_add_subtree( att_item, ett_cip_get_attribute_list_item);
4507 att_status = tvb_get_letohs( tvb, offset+2);
4508 proto_tree_add_item(att_tree, hf_cip_sc_get_attr_list_attr_status, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
4510 attr = cip_get_attribute(req_data->iClass, req_data->iInstance, att_value);
4511 if (attr != NULL)
4512 proto_item_append_text(att_item, " (%s)", attr->text);
4514 offset += 4;
4515 if (att_status == 0)
4517 if (attr != NULL)
4519 /* provide attribute data */
4520 att_size = dissect_cip_attribute(pinfo, att_tree, att_item, tvb, attr, offset, tvb_reported_length_remaining(tvb, offset));
4521 offset += att_size;
4522 proto_item_set_len(att_item, att_size+4);
4524 else
4526 /* Can't find the attribute, treat the rest of the response as raw data */
4527 proto_tree_add_item(att_tree, hf_cip_sc_get_attr_list_attr_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4528 break;
4532 if ((tvb_reported_length_remaining(tvb, offset) < 4) && (i < att_count-1))
4534 expert_add_info(pinfo, att_list, &ei_mal_serv_gal_count);
4535 break;
4539 proto_item_set_len(att_list, offset-start_offset );
4542 static void
4543 dissect_cip_set_attribute_list_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4544 int offset, cip_simple_request_info_t* req_data)
4546 int i, start_offset, att_count, att_value;
4547 attribute_info_t* attr;
4548 proto_item *att_list, *att_item;
4549 proto_tree *att_tree, *att_list_tree;
4551 /* Get attribute list request */
4552 if (tvb_reported_length_remaining(tvb, offset) < 2)
4554 expert_add_info(pinfo, item, &ei_mal_serv_sal);
4555 return;
4558 /* Add number of attributes */
4559 att_count = tvb_get_letohs( tvb, offset);
4560 proto_tree_add_item(tree, hf_cip_sc_set_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4562 /* Add Attribute List */
4563 att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
4564 att_list_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
4565 offset += 2;
4566 start_offset = offset;
4568 for( i=0; i < att_count; i++ )
4570 att_value = tvb_get_letohs( tvb, offset);
4571 att_item = proto_tree_add_item(att_list_tree, hf_cip_sc_set_attr_list_attr_item, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4572 att_tree = proto_item_add_subtree( att_item, ett_cip_set_attribute_list_item);
4574 proto_tree_add_item(att_tree, hf_cip_sc_set_attr_list_attr_status, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
4576 attr = cip_get_attribute(req_data->iClass, req_data->iInstance, att_value);
4577 if (attr != NULL)
4578 proto_item_append_text(att_item, " (%s)", attr->text);
4580 offset += 4;
4581 if ((tvb_reported_length_remaining(tvb, offset) < 4) && (i < att_count-1))
4583 expert_add_info(pinfo, att_list, &ei_mal_serv_sal_count);
4584 break;
4588 proto_item_set_len(att_list, offset-start_offset );
4591 static void
4592 dissect_cip_get_attribute_single_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item,
4593 int offset, cip_simple_request_info_t* req_data)
4595 attribute_info_t* attr;
4597 attr = cip_get_attribute(req_data->iClass, req_data->iInstance, req_data->iAttribute);
4598 if (attr != NULL)
4600 proto_item_append_text(item, " (%s)", attr->text);
4601 dissect_cip_attribute(pinfo, tree, item, tvb, attr, offset, tvb_reported_length_remaining(tvb, offset));
4603 else
4605 /* Can't find the attribute, treat the rest of the response as raw data */
4606 proto_tree_add_item(tree, hf_cip_sc_get_attr_single_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4610 static void
4611 dissect_cip_multiple_service_packet_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset)
4613 proto_item *mult_serv_item;
4614 proto_tree *mult_serv_tree;
4615 int i, num_services, serv_offset;
4616 cip_req_info_t *cip_req_info, *mr_single_req_info;
4617 mr_mult_req_info_t *mr_mult_req_info = NULL;
4619 if (tvb_reported_length_remaining(tvb, offset) < 2)
4621 expert_add_info(pinfo, item, &ei_mal_msp_missing_services);
4622 return;
4625 num_services = tvb_get_letohs( tvb, offset);
4626 proto_tree_add_item(tree, hf_cip_sc_mult_serv_pack_num_replies, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4628 if (tvb_reported_length_remaining(tvb, offset+((num_services+1)*2)) <= 0)
4630 expert_add_info(pinfo, item, &ei_mal_msp_resp_offset);
4631 return;
4634 cip_req_info = (cip_req_info_t*)p_get_proto_data( pinfo->fd, proto_cip, 0 );
4635 if ( cip_req_info )
4637 mr_mult_req_info = (mr_mult_req_info_t*)cip_req_info->pData;
4639 if ( mr_mult_req_info
4640 && ( mr_mult_req_info->service != SC_MULT_SERV_PACK
4641 || mr_mult_req_info->num_services != num_services
4644 mr_mult_req_info = NULL;
4647 /* Add number of replies */
4648 for( i=0; i < num_services; i++ )
4650 int serv_length;
4651 tvbuff_t *next_tvb;
4653 serv_offset = tvb_get_letohs( tvb, offset+2+(i*2) );
4655 if (tvb_reported_length_remaining(tvb, serv_offset) <= 0)
4657 expert_add_info(pinfo, item, &ei_mal_msp_inv_offset);
4658 continue;
4661 if( i == (num_services-1) )
4663 /* Last service to add */
4664 serv_length = tvb_reported_length_remaining(tvb, offset)-serv_offset;
4666 else
4668 serv_length = tvb_get_letohs( tvb, offset+2+((i+1)*2) ) - serv_offset;
4671 mult_serv_item = proto_tree_add_text( tree, tvb, offset+serv_offset, serv_length, "Service Reply #%d", i+1 );
4672 mult_serv_tree = proto_item_add_subtree( mult_serv_item, ett_cip_mult_service_packet );
4673 proto_tree_add_item(mult_serv_tree, hf_cip_sc_mult_serv_pack_offset, tvb, offset+2+(i*2) , 2, ENC_LITTLE_ENDIAN);
4676 ** We call our selves again to disect embedded packet
4679 col_append_str( pinfo->cinfo, COL_INFO, ", ");
4681 next_tvb = tvb_new_subset(tvb, offset+serv_offset, serv_length, serv_length);
4682 if ( mr_mult_req_info )
4684 mr_single_req_info = mr_mult_req_info->requests + i;
4685 dissect_cip_data( mult_serv_tree, next_tvb, 0, pinfo, mr_single_req_info );
4687 else
4689 dissect_cip_data( mult_serv_tree, next_tvb, 0, pinfo, NULL );
4695 static void
4696 dissect_cip_find_next_object_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset)
4698 guint8 i, num_instances;
4700 if (tvb_reported_length_remaining(tvb, offset) < 1)
4702 expert_add_info(pinfo, item, &ei_mal_serv_find_next_object);
4703 return;
4706 num_instances = tvb_get_guint8( tvb, offset);
4707 proto_tree_add_item(tree, hf_cip_find_next_object_num_instances, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4708 offset += 1;
4709 for (i = 0; i < num_instances; i++)
4711 proto_tree_add_item(tree, hf_cip_find_next_object_instance_item, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4712 offset += 2;
4714 if ((tvb_reported_length_remaining(tvb, offset) < 2) && (i < num_instances-1))
4716 expert_add_info(pinfo, item, &ei_mal_serv_find_next_object_count);
4717 break;
4722 static int
4723 dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4725 proto_item *cmd_data_item;
4726 proto_tree *cmd_data_tree;
4727 cip_req_info_t* preq_info;
4728 cip_simple_request_info_t req_data;
4729 int offset = 0,
4730 item_length = tvb_length(tvb);
4731 guint8 service = tvb_get_guint8( tvb, offset ) & 0x7F,
4732 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
4734 /* If there is any command specific data create a sub-tree for it */
4735 if( (item_length-4-add_stat_size ) != 0 )
4737 cmd_data_item = proto_tree_add_text(tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "%s",
4738 val_to_str(service, cip_sc_vals , "Unknown Service (0x%02x)"));
4739 proto_item_append_text(cmd_data_item, " (Response)");
4740 cmd_data_tree = proto_item_add_subtree( cmd_data_item, ett_cmd_data );
4742 else
4744 /* PROTO_ITEM_SET_HIDDEN( ti ); */
4745 return tvb_length(tvb);
4748 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
4749 if ((preq_info != NULL) &&
4750 (preq_info->ciaData != NULL))
4752 memcpy(&req_data, preq_info->ciaData, sizeof(cip_simple_request_info_t));
4754 else
4756 req_data.iClass = (guint32)-1;
4757 req_data.iInstance = (guint32)-1;
4758 req_data.iAttribute = (guint32)-1;
4759 req_data.iMember = (guint32)-1;
4762 switch(service)
4764 case SC_GET_ATT_ALL:
4765 proto_tree_add_item(cmd_data_tree, hf_cip_sc_get_attribute_all_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4766 break;
4767 case SC_SET_ATT_ALL:
4768 proto_tree_add_item(cmd_data_tree, hf_cip_sc_set_attribute_all_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4769 break;
4770 case SC_GET_ATT_LIST:
4771 dissect_cip_get_attribute_list_rsp(tvb, pinfo, cmd_data_tree, cmd_data_item, offset+4+add_stat_size, &req_data);
4772 break;
4773 case SC_SET_ATT_LIST:
4774 dissect_cip_set_attribute_list_rsp(tvb, pinfo, cmd_data_tree, cmd_data_item, offset+4+add_stat_size, &req_data);
4775 break;
4776 case SC_RESET:
4777 proto_tree_add_item(cmd_data_tree, hf_cip_sc_reset_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4778 break;
4779 case SC_START:
4780 proto_tree_add_item(cmd_data_tree, hf_cip_sc_start_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4781 break;
4782 case SC_STOP:
4783 proto_tree_add_item(cmd_data_tree, hf_cip_sc_stop_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4784 break;
4785 case SC_CREATE:
4786 proto_tree_add_item(cmd_data_tree, hf_cip_sc_create_instance, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4787 proto_tree_add_item(cmd_data_tree, hf_cip_sc_create_data, tvb, offset+4+add_stat_size+2, tvb_reported_length_remaining(tvb, offset+4+add_stat_size+2), ENC_NA);
4788 break;
4789 case SC_DELETE:
4790 proto_tree_add_item(cmd_data_tree, hf_cip_sc_delete_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4791 break;
4792 case SC_MULT_SERV_PACK:
4793 dissect_cip_multiple_service_packet_rsp(tvb, pinfo, cmd_data_tree, cmd_data_item, offset+4+add_stat_size);
4794 break;
4795 case SC_APPLY_ATTRIBUTES:
4796 proto_tree_add_item(cmd_data_tree, hf_cip_sc_apply_attributes_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4797 break;
4798 case SC_GET_ATT_SINGLE:
4799 dissect_cip_get_attribute_single_rsp(tvb, pinfo, cmd_data_tree, cmd_data_item, offset+4+add_stat_size, &req_data);
4800 break;
4801 case SC_SET_ATT_SINGLE:
4802 proto_tree_add_item(cmd_data_tree, hf_cip_sc_set_attr_single_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4803 break;
4804 case SC_FIND_NEXT_OBJ_INST:
4805 dissect_cip_find_next_object_rsp(tvb, pinfo, cmd_data_tree, cmd_data_item, offset+4+add_stat_size);
4806 break;
4807 case SC_RESTOR:
4808 proto_tree_add_item(cmd_data_tree, hf_cip_sc_restore_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4809 break;
4810 case SC_SAVE:
4811 proto_tree_add_item(cmd_data_tree, hf_cip_sc_save_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4812 break;
4813 case SC_NO_OP:
4814 proto_tree_add_item(cmd_data_tree, hf_cip_sc_noop_data, tvb, offset+4+add_stat_size, tvb_reported_length_remaining(tvb, offset+4+add_stat_size), ENC_NA);
4815 break;
4816 case SC_GET_MEMBER:
4817 proto_tree_add_item(cmd_data_tree, hf_cip_sc_get_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4818 break;
4819 case SC_SET_MEMBER:
4820 proto_tree_add_item(cmd_data_tree, hf_cip_sc_set_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4821 break;
4822 case SC_INSERT_MEMBER:
4823 proto_tree_add_item(cmd_data_tree, hf_cip_sc_insert_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4824 break;
4825 case SC_REMOVE_MEMBER:
4826 proto_tree_add_item(cmd_data_tree, hf_cip_sc_remove_member_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
4827 break;
4828 case SC_GROUP_SYNC:
4829 proto_tree_add_item(cmd_data_tree, hf_cip_sc_group_sync_is_sync, tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN);
4830 proto_tree_add_item(cmd_data_tree, hf_cip_sc_group_sync_data, tvb, offset+4+add_stat_size+1, tvb_reported_length_remaining(tvb, offset+4+add_stat_size+1), ENC_NA);
4831 break;
4834 return tvb_length(tvb);
4837 /************************************************
4839 * Dissector for CIP Connection Manager
4841 ************************************************/
4843 static void
4844 dissect_cip_cm_timeout(proto_tree *cmd_tree, tvbuff_t *tvb, int offset)
4846 guint8 tick, timeout_tick;
4847 int timeout;
4849 /* Display the priority/tick timer */
4850 tick = tvb_get_guint8( tvb, offset) & 0x0F;
4851 proto_tree_add_item( cmd_tree, hf_cip_cm_priority, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4852 proto_tree_add_item( cmd_tree, hf_cip_cm_tick_time, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4854 /* Display the time-out ticks */
4855 timeout_tick = tvb_get_guint8( tvb, offset+1 );
4856 proto_tree_add_item( cmd_tree, hf_cip_cm_timeout_tick, tvb, offset+1, 1, ENC_LITTLE_ENDIAN);
4858 /* Display the actual time out */
4859 timeout = ( 1 << tick ) * timeout_tick;
4860 proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_timeout, tvb, offset, 2, timeout, "%dms", timeout);
4863 static void
4864 dissect_cip_cm_fwd_open_req(cip_req_info_t *preq_info, proto_tree *cmd_tree, tvbuff_t *tvb, int offset, gboolean large_fwd_open, packet_info *pinfo)
4866 proto_item *pi;
4867 int conn_path_size, rpi, net_param_offset = 0;
4868 guint32 O2TConnID, T2OConnID, DeviceSerialNumber;
4869 guint16 ConnSerialNumber, VendorID;
4870 guint8 TransportClass_trigger, O2TType, T2OType;
4871 cip_simple_request_info_t connection_path;
4872 cip_safety_epath_info_t safety_fwdopen;
4874 dissect_cip_cm_timeout(cmd_tree, tvb, offset);
4875 O2TConnID = tvb_get_letohl( tvb, offset+2 );
4876 proto_tree_add_item( cmd_tree, hf_cip_cm_ot_connid, tvb, offset+2, 4, ENC_LITTLE_ENDIAN);
4877 T2OConnID = tvb_get_letohl( tvb, offset+6 );
4878 proto_tree_add_item( cmd_tree, hf_cip_cm_to_connid, tvb, offset+6, 4, ENC_LITTLE_ENDIAN);
4879 ConnSerialNumber = tvb_get_letohs( tvb, offset+10 );
4880 proto_tree_add_item( cmd_tree, hf_cip_cm_conn_serial_num, tvb, offset+10, 2, ENC_LITTLE_ENDIAN);
4881 VendorID = tvb_get_letohs( tvb, offset+12 );
4882 proto_tree_add_item( cmd_tree, hf_cip_cm_vendor, tvb, offset+12, 2, ENC_LITTLE_ENDIAN);
4883 DeviceSerialNumber = tvb_get_letohl( tvb, offset+14 );
4884 proto_tree_add_item( cmd_tree, hf_cip_cm_orig_serial_num, tvb, offset+14, 4, ENC_LITTLE_ENDIAN);
4885 proto_tree_add_item( cmd_tree, hf_cip_cm_timeout_multiplier, tvb, offset+18, 1, ENC_LITTLE_ENDIAN);
4886 proto_tree_add_item( cmd_tree, hf_cip_reserved24, tvb, offset+19, 3, ENC_LITTLE_ENDIAN);
4888 /* Display originator to target requested packet interval */
4889 rpi = tvb_get_letohl( tvb, offset+22 );
4890 proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_ot_rpi, tvb, offset+22, 4, rpi, "%dms (0x%08X)", rpi / 1000, rpi);
4892 /* Display originator to target network connection parameters as a tree */
4893 if (large_fwd_open)
4895 dissect_net_param32(tvb, offset+26, cmd_tree,
4896 hf_cip_cm_ot_net_params32, hf_cip_cm_lfwo_own, hf_cip_cm_lfwo_typ,
4897 hf_cip_cm_lfwo_prio, hf_cip_cm_lfwo_fixed_var, hf_cip_cm_lfwo_con_size, ett_cm_ncp);
4899 O2TType = (guint8)(((tvb_get_letohl( tvb, offset+26 ) & 0x60000000) >> 29) & 3);
4900 net_param_offset = 4;
4902 else
4904 dissect_net_param16(tvb, offset+26, cmd_tree,
4905 hf_cip_cm_ot_net_params16, hf_cip_cm_fwo_own, hf_cip_cm_fwo_typ,
4906 hf_cip_cm_fwo_prio, hf_cip_cm_fwo_fixed_var, hf_cip_cm_fwo_con_size, ett_cm_ncp);
4908 O2TType = (guint8)(((tvb_get_letohs( tvb, offset+26 ) & 0x6000) >> 13) & 3);
4909 net_param_offset = 2;
4912 /* Display target to originator requested packet interval */
4913 rpi = tvb_get_letohl( tvb, offset+26+net_param_offset );
4914 proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_to_rpi, tvb, offset+26+net_param_offset, 4, rpi, "%dms (0x%08X)", rpi / 1000, rpi);
4916 /* Display target to originator network connection parameters as a tree */
4917 if (large_fwd_open)
4919 dissect_net_param32(tvb, offset+26+net_param_offset+4, cmd_tree,
4920 hf_cip_cm_to_net_params32, hf_cip_cm_lfwo_own, hf_cip_cm_lfwo_typ,
4921 hf_cip_cm_lfwo_prio, hf_cip_cm_lfwo_fixed_var, hf_cip_cm_lfwo_con_size, ett_cm_ncp);
4923 T2OType = (guint8)(((tvb_get_letohl( tvb, offset+26+net_param_offset+4 ) & 0x60000000) >> 29) & 3);
4924 net_param_offset += 4;
4926 else
4928 dissect_net_param16(tvb, offset+26+net_param_offset+4, cmd_tree,
4929 hf_cip_cm_to_net_params16, hf_cip_cm_fwo_own, hf_cip_cm_fwo_typ,
4930 hf_cip_cm_fwo_prio, hf_cip_cm_fwo_fixed_var, hf_cip_cm_fwo_con_size, ett_cm_ncp);
4932 T2OType = (guint8)(((tvb_get_letohs( tvb, offset+26+net_param_offset+4 ) & 0x6000) >> 13) & 3);
4933 net_param_offset += 2;
4936 TransportClass_trigger = tvb_get_guint8( tvb, offset+26+net_param_offset+4);
4937 dissect_transport_type_trigger(tvb, offset+26+net_param_offset+4, cmd_tree, hf_cip_cm_transport_type_trigger,
4938 hf_cip_cm_fwo_dir, hf_cip_cm_fwo_trigg, hf_cip_cm_fwo_class, ett_cm_ttt);
4940 /* Add path size */
4941 conn_path_size = tvb_get_guint8( tvb, offset+26+net_param_offset+5 )*2;
4942 proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_conn_path_size, tvb, offset+26+net_param_offset+5, 1, conn_path_size/2, "%d (words)", conn_path_size/2);
4944 /* Add the epath */
4945 pi = proto_tree_add_text(cmd_tree, tvb, offset+26+net_param_offset+6, conn_path_size, "Connection Path: ");
4946 dissect_epath( tvb, pinfo, pi, offset+26+net_param_offset+6, conn_path_size, FALSE, FALSE, &connection_path, &safety_fwdopen);
4948 if (pinfo->fd->flags.visited)
4949 return;
4951 if (preq_info != NULL)
4953 DISSECTOR_ASSERT(preq_info->connInfo == NULL);
4954 preq_info->connInfo = wmem_new0(wmem_file_scope(), cip_conn_info_t);
4956 preq_info->connInfo->ConnSerialNumber = ConnSerialNumber;
4957 preq_info->connInfo->VendorID = VendorID;
4958 preq_info->connInfo->DeviceSerialNumber = DeviceSerialNumber;
4959 preq_info->connInfo->O2T.connID = O2TConnID;
4960 preq_info->connInfo->T2O.connID = T2OConnID;
4961 preq_info->connInfo->TransportClass_trigger = TransportClass_trigger;
4962 preq_info->connInfo->T2O.type = T2OType;
4963 preq_info->connInfo->O2T.type = O2TType;
4964 preq_info->connInfo->motion = (connection_path.iClass == 0x42) ? TRUE : FALSE;
4965 preq_info->connInfo->safety = safety_fwdopen;
4969 static void
4970 dissect_cip_cm_fwd_open_rsp_success(cip_req_info_t *preq_info, proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
4972 int temp_data;
4973 unsigned char app_rep_size;
4974 guint32 O2TConnID, T2OConnID, DeviceSerialNumber;
4975 guint16 ConnSerialNumber, VendorID;
4976 proto_item *ti;
4977 proto_tree *pid_tree, *safety_tree;
4979 /* Display originator to target connection ID */
4980 O2TConnID = tvb_get_letohl( tvb, offset );
4981 proto_tree_add_item( tree, hf_cip_cm_ot_connid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4983 /* Display target to originator connection ID */
4984 T2OConnID = tvb_get_letohl( tvb, offset+4 );
4985 proto_tree_add_item( tree, hf_cip_cm_to_connid, tvb, offset+4, 4, ENC_LITTLE_ENDIAN);
4987 /* Display connection serial number */
4988 ConnSerialNumber = tvb_get_letohs( tvb, offset+8 );
4989 proto_tree_add_item( tree, hf_cip_cm_conn_serial_num, tvb, offset+8, 2, ENC_LITTLE_ENDIAN);
4991 /* Display the originator vendor id */
4992 VendorID = tvb_get_letohs( tvb, offset+10 );
4993 proto_tree_add_item( tree, hf_cip_cm_vendor, tvb, offset+10, 2, ENC_LITTLE_ENDIAN);
4995 /* Display the originator serial number */
4996 DeviceSerialNumber = tvb_get_letohl( tvb, offset+12 );
4997 proto_tree_add_item( tree, hf_cip_cm_orig_serial_num, tvb, offset+12, 4, ENC_LITTLE_ENDIAN);
4999 /* Display originator to target actual packet interval */
5000 temp_data = tvb_get_letohl( tvb, offset+16 );
5001 proto_tree_add_uint_format_value(tree, hf_cip_cm_ot_api, tvb, offset+16, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5003 /* Display originator to target actual packet interval */
5004 temp_data = tvb_get_letohl( tvb, offset+20 );
5005 proto_tree_add_uint_format_value(tree, hf_cip_cm_to_api, tvb, offset+20, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5007 /* Display the application reply size */
5008 app_rep_size = tvb_get_guint8( tvb, offset+24 ) * 2;
5009 proto_tree_add_uint_format_value(tree, hf_cip_cm_app_reply_size, tvb, offset+24, 1, app_rep_size / 2, "%d (words)", app_rep_size / 2);
5011 /* Display the Reserved byte */
5012 proto_tree_add_item(tree, hf_cip_reserved8, tvb, offset+25, 1, ENC_LITTLE_ENDIAN );
5013 if (app_rep_size > 0)
5015 if ((preq_info == NULL) || (preq_info->connInfo == NULL) ||
5016 (preq_info->connInfo->safety.safety_seg == FALSE))
5018 proto_tree_add_item(tree, hf_cip_cm_app_reply_data, tvb, offset+26, app_rep_size, ENC_NA );
5020 else if (preq_info->connInfo->safety.format == CIP_SAFETY_BASE_FORMAT)
5022 ti = proto_tree_add_text( tree, tvb, offset+28, 10, "Safety Application Reply Data");
5023 safety_tree = proto_item_add_subtree( ti, ett_cip_cm_safety );
5024 proto_tree_add_item( safety_tree, hf_cip_cm_consumer_number, tvb, offset+26, 2, ENC_LITTLE_ENDIAN);
5025 ti = proto_tree_add_text( safety_tree, tvb, offset+28, 8, "PID/CID");
5026 pid_tree = proto_item_add_subtree( ti, ett_cip_cm_pid );
5027 proto_tree_add_item( pid_tree, hf_cip_cm_targ_vendor_id, tvb, offset+28, 2, ENC_LITTLE_ENDIAN);
5028 proto_tree_add_item( pid_tree, hf_cip_cm_targ_dev_serial_num, tvb, offset+30, 4, ENC_LITTLE_ENDIAN);
5029 proto_tree_add_item( pid_tree, hf_cip_cm_targ_conn_serial_num, tvb, offset+34, 2, ENC_LITTLE_ENDIAN);
5031 if (app_rep_size > 10)
5032 proto_tree_add_item(tree, hf_cip_cm_app_reply_data, tvb, offset+36, app_rep_size-10, ENC_NA );
5034 else if (preq_info->connInfo->safety.format == CIP_SAFETY_EXTENDED_FORMAT)
5036 ti = proto_tree_add_text( tree, tvb, offset+28, 14, "Safety Application Reply Data");
5037 safety_tree = proto_item_add_subtree( ti, ett_cip_cm_safety );
5038 proto_tree_add_item( safety_tree, hf_cip_cm_consumer_number, tvb, offset+26, 2, ENC_LITTLE_ENDIAN);
5039 ti = proto_tree_add_text( safety_tree, tvb, offset+28, 12, "PID/CID");
5040 pid_tree = proto_item_add_subtree( ti, ett_cip_cm_pid );
5041 proto_tree_add_item( pid_tree, hf_cip_cm_targ_vendor_id, tvb, offset+28, 2, ENC_LITTLE_ENDIAN);
5042 proto_tree_add_item( pid_tree, hf_cip_cm_targ_dev_serial_num, tvb, offset+30, 4, ENC_LITTLE_ENDIAN);
5043 proto_tree_add_item( pid_tree, hf_cip_cm_targ_conn_serial_num, tvb, offset+34, 2, ENC_LITTLE_ENDIAN);
5044 proto_tree_add_item( pid_tree, hf_cip_cm_initial_timestamp, tvb, offset+36, 2, ENC_LITTLE_ENDIAN);
5045 proto_tree_add_item( pid_tree, hf_cip_cm_initial_rollover, tvb, offset+38, 2, ENC_LITTLE_ENDIAN);
5047 if (app_rep_size > 14)
5048 proto_tree_add_item(tree, hf_cip_cm_app_reply_data, tvb, offset+40, app_rep_size-14, ENC_NA );
5052 /* See if we've captured the ForwardOpen request. If so some of the conversation data has already been
5053 populated and we just need to update it. */
5054 if (pinfo->fd->flags.visited)
5055 return;
5057 if ((preq_info != NULL) && (preq_info->connInfo != NULL))
5059 /* Ensure the connection triad matches before updating the connection IDs */
5060 if ((preq_info->connInfo->ConnSerialNumber == ConnSerialNumber) &&
5061 (preq_info->connInfo->VendorID == VendorID) &&
5062 (preq_info->connInfo->DeviceSerialNumber == DeviceSerialNumber))
5064 /* Update the connection IDs as ForwardOpen reply is allows to update them from
5065 the ForwardOpen request */
5066 preq_info->connInfo->O2T.connID = O2TConnID;
5067 preq_info->connInfo->T2O.connID = T2OConnID;
5072 static void
5073 dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
5075 proto_item *pi, *rrsc_item, *status_item, *add_status_item, *temp_item;
5076 proto_tree *rrsc_tree, *cmd_data_tree, *status_tree, *add_status_tree, *temp_tree;
5077 int req_path_size, conn_path_size, temp_data;
5078 unsigned char service, gen_status, add_stat_size;
5079 unsigned short add_status;
5080 unsigned char app_rep_size, route_path_size;
5081 int i, msg_req_siz;
5082 cip_req_info_t *preq_info;
5083 cip_req_info_t *pembedded_req_info;
5084 guint16 ConnSerialNumber, VendorID;
5085 guint32 DeviceSerialNumber;
5087 service = tvb_get_guint8( tvb, offset );
5089 /* Special handling for Unconnected send response. If successful, embedded service code is sent.
5090 * If failed, it can be either an Unconnected send response or the embedded service code response. */
5091 preq_info = (cip_req_info_t*)p_get_proto_data( pinfo->fd, proto_cip, 0 );
5092 if ( preq_info != NULL && ( service & 0x80 )
5093 && preq_info->bService == SC_CM_UNCON_SEND
5096 gen_status = tvb_get_guint8( tvb, offset+2 );
5097 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
5098 if ( add_stat_size == 2 )
5099 add_status = tvb_get_letohs( tvb, offset + 4 );
5100 else
5101 add_status = 0;
5102 if( gen_status == 0 /* success response ) */
5103 || ( ( service & 0x7F ) != SC_CM_UNCON_SEND )
5104 || !( ( gen_status == CI_GRC_FAILURE && (add_status == CM_ES_UNCONNECTED_REQUEST_TIMED_OUT ||
5105 add_status == CM_ES_PORT_NOT_AVAILABLE ||
5106 add_status == CM_ES_LINK_ADDRESS_NOT_VALID ||
5107 add_status == CM_ES_INVALID_SEGMENT_IN_CONN_PATH) )
5108 || gen_status == CI_GRC_NO_RESOURCE
5109 || gen_status == CI_GRC_BAD_PATH
5113 pembedded_req_info = (cip_req_info_t*)preq_info->pData;
5115 if ( pembedded_req_info )
5117 tvbuff_t *next_tvb;
5118 void *p_save_proto_data;
5120 p_save_proto_data = p_get_proto_data( pinfo->fd, proto_cip, 0 );
5121 p_remove_proto_data(pinfo->fd, proto_cip, 0);
5122 p_add_proto_data(pinfo->fd, proto_cip, 0, pembedded_req_info );
5124 proto_tree_add_text( item_tree, NULL, 0, 0, "(Service: Unconnected Send (Response))" );
5125 next_tvb = tvb_new_subset(tvb, offset, item_length, item_length);
5126 if ( pembedded_req_info && pembedded_req_info->dissector )
5127 call_dissector(pembedded_req_info->dissector, next_tvb, pinfo, item_tree );
5128 else
5129 call_dissector( cip_class_generic_handle, next_tvb, pinfo, item_tree );
5131 p_remove_proto_data(pinfo->fd, proto_cip, 0);
5132 p_add_proto_data(pinfo->fd, proto_cip, 0, p_save_proto_data);
5133 return;
5138 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP CM");
5140 /* Add Service code & Request/Response tree */
5141 rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
5142 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_cm_rrsc );
5144 /* Add Request/Response */
5145 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5147 /* watch for service collisions */
5148 proto_item_append_text( rrsc_item, "%s (%s)",
5149 val_to_str( ( service & 0x7F ),
5150 cip_sc_vals_cm , "Unknown Service (0x%02x)"),
5151 val_to_str_const( ( service & 0x80 )>>7,
5152 cip_sc_rr, "") );
5154 /* Add Service code */
5155 proto_tree_add_item(rrsc_tree, hf_cip_cm_sc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5157 if( service & 0x80 )
5159 /* Response message */
5160 gen_status = tvb_get_guint8( tvb, offset+2 );
5161 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
5163 if (gen_status == CI_GRC_FAILURE)
5165 /* Dissect object specific error codes */
5166 status_item = proto_tree_add_text(item_tree, tvb, offset+2, 1, "Status: " );
5167 status_tree = proto_item_add_subtree( status_item, ett_status_item );
5169 /* Add general status */
5170 proto_tree_add_item(status_tree, hf_cip_cm_genstat, tvb, offset+2, 1, ENC_LITTLE_ENDIAN );
5171 proto_item_append_text( status_item, "%s", val_to_str_ext( gen_status,
5172 &cip_gs_vals_ext , "Unknown Response (%x)") );
5174 /* Add additional status size */
5175 proto_tree_add_uint_format_value(status_tree, hf_cip_cm_addstat_size,
5176 tvb, offset+3, 1, add_stat_size/2, "%d (words)", add_stat_size/2);
5178 if( add_stat_size )
5180 add_status = tvb_get_letohs( tvb, offset + 4 );
5181 proto_tree_add_item(status_tree, hf_cip_cm_ext_status, tvb, offset+4, 2, ENC_LITTLE_ENDIAN );
5182 proto_item_append_text(status_item, ", Extended: %s", val_to_str_ext(add_status, &cip_cm_ext_st_vals_ext, "Reserved (0x%04x)"));
5184 switch(add_status)
5186 case CM_ES_RPI_NOT_ACCEPTABLE:
5187 if (add_stat_size < 3)
5189 expert_add_info(pinfo, status_item, &ei_mal_rpi_no_data);
5191 else
5193 proto_tree_add_item(status_tree, hf_cip_cm_ext112_ot_rpi_type, tvb, offset+6, 1, ENC_LITTLE_ENDIAN );
5194 proto_tree_add_item(status_tree, hf_cip_cm_ext112_to_rpi_type, tvb, offset+7, 1, ENC_LITTLE_ENDIAN );
5195 temp_data = tvb_get_letohl( tvb, offset+8);
5196 proto_tree_add_uint_format_value(status_tree, hf_cip_cm_ext112_ot_rpi, tvb, offset+8, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5197 temp_data = tvb_get_letohl( tvb, offset+12);
5198 proto_tree_add_uint_format_value(status_tree, hf_cip_cm_ext112_to_rpi, tvb, offset+12, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5200 break;
5201 case CM_ES_INVALID_CONFIGURATION_SIZE:
5202 if (add_stat_size < 1)
5204 expert_add_info(pinfo, status_item, &ei_mal_inv_config_size);
5206 else
5208 proto_tree_add_item(status_tree, hf_cip_cm_ext126_size, tvb, offset+6, 2, ENC_LITTLE_ENDIAN );
5210 break;
5211 case CM_ES_INVALID_OT_SIZE:
5212 if (add_stat_size < 1)
5214 expert_add_info(pinfo, status_item, &ei_mal_ot_size);
5216 else
5218 proto_tree_add_item(status_tree, hf_cip_cm_ext127_size, tvb, offset+6, 2, ENC_LITTLE_ENDIAN );
5220 break;
5221 case CM_ES_INVALID_TO_SIZE:
5222 if (add_stat_size < 1)
5224 expert_add_info(pinfo, status_item, &ei_mal_to_size);
5226 else
5228 proto_tree_add_item(status_tree, hf_cip_cm_ext128_size, tvb, offset+6, 2, ENC_LITTLE_ENDIAN );
5230 break;
5231 default:
5232 /* Add additional status */
5233 if (add_stat_size > 1)
5235 add_status_item = proto_tree_add_text( status_tree, tvb, offset+4, add_stat_size, "Additional Status" );
5236 add_status_tree = proto_item_add_subtree( add_status_item, ett_cm_add_status_item );
5238 for( i=0; i < add_stat_size-2; i += 2 )
5239 proto_tree_add_item(add_status_tree, hf_cip_cm_add_status, tvb, offset+4+i, 2, ENC_LITTLE_ENDIAN );
5245 /* If there is any command specific data create a sub-tree for it */
5246 if( ( item_length-4-add_stat_size ) != 0 )
5248 pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
5249 cmd_data_tree = proto_item_add_subtree( pi, ett_cm_cmd_data );
5251 if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
5253 /* Success responses */
5254 switch (service & 0x7F)
5256 case SC_CM_FWD_OPEN:
5257 case SC_CM_LARGE_FWD_OPEN:
5258 dissect_cip_cm_fwd_open_rsp_success(preq_info, cmd_data_tree, tvb, offset+4+add_stat_size, pinfo);
5259 break;
5260 case SC_CM_FWD_CLOSE:
5262 /* Forward close response (Success) */
5264 /* Display connection serial number */
5265 ConnSerialNumber = tvb_get_letohs( tvb, offset+4+add_stat_size );
5266 proto_tree_add_item( cmd_data_tree, hf_cip_cm_conn_serial_num, tvb, offset+4+add_stat_size, 2, ENC_LITTLE_ENDIAN);
5268 /* Display the originator vendor id */
5269 VendorID = tvb_get_letohs( tvb, offset+4+add_stat_size+2 );
5270 proto_tree_add_item( cmd_data_tree, hf_cip_cm_vendor, tvb, offset+4+add_stat_size+2, 2, ENC_LITTLE_ENDIAN);
5272 /* Display the originator serial number */
5273 DeviceSerialNumber = tvb_get_letohl( tvb, offset+4+add_stat_size+4 );
5274 proto_tree_add_item( cmd_data_tree, hf_cip_cm_orig_serial_num, tvb, offset+4+add_stat_size+4, 4, ENC_LITTLE_ENDIAN);
5276 /* Display the application reply size */
5277 app_rep_size = tvb_get_guint8( tvb, offset+4+add_stat_size+8 ) * 2;
5278 proto_tree_add_uint_format_value(cmd_data_tree, hf_cip_cm_app_reply_size, tvb, offset+4+add_stat_size+8, 1, app_rep_size / 2, "%d (words)", app_rep_size / 2);
5280 /* Display the Reserved byte */
5281 proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+4+add_stat_size+9, 1, ENC_LITTLE_ENDIAN);
5282 if (app_rep_size > 0)
5283 proto_tree_add_item(cmd_data_tree, hf_cip_cm_app_reply_data, tvb, offset+4+add_stat_size+10, app_rep_size, ENC_NA);
5285 enip_close_cip_connection( pinfo, ConnSerialNumber, VendorID, DeviceSerialNumber );
5287 } /* End of if forward close response */
5288 break;
5289 case SC_CM_UNCON_SEND:
5291 /* Unconnected send response (Success) */
5292 /* Display service response data */
5293 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5295 break;
5296 case SC_CM_GET_CONN_OWNER:
5298 /* Get Connection owner response (Success) */
5300 proto_tree_add_item( cmd_data_tree, hf_cip_cm_gco_conn, tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN);
5301 proto_tree_add_item( cmd_data_tree, hf_cip_cm_gco_coo_conn, tvb, offset+4+add_stat_size+1, 1, ENC_LITTLE_ENDIAN);
5302 proto_tree_add_item( cmd_data_tree, hf_cip_cm_gco_roo_conn, tvb, offset+4+add_stat_size+2, 1, ENC_LITTLE_ENDIAN);
5303 proto_tree_add_item( cmd_data_tree, hf_cip_cm_gco_last_action, tvb, offset+4+add_stat_size+3, 1, ENC_LITTLE_ENDIAN);
5304 proto_tree_add_item( cmd_data_tree, hf_cip_cm_conn_serial_num, tvb, offset+4+add_stat_size+4, 2, ENC_LITTLE_ENDIAN);
5305 proto_tree_add_item( cmd_data_tree, hf_cip_cm_vendor, tvb, offset+4+add_stat_size+6, 2, ENC_LITTLE_ENDIAN);
5306 proto_tree_add_item( cmd_data_tree, hf_cip_cm_orig_serial_num, tvb, offset+4+add_stat_size+8, 4, ENC_LITTLE_ENDIAN);
5308 break;
5309 default:
5310 /* Add data */
5311 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5312 break;
5315 else
5317 /* Error responses */
5318 switch (service & 0x7F)
5320 case SC_CM_FWD_OPEN:
5321 case SC_CM_LARGE_FWD_OPEN:
5322 case SC_CM_FWD_CLOSE:
5324 /* Forward open and forward close error response look the same */
5325 ConnSerialNumber = tvb_get_letohs( tvb, offset+4+add_stat_size );
5326 proto_tree_add_item( cmd_data_tree, hf_cip_cm_conn_serial_num, tvb, offset+4+add_stat_size, 2, ENC_LITTLE_ENDIAN);
5327 VendorID = tvb_get_letohs( tvb, offset+4+add_stat_size+2 );
5328 proto_tree_add_item( cmd_data_tree, hf_cip_cm_vendor, tvb, offset+4+add_stat_size+2, 2, ENC_LITTLE_ENDIAN);
5329 DeviceSerialNumber = tvb_get_letohl( tvb, offset+4+add_stat_size+4 );
5330 proto_tree_add_item( cmd_data_tree, hf_cip_cm_orig_serial_num, tvb, offset+4+add_stat_size+4, 4, ENC_LITTLE_ENDIAN);
5331 proto_tree_add_item(cmd_data_tree, hf_cip_cm_remain_path_size, tvb, offset+4+add_stat_size+8, 1, ENC_LITTLE_ENDIAN);
5332 proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+4+add_stat_size+9, 1, ENC_LITTLE_ENDIAN);
5334 /* With an error reply the connection will either never be established or it has since already closed
5335 That means the conversation should end too */
5336 enip_close_cip_connection(pinfo, ConnSerialNumber, VendorID, DeviceSerialNumber);
5337 if (preq_info != NULL)
5339 /* Remove any connection information */
5340 preq_info->connInfo = NULL;
5342 break;
5343 case SC_CM_UNCON_SEND:
5344 /* Unconnected send response (Unsuccess) */
5345 proto_tree_add_item(cmd_data_tree, hf_cip_cm_remain_path_size, tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN);
5346 break;
5347 default:
5348 /* Add data */
5349 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5350 break;
5352 } /* end of if-else( CI_CRC_SUCCESS ) */
5354 } /* End of if command-specific data present */
5356 } /* End of if reply */
5357 else
5359 /* Request message */
5361 add_cip_service_to_info_column(pinfo, service, cip_sc_vals_cm);
5363 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
5365 /* If there is any command specific data creat a sub-tree for it */
5366 if( (item_length-req_path_size-2) != 0 )
5369 pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
5370 cmd_data_tree = proto_item_add_subtree( pi, ett_cm_cmd_data );
5372 /* Check what service code that received */
5373 switch (service)
5375 case SC_CM_FWD_OPEN:
5376 /* Forward open Request*/
5377 dissect_cip_cm_fwd_open_req(preq_info, cmd_data_tree, tvb, offset+2+req_path_size, FALSE, pinfo);
5378 break;
5379 case SC_CM_LARGE_FWD_OPEN:
5380 /* Large Forward open Request*/
5381 dissect_cip_cm_fwd_open_req(preq_info, cmd_data_tree, tvb, offset+2+req_path_size, TRUE, pinfo);
5382 break;
5383 case SC_CM_FWD_CLOSE:
5384 /* Forward Close Request */
5386 dissect_cip_cm_timeout( cmd_data_tree, tvb, offset+2+req_path_size);
5387 proto_tree_add_item( cmd_data_tree, hf_cip_cm_conn_serial_num, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5388 proto_tree_add_item( cmd_data_tree, hf_cip_cm_vendor, tvb, offset+2+req_path_size+4, 2, ENC_LITTLE_ENDIAN);
5389 proto_tree_add_item( cmd_data_tree, hf_cip_cm_orig_serial_num, tvb, offset+2+req_path_size+6, 4, ENC_LITTLE_ENDIAN);
5391 /* Add the path size */
5392 conn_path_size = tvb_get_guint8( tvb, offset+2+req_path_size+10 )*2;
5393 proto_tree_add_uint_format_value(cmd_data_tree, hf_cip_cm_conn_path_size, tvb, offset+2+req_path_size+10, 1, conn_path_size/2, "%d (words)", conn_path_size/2);
5395 /* Display the Reserved byte */
5396 proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+2+req_path_size+11, 1, ENC_LITTLE_ENDIAN);
5398 /* Add the EPATH */
5399 pi = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+12, conn_path_size, "Connection Path: ");
5400 dissect_epath( tvb, pinfo, pi, offset+2+req_path_size+12, conn_path_size, FALSE, FALSE, NULL, NULL );
5401 break;
5402 case SC_CM_UNCON_SEND:
5404 /* Unconnected send */
5405 tvbuff_t *next_tvb;
5407 /* Display timeout fields */
5408 dissect_cip_cm_timeout( cmd_data_tree, tvb, offset+2+req_path_size);
5410 /* Message request size */
5411 msg_req_siz = tvb_get_letohs( tvb, offset+2+req_path_size+2 );
5412 proto_tree_add_item(cmd_data_tree, hf_cip_cm_msg_req_size, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5414 /* Message Request */
5415 temp_item = proto_tree_add_text( cmd_data_tree, tvb, offset+2+req_path_size+4, msg_req_siz, "Message Request" );
5416 temp_tree = proto_item_add_subtree(temp_item, ett_cm_mes_req );
5419 ** We call our selves again to disect embedded packet
5422 col_append_str( pinfo->cinfo, COL_INFO, ": ");
5424 next_tvb = tvb_new_subset(tvb, offset+2+req_path_size+4, msg_req_siz, msg_req_siz);
5425 preq_info = (cip_req_info_t *)p_get_proto_data( pinfo->fd, proto_cip, 0 );
5426 pembedded_req_info = NULL;
5427 if ( preq_info )
5429 if ( preq_info->pData == NULL )
5431 pembedded_req_info = wmem_new0(wmem_file_scope(), cip_req_info_t);
5432 preq_info->pData = pembedded_req_info;
5434 else
5436 pembedded_req_info = (cip_req_info_t*)preq_info->pData;
5439 pembedded_req_info->isUnconnectedSend = TRUE;
5441 dissect_cip_data( temp_tree, next_tvb, 0, pinfo, pembedded_req_info );
5443 if( msg_req_siz % 2 )
5445 /* Pad byte */
5446 proto_tree_add_item(cmd_data_tree, hf_cip_pad8, tvb, offset+2+req_path_size+4+msg_req_siz, 1, ENC_LITTLE_ENDIAN);
5447 msg_req_siz++; /* include the padding */
5450 /* Route Path Size */
5451 route_path_size = tvb_get_guint8( tvb, offset+2+req_path_size+4+msg_req_siz )*2;
5452 proto_tree_add_uint_format_value(cmd_data_tree, hf_cip_cm_route_path_size, tvb, offset+2+req_path_size+4+msg_req_siz, 1, route_path_size / 2, "%d (words)", route_path_size / 2);
5454 /* Display the Reserved byte */
5455 proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+2+req_path_size+5+msg_req_siz, 1, ENC_LITTLE_ENDIAN);
5457 /* Route Path */
5458 temp_item = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+6+msg_req_siz, route_path_size, "Route Path: ");
5459 dissect_epath( tvb, pinfo, temp_item, offset+2+req_path_size+6+msg_req_siz, route_path_size, FALSE, FALSE, NULL, NULL );
5461 break;
5462 case SC_CM_GET_CONN_OWNER:
5463 /* Get Connection Owner Request */
5465 /* Display the Reserved byte */
5466 proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+2+req_path_size, 1, ENC_LITTLE_ENDIAN);
5468 /* Add path size */
5469 conn_path_size = tvb_get_guint8( tvb, offset+2+req_path_size+1 )*2;
5470 proto_tree_add_uint_format_value(cmd_data_tree, hf_cip_cm_conn_path_size, tvb, offset+2+req_path_size+1, 1, conn_path_size/2, "%d (words)", conn_path_size/2);
5472 /* Add the epath */
5473 pi = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+2, conn_path_size, "Connection Path: ");
5474 dissect_epath( tvb, pinfo, pi, offset+2+req_path_size+2, conn_path_size, FALSE, FALSE, NULL, NULL );
5475 break;
5476 default:
5477 /* Add data */
5478 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
5481 } /* End of if command-specific data present */
5483 } /* End of if-else( request ) */
5485 } /* End of dissect_cip_cm_data() */
5487 static int
5488 dissect_cip_class_cm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5490 proto_item *ti;
5491 proto_tree *class_tree;
5493 /* Create display subtree for the protocol */
5494 ti = proto_tree_add_item(tree, proto_cip_class_cm, tvb, 0, -1, ENC_NA);
5495 class_tree = proto_item_add_subtree( ti, ett_cip_class_cm );
5497 dissect_cip_cm_data( class_tree, tvb, 0, tvb_length(tvb), pinfo );
5499 return tvb_length(tvb);
5502 /************************************************
5504 * Dissector for CIP Modbus Object
5506 ************************************************/
5507 static void
5508 dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
5510 proto_item *pi, *rrsc_item;
5511 proto_tree *rrsc_tree, *cmd_data_tree;
5512 tvbuff_t *next_tvb;
5513 int req_path_size;
5514 guint8 gen_status, add_stat_size, service;
5515 modbus_request_info_t* request_info;
5517 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP MB");
5519 /* Add Service code & Request/Response tree */
5520 service = tvb_get_guint8( tvb, offset );
5521 rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
5522 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_mb_rrsc );
5524 /* Add Request/Response */
5525 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5527 proto_item_append_text( rrsc_item, "%s (%s)",
5528 val_to_str( ( service & 0x7F ),
5529 cip_sc_vals_mb , "Unknown Service (0x%02x)"),
5530 val_to_str_const( ( service & 0x80 )>>7,
5531 cip_sc_rr, "") );
5533 /* Add Service code */
5534 proto_tree_add_item(rrsc_tree, hf_cip_mb_sc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5536 if( service & 0x80 )
5538 /* Response message */
5539 gen_status = tvb_get_guint8( tvb, offset+2 );
5540 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
5542 /* If there is any command specific data create a sub-tree for it */
5543 if( ( item_length-4-add_stat_size ) != 0 )
5545 pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
5546 cmd_data_tree = proto_item_add_subtree( pi, ett_mb_cmd_data );
5548 if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
5550 /* Success responses */
5551 switch (service & 0x7F)
5553 case SC_MB_READ_DISCRETE_INPUTS:
5554 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_discrete_inputs_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5555 break;
5557 case SC_MB_READ_COILS:
5558 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_coils_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5559 break;
5561 case SC_MB_READ_INPUT_REGISTERS:
5562 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_input_register_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5563 break;
5565 case SC_MB_READ_HOLDING_REGISTERS:
5566 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_holding_register_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5567 break;
5569 case SC_MB_WRITE_COILS:
5570 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_coils_start_addr, tvb, offset+4+add_stat_size, 2, ENC_LITTLE_ENDIAN);
5571 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_coils_outputs_forced, tvb, offset+4+add_stat_size+2, 2, ENC_LITTLE_ENDIAN);
5572 break;
5574 case SC_MB_WRITE_HOLDING_REGISTERS:
5575 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_registers_start_addr, tvb, offset+4+add_stat_size, 2, ENC_LITTLE_ENDIAN);
5576 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_registers_outputs_forced, tvb, offset+4+add_stat_size+2, 2, ENC_LITTLE_ENDIAN);
5577 break;
5579 case SC_MB_PASSTHROUGH:
5580 /* Passthrough response (Success) */
5581 if( tvb_length_remaining(tvb, offset) > 0 )
5583 /* dissect the Modbus PDU */
5584 next_tvb = tvb_new_subset( tvb, offset+4+add_stat_size, item_length-4-add_stat_size, item_length-4-add_stat_size);
5586 /* keep packet context */
5587 request_info = wmem_new(wmem_packet_scope(), modbus_request_info_t);
5588 request_info->packet_type = RESPONSE_PACKET;
5589 request_info->register_addr_type = MBTCP_PREF_REGISTER_ADDR_RAW;
5590 request_info->register_format = MBTCP_PREF_REGISTER_FORMAT_UINT16;
5591 p_add_proto_data(pinfo->fd, proto_modbus, 0, request_info);
5593 call_dissector(modbus_handle, next_tvb, pinfo, cmd_data_tree);
5594 p_remove_proto_data(pinfo->fd, proto_modbus, 0);
5596 break;
5598 default:
5599 proto_tree_add_item(cmd_data_tree, hf_cip_mb_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5602 else
5604 proto_tree_add_item(cmd_data_tree, hf_cip_mb_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5607 } /* End of if command-specific data present */
5609 } /* End of if reply */
5610 else
5612 /* Request message */
5614 add_cip_service_to_info_column(pinfo, service, cip_sc_vals_mb);
5616 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
5618 /* If there is any command specific data creat a sub-tree for it */
5619 if( (item_length-req_path_size-2) != 0 )
5621 pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
5622 cmd_data_tree = proto_item_add_subtree( pi, ett_mb_cmd_data );
5624 /* Check what service code that received */
5625 switch (service)
5627 case SC_MB_READ_DISCRETE_INPUTS:
5628 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_discrete_inputs_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5629 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_discrete_inputs_num_inputs, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5630 break;
5632 case SC_MB_READ_COILS:
5633 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_coils_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5634 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_coils_num_coils, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5635 break;
5637 case SC_MB_READ_INPUT_REGISTERS:
5638 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_input_register_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5639 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_input_register_num_registers, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5640 break;
5642 case SC_MB_READ_HOLDING_REGISTERS:
5643 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_holding_register_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5644 proto_tree_add_item(cmd_data_tree, hf_cip_mb_read_holding_register_num_registers, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5645 break;
5647 case SC_MB_WRITE_COILS:
5649 guint16 NumCoils;
5651 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_coils_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5652 NumCoils = tvb_get_letohs( tvb, offset+2+req_path_size+2 );
5653 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_coils_num_coils, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5654 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_coils_data, tvb, offset+2+req_path_size+4, (NumCoils+7)/8, ENC_NA);
5656 break;
5658 case SC_MB_WRITE_HOLDING_REGISTERS:
5660 guint16 NumRegisters;
5662 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_registers_start_addr, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN);
5663 NumRegisters = tvb_get_letohs( tvb, offset+2+req_path_size+2 );
5664 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_registers_num_registers, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
5665 proto_tree_add_item(cmd_data_tree, hf_cip_mb_write_registers_data, tvb, offset+2+req_path_size+4, NumRegisters*2, ENC_NA);
5667 break;
5669 case SC_MB_PASSTHROUGH:
5670 /* Passthrough Request */
5671 if( tvb_length_remaining(tvb, offset) > 0 )
5673 /* dissect the Modbus PDU */
5674 next_tvb = tvb_new_subset( tvb, offset+2+req_path_size, item_length-req_path_size-2, item_length-req_path_size-2);
5676 /* keep packet context */
5677 request_info = wmem_new(wmem_packet_scope(), modbus_request_info_t);
5678 request_info->packet_type = QUERY_PACKET;
5679 request_info->register_addr_type = MBTCP_PREF_REGISTER_ADDR_RAW;
5680 request_info->register_format = MBTCP_PREF_REGISTER_FORMAT_UINT16;
5681 p_add_proto_data(pinfo->fd, proto_modbus, 0, request_info);
5683 call_dissector(modbus_handle, next_tvb, pinfo, cmd_data_tree);
5684 p_remove_proto_data(pinfo->fd, proto_modbus, 0);
5686 break;
5688 default:
5689 proto_tree_add_item(cmd_data_tree, hf_cip_mb_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
5692 } /* End of if command-specific data present */
5694 } /* End of if-else( request ) */
5696 } /* End of dissect_cip_mb_data() */
5698 static int
5699 dissect_cip_class_mb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5701 proto_item *ti;
5702 proto_tree *class_tree;
5704 /* Create display subtree for the protocol */
5705 ti = proto_tree_add_item(tree, proto_cip_class_mb, tvb, 0, -1, ENC_NA);
5706 class_tree = proto_item_add_subtree( ti, ett_cip_class_mb );
5708 dissect_cip_mb_data( class_tree, tvb, 0, tvb_length(tvb), pinfo );
5710 return tvb_length(tvb);
5713 /************************************************
5715 * Dissector for CIP Connection Configuration Object
5717 ************************************************/
5718 static int
5719 dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo)
5721 proto_item *pi, *tdii, *ncpi, *iomapi, *confgi;
5722 proto_tree *tdi_tree, *iomap_tree;
5723 proto_tree *ncp_tree, *confg_tree;
5724 int conn_path_size, variable_data_size = 0, config_data_size;
5725 int connection_name_size, iomap_size, ot_rtf, to_rtf;
5726 int temp_data;
5727 char* str_connection_name;
5729 /* Connection flags */
5730 temp_data = tvb_get_letohs( tvb, offset);
5731 ot_rtf = (temp_data >> 1) & 7;
5732 to_rtf = (temp_data >> 4) & 7;
5733 confgi = proto_tree_add_item(cmd_tree, hf_cip_cco_con_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN );
5734 confg_tree = proto_item_add_subtree(confgi, ett_cco_con_flag);
5736 /* Add the data to the tree */
5737 proto_tree_add_item(confg_tree, hf_cip_cco_con_type, tvb, offset, 2, ENC_LITTLE_ENDIAN );
5738 proto_tree_add_item(confg_tree, hf_cip_cco_ot_rtf, tvb, offset, 2, ENC_LITTLE_ENDIAN );
5739 proto_tree_add_item(confg_tree, hf_cip_cco_to_rtf, tvb, offset, 2, ENC_LITTLE_ENDIAN );
5741 /* Target device id */
5742 tdii = proto_tree_add_text( cmd_tree, tvb, offset+2, 10, "Target Device ID");
5743 tdi_tree = proto_item_add_subtree(tdii, ett_cco_tdi);
5745 dissect_deviceid(tvb, offset+2, tdi_tree,
5746 hf_cip_cco_tdi_vendor, hf_cip_cco_tdi_devtype, hf_cip_cco_tdi_prodcode,
5747 hf_cip_cco_tdi_compatibility, hf_cip_cco_tdi_comp_bit, hf_cip_cco_tdi_majorrev, hf_cip_cco_tdi_minorrev);
5749 /* CS Data Index Number */
5750 proto_tree_add_item(cmd_tree, hf_cip_cco_cs_data_index, tvb, offset+10, 4, ENC_LITTLE_ENDIAN );
5752 /* Net Connection Parameters */
5753 ncpi = proto_tree_add_text( cmd_tree, tvb, offset+14, 14, "Net Connection Parameters");
5754 ncp_tree = proto_item_add_subtree(ncpi, ett_cco_ncp);
5756 /* Timeout multiplier */
5757 proto_tree_add_item(ncp_tree, hf_cip_cco_timeout_multiplier, tvb, offset+14, 1, ENC_LITTLE_ENDIAN );
5759 dissect_transport_type_trigger(tvb, offset+15, ncp_tree, hf_cip_cco_transport_type_trigger,
5760 hf_cip_cco_fwo_dir, hf_cip_cco_fwo_trigger, hf_cip_cco_fwo_class, ett_cco_ttt);
5762 temp_data = tvb_get_letohl( tvb, offset+16);
5763 proto_tree_add_uint_format_value(ncp_tree, hf_cip_cco_ot_rpi, tvb, offset+16, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5765 /* Display O->T network connection parameters */
5766 dissect_net_param16(tvb, offset+20, ncp_tree,
5767 hf_cip_cco_ot_net_param16, hf_cip_cco_fwo_own, hf_cip_cco_fwo_typ,
5768 hf_cip_cco_fwo_prio, hf_cip_cco_fwo_fixed_var, hf_cip_cco_fwo_con_size, ett_cco_ncp);
5770 temp_data = tvb_get_letohl( tvb, offset+22);
5771 proto_tree_add_uint_format_value(ncp_tree, hf_cip_cco_to_rpi, tvb, offset+16, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5773 /* Display T->O network connection parameters */
5774 dissect_net_param16(tvb, offset+26, ncp_tree,
5775 hf_cip_cco_to_net_param16, hf_cip_cco_fwo_own, hf_cip_cco_fwo_typ,
5776 hf_cip_cco_fwo_prio, hf_cip_cco_fwo_fixed_var, hf_cip_cco_fwo_con_size, ett_cco_ncp);
5778 /* Connection Path */
5779 conn_path_size = tvb_get_guint8( tvb, offset+28 )*2;
5780 proto_tree_add_uint_format_value(cmd_tree, hf_cip_cco_conn_path_size, tvb, offset+28, 1, conn_path_size/2, "%d (words)", conn_path_size/2);
5782 /* Display the Reserved byte */
5783 proto_tree_add_item(cmd_tree, hf_cip_reserved8, tvb, offset+29, 1, ENC_LITTLE_ENDIAN );
5785 /* Add the epath */
5786 pi = proto_tree_add_text(cmd_tree, tvb, offset+30, conn_path_size, "Connection Path: ");
5787 dissect_epath( tvb, pinfo, pi, offset+30, conn_path_size, FALSE, FALSE, NULL, NULL );
5789 variable_data_size += (conn_path_size+30);
5791 /* Config #1 Data */
5792 config_data_size = tvb_get_letohs( tvb, offset+variable_data_size);
5793 proto_tree_add_item(cmd_tree, hf_cip_cco_proxy_config_size, tvb, offset+variable_data_size, 2, ENC_LITTLE_ENDIAN );
5794 if (config_data_size > 0)
5795 proto_tree_add_item(cmd_tree, hf_cip_cco_proxy_config_data, tvb, offset+variable_data_size+2, config_data_size, ENC_NA);
5797 variable_data_size += (config_data_size+2);
5799 /* Config #2 Data */
5800 config_data_size = tvb_get_letohs( tvb, offset+variable_data_size);
5801 proto_tree_add_item(cmd_tree, hf_cip_cco_target_config_size, tvb, offset+variable_data_size, 2, ENC_LITTLE_ENDIAN );
5802 if (config_data_size > 0)
5803 proto_tree_add_item(cmd_tree, hf_cip_cco_target_config_data, tvb, offset+variable_data_size+2, config_data_size, ENC_NA);
5805 variable_data_size += (config_data_size+2);
5807 /* Connection Name */
5808 connection_name_size = tvb_get_guint8( tvb, offset+variable_data_size);
5809 str_connection_name = tvb_get_string(wmem_packet_scope(), tvb, offset+variable_data_size+2, connection_name_size);
5810 proto_tree_add_text(cmd_tree, tvb, offset+variable_data_size, connection_name_size+2, "Connection Name: %s", str_connection_name);
5812 variable_data_size += ((connection_name_size*2)+2);
5814 /* I/O Mapping */
5815 iomap_size = tvb_get_letohs( tvb, offset+variable_data_size+2);
5817 iomapi = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, iomap_size+2, "I/O Mapping");
5818 iomap_tree = proto_item_add_subtree(iomapi, ett_cco_iomap);
5820 proto_tree_add_item(iomap_tree, hf_cip_cco_iomap_format_number, tvb, offset+variable_data_size, 2, ENC_LITTLE_ENDIAN );
5821 proto_tree_add_uint_format_value(iomap_tree, hf_cip_cco_iomap_size, tvb, offset+variable_data_size+2, 2, iomap_size, "%d (bytes)", iomap_size);
5823 /* Attribute data */
5824 if (iomap_size > 0)
5825 proto_tree_add_item(iomap_tree, hf_cip_cco_iomap_attribute, tvb, offset+variable_data_size+4, iomap_size, ENC_NA);
5827 variable_data_size += (iomap_size+4);
5829 /* Proxy device id */
5830 tdii = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, 10, "Proxy Device ID");
5831 tdi_tree = proto_item_add_subtree(tdii, ett_cco_pdi);
5833 dissect_deviceid(tvb, offset+variable_data_size, tdi_tree,
5834 hf_cip_cco_pdi_vendor, hf_cip_cco_pdi_devtype, hf_cip_cco_pdi_prodcode,
5835 hf_cip_cco_pdi_compatibility, hf_cip_cco_pdi_comp_bit, hf_cip_cco_pdi_majorrev, hf_cip_cco_pdi_minorrev);
5837 /* Add in proxy device id size */
5838 variable_data_size += 8;
5840 if ((offset+variable_data_size < item_length) &&
5841 ((ot_rtf == 5) || (to_rtf == 5)))
5843 /* Safety parameters */
5844 proto_tree_add_item(cmd_tree, hf_cip_cco_safety, tvb, offset+variable_data_size, 55, ENC_NA);
5845 variable_data_size += 55;
5848 if (offset+variable_data_size < item_length)
5850 proto_tree_add_item(cmd_tree, hf_cip_cco_connection_disable, tvb, offset+variable_data_size, 1, ENC_LITTLE_ENDIAN );
5851 variable_data_size++;
5854 if (offset+variable_data_size < item_length)
5856 proto_tree_add_item(cmd_tree, hf_cip_cco_net_conn_param_attr, tvb, offset+variable_data_size, 1, ENC_LITTLE_ENDIAN );
5857 variable_data_size++;
5860 if (offset+variable_data_size < item_length)
5862 /* Large Net Connection Parameter */
5863 ncpi = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, 18, "Large Net Connection Parameters");
5864 ncp_tree = proto_item_add_subtree(ncpi, ett_cco_ncp);
5866 proto_tree_add_item(ncp_tree, hf_cip_cco_timeout_multiplier, tvb, offset+variable_data_size, 1, ENC_LITTLE_ENDIAN );
5867 dissect_transport_type_trigger(tvb, offset+variable_data_size+1, ncp_tree, hf_cip_cco_transport_type_trigger,
5868 hf_cip_cco_fwo_dir, hf_cip_cco_fwo_trigger, hf_cip_cco_fwo_class, ett_cco_ttt);
5870 temp_data = tvb_get_letohl( tvb, offset+variable_data_size+2);
5871 proto_tree_add_uint_format_value(ncp_tree, hf_cip_cco_ot_rpi, tvb, offset+variable_data_size+2, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5873 /* Display O->T network connection parameters */
5874 dissect_net_param32(tvb, offset+variable_data_size+6, ncp_tree,
5875 hf_cip_cco_ot_net_param32, hf_cip_cco_lfwo_own, hf_cip_cco_lfwo_typ,
5876 hf_cip_cco_lfwo_prio, hf_cip_cco_lfwo_fixed_var, hf_cip_cco_lfwo_con_size, ett_cco_ncp);
5878 temp_data = tvb_get_letohl( tvb, offset+variable_data_size+10);
5879 proto_tree_add_uint_format_value(ncp_tree, hf_cip_cco_to_rpi, tvb, offset+variable_data_size+2, 4, temp_data, "%dms (0x%08X)", temp_data / 1000, temp_data);
5881 /* Display T->O network connection parameters */
5882 dissect_net_param32(tvb, offset+variable_data_size+14, ncp_tree,
5883 hf_cip_cco_to_net_param32, hf_cip_cco_lfwo_own, hf_cip_cco_lfwo_typ,
5884 hf_cip_cco_lfwo_prio, hf_cip_cco_lfwo_fixed_var, hf_cip_cco_lfwo_con_size, ett_cco_ncp);
5886 variable_data_size += 18;
5888 return variable_data_size;
5891 static void
5892 dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
5894 proto_item *pi, *rrsc_item, *con_sti;
5895 proto_tree *rrsc_tree, *cmd_data_tree, *con_st_tree;
5896 int req_path_size;
5897 int temp_data;
5898 guint8 service, gen_status, add_stat_size;
5899 cip_req_info_t* preq_info;
5900 cip_simple_request_info_t req_data;
5902 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP CCO");
5904 /* Add Service code & Request/Response tree */
5905 service = tvb_get_guint8( tvb, offset );
5906 rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
5907 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_cco_rrsc );
5909 /* Add Request/Response */
5910 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5912 proto_item_append_text( rrsc_item, "%s (%s)",
5913 val_to_str( ( service & 0x7F ),
5914 cip_sc_vals_cco , "Unknown Service (0x%02x)"),
5915 val_to_str_const( ( service & 0x80 )>>7,
5916 cip_sc_rr, "") );
5918 /* Add Service code */
5919 proto_tree_add_item(rrsc_tree, hf_cip_cco_sc, tvb, offset, 1, ENC_LITTLE_ENDIAN );
5921 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
5922 if ((preq_info != NULL) &&
5923 (preq_info->ciaData != NULL))
5925 memcpy(&req_data, preq_info->ciaData, sizeof(cip_simple_request_info_t));
5927 else
5929 req_data.iClass = (guint32)-1;
5930 req_data.iInstance = (guint32)-1;
5931 req_data.iAttribute = (guint32)-1;
5932 req_data.iMember = (guint32)-1;
5935 if(service & 0x80 )
5937 /* Response message */
5939 /* Add additional status size */
5940 gen_status = tvb_get_guint8( tvb, offset+2 );
5941 add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2;
5943 /* If there is any command specific data create a sub-tree for it */
5944 if( ( item_length-4-add_stat_size ) != 0 )
5946 pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
5947 cmd_data_tree = proto_item_add_subtree( pi, ett_cco_cmd_data );
5949 if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
5951 /* Success responses */
5952 if (((service & 0x7F) == SC_GET_ATT_ALL) &&
5953 (req_data.iInstance != (guint32)-1))
5955 if (req_data.iInstance == 0)
5957 /* Get Attribute All (class) request */
5959 proto_tree_add_item(cmd_data_tree, hf_cip_class_rev, tvb, offset+4+add_stat_size, 2, ENC_LITTLE_ENDIAN );
5960 proto_tree_add_item(cmd_data_tree, hf_cip_class_max_inst32, tvb, offset+4+add_stat_size+2, 4, ENC_LITTLE_ENDIAN );
5961 proto_tree_add_item(cmd_data_tree, hf_cip_class_num_inst32, tvb, offset+4+add_stat_size+6, 4, ENC_LITTLE_ENDIAN );
5962 proto_tree_add_item(cmd_data_tree, hf_cip_cco_format_number, tvb, offset+4+add_stat_size+10, 2, ENC_LITTLE_ENDIAN );
5963 proto_tree_add_item(cmd_data_tree, hf_cip_cco_edit_signature, tvb, offset+4+add_stat_size+12, 4, ENC_LITTLE_ENDIAN );
5965 else
5967 /* Get Attribute All (instance) request */
5969 /* Connection status */
5970 con_sti = proto_tree_add_text( cmd_data_tree, tvb, offset+4+add_stat_size, 4, "Connection Status");
5971 con_st_tree = proto_item_add_subtree(con_sti, ett_cco_con_status);
5973 proto_tree_add_item(con_st_tree, hf_cip_genstat, tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN );
5974 proto_tree_add_item(con_st_tree, hf_cip_pad8, tvb, offset+4+add_stat_size+1, 1, ENC_LITTLE_ENDIAN);
5976 /* Extended Status */
5977 temp_data = tvb_get_letohs( tvb, offset+4+add_stat_size+2);
5978 proto_tree_add_text(con_st_tree, tvb, offset+4+add_stat_size+2, 2, "Extended Status: 0x%04X", temp_data );
5980 dissect_cip_cco_all_attribute_common( cmd_data_tree, tvb, offset+4+add_stat_size+4, item_length, pinfo);
5983 else
5985 /* Add data */
5986 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5989 else
5991 /* Error responses */
5993 /* Add data */
5994 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
5995 } /* end of if-else( CI_CRC_SUCCESS ) */
5997 } /* End of if command-specific data present */
5999 } /* End of if reply */
6000 else
6002 /* Request message */
6004 add_cip_service_to_info_column(pinfo, service, cip_sc_vals_cco);
6006 req_path_size = tvb_get_guint8( tvb, offset+1 )*2;
6008 /* If there is any command specific data create a sub-tree for it */
6009 if( (item_length-req_path_size-2) != 0 )
6012 pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
6013 cmd_data_tree = proto_item_add_subtree( pi, ett_cco_cmd_data );
6015 /* Check what service code that received */
6017 switch (service)
6019 case SC_CCO_AUDIT_CHANGE:
6020 proto_tree_add_item(cmd_data_tree, hf_cip_cco_change_type, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN );
6021 break;
6022 case SC_CCO_CHANGE_COMPLETE:
6023 proto_tree_add_item(cmd_data_tree, hf_cip_cco_change_type, tvb, offset+2+req_path_size, 2, ENC_LITTLE_ENDIAN );
6024 break;
6025 case SC_SET_ATT_ALL:
6026 if ((req_data.iInstance == 0) ||
6027 (req_data.iInstance == (guint32)-1))
6029 /* Just add raw data */
6030 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
6031 break;
6034 /* Set Attribute All (instance) request */
6035 dissect_cip_cco_all_attribute_common(cmd_data_tree, tvb, offset+2+req_path_size, item_length, pinfo);
6036 break;
6037 default:
6039 /* Add data */
6040 proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
6041 } /* End of check service code */
6043 } /* End of if command-specific data present */
6045 } /* End of if-else( request ) */
6047 } /* End of dissect_cip_cco_data() */
6049 static int
6050 dissect_cip_class_cco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
6052 proto_item *ti;
6053 proto_tree *class_tree;
6055 /* Create display subtree for the protocol */
6056 ti = proto_tree_add_item(tree, proto_cip_class_cco, tvb, 0, -1, ENC_NA);
6057 class_tree = proto_item_add_subtree( ti, ett_cip_class_cco );
6059 dissect_cip_cco_data( class_tree, tvb, 0, tvb_length(tvb), pinfo );
6061 return tvb_length(tvb);
6064 static gboolean
6065 dissect_class_cco_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
6067 unsigned char service, service_code, ioilen, segment;
6068 cip_req_info_t* preq_info;
6069 guint32 classid = 0;
6070 int offset = 0;
6072 service = tvb_get_guint8( tvb, offset );
6073 service_code = service & 0x7F;
6075 /* Handle GetAttributeAll and SetAttributeAll in CCO class */
6076 if ((service_code == SC_GET_ATT_ALL) ||
6077 (service_code == SC_SET_ATT_ALL))
6079 if (service & 0x80)
6081 /* Service response */
6082 preq_info = (cip_req_info_t*)p_get_proto_data(pinfo->fd, proto_cip, 0);
6083 if ((preq_info != NULL) &&
6084 (preq_info->dissector == dissector_get_uint_handle( subdissector_class_table, CI_CLS_CCO)))
6086 call_dissector(preq_info->dissector, tvb, pinfo, tree);
6087 return TRUE;
6090 else
6092 /* Service request */
6093 ioilen = tvb_get_guint8( tvb, offset + 1 );
6094 if (ioilen > 1)
6096 segment = tvb_get_guint8( tvb, offset + 2 );
6097 if (((segment & CI_SEGMENT_TYPE_MASK) == CI_LOGICAL_SEGMENT) &&
6098 ((segment & CI_LOGICAL_SEG_TYPE_MASK) == CI_LOGICAL_SEG_CLASS_ID))
6100 /* Logical Class ID, do a format check */
6101 switch ( segment & CI_LOGICAL_SEG_FORMAT_MASK )
6103 case CI_LOGICAL_SEG_8_BIT:
6104 classid = tvb_get_guint8( tvb, offset + 3 );
6105 break;
6106 case CI_LOGICAL_SEG_16_BIT:
6107 if ( ioilen >= 2 )
6108 classid = tvb_get_letohs( tvb, offset + 4 );
6109 break;
6110 case CI_LOGICAL_SEG_32_BIT:
6111 if ( ioilen >= 3 )
6112 classid = tvb_get_letohl( tvb, offset + 4 );
6113 break;
6118 if (classid == CI_CLS_CCO)
6120 call_dissector(cip_class_cco_handle, tvb, pinfo, tree );
6121 return TRUE;
6127 return FALSE;
6130 /************************************************
6132 * Dissector for CIP Request/Response
6133 * - matches requests/responses
6134 * - calls class specific dissector
6136 ************************************************/
6138 static void
6139 dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info *pinfo, cip_req_info_t* preq_info )
6141 proto_item *ti;
6142 proto_tree *cip_tree;
6143 proto_item *pi, *rrsc_item, *status_item, *add_status_item;
6144 proto_tree *rrsc_tree, *status_tree, *add_status_tree;
6145 int req_path_size;
6146 unsigned char i, gen_status, add_stat_size;
6147 unsigned char service,ioilen,segment;
6148 void *p_save_proto_data;
6149 cip_simple_request_info_t path_info;
6150 dissector_handle_t dissector;
6151 gint service_index;
6153 p_save_proto_data = p_get_proto_data(pinfo->fd, proto_cip, 0);
6154 p_remove_proto_data(pinfo->fd, proto_cip, 0);
6155 p_add_proto_data(pinfo->fd, proto_cip, 0, preq_info);
6157 /* Create display subtree for the protocol */
6158 ti = proto_tree_add_item(item_tree, proto_cip, tvb, 0, -1, ENC_NA);
6159 cip_tree = proto_item_add_subtree( ti, ett_cip );
6161 service = tvb_get_guint8( tvb, offset );
6163 /* Add Service code & Request/Response tree */
6164 rrsc_item = proto_tree_add_uint_format_value(cip_tree, hf_cip_service,
6165 tvb, offset, 1, service, "%s (%s)",
6166 val_to_str( ( service & 0x7F ), cip_sc_vals , "Unknown Service (0x%02x)"),
6167 val_to_str_const( ( service & 0x80 )>>7, cip_sc_rr, ""));
6169 rrsc_tree = proto_item_add_subtree( rrsc_item, ett_rrsc );
6171 proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6172 proto_tree_add_item(rrsc_tree, hf_cip_service_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6174 if( service & 0x80 )
6176 /* Response message */
6177 status_item = proto_tree_add_text( cip_tree, tvb, offset+2, 1, "Status: " );
6178 status_tree = proto_item_add_subtree( status_item, ett_status_item );
6180 /* Add general status */
6181 gen_status = tvb_get_guint8( tvb, offset+2 );
6182 proto_tree_add_item(status_tree, hf_cip_genstat, tvb, offset+2, 1, ENC_LITTLE_ENDIAN );
6183 proto_item_append_text( status_item, "%s", val_to_str_ext( gen_status,
6184 &cip_gs_vals_ext , "Unknown Response (%x)") );
6186 /* Add reply status to info column */
6187 col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s",
6188 val_to_str_ext( gen_status, &cip_gs_vals_ext, "Unknown Response (%x)") );
6189 col_set_fence(pinfo->cinfo, COL_INFO);
6191 /* Add additional status size */
6192 add_stat_size = tvb_get_guint8( tvb, offset+3 );
6193 proto_tree_add_uint_format_value(status_tree, hf_cip_addstat_size,
6194 tvb, offset+3, 1, add_stat_size, "%d (words)", add_stat_size);
6196 if( add_stat_size )
6198 /* Add additional status */
6199 add_status_item = proto_tree_add_text( status_tree, tvb, offset+4, add_stat_size*2, "Additional Status" );
6200 add_status_tree = proto_item_add_subtree( add_status_item, ett_add_status_item );
6202 for( i=0; i < add_stat_size; i ++ )
6203 proto_tree_add_item(add_status_tree, hf_cip_add_stat, tvb, offset+4+(i*2), 2, ENC_LITTLE_ENDIAN );
6206 proto_item_set_len( status_item, 2 + add_stat_size*2);
6209 if( preq_info
6210 && !( preq_info->bService == ( service & 0x7F )
6211 || ( preq_info->bService == SC_CM_UNCON_SEND && preq_info->dissector == cip_class_cm_handle )
6214 preq_info = NULL;
6216 if ( preq_info )
6218 if ( preq_info->IOILen && preq_info->pIOI )
6220 tvbuff_t* tvbIOI;
6222 tvbIOI = tvb_new_real_data((const guint8 *)preq_info->pIOI, preq_info->IOILen * 2, preq_info->IOILen * 2);
6223 if ( tvbIOI )
6225 pi = proto_tree_add_text( cip_tree, NULL, 0, 0, "Request Path Size: %d (words)", preq_info->IOILen );
6226 PROTO_ITEM_SET_GENERATED(pi);
6228 /* Add the epath */
6229 pi = proto_tree_add_text(cip_tree, NULL, 0, 0, "Request Path: ");
6230 PROTO_ITEM_SET_GENERATED(pi);
6232 preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t);
6233 dissect_epath( tvbIOI, pinfo, pi, 0, preq_info->IOILen*2, TRUE, FALSE, preq_info->ciaData, NULL);
6234 tvb_free(tvbIOI);
6239 /* Check to see if service is 'generic' */
6240 try_val_to_str_idx((service & 0x7F), cip_sc_vals, &service_index);
6241 if (service_index >= 0)
6243 /* See if object dissector wants to override generic service handling */
6244 if(!dissector_try_heuristic(heur_subdissector_service, tvb, pinfo, item_tree, NULL))
6246 dissect_cip_generic_service_rsp(tvb, pinfo, cip_tree);
6249 else if ( preq_info && preq_info->dissector )
6251 call_dissector( preq_info->dissector, tvb, pinfo, item_tree );
6253 else
6255 call_dissector( cip_class_generic_handle, tvb, pinfo, item_tree );
6257 } /* End of if reply */
6258 else
6260 /* Request message */
6262 /* Add path size to tree */
6263 req_path_size = tvb_get_guint8( tvb, offset+1);
6264 proto_tree_add_uint_format_value(cip_tree, hf_cip_request_path_size,
6265 tvb, offset+1, 1, req_path_size, "%d (words)", req_path_size);
6267 /* Add the epath */
6268 pi = proto_tree_add_text(cip_tree, tvb, offset+2, req_path_size*2, "Request Path: ");
6269 if (preq_info)
6271 preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t);
6272 dissect_epath( tvb, pinfo, pi, offset+2, req_path_size*2, FALSE, FALSE, preq_info->ciaData, NULL);
6273 memcpy(&path_info, preq_info->ciaData, sizeof(cip_simple_request_info_t));
6275 else
6277 dissect_epath( tvb, pinfo, pi, offset+2, req_path_size*2, FALSE, FALSE, &path_info, NULL);
6280 ioilen = tvb_get_guint8( tvb, offset + 1 );
6282 if ( preq_info )
6283 preq_info->dissector = NULL;
6284 dissector = NULL;
6286 /* The class ID should already be extracted if it's available */
6287 if (path_info.iClass != 0xFFFFFFFF)
6289 dissector = dissector_get_uint_handle( subdissector_class_table, path_info.iClass);
6291 else
6293 if ( ioilen >= 1 )
6295 segment = tvb_get_guint8( tvb, offset + 2 );
6296 if ((segment & CI_SEGMENT_TYPE_MASK) == CI_DATA_SEGMENT)
6298 dissector = dissector_get_uint_handle( subdissector_symbol_table, segment );
6303 if ( preq_info )
6305 preq_info->dissector = dissector;
6307 /* copy IOI for access by response packet */
6308 preq_info->pIOI = wmem_alloc(wmem_file_scope(), ioilen*2);
6309 preq_info->IOILen = ioilen;
6310 tvb_memcpy(tvb, preq_info->pIOI, offset+2, ioilen*2);
6312 preq_info->bService = service;
6315 /* Check to see if service is 'generic' */
6316 try_val_to_str_idx(service, cip_sc_vals, &service_index);
6317 if (service_index >= 0)
6319 /* See if object dissector wants to override generic service handling */
6320 if(!dissector_try_heuristic(heur_subdissector_service, tvb, pinfo, item_tree, NULL))
6322 dissect_cip_generic_service_req(tvb, pinfo, cip_tree, &path_info);
6325 else if ( dissector )
6327 call_dissector( dissector, tvb, pinfo, item_tree );
6329 else
6331 call_dissector( cip_class_generic_handle, tvb, pinfo, item_tree );
6333 } /* End of if-else( request ) */
6335 p_remove_proto_data(pinfo->fd, proto_cip, 0);
6336 p_add_proto_data(pinfo->fd, proto_cip, 0, p_save_proto_data);
6338 } /* End of dissect_cip_data() */
6341 static int
6342 dissect_cip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
6344 enip_request_info_t *enip_info;
6345 cip_req_info_t *preq_info;
6347 /* Make entries in Protocol column and Info column on summary display */
6348 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP");
6350 col_clear(pinfo->cinfo, COL_INFO);
6352 /* Each CIP request received by ENIP gets a unique ID */
6353 enip_info = (enip_request_info_t*)p_get_proto_data(pinfo->fd, proto_enip, 0);
6355 if ( enip_info )
6357 preq_info = enip_info->cip_info;
6358 if ( preq_info == NULL )
6360 preq_info = wmem_new0(wmem_file_scope(), cip_req_info_t);
6361 enip_info->cip_info = preq_info;
6363 dissect_cip_data( tree, tvb, 0, pinfo, enip_info->cip_info );
6365 else
6367 dissect_cip_data( tree, tvb, 0, pinfo, NULL );
6370 return tvb_length(tvb);
6374 * Protocol initialization
6377 void
6378 proto_register_cip(void)
6380 /* Setup list of header fields */
6381 static hf_register_info hf[] = {
6383 { &hf_cip_service, { "Service", "cip.service", FT_UINT8, BASE_HEX, NULL, 0, "Service Code + Request/Response", HFILL }},
6384 { &hf_cip_reqrsp, { "Request/Response", "cip.rr", FT_UINT8, BASE_HEX, VALS(cip_sc_rr), 0x80, "Request or Response message", HFILL }},
6385 { &hf_cip_service_code, { "Service", "cip.sc", FT_UINT8, BASE_HEX, VALS(cip_sc_vals), 0x7F, "Service Code", HFILL }},
6386 { &hf_cip_epath, { "EPath", "cip.epath", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6387 { &hf_cip_genstat, { "General Status", "cip.genstat", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &cip_gs_vals_ext, 0, NULL, HFILL }},
6388 { &hf_cip_addstat_size, { "Additional Status Size", "cip.addstat_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6389 { &hf_cip_add_stat, { "Additional Status", "cip.addstat", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6390 { &hf_cip_request_path_size, { "Request Path Size", "cip.request_path_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6392 { &hf_cip_path_segment, { "Path Segment", "cip.path_segment", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6393 { &hf_cip_path_segment_type, { "Path Segment Type", "cip.path_segment.type", FT_UINT8, BASE_DEC, VALS(cip_path_seg_vals), CI_SEGMENT_TYPE_MASK, NULL, HFILL }},
6394 { &hf_cip_port_ex_link_addr, { "Extended Link Address", "cip.ex_linkaddress", FT_BOOLEAN, 8, TFS(&tfs_true_false), CI_PORT_SEG_EX_LINK_ADDRESS, NULL, HFILL }},
6395 { &hf_cip_port, { "Port", "cip.port", FT_UINT8, BASE_DEC, NULL, CI_PORT_SEG_PORT_ID_MASK, "Port Identifier", HFILL }},
6396 { &hf_cip_link_address_byte, { "Link Address", "cip.linkaddress", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6397 { &hf_cip_link_address_size, { "Link Address Size", "cip.linkaddress_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6398 { &hf_cip_link_address_string, { "Link Address", "cip.linkaddress", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
6399 { &hf_cip_logical_seg_type, { "Logical Segment Type", "cip.logical_segment.type", FT_UINT8, BASE_DEC, VALS(cip_logical_segment_type_vals), CI_LOGICAL_SEG_TYPE_MASK, NULL, HFILL }},
6400 { &hf_cip_logical_seg_format, { "Logical Segment Format", "cip.logical_segment.format", FT_UINT8, BASE_DEC, VALS(cip_logical_segment_format_vals), CI_LOGICAL_SEG_FORMAT_MASK, NULL, HFILL }},
6401 { &hf_cip_class8, { "Class", "cip.class", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &cip_class_names_vals_ext, 0, NULL, HFILL }},
6402 { &hf_cip_class16, { "Class", "cip.class", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_class_names_vals_ext, 0, NULL, HFILL }},
6403 { &hf_cip_class32, { "Class", "cip.class", FT_UINT32, BASE_HEX|BASE_EXT_STRING, &cip_class_names_vals_ext, 0, NULL, HFILL }},
6404 { &hf_cip_instance8, { "Instance", "cip.instance", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6405 { &hf_cip_instance16, { "Instance", "cip.instance", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6406 { &hf_cip_instance32, { "Instance", "cip.instance", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6407 { &hf_cip_member8, { "Member", "cip.member", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6408 { &hf_cip_member16, { "Member", "cip.member", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6409 { &hf_cip_member32, { "Member", "cip.member", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6410 { &hf_cip_attribute8, { "Attribute", "cip.attribute", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6411 { &hf_cip_attribute16, { "Attribute", "cip.attribute", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6412 { &hf_cip_attribute32, { "Attribute", "cip.attribute", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6413 { &hf_cip_conpoint8, { "Connection Point", "cip.connpoint", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6414 { &hf_cip_conpoint16, { "Connection Point", "cip.connpoint", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6415 { &hf_cip_conpoint32, { "Connection Point", "cip.connpoint", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6416 { &hf_cip_ekey_format, { "Key Format", "cip.ekey.format", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6417 { &hf_cip_ekey_vendor, { "Vendor ID", "cip.ekey.vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, NULL, HFILL }},
6418 { &hf_cip_ekey_devtype, { "Device Type", "cip.ekey.devtype", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &cip_devtype_vals_ext, 0, NULL, HFILL }},
6419 { &hf_cip_ekey_prodcode, { "Product Code", "cip.ekey.product_code", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6420 { &hf_cip_ekey_compatibility, { "Compatibility", "cip.ekey.compatibility", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6421 { &hf_cip_ekey_comp_bit, { "Compatibility", "cip.ekey.comp_bit", FT_UINT8, BASE_HEX, VALS(cip_com_bit_vals), 0x80, "EKey: Compatibility bit", HFILL }},
6422 { &hf_cip_ekey_majorrev, { "Major Revision", "cip.ekey.major_rev", FT_UINT8, BASE_DEC, NULL, 0x7F, "EKey: Major Revision", HFILL }},
6423 { &hf_cip_ekey_minorrev, { "Minor Revision", "cip.ekey.minor_rev", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6424 { &hf_cip_data_seg_type, { "Data Segment Type", "cip.data_segment.type", FT_UINT8, BASE_DEC, VALS(cip_data_segment_type_vals), CI_DATA_SEG_TYPE_MASK, NULL, HFILL }},
6425 { &hf_cip_data_seg_size, { "Data Size", "cip.data_segment.size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6426 { &hf_cip_data_seg_item, { "Data", "cip.data_segment.data", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6427 { &hf_cip_symbol, { "Symbol", "cip.symbol", FT_STRING, BASE_NONE, NULL, 0, "ANSI Extended Symbol Segment", HFILL }},
6428 { &hf_cip_network_seg_type, { "Network Segment Type", "cip.network_segment.type", FT_UINT8, BASE_DEC, VALS(cip_network_segment_type_vals), CI_NETWORK_SEG_TYPE_MASK, NULL, HFILL }},
6429 { &hf_cip_seg_schedule, { "Multiplier/Phase", "cip.network_segment.schedule", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6430 { &hf_cip_seg_fixed_tag, { "Fixed Tag", "cip.network_segment.fixed_tag", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6431 { &hf_cip_seg_prod_inhibit_time, { "Production Inhibit Time", "cip.network_segment.prod_inhibit", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6432 { &hf_cip_seg_network_size, { "Network Segment Length", "cip.network_segment.length", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6433 { &hf_cip_seg_safety_format, { "Safety Format", "cip.safety_segment.format", FT_UINT8, BASE_DEC, VALS(cip_safety_segment_format_type_vals), 0, NULL, HFILL }},
6434 { &hf_cip_seg_safety_reserved, { "Reserved", "cip.safety_segment.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6435 { &hf_cip_seg_safety_configuration_crc, { "Configuration CRC", "cip.safety_segment.configuration_crc", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6436 { &hf_cip_seg_safety_configuration_timestamp, { "Configuration Timestamp", "cip.safety_segment.configuration_timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }},
6437 { &hf_cip_seg_safety_configuration_date, { "Configuration (Manual) Date", "cip.safety_segment.configuration_date", FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }},
6438 { &hf_cip_seg_safety_configuration_time, { "Configuration (Manual) Time", "cip.safety_segment.configuration_time", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6439 { &hf_cip_seg_safety_time_correction_epi, { "Time Correction EPI", "cip.safety_segment.time_correction_eri", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6440 { &hf_cip_seg_safety_time_correction_net_params, { "Time Correction Network Connection Parameters", "cip.safety_segment.time_correction.net_params", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6441 { &hf_cip_seg_safety_time_correction_own, { "Owner", "cip.safety_segment.time_correction.owner", FT_UINT16, BASE_DEC, VALS(cip_con_owner_vals), 0x8000, "Time Correction: Redundant owner bit", HFILL }},
6442 { &hf_cip_seg_safety_time_correction_typ, { "Connection Type", "cip.safety_segment.time_correction.type", FT_UINT16, BASE_DEC, VALS(cip_con_type_vals), 0x6000, "Time Correction: Connection type", HFILL }},
6443 { &hf_cip_seg_safety_time_correction_prio, { "Priority", "cip.safety_segment.time_correction.prio", FT_UINT16, BASE_DEC, VALS(cip_con_prio_vals), 0x0C00, "Time Correction: Connection priority", HFILL }},
6444 { &hf_cip_seg_safety_time_correction_fixed_var, { "Connection Size Type", "cip.safety_segment.time_correction.f_v", FT_UINT16, BASE_DEC, VALS(cip_con_fw_vals), 0x0200, "Time Correction: Fixed or variable connection size", HFILL }},
6445 { &hf_cip_seg_safety_time_correction_con_size, { "Connection Size", "cip.safety_segment.time_correction.consize", FT_UINT16, BASE_DEC, NULL, 0x01FF, "Time Correction: Connection size", HFILL }},
6446 { &hf_cip_seg_safety_tunid, { "Target UNID", "cip.safety_segment.tunid", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6447 { &hf_cip_seg_safety_tunid_ssn_timestamp, { "SSN Timestamp", "cip.safety_segment.tunid.ssn.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }},
6448 { &hf_cip_seg_safety_tunid_ssn_date, { "SSN (Manual) Date", "cip.safety_segment.tunid.ssn.date", FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }},
6449 { &hf_cip_seg_safety_tunid_ssn_time, { "SSN (Manual) Time", "cip.safety_segment.tunid.ssn.time", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6450 { &hf_cip_seg_safety_tunid_macid, { "MAC ID", "cip.safety_segment.tunid.macid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6451 { &hf_cip_seg_safety_ounid, { "Originator UNID", "cip.safety_segment.ounid", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6452 { &hf_cip_seg_safety_ounid_ssn_timestamp, { "SSN Timestamp", "cip.safety_segment.tunid.ssn.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }},
6453 { &hf_cip_seg_safety_ounid_ssn_date, { "SSN (Manual) Date", "cip.safety_segment.tunid.ssn.date", FT_UINT16, BASE_HEX, VALS(cipsafety_ssn_date_vals), 0, NULL, HFILL }},
6454 { &hf_cip_seg_safety_ounid_ssn_time, { "SSN (Manual) Time", "cip.safety_segment.tunid.ssn.time", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6455 { &hf_cip_seg_safety_ounid_macid, { "MAC ID", "cip.safety_segment.ounid.macid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6456 { &hf_cip_seg_safety_ping_eri_multiplier, { "Ping Interval EPI Multiplier", "cip.safety_segment.ping_eri_multiplier", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6457 { &hf_cip_seg_safety_time_coord_msg_min_multiplier, { "Time Coord Msg Min Multiplier", "cip.safety_segment.time_coord_msg_min_multiplier", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6458 { &hf_cip_seg_safety_network_time_expected_multiplier, { "Network Time Expectation Multiplier", "cip.safety_segment.network_time_expected_multiplier", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6459 { &hf_cip_seg_safety_timeout_multiplier, { "Timeout Multiplier", "cip.safety_segment.timeout_multiplier", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6460 { &hf_cip_seg_safety_max_consumer_number, { "Max Consumer Number", "cip.safety_segment.max_consumer_number", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6461 { &hf_cip_seg_safety_conn_param_crc, { "Connection Param CRC", "cip.safety_segment.conn_param_crc", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6462 { &hf_cip_seg_safety_time_correction_conn_id, { "Time Correction Connection ID", "cip.safety_segment.time_correction_conn_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6463 { &hf_cip_seg_safety_max_fault_number, { "Max Fault Number", "cip.safety_segment.max_fault_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6464 { &hf_cip_seg_safety_init_timestamp, { "Initial Timestamp", "cip.safety_segment.init_timestamp", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6465 { &hf_cip_seg_safety_init_rollover, { "Initial Rollover Value", "cip.safety_segment.init_rollover", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6466 { &hf_cip_seg_safety_data, { "Safety Data", "cip.safety_segment.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6467 { &hf_cip_class_rev, { "Class Revision", "cip.class.rev", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6468 { &hf_cip_class_max_inst32, { "Max Instance", "cip.class.max_inst", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6469 { &hf_cip_class_num_inst32, { "Number of Instances", "cip.class.num_inst", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6470 { &hf_cip_reserved8, { "Reserved", "cip.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6471 #if 0
6472 { &hf_cip_reserved16, { "Reserved", "cip.reserved", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6473 #endif
6474 { &hf_cip_reserved24, { "Reserved", "cip.reserved", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL }},
6475 { &hf_cip_pad8, { "Pad Byte", "cip.pad", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6477 { &hf_cip_sc_get_attr_list_attr_count, { "Attribute Count", "cip.getlist.attr_count", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6478 { &hf_cip_sc_get_attr_list_attr_item, { "Attribute", "cip.getlist.attr_item", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6479 { &hf_cip_sc_get_attr_list_attr_status, { "General Status", "cip.getlist.attr_status", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_gs_vals_ext, 0, NULL, HFILL }},
6480 { &hf_cip_sc_get_attr_list_attr_data, { "Data", "cip.getlist.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6481 { &hf_cip_sc_set_attr_list_attr_count, { "Attribute Count", "cip.setlist.attr_count", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6482 { &hf_cip_sc_set_attr_list_attr_item, { "Attribute", "cip.setlist.attr_item", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6483 { &hf_cip_sc_set_attr_list_attr_status, { "General Status", "cip.setlist.attr_status", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_gs_vals_ext, 0, NULL, HFILL }},
6484 { &hf_cip_sc_set_attr_list_attr_data, { "Data", "cip.setlist.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6486 { &hf_cip_sc_get_attribute_all_data, { "Data", "cip.getall.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6487 { &hf_cip_sc_set_attribute_all_data, { "Data", "cip.setall.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6488 { &hf_cip_sc_reset_param, { "Reset type", "cip.reset.type", FT_UINT8, BASE_DEC, VALS(cip_reset_type_vals), 0, NULL, HFILL }},
6489 { &hf_cip_sc_reset_data, { "Data", "cip.reset.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6490 { &hf_cip_sc_start_data, { "Data", "cip.start.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6491 { &hf_cip_sc_stop_data, { "Data", "cip.stop.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6492 { &hf_cip_sc_create_instance, { "Instance", "cip.create.instance", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6493 { &hf_cip_sc_create_data, { "Data", "cip.create.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6494 { &hf_cip_sc_mult_serv_pack_num_services, { "Number of Services", "cip.msp.num_services", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6495 { &hf_cip_sc_mult_serv_pack_offset, { "Offset", "cip.msp.offset", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6496 { &hf_cip_sc_mult_serv_pack_num_replies, { "Number of Replies", "cip.msp.num_replies", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6497 { &hf_cip_sc_delete_data, { "Data", "cip.delete.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6498 { &hf_cip_sc_apply_attributes_data, { "Data", "cip.apply_attributes.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6499 { &hf_cip_sc_get_attr_single_data, { "Data", "cip.getsingle.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6500 { &hf_cip_sc_set_attr_single_data, { "Data", "cip.setsingle.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6501 { &hf_cip_find_next_object_max_instance, { "Maximum ID", "cip.find_next_object.max_instance", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6502 { &hf_cip_find_next_object_num_instances, { "Number of Instances:", "cip.find_next_object.num_instances", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6503 { &hf_cip_find_next_object_instance_item, { "Instance", "cip.find_next_object.instance", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6504 { &hf_cip_sc_restore_data, { "Data", "cip.restore.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6505 { &hf_cip_sc_save_data, { "Data", "cip.save.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6506 { &hf_cip_sc_noop_data, { "Data", "cip.noop.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6507 { &hf_cip_sc_get_member_data, { "Data", "cip.getmember.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6508 { &hf_cip_sc_set_member_data, { "Data", "cip.setmember.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6509 { &hf_cip_sc_insert_member_data, { "Data", "cip.insertmember.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6510 { &hf_cip_sc_remove_member_data, { "Data", "cip.removemember.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6511 { &hf_cip_sc_group_sync_is_sync, { "IsSynchronized", "cip.group_sync.data", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6512 { &hf_cip_sc_group_sync_data, { "Data", "cip.group_sync.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6513 { &hf_cip_data, { "Data", "cip.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6515 { &hf_id_vendor_id, { "Vendor ID", "cip.id.vendor_id", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6516 { &hf_id_device_type, { "Device Type", "cip.id.device_type", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6517 { &hf_id_produce_code, { "Product Code", "cip.id.produce_code", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6518 { &hf_id_major_rev, { "Major Revision", "cip.id.major_rev", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6519 { &hf_id_minor_rev, { "Minor Revision", "cip.id.minor_rev", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6520 { &hf_id_status, { "Status", "cip.id.status", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6521 { &hf_id_serial_number, { "Serial Number", "cip.id.serial_number", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6522 { &hf_id_product_name, { "Product Name", "cip.id.product_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
6524 { &hf_msg_rout_num_classes, { "Number of Classes", "cip.mr.num_classes", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6525 { &hf_msg_rout_classes, { "Class", "cip.mr.class", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_class_names_vals_ext, 0, NULL, HFILL }},
6526 { &hf_msg_rout_num_available, { "Number Available", "cip.mr.num_available", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6527 { &hf_msg_rout_num_active, { "Number Active", "cip.mr.num_active", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6528 { &hf_msg_rout_active_connections, { "Active Connection", "cip.mr.active_connections", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6530 { &hf_conn_mgr_open_requests, { "Open Requests", "cip.cm.open_requests", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6531 { &hf_conn_mgr_open_format_rejects, { "Open Format Rejects", "cip.cm.open_format_rejects", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6532 { &hf_conn_mgr_open_resource_rejects, { "Open Resource Rejects", "cip.cm.open_resource_rejects", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6533 { &hf_conn_mgr_other_open_rejects, { "Other Open Rejects", "cip.cm.other_open_rejects", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6534 { &hf_conn_mgr_close_requests, { "Close Requests", "cip.cm.close_requests", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6535 { &hf_conn_close_format_requests, { "Close Format Requests", "cip.cm.close_format_requests", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6536 { &hf_conn_mgr_close_other_requests, { "Close Other Requests", "cip.cm.close_other_requests", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6537 { &hf_conn_mgr_conn_timouts, { "Connection Timeouts", "cip.cm.conn_timouts", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6539 { &hf_time_sync_ptp_enable, { "PTP Enable", "cip.time_sync.ptp_enable", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0, NULL, HFILL }},
6540 { &hf_time_sync_is_synchronized, { "Is Synchronized", "cip.time_sync.is_synchronized", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, NULL, HFILL }},
6541 { &hf_time_sync_sys_time_micro, { "System Time (Microseconds)", "cip.time_sync.sys_time_micro", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6542 { &hf_time_sync_sys_time_nano, { "System Time (Nanoseconds)", "cip.time_sync.sys_time_nano", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6543 { &hf_time_sync_offset_from_master, { "Offset from Master", "cip.time_sync.offset_from_master", FT_INT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6544 { &hf_time_sync_max_offset_from_master, { "Max Offset from Master", "cip.time_sync.max_offset_from_master", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6545 { &hf_time_sync_mean_path_delay_to_master, { "Mean Path Delay To Master", "cip.time_sync.mean_path_delay_to_master", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6546 { &hf_time_sync_gm_clock_clock_id, { "Clock Identity", "cip.time_sync.gm_clock.clock_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6547 { &hf_time_sync_gm_clock_clock_class, { "Clock Class", "cip.time_sync.gm_clock.clock_class", FT_UINT16, BASE_DEC, VALS(cip_time_sync_clock_class_vals), 0, NULL, HFILL }},
6548 { &hf_time_sync_gm_clock_time_accuracy, { "Time Accuracy", "cip.time_sync.gm_clock.time_accuracy", FT_UINT16, BASE_DEC, VALS(cip_time_sync_time_accuracy_vals), 0, NULL, HFILL }},
6549 { &hf_time_sync_gm_clock_offset_scaled_log_variance, { "Offset Scaled Log Variance", "cip.time_sync.gm_clock.offset_scaled_log_variance", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6550 { &hf_time_sync_gm_clock_current_utc_offset, { "Current UTC Offset", "cip.time_sync.gm_clock.current_utc_offset", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6551 { &hf_time_sync_gm_clock_time_property_flags, { "Time Property Flags", "cip.time_sync.gm_clock.time_property_flags", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6552 { &hf_time_sync_gm_clock_time_property_flags_leap61, { "Leap indicator 61", "cip.time_sync.gm_clock.time_property_flags.leap61", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x01, NULL, HFILL }},
6553 { &hf_time_sync_gm_clock_time_property_flags_leap59, { "Leap indicator 59", "cip.time_sync.gm_clock.time_property_flags.leap59", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x02, NULL, HFILL }},
6554 { &hf_time_sync_gm_clock_time_property_flags_current_utc_valid, { "Current UTC Offset Valid", "cip.time_sync.gm_clock.time_property_flags.current_utc_valid", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x04, NULL, HFILL }},
6555 { &hf_time_sync_gm_clock_time_property_flags_ptp_timescale, { "PTP Timescale", "cip.time_sync.gm_clock.time_property_flags.ptp_timescale", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x08, NULL, HFILL }},
6556 { &hf_time_sync_gm_clock_time_property_flags_time_traceable, { "Time traceable", "cip.time_sync.gm_clock.time_property_flags.time_traceable", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x10, NULL, HFILL }},
6557 { &hf_time_sync_gm_clock_time_property_flags_freq_traceable, { "Frequency traceable", "cip.time_sync.gm_clock.time_property_flags.freq_traceable", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x20, NULL, HFILL }},
6558 { &hf_time_sync_gm_clock_time_source, { "Time Source", "cip.time_sync.gm_clock.time_source", FT_UINT16, BASE_DEC, VALS(cip_time_sync_time_source_vals), 0, NULL, HFILL }},
6559 { &hf_time_sync_gm_clock_priority1, { "Priority1", "cip.time_sync.gm_clock.priority1", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6560 { &hf_time_sync_gm_clock_priority2, { "Priority2", "cip.time_sync.gm_clock.priority2", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6561 { &hf_time_sync_parent_clock_clock_id, { "Clock Identity", "cip.time_sync.parent_clock.clock_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6562 { &hf_time_sync_parent_clock_port_number, { "Port Number", "cip.time_sync.parent_clock.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6563 { &hf_time_sync_parent_clock_observed_offset_scaled_log_variance, { "Observed Offset Scaled Log Variance", "cip.time_sync.parent_clock.observed_offset_scaled_log_variance", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6564 { &hf_time_sync_parent_clock_observed_phase_change_rate, { "Observed Phase Change Rate", "cip.time_sync.parent_clock.observed_phase_change_rate", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6565 { &hf_time_sync_local_clock_clock_id, { "Clock Identity", "cip.time_sync.local_clock.clock_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6566 { &hf_time_sync_local_clock_clock_class, { "Clock Class", "cip.time_sync.local_clock.clock_class", FT_UINT16, BASE_DEC, VALS(cip_time_sync_clock_class_vals), 0, NULL, HFILL }},
6567 { &hf_time_sync_local_clock_time_accuracy, { "Time Accuracy", "cip.time_sync.local_clock.time_accuracy", FT_UINT16, BASE_DEC, VALS(cip_time_sync_time_accuracy_vals), 0, NULL, HFILL }},
6568 { &hf_time_sync_local_clock_offset_scaled_log_variance, { "Offset Scaled Log Variance", "cip.time_sync.local_clock.offset_scaled_log_variance", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6569 { &hf_time_sync_local_clock_current_utc_offset, { "Current UTC Offset", "cip.time_sync.local_clock.current_utc_offset", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6570 { &hf_time_sync_local_clock_time_property_flags, { "Time Property Flags", "cip.time_sync.local_clock.time_property_flags", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6571 { &hf_time_sync_local_clock_time_property_flags_leap61, { "Leap indicator 61", "cip.time_sync.local_clock.time_property_flags.leap61", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x01, NULL, HFILL }},
6572 { &hf_time_sync_local_clock_time_property_flags_leap59, { "Leap indicator 59", "cip.time_sync.local_clock.time_property_flags.leap59", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x02, NULL, HFILL }},
6573 { &hf_time_sync_local_clock_time_property_flags_current_utc_valid, { "Current UTC Offset Valid", "cip.time_sync.local_clock.time_property_flags.current_utc_valid", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x04, NULL, HFILL }},
6574 { &hf_time_sync_local_clock_time_property_flags_ptp_timescale, { "PTP Timescale", "cip.time_sync.local_clock.time_property_flags.ptp_timescale", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x08, NULL, HFILL }},
6575 { &hf_time_sync_local_clock_time_property_flags_time_traceable, { "Time traceable", "cip.time_sync.local_clock.time_property_flags.time_traceable", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x10, NULL, HFILL }},
6576 { &hf_time_sync_local_clock_time_property_flags_freq_traceable, { "Frequency traceable", "cip.time_sync.local_clock.time_property_flags.freq_traceable", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x20, NULL, HFILL }},
6577 { &hf_time_sync_local_clock_time_source, { "Time Source", "cip.time_sync.local_clock.time_source", FT_UINT16, BASE_DEC, VALS(cip_time_sync_time_source_vals), 0, NULL, HFILL }},
6578 { &hf_time_sync_num_ports, { "Port Number", "cip.time_sync.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6579 { &hf_time_sync_port_state_info_num_ports, { "Number of Ports", "cip.time_sync.port_state_info.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6580 { &hf_time_sync_port_state_info_port_num, { "Port Number", "cip.time_sync.port_state_info.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6581 { &hf_time_sync_port_state_info_port_state, { "Port State", "cip.time_sync.port_state_info.port_state", FT_UINT16, BASE_DEC, VALS(cip_time_sync_port_state_vals), 0, NULL, HFILL }},
6582 { &hf_time_sync_port_enable_cfg_num_ports, { "Number of Ports", "cip.time_sync.port_enable_cfg.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6583 { &hf_time_sync_port_enable_cfg_port_num, { "Port Number", "cip.time_sync.port_enable_cfg.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6584 { &hf_time_sync_port_enable_cfg_port_enable, { "Port Enable", "cip.time_sync.port_enable_cfg.port_enable", FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), 0, NULL, HFILL }},
6585 { &hf_time_sync_port_log_announce_num_ports, { "Number of Ports", "cip.time_sync.port_log_announce.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6586 { &hf_time_sync_port_log_announce_port_num, { "Port Number", "cip.time_sync.port_log_announce.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6587 { &hf_time_sync_port_log_announce_interval, { "Port Log Announce Interval", "cip.time_sync.port_log_announce.interval", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6588 { &hf_time_sync_port_log_sync_num_ports, { "Number of Ports", "cip.time_sync.port_log_sync.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6589 { &hf_time_sync_port_log_sync_port_num, { "Port Number", "cip.time_sync.port_log_sync.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6590 { &hf_time_sync_port_log_sync_port_log_sync_interval, { "Port Log Sync Interval", "cip.time_sync.port_log_sync.port_log_sync_interval", FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6591 { &hf_time_sync_priority1, { "Priority1", "cip.time_sync.priority1", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6592 { &hf_time_sync_priority2, { "Priority2", "cip.time_sync.priority2", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6593 { &hf_time_sync_domain_number, { "Domain number", "cip.time_sync.domain_number", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6594 { &hf_time_sync_clock_type, { "Clock Type", "cip.time_sync.clock_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6595 { &hf_time_sync_clock_type_ordinary, { "Ordinary Clock", "cip.time_sync.clock_type.ordinary", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0080, NULL, HFILL }},
6596 { &hf_time_sync_clock_type_boundary, { "Boundary Clock", "cip.time_sync.clock_type.boundary", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0040, NULL, HFILL }},
6597 { &hf_time_sync_clock_type_end_to_end, { "End-to-End Transparent Clock", "cip.time_sync.clock_type.end_to_end", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0010, NULL, HFILL }},
6598 { &hf_time_sync_clock_type_management, { "Management Node", "cip.time_sync.clock_type.management", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0008, NULL, HFILL }},
6599 { &hf_time_sync_clock_type_slave_only, { "Slave Only", "cip.time_sync.clock_type.slave_only", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x0100, NULL, HFILL }},
6600 { &hf_time_sync_manufacture_id_oui, { "Manufacture Identity OUI", "cip.time_sync.manufacture_id.oui", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL }},
6601 { &hf_time_sync_manufacture_id_reserved, { "Reserved", "cip.time_sync.manufacture_id.reserved", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6602 { &hf_time_sync_prod_desc_size, { "Product Description Size", "cip.time_sync.prod_desc_size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6603 { &hf_time_sync_prod_desc_str, { "Product Description", "cip.time_sync.prod_desc", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
6604 { &hf_time_sync_revision_data_size, { "Revision Data Size", "cip.time_sync.revision_data_size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6605 { &hf_time_sync_revision_data_str, { "Revision Data", "cip.time_sync.revision_data", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
6606 { &hf_time_sync_user_desc_size, { "User Description Size", "cip.time_sync.user_desc_size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6607 { &hf_time_sync_user_desc_str, { "User Description", "cip.time_sync.user_desc", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
6608 { &hf_time_sync_port_profile_id_info_num_ports, { "Number of Ports", "cip.time_sync.port_profile_id_info.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6609 { &hf_time_sync_port_profile_id_info_port_num, { "Port Number", "cip.time_sync.port_profile_id_info.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6610 { &hf_time_sync_port_profile_id_info_profile_id, { "Port Profile Identity", "cip.time_sync.port_profile_id_info.profile_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6611 { &hf_time_sync_port_phys_addr_info_num_ports, { "Number of Ports", "cip.time_sync.port_phys_addr_info.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6612 { &hf_time_sync_port_phys_addr_info_port_num, { "Port Number", "cip.time_sync.port_phys_addr_info.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6613 { &hf_time_sync_port_phys_addr_info_phys_proto, { "Physical Protocol", "cip.time_sync.port_profile_id_info.phys_proto", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6614 { &hf_time_sync_port_phys_addr_info_addr_size, { "Size of Address", "cip.time_sync.port_phys_addr_info.addr_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6615 #if 0
6616 { &hf_time_sync_port_phys_addr_info_phys_addr, { "Port Physical Address", "cip.time_sync.port_profile_id_info.phys_addr", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6617 #endif
6618 { &hf_time_sync_port_proto_addr_info_num_ports, { "Number of Ports", "cip.time_sync.port_proto_addr_info.num_ports", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6619 { &hf_time_sync_port_proto_addr_info_port_num, { "Port Number", "cip.time_sync.port_proto_addr_info.port_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6620 { &hf_time_sync_port_proto_addr_info_network_proto, { "Network Protocol", "cip.time_sync.port_proto_addr_info.network_proto", FT_UINT16, BASE_DEC, VALS(cip_time_sync_network_protocol_vals), 0, NULL, HFILL }},
6621 { &hf_time_sync_port_proto_addr_info_addr_size, { "Size of Address", "cip.time_sync.port_proto_addr_info.addr_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6622 { &hf_time_sync_port_proto_addr_info_port_proto_addr, { "Port Protocol Address", "cip.time_sync.port_profile_id_info.port_proto_addr", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6623 { &hf_time_sync_steps_removed, { "Steps Removed", "cip.time_sync.steps_removed", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6624 { &hf_time_sync_sys_time_and_offset_time, { "System Time (Microseconds)", "cip.time_sync.sys_time_and_offset.time", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6625 { &hf_time_sync_sys_time_and_offset_offset, { "System Offset (Microseconds)", "cip.time_sync.sys_time_and_offset.offset", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
6628 static hf_register_info hf_cm[] = {
6629 { &hf_cip_cm_sc, { "Service", "cip.cm.sc", FT_UINT8, BASE_HEX, VALS(cip_sc_vals_cm), 0x7F, NULL, HFILL }},
6630 { &hf_cip_cm_genstat, { "General Status", "cip.cm.genstat", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &cip_gs_vals_ext, 0, NULL, HFILL }},
6631 { &hf_cip_cm_addstat_size, { "Additional Status Size", "cip.cm.addstat_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6632 { &hf_cip_cm_ext_status, { "Extended Status", "cip.cm.ext_status", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_cm_ext_st_vals_ext, 0, NULL, HFILL }},
6633 { &hf_cip_cm_add_status, { "Additional Status", "cip.cm.addstat", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6634 { &hf_cip_cm_priority, { "Priority", "cip.cm.priority", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
6635 { &hf_cip_cm_tick_time, { "Tick time", "cip.cm.tick_time", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
6636 { &hf_cip_cm_timeout_tick, { "Time-out ticks", "cip.cm.timeout_tick", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6637 { &hf_cip_cm_timeout, { "Actual Time Out", "cip.cm.timeout", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6638 { &hf_cip_cm_ot_connid, { "O->T Network Connection ID", "cip.cm.ot_connid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6639 { &hf_cip_cm_to_connid, { "T->O Network Connection ID", "cip.cm.to_connid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6640 { &hf_cip_cm_conn_serial_num, { "Connection Serial Number", "cip.cm.conn_serial_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6641 { &hf_cip_cm_vendor, { "Vendor ID", "cip.cm.vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, NULL, HFILL }},
6642 { &hf_cip_cm_timeout_multiplier, { "Connection Timeout Multiplier", "cip.cm.timeout_multiplier", FT_UINT8, BASE_DEC, VALS(cip_con_time_mult_vals), 0, NULL, HFILL }},
6643 { &hf_cip_cm_ot_rpi, { "O->T RPI", "cip.cm.otrpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6644 { &hf_cip_cm_ot_net_params32, { "O->T Network Connection Parameters", "cip.cm.ot_net_params", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6645 { &hf_cip_cm_ot_net_params16, { "O->T Network Connection Parameters", "cip.cm.ot_net_params", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6646 { &hf_cip_cm_to_rpi, { "T->O RPI", "cip.cm.torpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6647 { &hf_cip_cm_to_net_params32, { "T->O Network Connection Parameters", "cip.cm.to_net_params", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6648 { &hf_cip_cm_to_net_params16, { "T->O Network Connection Parameters", "cip.cm.to_net_params", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6649 { &hf_cip_cm_transport_type_trigger, { "Transport Type/Trigger", "cip.cm.transport_type_trigger", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6650 { &hf_cip_cm_conn_path_size, { "Connection Path Size", "cip.cm.connpath_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6651 { &hf_cip_cm_ot_api, { "O->T API", "cip.cm.otapi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6652 { &hf_cip_cm_to_api, { "T->O API", "cip.cm.toapi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6653 { &hf_cip_cm_app_reply_size, { "Application Reply Size", "cip.cm.app_reply_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6654 { &hf_cip_cm_app_reply_data , { "Application Reply", "cip.cm.app_reply_data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6655 { &hf_cip_cm_consumer_number, { "Consumer Number", "cip.cm.consumer_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6656 { &hf_cip_cm_targ_vendor_id, { "Target Vendor ID", "cip.cm.targ_vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, NULL, HFILL }},
6657 { &hf_cip_cm_targ_dev_serial_num, { "Target Device Serial Number", "cip.cm.targ_dev_serial_num", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6658 { &hf_cip_cm_targ_conn_serial_num, { "Target Connection Serial Number", "cip.cm.targ_conn_serial_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6659 { &hf_cip_cm_initial_timestamp, { "Initial Timestamp", "cip.cm.initial_timestamp", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6660 { &hf_cip_cm_initial_rollover, { "Initial Rollover Value", "cip.cm.initial_rollover", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6661 { &hf_cip_cm_remain_path_size, { "Remaining Path Size", "cip.cm.remain_path_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6662 { &hf_cip_cm_msg_req_size, { "Message Request Size", "cip.cm.msg_req_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6663 { &hf_cip_cm_route_path_size, { "Route Path Size", "cip.cm.route_path_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6664 { &hf_cip_cm_orig_serial_num, { "Originator Serial Number", "cip.cm.orig_serial_num", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6665 { &hf_cip_cm_fwo_con_size, { "Connection Size", "cip.cm.fwo.consize", FT_UINT16, BASE_DEC, NULL, 0x01FF, "Fwd Open: Connection size", HFILL }},
6666 { &hf_cip_cm_lfwo_con_size, { "Connection Size", "cip.cm.fwo.consize", FT_UINT32, BASE_DEC, NULL, 0xFFFF, "Large Fwd Open: Connection size", HFILL }},
6667 { &hf_cip_cm_fwo_fixed_var, { "Connection Size Type", "cip.cm.fwo.f_v", FT_UINT16, BASE_DEC, VALS(cip_con_fw_vals), 0x0200, "Fwd Open: Fixed or variable connection size", HFILL }},
6668 { &hf_cip_cm_lfwo_fixed_var, { "Connection Size Type", "cip.cm.fwo.f_v", FT_UINT32, BASE_DEC, VALS(cip_con_fw_vals), 0x02000000, "Large Fwd Open: Fixed or variable connection size", HFILL }},
6669 { &hf_cip_cm_fwo_prio, { "Priority", "cip.cm.fwo.prio", FT_UINT16, BASE_DEC, VALS(cip_con_prio_vals), 0x0C00, "Fwd Open: Connection priority", HFILL }},
6670 { &hf_cip_cm_lfwo_prio, { "Priority", "cip.cm.fwo.prio", FT_UINT32, BASE_DEC, VALS(cip_con_prio_vals), 0x0C000000, "Large Fwd Open: Connection priority", HFILL }},
6671 { &hf_cip_cm_fwo_typ, { "Connection Type", "cip.cm.fwo.type", FT_UINT16, BASE_DEC, VALS(cip_con_type_vals), 0x6000, "Fwd Open: Connection type", HFILL }},
6672 { &hf_cip_cm_lfwo_typ, { "Connection Type", "cip.cm.fwo.type", FT_UINT32, BASE_DEC, VALS(cip_con_type_vals), 0x60000000, "Large Fwd Open: Connection type", HFILL }},
6673 { &hf_cip_cm_fwo_own, { "Owner", "cip.cm.fwo.owner", FT_UINT16, BASE_DEC, VALS(cip_con_owner_vals), 0x8000, "Fwd Open: Redundant owner bit", HFILL }},
6674 { &hf_cip_cm_lfwo_own, { "Owner", "cip.cm.fwo.owner", FT_UINT32, BASE_DEC, VALS(cip_con_owner_vals), 0x80000000, "Large Fwd Open: Redundant owner bit", HFILL }},
6675 { &hf_cip_cm_fwo_dir, { "Direction", "cip.cm.fwo.dir", FT_UINT8, BASE_DEC, VALS(cip_con_dir_vals), CI_PRODUCTION_DIR_MASK, "Fwd Open: Direction", HFILL }},
6676 { &hf_cip_cm_fwo_trigg, { "Trigger", "cip.cm.fwo.trigger", FT_UINT8, BASE_DEC, VALS(cip_con_trigg_vals), CI_PRODUCTION_TRIGGER_MASK, "Fwd Open: Production trigger", HFILL }},
6677 { &hf_cip_cm_fwo_class, { "Class", "cip.cm.fwo.transport", FT_UINT8, BASE_DEC, VALS(cip_con_class_vals), CI_TRANSPORT_CLASS_MASK, "Fwd Open: Transport Class", HFILL }},
6678 { &hf_cip_cm_gco_conn, { "Number of Connections", "cip.cm.gco.conn", FT_UINT8, BASE_DEC, NULL, 0, "GetConnOwner: Number of Connections", HFILL }},
6679 { &hf_cip_cm_gco_coo_conn, { "COO Connections", "cip.cm.gco.coo_conn", FT_UINT8, BASE_DEC, NULL, 0, "GetConnOwner: COO Connections", HFILL }},
6680 { &hf_cip_cm_gco_roo_conn, { "ROO Connections", "cip.cm.gco.roo_conn", FT_UINT8, BASE_DEC, NULL, 0, "GetConnOwner: ROO Connections", HFILL }},
6681 { &hf_cip_cm_gco_last_action, { "Last Action", "cip.cm.gco.la", FT_UINT8, BASE_DEC, VALS(cip_con_last_action_vals), 0, "GetConnOwner: Last Action", HFILL }},
6682 { &hf_cip_cm_ext112_ot_rpi_type, { "Trigger", "cip.cm.ext112otrpi_type", FT_UINT8, BASE_DEC, VALS(cip_cm_rpi_type_vals), 0, NULL, HFILL }},
6683 { &hf_cip_cm_ext112_to_rpi_type, { "Trigger", "cip.cm.ext112torpi_type", FT_UINT8, BASE_DEC, VALS(cip_cm_rpi_type_vals), 0, NULL, HFILL }},
6684 { &hf_cip_cm_ext112_ot_rpi, { "Acceptable O->T RPI", "cip.cm.ext112otrpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6685 { &hf_cip_cm_ext112_to_rpi, { "Acceptable T->O RPI", "cip.cm.ext112torpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6686 { &hf_cip_cm_ext126_size, { "Maximum Size", "cip.cm.ext126_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6687 { &hf_cip_cm_ext127_size, { "Maximum Size", "cip.cm.ext127_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6688 { &hf_cip_cm_ext128_size, { "Maximum Size", "cip.cm.ext128_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}
6691 static hf_register_info hf_mb[] = {
6692 { &hf_cip_mb_sc, { "Service", "cip.mb.sc", FT_UINT8, BASE_HEX, VALS(cip_sc_vals_mb), 0x7F, NULL, HFILL }},
6693 { &hf_cip_mb_read_coils_start_addr, { "Starting Address", "cip.mb.read_coils.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6694 { &hf_cip_mb_read_coils_num_coils, { "Quantity of Coils", "cip.mb.read_coils.num_coils", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6695 { &hf_cip_mb_read_coils_data, { "Data", "cip.mb.read_coils.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6696 { &hf_cip_mb_read_discrete_inputs_start_addr, { "Starting Address", "cip.mb.read_discrete_inputs.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6697 { &hf_cip_mb_read_discrete_inputs_num_inputs, { "Quantity of Inputs", "cip.mb.read_discrete_inputs.num_inputs", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6698 { &hf_cip_mb_read_discrete_inputs_data, { "Data", "cip.mb.read_discrete_inputs.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6699 { &hf_cip_mb_read_holding_register_start_addr, { "Starting Address", "cip.mb.read_holding_register.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6700 { &hf_cip_mb_read_holding_register_num_registers, { "Quantity of Holding Registers", "cip.mb.read_holding_register.num_registers", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6701 { &hf_cip_mb_read_holding_register_data, { "Data", "cip.mb.read_holding_register.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6702 { &hf_cip_mb_read_input_register_start_addr, { "Starting Address", "cip.mb.read_input_register.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6703 { &hf_cip_mb_read_input_register_num_registers, { "Quantity of Input Registers", "cip.mb.read_input_register.num_registers", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6704 { &hf_cip_mb_read_input_register_data, { "Data", "cip.mb.read_input_register.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6705 { &hf_cip_mb_write_coils_start_addr, { "Starting Address", "cip.mb.write_coils.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6706 { &hf_cip_mb_write_coils_outputs_forced, { "Outputs Forced", "cip.mb.write_coils.outputs_forced", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6707 { &hf_cip_mb_write_coils_num_coils, { "Quantity of Coils", "cip.mb.write_coils.num_coils", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6708 { &hf_cip_mb_write_coils_data, { "Data", "cip.mb.write_coils.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6709 { &hf_cip_mb_write_registers_start_addr, { "Starting Address", "cip.mb.write_registers.start_addr", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6710 { &hf_cip_mb_write_registers_outputs_forced, { "Outputs Forced", "cip.mb.write_registers.outputs_forced", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6711 { &hf_cip_mb_write_registers_num_registers, { "Quantity of Holding Registers", "cip.mb.write_registers.num_registers", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6712 { &hf_cip_mb_write_registers_data, { "Data", "cip.mb.write_registers.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6713 { &hf_cip_mb_data, { "Data", "cip.mb.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}
6716 static hf_register_info hf_cco[] = {
6717 { &hf_cip_cco_sc, { "Service", "cip.cco.sc", FT_UINT8, BASE_HEX, VALS(cip_sc_vals_cco), 0x7F, NULL, HFILL }},
6718 { &hf_cip_cco_format_number, { "Format Number", "cip.cco.format_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6719 { &hf_cip_cco_edit_signature, { "Edit Signature", "cip.cco.edit_signature", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6720 { &hf_cip_cco_con_flags, { "Connection Flags", "cip.cco.connflags", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6721 { &hf_cip_cco_con_type, { "Connection O_T", "cip.cco.con", FT_UINT16, BASE_DEC, VALS(cip_con_vals), 0x001, NULL, HFILL }},
6722 { &hf_cip_cco_ot_rtf, { "O->T real time transfer format", "cip.cco.otrtf", FT_UINT16, BASE_DEC, VALS(cip_con_rtf_vals), 0x000E, NULL, HFILL }},
6723 { &hf_cip_cco_to_rtf, { "T->O real time transfer format", "cip.cco.tortf", FT_UINT16, BASE_DEC, VALS(cip_con_rtf_vals), 0x0070, NULL, HFILL }},
6724 { &hf_cip_cco_tdi_vendor, { "Vendor ID", "cip.cco.tdi.vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, NULL, HFILL }},
6725 { &hf_cip_cco_tdi_devtype, { "Device Type", "cip.cco.tdi.devtype", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &cip_devtype_vals_ext, 0, NULL, HFILL }},
6726 { &hf_cip_cco_tdi_prodcode, { "Product Code", "cip.cco.tdi.product_code", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6727 { &hf_cip_cco_tdi_compatibility, { "Compatibility", "cip.cco.tdi.compatibility", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6728 { &hf_cip_cco_tdi_comp_bit, { "Compatibility", "cip.cco.tdi.comp_bit", FT_UINT8, BASE_HEX, VALS(cip_com_bit_vals), 0x80, NULL, HFILL }},
6729 { &hf_cip_cco_tdi_majorrev, { "Major Revision", "cip.cco.tdi.major_rev", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
6730 { &hf_cip_cco_tdi_minorrev, { "Minor Revision", "cip.cco.tdi.minor_rev", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6731 { &hf_cip_cco_pdi_vendor, { "Vendor ID", "cip.cco.pdi.vendor", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_vendor_vals_ext, 0, NULL, HFILL }},
6732 { &hf_cip_cco_pdi_devtype, { "Device Type", "cip.cco.pdi.devtype", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &cip_devtype_vals_ext, 0, NULL, HFILL }},
6733 { &hf_cip_cco_pdi_prodcode, { "Product Code", "cip.cco.pdi.product_code", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6734 { &hf_cip_cco_pdi_compatibility, { "Compatibility", "cip.cco.pdi.compatibility", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6735 { &hf_cip_cco_pdi_comp_bit, { "Compatibility", "cip.cco.pdi.comp_bit", FT_UINT8, BASE_HEX, VALS(cip_com_bit_vals), 0x80, NULL, HFILL }},
6736 { &hf_cip_cco_pdi_majorrev, { "Major Revision", "cip.cco.pdi.major_rev", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
6737 { &hf_cip_cco_pdi_minorrev, { "Minor Revision", "cip.cco.pdi.minor_rev", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6738 { &hf_cip_cco_cs_data_index, { "CS Data Index Number", "cip.cco.cs_data_index", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6739 { &hf_cip_cco_timeout_multiplier, { "Connection Timeout Multiplier", "cip.cco.timeout_multiplier", FT_UINT8, BASE_DEC, VALS(cip_con_time_mult_vals), 0, NULL, HFILL }},
6740 { &hf_cip_cco_ot_rpi, { "O->T RPI", "cip.cco.otrpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6741 { &hf_cip_cco_ot_net_param32, { "O->T Network Connection Parameters", "cip.cco.ot_net_params", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6742 { &hf_cip_cco_ot_net_param16, { "O->T Network Connection Parameters", "cip.cco.ot_net_params", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6743 { &hf_cip_cco_to_rpi, { "T->O RPI", "cip.cco.torpi", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6744 { &hf_cip_cco_to_net_param16, { "T->O Network Connection Parameters", "cip.cco.to_net_params", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
6745 { &hf_cip_cco_to_net_param32, { "T->O Network Connection Parameters", "cip.cco.to_net_params", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
6746 { &hf_cip_cco_transport_type_trigger, { "Transport Type/Trigger", "cip.cco.transport_type_trigger", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
6747 { &hf_cip_cco_fwo_con_size, { "Connection Size", "cip.cco.consize", FT_UINT16, BASE_DEC, NULL, 0x01FF, NULL, HFILL }},
6748 { &hf_cip_cco_lfwo_con_size, { "Connection Size", "cip.cco.consize", FT_UINT32, BASE_DEC, NULL, 0xFFFF, NULL, HFILL }},
6749 { &hf_cip_cco_fwo_fixed_var, { "Connection Size Type", "cip.cco.f_v", FT_UINT16, BASE_DEC, VALS(cip_con_fw_vals), 0x0200, NULL, HFILL }},
6750 { &hf_cip_cco_lfwo_fixed_var, { "Connection Size Type", "cip.cco.f_v", FT_UINT32, BASE_DEC, VALS(cip_con_fw_vals), 0x02000000, NULL, HFILL }},
6751 { &hf_cip_cco_fwo_prio, { "Priority", "cip.cco.prio", FT_UINT16, BASE_DEC, VALS(cip_con_prio_vals), 0x0C00, NULL, HFILL }},
6752 { &hf_cip_cco_lfwo_prio, { "Priority", "cip.cco.prio", FT_UINT32, BASE_DEC, VALS(cip_con_prio_vals), 0x0C000000, NULL, HFILL }},
6753 { &hf_cip_cco_fwo_typ, { "Connection Type", "cip.cco.type", FT_UINT16, BASE_DEC, VALS(cip_con_type_vals), 0x6000, NULL, HFILL }},
6754 { &hf_cip_cco_lfwo_typ, { "Connection Type", "cip.cco.type", FT_UINT32, BASE_DEC, VALS(cip_con_type_vals), 0x60000000, NULL, HFILL }},
6755 { &hf_cip_cco_fwo_own, { "Owner", "cip.cco.owner", FT_UINT16, BASE_DEC, VALS(cip_con_owner_vals), 0x8000, NULL, HFILL }},
6756 { &hf_cip_cco_lfwo_own, { "Owner", "cip.cco.owner", FT_UINT32, BASE_DEC, VALS(cip_con_owner_vals), 0x80000000, NULL, HFILL }},
6757 { &hf_cip_cco_fwo_dir, { "Direction", "cip.cco.dir", FT_UINT8, BASE_DEC, VALS(cip_con_dir_vals), CI_PRODUCTION_DIR_MASK, NULL, HFILL }},
6758 { &hf_cip_cco_fwo_trigger, { "Trigger", "cip.cco.trigger", FT_UINT8, BASE_DEC, VALS(cip_con_trigg_vals), CI_PRODUCTION_TRIGGER_MASK, NULL, HFILL }},
6759 { &hf_cip_cco_fwo_class, { "Class", "cip.cco.transport", FT_UINT8, BASE_DEC, VALS(cip_con_class_vals), CI_TRANSPORT_CLASS_MASK, NULL, HFILL }},
6760 { &hf_cip_cco_conn_path_size, { "Connection Path Size", "cip.cco.connpath_size", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6761 { &hf_cip_cco_proxy_config_size, { "Proxy Config Data Size", "cip.cco.proxy_config_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6762 { &hf_cip_cco_target_config_size, { "Target Config Data Size", "cip.cco.proxy_config_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6763 { &hf_cip_cco_iomap_format_number, { "Format number", "cip.cco.iomap_format_number", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6764 { &hf_cip_cco_iomap_size, { "Attribute size", "cip.cco.iomap_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
6765 { &hf_cip_cco_connection_disable, { "Connection Disable", "cip.cco.connection_disable", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
6766 { &hf_cip_cco_net_conn_param_attr, { "Net Connection Parameter Attribute Selection", "cip.cco.net_conn_param_attr", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
6767 { &hf_cip_cco_proxy_config_data, { "Proxy Config Data", "cip.cco.proxy_config_data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6768 { &hf_cip_cco_target_config_data, { "Target Config Data", "cip.cco.target_config_data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6769 { &hf_cip_cco_iomap_attribute, { "Attribute Data", "cip.cco.iomap", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6770 { &hf_cip_cco_safety, { "Safety Parameters", "cip.cco.safety", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
6771 { &hf_cip_cco_change_type, { "Change Type", "cip.cco.change_type", FT_UINT16, BASE_DEC, cip_cco_change_type_vals, 0, NULL, HFILL }},
6774 /* Setup protocol subtree array */
6775 static gint *ett[] = {
6776 &ett_cip_class_generic,
6777 &ett_cip,
6778 &ett_path,
6779 &ett_path_seg,
6780 &ett_ekey_path,
6781 &ett_rrsc,
6782 &ett_mcsc,
6783 &ett_cia_path,
6784 &ett_data_seg,
6785 &ett_data_seg_data,
6786 &ett_cmd_data,
6787 &ett_port_path,
6788 &ett_network_seg,
6789 &ett_network_seg_safety,
6790 &ett_network_seg_safety_time_correction_net_params,
6791 &ett_cip_seg_safety_tunid,
6792 &ett_cip_seg_safety_tunid_ssn,
6793 &ett_cip_seg_safety_ounid,
6794 &ett_cip_seg_safety_ounid_ssn,
6795 &ett_status_item,
6796 &ett_add_status_item,
6797 &ett_cip_get_attribute_list,
6798 &ett_cip_get_attribute_list_item,
6799 &ett_cip_set_attribute_list,
6800 &ett_cip_set_attribute_list_item,
6801 &ett_cip_mult_service_packet,
6802 &ett_time_sync_gm_clock_flags,
6803 &ett_time_sync_local_clock_flags,
6804 &ett_time_sync_port_state_info,
6805 &ett_time_sync_port_enable_cfg,
6806 &ett_time_sync_port_log_announce,
6807 &ett_time_sync_port_log_sync,
6808 &ett_time_sync_clock_type,
6809 &ett_time_sync_port_profile_id_info,
6810 &ett_time_sync_port_phys_addr_info,
6811 &ett_time_sync_port_proto_addr_info,
6814 static gint *ett_cm[] = {
6815 &ett_cip_class_cm,
6816 &ett_cm_rrsc,
6817 &ett_cm_mes_req,
6818 &ett_cm_ncp,
6819 &ett_cm_cmd_data,
6820 &ett_cm_ttt,
6821 &ett_cm_add_status_item,
6822 &ett_cip_cm_pid,
6823 &ett_cip_cm_safety
6826 static gint *ett_mb[] = {
6827 &ett_cip_class_mb,
6828 &ett_mb_rrsc,
6829 &ett_mb_cmd_data
6832 static gint *ett_cco[] = {
6833 &ett_cip_class_cco,
6834 &ett_cco_iomap,
6835 &ett_cco_con_status,
6836 &ett_cco_con_flag,
6837 &ett_cco_tdi,
6838 &ett_cco_pdi,
6839 &ett_cco_ncp,
6840 &ett_cco_rrsc,
6841 &ett_cco_cmd_data,
6842 &ett_cco_ttt,
6845 static ei_register_info ei[] = {
6846 { &ei_mal_identity_revision, { "cip.malformed.id.revision", PI_MALFORMED, PI_ERROR, "Malformed Identity revision", EXPFILL }},
6847 { &ei_mal_msg_rout_num_classes, { "cip.malformed.msg_rout.num_classes", PI_MALFORMED, PI_ERROR, "Malformed Message Router Attribute 1", EXPFILL }},
6848 { &ei_mal_time_sync_gm_clock, { "cip.malformed.time_sync.gm_clock", PI_MALFORMED, PI_ERROR, "Malformed Grandmaster clock info", EXPFILL }},
6849 { &ei_mal_time_sync_parent_clock, { "cip.malformed.time_sync.parent_clock", PI_MALFORMED, PI_ERROR, "Malformed Parent clock info", EXPFILL }},
6850 { &ei_mal_time_sync_local_clock, { "cip.malformed.time_sync.local_clock", PI_MALFORMED, PI_ERROR, "Malformed Local clock info", EXPFILL }},
6851 { &ei_mal_time_sync_port_state_info, { "cip.malformed.time_sync.port_state_info", PI_MALFORMED, PI_ERROR, "Malformed Port State Info", EXPFILL }},
6852 { &ei_mal_time_sync_port_state_info_ports, { "cip.malformed.time_sync.port_state_info.ports", PI_MALFORMED, PI_ERROR, "Malformed Port State Info - too many ports", EXPFILL }},
6853 { &ei_mal_time_sync_port_enable_cfg, { "cip.malformed.time_sync.port_enable_cfg", PI_MALFORMED, PI_ERROR, "Malformed Port Enable Cfg", EXPFILL }},
6854 { &ei_mal_time_sync_port_enable_cfg_ports, { "cip.malformed.time_sync.port_enable_cfg.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Enable Cfg - too many ports", EXPFILL }},
6855 { &ei_mal_time_sync_port_log_announce, { "cip.malformed.time_sync.port_log_announce", PI_MALFORMED, PI_ERROR, "Malformed Port Log Announcement Interval Cfg", EXPFILL }},
6856 { &ei_mal_time_sync_port_log_announce_ports, { "cip.malformed.time_sync.port_log_announce.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Log Announcement Interval Cfg - too many ports", EXPFILL }},
6857 { &ei_mal_time_sync_port_log_sync, { "cip.malformed.time_sync.port_log_sync", PI_MALFORMED, PI_ERROR, "Malformed Port Log Sync Interval Cfg", EXPFILL }},
6858 { &ei_mal_time_sync_port_log_sync_ports, { "cip.malformed.time_sync.port_log_sync.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Log Sync Interval Cfg - too many ports", EXPFILL }},
6859 { &ei_mal_time_sync_clock_type, { "cip.malformed.time_sync.clock_type", PI_MALFORMED, PI_ERROR, "Malformed Clock Type", EXPFILL }},
6860 { &ei_mal_time_sync_manufacture_id, { "cip.malformed.time_sync.manufacture_id", PI_MALFORMED, PI_ERROR, "Malformed Manufacture Identity", EXPFILL }},
6861 { &ei_mal_time_sync_prod_desc, { "cip.malformed.time_sync.prod_desc", PI_MALFORMED, PI_ERROR, "Malformed Product Description", EXPFILL }},
6862 { &ei_mal_time_sync_prod_desc_64, { "cip.malformed.time_sync.prod_desc.limit_64", PI_PROTOCOL, PI_WARN, "Product Description limited to 64 characters", EXPFILL }},
6863 { &ei_mal_time_sync_prod_desc_size, { "cip.malformed.time_sync.prod_desc.size", PI_MALFORMED, PI_ERROR, "Malformed Product Description - invalid size", EXPFILL }},
6864 { &ei_mal_time_sync_revision_data, { "cip.malformed.time_sync.revision_data", PI_MALFORMED, PI_ERROR, "Malformed Revision Data", EXPFILL }},
6865 { &ei_mal_time_sync_revision_data_32, { "cip.malformed.time_sync.revision_data.limit_32", PI_PROTOCOL, PI_WARN, "Revision Data limited to 32 characters", EXPFILL }},
6866 { &ei_mal_time_sync_revision_data_size, { "cip.malformed.time_sync.revision_data.size", PI_MALFORMED, PI_ERROR, "Malformed Revision Data - invalid size", EXPFILL }},
6867 { &ei_mal_time_sync_user_desc, { "cip.malformed.time_sync.user_desc", PI_MALFORMED, PI_ERROR, "Malformed User Description", EXPFILL }},
6868 { &ei_mal_time_sync_user_desc_128, { "cip.malformed.time_sync.user_desc.limit_128", PI_PROTOCOL, PI_WARN, "User Description limited to 128 characters", EXPFILL }},
6869 { &ei_mal_time_sync_user_desc_size, { "cip.malformed.time_sync.user_desc.size", PI_MALFORMED, PI_ERROR, "Malformed User Description - invalid size", EXPFILL }},
6870 { &ei_mal_time_sync_port_profile_id_info, { "cip.malformed.time_sync.port_profile_id_info", PI_MALFORMED, PI_ERROR, "Malformed Port Profile Identity Info", EXPFILL }},
6871 { &ei_mal_time_sync_port_profile_id_info_ports, { "cip.malformed.time_sync.port_profile_id_info.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Profile Identity Info - too many ports", EXPFILL }},
6872 { &ei_mal_time_sync_port_phys_addr_info, { "cip.malformed.time_sync.port_phys_addr_info", PI_MALFORMED, PI_ERROR, "Malformed Port Physical Address Info", EXPFILL }},
6873 { &ei_mal_time_sync_port_phys_addr_info_ports, { "cip.malformed.time_sync.port_phys_addr_info.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Physical Address Info - too many ports", EXPFILL }},
6874 { &ei_mal_time_sync_port_proto_addr_info, { "cip.malformed.time_sync.port_proto_addr_info", PI_MALFORMED, PI_ERROR, "Malformed Port Protocol Address Info", EXPFILL }},
6875 { &ei_mal_time_sync_port_proto_addr_info_ports, { "cip.malformed.time_sync.port_proto_addr_info.ports", PI_MALFORMED, PI_ERROR, "Malformed Port Protocol Address Info - too many ports", EXPFILL }},
6876 { &ei_mal_time_sync_sys_time_and_offset, { "cip.malformed.time_sync.sys_time_and_offset", PI_MALFORMED, PI_ERROR, "Malformed System Time and Offset", EXPFILL }},
6877 { &ei_proto_log_seg_format, { "cip.unsupported.log_seg_format", PI_PROTOCOL, PI_WARN, "Unsupported Logical Segment Format", EXPFILL }},
6878 { &ei_mal_incomplete_epath, { "cip.malformed.incomplete_epath", PI_MALFORMED, PI_ERROR, "Incomplete EPATH", EXPFILL }},
6879 { &ei_proto_electronic_key_format, { "cip.unsupported.electronic_key_format", PI_PROTOCOL, PI_WARN, "Unsupported Electronic Key Format", EXPFILL }},
6880 { &ei_proto_special_segment_format, { "cip.unsupported.special_segment_format", PI_PROTOCOL, PI_WARN, "Unsupported Special Segment Format", EXPFILL }},
6881 { &ei_proto_log_seg_type, { "cip.unsupported.log_seg_type", PI_PROTOCOL, PI_WARN, "Unsupported Logical Segment Type", EXPFILL }},
6882 { &ei_proto_log_sub_seg_type, { "cip.unsupported.log_sub_seg_type", PI_PROTOCOL, PI_WARN, "Unsupported Sub-Segment Type", EXPFILL }},
6883 { &ei_proto_seg_type, { "cip.unsupported.seg_type", PI_PROTOCOL, PI_WARN, "Unsupported Segment Type", EXPFILL }},
6884 { &ei_proto_unsupported_datatype, { "cip.unsupported.datatype", PI_PROTOCOL, PI_WARN, "Unsupported Datatype", EXPFILL }},
6885 { &ei_mal_serv_gal, { "cip.malformed.get_attribute_list", PI_MALFORMED, PI_ERROR, "Malformed Get Attribute List service", EXPFILL }},
6886 { &ei_mal_serv_gal_count, { "cip.malformed.get_attribute_list.count", PI_MALFORMED, PI_ERROR, "Malformed Get Attribute List attribute list count greater than packet size", EXPFILL }},
6887 { &ei_mal_serv_sal, { "cip.malformed.set_attribute_list", PI_MALFORMED, PI_ERROR, "Malformed Set Attribute List service", EXPFILL }},
6888 { &ei_mal_serv_sal_count, { "cip.malformed.set_attribute_list.count", PI_MALFORMED, PI_ERROR, "Malformed Set Attribute List attribute list count greater than packet size", EXPFILL }},
6889 { &ei_mal_msp_services, { "cip.malformed.msp.services", PI_MALFORMED, PI_WARN, "Multiple Service Packet too many services for packet", EXPFILL }},
6890 { &ei_mal_msp_inv_offset, { "cip.malformed.msp.inv_offset", PI_MALFORMED, PI_WARN, "Multiple Service Packet service invalid offset", EXPFILL }},
6891 { &ei_mal_msp_missing_services, { "cip.malformed.msp.missing_services", PI_MALFORMED, PI_ERROR, "Multiple Service Packet service missing Number of Services field", EXPFILL }},
6892 { &ei_mal_msp_resp_offset, { "cip.malformed.msp.resp_offset", PI_MALFORMED, PI_ERROR, "Multiple Service Packet service too many response offsets for packet size", EXPFILL }},
6893 { &ei_mal_serv_find_next_object, { "cip.malformed.find_next_object", PI_MALFORMED, PI_ERROR, "Find Next Object service missing Number of List Members field", EXPFILL }},
6894 { &ei_mal_serv_find_next_object_count, { "cip.malformed.find_next_object.count", PI_MALFORMED, PI_ERROR, "Find Next Object instance list count greater than packet size", EXPFILL }},
6895 { &ei_mal_rpi_no_data, { "cip.malformed.rpi_no_data", PI_MALFORMED, PI_WARN, "RPI not acceptable - missing extended data", EXPFILL }},
6896 { &ei_mal_inv_config_size, { "cip.malformed.inv_config_size", PI_MALFORMED, PI_WARN, "Invalid configuration size - missing size field", EXPFILL }},
6897 { &ei_mal_ot_size, { "cip.malformed.ot_size", PI_MALFORMED, PI_WARN, "Invalid O->T size - missing size field", EXPFILL }},
6898 { &ei_mal_to_size, { "cip.malformed.to_size", PI_MALFORMED, PI_WARN, "Invalid T->O size - missing size field", EXPFILL }},
6901 expert_module_t* expert_cip;
6903 /* Register the protocol name and description */
6904 proto_cip = proto_register_protocol("Common Industrial Protocol",
6905 "CIP", "cip");
6907 /* Required function calls to register the header fields and subtrees used */
6908 proto_register_field_array(proto_cip, hf, array_length(hf));
6909 proto_register_subtree_array(ett, array_length(ett));
6911 expert_cip = expert_register_protocol(proto_cip);
6912 expert_register_field_array(expert_cip, ei, array_length(ei));
6914 subdissector_class_table = register_dissector_table("cip.class.iface",
6915 "CIP Class Interface Handle", FT_UINT32, BASE_HEX);
6916 subdissector_symbol_table = register_dissector_table("cip.data_segment.iface",
6917 "CIP Data Segment Interface Handle", FT_UINT32, BASE_HEX);
6919 /* Register the protocol name and description */
6920 proto_cip_class_generic = proto_register_protocol("CIP Class Generic",
6921 "CIPCLS", "cipcls");
6923 /* Register the protocol name and description */
6924 proto_cip_class_cm = proto_register_protocol("CIP Connection Manager",
6925 "CIPCM", "cipcm");
6926 proto_register_field_array(proto_cip_class_cm, hf_cm, array_length(hf_cm));
6927 proto_register_subtree_array(ett_cm, array_length(ett_cm));
6929 proto_cip_class_mb = proto_register_protocol("CIP Modbus Object",
6930 "CIPMB", "cipmb");
6931 proto_register_field_array(proto_cip_class_mb, hf_mb, array_length(hf_mb));
6932 proto_register_subtree_array(ett_mb, array_length(ett_mb));
6934 proto_cip_class_cco = proto_register_protocol("CIP Connection Configuration Object",
6935 "CIPCCO", "cipcco");
6936 proto_register_field_array(proto_cip_class_cco, hf_cco, array_length(hf_cco));
6937 proto_register_subtree_array(ett_cco, array_length(ett_cco));
6939 /* Register a heuristic dissector on the service of the message so objects
6940 * can override the dissector for common services */
6941 register_heur_dissector_list("cip.sc", &heur_subdissector_service);
6943 } /* end of proto_register_cip() */
6946 void
6947 proto_reg_handoff_cip(void)
6949 dissector_handle_t cip_handle;
6950 dissector_handle_t cip_class_mb_handle;
6952 /* Create dissector handles */
6953 /* Register for UCMM CIP data, using EtherNet/IP SendRRData service*/
6954 /* Register for Connected CIP data, using EtherNet/IP SendUnitData service*/
6955 cip_handle = new_create_dissector_handle( dissect_cip, proto_cip );
6956 dissector_add_uint( "enip.srrd.iface", ENIP_CIP_INTERFACE, cip_handle );
6957 dissector_add_uint( "enip.sud.iface", ENIP_CIP_INTERFACE, cip_handle );
6959 /* Create and register dissector handle for generic class */
6960 cip_class_generic_handle = new_create_dissector_handle( dissect_cip_class_generic, proto_cip_class_generic );
6961 dissector_add_uint( "cip.class.iface", 0, cip_class_generic_handle );
6963 /* Create and register dissector handle for Connection Manager */
6964 cip_class_cm_handle = new_create_dissector_handle( dissect_cip_class_cm, proto_cip_class_cm );
6965 dissector_add_uint( "cip.class.iface", CI_CLS_CM, cip_class_cm_handle );
6967 /* Create and register dissector handle for Modbus Object */
6968 cip_class_mb_handle = new_create_dissector_handle( dissect_cip_class_mb, proto_cip_class_mb );
6969 dissector_add_uint( "cip.class.iface", CI_CLS_MB, cip_class_mb_handle );
6970 modbus_handle = find_dissector("modbus");
6972 /* Create and register dissector handle for Connection Configuration Object */
6973 cip_class_cco_handle = new_create_dissector_handle( dissect_cip_class_cco, proto_cip_class_cco );
6974 dissector_add_uint( "cip.class.iface", CI_CLS_CCO, cip_class_cco_handle );
6975 heur_dissector_add("cip.sc", dissect_class_cco_heur, proto_cip_class_cco);
6977 proto_enip = proto_get_id_by_filter_name( "enip" );
6978 proto_modbus = proto_get_id_by_filter_name( "modbus" );
6980 } /* end of proto_reg_handoff_cip() */
6984 * Editor modelines
6986 * Local Variables:
6987 * c-basic-offset: 3
6988 * tab-width: 8
6989 * indent-tabs-mode: nil
6990 * End:
6992 * ex: set shiftwidth=3 tabstop=8 expandtab:
6993 * :indentSize=3:tabSize=8:noTabs=true: