2 * Routines for OMRON FINS UDP dissection
3 * Copyright Sourcefire, Inc. 2008-2009, Matthew Watchinski <mwatchinski@sourcefire.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * Reference for OMRON-FINS W227_E1_02_FINS_Command_Reference_Manual
12 * Hopefully google will find it for you.
14 * Special thanks to the guys who wrote the README.developer its great.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
39 #include <epan/packet.h>
40 #include <epan/prefs.h>
41 #include <epan/expert.h>
43 #define OMRON_FINS_UDP_PORT 9600
45 static int proto_omron_fins = -1;
46 static gint ett_omron = -1;
47 static gint ett_omron_header = -1;
48 static gint ett_omron_icf_fields = -1;
49 static gint ett_omron_command_data = -1;
50 static gint ett_area_data = -1;
51 static gint ett_cpu_bus = -1;
52 static gint ett_io_data = -1;
53 static gint ett_pc_status_fields = -1;
54 static gint ett_fatal_fields = -1;
55 static gint ett_non_fatal_fields = -1;
56 static gint ett_message_fields = -1;
57 static gint ett_omron_error_log_data = -1;
58 static gint ett_omron_disk_data = -1;
59 static gint ett_omron_file_data = -1;
60 static gint ett_omron_data_type = -1;
61 static gint ett_omron_block_record = -1;
62 static gint ett_omron_status_block = -1;
63 static gint ett_omron_cyclic_fields = -1;
64 static gint ett_omron_netw_nodes_sts = -1;
65 static gint ett_omron_netw_node_sts = -1;
66 static gint ett_omron_netw_nodes_non_fatal_err_sts = -1;
67 static gint ett_omron_netw_nodes_cyclic_err_ctrs = -1;
68 static gint ett_omron_data_link_status_tree = -1;
71 static gboolean gPREF_HEX = FALSE;
74 /* Omron-FINS Header fields */
75 static int hf_omron_icf = -1;
77 static int hf_omron_icf_gwb = -1; /* Gateway usage (0: don't use; 1: use) should be 1 */
78 static int hf_omron_icf_dtb = -1; /* Data type (0: command 1: response) */
79 static int hf_omron_icf_rb0 = -1; /* Reserved should be 0 */
80 static int hf_omron_icf_rb1 = -1; /* Reserved should be 0 */
81 static int hf_omron_icf_rb2 = -1; /* Reserved should be 0 */
82 static int hf_omron_icf_rb3 = -1; /* Reserved should be 0 */
83 static int hf_omron_icf_rb4 = -1; /* Reserved should be 0 */
84 static int hf_omron_icf_rsb = -1; /* Response setting (0: response required; 1: response not required) */
86 static int hf_omron_rsv = -1;
87 static int hf_omron_gct = -1;
88 static int hf_omron_dna = -1;
89 static int hf_omron_da1 = -1;
90 static int hf_omron_da2 = -1;
91 static int hf_omron_sna = -1;
92 static int hf_omron_sa1 = -1;
93 static int hf_omron_sa2 = -1;
94 static int hf_omron_sid = -1;
96 static int hf_omron_command = -1;
97 static int hf_omron_command_data = -1;
98 static int hf_omron_command_memory_area_code = -1;
99 static int hf_omron_response_code = -1;
101 static int hf_omron_address = -1;
102 static int hf_omron_address_bits = -1;
103 static int hf_omron_num_items = -1;
105 static int hf_omron_response_data = -1;
106 static int hf_omron_parameter_area_code = -1;
108 static int hf_omron_beginning_word = -1;
109 static int hf_omron_num_words = -1;
111 static int hf_omron_program_number = -1;
112 static int hf_omron_protect_code = -1;
113 static int hf_omron_begin_word = -1;
114 static int hf_omron_last_word = -1;
115 static int hf_omron_password = -1;
117 static int hf_omron_clear_code = -1;
118 static int hf_omron_mode_code = -1;
119 static int hf_omron_monitor_label = -1;
121 static int hf_omron_controller_model = -1;
122 static int hf_omron_controller_version = -1;
123 static int hf_omron_for_system_use = -1;
125 static int hf_omron_program_area_size = -1;
126 static int hf_omron_iom_size = -1;
127 static int hf_omron_num_dm_words = -1;
128 static int hf_omron_timer_counter_size = -1;
129 static int hf_omron_expansion_dm_size = -1;
130 static int hf_omron_num_step_transitions = -1;
131 static int hf_omron_kind_memory_card = -1;
132 static int hf_omron_memory_card_size = -1;
134 static int hf_omron_cpu_bus_unit_0 = -1;
135 static int hf_omron_cpu_bus_unit_1 = -1;
136 static int hf_omron_cpu_bus_unit_2 = -1;
137 static int hf_omron_cpu_bus_unit_3 = -1;
138 static int hf_omron_cpu_bus_unit_4 = -1;
139 static int hf_omron_cpu_bus_unit_5 = -1;
140 static int hf_omron_cpu_bus_unit_6 = -1;
141 static int hf_omron_cpu_bus_unit_7 = -1;
142 static int hf_omron_cpu_bus_unit_8 = -1;
143 static int hf_omron_cpu_bus_unit_9 = -1;
144 static int hf_omron_cpu_bus_unit_10 = -1;
145 static int hf_omron_cpu_bus_unit_11 = -1;
146 static int hf_omron_cpu_bus_unit_12 = -1;
147 static int hf_omron_cpu_bus_unit_13 = -1;
148 static int hf_omron_cpu_bus_unit_14 = -1;
149 static int hf_omron_cpu_bus_unit_15 = -1;
150 static int hf_omron_cpu_bus_reserved = -1;
152 static int hf_omron_io_data_num_sysmac_1 = -1;
153 static int hf_omron_io_data_num_sysmac_2 = -1;
155 static int hf_omron_pc_status = -1;
156 static int hf_omron_pc_status_pdc = -1;
157 static int hf_omron_pc_status_hi = -1;
158 static int hf_omron_pc_status_r1 = -1;
159 static int hf_omron_pc_status_r2 = -1;
160 static int hf_omron_pc_status_rack_num = -1;
162 static int hf_omron_unit_address = -1;
163 static int hf_omron_num_units = -1;
164 static int hf_omron_model_number = -1;
166 static int hf_omron_status = -1;
167 static int hf_omron_fatal_error_data = -1;
168 static int hf_omron_fatal_fals_error = -1;
169 static int hf_omron_fatal_sfc_error = -1;
170 static int hf_omron_fatal_cycle_time_over = -1;
171 static int hf_omron_fatal_program_error = -1;
172 static int hf_omron_fatal_io_setting_error = -1;
173 static int hf_omron_fatal_io_point_overflow = -1;
174 static int hf_omron_fatal_cpu_bus_error = -1;
175 static int hf_omron_fatal_duplication_error = -1;
176 static int hf_omron_fatal_io_bus_error = -1;
177 static int hf_omron_fatal_memory_error = -1;
178 static int hf_omron_fatal_rv_1 = -1;
179 static int hf_omron_fatal_rv_2 = -1;
180 static int hf_omron_fatal_rv_3 = -1;
181 static int hf_omron_fatal_rv_4 = -1;
182 static int hf_omron_fatal_rv_5 = -1;
183 static int hf_omron_fatal_watch_dog_timer_error = -1;
185 static int hf_omron_non_fatal_error_data = -1;
186 static int hf_omron_non_fatal_rv1 = -1;
187 static int hf_omron_non_fatal_rv2 = -1;
188 static int hf_omron_non_fatal_power_interruption = -1;
189 static int hf_omron_non_fatal_cpu_bus_unit_setting_error = -1;
190 static int hf_omron_non_fatal_battery_error = -1;
191 static int hf_omron_non_fatal_sysmac_bus_error = -1;
192 static int hf_omron_non_fatal_sysmac_bus2_error = -1;
193 static int hf_omron_non_fatal_cpu_bus_unit_error = -1;
194 static int hf_omron_non_fatal_rv3 = -1;
195 static int hf_omron_non_fatal_io_verification_error = -1;
196 static int hf_omron_non_fatal_rv4 = -1;
197 static int hf_omron_non_fatal_sfc_error = -1;
198 static int hf_omron_non_fatal_indirect_dm_error = -1;
199 static int hf_omron_non_fatal_jmp_error = -1;
200 static int hf_omron_non_fatal_rv5 = -1;
201 static int hf_omron_non_fatal_fal_error = -1;
203 static int hf_omron_message = -1;
204 static int hf_omron_message_no_0 = -1;
205 static int hf_omron_message_no_1 = -1;
206 static int hf_omron_message_no_2 = -1;
207 static int hf_omron_message_no_3 = -1;
208 static int hf_omron_message_no_4 = -1;
209 static int hf_omron_message_no_5 = -1;
210 static int hf_omron_message_no_6 = -1;
211 static int hf_omron_message_no_7 = -1;
212 static int hf_omron_message_rv_0 = -1;
213 static int hf_omron_message_rv_1 = -1;
214 static int hf_omron_message_rv_2 = -1;
215 static int hf_omron_message_rv_3 = -1;
216 static int hf_omron_message_rv_4 = -1;
217 static int hf_omron_message_rv_5 = -1;
218 static int hf_omron_message_rv_6 = -1;
219 static int hf_omron_message_rv_7 = -1;
221 static int hf_omron_fals = -1;
222 static int hf_omron_error_message = -1;
224 static int hf_omron_parameter = -1;
225 static int hf_omron_avg_cycle_time = -1;
226 static int hf_omron_max_cycle_time = -1;
227 static int hf_omron_min_cycle_time = -1;
229 static int hf_omron_year = -1;
230 static int hf_omron_month = -1;
231 static int hf_omron_date = -1;
232 static int hf_omron_hour = -1;
233 static int hf_omron_minute = -1;
234 static int hf_omron_second = -1;
235 static int hf_omron_day = -1;
237 static int hf_omron_read_message = -1;
239 static int hf_omron_node_number = -1;
240 static int hf_omron_network_address = -1;
242 static int hf_omron_error_reset_fals_no = -1;
244 static int hf_omron_beginning_record_no = -1;
245 static int hf_omron_no_of_records = -1;
246 static int hf_omron_max_no_of_stored_records = -1;
247 static int hf_omron_no_of_stored_records = -1;
249 static int hf_omron_disk_no = -1;
250 static int hf_omron_beginning_file_position = -1;
251 static int hf_omron_no_of_files = -1;
253 static int hf_omron_volume_label = -1;
254 static int hf_omron_date_year = -1;
255 static int hf_omron_date_month = -1;
256 static int hf_omron_date_day = -1;
257 static int hf_omron_date_hour = -1;
258 static int hf_omron_date_minute = -1;
259 static int hf_omron_date_second = -1;
260 static int hf_omron_total_capacity = -1;
261 static int hf_omron_unused_capacity = -1;
262 static int hf_omron_total_no_files = -1;
263 static int hf_omron_no_files = -1;
264 static int hf_omron_filename = -1;
265 static int hf_omron_file_capacity = -1;
267 static int hf_omron_file_position = -1;
268 static int hf_omron_data_length = -1;
269 static int hf_omron_file_data = -1;
270 static int hf_omron_file_parameter_code = -1;
272 static int hf_omron_volume_parameter_code = -1;
273 static int hf_omron_transfer_parameter_code = -1;
275 static int hf_omron_transfer_beginning_address = -1;
276 static int hf_omron_number_of_bytes = -1;
278 static int hf_omron_number_of_bits_flags = -1;
279 static int hf_omron_set_reset_specification = -1;
280 static int hf_omron_bit_flag = -1;
282 static int hf_omron_data = -1;
284 static int hf_omron_beginning_block_num = -1;
285 static int hf_omron_num_blocks = -1;
286 static int hf_omron_num_blocks_remaining = -1;
287 static int hf_omron_total_num_blocks = -1;
288 static int hf_omron_type = -1;
289 static int hf_omron_data_type = -1;
290 static int hf_omron_data_type_type = -1;
291 static int hf_omron_data_type_rv = -1;
292 static int hf_omron_data_type_protected = -1;
293 static int hf_omron_data_type_end = -1;
294 static int hf_omron_control_data = -1;
296 static int hf_omron_block_num = -1;
297 static int hf_omron_num_unit_uint16 = -1;
299 static int hf_omron_fixed = -1;
300 static int hf_omron_intelligent_id_no = -1;
301 static int hf_omron_first_word = -1;
302 static int hf_omron_read_len = -1;
303 static int hf_omron_no_of_link_nodes = -1;
304 static int hf_omron_block_record_node_num_status = -1;
305 static int hf_omron_block_record_node_num_num_nodes = -1;
306 static int hf_omron_block_record_cio_area = -1;
307 static int hf_omron_block_record_kind_of_dm = -1;
308 static int hf_omron_block_record_dm_area_first_word = -1;
309 static int hf_omron_block_record_no_of_total_words = -1;
311 static int hf_omron_status_flags = -1;
312 static int hf_omron_status_flags_slave_master = -1;
313 static int hf_omron_status_flags_data_link = -1;
314 static int hf_omron_master_node_number = -1;
315 static int hf_omron_status_node_0 = -1;
316 static int hf_omron_status_node_1 = -1;
317 static int hf_omron_status_node_2 = -1;
318 static int hf_omron_status_node_3 = -1;
319 static int hf_omron_status_node_4 = -1;
320 static int hf_omron_status_node_5 = -1;
321 static int hf_omron_status_node_6 = -1;
322 static int hf_omron_status_node_7 = -1;
323 static int hf_omron_status_1_node_0 = -1;
324 static int hf_omron_status_1_node_1 = -1;
325 static int hf_omron_status_1_node_2 = -1;
326 static int hf_omron_status_1_node_3 = -1;
327 static int hf_omron_status_1_node_4 = -1;
328 static int hf_omron_status_1_node_5 = -1;
329 static int hf_omron_status_1_node_6 = -1;
330 static int hf_omron_status_1_node_7 = -1;
331 static int hf_omron_status_2_node_0 = -1;
332 static int hf_omron_status_2_node_1 = -1;
333 static int hf_omron_status_2_node_2 = -1;
334 static int hf_omron_status_2_node_3 = -1;
335 static int hf_omron_status_2_node_4 = -1;
336 static int hf_omron_status_2_node_5 = -1;
337 static int hf_omron_status_2_node_6 = -1;
338 static int hf_omron_status_2_node_7 = -1;
340 static int hf_omron_name_data = -1;
342 static int hf_omron_num_receptions = -1;
344 static int hf_omron_netw_node_sts_low_0 = -1;
345 static int hf_omron_netw_node_sts_low_1 = -1;
346 static int hf_omron_netw_node_sts_low_2 = -1;
347 static int hf_omron_netw_node_sts_low_3 = -1;
348 static int hf_omron_netw_node_sts_high_0 = -1;
349 static int hf_omron_netw_node_sts_high_1 = -1;
350 static int hf_omron_netw_node_sts_high_2 = -1;
351 static int hf_omron_netw_node_sts_high_3 = -1;
352 static int hf_omron_com_cycle_time = -1;
353 static int hf_omron_polling_unit_node_num = -1;
354 static int hf_omron_cyclic_operation = -1;
355 static int hf_omron_cyclic_trans_status = -1;
357 static int hf_omron_cyclic_label_1 = -1;
358 static int hf_omron_cyclic_7 = -1;
359 static int hf_omron_cyclic_6 = -1;
360 static int hf_omron_cyclic_5 = -1;
361 static int hf_omron_cyclic_4 = -1;
362 static int hf_omron_cyclic_3 = -1;
363 static int hf_omron_cyclic_2 = -1;
364 static int hf_omron_cyclic_1 = -1;
365 static int hf_omron_cyclic_label_2 = -1;
366 static int hf_omron_cyclic_15 = -1;
367 static int hf_omron_cyclic_14 = -1;
368 static int hf_omron_cyclic_13 = -1;
369 static int hf_omron_cyclic_12 = -1;
370 static int hf_omron_cyclic_11 = -1;
371 static int hf_omron_cyclic_10 = -1;
372 static int hf_omron_cyclic_9 = -1;
373 static int hf_omron_cyclic_8 = -1;
374 static int hf_omron_cyclic_label_3 = -1;
375 static int hf_omron_cyclic_23 = -1;
376 static int hf_omron_cyclic_22 = -1;
377 static int hf_omron_cyclic_21 = -1;
378 static int hf_omron_cyclic_20 = -1;
379 static int hf_omron_cyclic_19 = -1;
380 static int hf_omron_cyclic_18 = -1;
381 static int hf_omron_cyclic_17 = -1;
382 static int hf_omron_cyclic_16 = -1;
383 static int hf_omron_cyclic_label_4 = -1;
384 static int hf_omron_cyclic_31 = -1;
385 static int hf_omron_cyclic_30 = -1;
386 static int hf_omron_cyclic_29 = -1;
387 static int hf_omron_cyclic_28 = -1;
388 static int hf_omron_cyclic_27 = -1;
389 static int hf_omron_cyclic_26 = -1;
390 static int hf_omron_cyclic_25 = -1;
391 static int hf_omron_cyclic_24 = -1;
392 static int hf_omron_cyclic_label_5 = -1;
393 static int hf_omron_cyclic_39 = -1;
394 static int hf_omron_cyclic_38 = -1;
395 static int hf_omron_cyclic_37 = -1;
396 static int hf_omron_cyclic_36 = -1;
397 static int hf_omron_cyclic_35 = -1;
398 static int hf_omron_cyclic_34 = -1;
399 static int hf_omron_cyclic_33 = -1;
400 static int hf_omron_cyclic_32 = -1;
401 static int hf_omron_cyclic_label_6 = -1;
402 static int hf_omron_cyclic_47 = -1;
403 static int hf_omron_cyclic_46 = -1;
404 static int hf_omron_cyclic_45 = -1;
405 static int hf_omron_cyclic_44 = -1;
406 static int hf_omron_cyclic_43 = -1;
407 static int hf_omron_cyclic_42 = -1;
408 static int hf_omron_cyclic_41 = -1;
409 static int hf_omron_cyclic_40 = -1;
410 static int hf_omron_cyclic_label_7 = -1;
411 static int hf_omron_cyclic_55 = -1;
412 static int hf_omron_cyclic_54 = -1;
413 static int hf_omron_cyclic_53 = -1;
414 static int hf_omron_cyclic_52 = -1;
415 static int hf_omron_cyclic_51 = -1;
416 static int hf_omron_cyclic_50 = -1;
417 static int hf_omron_cyclic_49 = -1;
418 static int hf_omron_cyclic_48 = -1;
419 static int hf_omron_cyclic_label_8 = -1;
420 static int hf_omron_cyclic_62 = -1;
421 static int hf_omron_cyclic_61 = -1;
422 static int hf_omron_cyclic_60 = -1;
423 static int hf_omron_cyclic_59 = -1;
424 static int hf_omron_cyclic_58 = -1;
425 static int hf_omron_cyclic_57 = -1;
426 static int hf_omron_cyclic_56 = -1;
427 static int hf_omron_node_error_count = -1;
432 #define ICF_GW_MASK 0x80
433 #define ICF_GW_DUSE 0x00
434 #define ICF_GW_USE 0x01
436 #define ICF_DTB_MASK 0x40
437 #define ICF_DTB_CMD 0x00
438 #define ICF_DTB_RESP 0x01
440 #define ICF_RB0_MASK 0x20
441 #define ICF_RB1_MASK 0x10
442 #define ICF_RB2_MASK 0x08
443 #define ICF_RB3_MASK 0x04
444 #define ICF_RB4_MASK 0x02
446 #define ICF_RSB_MASK 0x01
447 #define ICF_RSB_DUSE 0x00
448 #define ICF_RSB_USE 0x01
450 #define INT_DNA_MIN1 0x00
451 #define INT_DNA_MAX1 0x00
452 #define INT_DNA_MIN2 0x01
453 #define INT_DNA_MAX2 0x7F
455 #define INT_DA1_MIN1 0x00
456 #define INT_DA1_MAX1 0x3E
457 #define INT_DA1_MIN2 0x3F
458 #define INT_DA1_MAX2 0x7E
459 #define INT_DA1_MIN3 0xFF
460 #define INT_DA1_MAX3 0xFF
462 #define INT_DA2_MIN1 0x00
463 #define INT_DA2_MAX1 0x00
464 #define INT_DA2_MIN2 0xFE
465 #define INT_DA2_MAX2 0xFE
466 #define INT_DA2_MIN3 0x10
467 #define INT_DA2_MAX3 0x1F
469 #define INT_SNA_MIN1 0x00
470 #define INT_SNA_MAX1 0x00
471 #define INT_SNA_MIN2 0x01
472 #define INT_SNA_MAX2 0x7F
474 #define INT_SA1_MIN1 0x00
475 #define INT_SA1_MAX1 0x3E
476 #define INT_SA1_MIN2 0x3F
477 #define INT_SA1_MAX2 0x7E
478 #define INT_SA1_MIN3 0xFF
479 #define INT_SA1_MAX3 0xFF
481 #define INT_SA2_MIN1 0x00
482 #define INT_SA2_MAX1 0x00
483 #define INT_SA2_MIN2 0xFE
484 #define INT_SA2_MAX2 0xFE
485 #define INT_SA2_MIN3 0x10
486 #define INT_SA2_MAX3 0x1F
489 /* Constants used for display */
490 static const value_string icf_gw_vals[] = {
491 { ICF_GW_DUSE, "Don't use Gateway" },
492 { ICF_GW_USE, "Use Gateway" },
495 static const value_string icf_dtb_vals[] = {
496 { ICF_DTB_CMD, "Command" },
497 { ICF_DTB_RESP, "Response" },
500 static const value_string icf_rsb_vals[] = {
501 { ICF_RSB_DUSE, "Response Required" },
502 { ICF_RSB_USE, "Response Not Required" },
505 static const range_string omron_dna_range[] = {
506 { INT_DNA_MIN1, INT_DNA_MAX1, "Local network" },
507 { INT_DNA_MIN2, INT_DNA_MAX2, "Remote network" },
510 static const range_string omron_da1_range[] = {
511 { INT_DA1_MIN1, INT_DA1_MAX1, "SYSMAC NET / LINK" },
512 { INT_DA1_MIN2, INT_DA1_MAX2, "SYSMAC NET" },
513 { INT_DA1_MIN3, INT_DA1_MAX3, "Broadcast" },
516 static const range_string omron_da2_range[] = {
517 { INT_DA2_MIN1, INT_DA2_MAX1, "PC (CPU)" },
518 { INT_DA2_MIN2, INT_DA2_MAX2, "SYSMAC NET or LINK Unit connected to network" },
519 { INT_DA2_MIN3, INT_DA2_MAX3, "CPU BUS Unit" },
522 static const range_string omron_sna_range[] = {
523 { INT_SNA_MIN1, INT_SNA_MAX1, "Local network" },
524 { INT_SNA_MIN2, INT_SNA_MAX2, "Remote network" },
527 static const range_string omron_sa1_range[] = {
528 { INT_SA1_MIN1, INT_SA1_MAX1, "SYSMAC NET / LINK" },
529 { INT_SA1_MIN2, INT_SA1_MAX2, "SYSMAC NET" },
530 { INT_SA1_MIN3, INT_SA1_MAX3, "Broadcast" },
533 static const range_string omron_sa2_range[] = {
534 { INT_SA2_MIN1, INT_SA2_MAX1, "PC (CPU)" },
535 { INT_SA2_MIN2, INT_SA2_MAX2, "SYSMAC NET or LINK Unit connected to network" },
536 { INT_SA2_MIN3, INT_SA2_MAX3, "CPU BUS Unit" },
539 static const range_string omron_error_reset_range[] = {
540 { 0xFFFE, 0xFFFE, "Present error cleared" },
541 { 0x0002, 0x0002, "Power interruption error" },
542 { 0x00A0, 0x00A7, "SYSMAC BUS error" },
543 { 0x00B0, 0x00B3, "SYSMAC BUS/2 error" },
544 { 0x00E7, 0x00E7, "I/O verification error" },
545 { 0x00F4, 0x00F4, "Non-fatal SFC error" },
546 { 0x00F7, 0x00F7, "Batter error" },
547 { 0x00F8, 0x00F8, "Indirect DM error" },
548 { 0x00F9, 0x00F9, "JMP error" },
549 { 0x0200, 0x0215, "CPU Bus Unit error" },
550 { 0x0400, 0x0415, "CPU Bus Unit setting error" },
551 { 0x4101, 0x42FF, "FALL (006) executed in user program" },
552 { 0xFFFF, 0xFFFF, "All errors cleared" },
553 { 0x809F, 0x809F, "Cycle time too long" },
554 { 0x80C0, 0x80C7, "I/O bus error" },
555 { 0x80E0, 0x80E0, "I/O setting error" },
556 { 0x80E1, 0x80E1, "I/O points overflow" },
557 { 0x80E9, 0x80E9, "Duplication error" },
558 { 0x80F0, 0x80F0, "Program error" },
559 { 0x80F1, 0x80F1, "Memory error" },
560 { 0x80F3, 0x80F3, "Fatal SFC error" },
561 { 0x80FF, 0x80FF, "System error" },
562 { 0x8100, 0x8115, "CPU bus error" },
563 { 0xC101, 0xC2FF, "FALS(007) executed" },
567 static const value_string command_code_cv[] = {
568 { 0x0101, "Memory Area Read" },
569 { 0x0102, "Memory Area Write" },
570 { 0x0103, "Memory Area Fill" },
571 { 0x0104, "Multiple Memory Area Read" },
572 { 0x0105, "Memory Area Transfer" },
573 { 0x0201, "Parameter Area Read" },
574 { 0x0202, "Parameter Area Write" },
575 { 0x0203, "Parameter Area Clear" },
576 { 0x0220, "Data Link Table Read" },
577 { 0x0221, "Data Link Table Write" },
578 { 0x0304, "Program Area Protect" },
579 { 0x0305, "Program Area Protect Clear" },
580 { 0x0306, "Program Area Read" },
581 { 0x0307, "Program Area Write" },
582 { 0x0308, "Program Area Clear" },
586 { 0x0501, "Controller Data Read" },
587 { 0x0502, "Connection Data Read" },
588 { 0x0601, "Controller Status Read" },
589 { 0x0602, "Network Status Read" },
590 { 0x0603, "Data Link Status Read" },
591 { 0x0620, "Cycle Time Read" },
592 { 0x0701, "Clock Read" },
593 { 0x0702, "Clock Write" },
594 { 0x0801, "LOOP-BACK Test" },
595 { 0x0802, "Broadcast Test Results Read" },
596 { 0x0803, "Broadcast Test Data Send" },
597 { 0x0920, "Message Read | Message Clear | FAL/FALS Read" },
598 { 0x0C01, "Access Right Acquire" },
599 { 0x0C02, "Access Right Forced Acquire" },
600 { 0x0C03, "Access Right Release" },
601 { 0x2101, "Error Clear" },
602 { 0x2102, "Error Log Read" },
603 { 0x2103, "Error Log Clear" },
604 { 0x2201, "File Name Read" },
605 { 0x2202, "Single File Read" },
606 { 0x2203, "Single File Write" },
607 { 0x2204, "Memory Card Format" },
608 { 0x2205, "File Delete" },
609 { 0x2206, "Volume Label Create/Delete" },
610 { 0x2207, "File Copy" },
611 { 0x2208, "File Name Change" },
612 { 0x2209, "File Data Check" },
613 { 0x220A, "Memory Area File Transfer" },
614 { 0x220B, "Parameter Area File Transfer" },
615 { 0x220C, "Program Area File Transfer" },
616 { 0x220F, "File Memory Index Read" },
617 { 0x2210, "File Memory Read" },
618 { 0x2211, "File Memory Write" },
619 { 0x2301, "Forced Set/Reset" },
620 { 0x2302, "Forced Set/Reset Cancel" },
621 { 0x230A, "Multiple Forced Status Read" },
622 { 0x2601, "Name Set" },
623 { 0x2602, "Name Delete" },
624 { 0x2603, "Name Read" },
627 static const value_string memory_area_code_cv[] = {
628 { 0x00, "CIO, TR, CPU Bus Link, and Auxiliary : Bit status" },
629 { 0x40, "CIO, TR, CPU Bus Link, and Auxiliary : Bit status (with forced status)" },
630 { 0x80, "CIO, TR, CPU Bus Link, and Auxiliary : Word contents" },
631 { 0xC0, "CIO, TR, CPU Bus Link, and Auxiliary : Word contents (with forced status)" },
632 { 0x01, "Timer/Counter : Completion Flag status" },
633 { 0x41, "Timer/Counter : Completion Flag status (with forced status)" },
634 { 0x81, "Timer/Counter : PV" },
635 { 0x82, "DM : Word contents" },
636 { 0x03, "Transition : Flag status" },
637 { 0x43, "Transition : Flag status (with forced status)" },
638 { 0x04, "Step : Flag status" },
639 { 0x44, "Step : Status" },
640 { 0x84, "Step : Step timer PV" },
641 { 0x05, "Forced status : Bit status" },
642 { 0x85, "Forced status : Word contents" },
643 { 0x90, "Expansion DM : Word contents, specified bank" },
644 { 0x91, "Expansion DM : Word contents, specified bank" },
645 { 0x92, "Expansion DM : Word contents, specified bank" },
646 { 0x93, "Expansion DM : Word contents, specified bank" },
647 { 0x94, "Expansion DM : Word contents, specified bank" },
648 { 0x95, "Expansion DM : Word contents, specified bank" },
649 { 0x96, "Expansion DM : Word contents, specified bank" },
650 { 0x97, "Expansion DM : Word contents, specified bank" },
651 { 0x98, "Expansion DM : Word contents, current bank" },
652 { 0x9C, "Register : Register contents / Current bank no. of expansion DM" },
653 { 0x1B, "Action : Flag status" },
654 { 0xDD, "Interrupt status : Scheduled interrupt interval" },
657 static const value_string response_codes[] = {
658 { 0x0000, "Normal completion" },
659 { 0x0001, "Service was interrupted" },
660 { 0x0101, "Local node not part of Network" },
661 { 0x0102, "Token time-out, node number to large" },
662 { 0x0103, "Number of transmit retries exceeded" },
663 { 0x0104, "Maximum number of frames exceeded" },
664 { 0x0105, "Node number setting error (range)" },
665 { 0x0106, "Node number duplication error" },
666 { 0x0201, "Destination node not part of Network" },
667 { 0x0202, "No node with the specified node number" },
668 { 0x0203, "Third node not part of Network : Broadcasting was specified" },
669 { 0x0204, "Busy error, destination node busy" },
670 { 0x0205, "Response time-out" },
671 { 0x0301, "Error occurred : ERC indicator is lit" },
672 { 0x0302, "CPU error occurred in the PC at the destination node" },
673 { 0x0303, "A controller error has prevented a normal response" },
674 { 0x0304, "Node number setting error" },
675 { 0x0401, "An undefined command has been used" },
676 { 0x0402, "Cannot process command because the specified unit model or version is wrong" },
677 { 0x0501, "Destination node number is not set in the routing table" },
678 { 0x0502, "Routing table isn't registered" },
679 { 0x0503, "Routing table error" },
680 { 0x0504, "Max relay nodes (2) was exceeded" },
681 { 0x1001, "The command is longer than the max permissible length" },
682 { 0x1002, "The command is shorter than the min permissible length" },
683 { 0x1003, "The designated number od data items differs from the actual number" },
684 { 0x1004, "An incorrect command format has been used" },
685 { 0x1005, "An incorrect header has been used" },
686 { 0x1101, "Memory area code invalid or DM is not available" },
687 { 0x1102, "Access size is wrong in command" },
688 { 0x1103, "First address in inaccessible area" },
689 { 0x1104, "The end of specified word range exceeds acceptable range" },
690 { 0x1106, "A non-existent program number" },
691 { 0x1109, "The size of data items in command block are wrong" },
692 { 0x110A, "The IOM break function cannot be executed" },
693 { 0x110B, "The response block is longer than the max length" },
694 { 0x110C, "An incorrect parameter code has been specified" },
695 { 0x2002, "The data is protected" },
696 { 0x2003, "Registered table does not exist" },
697 { 0x2004, "Search data does not exist" },
698 { 0x2005, "Non-existent program number" },
699 { 0x2006, "Non-existent file" },
700 { 0x2007, "Verification error" },
701 { 0x2101, "Specified area is read-only" },
702 { 0x2102, "The data is protected" },
703 { 0x2103, "Too many files open" },
704 { 0x2105, "Non-existent program number" },
705 { 0x2106, "Non-existent file" },
706 { 0x2107, "File already exists" },
707 { 0x2108, "Data cannot be changed" },
708 { 0x2201, "The mode is wrong (executing)" },
709 { 0x2202, "The mode is wrong (stopped)" },
710 { 0x2203, "The PC is in the PROGRAM mode" },
711 { 0x2204, "The PC is in the DEBUG mode" },
712 { 0x2205, "The PC is in the MONITOR mode" },
713 { 0x2206, "The PC is in the RUN mode" },
714 { 0x2207, "The specified node is not the control node" },
715 { 0x2208, "The mode is wrong and the step cannot be executed" },
716 { 0x2301, "The file device does not exist where specified" },
717 { 0x2302, "The specified memory does not exist" },
718 { 0x2303, "No clock exists" },
719 { 0x2401, "Data link table is incorrect" },
720 { 0x2502, "Parity / checksum error occurred" },
721 { 0x2503, "I/O setting error" },
722 { 0x2504, "Too many I/O points" },
723 { 0x2505, "CPU bus error" },
724 { 0x2506, "I/O duplication error" },
725 { 0x2507, "I/O bus error" },
726 { 0x2509, "SYSMAC BUS/2 error" },
727 { 0x250A, "Special I/O Unit error" },
728 { 0x250D, "Duplication in SYSMAC BUS word allocation" },
729 { 0x250F, "A memmory error has occurred" },
730 { 0x2510, "Terminator not connected in SYSMAC BUS system" },
731 { 0x2601, "The specified area is not protected" },
732 { 0x2602, "An incorrect password has been specified" },
733 { 0x2604, "The specified area is protected" },
734 { 0x2605, "The service is being executed" },
735 { 0x2606, "The service is not being executed" },
736 { 0x2607, "Service cannot be execute from local node" },
737 { 0x2608, "Service cannot be executed settings are incorrect" },
738 { 0x2609, "Service cannot be executed incorrect settings in command data" },
739 { 0x260A, "The specified action has already been registered" },
740 { 0x260B, "Cannot clear error, error still exists" },
741 { 0x3001, "The access right is held by another device" },
742 { 0x4001, "Command aborted with ABORT command" },
745 static const value_string parameter_area_codes[] = {
746 { 0x8010, "PC Setup" },
747 { 0x8011, "Peripheral Device settings" },
748 { 0x8012, "I/O table" },
749 { 0x8013, "Routing tables" },
750 { 0x8002, "CPU Bus Unit settings" },
753 static const value_string mode_codes[] = {
754 { 0x00, "PROGRAM mode" },
755 { 0x01, "DEBUG mode" },
756 { 0x02, "MONITOR mode" },
757 { 0x04, "RUN mode" },
760 static const value_string status_codes[] = {
763 { 0x80, "CPU on standby" },
766 static const value_string memory_card_codes[] = {
767 { 0x00, "No memory card" },
773 static const value_string parameter_codes[] = {
774 { 0x00, "Initializes the cycle time." },
775 { 0x01, "Read the cycle time" },
778 static const value_string omron_days[] = {
788 static const value_string omron_file_parameter_codes[] = {
789 { 0x0000, "Write new file, do not overwrite" },
790 { 0x0001, "Write new file, overwrite" },
791 { 0x0002, "Appened to file " },
792 { 0x0003, "Overwite file" },
795 static const value_string omron_volume_parameter_codes[] = {
796 { 0x0000, "Create new volume label, do not overwrite" },
797 { 0x0001, "Create new volume label, overwrite" },
798 { 0x0002, "Delete existing volume label" },
801 static const value_string omron_transfer_parameter_codes[] = {
802 { 0x0000, "Data transfer from the PC memory area to the file device" },
803 { 0x0001, "Data transfer from the file device to the PC emory area" },
804 { 0x0002, "Data compared" },
807 static const value_string omron_set_reset_specifications[] = {
808 { 0x0000, "Force-reset (OFF)" },
809 { 0x0001, "Force-set (ON)" },
810 { 0x8000, "Forced status released and bit turned OFF (0)" },
811 { 0x8001, "Forced status released and bit turned ON (1)" },
812 { 0xFFFF, "Forced status released" },
815 static const value_string omron_type_codes[] = {
817 { 0x01, "First half RAM; second half ROM" },
820 static const value_string omron_data_type_bits[] = {
822 { 0x01, "I/O data" },
823 { 0x02, "User program" },
824 { 0x03, "Comments" },
827 static const value_string omron_cyclic_ops_codes[] = {
832 static const value_string omron_cyclic_trans_codes[] = {
833 { 0x00, "No transmission" },
834 { 0x01, "Transmission" },
837 static const int *omron_icf_fields[] = {
849 static const int *pc_status_fields[] = {
850 &hf_omron_pc_status_pdc,
851 &hf_omron_pc_status_hi,
852 &hf_omron_pc_status_r1,
853 &hf_omron_pc_status_r2,
854 &hf_omron_pc_status_rack_num,
858 static const int *fatal_error_fields[] = {
859 &hf_omron_fatal_fals_error,
860 &hf_omron_fatal_sfc_error,
861 &hf_omron_fatal_cycle_time_over,
862 &hf_omron_fatal_program_error,
863 &hf_omron_fatal_io_setting_error,
864 &hf_omron_fatal_io_point_overflow,
865 &hf_omron_fatal_cpu_bus_error,
866 &hf_omron_fatal_duplication_error,
867 &hf_omron_fatal_io_bus_error,
868 &hf_omron_fatal_memory_error,
869 &hf_omron_fatal_rv_1,
870 &hf_omron_fatal_rv_2,
871 &hf_omron_fatal_rv_3,
872 &hf_omron_fatal_rv_4,
873 &hf_omron_fatal_rv_5,
874 &hf_omron_fatal_watch_dog_timer_error,
878 static const int *non_fatal_error_fields[] = {
879 &hf_omron_non_fatal_rv1,
880 &hf_omron_non_fatal_rv2,
881 &hf_omron_non_fatal_power_interruption,
882 &hf_omron_non_fatal_cpu_bus_unit_setting_error,
883 &hf_omron_non_fatal_battery_error,
884 &hf_omron_non_fatal_sysmac_bus_error,
885 &hf_omron_non_fatal_sysmac_bus2_error,
886 &hf_omron_non_fatal_cpu_bus_unit_error,
887 &hf_omron_non_fatal_rv3,
888 &hf_omron_non_fatal_io_verification_error,
889 &hf_omron_non_fatal_rv4,
890 &hf_omron_non_fatal_sfc_error,
891 &hf_omron_non_fatal_indirect_dm_error,
892 &hf_omron_non_fatal_jmp_error,
893 &hf_omron_non_fatal_rv5,
894 &hf_omron_non_fatal_fal_error,
898 static const int *message_fields[] = {
899 &hf_omron_message_no_0,
900 &hf_omron_message_no_1,
901 &hf_omron_message_no_2,
902 &hf_omron_message_no_3,
903 &hf_omron_message_no_4,
904 &hf_omron_message_no_5,
905 &hf_omron_message_no_6,
906 &hf_omron_message_no_7,
907 &hf_omron_message_rv_0,
908 &hf_omron_message_rv_1,
909 &hf_omron_message_rv_2,
910 &hf_omron_message_rv_3,
911 &hf_omron_message_rv_4,
912 &hf_omron_message_rv_5,
913 &hf_omron_message_rv_6,
914 &hf_omron_message_rv_7,
918 static const int *message_yes_no_fields[] = {
919 &hf_omron_message_rv_1,
920 &hf_omron_message_rv_2,
921 &hf_omron_message_rv_3,
922 &hf_omron_message_rv_4,
923 &hf_omron_message_rv_5,
924 &hf_omron_message_rv_6,
925 &hf_omron_message_rv_7,
929 static const int *data_type_fields[] = {
930 &hf_omron_data_type_type,
931 &hf_omron_data_type_rv,
932 &hf_omron_data_type_protected,
933 &hf_omron_data_type_end,
937 static const int *cyclic_non_fatal_1_fields[] = {
948 static const int *cyclic_non_fatal_2_fields[] = {
960 static const int *cyclic_non_fatal_3_fields[] = {
972 static const int *cyclic_non_fatal_4_fields[] = {
984 static const int *cyclic_non_fatal_5_fields[] = {
996 static const int *cyclic_non_fatal_6_fields[] = {
1000 &hf_omron_cyclic_43,
1001 &hf_omron_cyclic_44,
1002 &hf_omron_cyclic_45,
1003 &hf_omron_cyclic_46,
1004 &hf_omron_cyclic_47,
1008 static const int *cyclic_non_fatal_7_fields[] = {
1009 &hf_omron_cyclic_48,
1010 &hf_omron_cyclic_49,
1011 &hf_omron_cyclic_50,
1012 &hf_omron_cyclic_51,
1013 &hf_omron_cyclic_52,
1014 &hf_omron_cyclic_53,
1015 &hf_omron_cyclic_54,
1016 &hf_omron_cyclic_55,
1020 static const int *cyclic_non_fatal_8_fields[] = {
1021 &hf_omron_cyclic_56,
1022 &hf_omron_cyclic_57,
1023 &hf_omron_cyclic_58,
1024 &hf_omron_cyclic_59,
1025 &hf_omron_cyclic_60,
1026 &hf_omron_cyclic_61,
1027 &hf_omron_cyclic_62,
1031 static const true_false_string boolean_data_type_protected = {
1036 static const true_false_string boolean_data_type_end = {
1041 static const true_false_string boolean_node_num_status = {
1046 static const true_false_string boolean_status_flag_status = {
1051 static const true_false_string boolean_status_flags_slave_master = {
1056 static const true_false_string boolean_status_flags_data_link = {
1061 static const true_false_string boolean_status_block_stop_run = {
1066 static const true_false_string boolean_status_flag_status_2 = {
1071 static const true_false_string boolean_member_network = {
1076 static const true_false_string boolean_member_polling = {
1077 "Unit does not respond to polling",
1078 "Unit responds to polling"
1085 dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1087 proto_item *ti = NULL;
1088 proto_tree *omron_tree = NULL;
1089 proto_tree *omron_header_tree, *field_tree, *command_tree, *area_data_tree, *cpu_bus_tree;
1090 proto_tree *io_data_tree, *error_log_tree, *omron_disk_data_tree, *omron_file_data_tree;
1091 proto_tree *omron_block_record_tree, *omron_status_tree;
1092 const gchar *cmd_str;
1094 gint reported_length_remaining;
1098 gboolean is_response = FALSE;
1099 gboolean is_command = FALSE;
1100 guint16 command_code;
1102 /* Make sure we have enough actual data to do the heuristics checks */
1103 if(tvb_length(tvb) < 12 ) {
1106 /* Check some bytes to see if it's OMRON */
1107 omron_byte = tvb_get_guint8(tvb, 1);
1108 if(omron_byte != 0x00) {
1111 omron_byte = tvb_get_guint8(tvb, 2);
1112 if(omron_byte != 0x02) {
1115 /* get the command code: we need it later */
1116 command_code = tvb_get_ntohs(tvb,10);
1118 /* Set the protocol column */
1119 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMRON");
1122 cmd_str = match_strval_idx(command_code, command_code_cv, &cmd_str_idx);
1123 if (cmd_str_idx == -1)
1124 cmd_str = ep_strdup_printf("Unknown (%d)", command_code);
1126 /* Setup and fill in the INFO column if it's there */
1127 icf_flags = tvb_get_guint8(tvb, offset);
1128 if (icf_flags & 0x40) {
1130 if (check_col(pinfo->cinfo, COL_INFO)) {
1131 col_add_fstr(pinfo->cinfo, COL_INFO, "Response : %s", cmd_str);
1137 if (check_col(pinfo->cinfo, COL_INFO)) {
1138 col_add_fstr(pinfo->cinfo, COL_INFO, "Command : %s", cmd_str);
1142 if (tree) { /* we are being asked for details */
1143 ti = proto_tree_add_item(tree, proto_omron_fins, tvb, 0, -1, FALSE);
1144 omron_tree = proto_item_add_subtree(ti, ett_omron);
1146 ti = proto_tree_add_text(omron_tree, tvb, 0, 12, "Omron Header");
1147 omron_header_tree = proto_item_add_subtree(ti, ett_omron_header);
1149 proto_tree_add_bitmask(omron_header_tree, tvb, offset, hf_omron_icf,
1150 ett_omron_icf_fields, omron_icf_fields, FALSE);
1153 offset = offset + 1;
1154 proto_tree_add_item(omron_header_tree, hf_omron_rsv, tvb, offset, 1, FALSE);
1157 offset = offset + 1;
1158 proto_tree_add_item(omron_header_tree, hf_omron_gct, tvb, offset, 1, FALSE);
1161 offset = offset + 1;
1162 proto_tree_add_item(omron_header_tree, hf_omron_dna, tvb, offset, 1, FALSE);
1165 offset = offset + 1;
1166 proto_tree_add_item(omron_header_tree, hf_omron_da1, tvb, offset, 1, FALSE);
1169 offset = offset + 1;
1170 proto_tree_add_item(omron_header_tree, hf_omron_da2, tvb, offset, 1, FALSE);
1173 offset = offset + 1;
1174 proto_tree_add_item(omron_header_tree, hf_omron_sna, tvb, offset, 1, FALSE);
1177 offset = offset + 1;
1178 proto_tree_add_item(omron_header_tree, hf_omron_sa1, tvb, offset, 1, FALSE);
1181 offset = offset + 1;
1182 proto_tree_add_item(omron_header_tree, hf_omron_sa2, tvb, offset, 1, FALSE);
1185 offset = offset + 1;
1186 proto_tree_add_item(omron_header_tree, hf_omron_sid, tvb, offset, 1, FALSE);
1188 /* Byte 11 and 12 Command Code */
1189 offset = offset + 1;
1190 ti = proto_tree_add_item(omron_header_tree, hf_omron_command, tvb, offset, 2, FALSE);
1192 offset = offset + 2;
1194 reported_length_remaining = tvb_reported_length_remaining(tvb, offset);
1196 if (cmd_str_idx == -1) {
1197 /* Unknown command-code */
1198 expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Command-Code");
1199 return tvb_length(tvb);
1202 /* Handle special cases wherein the data length for a command and/or a response can be 0 */
1203 switch(command_code) {
1214 /* command data length > 0 is NG; response data lengths are > 0 */
1216 if (reported_length_remaining != 0) {
1217 expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length (Should be 0)");
1219 return tvb_length(tvb);
1224 /* command data length should be 0 */
1226 if(reported_length_remaining != 0) {
1227 expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length (Should be 0)");
1230 /* There's no response */
1233 expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Response Command-Code");
1235 return tvb_length(tvb);
1239 /* command data length = 0 or > 0 is OK; */
1241 if (reported_length_remaining == 0)
1242 return tvb_length(tvb);
1247 /* command data length = 0 or > 0 is OK; */
1249 if (reported_length_remaining == 0)
1250 return tvb_length(tvb);
1252 /* There's no response */
1255 expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Response Command-Code");
1256 return tvb_length(tvb);
1264 /* Add command data tree */
1265 /* Note: A "malformed" will be thrown if data length = 0 at this point */
1266 ti = proto_tree_add_text(omron_tree, tvb, offset, -1, "Command Data");
1267 command_tree = proto_item_add_subtree(ti, ett_omron_command_data);
1269 /* Start parsing individual commands */
1270 switch(command_code) {
1274 /* check for enough data */
1277 if(reported_length_remaining == 6)
1279 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
1280 tvb, offset, 1, FALSE);
1282 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, FALSE);
1283 proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, FALSE);
1284 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, FALSE);
1285 offset = offset + 6;
1291 if(reported_length_remaining >= 2)
1293 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1296 if(reported_length_remaining > 2)
1298 proto_tree_add_item(command_tree, hf_omron_response_data, tvb,
1299 (offset+2), -1, FALSE);
1301 offset = offset + reported_length_remaining;
1311 if(reported_length_remaining >= 6)
1313 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
1314 tvb, offset, 1, FALSE);
1316 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, FALSE);
1317 proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, FALSE);
1318 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, FALSE);
1320 proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+6), -1, FALSE);
1321 offset = offset + reported_length_remaining;
1327 if(reported_length_remaining == 2)
1329 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1331 offset = offset + 2;
1341 if(reported_length_remaining == 8)
1343 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
1344 tvb, offset, 1, FALSE);
1346 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, FALSE);
1347 proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, FALSE);
1348 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, FALSE);
1350 proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+6), 2, FALSE);
1351 offset = offset + 8;
1357 if(reported_length_remaining == 2)
1359 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1361 offset = offset + 2;
1371 while(reported_length_remaining >= 4)
1373 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, FALSE);
1374 proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+1), 3, FALSE);
1375 offset = offset + 4;
1376 reported_length_remaining = reported_length_remaining - 4;
1382 if(reported_length_remaining >= 3)
1384 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1385 offset = offset + 2;
1386 reported_length_remaining = reported_length_remaining - 2;
1388 while(reported_length_remaining >= 2)
1390 guint8 memory_area_code;
1391 guint8 memory_code_len;
1393 ti = proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, FALSE);
1394 memory_area_code = tvb_get_guint8(tvb, offset);
1395 switch(memory_area_code) {
1397 memory_code_len = 1;
1400 memory_code_len = 1;
1403 memory_code_len = 2;
1406 memory_code_len = 4;
1409 memory_code_len = 1;
1412 memory_code_len = 1;
1415 memory_code_len = 2;
1418 memory_code_len = 2;
1421 memory_code_len = 1;
1424 memory_code_len = 1;
1427 memory_code_len = 1;
1430 memory_code_len = 1;
1433 memory_code_len = 2;
1436 memory_code_len = 1;
1439 memory_code_len = 2;
1442 memory_code_len = 2;
1445 memory_code_len = 2;
1448 memory_code_len = 2;
1451 memory_code_len = 2;
1454 memory_code_len = 2;
1457 memory_code_len = 2;
1460 memory_code_len = 2;
1463 memory_code_len = 2;
1466 memory_code_len = 2;
1469 memory_code_len = 1;
1472 memory_code_len = 2;
1475 memory_code_len = 4;
1478 memory_code_len = 0;
1481 offset = offset + 1;
1482 reported_length_remaining = reported_length_remaining - 1;
1484 if(memory_code_len == 0) {
1485 expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN,
1486 "Unknown Memory-Area-Code (%u)", memory_area_code);
1487 return tvb_length(tvb); /* Bail out .... */
1489 proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, memory_code_len, FALSE);
1490 offset = offset + memory_code_len;
1491 reported_length_remaining = reported_length_remaining - memory_code_len;
1493 } /* while ( ... >= 2) */
1494 } /* if(reported_length_remaining >= 3) */
1503 if(reported_length_remaining == 10)
1505 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
1506 tvb, offset, 1, FALSE);
1507 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, FALSE);
1508 proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, FALSE);
1510 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
1511 tvb, (offset+4), 1, FALSE);
1512 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+5), 2, FALSE);
1513 proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+7), 1, FALSE);
1515 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+8), 2, FALSE);
1516 offset = offset + 10;
1522 if(reported_length_remaining == 2)
1524 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1526 offset = offset + 2;
1537 if(reported_length_remaining == 6)
1539 proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, offset, 2, FALSE);
1540 proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+2), 2, FALSE);
1541 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+4), 2, FALSE);
1542 offset = offset + 6;
1548 if(reported_length_remaining >= 8)
1550 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1552 proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, (offset+2), 2, FALSE);
1553 proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+4), 2, FALSE);
1554 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, FALSE);
1556 if(reported_length_remaining > 8)
1558 proto_tree_add_item(command_tree, hf_omron_response_data, tvb,
1559 (offset+8), -1, FALSE);
1561 offset = offset + reported_length_remaining;
1573 if(reported_length_remaining >= 6)
1575 proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, offset, 2, FALSE);
1576 proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+2), 2, FALSE);
1577 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+4), 2, FALSE);
1579 if(reported_length_remaining > 6)
1581 proto_tree_add_item(command_tree, hf_omron_command_data, tvb,
1582 (offset+6), -1, FALSE);
1584 offset = offset + reported_length_remaining;
1590 if(reported_length_remaining == 2)
1592 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
1594 offset = offset + 2;
1604 if(reported_length_remaining == 8)
1606 proto_tree_add_item(command_tree, hf_omron_fixed, tvb, offset, 2, FALSE);
1607 proto_tree_add_item(command_tree, hf_omron_intelligent_id_no, tvb, (offset+2), 2, FALSE);
1608 proto_tree_add_item(command_tree, hf_omron_first_word, tvb, (offset+4), 2, FALSE);
1609 proto_tree_add_item(command_tree, hf_omron_read_len, tvb, (offset+6), 2, FALSE);
1610 offset = offset + 8;
1616 if(reported_length_remaining >= 3)
1618 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1619 proto_tree_add_item(command_tree, hf_omron_no_of_link_nodes, tvb, (offset+2), 1, FALSE);
1621 offset = offset + 3;
1622 reported_length_remaining = reported_length_remaining - 3;
1624 /* add block record tree for each record */
1625 while(reported_length_remaining >= 8)
1627 ti = proto_tree_add_text(command_tree, tvb, offset, 8, "Block Record");
1628 omron_block_record_tree = proto_item_add_subtree(ti, ett_omron_block_record);
1629 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_status, tvb, offset, 1, FALSE);
1630 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_num_nodes, tvb, offset, 1, FALSE);
1631 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_cio_area, tvb, (offset+1), 2, FALSE);
1632 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_kind_of_dm, tvb, (offset+3), 1, FALSE);
1633 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_dm_area_first_word, tvb, (offset+4), 2, FALSE);
1634 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_no_of_total_words, tvb, (offset+6), 2, FALSE);
1635 offset = offset + 8;
1636 reported_length_remaining = reported_length_remaining - 8;
1639 } /* if (is_response) */
1647 if(reported_length_remaining >= 9)
1649 proto_tree_add_item(command_tree, hf_omron_fixed, tvb, offset, 2, FALSE);
1650 proto_tree_add_item(command_tree, hf_omron_intelligent_id_no, tvb, (offset+2), 2, FALSE);
1651 proto_tree_add_item(command_tree, hf_omron_first_word, tvb, (offset+4), 2, FALSE);
1652 proto_tree_add_item(command_tree, hf_omron_read_len, tvb, (offset+6), 2, FALSE);
1653 proto_tree_add_item(command_tree, hf_omron_no_of_link_nodes, tvb, (offset+8), 1, FALSE);
1655 offset = offset + 9;
1656 reported_length_remaining = reported_length_remaining - 9;
1658 while(reported_length_remaining >= 8)
1660 ti = proto_tree_add_text(command_tree, tvb, offset, 8, "Block Record");
1661 omron_block_record_tree = proto_item_add_subtree(ti, ett_omron_block_record);
1662 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_status, tvb, offset, 1, FALSE);
1663 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_num_nodes, tvb, offset, 1, FALSE);
1664 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_cio_area, tvb, (offset+1), 2, FALSE);
1665 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_kind_of_dm, tvb, (offset+3), 1, FALSE);
1666 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_dm_area_first_word, tvb, (offset+4), 2, FALSE);
1667 proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_no_of_total_words, tvb, (offset+6), 2, FALSE);
1668 offset = offset + 8;
1669 reported_length_remaining = reported_length_remaining - 8;
1676 if(reported_length_remaining == 2)
1678 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1679 offset = offset + 2;
1690 if(reported_length_remaining == 15)
1692 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1693 proto_tree_add_item(command_tree, hf_omron_protect_code, tvb, (offset+2), 1, FALSE);
1694 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+3),4,FALSE);
1695 proto_tree_add_item(command_tree, hf_omron_last_word, tvb, (offset+7),4,FALSE);
1696 proto_tree_add_item(command_tree, hf_omron_password, tvb, (offset+11),4,FALSE);
1697 offset = offset + 15;
1703 if(reported_length_remaining == 2)
1705 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1706 offset = offset + 2;
1716 if(reported_length_remaining == 8)
1718 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1719 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+2), 4, FALSE);
1720 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, FALSE);
1721 offset = offset + 8;
1727 if(reported_length_remaining >= 10)
1729 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1730 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, FALSE);
1731 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, FALSE);
1732 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+8), 2, FALSE);
1734 if(reported_length_remaining > 10)
1736 proto_tree_add_item(command_tree, hf_omron_response_data, tvb, (offset+10), -1, FALSE);
1738 offset = offset + reported_length_remaining;
1748 if(reported_length_remaining >= 8)
1750 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1751 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+2), 4, FALSE);
1752 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, FALSE);
1754 if(reported_length_remaining > 8)
1756 proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+8), -1, FALSE);
1758 offset = offset + reported_length_remaining;
1763 if(reported_length_remaining == 10)
1765 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1766 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, FALSE);
1767 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, FALSE);
1768 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+8), 2, FALSE);
1769 offset = offset + 10;
1779 if(reported_length_remaining == 3)
1781 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1782 proto_tree_add_item(command_tree, hf_omron_clear_code, tvb, (offset+2), 1, FALSE);
1783 offset = offset + 3;
1788 if(reported_length_remaining == 2)
1790 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1791 offset = offset + 2;
1801 if(reported_length_remaining == 3)
1803 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1804 proto_tree_add_item(command_tree, hf_omron_mode_code, tvb, (offset+2), 1, FALSE);
1805 offset = offset + 3;
1807 else if (reported_length_remaining == 2)
1809 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
1810 proto_tree_add_item(command_tree, hf_omron_monitor_label, tvb, offset, 0, FALSE);
1811 offset = offset + 2;
1816 if(reported_length_remaining == 2)
1818 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1819 offset = offset + 2;
1827 /* command data length is 0 */
1831 if(reported_length_remaining == 2)
1833 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1834 offset = offset + 2;
1844 if(reported_length_remaining == 1)
1846 proto_tree_add_item(command_tree, hf_omron_command_data, tvb,
1848 offset = offset + 1;
1854 if(reported_length_remaining == 94)
1856 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1857 proto_tree_add_item(command_tree, hf_omron_controller_model, tvb, (offset+2), 20, FALSE);
1858 proto_tree_add_item(command_tree, hf_omron_controller_version, tvb, (offset+22), 20, FALSE);
1859 proto_tree_add_item(command_tree, hf_omron_for_system_use, tvb, (offset+42), 40, FALSE);
1860 /* add area data sub tree */
1861 ti = proto_tree_add_text(command_tree, tvb, (offset+82), 12, "Area Data");
1862 area_data_tree = proto_item_add_subtree(ti, ett_area_data);
1863 proto_tree_add_item(area_data_tree, hf_omron_program_area_size, tvb, (offset+82), 2, FALSE);
1864 proto_tree_add_item(area_data_tree, hf_omron_iom_size, tvb, (offset+84), 1, FALSE);
1865 proto_tree_add_item(area_data_tree, hf_omron_num_dm_words, tvb, (offset+85), 2, FALSE);
1866 proto_tree_add_item(area_data_tree, hf_omron_timer_counter_size, tvb, (offset+87), 1, FALSE);
1867 proto_tree_add_item(area_data_tree, hf_omron_expansion_dm_size, tvb, (offset+88), 1, FALSE);
1868 proto_tree_add_item(area_data_tree, hf_omron_num_step_transitions, tvb, (offset+89), 2, FALSE);
1869 proto_tree_add_item(area_data_tree, hf_omron_kind_memory_card, tvb, (offset+91), 1, FALSE);
1870 proto_tree_add_item(area_data_tree, hf_omron_memory_card_size, tvb, (offset+92), 2, FALSE);
1871 offset = offset + 94;
1874 else if(reported_length_remaining == 69)
1876 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1877 ti = proto_tree_add_text(command_tree, tvb, (offset+2), 64, "CPU Bus Unit Conf");
1878 cpu_bus_tree = proto_item_add_subtree(ti, ett_cpu_bus);
1879 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_0, tvb, (offset+2), 2, FALSE);
1880 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_1, tvb, (offset+4), 2, FALSE);
1881 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_2, tvb, (offset+6), 2, FALSE);
1882 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_3, tvb, (offset+8), 2, FALSE);
1883 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_4, tvb, (offset+10), 2, FALSE);
1884 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_5, tvb, (offset+12), 2, FALSE);
1885 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_6, tvb, (offset+14), 2, FALSE);
1886 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_7, tvb, (offset+16), 2, FALSE);
1887 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_8, tvb, (offset+18), 2, FALSE);
1888 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_9, tvb, (offset+20), 2, FALSE);
1889 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_10, tvb, (offset+22), 2, FALSE);
1890 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_11, tvb, (offset+24), 2, FALSE);
1891 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_12, tvb, (offset+26), 2, FALSE);
1892 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_13, tvb, (offset+28), 2, FALSE);
1893 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_14, tvb, (offset+30), 2, FALSE);
1894 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_15, tvb, (offset+32), 2, FALSE);
1895 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_reserved, tvb, (offset+34), 32, FALSE);
1896 /* Remote IO Data tree */
1897 ti = proto_tree_add_text(command_tree, tvb, (offset+66), 2, "Remote I/O data");
1898 io_data_tree = proto_item_add_subtree(ti, ett_io_data);
1899 proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_1, tvb, (offset+66), 1, FALSE);
1900 proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_2, tvb, (offset+67), 1, FALSE);
1902 proto_tree_add_bitmask(command_tree, tvb, (offset+68), hf_omron_pc_status,
1903 ett_pc_status_fields, pc_status_fields, FALSE);
1904 offset = offset + 69;
1907 else if(reported_length_remaining == 161)
1909 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1910 proto_tree_add_item(command_tree, hf_omron_controller_model, tvb, (offset+2), 20, FALSE);
1911 proto_tree_add_item(command_tree, hf_omron_controller_version, tvb, (offset+22), 20, FALSE);
1912 proto_tree_add_item(command_tree, hf_omron_for_system_use, tvb, (offset+42), 40, FALSE);
1913 /* add area data sub tree */
1914 ti = proto_tree_add_text(command_tree, tvb, (offset+82), 12, "Area Data");
1915 area_data_tree = proto_item_add_subtree(ti, ett_area_data);
1916 proto_tree_add_item(area_data_tree, hf_omron_program_area_size, tvb, (offset+82), 2, FALSE);
1917 proto_tree_add_item(area_data_tree, hf_omron_iom_size, tvb, (offset+84), 1, FALSE);
1918 proto_tree_add_item(area_data_tree, hf_omron_num_dm_words, tvb, (offset+85), 2, FALSE);
1919 proto_tree_add_item(area_data_tree, hf_omron_timer_counter_size, tvb, (offset+87), 1, FALSE);
1920 proto_tree_add_item(area_data_tree, hf_omron_expansion_dm_size, tvb, (offset+88), 1, FALSE);
1921 proto_tree_add_item(area_data_tree, hf_omron_num_step_transitions, tvb, (offset+89), 2, FALSE);
1922 proto_tree_add_item(area_data_tree, hf_omron_kind_memory_card, tvb, (offset+91), 1, FALSE);
1923 proto_tree_add_item(area_data_tree, hf_omron_memory_card_size, tvb, (offset+92), 2, FALSE);
1924 /* cpu bus unit configuration */
1925 ti = proto_tree_add_text(command_tree, tvb, (offset+94), 64, "CPU Bus Unit Conf");
1926 cpu_bus_tree = proto_item_add_subtree(ti, ett_cpu_bus);
1927 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_0, tvb, (offset+94), 2, FALSE);
1928 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_1, tvb, (offset+96), 2, FALSE);
1929 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_2, tvb, (offset+98), 2, FALSE);
1930 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_3, tvb, (offset+100), 2, FALSE);
1931 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_4, tvb, (offset+102), 2, FALSE);
1932 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_5, tvb, (offset+104), 2, FALSE);
1933 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_6, tvb, (offset+106), 2, FALSE);
1934 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_7, tvb, (offset+108), 2, FALSE);
1935 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_8, tvb, (offset+110), 2, FALSE);
1936 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_9, tvb, (offset+112), 2, FALSE);
1937 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_10, tvb, (offset+114), 2, FALSE);
1938 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_11, tvb, (offset+116), 2, FALSE);
1939 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_12, tvb, (offset+118), 2, FALSE);
1940 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_13, tvb, (offset+120), 2, FALSE);
1941 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_14, tvb, (offset+122), 2, FALSE);
1942 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_15, tvb, (offset+124), 2, FALSE);
1943 proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_reserved, tvb, (offset+126), 32, FALSE);
1944 /* Remote IO Data tree */
1945 ti = proto_tree_add_text(command_tree, tvb, (offset+158), 2, "Remote I/O data");
1946 io_data_tree = proto_item_add_subtree(ti, ett_io_data);
1947 proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_1, tvb, (offset+158), 1, FALSE);
1948 proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_2, tvb, (offset+159), 1, FALSE);
1950 proto_tree_add_bitmask(command_tree, tvb, (offset+160), hf_omron_pc_status,
1951 ett_pc_status_fields, pc_status_fields, FALSE);
1952 offset = offset + 161;
1962 if(reported_length_remaining >= 1)
1964 proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, offset, 1, FALSE);
1965 if (reported_length_remaining == 2)
1967 proto_tree_add_item(command_tree, hf_omron_num_units, tvb, (offset+1), 1, FALSE);
1968 offset = offset + 1;
1970 offset = offset + 1;
1976 if(reported_length_remaining >= 24)
1978 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
1979 proto_tree_add_item(command_tree, hf_omron_num_units, tvb, offset+2, 1, FALSE);
1980 offset = offset + 3;
1981 reported_length_remaining = reported_length_remaining - 3;
1983 while(reported_length_remaining >= 21)
1985 proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, offset, 1, FALSE);
1986 proto_tree_add_item(command_tree, hf_omron_model_number, tvb, offset+1, 20, FALSE);
1987 offset = offset + 21;
1988 reported_length_remaining = reported_length_remaining - 21;
1997 /* command data length is 0 */
2001 if(reported_length_remaining == 28)
2003 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2004 proto_tree_add_item(command_tree, hf_omron_status, tvb, (offset+2), 1, FALSE);
2005 proto_tree_add_item(command_tree, hf_omron_mode_code, tvb, (offset+3), 1, FALSE);
2006 /* Add bitmask for Fatal error data */
2007 proto_tree_add_bitmask(command_tree, tvb, (offset+4), hf_omron_fatal_error_data,
2008 ett_fatal_fields, fatal_error_fields, FALSE);
2009 /* Add bitmask for non fatal error data */
2010 proto_tree_add_bitmask(command_tree, tvb, (offset+6), hf_omron_non_fatal_error_data,
2011 ett_non_fatal_fields, non_fatal_error_fields, FALSE);
2012 /* add bitmask for message yes/no data */
2013 proto_tree_add_bitmask(command_tree, tvb, (offset+8), hf_omron_message,
2014 ett_message_fields, message_fields, FALSE);
2015 /* Add rest of fields */
2016 proto_tree_add_item(command_tree, hf_omron_fals, tvb, (offset+10), 2, FALSE);
2017 proto_tree_add_item(command_tree, hf_omron_error_message, tvb, (offset+12), 16, FALSE);
2018 offset = offset + 28;
2026 /* command data length is 0 */
2030 if(reported_length_remaining == 108)
2032 proto_item *netw_nodes_sts;
2033 proto_tree *netw_nodes_sts_tree;
2034 proto_item *netw_nodes_non_fatal_err_sts;
2035 proto_tree *netw_nodes_non_fatal_err_sts_tree;
2036 proto_item *netw_nodes_cyclic_err_ctrs;
2037 proto_tree *netw_nodes_cyclic_err_ctrs_tree;
2041 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2042 offset = offset + 2;
2044 /* parsing 31 bytes of foo */
2045 netw_nodes_sts = proto_tree_add_text(command_tree, tvb, offset, 31, "Network Nodes Status");
2046 netw_nodes_sts_tree = proto_item_add_subtree(netw_nodes_sts, ett_omron_netw_nodes_sts);
2048 for(i = 0; i < 31; i++)
2050 ti = proto_tree_add_text(netw_nodes_sts_tree, tvb, offset, 1, "Node Number %d", node_num);
2051 field_tree = proto_item_add_subtree(ti, ett_omron_netw_node_sts);
2052 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_3, tvb, offset, 1, FALSE);
2053 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_2, tvb, offset, 1, FALSE);
2054 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_1, tvb, offset, 1, FALSE);
2055 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_0, tvb, offset, 1, FALSE);
2056 node_num = node_num + 1;
2058 ti = proto_tree_add_text(netw_nodes_sts_tree, tvb, offset, 1, "Node Number %d", node_num);
2059 field_tree = proto_item_add_subtree(ti, ett_omron_netw_node_sts);
2060 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_3, tvb, offset, 1, FALSE);
2061 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_2, tvb, offset, 1, FALSE);
2062 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_1, tvb, offset, 1, FALSE);
2063 proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_0, tvb, offset, 1, FALSE);
2064 node_num = node_num + 1;
2066 offset = offset + 1;
2069 proto_tree_add_item(command_tree, hf_omron_com_cycle_time, tvb, offset, 2, FALSE);
2070 proto_tree_add_item(command_tree, hf_omron_polling_unit_node_num, tvb, (offset+2), 1, FALSE);
2071 proto_tree_add_item(command_tree, hf_omron_cyclic_operation, tvb, (offset+3), 1, FALSE);
2072 proto_tree_add_item(command_tree, hf_omron_cyclic_trans_status, tvb, (offset+4), 1, FALSE);
2075 netw_nodes_non_fatal_err_sts =
2076 proto_tree_add_text(command_tree, tvb, offset, 8, "Network Nodes Non-Fatal Error Status");
2077 netw_nodes_non_fatal_err_sts_tree =
2078 proto_item_add_subtree(netw_nodes_non_fatal_err_sts, ett_omron_netw_nodes_non_fatal_err_sts);
2080 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+0), hf_omron_cyclic_label_1,
2081 ett_omron_cyclic_fields, cyclic_non_fatal_1_fields, FALSE);
2082 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+1), hf_omron_cyclic_label_2,
2083 ett_omron_cyclic_fields, cyclic_non_fatal_2_fields, FALSE);
2084 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+2), hf_omron_cyclic_label_3,
2085 ett_omron_cyclic_fields, cyclic_non_fatal_3_fields, FALSE);
2086 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+3), hf_omron_cyclic_label_4,
2087 ett_omron_cyclic_fields, cyclic_non_fatal_4_fields, FALSE);
2088 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+4), hf_omron_cyclic_label_5,
2089 ett_omron_cyclic_fields, cyclic_non_fatal_5_fields, FALSE);
2090 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+5), hf_omron_cyclic_label_6,
2091 ett_omron_cyclic_fields, cyclic_non_fatal_6_fields, FALSE);
2092 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+6), hf_omron_cyclic_label_7,
2093 ett_omron_cyclic_fields, cyclic_non_fatal_7_fields, FALSE);
2094 proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+7), hf_omron_cyclic_label_8,
2095 ett_omron_cyclic_fields, cyclic_non_fatal_8_fields, FALSE);
2097 offset = offset + 8;
2099 netw_nodes_cyclic_err_ctrs = proto_tree_add_text(command_tree, tvb, offset, 62, "Network Nodes Cyclic Error Counters");
2100 netw_nodes_cyclic_err_ctrs_tree = proto_item_add_subtree(netw_nodes_cyclic_err_ctrs, ett_omron_netw_nodes_cyclic_err_ctrs);
2102 for(i = 0; i < 62; i++)
2104 guint8 ctr = tvb_get_guint8(tvb, offset);
2105 proto_tree_add_uint_format(netw_nodes_cyclic_err_ctrs_tree, hf_omron_node_error_count,
2106 tvb, offset, 1, ctr, "Node Number %2d: %3d", node_num, ctr);
2107 node_num = node_num + 1;
2108 offset = offset + 1;
2117 /* command data length is 0 */
2121 if(reported_length_remaining == 16)
2123 proto_item *status_flags;
2124 proto_tree *status_flags_tree;
2126 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2128 /* add status flag tree */
2129 ti = proto_tree_add_item(command_tree, hf_omron_status_flags, tvb, (offset+2), 1, FALSE);
2130 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2131 proto_tree_add_item(omron_status_tree, hf_omron_status_flags_slave_master, tvb, (offset+2), 1, FALSE);
2132 proto_tree_add_item(omron_status_tree, hf_omron_status_flags_data_link, tvb, (offset+2), 1, FALSE);
2134 /* command_tree for master node */
2135 proto_tree_add_item(command_tree, hf_omron_master_node_number, tvb, (offset+3), 1, FALSE);
2136 offset = offset + 4;
2138 /* Status flag blocks */
2139 status_flags = proto_tree_add_text(command_tree, tvb, offset, 96, "Status flag blocks");
2140 status_flags_tree = proto_item_add_subtree(status_flags, ett_omron_data_link_status_tree);
2142 /* Status block 1 */
2143 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, FALSE);
2144 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2145 proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+0), 1, FALSE);
2146 proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+0), 1, FALSE);
2147 proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+0), 1, FALSE);
2148 proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+0), 1, FALSE);
2149 proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+0), 1, FALSE);
2150 proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+0), 1, FALSE);
2151 proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+0), 1, FALSE);
2152 proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+0), 1, FALSE);
2154 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, FALSE);
2155 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2156 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+1), 1, FALSE);
2157 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+1), 1, FALSE);
2158 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+1), 1, FALSE);
2159 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+1), 1, FALSE);
2160 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+1), 1, FALSE);
2161 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+1), 1, FALSE);
2162 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+1), 1, FALSE);
2163 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+1), 1, FALSE);
2165 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, FALSE);
2166 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2167 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+2), 1, FALSE);
2168 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+2), 1, FALSE);
2169 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+2), 1, FALSE);
2170 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+2), 1, FALSE);
2171 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+2), 1, FALSE);
2172 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+2), 1, FALSE);
2173 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+2), 1, FALSE);
2174 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+2), 1, FALSE);
2176 /* status block 2 */
2177 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, FALSE);
2178 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2179 proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+3), 1, FALSE);
2180 proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+3), 1, FALSE);
2181 proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+3), 1, FALSE);
2182 proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+3), 1, FALSE);
2183 proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+3), 1, FALSE);
2184 proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+3), 1, FALSE);
2185 proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+3), 1, FALSE);
2186 proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+3), 1, FALSE);
2188 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, FALSE);
2189 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2190 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+4), 1, FALSE);
2191 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+4), 1, FALSE);
2192 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+4), 1, FALSE);
2193 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+4), 1, FALSE);
2194 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+4), 1, FALSE);
2195 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+4), 1, FALSE);
2196 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+4), 1, FALSE);
2197 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+4), 1, FALSE);
2199 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, FALSE);
2200 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2201 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+5), 1, FALSE);
2202 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+5), 1, FALSE);
2203 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+5), 1, FALSE);
2204 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+5), 1, FALSE);
2205 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+5), 1, FALSE);
2206 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+5), 1, FALSE);
2207 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+5), 1, FALSE);
2208 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+5), 1, FALSE);
2210 /* status block 3 */
2211 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, FALSE);
2212 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2213 proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+6), 1, FALSE);
2214 proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+6), 1, FALSE);
2215 proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+6), 1, FALSE);
2216 proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+6), 1, FALSE);
2217 proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+6), 1, FALSE);
2218 proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+6), 1, FALSE);
2219 proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+6), 1, FALSE);
2220 proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+6), 1, FALSE);
2222 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, FALSE);
2223 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2224 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+7), 1, FALSE);
2225 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+7), 1, FALSE);
2226 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+7), 1, FALSE);
2227 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+7), 1, FALSE);
2228 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+7), 1, FALSE);
2229 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+7), 1, FALSE);
2230 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+7), 1, FALSE);
2231 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+7), 1, FALSE);
2233 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, FALSE);
2234 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2235 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+8), 1, FALSE);
2236 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+8), 1, FALSE);
2237 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+8), 1, FALSE);
2238 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+8), 1, FALSE);
2239 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+8), 1, FALSE);
2240 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+8), 1, FALSE);
2241 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+8), 1, FALSE);
2242 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+8), 1, FALSE);
2244 /* status block 4 */
2245 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, FALSE);
2246 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2247 proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+9), 1, FALSE);
2248 proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+9), 1, FALSE);
2249 proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+9), 1, FALSE);
2250 proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+9), 1, FALSE);
2251 proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+9), 1, FALSE);
2252 proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+9), 1, FALSE);
2253 proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+9), 1, FALSE);
2254 proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+9), 1, FALSE);
2256 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, FALSE);
2257 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2258 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+10), 1, FALSE);
2259 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+10), 1, FALSE);
2260 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+10), 1, FALSE);
2261 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+10), 1, FALSE);
2262 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+10), 1, FALSE);
2263 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+10), 1, FALSE);
2264 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+10), 1, FALSE);
2265 proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+10), 1, FALSE);
2267 ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, FALSE);
2268 omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
2269 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+11), 1, FALSE);
2270 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+11), 1, FALSE);
2271 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+11), 1, FALSE);
2272 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+11), 1, FALSE);
2273 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+11), 1, FALSE);
2274 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+11), 1, FALSE);
2275 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+11), 1, FALSE);
2276 proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+11), 1, FALSE);
2278 offset = offset + 12;
2288 if(reported_length_remaining == 1)
2290 proto_tree_add_item(command_tree, hf_omron_parameter, tvb, offset, 1, FALSE);
2291 offset = offset + 1;
2297 if(reported_length_remaining == 2)
2299 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2300 offset = offset + 2;
2303 else if(reported_length_remaining == 14)
2305 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2306 proto_tree_add_item(command_tree, hf_omron_avg_cycle_time, tvb, (offset+2), 4, FALSE);
2307 proto_tree_add_item(command_tree, hf_omron_max_cycle_time, tvb, (offset+6), 4, FALSE);
2308 proto_tree_add_item(command_tree, hf_omron_min_cycle_time, tvb, (offset+10), 4, FALSE);
2309 offset = offset + 14;
2317 /* command data length is 0 */
2321 if(reported_length_remaining == 9)
2323 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2324 proto_tree_add_item(command_tree, hf_omron_year, tvb, (offset+2), 1, FALSE);
2325 proto_tree_add_item(command_tree, hf_omron_month, tvb, (offset+3), 1, FALSE);
2326 proto_tree_add_item(command_tree, hf_omron_date, tvb, (offset+4), 1, FALSE);
2327 proto_tree_add_item(command_tree, hf_omron_hour, tvb, (offset+5), 1, FALSE);
2328 proto_tree_add_item(command_tree, hf_omron_minute, tvb, (offset+6), 1, FALSE);
2329 proto_tree_add_item(command_tree, hf_omron_second, tvb, (offset+7), 1, FALSE);
2330 proto_tree_add_item(command_tree, hf_omron_day, tvb, (offset+8), 1, FALSE);
2331 offset = offset + 9;
2341 if(reported_length_remaining >= 5)
2343 proto_tree_add_item(command_tree, hf_omron_year, tvb, (offset), 1, FALSE);
2344 proto_tree_add_item(command_tree, hf_omron_month, tvb, (offset+1), 1, FALSE);
2345 proto_tree_add_item(command_tree, hf_omron_date, tvb, (offset+2), 1, FALSE);
2346 proto_tree_add_item(command_tree, hf_omron_hour, tvb, (offset+3), 1, FALSE);
2347 proto_tree_add_item(command_tree, hf_omron_minute, tvb, (offset+4), 1, FALSE);
2349 if(reported_length_remaining == 7)
2351 proto_tree_add_item(command_tree, hf_omron_second, tvb, (offset+5), 1, FALSE);
2352 proto_tree_add_item(command_tree, hf_omron_day, tvb, (offset+6), 1, FALSE);
2353 offset = offset + 2;
2355 offset = offset + 5;
2361 if(reported_length_remaining == 2)
2363 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2364 offset = offset + 2;
2374 /* zero-length case handled in previous switch statement */
2375 if(reported_length_remaining > 0)
2377 proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, -1, FALSE);
2378 offset = offset + reported_length_remaining;
2384 if(reported_length_remaining > 2)
2386 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2387 proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+2), -1, FALSE);
2388 offset = offset + reported_length_remaining;
2398 if(reported_length_remaining == 4)
2400 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2401 proto_tree_add_item(command_tree, hf_omron_num_receptions, tvb, (offset+2), 2, FALSE);
2402 offset = offset + 4;
2412 /* zero-length case handled in previous switch statement */
2413 if(reported_length_remaining > 0)
2415 proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, -1, FALSE);
2416 offset = offset + reported_length_remaining;
2426 if(reported_length_remaining == 2)
2428 if((tvb_get_ntohs(tvb, offset) & 0xC000) == 0x8000)
2430 /* "FAL/FALS READ" */
2431 proto_tree_add_item(command_tree, hf_omron_fals, tvb, offset, 2, FALSE);
2435 /* "MESSAGE READ" / "MESSAGE CLEAR" */
2436 /* add bitmask for message yes/no data */
2437 proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_message,
2438 ett_message_fields, message_yes_no_fields, FALSE);
2440 offset = offset + 2;
2446 if(reported_length_remaining == 2)
2448 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2449 offset = offset + 2;
2451 else if(reported_length_remaining == 20)
2453 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2454 proto_tree_add_item(command_tree, hf_omron_fals, tvb, (offset+2), 2, FALSE);
2455 proto_tree_add_item(command_tree, hf_omron_error_message, tvb, (offset+4), 16, FALSE);
2456 offset = offset + 20;
2458 else if(reported_length_remaining >= 4)
2460 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2461 /* add bitmask for message yes/no data */
2462 proto_tree_add_bitmask(command_tree, tvb, (offset+2), hf_omron_message,
2463 ett_message_fields, message_yes_no_fields, FALSE);
2465 offset = offset + 4;
2466 reported_length_remaining = reported_length_remaining - 4;
2468 while (reported_length_remaining >= 32)
2470 proto_tree_add_item(command_tree, hf_omron_read_message, tvb, offset, 32, FALSE);
2471 offset = offset + 32;
2472 reported_length_remaining = reported_length_remaining - 32;
2483 if(reported_length_remaining == 2)
2485 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
2486 offset = offset + 2;
2492 if(reported_length_remaining == 2)
2494 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2495 offset = offset + 2;
2497 else if(reported_length_remaining == 5)
2499 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2500 proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, (offset+2), 1, FALSE);
2501 proto_tree_add_item(command_tree, hf_omron_node_number, tvb, (offset+3), 1, FALSE);
2502 proto_tree_add_item(command_tree, hf_omron_network_address, tvb, (offset+4), 1, FALSE);
2503 offset = offset + 5;
2514 if(reported_length_remaining == 2)
2516 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
2517 offset = offset + 2;
2523 if(reported_length_remaining == 2)
2525 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2526 offset = offset + 2;
2537 if(reported_length_remaining == 2)
2539 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, FALSE);
2540 offset = offset + 2;
2546 if(reported_length_remaining == 2)
2548 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2549 offset = offset + 2;
2560 if(reported_length_remaining == 2)
2562 proto_tree_add_item(command_tree, hf_omron_error_reset_fals_no, tvb, offset, 2, FALSE);
2563 offset = offset + 2;
2569 if(reported_length_remaining == 2)
2571 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2572 offset = offset + 2;
2583 if(reported_length_remaining == 4)
2585 proto_tree_add_item(command_tree, hf_omron_beginning_record_no, tvb, offset, 2, FALSE);
2586 proto_tree_add_item(command_tree, hf_omron_no_of_records, tvb, (offset+2), 2, FALSE);
2587 offset = offset + 4;
2593 if(reported_length_remaining >= 8)
2595 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2596 proto_tree_add_item(command_tree, hf_omron_max_no_of_stored_records, tvb, (offset+2), 2, FALSE);
2597 proto_tree_add_item(command_tree, hf_omron_no_of_stored_records, tvb, (offset+4), 2, FALSE);
2598 proto_tree_add_item(command_tree, hf_omron_no_of_records, tvb, (offset+6), 2, FALSE);
2599 offset = offset + 8;
2600 reported_length_remaining = reported_length_remaining - 8;
2602 while(reported_length_remaining >= 10)
2604 ti = proto_tree_add_text(command_tree, tvb, offset, 10, "Error log data");
2605 error_log_tree = proto_item_add_subtree(ti, ett_omron_error_log_data);
2607 proto_tree_add_item(error_log_tree, hf_omron_error_reset_fals_no, tvb, offset, 2, FALSE);
2608 proto_tree_add_item(error_log_tree, hf_omron_error_reset_fals_no, tvb, (offset+2), 2, FALSE);
2609 proto_tree_add_item(error_log_tree, hf_omron_minute, tvb, (offset+4), 1, FALSE);
2610 proto_tree_add_item(error_log_tree, hf_omron_second, tvb, (offset+5), 1, FALSE);
2611 proto_tree_add_item(error_log_tree, hf_omron_day, tvb, (offset+6), 1, FALSE);
2612 proto_tree_add_item(error_log_tree, hf_omron_hour, tvb, (offset+7), 1, FALSE);
2613 proto_tree_add_item(error_log_tree, hf_omron_year, tvb, (offset+8), 1, FALSE);
2614 proto_tree_add_item(error_log_tree, hf_omron_month, tvb, (offset+9), 1, FALSE);
2616 offset = offset + 10;
2617 reported_length_remaining = reported_length_remaining - 10;
2626 /* command data length is 0 */
2630 if(reported_length_remaining == 2)
2632 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2633 offset = offset + 2;
2643 if(reported_length_remaining == 6)
2645 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2646 proto_tree_add_item(command_tree, hf_omron_beginning_file_position, tvb, (offset+2), 2, FALSE);
2647 proto_tree_add_item(command_tree, hf_omron_no_of_files, tvb, (offset+4), 2, FALSE);
2648 offset = offset + 6;
2654 if(reported_length_remaining >= 50)
2656 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2658 ti = proto_tree_add_text(command_tree, tvb, (offset+2), 26, "Disk data");
2659 omron_disk_data_tree = proto_item_add_subtree(ti, ett_omron_disk_data);
2660 proto_tree_add_item(omron_disk_data_tree, hf_omron_volume_label, tvb, (offset+2), 12, FALSE);
2662 omron_byte = tvb_get_guint8(tvb, (offset+14));
2663 proto_tree_add_uint_format(omron_disk_data_tree, hf_omron_date_year, tvb, (offset+14), 1, omron_byte,
2664 "Year: %d", ((omron_byte>>1)+1980));
2666 proto_tree_add_item(omron_disk_data_tree, hf_omron_date_month, tvb, (offset+14), 4, FALSE);
2667 proto_tree_add_item(omron_disk_data_tree, hf_omron_date_day, tvb, (offset+14), 4, FALSE);
2668 proto_tree_add_item(omron_disk_data_tree, hf_omron_date_hour, tvb, (offset+14), 4, FALSE);
2669 proto_tree_add_item(omron_disk_data_tree, hf_omron_date_minute, tvb, (offset+14), 4, FALSE);
2671 omron_byte = tvb_get_guint8(tvb, (offset+17));
2672 proto_tree_add_uint_format(omron_disk_data_tree, hf_omron_date_second, tvb, (offset+17), 1, omron_byte,
2673 "Second: %d", ((omron_byte&0x1F)*2));
2675 proto_tree_add_item(omron_disk_data_tree, hf_omron_total_capacity, tvb, (offset+18), 4, FALSE);
2676 proto_tree_add_item(omron_disk_data_tree, hf_omron_unused_capacity, tvb, (offset+22), 4, FALSE);
2677 proto_tree_add_item(omron_disk_data_tree, hf_omron_total_no_files, tvb, (offset+26), 2, FALSE);
2678 proto_tree_add_item(omron_disk_data_tree, hf_omron_no_files, tvb, (offset+28), 2, FALSE);
2680 offset = offset + 30;
2681 reported_length_remaining = reported_length_remaining - 30;
2683 while(reported_length_remaining >= 20)
2685 ti = proto_tree_add_text(command_tree, tvb, offset, 20, "File data");
2686 omron_file_data_tree = proto_item_add_subtree(ti, ett_omron_file_data);
2688 proto_tree_add_item(omron_file_data_tree, hf_omron_filename, tvb, offset, 12, FALSE);
2690 omron_byte = tvb_get_guint8(tvb, (offset+12));
2691 proto_tree_add_uint_format(omron_file_data_tree, hf_omron_date_year, tvb, (offset+12), 1, omron_byte,
2692 "Year: %d", ((omron_byte>>1)+1980));
2694 proto_tree_add_item(omron_file_data_tree, hf_omron_date_month, tvb, (offset+12), 4, FALSE);
2695 proto_tree_add_item(omron_file_data_tree, hf_omron_date_day, tvb, (offset+12), 4, FALSE);
2696 proto_tree_add_item(omron_file_data_tree, hf_omron_date_hour, tvb, (offset+12), 4, FALSE);
2697 proto_tree_add_item(omron_file_data_tree, hf_omron_date_minute, tvb, (offset+12), 4, FALSE);
2699 omron_byte = tvb_get_guint8(tvb, (offset+15));
2700 proto_tree_add_uint_format(omron_file_data_tree, hf_omron_date_second, tvb, (offset+15), 1, omron_byte,
2701 "Second: %d", ((omron_byte&0x1F)*2));
2703 proto_tree_add_item(omron_file_data_tree, hf_omron_file_capacity, tvb, (offset+16), 4, FALSE);
2705 offset = offset + 20;
2706 reported_length_remaining = reported_length_remaining - 20;
2708 } /* if(reported_length_remaining >= 50) */
2717 if(reported_length_remaining == 20)
2719 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2720 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, FALSE);
2721 proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+14), 4, FALSE);
2722 proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+18), 2, FALSE);
2723 offset = offset + 20;
2729 if(reported_length_remaining >= 12)
2731 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2732 proto_tree_add_item(command_tree, hf_omron_file_capacity, tvb, (offset+2), 4, FALSE);
2733 proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+6), 4, FALSE);
2734 proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+10), 2, FALSE);
2736 if(reported_length_remaining > 12)
2738 proto_tree_add_item(command_tree, hf_omron_file_data, tvb, (offset+12), -1, FALSE);
2740 offset = offset + reported_length_remaining;
2750 if(reported_length_remaining >= 22)
2752 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2753 proto_tree_add_item(command_tree, hf_omron_file_parameter_code, tvb, (offset+2), 2, FALSE);
2754 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+4), 12, FALSE);
2755 proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+16), 4, FALSE);
2756 proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+20), 2, FALSE);
2757 if(reported_length_remaining > 22)
2759 proto_tree_add_item(command_tree, hf_omron_file_data, tvb, (offset+22), -1, FALSE);
2761 offset = offset + reported_length_remaining;
2767 if(reported_length_remaining == 2)
2769 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2770 offset = offset + 2;
2780 if(reported_length_remaining == 2)
2782 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2783 offset = offset + 2;
2788 if(reported_length_remaining == 2)
2790 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2791 offset = offset + 2;
2801 if(reported_length_remaining >= 16)
2803 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2804 proto_tree_add_item(command_tree, hf_omron_no_files, tvb, (offset+2), 2, FALSE);
2805 offset = offset + 4;
2806 reported_length_remaining = reported_length_remaining - 4;
2808 while(reported_length_remaining >= 12)
2810 proto_tree_add_item(command_tree, hf_omron_filename, tvb, offset, 12, FALSE);
2811 offset = offset + 12;
2812 reported_length_remaining = reported_length_remaining - 12;
2819 if(reported_length_remaining == 4)
2821 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2822 proto_tree_add_item(command_tree, hf_omron_no_files, tvb, (offset+2), 2, FALSE);
2823 offset = offset + 4;
2833 if(reported_length_remaining >= 4)
2835 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2836 proto_tree_add_item(command_tree, hf_omron_volume_parameter_code, tvb, (offset+2), 2, FALSE);
2838 if(reported_length_remaining == 16)
2840 proto_tree_add_item(command_tree, hf_omron_volume_label, tvb, (offset+4), 12, FALSE);
2841 offset = offset + 12;
2843 offset = offset + 4;
2849 if(reported_length_remaining == 2)
2851 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2852 offset = offset + 2;
2862 if(reported_length_remaining == 28)
2864 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2865 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, FALSE);
2866 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+14), 2, FALSE);
2867 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+16), 12, FALSE);
2868 offset = offset + 28;
2874 if(reported_length_remaining == 2)
2876 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2877 offset = offset + 2;
2887 if(reported_length_remaining == 26)
2889 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2890 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, FALSE);
2891 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+14), 12, FALSE);
2892 offset = offset + 26;
2898 if(reported_length_remaining == 2)
2900 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2901 offset = offset + 2;
2911 if(reported_length_remaining == 14)
2913 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, FALSE);
2914 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, FALSE);
2915 offset = offset + 14;
2921 if(reported_length_remaining == 2)
2923 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2924 offset = offset + 2;
2934 if(reported_length_remaining == 22)
2936 proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, FALSE);
2937 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, FALSE);
2938 proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+3), 3, FALSE);
2939 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+6), 2, FALSE);
2940 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+8), 2, FALSE);
2941 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+10), 12, FALSE);
2942 offset = offset + 22;
2948 if(reported_length_remaining == 4)
2950 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2951 proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+2), 2, FALSE);
2952 offset = offset + 4;
2962 if(reported_length_remaining == 22)
2964 proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, FALSE);
2965 proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, (offset+2), 2, FALSE);
2966 proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+4), 2, FALSE);
2967 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, FALSE);
2968 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+8), 2, FALSE);
2969 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+10), 12, FALSE);
2970 offset = offset + 22;
2976 if(reported_length_remaining == 4)
2978 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
2979 proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+2), 2, FALSE);
2980 offset = offset + 4;
2990 if(reported_length_remaining == 26)
2992 proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, FALSE);
2993 proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, FALSE);
2994 proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, FALSE);
2995 proto_tree_add_item(command_tree, hf_omron_number_of_bytes, tvb, (offset+8), 4, FALSE);
2996 proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+12), 2, FALSE);
2997 proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+14), 12, FALSE);
2998 offset = offset + 26;
3004 if(reported_length_remaining == 6)
3006 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3007 proto_tree_add_item(command_tree, hf_omron_number_of_bytes, tvb, (offset+2), 4, FALSE);
3008 offset = offset + 6;
3018 if(reported_length_remaining == 3)
3020 proto_tree_add_item(command_tree, hf_omron_beginning_block_num, tvb, offset, 2, FALSE);
3021 proto_tree_add_item(command_tree, hf_omron_num_blocks, tvb, (offset+2), 1, FALSE);
3022 offset = offset + 3;
3028 if(reported_length_remaining >= 9)
3030 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3031 proto_tree_add_item(command_tree, hf_omron_num_blocks_remaining, tvb, (offset+2), 2, FALSE);
3032 proto_tree_add_item(command_tree, hf_omron_total_num_blocks, tvb, (offset+4), 2, FALSE);
3033 proto_tree_add_item(command_tree, hf_omron_type, tvb, (offset+6), 1, FALSE);
3034 offset = offset + 7;
3035 reported_length_remaining = reported_length_remaining - 7;
3037 while(reported_length_remaining >= 2)
3039 proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_data_type,
3040 ett_omron_data_type, data_type_fields, FALSE);
3041 proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+1), 1, FALSE);
3042 offset = offset + 2;
3043 reported_length_remaining = reported_length_remaining - 2;
3054 if(reported_length_remaining == 2)
3056 proto_tree_add_item(command_tree, hf_omron_block_num, tvb, offset, 2, FALSE);
3057 offset = offset + 2;
3063 if(reported_length_remaining >= 4)
3065 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3066 proto_tree_add_bitmask(command_tree, tvb, (offset+2), hf_omron_data_type,
3067 ett_omron_data_type, data_type_fields, FALSE);
3068 proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+3), 1, FALSE);
3069 proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+4), -1, FALSE);
3070 offset = offset + reported_length_remaining;
3080 if(reported_length_remaining >= 4)
3082 proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_data_type,
3083 ett_omron_data_type, data_type_fields, FALSE);
3084 proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+1), 1, FALSE);
3085 proto_tree_add_item(command_tree, hf_omron_block_num, tvb, (offset+2), 2, FALSE);
3086 proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+4), -1, FALSE);
3087 offset = offset + reported_length_remaining;
3093 if(reported_length_remaining == 2)
3095 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3096 offset = offset + 2;
3107 if(reported_length_remaining >= 8)
3109 proto_tree_add_item(command_tree, hf_omron_number_of_bits_flags, tvb, offset, 2, FALSE);
3110 offset = offset + 2;
3111 reported_length_remaining = reported_length_remaining - 2;
3113 while (reported_length_remaining >= 6)
3115 proto_tree_add_item(command_tree, hf_omron_set_reset_specification, tvb, offset, 2, FALSE);
3116 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, FALSE);
3117 proto_tree_add_item(command_tree, hf_omron_bit_flag, tvb, (offset+3), 3, FALSE);
3119 offset = offset + 6;
3120 reported_length_remaining = reported_length_remaining - 6;
3127 if(reported_length_remaining == 2)
3129 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3130 offset = offset + 2;
3138 /* command data length is 0 */
3142 if(reported_length_remaining == 2)
3144 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3145 offset = offset + 2;
3156 if(reported_length_remaining == 6)
3158 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, FALSE);
3159 proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+1), 3, FALSE);
3160 proto_tree_add_item(command_tree, hf_omron_num_unit_uint16, tvb, (offset+4), 2, FALSE);
3161 offset = offset + 6;
3167 if(reported_length_remaining >= 8)
3169 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3170 proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, FALSE);
3171 proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+3), 3, FALSE);
3172 proto_tree_add_item(command_tree, hf_omron_num_unit_uint16, tvb, (offset+6), 2, FALSE);
3173 proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+8), -1, FALSE);
3174 offset = offset + reported_length_remaining;
3184 if((reported_length_remaining > 0) && (reported_length_remaining <= 8))
3186 proto_tree_add_item(command_tree, hf_omron_name_data, tvb, offset, -1, FALSE);
3187 offset = offset + reported_length_remaining;
3193 if(reported_length_remaining == 2)
3195 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3196 offset = offset + 2;
3204 /* command data length is 0 */
3208 if(reported_length_remaining == 2)
3210 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3211 offset = offset + 2;
3219 /* command data length is 0 */
3223 if((reported_length_remaining > 2) && (reported_length_remaining <= (2+8)))
3225 proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, FALSE);
3226 proto_tree_add_item(command_tree, hf_omron_name_data, tvb, offset, -1, FALSE);
3227 offset = offset + reported_length_remaining;
3234 { /* invalid command ?? */
3235 ;/* ??? dissector_bug ??*/
3239 } /* switch(command_code) */
3241 if ((guint)offset != tvb_reported_length(tvb)) {
3242 expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length");
3247 return tvb_length(tvb);
3251 proto_register_omron_fins(void)
3254 module_t *omron_fins_module;
3257 /* Setup list of header fields */
3259 static hf_register_info hf[] = {
3261 { "OMRON ICF Field", "omron.icf", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3263 { &hf_omron_icf_gwb,
3264 { "Gateway bit", "omron.icf.gwb", FT_UINT8, BASE_HEX, VALS(icf_gw_vals), ICF_GW_MASK, NULL, HFILL }},
3266 { &hf_omron_icf_dtb,
3267 { "Data Type bit", "omron.icf.dtb", FT_UINT8, BASE_HEX, VALS(icf_dtb_vals), ICF_DTB_MASK, NULL, HFILL }},
3269 { &hf_omron_icf_rb0,
3270 { "Reserved bit 0", "omron.icf.rb0", FT_UINT8, BASE_HEX, NULL, ICF_RB0_MASK, NULL, HFILL }},
3272 { &hf_omron_icf_rb1,
3273 { "Reserved bit 1", "omron.icf.rb1", FT_UINT8, BASE_HEX, NULL, ICF_RB1_MASK, NULL, HFILL }},
3275 { &hf_omron_icf_rb2,
3276 { "Reserved bit 2", "omron.icf.rb2", FT_UINT8, BASE_HEX, NULL, ICF_RB2_MASK, NULL, HFILL }},
3278 { &hf_omron_icf_rb3,
3279 { "Reserved bit 3", "omron.icf.rb3", FT_UINT8, BASE_HEX, NULL, ICF_RB3_MASK, NULL, HFILL }},
3281 { &hf_omron_icf_rb4,
3282 { "Reserved bit 4", "omron.icf.rb4", FT_UINT8, BASE_HEX, NULL, ICF_RB4_MASK, NULL, HFILL }},
3284 { &hf_omron_icf_rsb,
3285 { "Response setting bit", "omron.icf.rsb", FT_UINT8, BASE_HEX, VALS(icf_rsb_vals), ICF_RSB_MASK, NULL, HFILL }},
3288 { "Reserved", "omron.rsv", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3291 { "Gateway Count", "omron.gct", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3294 { "Destination network address", "omron.dna", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_dna_range), 0x0, NULL, HFILL }},
3297 { "Destination node number", "omron.da1", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_da1_range), 0x0, NULL, HFILL }},
3300 { "Destination unit address", "omron.da2", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_da2_range), 0x0, NULL, HFILL }},
3303 { "Source network address", "omron.sna", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_sna_range), 0x0, NULL, HFILL }},
3306 { "Source node number", "omron.sa1", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_sa1_range), 0x0, NULL, HFILL }},
3309 { "Source unit address", "omron.sa2", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_sa2_range), 0x0, NULL, HFILL }},
3312 { "Service ID", "omron.sid", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3314 { &hf_omron_command,
3315 { "Command CODE", "omron.command", FT_UINT16, BASE_HEX, VALS(command_code_cv), 0x0, NULL, HFILL }},
3317 { &hf_omron_command_memory_area_code,
3318 { "Memory Area Code", "omron.memory.area.read", FT_UINT8, BASE_HEX, VALS(memory_area_code_cv), 0x0, NULL, HFILL }},
3320 { &hf_omron_response_code,
3321 { "Response code", "omron.response.code", FT_UINT16, BASE_HEX, VALS(response_codes), 0x0, NULL, HFILL }},
3323 { &hf_omron_command_data,
3324 { "Command Data", "omron.command.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3326 { &hf_omron_address,
3327 { "Beginning address", "omron.memory.address", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
3329 { &hf_omron_address_bits,
3330 { "Beginning address bits", "omron.memory.address.bits", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
3332 { &hf_omron_num_items,
3333 { "Number of items", "omron.memory.numitems", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3335 { &hf_omron_response_data,
3336 { "Response data", "omron.response.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3338 { &hf_omron_parameter_area_code,
3339 { "Parameter area code", "omron.parameter_area_code", FT_UINT16, BASE_HEX, VALS(parameter_area_codes), 0x0, NULL, HFILL }},
3341 { &hf_omron_beginning_word,
3342 { "Beginning word", "omron.word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3344 { &hf_omron_num_words,
3345 { "No. words or Bytes", "omron.numwords", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3347 { &hf_omron_program_number,
3348 { "Program number", "omron.program_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3350 { &hf_omron_protect_code,
3351 { "Protect code", "omron.protect_code", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3353 { &hf_omron_begin_word,
3354 { "Beginning word", "omron.word.begin", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3356 { &hf_omron_last_word,
3357 { "Last word", "omron.word.last", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3359 { &hf_omron_password,
3360 { "Password", "omron.password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3362 { &hf_omron_clear_code,
3363 { "Clear Code", "omron.clearcode", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3365 { &hf_omron_mode_code,
3366 { "Mode Code", "omron.mode_code", FT_UINT8, BASE_HEX, VALS(mode_codes), 0x0, NULL, HFILL }},
3368 { &hf_omron_monitor_label,
3369 { "Mode Code (Default Monitor)", "omron.mode_code_default_monitor", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3371 { &hf_omron_controller_model,
3372 { "Controller model", "omron.controller.model", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3374 { &hf_omron_controller_version,
3375 { "Controller version", "omron.controller.version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3376 { &hf_omron_for_system_use,
3377 { "For system use", "omron.system.use", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3379 { &hf_omron_program_area_size,
3380 {"Program area size", "omron.area_data.program_area_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3382 { &hf_omron_iom_size,
3383 {"IOM size", "omron.area_data.iom_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3385 { &hf_omron_num_dm_words,
3386 { "No. of DM words", "omron.area_data.dm_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3388 { &hf_omron_timer_counter_size,
3389 { "Timer/counter size", "omron.area_data.timer_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3390 { &hf_omron_expansion_dm_size,
3391 { "Expansion DM size", "omron.area_data.dm_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3393 { &hf_omron_num_step_transitions,
3394 { "No. of steps/transitions", "omron.area_data.num_steps", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3395 { &hf_omron_kind_memory_card,
3396 { "Kind of Memory card", "omron.area_data.memory_card", FT_UINT8, BASE_DEC, VALS(memory_card_codes), 0x0, NULL, HFILL }},
3398 { &hf_omron_memory_card_size,
3399 { "Memory card size", "omron.area_data.memory_card.size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3400 { &hf_omron_cpu_bus_unit_0,
3401 { "CPU Bus Unit No. 0", "omron.cpubus_unit.no0", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3402 { &hf_omron_cpu_bus_unit_1,
3403 { "CPU Bus Unit No. 1", "omron.cpubus_unit.no1", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3404 { &hf_omron_cpu_bus_unit_2,
3405 { "CPU Bus Unit No. 2", "omron.cpubus_unit.no2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3406 { &hf_omron_cpu_bus_unit_3,
3407 { "CPU Bus Unit No. 3", "omron.cpubus_unit.no3", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3408 { &hf_omron_cpu_bus_unit_4,
3409 { "CPU Bus Unit No. 4", "omron.cpubus_unit.no4", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3410 { &hf_omron_cpu_bus_unit_5,
3411 { "CPU Bus Unit No. 5", "omron.cpubus_unit.no5", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3412 { &hf_omron_cpu_bus_unit_6,
3413 { "CPU Bus Unit No. 6", "omron.cpubus_unit.no6", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3414 { &hf_omron_cpu_bus_unit_7,
3415 { "CPU Bus Unit No. 7", "omron.cpubus_unit.no7", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3416 { &hf_omron_cpu_bus_unit_8,
3417 { "CPU Bus Unit No. 8", "omron.cpubus_unit.no8", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3418 { &hf_omron_cpu_bus_unit_9,
3419 { "CPU Bus Unit No. 9", "omron.cpubus_unit.no9", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3420 { &hf_omron_cpu_bus_unit_10,
3421 { "CPU Bus Unit No. 10", "omron.cpubus_unit.no10", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3422 { &hf_omron_cpu_bus_unit_11,
3423 { "CPU Bus Unit No. 11", "omron.cpubus_unit.no11", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3424 { &hf_omron_cpu_bus_unit_12,
3425 { "CPU Bus Unit No. 12", "omron.cpubus_unit.no12", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3426 { &hf_omron_cpu_bus_unit_13,
3427 { "CPU Bus Unit No. 13", "omron.cpubus_unit.no13", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3428 { &hf_omron_cpu_bus_unit_14,
3429 { "CPU Bus Unit No. 14", "omron.cpubus_unit.no14", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3430 { &hf_omron_cpu_bus_unit_15,
3431 { "CPU Bus Unit No. 15", "omron.cpubus_unit.no15", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3432 { &hf_omron_cpu_bus_reserved,
3433 { "CPU Bus Unit Reserved", "omron.cpubus_unit.reserved", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3434 { &hf_omron_io_data_num_sysmac_1,
3435 { "No. of SYSMAC BUS/2 Masters mounted", "omron.remote_io_date.sysmac_1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3436 { &hf_omron_io_data_num_sysmac_2,
3437 { "No. of SYSMAC BUS Masters mounted", "omron.remote_io_date.sysmac_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3438 { &hf_omron_pc_status,
3439 { "PC status", "omron.pc_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3440 { &hf_omron_pc_status_pdc,
3441 { "Peripheral Device connected", "omron.pc_status.pdc", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL}},
3442 { &hf_omron_pc_status_hi,
3443 { "With built-in host interface", "omron.pc_status.hi", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL}},
3444 { &hf_omron_pc_status_r1,
3445 { "Reserved 1", "omron.pc_status.r1", FT_UINT8, BASE_DEC, NULL, 0x20, NULL, HFILL}},
3446 { &hf_omron_pc_status_r2,
3447 { "Reserved 2", "omron.pc_status.r2", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL}},
3448 { &hf_omron_pc_status_rack_num,
3449 { "Rack Number", "omron.pcp_status.rack_num", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}},
3450 { &hf_omron_unit_address,
3451 { "Unit address", "omron.unit_address", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
3452 { &hf_omron_num_units,
3453 { "No. of Units", "omron.unit_nums", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
3454 { &hf_omron_model_number,
3455 { "Model Number", "omron.model_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
3457 { "Status", "omron.status", FT_UINT8, BASE_HEX, VALS(status_codes), 0x0, NULL, HFILL}},
3458 { &hf_omron_fatal_error_data,
3459 { "Fatal error data", "omron.fatal_error_data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
3460 { &hf_omron_fatal_fals_error,
3461 {"FALS error", "omron.fatal.fals_error", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }},
3462 { &hf_omron_fatal_sfc_error,
3463 {"Fatal SFC error", "omron.fatal.sfc_error", FT_UINT16, BASE_DEC, NULL, 0x4000, NULL, HFILL }},
3464 { &hf_omron_fatal_cycle_time_over,
3465 {"Cycle time over", "omron.fatal.cycle_time_over", FT_UINT16, BASE_DEC, NULL, 0x2000, NULL, HFILL }},
3466 { &hf_omron_fatal_program_error,
3467 {"Program error", "omron.fatal.program_error", FT_UINT16, BASE_DEC, NULL, 0x1000, NULL, HFILL }},
3468 { &hf_omron_fatal_io_setting_error,
3469 {"I/O setting error", "omron.fatal.io_setting_error", FT_UINT16, BASE_DEC, NULL, 0x0800, NULL, HFILL }},
3470 { &hf_omron_fatal_io_point_overflow,
3471 {"I/O point overflow", "omron.fatal.io_point_overflow", FT_UINT16, BASE_DEC, NULL, 0x0400, NULL, HFILL }},
3472 { &hf_omron_fatal_cpu_bus_error,
3473 {"CPU bus error", "omron.fatal.cpu_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0200, NULL, HFILL }},
3474 { &hf_omron_fatal_duplication_error,
3475 {"Duplication error", "omron.fatal.duplication_error", FT_UINT16, BASE_DEC, NULL, 0x0100, NULL, HFILL }},
3476 { &hf_omron_fatal_io_bus_error,
3477 {"I/O bus error", "omron.fatal.io_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0080, NULL, HFILL }},
3478 { &hf_omron_fatal_memory_error,
3479 {"Memory error", "omron.fatal.memory_error", FT_UINT16, BASE_DEC, NULL, 0x0040, NULL, HFILL }},
3480 { &hf_omron_fatal_rv_1,
3481 {"Reserved", "omron.fatal.rv_1", FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL }},
3482 { &hf_omron_fatal_rv_2,
3483 {"Reserved", "omron.fatal.rv_2", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL }},
3484 { &hf_omron_fatal_rv_3,
3485 {"Reserved", "omron.fatal.rv_3", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL }},
3486 { &hf_omron_fatal_rv_4,
3487 {"Reserved", "omron.fatal.rv_4", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL }},
3488 { &hf_omron_fatal_rv_5,
3489 {"Reserved", "omron.fatal.rv_5", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL }},
3490 { &hf_omron_fatal_watch_dog_timer_error,
3491 {"Watch dog timer error", "omron.fatal.watch_dog_timer_error", FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL }},
3492 { &hf_omron_non_fatal_error_data,
3493 { "Non fatal error data", "omron.fatal_error_data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
3494 { &hf_omron_non_fatal_rv1,
3495 { "Reserved", "omron.non_fatal.rv1", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }},
3496 { &hf_omron_non_fatal_rv2,
3497 { "Reserved", "omron.non_fatal.rv2", FT_UINT16, BASE_DEC, NULL, 0x4000, NULL, HFILL }},
3498 { &hf_omron_non_fatal_power_interruption,
3499 { "Momentary power interruption", "omron.non_fatal.power_interruption", FT_UINT16, BASE_DEC, NULL, 0x2000, NULL, HFILL }},
3500 { &hf_omron_non_fatal_cpu_bus_unit_setting_error,
3501 { "CPU Bus Unit setting error", "omron.non_fatal.cpu_bus_unit_setting_error", FT_UINT16, BASE_DEC, NULL, 0x1000, NULL, HFILL }},
3502 { &hf_omron_non_fatal_battery_error,
3503 { "Battery error", "omron.non_fatal.batter_error", FT_UINT16, BASE_DEC, NULL, 0x0800, NULL, HFILL }},
3504 { &hf_omron_non_fatal_sysmac_bus_error,
3505 { "SYSMAC BUS error", "omron.non_fatal.sysmac_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0400, NULL, HFILL }},
3506 { &hf_omron_non_fatal_sysmac_bus2_error,
3507 { "SYSMAC BUS/2 error", "omron.non_fatal.sysmac_bus2_error", FT_UINT16, BASE_DEC, NULL, 0x0200, NULL, HFILL }},
3508 { &hf_omron_non_fatal_cpu_bus_unit_error,
3509 { "CPU Bus Unit error", "omron.non_fatal.cpu_bus_unit_error", FT_UINT16, BASE_DEC, NULL, 0x0100, NULL, HFILL }},
3510 { &hf_omron_non_fatal_rv3,
3511 { "Reserved", "omron.non_fatal.rv3", FT_UINT16, BASE_DEC, NULL, 0x0080, NULL, HFILL }},
3512 { &hf_omron_non_fatal_io_verification_error,
3513 { "I/O verfication error", "omron.non_fatal.io_verification_error", FT_UINT16, BASE_DEC, NULL, 0x0040, NULL, HFILL }},
3514 { &hf_omron_non_fatal_rv4,
3515 { "Reserved", "omron.non_fatal.rv4", FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL }},
3516 { &hf_omron_non_fatal_sfc_error,
3517 { "Non-fatal SFC error v", "omron.non_fatal.sfc_error", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL }},
3518 { &hf_omron_non_fatal_indirect_dm_error,
3519 { "Indirect DM error", "omron.non_fatal.indirect_dm_error", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL }},
3520 { &hf_omron_non_fatal_jmp_error,
3521 { "JMP error", "omron.non_fatal.jmp_error", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL }},
3522 { &hf_omron_non_fatal_rv5,
3523 { "Reserved", "omron.non_fatal.rv5", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL }},
3524 { &hf_omron_non_fatal_fal_error,
3525 { "FAL error", "omron.non_fatal.fal_error", FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL }},
3526 { &hf_omron_message,
3527 { "Message", "omron.message", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
3528 { &hf_omron_message_no_0,
3529 { "Message no. 0", "omron.message.no_0", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
3530 { &hf_omron_message_no_1,
3531 { "Message no. 1", "omron.message.no_1", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
3532 { &hf_omron_message_no_2,
3533 { "Message no. 2", "omron.message.no_2", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x2000, NULL, HFILL }},
3534 { &hf_omron_message_no_3,
3535 { "Message no. 3", "omron.message.no_3", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x1000, NULL, HFILL }},
3536 { &hf_omron_message_no_4,
3537 { "Message no. 4", "omron.message.no_4", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0800, NULL, HFILL }},
3538 { &hf_omron_message_no_5,
3539 { "Message no. 5", "omron.message.no_5", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0400, NULL, HFILL }},
3540 { &hf_omron_message_no_6,
3541 { "Message no. 6", "omron.message.no_6", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0200, NULL, HFILL }},
3542 { &hf_omron_message_no_7,
3543 { "Message no. 7", "omron.message.no_7", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100, NULL, HFILL }},
3544 { &hf_omron_message_rv_0,
3545 { "Reserved", "omron.message.rv_0", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080, NULL, HFILL }},
3546 { &hf_omron_message_rv_1,
3547 { "Reserved", "omron.message.rv_1", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0040, NULL, HFILL }},
3548 { &hf_omron_message_rv_2,
3549 { "Reserved", "omron.message.rv_2", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0020, NULL, HFILL }},
3550 { &hf_omron_message_rv_3,
3551 { "Reserved", "omron.message.rv_3", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0010, NULL, HFILL }},
3552 { &hf_omron_message_rv_4,
3553 { "Reserved", "omron.message.rv_4", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0008, NULL, HFILL }},
3554 { &hf_omron_message_rv_5,
3555 { "Reserved", "omron.message.rv_5", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0004, NULL, HFILL }},
3556 { &hf_omron_message_rv_6,
3557 { "Reserved", "omron.message.rv_6", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0002, NULL, HFILL }},
3558 { &hf_omron_message_rv_7,
3559 { "Reserved", "omron.message.rv_7", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0001, NULL, HFILL }},
3561 { "FALS / FALS no.", "omron.fals", FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL}},
3562 { &hf_omron_error_message,
3563 { "Error message", "omron.error_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
3564 { &hf_omron_parameter,
3565 { "Parameter", "omron.parameter", FT_UINT8, BASE_HEX, VALS(parameter_codes), 0x0, NULL, HFILL }},
3566 { &hf_omron_avg_cycle_time,
3567 { "Average cycle time", "omron.avg_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3568 { &hf_omron_max_cycle_time,
3569 { "Max. cycle time", "omron.max_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3570 { &hf_omron_min_cycle_time,
3571 { "Min cycle time", "omron.min_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3573 { "Year", "omron.year", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3575 { "Month", "omron.month", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3577 { "Date", "omron.date", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3579 { "Hour", "omron.hour", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3581 { "Minute", "omron.minute", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3583 { "Second", "omron.second", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3585 { "Day", "omron.day", FT_UINT8, BASE_DEC, VALS(omron_days), 0x0, NULL, HFILL }},
3586 { &hf_omron_read_message,
3587 { "Message", "omron.read_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3588 { &hf_omron_node_number,
3589 { "Node number", "omron.node_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3590 { &hf_omron_network_address,
3591 { "Network address", "omron.network_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3592 { &hf_omron_error_reset_fals_no,
3593 { "Error reset FAL no.", "omron.error_reset_fals_no", FT_UINT16, BASE_RANGE_STRING|BASE_HEX, RVALS(&omron_error_reset_range), 0x0, NULL, HFILL }},
3594 { &hf_omron_beginning_record_no,
3595 { "Beginning record no.", "omron.beginning_record_no", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3596 { &hf_omron_no_of_records,
3597 { "No. of records", "omron.no_of_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3598 { &hf_omron_max_no_of_stored_records,
3599 { "Max. no. of stored records", "omron.max_no_of_stored_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3600 { &hf_omron_no_of_stored_records,
3601 { "No. of stored records", "omron.no_stored_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3602 { &hf_omron_disk_no,
3603 { "Disk no.", "omron.disk_no", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3604 { &hf_omron_beginning_file_position,
3605 { "Beginning file position", "omron.beginning_file_position", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3606 { &hf_omron_no_of_files,
3607 { "No. of files", "omron.no_of_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3608 { &hf_omron_volume_label,
3609 { "Volume label", "omron.disk_data.volume_label", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3610 { &hf_omron_date_year,
3611 { "Year", "omron.disk_data.year", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3612 { &hf_omron_date_month,
3613 { "Month", "omron.disk_data.month", FT_UINT32, BASE_DEC, NULL, 0x01E00000, NULL, HFILL }},
3614 { &hf_omron_date_day,
3615 { "Day", "omron.disk_data.day", FT_UINT32, BASE_DEC, NULL, 0x001F0000, NULL, HFILL }},
3616 { &hf_omron_date_hour,
3617 { "Hour", "omron.disk_data.hour", FT_UINT32, BASE_DEC, NULL, 0x0000F800, NULL, HFILL }},
3618 { &hf_omron_date_minute,
3619 { "Minute", "omron.disk_data.minute", FT_UINT32, BASE_DEC, NULL, 0x000007E0, NULL, HFILL }},
3620 { &hf_omron_date_second,
3621 { "Second", "omron.disk_data.second", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3622 { &hf_omron_total_capacity,
3623 { "Total capacity", "omron.disk_data.total_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3624 { &hf_omron_unused_capacity,
3625 { "Unused capacity", "omron.disk_data.unused_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3626 { &hf_omron_total_no_files,
3627 { "Total no. of files", "omron.disk_data.total_no_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3628 { &hf_omron_no_files,
3629 { "No. of files", "omron.disk_data.no_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3630 { &hf_omron_filename,
3631 { "Filename", "omron.file_data.filename", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3632 { &hf_omron_file_capacity,
3633 { "File capacity", "omron.file_data.file_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3634 { &hf_omron_file_position,
3635 { "File position", "omron.file_position", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3636 { &hf_omron_data_length,
3637 { "Data length", "omron.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3638 { &hf_omron_file_data,
3639 { "File data", "omron.file_data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3640 { &hf_omron_file_parameter_code,
3641 { "Parameter code", "omron.file_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_file_parameter_codes), 0x0, NULL, HFILL }},
3642 { &hf_omron_volume_parameter_code,
3643 { "Volume parameter code", "omron.volume_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_volume_parameter_codes), 0x0, NULL, HFILL }},
3644 { &hf_omron_transfer_parameter_code,
3645 { "Parameter code", "omron.transfer_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_transfer_parameter_codes), 0x0, NULL, HFILL }},
3646 { &hf_omron_transfer_beginning_address,
3647 { "Beginning address", "omron.transfer_beginning_address", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3648 { &hf_omron_number_of_bytes,
3649 { "Number of bytes", "omron.number_of_bytes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3650 { &hf_omron_number_of_bits_flags,
3651 { "No. of bits/flags", "omron.number_of_bits_flags", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3652 { &hf_omron_set_reset_specification,
3653 { "Set/Reset Specification", "omron.set_reset_specification", FT_UINT16, BASE_HEX, VALS(omron_set_reset_specifications), 0x0, NULL, HFILL }},
3654 { &hf_omron_bit_flag,
3655 { "Bit/flag", "omron.bit_flag", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3657 { "Data", "omron.data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3658 { &hf_omron_beginning_block_num,
3659 { "Beginning block number", "omron.beginning_block_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3660 { &hf_omron_num_blocks,
3661 { "Number of blocks", "omron.num_blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3662 { &hf_omron_num_blocks_remaining,
3663 { "Number of blocks remaining", "omron.num_blocks_remaining", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3664 { &hf_omron_total_num_blocks,
3665 { "Total number of blocks", "omron.total_num_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3667 { "Type", "omron.type", FT_UINT8, BASE_HEX, VALS(omron_type_codes), 0x0, NULL, HFILL }},
3668 { &hf_omron_data_type,
3669 { "Data type", "omron.data_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3670 { &hf_omron_data_type_type,
3671 { "Data type", "omron.data_type_type", FT_UINT8, BASE_HEX, VALS(omron_data_type_bits), 0x07, NULL, HFILL }},
3672 { &hf_omron_data_type_rv,
3673 { "Reserved", "omron.data_type_rv", FT_UINT8, BASE_HEX, NULL, 0x38, NULL, HFILL }},
3674 { &hf_omron_data_type_protected,
3675 { "Protected", "omron.data_type_protected", FT_BOOLEAN, 8, TFS(&boolean_data_type_protected), 0x40, NULL, HFILL }},
3676 { &hf_omron_data_type_end,
3677 { "Block", "omron.data_type_end", FT_BOOLEAN, 8, TFS(&boolean_data_type_end), 0x80, NULL, HFILL }},
3678 { &hf_omron_control_data,
3679 { "Control data", "omron.control_data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3680 { &hf_omron_block_num,
3681 { "Block number", "omron.block_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3682 { &hf_omron_num_unit_uint16,
3683 { "Number of units", "omron.num_unit_uint16", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3685 { "Fixed", "omron.fixed", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3686 { &hf_omron_intelligent_id_no,
3687 { "Intelligent ID no.", "omron.intelligent_id_no", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3688 { &hf_omron_first_word,
3689 { "First word", "omron.first_word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3690 { &hf_omron_read_len,
3691 { "Read length", "omron.read_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3692 { &hf_omron_no_of_link_nodes,
3693 { "No. of link nodes", "omron.no_of_link_nodes", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
3694 { &hf_omron_block_record_node_num_status,
3695 { "Data link status", "omron.block_record.node_num_status", FT_BOOLEAN, 8, TFS(&boolean_node_num_status), 0x80, NULL, HFILL }},
3696 { &hf_omron_block_record_node_num_num_nodes,
3697 { "No. of link nodes", "omron.block_record.node_num_num_nodes", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
3698 { &hf_omron_block_record_cio_area,
3699 { "CIO Area first word", "omron.block_record.cio_area", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3700 { &hf_omron_block_record_kind_of_dm,
3701 { "Kind of DM", "omron.block_record.kind_of_dm", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3702 { &hf_omron_block_record_dm_area_first_word,
3703 { "DM Area first word", "omron.block_record.dm_area_first_word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3704 { &hf_omron_block_record_no_of_total_words,
3705 { "No. of total words", "omron.block_record.no_of_total_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3706 { &hf_omron_status_flags,
3707 { "Status flags", "omron.status_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3708 { &hf_omron_status_flags_slave_master,
3709 { "Status Type", "omron.status_flags.slave_master", FT_BOOLEAN, 8, TFS(&boolean_status_flags_slave_master), 0x80, NULL, HFILL }},
3710 { &hf_omron_status_flags_data_link,
3711 { "Status Data link", "omron.status_flags.data_link", FT_BOOLEAN, 8, TFS(&boolean_status_flags_data_link), 0x01, NULL, HFILL }},
3712 { &hf_omron_master_node_number,
3713 { "Master node number", "omron.master_node_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3714 { &hf_omron_status_node_0,
3715 { "Node 0", "omron.status.node.0", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x01, NULL, HFILL }},
3716 { &hf_omron_status_node_1,
3717 { "Node 1", "omron.status.node.1", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x02, NULL, HFILL }},
3718 { &hf_omron_status_node_2,
3719 { "Node 2", "omron.status.node.2", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x04, NULL, HFILL }},
3720 { &hf_omron_status_node_3,
3721 { "Node 3", "omron.status.node.3", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x08, NULL, HFILL }},
3722 { &hf_omron_status_node_4,
3723 { "Node 4", "omron.status.node.4", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x10, NULL, HFILL }},
3724 { &hf_omron_status_node_5,
3725 { "Node 5", "omron.status.node.5", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x20, NULL, HFILL }},
3726 { &hf_omron_status_node_6,
3727 { "Node 6", "omron.status.node.6", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x40, NULL, HFILL }},
3728 { &hf_omron_status_node_7,
3729 { "Node 7", "omron.status.node.7", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x80, NULL, HFILL }},
3730 { &hf_omron_status_1_node_0,
3731 { "Node 0", "omron.status.node.10", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x01, NULL, HFILL }},
3732 { &hf_omron_status_1_node_1,
3733 { "Node 1", "omron.status.node.11", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x02, NULL, HFILL }},
3734 { &hf_omron_status_1_node_2,
3735 { "Node 2", "omron.status.node.12", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x04, NULL, HFILL }},
3736 { &hf_omron_status_1_node_3,
3737 { "Node 3", "omron.status.node.13", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x08, NULL, HFILL }},
3738 { &hf_omron_status_1_node_4,
3739 { "Node 4", "omron.status.node.14", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x10, NULL, HFILL }},
3740 { &hf_omron_status_1_node_5,
3741 { "Node 5", "omron.status.node.15", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x20, NULL, HFILL }},
3742 { &hf_omron_status_1_node_6,
3743 { "Node 6", "omron.status.node.16", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x40, NULL, HFILL }},
3744 { &hf_omron_status_1_node_7,
3745 { "Node 7", "omron.status.node.17", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x80, NULL, HFILL }},
3746 { &hf_omron_status_2_node_0,
3747 { "Node 0", "omron.status.node.20", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x01, NULL, HFILL }},
3748 { &hf_omron_status_2_node_1,
3749 { "Node 1", "omron.status.node.21", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x02, NULL, HFILL }},
3750 { &hf_omron_status_2_node_2,
3751 { "Node 2", "omron.status.node.22", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x04, NULL, HFILL }},
3752 { &hf_omron_status_2_node_3,
3753 { "Node 3", "omron.status.node.23", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x08, NULL, HFILL }},
3754 { &hf_omron_status_2_node_4,
3755 { "Node 4", "omron.status.node.24", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x10, NULL, HFILL }},
3756 { &hf_omron_status_2_node_5,
3757 { "Node 5", "omron.status.node.25", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x20, NULL, HFILL }},
3758 { &hf_omron_status_2_node_6,
3759 { "Node 6", "omron.status.node.26", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x40, NULL, HFILL }},
3760 { &hf_omron_status_2_node_7,
3761 { "Node 7", "omron.status.node.27", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x80, NULL, HFILL }},
3762 { &hf_omron_name_data,
3763 { "Name data", "omron.name_data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3764 { &hf_omron_num_receptions,
3765 { "Number of receptions", "omron.num_receptions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3766 { &hf_omron_netw_node_sts_low_0,
3767 { "Network", "omron.node_number.low.network", FT_BOOLEAN, 8, TFS(&boolean_member_network), 0x01, NULL, HFILL }},
3768 { &hf_omron_netw_node_sts_low_1,
3769 { "Exit status", "omron.node_number.low.exit_status", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x02, NULL, HFILL }},
3770 { &hf_omron_netw_node_sts_low_2,
3771 { "Reserved", "omron.node_number.low.rv", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3772 { &hf_omron_netw_node_sts_low_3,
3773 { "Polling", "omron.node_number.low.polling_Status", FT_BOOLEAN, 8, TFS(&boolean_member_polling), 0x08, NULL, HFILL }},
3774 { &hf_omron_netw_node_sts_high_0,
3775 { "Network", "omron.node_number.high.network", FT_BOOLEAN, 8, TFS(&boolean_member_network), 0x10, NULL, HFILL }},
3776 { &hf_omron_netw_node_sts_high_1,
3777 { "Exit status", "omron.node_number.high.exit_status", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x20, NULL, HFILL }},
3778 { &hf_omron_netw_node_sts_high_2,
3779 { "Reserved", "omron.node_number.high.rv", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
3780 { &hf_omron_netw_node_sts_high_3,
3781 { "Polling", "omron.node_number.high.polling_Status", FT_BOOLEAN, 8, TFS(&boolean_member_polling), 0x80, NULL, HFILL }},
3782 { &hf_omron_com_cycle_time,
3783 { "Communications cycle time (usec)", "omron.com_cycle_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3784 { &hf_omron_polling_unit_node_num,
3785 { "Current polling unit node number", "omron.polling_unit_node_num", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3786 { &hf_omron_cyclic_operation,
3787 { "Cyclic operation", "omron.cyclic_operation", FT_UINT8, BASE_HEX, VALS(omron_cyclic_ops_codes), 0x0, NULL, HFILL }},
3788 { &hf_omron_cyclic_trans_status,
3789 { "Cyclic transmission status", "omron.cyclic_trans_status", FT_UINT8, BASE_HEX, VALS(omron_cyclic_trans_codes), 0x0, NULL, HFILL }},
3790 { &hf_omron_cyclic_label_1,
3791 { "Nodes 1- 7", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3792 { &hf_omron_cyclic_7,
3793 { "Node 7 error status", "omron.cyclic_error.node.7", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3794 { &hf_omron_cyclic_6,
3795 { "Node 6 error status", "omron.cyclic_error.node.6", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3796 { &hf_omron_cyclic_5,
3797 { "Node 5 error status", "omron.cyclic_error.node.5", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3798 { &hf_omron_cyclic_4,
3799 { "Node 4 error status", "omron.cyclic_error.node.4", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3800 { &hf_omron_cyclic_3,
3801 { "Node 3 error status", "omron.cyclic_error.node.3", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3802 { &hf_omron_cyclic_2,
3803 { "Node 2 error status", "omron.cyclic_error.node.2", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3804 { &hf_omron_cyclic_1,
3805 { "Node 1 error status", "omron.cyclic_error.node.1", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3806 { &hf_omron_cyclic_label_2,
3807 { "Nodes 8-15", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3808 { &hf_omron_cyclic_15,
3809 { "Node 15 error status", "omron.cyclic_error.node.15", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3810 { &hf_omron_cyclic_14,
3811 { "Node 14 error status", "omron.cyclic_error.node.14", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3812 { &hf_omron_cyclic_13,
3813 { "Node 13 error status", "omron.cyclic_error.node.13", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3814 { &hf_omron_cyclic_12,
3815 { "Node 12 error status", "omron.cyclic_error.node.12", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3816 { &hf_omron_cyclic_11,
3817 { "Node 11 error status", "omron.cyclic_error.node.11", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3818 { &hf_omron_cyclic_10,
3819 { "Node 10 error status", "omron.cyclic_error.node.10", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3820 { &hf_omron_cyclic_9,
3821 { "Node 9 error status", "omron.cyclic_error.node.9", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3822 { &hf_omron_cyclic_8,
3823 { "Node 8 error status", "omron.cyclic_error.node.8", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3824 { &hf_omron_cyclic_label_3,
3825 { "Nodes 16-23", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3826 { &hf_omron_cyclic_23,
3827 { "Node 23 error status", "omron.cyclic_error.node.23", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3828 { &hf_omron_cyclic_22,
3829 { "Node 22 error status", "omron.cyclic_error.node.22", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3830 { &hf_omron_cyclic_21,
3831 { "Node 21 error status", "omron.cyclic_error.node.21", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3832 { &hf_omron_cyclic_20,
3833 { "Node 20 error status", "omron.cyclic_error.node.20", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3834 { &hf_omron_cyclic_19,
3835 { "Node 19 error status", "omron.cyclic_error.node.19", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3836 { &hf_omron_cyclic_18,
3837 { "Node 18 error status", "omron.cyclic_error.node.18", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3838 { &hf_omron_cyclic_17,
3839 { "Node 17 error status", "omron.cyclic_error.node.17", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3840 { &hf_omron_cyclic_16,
3841 { "Node 16 error status", "omron.cyclic_error.node.16", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3842 { &hf_omron_cyclic_label_4,
3843 { "Nodes 24-31", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3844 { &hf_omron_cyclic_31,
3845 { "Node 31 error status", "omron.cyclic_error.node.31", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3846 { &hf_omron_cyclic_30,
3847 { "Node 30 error status", "omron.cyclic_error.node.30", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3848 { &hf_omron_cyclic_29,
3849 { "Node 29 error status", "omron.cyclic_error.node.29", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3850 { &hf_omron_cyclic_28,
3851 { "Node 28 error status", "omron.cyclic_error.node.28", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3852 { &hf_omron_cyclic_27,
3853 { "Node 27 error status", "omron.cyclic_error.node.27", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3854 { &hf_omron_cyclic_26,
3855 { "Node 26 error status", "omron.cyclic_error.node.26", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3856 { &hf_omron_cyclic_25,
3857 { "Node 25 error status", "omron.cyclic_error.node.25", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3858 { &hf_omron_cyclic_24,
3859 { "Node 24 error status", "omron.cyclic_error.node.24", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3860 { &hf_omron_cyclic_label_5,
3861 { "Nodes 32-39", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3862 { &hf_omron_cyclic_39,
3863 { "Node 39 error status", "omron.cyclic_error.node.39", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3864 { &hf_omron_cyclic_38,
3865 { "Node 38 error status", "omron.cyclic_error.node.38", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3866 { &hf_omron_cyclic_37,
3867 { "Node 37 error status", "omron.cyclic_error.node.37", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3868 { &hf_omron_cyclic_36,
3869 { "Node 36 error status", "omron.cyclic_error.node.36", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3870 { &hf_omron_cyclic_35,
3871 { "Node 35 error status", "omron.cyclic_error.node.35", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3872 { &hf_omron_cyclic_34,
3873 { "Node 34 error status", "omron.cyclic_error.node.34", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3874 { &hf_omron_cyclic_33,
3875 { "Node 33 error status", "omron.cyclic_error.node.33", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3876 { &hf_omron_cyclic_32,
3877 { "Node 32 error status", "omron.cyclic_error.node.32", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3878 { &hf_omron_cyclic_label_6,
3879 { "Nodes 40-47", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3880 { &hf_omron_cyclic_47,
3881 { "Node 47 error status", "omron.cyclic_error.node.47", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3882 { &hf_omron_cyclic_46,
3883 { "Node 46 error status", "omron.cyclic_error.node.46", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3884 { &hf_omron_cyclic_45,
3885 { "Node 45 error status", "omron.cyclic_error.node.45", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3886 { &hf_omron_cyclic_44,
3887 { "Node 44 error status", "omron.cyclic_error.node.44", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3888 { &hf_omron_cyclic_43,
3889 { "Node 43 error status", "omron.cyclic_error.node.43", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3890 { &hf_omron_cyclic_42,
3891 { "Node 42 error status", "omron.cyclic_error.node.42", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3892 { &hf_omron_cyclic_41,
3893 { "Node 41 error status", "omron.cyclic_error.node.41", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3894 { &hf_omron_cyclic_40,
3895 { "Node 40 error status", "omron.cyclic_error.node.40", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3896 { &hf_omron_cyclic_label_7,
3897 { "Nodes 48-55", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3898 { &hf_omron_cyclic_55,
3899 { "Node 55 error status", "omron.cyclic_error.node.55", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
3900 { &hf_omron_cyclic_54,
3901 { "Node 54 error status", "omron.cyclic_error.node.54", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3902 { &hf_omron_cyclic_53,
3903 { "Node 53 error status", "omron.cyclic_error.node.53", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3904 { &hf_omron_cyclic_52,
3905 { "Node 52 error status", "omron.cyclic_error.node.52", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3906 { &hf_omron_cyclic_51,
3907 { "Node 51 error status", "omron.cyclic_error.node.51", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3908 { &hf_omron_cyclic_50,
3909 { "Node 50 error status", "omron.cyclic_error.node.50", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3910 { &hf_omron_cyclic_49,
3911 { "Node 49 error status", "omron.cyclic_error.node.49", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3912 { &hf_omron_cyclic_48,
3913 { "Node 48 error status", "omron.cyclic_error.node.48", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3914 { &hf_omron_cyclic_label_8,
3915 { "Nodes 56-62", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3916 { &hf_omron_cyclic_62,
3917 { "Node 62 error status", "omron.cyclic_error.node.62", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
3918 { &hf_omron_cyclic_61,
3919 { "Node 61 error status", "omron.cyclic_error.node.61", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
3920 { &hf_omron_cyclic_60,
3921 { "Node 60 error status", "omron.cyclic_error.node.60", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
3922 { &hf_omron_cyclic_59,
3923 { "Node 59 error status", "omron.cyclic_error.node.59", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
3924 { &hf_omron_cyclic_58,
3925 { "Node 58 error status", "omron.cyclic_error.node.58", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
3926 { &hf_omron_cyclic_57,
3927 { "Node 57 error status", "omron.cyclic_error.node.57", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
3928 { &hf_omron_cyclic_56,
3929 { "Node 56 error status", "omron.cyclic_error.node.56", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3930 { &hf_omron_node_error_count,
3931 { "Node error count", "omron.node_error_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}
3934 /* Setup protocol subtree array */
3935 static gint *ett[] = {
3938 &ett_omron_icf_fields,
3939 &ett_omron_command_data,
3943 &ett_pc_status_fields,
3945 &ett_non_fatal_fields,
3946 &ett_message_fields,
3947 &ett_omron_error_log_data,
3948 &ett_omron_disk_data,
3949 &ett_omron_file_data,
3950 &ett_omron_data_type,
3951 &ett_omron_block_record,
3952 &ett_omron_status_block,
3953 &ett_omron_cyclic_fields,
3954 &ett_omron_netw_nodes_sts,
3955 &ett_omron_netw_node_sts,
3956 &ett_omron_netw_nodes_non_fatal_err_sts,
3957 &ett_omron_netw_nodes_cyclic_err_ctrs,
3958 &ett_omron_data_link_status_tree,
3961 /* Register the protocol name and description */
3962 proto_omron_fins = proto_register_protocol (
3963 "OMRON FINS Protocol", /* name */
3964 "OMRON-FINS", /* short name */
3965 "omron" /* abbrev */
3968 /* Required function calls to register the header fields and subtrees used */
3969 proto_register_field_array(proto_omron_fins, hf, array_length(hf));
3970 proto_register_subtree_array(ett, array_length(ett));
3973 /*Register preferences module (See Section 2.6 for more on preferences) */
3974 omron_fins_module = prefs_register_protocol(proto_omron_fins, NULL);
3976 /* Register a sample preference */
3977 prefs_register_bool_preference(omron_fins_module, "show_hex",
3978 "Display numbers in Hex",
3979 "Enable to display numerical values in hexadecimal.",
3985 proto_reg_handoff_omron_fins(void)
3987 dissector_handle_t omron_fins_handle;
3989 omron_fins_handle = new_create_dissector_handle(dissect_omron_fins, proto_omron_fins);
3990 dissector_add("udp.port", OMRON_FINS_UDP_PORT, omron_fins_handle);