summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-omron-fins.c
blob: ce528bd74955d0d1addefe7cb4b1806189e02cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
/* packet-omron-fins.c
 * Routines for OMRON FINS UDP dissection
 * Copyright Sourcefire, Inc. 2008-2009, Matthew Watchinski <mwatchinski@sourcefire.com>
 *
 * Omron FINS/TCP Support
 * Copyright 2019 Kevin Herron <kevinherron@gmail.com>
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * Reference for OMRON-FINS W227_E1_02_FINS_Command_Reference_Manual
 * Hopefully google will find it for you.
 *
 * Special thanks to the guys who wrote the README.developer: it's great.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */


#include "config.h"
#include "packet-tcp.h"

#include <epan/packet.h>
#include <epan/expert.h>
void proto_register_omron_fins(void);
void proto_reg_handoff_omron_fins(void);

static dissector_handle_t omron_fins_tcp_handle;
static dissector_handle_t omron_fins_udp_handle;

#define OMRON_FINS_TCP_PORT 9600 /* Not IANA registered */
#define OMRON_FINS_UDP_PORT 9600 /* Not IANA registered */
#define OMRON_FINS_TCP_MAGIC_BYTES 0x46494e53 /* ASCII 'FINS' */

static int proto_omron_fins = -1;
static gint ett_omron = -1;
static gint ett_omron_tcp_header = -1;
static gint ett_omron_header = -1;
static gint ett_omron_icf_fields = -1;
static gint ett_omron_command_data = -1;
static gint ett_area_data = -1;
static gint ett_cpu_bus = -1;
static gint ett_io_data = -1;
static gint ett_pc_status_fields = -1;
static gint ett_fatal_fields = -1;
static gint ett_non_fatal_fields = -1;
static gint ett_message_fields = -1;
static gint ett_omron_error_log_data = -1;
static gint ett_omron_disk_data = -1;
static gint ett_omron_file_data = -1;
static gint ett_omron_data_type = -1;
static gint ett_omron_block_record = -1;
static gint ett_omron_status_block = -1;
static gint ett_omron_cyclic_fields = -1;
static gint ett_omron_netw_nodes_sts = -1;
static gint ett_omron_netw_node_sts = -1;
static gint ett_omron_netw_nodes_non_fatal_err_sts = -1;
static gint ett_omron_netw_nodes_cyclic_err_ctrs = -1;
static gint ett_omron_data_link_status_tree = -1;

#if 0
static gboolean gPREF_HEX = FALSE;
#endif

/* TCP Header fields */
static int hf_omron_tcp_magic = -1;
static int hf_omron_tcp_length = -1;
static int hf_omron_tcp_command = -1;
static int hf_omron_tcp_error_code = -1;
static int hf_omron_tcp_client_node_address = -1;
static int hf_omron_tcp_server_node_address = -1;

/* Omron-FINS Header fields */
static int hf_omron_icf = -1;

static int hf_omron_icf_gwb = -1; /* Gateway usage (0: don't use; 1: use) should be 1 */
static int hf_omron_icf_dtb = -1; /* Data type (0: command 1: response) */
static int hf_omron_icf_rb0 = -1; /* Reserved should be 0 */
static int hf_omron_icf_rb1 = -1; /* Reserved should be 0 */
static int hf_omron_icf_rb2 = -1; /* Reserved should be 0 */
static int hf_omron_icf_rb3 = -1; /* Reserved should be 0 */
static int hf_omron_icf_rb4 = -1; /* Reserved should be 0 */
static int hf_omron_icf_rsb = -1; /* Response setting (0: response required; 1: response not required) */

static int hf_omron_rsv = -1;
static int hf_omron_gct = -1;
static int hf_omron_dna = -1;
static int hf_omron_da1 = -1;
static int hf_omron_da2 = -1;
static int hf_omron_sna = -1;
static int hf_omron_sa1 = -1;
static int hf_omron_sa2 = -1;
static int hf_omron_sid = -1;

static int hf_omron_command                  = -1;
static int hf_omron_command_data             = -1;
static int hf_omron_command_memory_area_code = -1;
static int hf_omron_response_code            = -1;

static int hf_omron_address      = -1;
static int hf_omron_address_bits = -1;
static int hf_omron_num_items    = -1;

static int hf_omron_response_data       = -1;
static int hf_omron_parameter_area_code = -1;

static int hf_omron_beginning_word = -1;
static int hf_omron_num_words = -1;

static int hf_omron_program_number = -1;
static int hf_omron_protect_code   = -1;
static int hf_omron_begin_word     = -1;
static int hf_omron_last_word      = -1;
static int hf_omron_password       = -1;

static int hf_omron_clear_code    = -1;
static int hf_omron_mode_code     = -1;
static int hf_omron_monitor_label = -1;

static int hf_omron_controller_model   = -1;
static int hf_omron_controller_version = -1;
static int hf_omron_for_system_use     = -1;

static int hf_omron_program_area_size    = -1;
static int hf_omron_iom_size             = -1;
static int hf_omron_num_dm_words         = -1;
static int hf_omron_timer_counter_size   = -1;
static int hf_omron_expansion_dm_size    = -1;
static int hf_omron_num_step_transitions = -1;
static int hf_omron_kind_memory_card     = -1;
static int hf_omron_memory_card_size     = -1;

static int hf_omron_cpu_bus_unit_0   = -1;
static int hf_omron_cpu_bus_unit_1   = -1;
static int hf_omron_cpu_bus_unit_2   = -1;
static int hf_omron_cpu_bus_unit_3   = -1;
static int hf_omron_cpu_bus_unit_4   = -1;
static int hf_omron_cpu_bus_unit_5   = -1;
static int hf_omron_cpu_bus_unit_6   = -1;
static int hf_omron_cpu_bus_unit_7   = -1;
static int hf_omron_cpu_bus_unit_8   = -1;
static int hf_omron_cpu_bus_unit_9   = -1;
static int hf_omron_cpu_bus_unit_10  = -1;
static int hf_omron_cpu_bus_unit_11  = -1;
static int hf_omron_cpu_bus_unit_12  = -1;
static int hf_omron_cpu_bus_unit_13  = -1;
static int hf_omron_cpu_bus_unit_14  = -1;
static int hf_omron_cpu_bus_unit_15  = -1;
static int hf_omron_cpu_bus_reserved = -1;

static int hf_omron_io_data_num_sysmac_1 = -1;
static int hf_omron_io_data_num_sysmac_2 = -1;

static int hf_omron_pc_status          = -1;
static int hf_omron_pc_status_pdc      = -1;
static int hf_omron_pc_status_hi       = -1;
static int hf_omron_pc_status_r1       = -1;
static int hf_omron_pc_status_r2       = -1;
static int hf_omron_pc_status_rack_num = -1;

static int hf_omron_unit_address = -1;
static int hf_omron_num_units    = -1;
static int hf_omron_model_number = -1;

static int hf_omron_status                      = -1;
static int hf_omron_fatal_error_data            = -1;
static int hf_omron_fatal_fals_error            = -1;
static int hf_omron_fatal_sfc_error             = -1;
static int hf_omron_fatal_cycle_time_over       = -1;
static int hf_omron_fatal_program_error         = -1;
static int hf_omron_fatal_io_setting_error      = -1;
static int hf_omron_fatal_io_point_overflow     = -1;
static int hf_omron_fatal_cpu_bus_error         = -1;
static int hf_omron_fatal_duplication_error     = -1;
static int hf_omron_fatal_io_bus_error          = -1;
static int hf_omron_fatal_memory_error          = -1;
static int hf_omron_fatal_rv_1                  = -1;
static int hf_omron_fatal_rv_2                  = -1;
static int hf_omron_fatal_rv_3                  = -1;
static int hf_omron_fatal_rv_4                  = -1;
static int hf_omron_fatal_rv_5                  = -1;
static int hf_omron_fatal_watch_dog_timer_error = -1;

static int hf_omron_non_fatal_error_data                 = -1;
static int hf_omron_non_fatal_rv1                        = -1;
static int hf_omron_non_fatal_rv2                        = -1;
static int hf_omron_non_fatal_power_interruption         = -1;
static int hf_omron_non_fatal_cpu_bus_unit_setting_error = -1;
static int hf_omron_non_fatal_battery_error              = -1;
static int hf_omron_non_fatal_sysmac_bus_error           = -1;
static int hf_omron_non_fatal_sysmac_bus2_error          = -1;
static int hf_omron_non_fatal_cpu_bus_unit_error         = -1;
static int hf_omron_non_fatal_rv3                        = -1;
static int hf_omron_non_fatal_io_verification_error      = -1;
static int hf_omron_non_fatal_rv4                        = -1;
static int hf_omron_non_fatal_sfc_error                  = -1;
static int hf_omron_non_fatal_indirect_dm_error          = -1;
static int hf_omron_non_fatal_jmp_error                  = -1;
static int hf_omron_non_fatal_rv5                        = -1;
static int hf_omron_non_fatal_fal_error                  = -1;

static int hf_omron_message = -1;
static int hf_omron_message_no_0 = -1;
static int hf_omron_message_no_1 = -1;
static int hf_omron_message_no_2 = -1;
static int hf_omron_message_no_3 = -1;
static int hf_omron_message_no_4 = -1;
static int hf_omron_message_no_5 = -1;
static int hf_omron_message_no_6 = -1;
static int hf_omron_message_no_7 = -1;
static int hf_omron_message_rv_0 = -1;
static int hf_omron_message_rv_1 = -1;
static int hf_omron_message_rv_2 = -1;
static int hf_omron_message_rv_3 = -1;
static int hf_omron_message_rv_4 = -1;
static int hf_omron_message_rv_5 = -1;
static int hf_omron_message_rv_6 = -1;
static int hf_omron_message_rv_7 = -1;

static int hf_omron_fals          = -1;
static int hf_omron_error_message = -1;

static int hf_omron_parameter      = -1;
static int hf_omron_avg_cycle_time = -1;
static int hf_omron_max_cycle_time = -1;
static int hf_omron_min_cycle_time = -1;

static int hf_omron_year   = -1;
static int hf_omron_month  = -1;
static int hf_omron_date   = -1;
static int hf_omron_hour   = -1;
static int hf_omron_minute = -1;
static int hf_omron_second = -1;
static int hf_omron_day    = -1;

static int hf_omron_read_message = -1;

static int hf_omron_node_number     = -1;
static int hf_omron_network_address = -1;

static int hf_omron_error_reset_fals_no = -1;

static int hf_omron_beginning_record_no      = -1;
static int hf_omron_no_of_records            = -1;
static int hf_omron_max_no_of_stored_records = -1;
static int hf_omron_no_of_stored_records     = -1;

static int hf_omron_disk_no                 = -1;
static int hf_omron_beginning_file_position = -1;
static int hf_omron_no_of_files             = -1;

static int hf_omron_volume_label    = -1;
static int hf_omron_date_year       = -1;
static int hf_omron_date_month      = -1;
static int hf_omron_date_day        = -1;
static int hf_omron_date_hour       = -1;
static int hf_omron_date_minute     = -1;
static int hf_omron_date_second     = -1;
static int hf_omron_total_capacity  = -1;
static int hf_omron_unused_capacity = -1;
static int hf_omron_total_no_files  = -1;
static int hf_omron_no_files        = -1;
static int hf_omron_filename        = -1;
static int hf_omron_file_capacity   = -1;

static int hf_omron_file_position       = -1;
static int hf_omron_data_length         = -1;
static int hf_omron_file_data           = -1;
static int hf_omron_file_parameter_code = -1;

static int hf_omron_volume_parameter_code   = -1;
static int hf_omron_transfer_parameter_code = -1;

static int hf_omron_transfer_beginning_address = -1;
static int hf_omron_number_of_bytes            = -1;

static int hf_omron_number_of_bits_flags    = -1;
static int hf_omron_set_reset_specification = -1;
static int hf_omron_bit_flag                = -1;

static int hf_omron_data = -1;

static int hf_omron_beginning_block_num  = -1;
static int hf_omron_num_blocks           = -1;
static int hf_omron_num_blocks_remaining = -1;
static int hf_omron_total_num_blocks     = -1;
static int hf_omron_type                 = -1;
static int hf_omron_data_type            = -1;
static int hf_omron_data_type_type       = -1;
static int hf_omron_data_type_rv         = -1;
static int hf_omron_data_type_protected  = -1;
static int hf_omron_data_type_end        = -1;
static int hf_omron_control_data         = -1;

static int hf_omron_block_num       = -1;
static int hf_omron_num_unit_uint16 = -1;

static int hf_omron_fixed                           = -1;
static int hf_omron_intelligent_id_no               = -1;
static int hf_omron_first_word                      = -1;
static int hf_omron_read_len                        = -1;
static int hf_omron_no_of_link_nodes                = -1;
static int hf_omron_block_record_node_num_status    = -1;
static int hf_omron_block_record_node_num_num_nodes = -1;
static int hf_omron_block_record_cio_area           = -1;
static int hf_omron_block_record_kind_of_dm         = -1;
static int hf_omron_block_record_dm_area_first_word = -1;
static int hf_omron_block_record_no_of_total_words  = -1;

static int hf_omron_status_flags              = -1;
static int hf_omron_status_flags_slave_master = -1;
static int hf_omron_status_flags_data_link    = -1;
static int hf_omron_master_node_number        = -1;
static int hf_omron_status_node_0             = -1;
static int hf_omron_status_node_1             = -1;
static int hf_omron_status_node_2             = -1;
static int hf_omron_status_node_3             = -1;
static int hf_omron_status_node_4             = -1;
static int hf_omron_status_node_5             = -1;
static int hf_omron_status_node_6             = -1;
static int hf_omron_status_node_7             = -1;
static int hf_omron_status_1_node_0           = -1;
static int hf_omron_status_1_node_1           = -1;
static int hf_omron_status_1_node_2           = -1;
static int hf_omron_status_1_node_3           = -1;
static int hf_omron_status_1_node_4           = -1;
static int hf_omron_status_1_node_5           = -1;
static int hf_omron_status_1_node_6           = -1;
static int hf_omron_status_1_node_7           = -1;
static int hf_omron_status_2_node_0           = -1;
static int hf_omron_status_2_node_1           = -1;
static int hf_omron_status_2_node_2           = -1;
static int hf_omron_status_2_node_3           = -1;
static int hf_omron_status_2_node_4           = -1;
static int hf_omron_status_2_node_5           = -1;
static int hf_omron_status_2_node_6           = -1;
static int hf_omron_status_2_node_7           = -1;

static int hf_omron_name_data = -1;

static int hf_omron_num_receptions = -1;

static int hf_omron_netw_node_sts_low_0   = -1;
static int hf_omron_netw_node_sts_low_1   = -1;
static int hf_omron_netw_node_sts_low_2   = -1;
static int hf_omron_netw_node_sts_low_3   = -1;
static int hf_omron_netw_node_sts_high_0  = -1;
static int hf_omron_netw_node_sts_high_1  = -1;
static int hf_omron_netw_node_sts_high_2  = -1;
static int hf_omron_netw_node_sts_high_3  = -1;
static int hf_omron_com_cycle_time        = -1;
static int hf_omron_polling_unit_node_num = -1;
static int hf_omron_cyclic_operation      = -1;
static int hf_omron_cyclic_trans_status   = -1;

static int hf_omron_cyclic_label_1   = -1;
static int hf_omron_cyclic_7         = -1;
static int hf_omron_cyclic_6         = -1;
static int hf_omron_cyclic_5         = -1;
static int hf_omron_cyclic_4         = -1;
static int hf_omron_cyclic_3         = -1;
static int hf_omron_cyclic_2         = -1;
static int hf_omron_cyclic_1         = -1;
static int hf_omron_cyclic_label_2   = -1;
static int hf_omron_cyclic_15        = -1;
static int hf_omron_cyclic_14        = -1;
static int hf_omron_cyclic_13        = -1;
static int hf_omron_cyclic_12        = -1;
static int hf_omron_cyclic_11        = -1;
static int hf_omron_cyclic_10        = -1;
static int hf_omron_cyclic_9         = -1;
static int hf_omron_cyclic_8         = -1;
static int hf_omron_cyclic_label_3   = -1;
static int hf_omron_cyclic_23        = -1;
static int hf_omron_cyclic_22        = -1;
static int hf_omron_cyclic_21        = -1;
static int hf_omron_cyclic_20        = -1;
static int hf_omron_cyclic_19        = -1;
static int hf_omron_cyclic_18        = -1;
static int hf_omron_cyclic_17        = -1;
static int hf_omron_cyclic_16        = -1;
static int hf_omron_cyclic_label_4   = -1;
static int hf_omron_cyclic_31        = -1;
static int hf_omron_cyclic_30        = -1;
static int hf_omron_cyclic_29        = -1;
static int hf_omron_cyclic_28        = -1;
static int hf_omron_cyclic_27        = -1;
static int hf_omron_cyclic_26        = -1;
static int hf_omron_cyclic_25        = -1;
static int hf_omron_cyclic_24        = -1;
static int hf_omron_cyclic_label_5   = -1;
static int hf_omron_cyclic_39        = -1;
static int hf_omron_cyclic_38        = -1;
static int hf_omron_cyclic_37        = -1;
static int hf_omron_cyclic_36        = -1;
static int hf_omron_cyclic_35        = -1;
static int hf_omron_cyclic_34        = -1;
static int hf_omron_cyclic_33        = -1;
static int hf_omron_cyclic_32        = -1;
static int hf_omron_cyclic_label_6   = -1;
static int hf_omron_cyclic_47        = -1;
static int hf_omron_cyclic_46        = -1;
static int hf_omron_cyclic_45        = -1;
static int hf_omron_cyclic_44        = -1;
static int hf_omron_cyclic_43        = -1;
static int hf_omron_cyclic_42        = -1;
static int hf_omron_cyclic_41        = -1;
static int hf_omron_cyclic_40        = -1;
static int hf_omron_cyclic_label_7   = -1;
static int hf_omron_cyclic_55        = -1;
static int hf_omron_cyclic_54        = -1;
static int hf_omron_cyclic_53        = -1;
static int hf_omron_cyclic_52        = -1;
static int hf_omron_cyclic_51        = -1;
static int hf_omron_cyclic_50        = -1;
static int hf_omron_cyclic_49        = -1;
static int hf_omron_cyclic_48        = -1;
static int hf_omron_cyclic_label_8   = -1;
static int hf_omron_cyclic_62        = -1;
static int hf_omron_cyclic_61        = -1;
static int hf_omron_cyclic_60        = -1;
static int hf_omron_cyclic_59        = -1;
static int hf_omron_cyclic_58        = -1;
static int hf_omron_cyclic_57        = -1;
static int hf_omron_cyclic_56        = -1;
static int hf_omron_node_error_count = -1;

static expert_field ei_omron_command_code = EI_INIT;
static expert_field ei_omron_bad_length = EI_INIT;
static expert_field ei_oomron_command_memory_area_code = EI_INIT;


/* Defines */
#define TCP_CMD_NODE_ADDRESS_DATA_SEND_CLIENT   0x00
#define TCP_CMD_NODE_ADDRESS_DATA_SEND_SERVER   0x01
#define TCP_CMD_FRAME_SEND                      0x02
#define TCP_CMD_FRAME_SEND_ERROR_NOTIFICATION   0x03
#define TCP_CMD_CONNECTION_CONFIRMATION         0x06

#define ICF_GW_MASK  0x80
#define ICF_GW_DUSE  0x00
#define ICF_GW_USE   0x01

#define ICF_DTB_MASK 0x40
#define ICF_DTB_CMD  0x00
#define ICF_DTB_RESP 0x01

#define ICF_RB0_MASK 0x20
#define ICF_RB1_MASK 0x10
#define ICF_RB2_MASK 0x08
#define ICF_RB3_MASK 0x04
#define ICF_RB4_MASK 0x02

#define ICF_RSB_MASK 0x01
#define ICF_RSB_DUSE 0x00
#define ICF_RSB_USE  0x01

#define INT_DNA_MIN1 0x00
#define INT_DNA_MAX1 0x00
#define INT_DNA_MIN2 0x01
#define INT_DNA_MAX2 0x7F

#define INT_DA1_MIN1 0x00
#define INT_DA1_MAX1 0x3E
#define INT_DA1_MIN2 0x3F
#define INT_DA1_MAX2 0x7E
#define INT_DA1_MIN3 0xFF
#define INT_DA1_MAX3 0xFF

#define INT_DA2_MIN1 0x00
#define INT_DA2_MAX1 0x00
#define INT_DA2_MIN2 0xFE
#define INT_DA2_MAX2 0xFE
#define INT_DA2_MIN3 0x10
#define INT_DA2_MAX3 0x1F

#define INT_SNA_MIN1 0x00
#define INT_SNA_MAX1 0x00
#define INT_SNA_MIN2 0x01
#define INT_SNA_MAX2 0x7F

#define INT_SA1_MIN1 0x00
#define INT_SA1_MAX1 0x3E
#define INT_SA1_MIN2 0x3F
#define INT_SA1_MAX2 0x7E
#define INT_SA1_MIN3 0xFF
#define INT_SA1_MAX3 0xFF

#define INT_SA2_MIN1 0x00
#define INT_SA2_MAX1 0x00
#define INT_SA2_MIN2 0xFE
#define INT_SA2_MAX2 0xFE
#define INT_SA2_MIN3 0x10
#define INT_SA2_MAX3 0x1F


/* Constants used for display */
static const value_string icf_gw_vals[] = {
    { ICF_GW_DUSE, "Don't use Gateway"   },
    { ICF_GW_USE,  "Use Gateway"         },
    { 0,           NULL                  } };

static const value_string icf_dtb_vals[] = {
    { ICF_DTB_CMD,  "Command"   },
    { ICF_DTB_RESP, "Response"  },
    { 0,            NULL        } };

static const value_string icf_rsb_vals[] = {
    { ICF_RSB_DUSE, "Response Required"     },
    { ICF_RSB_USE,  "Response Not Required" },
    { 0,            NULL                    } };

static const range_string omron_dna_range[] = {
    { INT_DNA_MIN1, INT_DNA_MAX1,   "Local network"  },
    { INT_DNA_MIN2, INT_DNA_MAX2,   "Remote network" },
    { 0,            0,              NULL             } };

static const range_string omron_da1_range[] = {
    { INT_DA1_MIN1, INT_DA1_MAX1,   "SYSMAC NET / LINK" },
    { INT_DA1_MIN2, INT_DA1_MAX2,   "SYSMAC NET"        },
    { INT_DA1_MIN3, INT_DA1_MAX3,   "Broadcast"         },
    { 0,            0,              NULL                } };

static const range_string omron_da2_range[] = {
    { INT_DA2_MIN1, INT_DA2_MAX1,   "PC (CPU)"                                     },
    { INT_DA2_MIN2, INT_DA2_MAX2,   "SYSMAC NET or LINK Unit connected to network" },
    { INT_DA2_MIN3, INT_DA2_MAX3,   "CPU BUS Unit"                                 },
    { 0,            0,              NULL                                           } };

static const range_string omron_sna_range[] = {
    { INT_SNA_MIN1, INT_SNA_MAX1,   "Local network"             },
    { INT_SNA_MIN2, INT_SNA_MAX2,   "Remote network"            },
    { 0,            0,              NULL                        } };

static const range_string omron_sa1_range[] = {
    { INT_SA1_MIN1, INT_SA1_MAX1,   "SYSMAC NET / LINK" },
    { INT_SA1_MIN2, INT_SA1_MAX2,   "SYSMAC NET"        },
    { INT_SA1_MIN3, INT_SA1_MAX3,   "Broadcast"         },
    { 0,            0,              NULL                } };

static const range_string omron_sa2_range[] = {
    { INT_SA2_MIN1, INT_SA2_MAX1,   "PC (CPU)" },
    { INT_SA2_MIN2, INT_SA2_MAX2,   "SYSMAC NET or LINK Unit connected to network" },
    { INT_SA2_MIN3, INT_SA2_MAX3,   "CPU BUS Unit"                                 },
    { 0,            0,              NULL                                           } };

static const range_string omron_error_reset_range[] = {
    { 0xFFFE, 0xFFFE, "Present error cleared" },
    { 0x0002, 0x0002, "Power interruption error" },
    { 0x00A0, 0x00A7, "SYSMAC BUS error" },
    { 0x00B0, 0x00B3, "SYSMAC BUS/2 error" },
    { 0x00E7, 0x00E7, "I/O verification error" },
    { 0x00F4, 0x00F4, "Non-fatal SFC error" },
    { 0x00F7, 0x00F7, "Batter error" },
    { 0x00F8, 0x00F8, "Indirect DM error" },
    { 0x00F9, 0x00F9, "JMP error" },
    { 0x0200, 0x0215, "CPU Bus Unit error" },
    { 0x0400, 0x0415, "CPU Bus Unit setting error" },
    { 0x4101, 0x42FF, "FALL (006) executed in user program" },
    { 0xFFFF, 0xFFFF, "All errors cleared" },
    { 0x809F, 0x809F, "Cycle time too long" },
    { 0x80C0, 0x80C7, "I/O bus error" },
    { 0x80E0, 0x80E0, "I/O setting error" },
    { 0x80E1, 0x80E1, "I/O points overflow" },
    { 0x80E9, 0x80E9, "Duplication error" },
    { 0x80F0, 0x80F0, "Program error" },
    { 0x80F1, 0x80F1, "Memory error" },
    { 0x80F3, 0x80F3, "Fatal SFC error" },
    { 0x80FF, 0x80FF, "System error" },
    { 0x8100, 0x8115, "CPU bus error" },
    { 0xC101, 0xC2FF, "FALS(007) executed" },
    { 0,0, NULL }
};

static const value_string tcp_command_cv[] = {
    { TCP_CMD_NODE_ADDRESS_DATA_SEND_CLIENT, "Node Address Data Send (Client to Server)" },
    { TCP_CMD_NODE_ADDRESS_DATA_SEND_SERVER, "Node Address Data Send (Server to Client)" },
    { TCP_CMD_FRAME_SEND, "Frame Send" },
    { TCP_CMD_FRAME_SEND_ERROR_NOTIFICATION, "Frame Send Error Notification" },
    { TCP_CMD_CONNECTION_CONFIRMATION, "Connection Confirmation" },
    { 0, NULL }
};

static const value_string tcp_error_code_cv[] = {
    { 0x00000000, "Normal" },
    { 0x00000001, "The header is not 'FINS' (ASCII code)" },
    { 0x00000002, "The data length is too long" },
    { 0x00000003, "The command is not supported" },
    { 0x00000020, "All connections are in use" },
    { 0x00000021, "The specified node is already connected" },
    { 0x00000022, "Attempt to access a protected node from an unspecified IP address" },
    { 0x00000023, "The client FINS node address is out of range" },
    { 0x00000024, "The same FINS node address is being used by the client and server" },
    { 0x00000025, "All the node addresses available for allocation have been used" },
    { 0, NULL }
};

static const value_string command_code_cv[] = {
    { 0x0101, "Memory Area Read" },
    { 0x0102, "Memory Area Write" },
    { 0x0103, "Memory Area Fill" },
    { 0x0104, "Multiple Memory Area Read" },
    { 0x0105, "Memory Area Transfer" },
    { 0x0201, "Parameter Area Read" },
    { 0x0202, "Parameter Area Write" },
    { 0x0203, "Parameter Area Clear" },
    { 0x0220, "Data Link Table Read" },
    { 0x0221, "Data Link Table Write" },
    { 0x0304, "Program Area Protect" },
    { 0x0305, "Program Area Protect Clear" },
    { 0x0306, "Program Area Read" },
    { 0x0307, "Program Area Write" },
    { 0x0308, "Program Area Clear" },
    { 0x0401, "Run" },
    { 0x0402, "Stop" },
    { 0x0403, "Reset" },
    { 0x0501, "Controller Data Read" },
    { 0x0502, "Connection Data Read" },
    { 0x0601, "Controller Status Read" },
    { 0x0602, "Network Status Read" },
    { 0x0603, "Data Link Status Read" },
    { 0x0620, "Cycle Time Read" },
    { 0x0701, "Clock Read" },
    { 0x0702, "Clock Write" },
    { 0x0801, "LOOP-BACK Test" },
    { 0x0802, "Broadcast Test Results Read" },
    { 0x0803, "Broadcast Test Data Send" },
    { 0x0920, "Message Read | Message Clear | FAL/FALS Read" },
    { 0x0C01, "Access Right Acquire" },
    { 0x0C02, "Access Right Forced Acquire" },
    { 0x0C03, "Access Right Release" },
    { 0x2101, "Error Clear" },
    { 0x2102, "Error Log Read" },
    { 0x2103, "Error Log Clear" },
    { 0x2201, "File Name Read" },
    { 0x2202, "Single File Read" },
    { 0x2203, "Single File Write" },
    { 0x2204, "Memory Card Format" },
    { 0x2205, "File Delete" },
    { 0x2206, "Volume Label Create/Delete" },
    { 0x2207, "File Copy" },
    { 0x2208, "File Name Change" },
    { 0x2209, "File Data Check" },
    { 0x220A, "Memory Area File Transfer" },
    { 0x220B, "Parameter Area File Transfer" },
    { 0x220C, "Program Area File Transfer" },
    { 0x220F, "File Memory Index Read" },
    { 0x2210, "File Memory Read" },
    { 0x2211, "File Memory Write" },
    { 0x2301, "Forced Set/Reset" },
    { 0x2302, "Forced Set/Reset Cancel" },
    { 0x230A, "Multiple Forced Status Read" },
    { 0x2601, "Name Set" },
    { 0x2602, "Name Delete" },
    { 0x2603, "Name Read" },
    { 0,    NULL                } };

static const value_string memory_area_code_cv[] = {
    { 0x00, "CIO, TR, CPU Bus Link, and Auxiliary : Bit status" },
    { 0x40, "CIO, TR, CPU Bus Link, and Auxiliary : Bit status (with forced status)" },
    { 0x80, "CIO, TR, CPU Bus Link, and Auxiliary : Word contents" },
    { 0xC0, "CIO, TR, CPU Bus Link, and Auxiliary : Word contents (with forced status)" },
    { 0x01, "Timer/Counter : Completion Flag status" },
    { 0x41, "Timer/Counter : Completion Flag status (with forced status)" },
    { 0x81, "Timer/Counter : PV" },
    { 0x82, "DM : Word contents" },
    { 0x03, "Transition : Flag status" },
    { 0x43, "Transition : Flag status (with forced status)" },
    { 0x04, "Step : Flag status" },
    { 0x44, "Step : Status" },
    { 0x84, "Step : Step timer PV" },
    { 0x05, "Forced status : Bit status" },
    { 0x85, "Forced status : Word contents" },
    { 0x90, "Expansion DM : Word contents, bank E0" },
    { 0x91, "Expansion DM : Word contents, bank E1" },
    { 0x92, "Expansion DM : Word contents, bank E2" },
    { 0x93, "Expansion DM : Word contents, bank E3" },
    { 0x94, "Expansion DM : Word contents, bank E4" },
    { 0x95, "Expansion DM : Word contents, bank E5" },
    { 0x96, "Expansion DM : Word contents, bank E6" },
    { 0x97, "Expansion DM : Word contents, bank E7" },
    { 0x98, "Expansion DM : Word contents, current bank" },
    { 0x9C, "Register : Register contents / Current bank no. of expansion DM" },
    { 0x1B, "Action : Flag status" },
    { 0xDD, "Interrupt status : Scheduled interrupt interval" },
    { 0x30, "CS1 mode: CIO Area : Bit status" },
    { 0x31, "CS1 mode: Work Area : Bit status" },
    { 0x32, "CS1 mode: Holding Bit Area : Bit status" },
    { 0x33, "CS1 mode: Auxiliary Area : Bit status" },
    { 0x70, "CS1 mode: CIO Area : Bit status (with forced status)" },
    { 0x71, "CS1 mode: Work Area : Bit status (with forced status)" },
    { 0x72, "CS1 mode: Holding Bit Area : Bit status (with forced status)" },
    { 0xB0, "CS1 mode: CIO Area : Word contents" },
    { 0xB1, "CS1 mode: Work Area : Word contents" },
    { 0xB2, "CS1 mode: Holding Bit Area : Word contents" },
    { 0xB3, "CS1 mode: Auxiliary Bit Area : Word contents" },
    { 0xF0, "CS1 mode: CIO Area : Word contents (with forced status)" },
    { 0xF1, "CS1 mode: Work Area : Word contents (with forced status)" },
    { 0xF2, "CS1 mode: Holding Bit Area : Word contents (with forced status)" },
    { 0x09, "CS1 mode: Timer/Counter : Completion Flag status" },
    { 0x49, "CS1 mode: Timer/Counter : Completion Flag status (with forced status)" },
    { 0x89, "CS1 mode: Timer/Counter : PV" },
    { 0x02, "CS1 mode: DM : Bit contents" },
    { 0x20, "CS1 mode: Expansion DM : Bit contents, bank E0" },
    { 0x21, "CS1 mode: Expansion DM : Bit contents, bank E1" },
    { 0x22, "CS1 mode: Expansion DM : Bit contents, bank E2" },
    { 0x23, "CS1 mode: Expansion DM : Bit contents, bank E3" },
    { 0x24, "CS1 mode: Expansion DM : Bit contents, bank E4" },
    { 0x25, "CS1 mode: Expansion DM : Bit contents, bank E5" },
    { 0x26, "CS1 mode: Expansion DM : Bit contents, bank E6" },
    { 0x27, "CS1 mode: Expansion DM : Bit contents, bank E7" },
    { 0x28, "CS1 mode: Expansion DM : Bit contents, bank E8" },
    { 0x29, "CS1 mode: Expansion DM : Bit contents, bank E9" },
    { 0x2A, "CS1 mode: Expansion DM : Bit contents, bank EA" },
    { 0x2B, "CS1 mode: Expansion DM : Bit contents, bank EB" },
    { 0x2C, "CS1 mode: Expansion DM : Bit contents, bank EC" },
    { 0xA0, "CS1 mode: Expansion DM : Word contents, bank E0" },
    { 0xA1, "CS1 mode: Expansion DM : Word contents, bank E1" },
    { 0xA2, "CS1 mode: Expansion DM : Word contents, bank E2" },
    { 0xA3, "CS1 mode: Expansion DM : Word contents, bank E3" },
    { 0xA4, "CS1 mode: Expansion DM : Word contents, bank E4" },
    { 0xA5, "CS1 mode: Expansion DM : Word contents, bank E5" },
    { 0xA6, "CS1 mode: Expansion DM : Word contents, bank E6" },
    { 0xA7, "CS1 mode: Expansion DM : Word contents, bank E7" },
    { 0xA8, "CS1 mode: Expansion DM : Word contents, bank E8" },
    { 0xA9, "CS1 mode: Expansion DM : Word contents, bank E9" },
    { 0xAA, "CS1 mode: Expansion DM : Word contents, bank EA" },
    { 0xAB, "CS1 mode: Expansion DM : Word contents, bank EB" },
    { 0xAC, "CS1 mode: Expansion DM : Word contents, bank EC" },
    { 0xBC, "CS1 mode: Register : Register contents / Current bank no. of expansion DM" },
    { 0x06, "CS1 mode: Task flag : Bit contents" },
    { 0x46, "CS1 mode: Task flag : Status" },
    { 0xDC, "CS1 mode: Index register : Register contents" },
    { 0x07, "CS1 mode: Clock pulses / Condition flags : Bit contents" },
    { 0,    NULL    } };

static const value_string memory_area_code_prefix[] = {
    { 0x82, "D" },
    { 0x90, "E0_" },
    { 0x91, "E1_" },
    { 0x92, "E2_" },
    { 0x93, "E3_" },
    { 0x94, "E4_" },
    { 0x95, "E5_" },
    { 0x96, "E6_" },
    { 0x97, "E7_" },
    { 0x30, "CIO" },
    { 0x31, "W" },
    { 0x32, "H" },
    { 0x33, "A" },
    { 0x70, "CIO" },
    { 0x71, "W" },
    { 0x72, "H" },
    { 0xB0, "CIO" },
    { 0xB1, "W" },
    { 0xB2, "H" },
    { 0xB3, "A" },
    { 0xF0, "CIO" },
    { 0xF1, "W" },
    { 0xF2, "H" },
    { 0x02, "D" },
    { 0x20, "E0_" },
    { 0x21, "E1_" },
    { 0x22, "E2_" },
    { 0x23, "E3_" },
    { 0x24, "E4_" },
    { 0x25, "E5_" },
    { 0x26, "E6_" },
    { 0x27, "E7_" },
    { 0x28, "E8_" },
    { 0x29, "E9_" },
    { 0x2A, "EA_" },
    { 0x2B, "EB_" },
    { 0x2C, "EC_" },
    { 0xA0, "E0_" },
    { 0xA1, "E1_" },
    { 0xA2, "E2_" },
    { 0xA3, "E3_" },
    { 0xA4, "E4_" },
    { 0xA5, "E5_" },
    { 0xA6, "E6_" },
    { 0xA7, "E7_" },
    { 0xA8, "E8_" },
    { 0xA9, "E9_" },
    { 0xAA, "EA_" },
    { 0xAB, "EB_" },
    { 0xAC, "EC_" },
    { 0,    NULL    } };

static const value_string response_codes[] = {
    { 0x0000, "Normal completion" },
    { 0x0001, "Service was interrupted" },
    { 0x0101, "Local node not part of Network" },
    { 0x0102, "Token time-out, node number to large" },
    { 0x0103, "Number of transmit retries exceeded" },
    { 0x0104, "Maximum number of frames exceeded" },
    { 0x0105, "Node number setting error (range)" },
    { 0x0106, "Node number duplication error" },
    { 0x0201, "Destination node not part of Network" },
    { 0x0202, "No node with the specified node number" },
    { 0x0203, "Third node not part of Network : Broadcasting was specified" },
    { 0x0204, "Busy error, destination node busy" },
    { 0x0205, "Response time-out" },
    { 0x0301, "Error occurred : ERC indicator is lit" },
    { 0x0302, "CPU error occurred in the PC at the destination node" },
    { 0x0303, "A controller error has prevented a normal response" },
    { 0x0304, "Node number setting error" },
    { 0x0401, "An undefined command has been used" },
    { 0x0402, "Cannot process command because the specified unit model or version is wrong" },
    { 0x0501, "Destination node number is not set in the routing table" },
    { 0x0502, "Routing table isn't registered" },
    { 0x0503, "Routing table error" },
    { 0x0504, "Max relay nodes (2) was exceeded" },
    { 0x1001, "The command is longer than the max permissible length" },
    { 0x1002, "The command is shorter than the min permissible length" },
    { 0x1003, "The designated number of data items differs from the actual number" },
    { 0x1004, "An incorrect command format has been used" },
    { 0x1005, "An incorrect header has been used" },
    { 0x1101, "Memory area code invalid or DM is not available" },
    { 0x1102, "Access size is wrong in command" },
    { 0x1103, "First address in inaccessible area" },
    { 0x1104, "The end of specified word range exceeds acceptable range" },
    { 0x1106, "A non-existent program number" },
    { 0x1109, "The size of data items in command block are wrong" },
    { 0x110A, "The IOM break function cannot be executed" },
    { 0x110B, "The response block is longer than the max length" },
    { 0x110C, "An incorrect parameter code has been specified" },
    { 0x2002, "The data is protected" },
    { 0x2003, "Registered table does not exist" },
    { 0x2004, "Search data does not exist" },
    { 0x2005, "Non-existent program number" },
    { 0x2006, "Non-existent file" },
    { 0x2007, "Verification error" },
    { 0x2101, "Specified area is read-only" },
    { 0x2102, "The data is protected" },
    { 0x2103, "Too many files open" },
    { 0x2105, "Non-existent program number" },
    { 0x2106, "Non-existent file" },
    { 0x2107, "File already exists" },
    { 0x2108, "Data cannot be changed" },
    { 0x2201, "The mode is wrong (executing)" },
    { 0x2202, "The mode is wrong (stopped)" },
    { 0x2203, "The PC is in the PROGRAM mode" },
    { 0x2204, "The PC is in the DEBUG mode" },
    { 0x2205, "The PC is in the MONITOR mode" },
    { 0x2206, "The PC is in the RUN mode" },
    { 0x2207, "The specified node is not the control node" },
    { 0x2208, "The mode is wrong and the step cannot be executed" },
    { 0x2301, "The file device does not exist where specified" },
    { 0x2302, "The specified memory does not exist" },
    { 0x2303, "No clock exists" },
    { 0x2401, "Data link table is incorrect" },
    { 0x2502, "Parity / checksum error occurred" },
    { 0x2503, "I/O setting error" },
    { 0x2504, "Too many I/O points" },
    { 0x2505, "CPU bus error" },
    { 0x2506, "I/O duplication error" },
    { 0x2507, "I/O bus error" },
    { 0x2509, "SYSMAC BUS/2 error" },
    { 0x250A, "Special I/O Unit error" },
    { 0x250D, "Duplication in SYSMAC BUS word allocation" },
    { 0x250F, "A memory error has occurred" },
    { 0x2510, "Terminator not connected in SYSMAC BUS system" },
    { 0x2601, "The specified area is not protected" },
    { 0x2602, "An incorrect password has been specified" },
    { 0x2604, "The specified area is protected" },
    { 0x2605, "The service is being executed" },
    { 0x2606, "The service is not being executed" },
    { 0x2607, "Service cannot be execute from local node" },
    { 0x2608, "Service cannot be executed settings are incorrect" },
    { 0x2609, "Service cannot be executed incorrect settings in command data" },
    { 0x260A, "The specified action has already been registered" },
    { 0x260B, "Cannot clear error, error still exists" },
    { 0x3001, "The access right is held by another device" },
    { 0x4001, "Command aborted with ABORT command" },
    { 0,    NULL    } };

static const value_string parameter_area_codes[] = {
    { 0x8010, "PC Setup" },
    { 0x8011, "Peripheral Device settings" },
    { 0x8012, "I/O table" },
    { 0x8013, "Routing tables" },
    { 0x8002, "CPU Bus Unit settings" },
    { 0,      NULL } };

static const value_string mode_codes[] = {
    { 0x00, "PROGRAM mode" },
    { 0x01, "DEBUG mode" },
    { 0x02, "MONITOR mode" },
    { 0x04, "RUN mode" },
    { 0,    NULL } };

static const value_string status_codes[] = {
    { 0x00, "Stop" },
    { 0x01, "Run" },
    { 0x80, "CPU on standby" },
    { 0,    NULL    } };

static const value_string memory_card_codes[] = {
    { 0x00, "No memory card" },
    { 0x01, "SPRAM" },
    { 0x02, "EPROM" },
    { 0x03, "EEPROM" },
    { 0,    NULL } };

static const value_string parameter_codes[] = {
    { 0x00, "Initializes the cycle time." },
    { 0x01, "Read the cycle time" },
    { 0,    NULL } };

static const value_string omron_days[] = {
    { 0x00, "Sun"  },
    { 0x01, "Mon"  },
    { 0x02, "Tues" },
    { 0x03, "Wed"  },
    { 0x04, "Thur" },
    { 0x05, "Fri"  },
    { 0x06, "Sat"  },
    { 0,    NULL   } };

static const value_string omron_file_parameter_codes[] = {
    { 0x0000, "Write new file, do not overwrite" },
    { 0x0001, "Write new file, overwrite" },
    { 0x0002, "Append to file " },
    { 0x0003, "Overwrite file" },
    { 0,      NULL  } };

static const value_string omron_volume_parameter_codes[] = {
    { 0x0000, "Create new volume label, do not overwrite" },
    { 0x0001, "Create new volume label, overwrite" },
    { 0x0002, "Delete existing volume label" },
    { 0,    NULL } };

static const value_string omron_transfer_parameter_codes[] = {
    { 0x0000, "Data transfer from the PC memory area to the file device" },
    { 0x0001, "Data transfer from the file device to the PC memory area" },
    { 0x0002, "Data compared" },
    { 0,         NULL } };

static const value_string omron_set_reset_specifications[] = {
    { 0x0000, "Force-reset (OFF)" },
    { 0x0001, "Force-set (ON)" },
    { 0x8000, "Forced status released and bit turned OFF (0)" },
    { 0x8001, "Forced status released and bit turned ON (1)" },
    { 0xFFFF, "Forced status released" },
    { 0,    NULL } };

static const value_string omron_type_codes[] = {
    { 0x00, "RAM" },
    { 0x01, "First half RAM; second half ROM" },
    { 0,    NULL } };

static const value_string omron_data_type_bits[] = {
    { 0x00, "Empty" },
    { 0x01, "I/O data" },
    { 0x02, "User program" },
    { 0x03, "Comments" },
    { 0,    NULL } };

static const value_string omron_cyclic_ops_codes[] = {
    { 0x00, "Stopped" },
    { 0x01, "Active" },
    { 0,    NULL } };

static const value_string omron_cyclic_trans_codes[] = {
    { 0x00, "No transmission" },
    { 0x01, "Transmission" },
    { 0,    NULL } };

static int * const omron_icf_fields[] = {
    &hf_omron_icf_gwb,
    &hf_omron_icf_dtb,
    &hf_omron_icf_rb0,
    &hf_omron_icf_rb1,
    &hf_omron_icf_rb2,
    &hf_omron_icf_rb3,
    &hf_omron_icf_rb4,
    &hf_omron_icf_rsb,
    NULL
};

static int * const pc_status_fields[] = {
    &hf_omron_pc_status_pdc,
    &hf_omron_pc_status_hi,
    &hf_omron_pc_status_r1,
    &hf_omron_pc_status_r2,
    &hf_omron_pc_status_rack_num,
    NULL
};

static int * const fatal_error_fields[] = {
    &hf_omron_fatal_fals_error,
    &hf_omron_fatal_sfc_error,
    &hf_omron_fatal_cycle_time_over,
    &hf_omron_fatal_program_error,
    &hf_omron_fatal_io_setting_error,
    &hf_omron_fatal_io_point_overflow,
    &hf_omron_fatal_cpu_bus_error,
    &hf_omron_fatal_duplication_error,
    &hf_omron_fatal_io_bus_error,
    &hf_omron_fatal_memory_error,
    &hf_omron_fatal_rv_1,
    &hf_omron_fatal_rv_2,
    &hf_omron_fatal_rv_3,
    &hf_omron_fatal_rv_4,
    &hf_omron_fatal_rv_5,
    &hf_omron_fatal_watch_dog_timer_error,
    NULL
};

static int * const non_fatal_error_fields[] = {
    &hf_omron_non_fatal_rv1,
    &hf_omron_non_fatal_rv2,
    &hf_omron_non_fatal_power_interruption,
    &hf_omron_non_fatal_cpu_bus_unit_setting_error,
    &hf_omron_non_fatal_battery_error,
    &hf_omron_non_fatal_sysmac_bus_error,
    &hf_omron_non_fatal_sysmac_bus2_error,
    &hf_omron_non_fatal_cpu_bus_unit_error,
    &hf_omron_non_fatal_rv3,
    &hf_omron_non_fatal_io_verification_error,
    &hf_omron_non_fatal_rv4,
    &hf_omron_non_fatal_sfc_error,
    &hf_omron_non_fatal_indirect_dm_error,
    &hf_omron_non_fatal_jmp_error,
    &hf_omron_non_fatal_rv5,
    &hf_omron_non_fatal_fal_error,
    NULL
};

static int * const message_fields[] = {
    &hf_omron_message_no_0,
    &hf_omron_message_no_1,
    &hf_omron_message_no_2,
    &hf_omron_message_no_3,
    &hf_omron_message_no_4,
    &hf_omron_message_no_5,
    &hf_omron_message_no_6,
    &hf_omron_message_no_7,
    &hf_omron_message_rv_0,
    &hf_omron_message_rv_1,
    &hf_omron_message_rv_2,
    &hf_omron_message_rv_3,
    &hf_omron_message_rv_4,
    &hf_omron_message_rv_5,
    &hf_omron_message_rv_6,
    &hf_omron_message_rv_7,
    NULL
};

static int * const message_yes_no_fields[] = {
    &hf_omron_message_rv_1,
    &hf_omron_message_rv_2,
    &hf_omron_message_rv_3,
    &hf_omron_message_rv_4,
    &hf_omron_message_rv_5,
    &hf_omron_message_rv_6,
    &hf_omron_message_rv_7,
    NULL
};

static int * const data_type_fields[] = {
    &hf_omron_data_type_type,
    &hf_omron_data_type_rv,
    &hf_omron_data_type_protected,
    &hf_omron_data_type_end,
    NULL
};

static int * const cyclic_non_fatal_1_fields[] = {
    &hf_omron_cyclic_1,
    &hf_omron_cyclic_2,
    &hf_omron_cyclic_3,
    &hf_omron_cyclic_4,
    &hf_omron_cyclic_5,
    &hf_omron_cyclic_6,
    &hf_omron_cyclic_7,
    NULL
};

static int * const cyclic_non_fatal_2_fields[] = {
    &hf_omron_cyclic_8,
    &hf_omron_cyclic_9,
    &hf_omron_cyclic_10,
    &hf_omron_cyclic_11,
    &hf_omron_cyclic_12,
    &hf_omron_cyclic_13,
    &hf_omron_cyclic_14,
    &hf_omron_cyclic_15,
    NULL
};

static int * const cyclic_non_fatal_3_fields[] = {
    &hf_omron_cyclic_16,
    &hf_omron_cyclic_17,
    &hf_omron_cyclic_18,
    &hf_omron_cyclic_19,
    &hf_omron_cyclic_20,
    &hf_omron_cyclic_21,
    &hf_omron_cyclic_22,
    &hf_omron_cyclic_23,
    NULL
};

static int * const cyclic_non_fatal_4_fields[] = {
    &hf_omron_cyclic_24,
    &hf_omron_cyclic_25,
    &hf_omron_cyclic_26,
    &hf_omron_cyclic_27,
    &hf_omron_cyclic_28,
    &hf_omron_cyclic_29,
    &hf_omron_cyclic_30,
    &hf_omron_cyclic_31,
    NULL
};

static int * const cyclic_non_fatal_5_fields[] = {
    &hf_omron_cyclic_32,
    &hf_omron_cyclic_33,
    &hf_omron_cyclic_34,
    &hf_omron_cyclic_35,
    &hf_omron_cyclic_36,
    &hf_omron_cyclic_37,
    &hf_omron_cyclic_38,
    &hf_omron_cyclic_39,
    NULL
};

static int * const cyclic_non_fatal_6_fields[] = {
    &hf_omron_cyclic_40,
    &hf_omron_cyclic_41,
    &hf_omron_cyclic_42,
    &hf_omron_cyclic_43,
    &hf_omron_cyclic_44,
    &hf_omron_cyclic_45,
    &hf_omron_cyclic_46,
    &hf_omron_cyclic_47,
    NULL
};

static int * const cyclic_non_fatal_7_fields[] = {
    &hf_omron_cyclic_48,
    &hf_omron_cyclic_49,
    &hf_omron_cyclic_50,
    &hf_omron_cyclic_51,
    &hf_omron_cyclic_52,
    &hf_omron_cyclic_53,
    &hf_omron_cyclic_54,
    &hf_omron_cyclic_55,
    NULL
};

static int * const cyclic_non_fatal_8_fields[] = {
    &hf_omron_cyclic_56,
    &hf_omron_cyclic_57,
    &hf_omron_cyclic_58,
    &hf_omron_cyclic_59,
    &hf_omron_cyclic_60,
    &hf_omron_cyclic_61,
    &hf_omron_cyclic_62,
    NULL
};

static const true_false_string boolean_data_type_protected = {
    "Protected",
    "Not Protected"
};

static const true_false_string boolean_data_type_end = {
    "Last Block",
    "Not Last Block"
};

static const true_false_string boolean_node_num_status = {
    "Normal",
    "Warning"
};

static const true_false_string boolean_status_flag_status = {
    "Error",
    "Normal"
};

static const true_false_string boolean_status_flags_slave_master = {
    "Master",
    "Slave"
};

static const true_false_string boolean_status_flags_data_link = {
    "Active",
    "Not Active"
};

static const true_false_string boolean_status_block_stop_run = {
    "Run",
    "Stop"
};

static const true_false_string boolean_status_flag_status_2 = {
    "Warning",
    "Normal"
};

static const true_false_string boolean_member_network = {
    "In network",
    "Not in network"
};

static const true_false_string boolean_member_polling = {
    "Unit does not respond to polling",
    "Unit responds to polling"
};

/* CODE */

static int
dissect_omron_fins_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *omron_tree)
{
    proto_item  *ti = NULL;
    proto_tree  *omron_header_tree, *field_tree, *command_tree, *area_data_tree, *cpu_bus_tree;
    proto_tree  *io_data_tree, *error_log_tree, *omron_disk_data_tree, *omron_file_data_tree;
    proto_tree  *omron_block_record_tree, *omron_status_tree;
    const gchar *cmd_str;
    gint     cmd_str_idx = -1;
    gint     reported_length_remaining;
    guint    offset = 0;
    guint8   icf_flags;
    guint8   omron_byte;
    gboolean is_response = FALSE;
    gboolean is_command  = FALSE;
    guint16  command_code = 0;

    /* Set the protocol column */
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMRON");

    /* get the command code: we need it later */
    command_code = tvb_get_ntohs(tvb, offset + 10);

    cmd_str = try_val_to_str_idx(command_code, command_code_cv, &cmd_str_idx);
    if (cmd_str_idx == -1)
        cmd_str = wmem_strdup_printf(pinfo->pool, "Unknown (%d)", command_code);

    /* Setup and fill in the INFO column if it's there */
    icf_flags = tvb_get_guint8(tvb, offset);
    if (icf_flags & 0x40) {
        is_response = TRUE;
        col_add_fstr(pinfo->cinfo, COL_INFO, "Response : %s", cmd_str);
    } else {
        is_command = TRUE;
        col_add_fstr(pinfo->cinfo, COL_INFO, "Command  : %s", cmd_str);
    }

    /* Show address info for single memory area read */
    if (is_command && command_code == 0x0101 && tvb_captured_length(tvb) >= 15) {
        const gchar *mem_area_str;
        gint mem_area_str_idx;
        guint8 mem_area;
        guint16 mem_address;

        mem_area = tvb_get_guint8(tvb, offset + 12);
        mem_area_str = try_val_to_str_idx(mem_area, memory_area_code_prefix, &mem_area_str_idx);
        if (mem_area_str_idx >= 0) {
            mem_address = tvb_get_ntohs(tvb, offset + 13);
            col_append_fstr(pinfo->cinfo, COL_INFO, " (%s%u)", mem_area_str, mem_address);
        }
    }

    if (omron_tree) { /* we are being asked for details */
        omron_header_tree = proto_tree_add_subtree(omron_tree, tvb, offset, 12, ett_omron_header, &ti, "FINS Header");

        proto_tree_add_bitmask(omron_header_tree, tvb, offset, hf_omron_icf,
                               ett_omron_icf_fields, omron_icf_fields, ENC_BIG_ENDIAN);

        /* Byte 2 RSV */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_rsv, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 3 GCT */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_gct, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 4 DNA */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_dna, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 5 DA1 */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_da1, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 6 DA2 */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_da2, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 7 SNA */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_sna, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 8 SA1 */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_sa1, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 9 SA2 */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_sa2, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 10 SID */
        offset = offset + 1;
        proto_tree_add_item(omron_header_tree, hf_omron_sid, tvb, offset, 1, ENC_BIG_ENDIAN);

        /* Byte 11 and 12 Command Code */
        offset = offset + 1;
        ti = proto_tree_add_item(omron_header_tree, hf_omron_command, tvb, offset, 2, ENC_BIG_ENDIAN);

        offset = offset + 2;

        reported_length_remaining = tvb_reported_length_remaining(tvb, offset);

        if (cmd_str_idx == -1) {
            /* Unknown command-code */
            expert_add_info(pinfo, ti, &ei_omron_command_code);
            return tvb_captured_length(tvb);
        }

        /* Handle  special cases wherein the data length for a command and/or a response can be 0 */
        switch(command_code) {
        case 0x0402:
        case 0x0601:
        case 0x0602:
        case 0x0603:
        case 0x0701:
        case 0x0802:
        case 0x2103:
        case 0x2302:
        case 0x2602:
        case 0x2603:
            /* command data length > 0 is NG;  response data lengths are > 0  */
            if (is_command) {
                if (reported_length_remaining != 0) {
                    expert_add_info_format(pinfo, omron_tree, &ei_omron_bad_length, "Unexpected Length (Should be 0)");
                }
                return tvb_captured_length(tvb);
            }
            break;

        case 0x0403:
            /* command data length should be 0 */
            if (is_command) {
                if(reported_length_remaining != 0) {
                    expert_add_info_format(pinfo, omron_tree, &ei_omron_bad_length, "Unexpected Length (Should be 0)");
                }
            }
            /* There's no response */
            if (is_response)
            {
                expert_add_info_format(pinfo, ti, &ei_omron_command_code, "Unknown Response Command-Code");
            }
            return tvb_captured_length(tvb);
            break;

        case 0x0801:
            /* command data length = 0 or > 0 is OK;  */
            if (is_command) {
                if (reported_length_remaining == 0)
                    return tvb_captured_length(tvb);
            }
            break;

        case 0x0803:
            /* command data length = 0 or > 0 is OK;  */
            if (is_command) {
                if (reported_length_remaining == 0)
                    return tvb_captured_length(tvb);
            }
            /* There's no response */
            if (is_response)
            {
                expert_add_info_format(pinfo, ti, &ei_omron_command_code, "Unknown Response Command-Code");
                return tvb_captured_length(tvb);
            }
            break;

        default:
            break;
        }

        /* Add command data tree */
        /* Note: A "malformed" will be thrown if data length = 0 at this point */
        command_tree = proto_tree_add_subtree(omron_tree, tvb, offset, -1, ett_omron_command_data, NULL, "Command Data");

        /* Start parsing individual commands */
        switch(command_code) {

        case 0x0101:
        {
            /* check for enough data */
            if(is_command)
            {
                if(reported_length_remaining == 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
                                        tvb, offset, 1, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    offset = offset + 6;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                                        2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 2)
                    {
                        proto_tree_add_item(command_tree, hf_omron_response_data, tvb,
                                            (offset+2), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x0102:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
                        tvb, offset, 1, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+6), -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                        2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0103:
        {
            if(is_command)
            {
                if(reported_length_remaining == 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
                        tvb, offset, 1, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+4), 2, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+6), 2, ENC_NA);
                    offset = offset + 8;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                        2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0104:
        {
            if(is_command)
            {
                while(reported_length_remaining >= 4)
                {
                    const gchar *mem_area_str;
                    gint mem_area_str_idx;
                    guint8 mem_area;
                    guint16 mem_address;

                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, ENC_BIG_ENDIAN);
                    ti = proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, ENC_BIG_ENDIAN);

                    mem_area = tvb_get_guint8(tvb, offset);
                    mem_area_str = try_val_to_str_idx(mem_area, memory_area_code_prefix, &mem_area_str_idx);
                    if(mem_area_str_idx >= 0) {
                        mem_address = tvb_get_ntohs(tvb, offset+1);
                        proto_item_append_text(ti, " (%s%u)", mem_area_str, mem_address);
                    }

                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                    reported_length_remaining = reported_length_remaining - 4;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 3)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                    reported_length_remaining = reported_length_remaining - 2;

                    while(reported_length_remaining >= 2)
                    {
                        guint8 memory_area_code;
                        guint8 memory_code_len;

                        ti = proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, ENC_BIG_ENDIAN);
                        memory_area_code  = tvb_get_guint8(tvb, offset);
                        switch(memory_area_code) {
                            case 0x00:
                            case 0x01:
                            case 0x02:
                            case 0x03:
                            case 0x04:
                            case 0x05:
                            case 0x06:
                            case 0x07:
                            case 0x09:
                            case 0x1B:
                            case 0x20:
                            case 0x21:
                            case 0x22:
                            case 0x23:
                            case 0x24:
                            case 0x25:
                            case 0x26:
                            case 0x27:
                            case 0x28:
                            case 0x29:
                            case 0x2A:
                            case 0x2B:
                            case 0x2C:
                            case 0x30:
                            case 0x31:
                            case 0x32:
                            case 0x33:
                            case 0x40:
                            case 0x41:
                            case 0x43:
                            case 0x44:
                            case 0x46:
                            case 0x49:
                            case 0x70:
                            case 0x71:
                            case 0x72:
                                memory_code_len = 1;
                                break;
                            case 0x80:
                            case 0x81:
                            case 0x82:
                            case 0x84:
                            case 0x85:
                            case 0x89:
                            case 0x90:
                            case 0x91:
                            case 0x92:
                            case 0x93:
                            case 0x94:
                            case 0x95:
                            case 0x96:
                            case 0x97:
                            case 0x98:
                            case 0x9C:
                            case 0xA0:
                            case 0xA1:
                            case 0xA2:
                            case 0xA3:
                            case 0xA4:
                            case 0xA5:
                            case 0xA6:
                            case 0xA7:
                            case 0xA8:
                            case 0xA9:
                            case 0xAA:
                            case 0xAB:
                            case 0xAC:
                            case 0xB0:
                            case 0xB1:
                            case 0xB2:
                            case 0xB3:
                            case 0xBC:
                                memory_code_len = 2;
                                break;
                            case 0xC0:
                            case 0xDC:
                            case 0xDD:
                            case 0xF0:
                            case 0xF1:
                            case 0xF2:
                                memory_code_len = 4;
                                break;
                            default:
                                memory_code_len = 0;
                        } /* switch */

                        offset = offset + 1;
                        reported_length_remaining = reported_length_remaining - 1;

                        if(memory_code_len == 0) {
                            expert_add_info_format(pinfo, ti, &ei_oomron_command_memory_area_code, "Unknown Memory-Area-Code (%u)", memory_area_code);
                            return tvb_captured_length(tvb); /* Bail out .... */
                        }
                        proto_tree_add_item(command_tree, hf_omron_response_data, tvb, offset, memory_code_len, ENC_NA);
                        offset = offset + memory_code_len;
                        reported_length_remaining = reported_length_remaining - memory_code_len;

                    } /* while ( ... >= 2) */
                } /* if(reported_length_remaining >= 3) */
            }
        }
        break;

        case 0x0105:
        {
            if(is_command)
            {
                if(reported_length_remaining == 10)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
                        tvb, offset, 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+3), 1, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code,
                        tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+5), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address_bits, tvb, (offset+7), 1, ENC_BIG_ENDIAN);

                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+8), 2, ENC_BIG_ENDIAN);
                    offset = offset + 10;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                                        2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0201:
        {

            if(is_command)
            {
                if(reported_length_remaining == 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    offset = offset + 6;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                        2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 8)
                    {
                        proto_tree_add_item(command_tree, hf_omron_response_data, tvb,
                              (offset+8), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x0202:
        case 0x0203:
        {

            if(is_command)
            {
                if(reported_length_remaining >= 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_beginning_word, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+4), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 6)
                    {
                        proto_tree_add_item(command_tree, hf_omron_command_data, tvb,
                              (offset+6), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset,
                        2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0220:
        {
            if(is_command)
            {
                if(reported_length_remaining == 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_fixed, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_intelligent_id_no, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_first_word, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_read_len, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    offset = offset + 8;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 3)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_link_nodes, tvb, (offset+2), 1, ENC_BIG_ENDIAN);

                    offset = offset + 3;
                    reported_length_remaining = reported_length_remaining - 3;

                    /* add block record tree for each record */
                    while(reported_length_remaining >= 8)
                    {
                        omron_block_record_tree = proto_tree_add_subtree(command_tree, tvb, offset, 8, ett_omron_block_record, NULL, "Block Record");
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_status, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_num_nodes, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_cio_area, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_kind_of_dm, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_dm_area_first_word, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_no_of_total_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                        offset = offset + 8;
                        reported_length_remaining = reported_length_remaining - 8;
                    }
                }
            } /* if (is_response) */
        }
        break;

        case 0x0221:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 9)
                {
                    proto_tree_add_item(command_tree, hf_omron_fixed, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_intelligent_id_no, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_first_word, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_read_len, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_link_nodes, tvb, (offset+8), 1, ENC_BIG_ENDIAN);

                    offset = offset + 9;
                    reported_length_remaining = reported_length_remaining - 9;

                    while(reported_length_remaining >= 8)
                    {
                        omron_block_record_tree = proto_tree_add_subtree(command_tree, tvb, offset, 8, ett_omron_block_record, NULL, "Block Record");
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_status, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_node_num_num_nodes, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_cio_area, tvb, (offset+1), 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_kind_of_dm, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_dm_area_first_word, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_block_record_tree, hf_omron_block_record_no_of_total_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                        offset = offset + 8;
                        reported_length_remaining = reported_length_remaining - 8;
                    }
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0304:
        case 0x0305:
        {
            if(is_command)
            {
                if(reported_length_remaining == 15)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_protect_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+3),4,ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_last_word, tvb, (offset+7),4,ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_password, tvb, (offset+11),4,ENC_ASCII);
                    offset = offset + 15;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0306:
        {
            if(is_command)
            {
                if(reported_length_remaining == 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+2), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    offset = offset + 8;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 10)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+8), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 10)
                    {
                        proto_tree_add_item(command_tree, hf_omron_response_data, tvb, (offset+10), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x0307:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+2), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 8)
                    {
                        proto_tree_add_item(command_tree, hf_omron_command_data, tvb, (offset+8), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }
            if(is_response)
            {
                if(reported_length_remaining == 10)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+8), 2, ENC_BIG_ENDIAN);
                    offset = offset + 10;
                }
            }
        }
        break;

        case 0x0308:
        {
            if(is_command)
            {
                if(reported_length_remaining == 3)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_clear_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    offset = offset + 3;
                }
            }
            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0401:
        {
            if(is_command)
            {
                if(reported_length_remaining == 3)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_mode_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    offset = offset + 3;
                }
                else if (reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_monitor_label, tvb, offset, 0, ENC_NA);
                    offset = offset + 2;
                }
            }
            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0402:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0501:
        {
            if(is_command)
            {
                if(reported_length_remaining == 1)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_data, tvb,
                              offset, -1, ENC_NA);
                    offset = offset + 1;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 94)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_controller_model, tvb, (offset+2), 20, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_controller_version, tvb, (offset+22), 20, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_for_system_use, tvb, (offset+42), 40, ENC_ASCII);
                    /* add area data sub tree */
                    area_data_tree = proto_tree_add_subtree(command_tree, tvb, (offset+82), 12, ett_area_data, NULL, "Area Data");
                    proto_tree_add_item(area_data_tree, hf_omron_program_area_size, tvb, (offset+82), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_iom_size, tvb, (offset+84), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_num_dm_words, tvb, (offset+85), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_timer_counter_size, tvb, (offset+87), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_expansion_dm_size, tvb, (offset+88), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_num_step_transitions, tvb, (offset+89), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_kind_memory_card, tvb, (offset+91), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_memory_card_size, tvb, (offset+92), 2, ENC_BIG_ENDIAN);
                    offset = offset + 94;
                }

                else if(reported_length_remaining == 69)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    cpu_bus_tree = proto_tree_add_subtree(command_tree, tvb, (offset+2), 64, ett_cpu_bus, NULL, "CPU Bus Unit Conf");
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_0, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_1, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_2, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_3, tvb, (offset+8), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_4, tvb, (offset+10), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_5, tvb, (offset+12), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_6, tvb, (offset+14), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_7, tvb, (offset+16), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_8, tvb, (offset+18), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_9, tvb, (offset+20), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_10, tvb, (offset+22), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_11, tvb, (offset+24), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_12, tvb, (offset+26), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_13, tvb, (offset+28), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_14, tvb, (offset+30), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_15, tvb, (offset+32), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_reserved, tvb, (offset+34), 32, ENC_ASCII);
                    /* Remote IO Data tree */
                    io_data_tree = proto_tree_add_subtree(command_tree, tvb, (offset+66), 2, ett_io_data, NULL, "Remote I/O data");
                    proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_1, tvb, (offset+66), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_2, tvb, (offset+67), 1, ENC_BIG_ENDIAN);
                    /* PC status */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+68), hf_omron_pc_status,
                        ett_pc_status_fields, pc_status_fields, ENC_BIG_ENDIAN);
                    offset = offset + 69;
                }

                else if(reported_length_remaining == 161)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_controller_model, tvb, (offset+2), 20, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_controller_version, tvb, (offset+22), 20, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_for_system_use, tvb, (offset+42), 40, ENC_ASCII);
                    /* add area data sub tree */
                    area_data_tree = proto_tree_add_subtree(command_tree, tvb, (offset+82), 12, ett_area_data, NULL, "Area Data");
                    proto_tree_add_item(area_data_tree, hf_omron_program_area_size, tvb, (offset+82), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_iom_size, tvb, (offset+84), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_num_dm_words, tvb, (offset+85), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_timer_counter_size, tvb, (offset+87), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_expansion_dm_size, tvb, (offset+88), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_num_step_transitions, tvb, (offset+89), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_kind_memory_card, tvb, (offset+91), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(area_data_tree, hf_omron_memory_card_size, tvb, (offset+92), 2, ENC_BIG_ENDIAN);
                    /* cpu bus unit configuration */
                    cpu_bus_tree = proto_tree_add_subtree(command_tree, tvb, (offset+94), 64, ett_cpu_bus, NULL, "CPU Bus Unit Conf");
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_0, tvb, (offset+94), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_1, tvb, (offset+96), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_2, tvb, (offset+98), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_3, tvb, (offset+100), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_4, tvb, (offset+102), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_5, tvb, (offset+104), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_6, tvb, (offset+106), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_7, tvb, (offset+108), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_8, tvb, (offset+110), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_9, tvb, (offset+112), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_10, tvb, (offset+114), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_11, tvb, (offset+116), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_12, tvb, (offset+118), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_13, tvb, (offset+120), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_14, tvb, (offset+122), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_unit_15, tvb, (offset+124), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(cpu_bus_tree, hf_omron_cpu_bus_reserved, tvb, (offset+126), 32, ENC_ASCII);
                    /* Remote IO Data tree */
                    io_data_tree = proto_tree_add_subtree(command_tree, tvb, (offset+158), 2, ett_io_data, NULL, "Remote I/O data");
                    proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_1, tvb, (offset+158), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(io_data_tree, hf_omron_io_data_num_sysmac_2, tvb, (offset+159), 1, ENC_BIG_ENDIAN);
                    /* PC status */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+160), hf_omron_pc_status,
                        ett_pc_status_fields, pc_status_fields, ENC_BIG_ENDIAN);
                    offset = offset + 161;
                }
            }
        }
        break;

        case 0x0502:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 1)
                {
                    proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, offset, 1, ENC_BIG_ENDIAN);
                    if (reported_length_remaining == 2)
                    {
                        proto_tree_add_item(command_tree, hf_omron_num_units, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                        offset = offset + 1;
                    }
                    offset = offset + 1;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 24)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_units, tvb, offset+2, 1, ENC_BIG_ENDIAN);
                    offset = offset + 3;
                    reported_length_remaining = reported_length_remaining - 3;

                    while(reported_length_remaining >= 21)
                    {
                        proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(command_tree, hf_omron_model_number, tvb, offset+1, 20, ENC_ASCII);
                        offset = offset + 21;
                        reported_length_remaining = reported_length_remaining - 21;
                    }
                }
            }
        }
        break;

        case 0x0601:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 28)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_status, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_mode_code, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    /* Add bitmask for Fatal error data */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+4), hf_omron_fatal_error_data,
                        ett_fatal_fields, fatal_error_fields, ENC_BIG_ENDIAN);
                    /* Add bitmask for non fatal error data */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+6), hf_omron_non_fatal_error_data,
                        ett_non_fatal_fields, non_fatal_error_fields, ENC_BIG_ENDIAN);
                    /* add bitmask for message yes/no data */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+8), hf_omron_message,
                        ett_message_fields, message_fields, ENC_BIG_ENDIAN);
                    /* Add rest of fields */
                    proto_tree_add_item(command_tree, hf_omron_fals, tvb, (offset+10), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_error_message, tvb, (offset+12), 16, ENC_ASCII);
                    offset = offset + 28;
                }
            }
        }
        break;

        case 0x0602:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 108)
                {
                    proto_tree *netw_nodes_sts_tree;
                    proto_tree *netw_nodes_non_fatal_err_sts_tree;
                    proto_tree *netw_nodes_cyclic_err_ctrs_tree;
                    guint8 i;
                    guint8 node_num;

                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;

                    /* parsing 31 bytes of foo */
                    netw_nodes_sts_tree = proto_tree_add_subtree(command_tree, tvb, offset, 31, ett_omron_netw_nodes_sts, NULL, "Network Nodes Status");
                    node_num = 1;
                    for(i = 0; i < 31; i++)
                    {
                        field_tree = proto_tree_add_subtree_format(netw_nodes_sts_tree, tvb, offset, 1,
                                                ett_omron_netw_node_sts, NULL, "Node Number %d", node_num);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_3, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_2, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_1, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_low_0, tvb, offset, 1, ENC_BIG_ENDIAN);
                        node_num = node_num + 1;

                        field_tree = proto_tree_add_subtree_format(netw_nodes_sts_tree, tvb, offset, 1,
                                                ett_omron_netw_node_sts, NULL, "Node Number %d", node_num);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_3, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_2, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_1, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(field_tree, hf_omron_netw_node_sts_high_0, tvb, offset, 1, ENC_BIG_ENDIAN);
                        node_num = node_num + 1;

                        offset = offset + 1;
                    }

                    proto_tree_add_item(command_tree, hf_omron_com_cycle_time, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_polling_unit_node_num, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_cyclic_operation, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_cyclic_trans_status, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    offset =offset + 5;

                    netw_nodes_non_fatal_err_sts_tree = proto_tree_add_subtree(command_tree, tvb, offset, 8,
                        ett_omron_netw_nodes_non_fatal_err_sts, NULL, "Network Nodes Non-Fatal Error Status");

                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+0), hf_omron_cyclic_label_1,
                        ett_omron_cyclic_fields, cyclic_non_fatal_1_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+1), hf_omron_cyclic_label_2,
                        ett_omron_cyclic_fields, cyclic_non_fatal_2_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+2), hf_omron_cyclic_label_3,
                        ett_omron_cyclic_fields, cyclic_non_fatal_3_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+3), hf_omron_cyclic_label_4,
                        ett_omron_cyclic_fields, cyclic_non_fatal_4_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+4), hf_omron_cyclic_label_5,
                        ett_omron_cyclic_fields, cyclic_non_fatal_5_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+5), hf_omron_cyclic_label_6,
                        ett_omron_cyclic_fields, cyclic_non_fatal_6_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+6), hf_omron_cyclic_label_7,
                        ett_omron_cyclic_fields, cyclic_non_fatal_7_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(netw_nodes_non_fatal_err_sts_tree, tvb, (offset+7), hf_omron_cyclic_label_8,
                        ett_omron_cyclic_fields, cyclic_non_fatal_8_fields, ENC_BIG_ENDIAN);

                    offset = offset + 8;

                    netw_nodes_cyclic_err_ctrs_tree = proto_tree_add_subtree(command_tree, tvb, offset, 62,
                                            ett_omron_netw_nodes_cyclic_err_ctrs, NULL, "Network Nodes Cyclic Error Counters");
                    node_num = 1;
                    for(i = 0; i < 62; i++)
                    {
                        guint8 ctr = tvb_get_guint8(tvb, offset);
                        proto_tree_add_uint_format(netw_nodes_cyclic_err_ctrs_tree, hf_omron_node_error_count,
                                                   tvb, offset, 1, ctr, "Node Number %2d: %3d", node_num, ctr);
                        node_num = node_num + 1;
                        offset = offset + 1;
                    }
                }
            }
        }
        break;

        case 0x0603:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 16)
                {
                    proto_tree *status_flags_tree;

                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);

                    /* add status flag tree */
                    ti = proto_tree_add_item(command_tree, hf_omron_status_flags, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_flags_slave_master, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_flags_data_link, tvb, (offset+2), 1, ENC_BIG_ENDIAN);

                    /* command_tree for master node */
                    proto_tree_add_item(command_tree, hf_omron_master_node_number, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    offset = offset + 4;

                    /* Status flag blocks */
                    status_flags_tree = proto_tree_add_subtree(command_tree, tvb, offset, 96, ett_omron_data_link_status_tree, NULL, "Status flag blocks");

                    /* Status block 1 */
                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+0), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+0), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+1), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+0), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+2), 1, ENC_BIG_ENDIAN);

                    /* status block 2 */
                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+3), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+4), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+3), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+5), 1, ENC_BIG_ENDIAN);

                    /* status block 3 */
                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+6), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+7), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+6), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+8), 1, ENC_BIG_ENDIAN);

                    /* status block 4 */
                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_0, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_1, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_2, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_3, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_4, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_5, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_6, tvb, (offset+9), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_node_7, tvb, (offset+9), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_0, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_1, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_2, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_3, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_4, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_5, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_6, tvb, (offset+10), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_1_node_7, tvb, (offset+10), 1, ENC_BIG_ENDIAN);

                    ti = proto_tree_add_item(status_flags_tree, hf_omron_status_flags, tvb, (offset+9), 3, ENC_BIG_ENDIAN);
                    omron_status_tree = proto_item_add_subtree(ti, ett_omron_status_block);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_0, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_1, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_2, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_3, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_4, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_5, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_6, tvb, (offset+11), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_status_tree, hf_omron_status_2_node_7, tvb, (offset+11), 1, ENC_BIG_ENDIAN);

                    offset = offset + 12;
                }
            }
        }
        break;

        case 0x0620:
        {
            if(is_command)
            {
                if(reported_length_remaining == 1)
                {
                    proto_tree_add_item(command_tree, hf_omron_parameter, tvb, offset, 1, ENC_BIG_ENDIAN);
                    offset = offset + 1;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }

                else if(reported_length_remaining == 14)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_avg_cycle_time, tvb, (offset+2), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_max_cycle_time, tvb, (offset+6), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_min_cycle_time, tvb, (offset+10), 4, ENC_BIG_ENDIAN);
                    offset = offset + 14;
                }
            }
        }
        break;

        case 0x0701:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 9)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_year, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_month, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_date, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_hour, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_minute, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_second, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_day, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                    offset = offset + 9;
                }
            }
        }
        break;

        case 0x0702:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 5)
                {
                    proto_tree_add_item(command_tree, hf_omron_year, tvb, (offset), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_month, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_date, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_hour, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_minute, tvb, (offset+4), 1, ENC_BIG_ENDIAN);

                    if(reported_length_remaining == 7)
                    {
                        proto_tree_add_item(command_tree, hf_omron_second, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(command_tree, hf_omron_day, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                        offset = offset + 2;
                    }
                    offset = offset + 5;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x0801:
        {
            if(is_command)
            {
                /* zero-length case handled in previous switch statement */
                if(reported_length_remaining > 0)
                {
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining > 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+2), -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x0802:
        {
            if(is_response)
            {
                if(reported_length_remaining == 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_receptions, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
               }
            }
        }
        break;

        case 0x0803:
        {
            if(is_command)
            {
                /* zero-length case handled in previous switch statement */
                if(reported_length_remaining > 0)
                {
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x0920:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    if((tvb_get_ntohs(tvb, offset) & 0xC000) == 0x8000)
                    {
                        /* "FAL/FALS READ" */
                        proto_tree_add_item(command_tree, hf_omron_fals, tvb, offset, 2, ENC_BIG_ENDIAN);
                    }
                    else
                    {
                        /* "MESSAGE READ" / "MESSAGE CLEAR" */
                        /* add bitmask for message yes/no data */
                        proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_message,
                                               ett_message_fields, message_yes_no_fields, ENC_BIG_ENDIAN);
                    }
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
                else if(reported_length_remaining == 20)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_fals, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_error_message, tvb, (offset+4), 16, ENC_ASCII);
                    offset = offset + 20;
                }
                else if(reported_length_remaining >= 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    /* add bitmask for message yes/no data */
                    proto_tree_add_bitmask(command_tree, tvb, (offset+2), hf_omron_message,
                                           ett_message_fields, message_yes_no_fields, ENC_BIG_ENDIAN);

                    offset = offset + 4;
                    reported_length_remaining = reported_length_remaining - 4;

                    while (reported_length_remaining >= 32)
                    {
                        proto_tree_add_item(command_tree, hf_omron_read_message, tvb, offset, 32, ENC_ASCII);
                        offset = offset + 32;
                        reported_length_remaining = reported_length_remaining - 32;
                    }
                }
            }
        }
        break;

        case 0x0C01:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
                else if(reported_length_remaining == 5)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_unit_address, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_node_number, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_network_address, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                    offset = offset + 5;
                }

            }
        }
        break;

        case 0x0C02:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

        }
        break;

        case 0x0C03:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

        }
        break;

        case 0x2101:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_error_reset_fals_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

        }
        break;

        case 0x2102:
        {
            if(is_command)
            {
                if(reported_length_remaining == 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_beginning_record_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_records, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_max_no_of_stored_records, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_stored_records, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_records, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    offset = offset + 8;
                    reported_length_remaining = reported_length_remaining - 8;

                    while(reported_length_remaining >= 10)
                    {
                        error_log_tree = proto_tree_add_subtree(command_tree, tvb, offset, 10, ett_omron_error_log_data, NULL, "Error log data");

                        proto_tree_add_item(error_log_tree, hf_omron_error_reset_fals_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_error_reset_fals_no, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_minute, tvb, (offset+4), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_second, tvb, (offset+5), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_day, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_hour, tvb, (offset+7), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_year, tvb, (offset+8), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(error_log_tree, hf_omron_month, tvb, (offset+9), 1, ENC_BIG_ENDIAN);

                        offset = offset + 10;
                        reported_length_remaining = reported_length_remaining - 10;
                    }
                }
            }
        }
        break;

        case 0x2103:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2201:
        {
            if(is_command)
            {
                if(reported_length_remaining == 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_beginning_file_position, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_of_files, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    offset = offset + 6;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 50)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);

                    omron_disk_data_tree = proto_tree_add_subtree(command_tree, tvb, (offset+2), 26, ett_omron_disk_data, NULL, "Disk data");
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_volume_label, tvb, (offset+2), 12, ENC_ASCII);

                    omron_byte = tvb_get_guint8(tvb, (offset+14));
                    proto_tree_add_uint_format_value(omron_disk_data_tree, hf_omron_date_year, tvb, (offset+14), 1, omron_byte,
                        "%d", ((omron_byte>>1)+1980));

                    proto_tree_add_item(omron_disk_data_tree, hf_omron_date_month, tvb, (offset+14), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_date_day, tvb, (offset+14), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_date_hour, tvb, (offset+14), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_date_minute, tvb, (offset+14), 4, ENC_BIG_ENDIAN);

                    omron_byte = tvb_get_guint8(tvb, (offset+17));
                    proto_tree_add_uint_format_value(omron_disk_data_tree, hf_omron_date_second, tvb, (offset+17), 1, omron_byte,
                        "%d", ((omron_byte&0x1F)*2));

                    proto_tree_add_item(omron_disk_data_tree, hf_omron_total_capacity, tvb, (offset+18), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_unused_capacity, tvb, (offset+22), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_total_no_files, tvb, (offset+26), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(omron_disk_data_tree, hf_omron_no_files, tvb, (offset+28), 2, ENC_BIG_ENDIAN);

                    offset = offset + 30;
                    reported_length_remaining = reported_length_remaining - 30;

                    while(reported_length_remaining >= 20)
                    {
                        omron_file_data_tree = proto_tree_add_subtree(command_tree, tvb, offset, 20, ett_omron_file_data, NULL, "File data");

                        proto_tree_add_item(omron_file_data_tree, hf_omron_filename, tvb, offset, 12, ENC_ASCII);

                        omron_byte = tvb_get_guint8(tvb, (offset+12));
                        proto_tree_add_uint_format_value(omron_file_data_tree, hf_omron_date_year, tvb, (offset+12), 1, omron_byte,
                                                   "%d", ((omron_byte>>1)+1980));

                        proto_tree_add_item(omron_file_data_tree, hf_omron_date_month, tvb, (offset+12), 4, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_file_data_tree, hf_omron_date_day, tvb, (offset+12), 4, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_file_data_tree, hf_omron_date_hour, tvb, (offset+12), 4, ENC_BIG_ENDIAN);
                        proto_tree_add_item(omron_file_data_tree, hf_omron_date_minute, tvb, (offset+12), 4, ENC_BIG_ENDIAN);

                        omron_byte = tvb_get_guint8(tvb, (offset+15));
                        proto_tree_add_uint_format_value(omron_file_data_tree, hf_omron_date_second, tvb, (offset+15), 1, omron_byte,
                                                   "%d", ((omron_byte&0x1F)*2));

                        proto_tree_add_item(omron_file_data_tree, hf_omron_file_capacity, tvb, (offset+16), 4, ENC_BIG_ENDIAN);

                        offset = offset + 20;
                        reported_length_remaining = reported_length_remaining - 20;
                    } /* while */
                } /* if(reported_length_remaining >= 50) */
            }
        }
        break;

        case 0x2202:
        {
            if(is_command)
            {
                if(reported_length_remaining == 20)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+14), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+18), 2, ENC_BIG_ENDIAN);
                    offset = offset + 20;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 12)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_file_capacity, tvb, (offset+2), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+6), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+10), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining > 12)
                    {
                        proto_tree_add_item(command_tree, hf_omron_file_data, tvb, (offset+12), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x2203:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 22)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_file_parameter_code, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+4), 12, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_file_position, tvb, (offset+16), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data_length, tvb, (offset+20), 2, ENC_BIG_ENDIAN);
                    if(reported_length_remaining > 22)
                    {
                        proto_tree_add_item(command_tree, hf_omron_file_data, tvb, (offset+22), -1, ENC_NA);
                    }
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2204:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2205:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 16)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_files, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                    reported_length_remaining = reported_length_remaining - 4;

                    while(reported_length_remaining >= 12)
                    {
                        proto_tree_add_item(command_tree, hf_omron_filename, tvb, offset, 12, ENC_ASCII);
                        offset = offset + 12;
                        reported_length_remaining = reported_length_remaining - 12;
                    }
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_no_files, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                }
            }
        }
        break;

        case 0x2206:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_volume_parameter_code, tvb, (offset+2), 2, ENC_BIG_ENDIAN);

                    if(reported_length_remaining == 16)
                    {
                        proto_tree_add_item(command_tree, hf_omron_volume_label, tvb, (offset+4), 12, ENC_ASCII);
                        offset = offset + 12;
                    }
                    offset = offset + 4;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2207:
        {
            if(is_command)
            {
                if(reported_length_remaining == 28)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+14), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+16), 12, ENC_ASCII);
                    offset = offset + 28;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2208:
        {
            if(is_command)
            {
                if(reported_length_remaining == 26)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, ENC_ASCII);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+14), 12, ENC_ASCII);
                    offset = offset + 26;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2209:
        {
            if(is_command)
            {
                if(reported_length_remaining == 14)
                {
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+2), 12, ENC_ASCII);
                    offset = offset + 14;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x220A:
        {
            if(is_command)
            {
                if(reported_length_remaining == 22)
                {
                    proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+3), 3, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+8), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+10), 12, ENC_ASCII);
                    offset = offset + 22;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_items, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                }
            }
        }
        break;

        case 0x220B:
        {
            if(is_command)
            {
                if(reported_length_remaining == 22)
                {
                    proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_parameter_area_code, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_address, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+8), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+10), 12, ENC_ASCII);
                    offset = offset + 22;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_words, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    offset = offset + 4;
                }
            }
        }
        break;

        case 0x220C:
        {
            if(is_command)
            {
                if(reported_length_remaining == 26)
                {
                    proto_tree_add_item(command_tree, hf_omron_transfer_parameter_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_program_number, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_begin_word, tvb, (offset+4), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_number_of_bytes, tvb, (offset+8), 4, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_disk_no, tvb, (offset+12), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_filename, tvb, (offset+14), 12, ENC_ASCII);
                    offset = offset + 26;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_number_of_bytes, tvb, (offset+2), 4, ENC_BIG_ENDIAN);
                    offset = offset + 6;
                }
            }
        }
        break;

        case 0x220F:
        {
            if(is_command)
            {
                if(reported_length_remaining == 3)
                {
                    proto_tree_add_item(command_tree, hf_omron_beginning_block_num, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_blocks, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    offset = offset + 3;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 9)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_blocks_remaining, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_total_num_blocks, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_type, tvb, (offset+6), 1, ENC_BIG_ENDIAN);
                    offset = offset + 7;
                    reported_length_remaining = reported_length_remaining - 7;

                    while(reported_length_remaining >= 2)
                    {
                        proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_data_type,
                            ett_omron_data_type, data_type_fields, ENC_BIG_ENDIAN);
                        proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                        offset = offset + 2;
                        reported_length_remaining = reported_length_remaining - 2;
                    }
                }
            }
        }
        break;

        case 0x2210:
        {
            if(is_command)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_block_num, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 4)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_bitmask(command_tree, tvb, (offset+2), hf_omron_data_type,
                        ett_omron_data_type, data_type_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+3), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+4), -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x2211:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 4)
                {
                    proto_tree_add_bitmask(command_tree, tvb, offset, hf_omron_data_type,
                        ett_omron_data_type, data_type_fields, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_control_data, tvb, (offset+1), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_block_num, tvb, (offset+2), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+4), -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }

        break;

        case 0x2301:
        {
            if(is_command)
            {
                if(reported_length_remaining >= 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_number_of_bits_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                    reported_length_remaining = reported_length_remaining - 2;

                    while (reported_length_remaining >= 6)
                    {
                        proto_tree_add_item(command_tree, hf_omron_set_reset_specification, tvb, offset, 2, ENC_BIG_ENDIAN);
                        proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(command_tree, hf_omron_bit_flag, tvb, (offset+3), 3, ENC_BIG_ENDIAN);

                        offset = offset + 6;
                        reported_length_remaining = reported_length_remaining - 6;
                    }
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2302:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }

        }
        break;

        case 0x230A:
        {
            if(is_command)
            {
                if(reported_length_remaining == 6)
                {
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, offset, 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+1), 3, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_unit_uint16, tvb, (offset+4), 2, ENC_BIG_ENDIAN);
                    offset = offset + 6;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining >= 8)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_command_memory_area_code, tvb, (offset+2), 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_transfer_beginning_address, tvb, (offset+3), 3, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_num_unit_uint16, tvb, (offset+6), 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_data, tvb, (offset+8), -1, ENC_NA);
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        case 0x2601:
        {
            if(is_command)
            {
                if((reported_length_remaining > 0) && (reported_length_remaining <= 8))
                {
                    proto_tree_add_item(command_tree, hf_omron_name_data, tvb, offset, -1, ENC_ASCII);
                    offset = offset + reported_length_remaining;
                }
            }

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2602:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if(reported_length_remaining == 2)
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    offset = offset + 2;
                }
            }
        }
        break;

        case 0x2603:
        {
            /* command data length is 0 */

            if(is_response)
            {
                if((reported_length_remaining > 2) && (reported_length_remaining <= (2+8)))
                {
                    proto_tree_add_item(command_tree, hf_omron_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(command_tree, hf_omron_name_data, tvb, offset, -1, ENC_ASCII);
                    offset = offset + reported_length_remaining;
                }
            }
        }
        break;

        default:
        { /* invalid command ?? */
            /* ??? dissector_bug ??*/
        }
        break;

        } /* switch(command_code) */

        if ((guint)offset != tvb_reported_length(tvb)) {
            expert_add_info(pinfo, omron_tree, &ei_omron_bad_length);
        }

    } /* if(tree) */

    return tvb_captured_length(tvb);
}

static guint
get_omron_fins_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
    guint32 length = tvb_get_ntohl(tvb, offset + 4);

    // length field does not include magic or length fields
    return 8 + length;
}

static int
dissect_omron_fins_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    proto_item *ti = NULL;
    proto_tree *omron_tree = NULL;
    proto_tree *omron_tcp_header_tree = NULL;

    gint fins_pdu_offset = 0;
    guint32 tcp_command = tvb_get_ntohl(tvb, 8);

    switch (tcp_command) {
        case TCP_CMD_NODE_ADDRESS_DATA_SEND_CLIENT:
            fins_pdu_offset = 20;
            break;
        case TCP_CMD_NODE_ADDRESS_DATA_SEND_SERVER:
            fins_pdu_offset = 24;
            break;
        case TCP_CMD_FRAME_SEND:
        case TCP_CMD_FRAME_SEND_ERROR_NOTIFICATION:
        case TCP_CMD_CONNECTION_CONFIRMATION:
            fins_pdu_offset = 16;
            break;
        default:
            return 0;
    }

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMRON");

    col_add_fstr(pinfo->cinfo, COL_INFO, "FINS/TCP : %s",
                 val_to_str(tcp_command, tcp_command_cv, "Unknown (%d)"));

    if (tree) {
        ti = proto_tree_add_item(tree, proto_omron_fins, tvb, 0, -1, ENC_NA);
        omron_tree = proto_item_add_subtree(ti, ett_omron);

        omron_tcp_header_tree = proto_tree_add_subtree(
            omron_tree, tvb, 0, fins_pdu_offset, ett_omron_tcp_header, &ti, "FINS/TCP Header");

        proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_magic, tvb, 0, 4, ENC_BIG_ENDIAN);
        proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_length, tvb, 4, 4, ENC_BIG_ENDIAN);
        proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_command, tvb, 8, 4, ENC_BIG_ENDIAN);
        proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_error_code, tvb, 12, 4, ENC_BIG_ENDIAN);

        if (tcp_command == TCP_CMD_NODE_ADDRESS_DATA_SEND_CLIENT) {
            proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_client_node_address, tvb, 16, 4, ENC_BIG_ENDIAN);
        } else if (tcp_command == TCP_CMD_NODE_ADDRESS_DATA_SEND_SERVER) {
            proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_client_node_address, tvb, 16, 4, ENC_BIG_ENDIAN);
            proto_tree_add_item(omron_tcp_header_tree, hf_omron_tcp_server_node_address, tvb, 20, 4, ENC_BIG_ENDIAN);
        }
    }

    if (tcp_command == TCP_CMD_FRAME_SEND) {
        tvbuff_t *slice = tvb_new_subset_remaining(tvb, fins_pdu_offset);

        dissect_omron_fins_common(slice, pinfo, omron_tree);
    }

    return tvb_reported_length(tvb);
}

static int
dissect_omron_fins_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    if (tvb_get_ntohl(tvb, 0) != OMRON_FINS_TCP_MAGIC_BYTES) {
        return 0;
    }

    tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8,
                     get_omron_fins_tcp_pdu_len, dissect_omron_fins_tcp_pdu, data);

    return tvb_reported_length(tvb);
}

static int
dissect_omron_fins_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    guint8 omron_byte;
    proto_item *ti = NULL;
    proto_tree *omron_tree = NULL;

    /* Make sure we have enough actual data to do the heuristics checks */
    if (tvb_captured_length(tvb) < 12) {
        return 0;
    }
    /* Check some bytes to see if it's OMRON */
    omron_byte = tvb_get_guint8(tvb, 1);
    if (omron_byte != 0x00) {
        return 0;
    }

    if (tree) {
        ti = proto_tree_add_item(tree, proto_omron_fins, tvb, 0, -1, ENC_NA);
        omron_tree = proto_item_add_subtree(ti, ett_omron);
    }

    return dissect_omron_fins_common(tvb, pinfo, omron_tree);
}

void
proto_register_omron_fins(void)
{
#if 0
    module_t *omron_fins_module;
#endif

    /* Setup list of header fields */

    static hf_register_info hf[] = {
        { &hf_omron_tcp_magic,
        { "Magic Bytes", "omron.tcp.magic", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_tcp_length,
        { "Length", "omron.tcp.length", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_tcp_command,
        { "Command", "omron.tcp.command", FT_UINT32, BASE_HEX, VALS(tcp_command_cv), 0x0, NULL, HFILL }},

        { &hf_omron_tcp_error_code,
        { "Error Code", "omron.tcp.error_code", FT_UINT32, BASE_HEX, VALS(tcp_error_code_cv), 0x0, NULL, HFILL }},

        { &hf_omron_tcp_client_node_address,
        { "Client Node Address", "omron.tcp.client_node_address", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_tcp_server_node_address,
        { "Server Node Address", "omron.tcp.server_node_address", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_icf,
        { "OMRON ICF Field", "omron.icf", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_icf_gwb,
        { "Gateway bit", "omron.icf.gwb", FT_UINT8, BASE_HEX, VALS(icf_gw_vals), ICF_GW_MASK, NULL, HFILL }},

        { &hf_omron_icf_dtb,
        { "Data Type bit", "omron.icf.dtb", FT_UINT8, BASE_HEX, VALS(icf_dtb_vals), ICF_DTB_MASK, NULL, HFILL }},

        { &hf_omron_icf_rb0,
        { "Reserved bit 0", "omron.icf.rb0", FT_UINT8, BASE_HEX, NULL, ICF_RB0_MASK, NULL, HFILL }},

        { &hf_omron_icf_rb1,
        { "Reserved bit 1", "omron.icf.rb1", FT_UINT8, BASE_HEX, NULL, ICF_RB1_MASK, NULL, HFILL }},

        { &hf_omron_icf_rb2,
        { "Reserved bit 2", "omron.icf.rb2", FT_UINT8, BASE_HEX, NULL, ICF_RB2_MASK, NULL, HFILL }},

        { &hf_omron_icf_rb3,
        { "Reserved bit 3", "omron.icf.rb3", FT_UINT8, BASE_HEX, NULL, ICF_RB3_MASK, NULL, HFILL }},

        { &hf_omron_icf_rb4,
        { "Reserved bit 4", "omron.icf.rb4", FT_UINT8, BASE_HEX, NULL, ICF_RB4_MASK, NULL, HFILL }},

        { &hf_omron_icf_rsb,
        { "Response setting bit", "omron.icf.rsb", FT_UINT8, BASE_HEX, VALS(icf_rsb_vals), ICF_RSB_MASK, NULL, HFILL }},

        { &hf_omron_rsv,
        { "Reserved", "omron.rsv", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_gct,
        { "Gateway Count", "omron.gct", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_dna,
        { "Destination network address", "omron.dna", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_dna_range), 0x0, NULL, HFILL }},

        { &hf_omron_da1,
        { "Destination node number", "omron.da1", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_da1_range), 0x0, NULL, HFILL }},

        { &hf_omron_da2,
        { "Destination unit address", "omron.da2", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_da2_range), 0x0, NULL, HFILL }},

        { &hf_omron_sna,
        { "Source network address", "omron.sna", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_sna_range), 0x0, NULL, HFILL }},

        { &hf_omron_sa1,
        { "Source node number", "omron.sa1", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_sa1_range), 0x0, NULL, HFILL }},

        { &hf_omron_sa2,
        { "Source unit address", "omron.sa2", FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_sa2_range), 0x0, NULL, HFILL }},

        { &hf_omron_sid,
        { "Service ID", "omron.sid", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_command,
        { "Command CODE", "omron.command", FT_UINT16, BASE_HEX, VALS(command_code_cv), 0x0, NULL, HFILL }},

        { &hf_omron_command_memory_area_code,
        { "Memory Area Code", "omron.memory.area.read", FT_UINT8, BASE_HEX, VALS(memory_area_code_cv), 0x0, NULL, HFILL }},

        { &hf_omron_response_code,
        { "Response code", "omron.response.code", FT_UINT16, BASE_HEX, VALS(response_codes), 0x0, NULL, HFILL }},

        { &hf_omron_command_data,
        { "Command Data", "omron.command.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

        { &hf_omron_address,
        { "Beginning address", "omron.memory.address", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

        { &hf_omron_address_bits,
        { "Beginning address bits", "omron.memory.address.bits", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},

        { &hf_omron_num_items,
        { "Number of items", "omron.memory.numitems", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},

        { &hf_omron_response_data,
        { "Response data", "omron.response.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

        { &hf_omron_parameter_area_code,
        { "Parameter area code", "omron.parameter_area_code", FT_UINT16, BASE_HEX, VALS(parameter_area_codes), 0x0, NULL, HFILL }},

        { &hf_omron_beginning_word,
        { "Beginning word", "omron.word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_num_words,
        { "No. words or Bytes", "omron.numwords", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_program_number,
        { "Program number", "omron.program_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_protect_code,
        { "Protect code", "omron.protect_code", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_begin_word,
        { "Beginning word", "omron.word.begin", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_last_word,
        { "Last word", "omron.word.last", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_password,
        { "Password", "omron.password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_clear_code,
        { "Clear Code", "omron.clearcode", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_mode_code,
        { "Mode Code", "omron.mode_code", FT_UINT8, BASE_HEX, VALS(mode_codes), 0x0, NULL, HFILL }},

        { &hf_omron_monitor_label,
        { "Mode Code (Default Monitor)", "omron.mode_code_default_monitor", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_controller_model,
        { "Controller model", "omron.controller.model", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_controller_version,
        { "Controller version", "omron.controller.version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_for_system_use,
        { "For system use", "omron.system.use", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_program_area_size,
        {"Program area size", "omron.area_data.program_area_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_iom_size,
        {"IOM size", "omron.area_data.iom_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_num_dm_words,
        { "No. of DM words", "omron.area_data.dm_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_timer_counter_size,
        { "Timer/counter size", "omron.area_data.timer_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_expansion_dm_size,
        { "Expansion DM size", "omron.area_data.dm_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},

        { &hf_omron_num_step_transitions,
        { "No. of steps/transitions", "omron.area_data.num_steps", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_kind_memory_card,
        { "Kind of Memory card", "omron.area_data.memory_card", FT_UINT8, BASE_DEC, VALS(memory_card_codes), 0x0, NULL, HFILL }},

        { &hf_omron_memory_card_size,
        { "Memory card size", "omron.area_data.memory_card.size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_0,
        { "CPU Bus Unit No. 0", "omron.cpubus_unit.no0", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_1,
        { "CPU Bus Unit No. 1", "omron.cpubus_unit.no1", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_2,
        { "CPU Bus Unit No. 2", "omron.cpubus_unit.no2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_3,
        { "CPU Bus Unit No. 3", "omron.cpubus_unit.no3", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_4,
        { "CPU Bus Unit No. 4", "omron.cpubus_unit.no4", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_5,
        { "CPU Bus Unit No. 5", "omron.cpubus_unit.no5", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_6,
        { "CPU Bus Unit No. 6", "omron.cpubus_unit.no6", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_7,
        { "CPU Bus Unit No. 7", "omron.cpubus_unit.no7", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_8,
        { "CPU Bus Unit No. 8", "omron.cpubus_unit.no8", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_9,
        { "CPU Bus Unit No. 9", "omron.cpubus_unit.no9", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_10,
        { "CPU Bus Unit No. 10", "omron.cpubus_unit.no10", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_11,
        { "CPU Bus Unit No. 11", "omron.cpubus_unit.no11", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_12,
        { "CPU Bus Unit No. 12", "omron.cpubus_unit.no12", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_13,
        { "CPU Bus Unit No. 13", "omron.cpubus_unit.no13", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_14,
        { "CPU Bus Unit No. 14", "omron.cpubus_unit.no14", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_unit_15,
        { "CPU Bus Unit No. 15", "omron.cpubus_unit.no15", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cpu_bus_reserved,
        { "CPU Bus Unit Reserved", "omron.cpubus_unit.reserved", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_io_data_num_sysmac_1,
        { "No. of SYSMAC BUS/2 Masters mounted", "omron.remote_io_date.sysmac_1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_io_data_num_sysmac_2,
        { "No. of SYSMAC BUS Masters mounted", "omron.remote_io_date.sysmac_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_pc_status,
        { "PC status", "omron.pc_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_pc_status_pdc,
        { "Peripheral Device connected", "omron.pc_status.pdc", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL}},
        { &hf_omron_pc_status_hi,
        { "With built-in host interface", "omron.pc_status.hi", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL}},
        { &hf_omron_pc_status_r1,
        { "Reserved 1", "omron.pc_status.r1", FT_UINT8, BASE_DEC, NULL, 0x20, NULL, HFILL}},
        { &hf_omron_pc_status_r2,
        { "Reserved 2", "omron.pc_status.r2", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL}},
        { &hf_omron_pc_status_rack_num,
        { "Rack Number", "omron.pcp_status.rack_num", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}},
        { &hf_omron_unit_address,
        { "Unit address", "omron.unit_address", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_num_units,
        { "No. of Units", "omron.unit_nums", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_model_number,
        { "Model Number", "omron.model_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_status,
        { "Status", "omron.status", FT_UINT8, BASE_HEX, VALS(status_codes), 0x0, NULL, HFILL}},
        { &hf_omron_fatal_error_data,
        { "Fatal error data", "omron.fatal_error_data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_fatal_fals_error,
        {"FALS error", "omron.fatal.fals_error", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }},
        { &hf_omron_fatal_sfc_error,
        {"Fatal SFC error", "omron.fatal.sfc_error", FT_UINT16, BASE_DEC, NULL, 0x4000, NULL, HFILL }},
        { &hf_omron_fatal_cycle_time_over,
        {"Cycle time over", "omron.fatal.cycle_time_over", FT_UINT16, BASE_DEC, NULL, 0x2000, NULL, HFILL }},
        { &hf_omron_fatal_program_error,
        {"Program error", "omron.fatal.program_error", FT_UINT16, BASE_DEC, NULL, 0x1000, NULL, HFILL }},
        { &hf_omron_fatal_io_setting_error,
        {"I/O setting error", "omron.fatal.io_setting_error", FT_UINT16, BASE_DEC, NULL, 0x0800, NULL, HFILL }},
        { &hf_omron_fatal_io_point_overflow,
        {"I/O point overflow", "omron.fatal.io_point_overflow", FT_UINT16, BASE_DEC, NULL, 0x0400, NULL, HFILL }},
        { &hf_omron_fatal_cpu_bus_error,
        {"CPU bus error", "omron.fatal.cpu_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0200, NULL, HFILL }},
        { &hf_omron_fatal_duplication_error,
        {"Duplication error", "omron.fatal.duplication_error", FT_UINT16, BASE_DEC, NULL, 0x0100, NULL, HFILL }},
        { &hf_omron_fatal_io_bus_error,
        {"I/O bus error", "omron.fatal.io_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0080, NULL, HFILL }},
        { &hf_omron_fatal_memory_error,
        {"Memory error", "omron.fatal.memory_error", FT_UINT16, BASE_DEC, NULL, 0x0040, NULL, HFILL }},
        { &hf_omron_fatal_rv_1,
        {"Reserved", "omron.fatal.rv_1", FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL }},
        { &hf_omron_fatal_rv_2,
        {"Reserved", "omron.fatal.rv_2", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL }},
        { &hf_omron_fatal_rv_3,
        {"Reserved", "omron.fatal.rv_3", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL }},
        { &hf_omron_fatal_rv_4,
        {"Reserved", "omron.fatal.rv_4", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL }},
        { &hf_omron_fatal_rv_5,
        {"Reserved", "omron.fatal.rv_5", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL }},
        { &hf_omron_fatal_watch_dog_timer_error,
        {"Watch dog timer error", "omron.fatal.watch_dog_timer_error", FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL }},
        { &hf_omron_non_fatal_error_data,
        { "Non fatal error data", "omron.fatal_error_data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_non_fatal_rv1,
        { "Reserved", "omron.non_fatal.rv1", FT_UINT16, BASE_DEC, NULL, 0x8000, NULL, HFILL }},
        { &hf_omron_non_fatal_rv2,
        { "Reserved", "omron.non_fatal.rv2", FT_UINT16, BASE_DEC, NULL, 0x4000, NULL, HFILL }},
        { &hf_omron_non_fatal_power_interruption,
        { "Momentary power interruption", "omron.non_fatal.power_interruption", FT_UINT16, BASE_DEC, NULL, 0x2000, NULL, HFILL }},
        { &hf_omron_non_fatal_cpu_bus_unit_setting_error,
        { "CPU Bus Unit setting error", "omron.non_fatal.cpu_bus_unit_setting_error", FT_UINT16, BASE_DEC, NULL, 0x1000, NULL, HFILL }},
        { &hf_omron_non_fatal_battery_error,
        { "Battery error", "omron.non_fatal.batter_error", FT_UINT16, BASE_DEC, NULL, 0x0800, NULL, HFILL }},
        { &hf_omron_non_fatal_sysmac_bus_error,
        { "SYSMAC BUS error", "omron.non_fatal.sysmac_bus_error", FT_UINT16, BASE_DEC, NULL, 0x0400, NULL, HFILL }},
        { &hf_omron_non_fatal_sysmac_bus2_error,
        { "SYSMAC BUS/2 error", "omron.non_fatal.sysmac_bus2_error", FT_UINT16, BASE_DEC, NULL, 0x0200, NULL, HFILL }},
        { &hf_omron_non_fatal_cpu_bus_unit_error,
        { "CPU Bus Unit error", "omron.non_fatal.cpu_bus_unit_error", FT_UINT16, BASE_DEC, NULL, 0x0100, NULL, HFILL }},
        { &hf_omron_non_fatal_rv3,
        { "Reserved", "omron.non_fatal.rv3", FT_UINT16, BASE_DEC, NULL, 0x0080, NULL, HFILL }},
        { &hf_omron_non_fatal_io_verification_error,
        { "I/O verification error", "omron.non_fatal.io_verification_error", FT_UINT16, BASE_DEC, NULL, 0x0040, NULL, HFILL }},
        { &hf_omron_non_fatal_rv4,
        { "Reserved", "omron.non_fatal.rv4", FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL }},
        { &hf_omron_non_fatal_sfc_error,
        { "Non-fatal SFC error v", "omron.non_fatal.sfc_error", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL }},
        { &hf_omron_non_fatal_indirect_dm_error,
        { "Indirect DM error", "omron.non_fatal.indirect_dm_error", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL }},
        { &hf_omron_non_fatal_jmp_error,
        { "JMP error", "omron.non_fatal.jmp_error", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL }},
        { &hf_omron_non_fatal_rv5,
        { "Reserved", "omron.non_fatal.rv5", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL }},
        { &hf_omron_non_fatal_fal_error,
        { "FAL error", "omron.non_fatal.fal_error", FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL }},
        { &hf_omron_message,
        { "Message", "omron.message", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_message_no_0,
        { "Message no. 0", "omron.message.no_0", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
        { &hf_omron_message_no_1,
        { "Message no. 1", "omron.message.no_1", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
        { &hf_omron_message_no_2,
        { "Message no. 2", "omron.message.no_2", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x2000, NULL, HFILL }},
        { &hf_omron_message_no_3,
        { "Message no. 3", "omron.message.no_3", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x1000, NULL, HFILL }},
        { &hf_omron_message_no_4,
        { "Message no. 4", "omron.message.no_4", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0800, NULL, HFILL }},
        { &hf_omron_message_no_5,
        { "Message no. 5", "omron.message.no_5", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0400, NULL, HFILL }},
        { &hf_omron_message_no_6,
        { "Message no. 6", "omron.message.no_6", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0200, NULL, HFILL }},
        { &hf_omron_message_no_7,
        { "Message no. 7", "omron.message.no_7", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100, NULL, HFILL }},
        { &hf_omron_message_rv_0,
        { "Reserved", "omron.message.rv_0", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080, NULL, HFILL }},
        { &hf_omron_message_rv_1,
        { "Reserved", "omron.message.rv_1", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0040, NULL, HFILL }},
        { &hf_omron_message_rv_2,
        { "Reserved", "omron.message.rv_2", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0020, NULL, HFILL }},
        { &hf_omron_message_rv_3,
        { "Reserved", "omron.message.rv_3", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0010, NULL, HFILL }},
        { &hf_omron_message_rv_4,
        { "Reserved", "omron.message.rv_4", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0008, NULL, HFILL }},
        { &hf_omron_message_rv_5,
        { "Reserved", "omron.message.rv_5", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0004, NULL, HFILL }},
        { &hf_omron_message_rv_6,
        { "Reserved", "omron.message.rv_6", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0002, NULL, HFILL }},
        { &hf_omron_message_rv_7,
        { "Reserved", "omron.message.rv_7", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0001, NULL, HFILL }},
        { &hf_omron_fals,
        { "FALS / FALS no.", "omron.fals", FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL}},
        { &hf_omron_error_message,
        { "Error message", "omron.error_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
        { &hf_omron_parameter,
        { "Parameter", "omron.parameter", FT_UINT8, BASE_HEX, VALS(parameter_codes), 0x0, NULL, HFILL }},
        { &hf_omron_avg_cycle_time,
        { "Average cycle time", "omron.avg_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_max_cycle_time,
        { "Max. cycle time", "omron.max_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_min_cycle_time,
        { "Min cycle time", "omron.min_cycle_time", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_year,
        { "Year", "omron.year", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_month,
        { "Month", "omron.month", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_date,
        { "Date", "omron.date", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_hour,
        { "Hour", "omron.hour", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_minute,
        { "Minute", "omron.minute", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_second,
        { "Second", "omron.second", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_day,
        { "Day", "omron.day", FT_UINT8, BASE_DEC, VALS(omron_days), 0x0, NULL, HFILL }},
        { &hf_omron_read_message,
        { "Message", "omron.read_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_node_number,
        { "Node number", "omron.node_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_network_address,
        { "Network address", "omron.network_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_error_reset_fals_no,
        { "Error reset FAL no.", "omron.error_reset_fals_no", FT_UINT16, BASE_RANGE_STRING|BASE_HEX, RVALS(omron_error_reset_range), 0x0, NULL, HFILL }},
        { &hf_omron_beginning_record_no,
        { "Beginning record no.", "omron.beginning_record_no", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_no_of_records,
        { "No. of records", "omron.no_of_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_max_no_of_stored_records,
        { "Max. no. of stored records", "omron.max_no_of_stored_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_no_of_stored_records,
        { "No. of stored records", "omron.no_stored_records", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_disk_no,
        { "Disk no.", "omron.disk_no", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_beginning_file_position,
        { "Beginning file position", "omron.beginning_file_position", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_no_of_files,
        { "No. of files", "omron.no_of_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_volume_label,
        { "Volume label", "omron.disk_data.volume_label", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_date_year,
        { "Year", "omron.disk_data.year", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_date_month,
        { "Month", "omron.disk_data.month", FT_UINT32, BASE_DEC, NULL, 0x01E00000, NULL, HFILL }},
        { &hf_omron_date_day,
        { "Day", "omron.disk_data.day", FT_UINT32, BASE_DEC, NULL, 0x001F0000, NULL, HFILL }},
        { &hf_omron_date_hour,
        { "Hour", "omron.disk_data.hour", FT_UINT32, BASE_DEC, NULL, 0x0000F800, NULL, HFILL }},
        { &hf_omron_date_minute,
        { "Minute", "omron.disk_data.minute", FT_UINT32, BASE_DEC, NULL, 0x000007E0, NULL, HFILL }},
        { &hf_omron_date_second,
        { "Second", "omron.disk_data.second", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_total_capacity,
        { "Total capacity", "omron.disk_data.total_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_unused_capacity,
        { "Unused capacity", "omron.disk_data.unused_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_total_no_files,
        { "Total no. of files", "omron.disk_data.total_no_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_no_files,
        { "No. of files", "omron.disk_data.no_files", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_filename,
        { "Filename", "omron.file_data.filename", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_file_capacity,
        { "File capacity", "omron.file_data.file_capacity", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_file_position,
        { "File position", "omron.file_position", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_data_length,
        { "Data length", "omron.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_file_data,
        { "File data", "omron.file_data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_file_parameter_code,
        { "Parameter code", "omron.file_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_file_parameter_codes), 0x0, NULL, HFILL }},
        { &hf_omron_volume_parameter_code,
        { "Volume parameter code", "omron.volume_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_volume_parameter_codes), 0x0, NULL, HFILL }},
        { &hf_omron_transfer_parameter_code,
        { "Parameter code", "omron.transfer_parameter_code", FT_UINT16, BASE_HEX, VALS(omron_transfer_parameter_codes), 0x0, NULL, HFILL }},
        { &hf_omron_transfer_beginning_address,
        { "Beginning address", "omron.transfer_beginning_address", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_number_of_bytes,
        { "Number of bytes", "omron.number_of_bytes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_number_of_bits_flags,
        { "No. of bits/flags", "omron.number_of_bits_flags", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_set_reset_specification,
        { "Set/Reset Specification", "omron.set_reset_specification", FT_UINT16, BASE_HEX, VALS(omron_set_reset_specifications), 0x0, NULL, HFILL }},
        { &hf_omron_bit_flag,
        { "Bit/flag", "omron.bit_flag", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_data,
        { "Data", "omron.data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_beginning_block_num,
        { "Beginning block number", "omron.beginning_block_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_num_blocks,
        { "Number of blocks", "omron.num_blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_num_blocks_remaining,
        { "Number of blocks remaining", "omron.num_blocks_remaining", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_total_num_blocks,
        { "Total number of blocks", "omron.total_num_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_type,
        { "Type", "omron.type", FT_UINT8, BASE_HEX, VALS(omron_type_codes), 0x0, NULL, HFILL }},
        { &hf_omron_data_type,
        { "Data type", "omron.data_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_data_type_type,
        { "Data type", "omron.data_type_type", FT_UINT8, BASE_HEX, VALS(omron_data_type_bits), 0x07, NULL, HFILL }},
        { &hf_omron_data_type_rv,
        { "Reserved", "omron.data_type_rv", FT_UINT8, BASE_HEX, NULL, 0x38, NULL, HFILL }},
        { &hf_omron_data_type_protected,
        { "Protected", "omron.data_type_protected", FT_BOOLEAN, 8, TFS(&boolean_data_type_protected), 0x40, NULL, HFILL }},
        { &hf_omron_data_type_end,
        { "Block", "omron.data_type_end", FT_BOOLEAN, 8, TFS(&boolean_data_type_end), 0x80, NULL, HFILL }},
        { &hf_omron_control_data,
        { "Control data", "omron.control_data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_block_num,
        { "Block number", "omron.block_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_num_unit_uint16,
        { "Number of units", "omron.num_unit_uint16", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_fixed,
        { "Fixed", "omron.fixed", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_intelligent_id_no,
        { "Intelligent ID no.", "omron.intelligent_id_no", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_first_word,
        { "First word", "omron.first_word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_read_len,
        { "Read length", "omron.read_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_no_of_link_nodes,
        { "No. of link nodes", "omron.no_of_link_nodes", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
        { &hf_omron_block_record_node_num_status,
        { "Data link status", "omron.block_record.node_num_status", FT_BOOLEAN, 8, TFS(&boolean_node_num_status), 0x80, NULL, HFILL }},
        { &hf_omron_block_record_node_num_num_nodes,
        { "No. of link nodes", "omron.block_record.node_num_num_nodes", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }},
        { &hf_omron_block_record_cio_area,
        { "CIO Area first word", "omron.block_record.cio_area", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_block_record_kind_of_dm,
        { "Kind of DM", "omron.block_record.kind_of_dm", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_block_record_dm_area_first_word,
        { "DM Area first word", "omron.block_record.dm_area_first_word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_block_record_no_of_total_words,
        { "No. of total words", "omron.block_record.no_of_total_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_status_flags,
        { "Status flags", "omron.status_flags", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_status_flags_slave_master,
        { "Status Type", "omron.status_flags.slave_master", FT_BOOLEAN, 8, TFS(&boolean_status_flags_slave_master), 0x80, NULL, HFILL }},
        { &hf_omron_status_flags_data_link,
        { "Status Data link", "omron.status_flags.data_link", FT_BOOLEAN, 8, TFS(&boolean_status_flags_data_link), 0x01, NULL, HFILL }},
        { &hf_omron_master_node_number,
        { "Master node number", "omron.master_node_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_status_node_0,
        { "Node 0", "omron.status.node.0", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x01, NULL, HFILL }},
        { &hf_omron_status_node_1,
        { "Node 1", "omron.status.node.1", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x02, NULL, HFILL }},
        { &hf_omron_status_node_2,
        { "Node 2", "omron.status.node.2", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x04, NULL, HFILL }},
        { &hf_omron_status_node_3,
        { "Node 3", "omron.status.node.3", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x08, NULL, HFILL }},
        { &hf_omron_status_node_4,
        { "Node 4", "omron.status.node.4", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x10, NULL, HFILL }},
        { &hf_omron_status_node_5,
        { "Node 5", "omron.status.node.5", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x20, NULL, HFILL }},
        { &hf_omron_status_node_6,
        { "Node 6", "omron.status.node.6", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x40, NULL, HFILL }},
        { &hf_omron_status_node_7,
        { "Node 7", "omron.status.node.7", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x80, NULL, HFILL }},
        { &hf_omron_status_1_node_0,
        { "Node 0", "omron.status.node.10", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x01, NULL, HFILL }},
        { &hf_omron_status_1_node_1,
        { "Node 1", "omron.status.node.11", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x02, NULL, HFILL }},
        { &hf_omron_status_1_node_2,
        { "Node 2", "omron.status.node.12", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x04, NULL, HFILL }},
        { &hf_omron_status_1_node_3,
        { "Node 3", "omron.status.node.13", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x08, NULL, HFILL }},
        { &hf_omron_status_1_node_4,
        { "Node 4", "omron.status.node.14", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x10, NULL, HFILL }},
        { &hf_omron_status_1_node_5,
        { "Node 5", "omron.status.node.15", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x20, NULL, HFILL }},
        { &hf_omron_status_1_node_6,
        { "Node 6", "omron.status.node.16", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x40, NULL, HFILL }},
        { &hf_omron_status_1_node_7,
        { "Node 7", "omron.status.node.17", FT_BOOLEAN, 8, TFS(&boolean_status_block_stop_run), 0x80, NULL, HFILL }},
        { &hf_omron_status_2_node_0,
        { "Node 0", "omron.status.node.20", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x01, NULL, HFILL }},
        { &hf_omron_status_2_node_1,
        { "Node 1", "omron.status.node.21", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x02, NULL, HFILL }},
        { &hf_omron_status_2_node_2,
        { "Node 2", "omron.status.node.22", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x04, NULL, HFILL }},
        { &hf_omron_status_2_node_3,
        { "Node 3", "omron.status.node.23", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x08, NULL, HFILL }},
        { &hf_omron_status_2_node_4,
        { "Node 4", "omron.status.node.24", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x10, NULL, HFILL }},
        { &hf_omron_status_2_node_5,
        { "Node 5", "omron.status.node.25", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x20, NULL, HFILL }},
        { &hf_omron_status_2_node_6,
        { "Node 6", "omron.status.node.26", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x40, NULL, HFILL }},
        { &hf_omron_status_2_node_7,
        { "Node 7", "omron.status.node.27", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status_2), 0x80, NULL, HFILL }},
        { &hf_omron_name_data,
        { "Name data", "omron.name_data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_num_receptions,
        { "Number of receptions", "omron.num_receptions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_netw_node_sts_low_0,
        { "Network", "omron.node_number.low.network", FT_BOOLEAN, 8, TFS(&boolean_member_network), 0x01, NULL, HFILL }},
        { &hf_omron_netw_node_sts_low_1,
        { "Exit status", "omron.node_number.low.exit_status", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x02, NULL, HFILL }},
        { &hf_omron_netw_node_sts_low_2,
        { "Reserved", "omron.node_number.low.rv", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
        { &hf_omron_netw_node_sts_low_3,
        { "Polling", "omron.node_number.low.polling_Status", FT_BOOLEAN, 8, TFS(&boolean_member_polling), 0x08, NULL, HFILL }},
        { &hf_omron_netw_node_sts_high_0,
        { "Network", "omron.node_number.high.network", FT_BOOLEAN, 8, TFS(&boolean_member_network), 0x10, NULL, HFILL }},
        { &hf_omron_netw_node_sts_high_1,
        { "Exit status", "omron.node_number.high.exit_status", FT_BOOLEAN, 8, TFS(&boolean_status_flag_status), 0x20, NULL, HFILL }},
        { &hf_omron_netw_node_sts_high_2,
        { "Reserved", "omron.node_number.high.rv", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
        { &hf_omron_netw_node_sts_high_3,
        { "Polling", "omron.node_number.high.polling_Status", FT_BOOLEAN, 8, TFS(&boolean_member_polling), 0x80, NULL, HFILL }},
        { &hf_omron_com_cycle_time,
        { "Communications cycle time (usec)", "omron.com_cycle_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_polling_unit_node_num,
        { "Current polling unit node number", "omron.polling_unit_node_num", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_operation,
        { "Cyclic operation", "omron.cyclic_operation", FT_UINT8, BASE_HEX, VALS(omron_cyclic_ops_codes), 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_trans_status,
        { "Cyclic transmission status", "omron.cyclic_trans_status", FT_UINT8, BASE_HEX, VALS(omron_cyclic_trans_codes), 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_label_1,
        { "Nodes  1- 7", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_7,
        { "Node  7 error status", "omron.cyclic_error.node.7", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_6,
        { "Node  6 error status", "omron.cyclic_error.node.6", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_5,
        { "Node  5 error status", "omron.cyclic_error.node.5", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_4,
        { "Node  4 error status", "omron.cyclic_error.node.4", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_3,
        { "Node  3 error status", "omron.cyclic_error.node.3", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_2,
        { "Node  2 error status", "omron.cyclic_error.node.2", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_1,
        { "Node  1 error status", "omron.cyclic_error.node.1", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_label_2,
        { "Nodes  8-15", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_15,
        { "Node 15 error status", "omron.cyclic_error.node.15", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_14,
        { "Node 14 error status", "omron.cyclic_error.node.14", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_13,
        { "Node 13 error status", "omron.cyclic_error.node.13", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_12,
        { "Node 12 error status", "omron.cyclic_error.node.12", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_11,
        { "Node 11 error status", "omron.cyclic_error.node.11", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_10,
        { "Node 10 error status", "omron.cyclic_error.node.10", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_9,
        { "Node  9 error status", "omron.cyclic_error.node.9", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_8,
        { "Node  8 error status", "omron.cyclic_error.node.8", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_3,
        { "Nodes 16-23", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_23,
        { "Node 23 error status", "omron.cyclic_error.node.23", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_22,
        { "Node 22 error status", "omron.cyclic_error.node.22", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_21,
        { "Node 21 error status", "omron.cyclic_error.node.21", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_20,
        { "Node 20 error status", "omron.cyclic_error.node.20", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_19,
        { "Node 19 error status", "omron.cyclic_error.node.19", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_18,
        { "Node 18 error status", "omron.cyclic_error.node.18", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_17,
        { "Node 17 error status", "omron.cyclic_error.node.17", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_16,
        { "Node 16 error status", "omron.cyclic_error.node.16", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_4,
        { "Nodes 24-31", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_31,
        { "Node 31 error status", "omron.cyclic_error.node.31", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_30,
        { "Node 30 error status", "omron.cyclic_error.node.30", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_29,
        { "Node 29 error status", "omron.cyclic_error.node.29", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_28,
        { "Node 28 error status", "omron.cyclic_error.node.28", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_27,
        { "Node 27 error status", "omron.cyclic_error.node.27", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_26,
        { "Node 26 error status", "omron.cyclic_error.node.26", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_25,
        { "Node 25 error status", "omron.cyclic_error.node.25", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_24,
        { "Node 24 error status", "omron.cyclic_error.node.24", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_5,
        { "Nodes 32-39", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_39,
        { "Node 39 error status", "omron.cyclic_error.node.39", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_38,
        { "Node 38 error status", "omron.cyclic_error.node.38", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_37,
        { "Node 37 error status", "omron.cyclic_error.node.37", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_36,
        { "Node 36 error status", "omron.cyclic_error.node.36", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_35,
        { "Node 35 error status", "omron.cyclic_error.node.35", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_34,
        { "Node 34 error status", "omron.cyclic_error.node.34", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_33,
        { "Node 33 error status", "omron.cyclic_error.node.33", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_32,
        { "Node 32 error status", "omron.cyclic_error.node.32", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_6,
        { "Nodes 40-47", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_47,
        { "Node 47 error status", "omron.cyclic_error.node.47", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_46,
        { "Node 46 error status", "omron.cyclic_error.node.46", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_45,
        { "Node 45 error status", "omron.cyclic_error.node.45", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_44,
        { "Node 44 error status", "omron.cyclic_error.node.44", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_43,
        { "Node 43 error status", "omron.cyclic_error.node.43", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_42,
        { "Node 42 error status", "omron.cyclic_error.node.42", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_41,
        { "Node 41 error status", "omron.cyclic_error.node.41", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_40,
        { "Node 40 error status", "omron.cyclic_error.node.40", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_7,
        { "Nodes 48-55", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_55,
        { "Node 55 error status", "omron.cyclic_error.node.55", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
        { &hf_omron_cyclic_54,
        { "Node 54 error status", "omron.cyclic_error.node.54", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_53,
        { "Node 53 error status", "omron.cyclic_error.node.53", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_52,
        { "Node 52 error status", "omron.cyclic_error.node.52", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_51,
        { "Node 51 error status", "omron.cyclic_error.node.51", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_50,
        { "Node 50 error status", "omron.cyclic_error.node.50", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_49,
        { "Node 49 error status", "omron.cyclic_error.node.49", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_48,
        { "Node 48 error status", "omron.cyclic_error.node.48", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_cyclic_label_8,
        { "Nodes 56-62", "omron.cyclic_error_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
        { &hf_omron_cyclic_62,
        { "Node 62 error status", "omron.cyclic_error.node.62", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
        { &hf_omron_cyclic_61,
        { "Node 61 error status", "omron.cyclic_error.node.61", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
        { &hf_omron_cyclic_60,
        { "Node 60 error status", "omron.cyclic_error.node.60", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
        { &hf_omron_cyclic_59,
        { "Node 59 error status", "omron.cyclic_error.node.59", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL }},
        { &hf_omron_cyclic_58,
        { "Node 58 error status", "omron.cyclic_error.node.58", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, NULL, HFILL }},
        { &hf_omron_cyclic_57,
        { "Node 57 error status", "omron.cyclic_error.node.57", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL }},
        { &hf_omron_cyclic_56,
        { "Node 56 error status", "omron.cyclic_error.node.56", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
        { &hf_omron_node_error_count,
        { "Node error count", "omron.node_error_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}
    };

    /* Setup protocol subtree array */
    static gint *ett[] = {
        &ett_omron,
        &ett_omron_tcp_header,
        &ett_omron_header,
        &ett_omron_icf_fields,
        &ett_omron_command_data,
        &ett_area_data,
        &ett_cpu_bus,
        &ett_io_data,
        &ett_pc_status_fields,
        &ett_fatal_fields,
        &ett_non_fatal_fields,
        &ett_message_fields,
        &ett_omron_error_log_data,
        &ett_omron_disk_data,
        &ett_omron_file_data,
        &ett_omron_data_type,
        &ett_omron_block_record,
        &ett_omron_status_block,
        &ett_omron_cyclic_fields,
        &ett_omron_netw_nodes_sts,
        &ett_omron_netw_node_sts,
        &ett_omron_netw_nodes_non_fatal_err_sts,
        &ett_omron_netw_nodes_cyclic_err_ctrs,
        &ett_omron_data_link_status_tree,
    };

    static ei_register_info ei[] = {
        { &ei_omron_command_code, { "omron.command.unknown", PI_UNDECODED, PI_WARN, "Unknown Command-Code", EXPFILL }},
        { &ei_oomron_command_memory_area_code, { "omron.memory.area.read.unknown", PI_UNDECODED, PI_WARN, "Unknown Memory-Area-Code (%u)", EXPFILL }},
        { &ei_omron_bad_length, { "omron.bad_length", PI_MALFORMED, PI_WARN, "Unexpected Length", EXPFILL }},
    };

    expert_module_t* expert_omron_fins;

    /* Register the protocol name and description */
    proto_omron_fins = proto_register_protocol (
            "OMRON FINS Protocol", /* name       */
            "OMRON FINS",          /* short name */
            "omron"                /* abbrev     */
            );

    /* Required function calls to register the header fields and subtrees used */
    proto_register_field_array(proto_omron_fins, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));
    expert_omron_fins = expert_register_protocol(proto_omron_fins);
    expert_register_field_array(expert_omron_fins, ei, array_length(ei));

    omron_fins_tcp_handle = register_dissector("omron.tcp", dissect_omron_fins_tcp, proto_omron_fins);
    omron_fins_udp_handle = register_dissector("omron.udp", dissect_omron_fins_udp, proto_omron_fins);

#if 0
    /*Register preferences module (See Section 2.6 for more on preferences) */
    omron_fins_module = prefs_register_protocol(proto_omron_fins, NULL);

    /* Register a sample preference */
    prefs_register_bool_preference(omron_fins_module, "show_hex",
         "Display numbers in Hex",
         "Enable to display numerical values in hexadecimal.",
         &gPREF_HEX);
#endif
}

void
proto_reg_handoff_omron_fins(void)
{
    dissector_add_uint_with_preference("tcp.port", OMRON_FINS_TCP_PORT, omron_fins_tcp_handle);
    dissector_add_uint_with_preference("udp.port", OMRON_FINS_UDP_PORT, omron_fins_udp_handle);
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */