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
|
/* packet-fcdns.c
* Routines for FC distributed Name Server (dNS)
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/tfs.h>
#include "packet-fc.h"
#include "packet-fcct.h"
#include "packet-fcswils.h"
void proto_register_fcdns(void);
void proto_reg_handoff_fcdns(void);
/*
* See FC-GS-2.
*/
static dissector_handle_t dns_handle;
/* protocol and registered fields */
/* Opcode definitions */
#define FCDNS_GA_NXT 0x0100
#define FCDNS_GID_A 0x0101
#define FCDNS_GPN_ID 0x0112
#define FCDNS_GNN_ID 0x0113
#define FCDNS_GCS_ID 0x0114
#define FCDNS_GFT_ID 0x0117
#define FCDNS_GSPN_ID 0x0118
#define FCDNS_GPT_ID 0x011A
#define FCDNS_GIPP_ID 0x011B
#define FCDNS_GFPN_ID 0x011C
#define FCDNS_GHA_ID 0x011D
#define FCDNS_GFD_ID 0x011E
#define FCDNS_GFF_ID 0x011F
#define FCDNS_GID_PN 0x0121
#define FCDNS_GIPP_PN 0x012B
#define FCDNS_GID_NN 0x0131
#define FCDNS_GPN_NN 0x0132
#define FCDNS_GIP_NN 0x0135
#define FCDNS_GIPA_NN 0x0136
#define FCDNS_GSNN_NN 0x0139
#define FCDNS_GNN_IP 0x0153
#define FCDNS_GIPA_IP 0x0156
#define FCDNS_GID_FT 0x0171
#define FCDNS_GPN_FT 0x0172
#define FCDNS_GNN_FT 0x0173
#define FCDNS_GID_PT 0x01A1
#define FCDNS_GID_IPP 0x01B1
#define FCDNS_GPN_IPP 0x01B2
#define FCDNS_GID_FF 0x01F1
#define FCDNS_RPN_ID 0x0212
#define FCDNS_RNN_ID 0x0213
#define FCDNS_RCS_ID 0x0214
#define FCDNS_RFT_ID 0x0217
#define FCDNS_RSPN_ID 0x0218
#define FCDNS_RPT_ID 0x021A
#define FCDNS_RIPP_ID 0x021B
#define FCDNS_RHA_ID 0x021D
#define FCDNS_RFD_ID 0x021E
#define FCDNS_RFF_ID 0x021F
#define FCDNS_RIP_NN 0x0235
#define FCDNS_RSNN_NN 0x0239
#define FCDNS_DA_ID 0x0300
/* dNS messages defined by FC-SW2 */
#define FCDNS_RA 0x0
#define FCDNS_GE_ID 0x0410
#define FCDNS_GE_PN 0x0420
#define FCDNS_GE_NN 0x0430
#define FCDNS_GE_IP 0x0450
#define FCDNS_GE_FT 0x0470
#define FCDNS_GE_PT 0x04A0
#define FCDNS_GE_ZM 0x04B0
#define FCDNS_GE_ZN 0x04C0
#define FCDNS_GE_IPP 0x04D0
#define FCDNS_GE_FF 0x04E0
static const value_string fc_dns_opcode_val[] = {
{FCDNS_GA_NXT, "GA_NXT" },
{FCDNS_GID_A, "GID_A" },
{FCDNS_GPN_ID, "GPN_ID" },
{FCDNS_GNN_ID, "GNN_ID" },
{FCDNS_GCS_ID, "GCS_ID" },
{FCDNS_GFT_ID, "GFT_ID" },
{FCDNS_GSPN_ID, "GSPN_ID" },
{FCDNS_GPT_ID, "GPT_ID" },
{FCDNS_GIPP_ID, "GIPP_ID" },
{FCDNS_GFPN_ID, "GFPN_ID" },
{FCDNS_GHA_ID, "GHA_ID" },
{FCDNS_GFD_ID, "GFD_ID" },
{FCDNS_GFF_ID, "GFF_ID" },
{FCDNS_GID_PN, "GID_PN" },
{FCDNS_GIPP_PN, "GIPP_PN" },
{FCDNS_GID_NN, "GID_NN" },
{FCDNS_GPN_NN, "GPN_NN" },
{FCDNS_GIP_NN, "GIP_NN" },
{FCDNS_GIPA_NN, "GIPA_NN" },
{FCDNS_GSNN_NN, "GSNN_NN" },
{FCDNS_GNN_IP, "GNN_IP" },
{FCDNS_GIPA_IP, "GIPA_IP" },
{FCDNS_GID_FT, "GID_FT" },
{FCDNS_GPN_FT, "GPN_FT" },
{FCDNS_GNN_FT, "GNN_FT" },
{FCDNS_GID_PT, "GID_PT" },
{FCDNS_GID_IPP, "GID_IPP" },
{FCDNS_GPN_IPP, "GPN_IPP" },
{FCDNS_GID_FF, "GID_FF" },
{FCDNS_RPN_ID, "RPN_ID" },
{FCDNS_RNN_ID, "RNN_ID" },
{FCDNS_RCS_ID, "RCS_ID" },
{FCDNS_RFT_ID, "RFT_ID" },
{FCDNS_RSPN_ID, "RSPN_ID" },
{FCDNS_RPT_ID, "RPT_ID" },
{FCDNS_RIPP_ID, "RIPP_ID" },
{FCDNS_RHA_ID, "RHA_ID" },
{FCDNS_RFD_ID, "RFD_ID" },
{FCDNS_RFF_ID, "RFF_ID" },
{FCDNS_RIP_NN, "RIP_NN" },
{FCDNS_RSNN_NN, "RSNN_NN"},
{FCDNS_DA_ID, "DA_ID"},
{FCDNS_GE_ID, "GE_ID"},
{FCDNS_GE_PN, "GE_PN"},
{FCDNS_GE_NN, "GE_NN"},
{FCDNS_GE_IP, "GE_IP"},
{FCDNS_GE_FT, "GE_FT"},
{FCDNS_GE_PT, "GE_PT"},
{FCDNS_GE_ZM, "GE_ZM"},
{FCDNS_GE_ZN, "GE_ZN"},
{FCDNS_GE_IPP, "GE_IPP"},
{FCDNS_GE_FF, "GE_FF"},
{FCCT_MSG_ACC, "MSG_ACC"},
{FCCT_MSG_RJT, "MSG_RJT"},
{0, NULL},
};
/* Port type definitions */
#define FCDNS_PTYPE_UNDEF 0x00
#define FCDNS_PTYPE_NPORT 0x01
#define FCDNS_PTYPE_NLPORT 0x02
#define FCDNS_PTYPE_FNLPORT 0x03
#define FCDNS_PTYPE_NXPORT 0x7F
#define FCDNS_PTYPE_FPORT 0x81
#define FCDNS_PTYPE_FLPORT 0x82
#define FCDNS_PTYPE_EPORT 0x84
#define FCDNS_PTYPE_BPORT 0x85
static const value_string fc_dns_port_type_val [] = {
{FCDNS_PTYPE_UNDEF , "Undefined Port Type"},
{FCDNS_PTYPE_NPORT , "N_Port"},
{FCDNS_PTYPE_NLPORT , "NL_Port"},
{FCDNS_PTYPE_FNLPORT , "F/NL_Port"},
{FCDNS_PTYPE_NXPORT , "Nx_Port"},
{FCDNS_PTYPE_FPORT , "F_Port"},
{FCDNS_PTYPE_FLPORT , "FL_Port"},
{FCDNS_PTYPE_EPORT , "E_Port"},
{FCDNS_PTYPE_BPORT , "B_Port"},
{0, NULL},
};
/* Reject Detailed Reason code definitions for dNS */
#define FCDNS_RJT_NOREASON 0x00
#define FCDNS_RJT_PIDNOTREG 0x01
#define FCDNS_RJT_PNAMENOTREG 0x02
#define FCDNS_RJT_NNAMENOTREG 0x03
#define FCDNS_RJT_CLASSNOTREG 0x04
#define FCDNS_RJT_IPNNOTREG 0x05
#define FCDNS_RJT_IPANOTREG 0x06
#define FCDNS_RJT_FC4NOTREG 0x07
#define FCDNS_RJT_SPNAMENOTREG 0x08
#define FCDNS_RJT_SNNAMENOTREG 0x09
#define FCDNS_RJT_PTYPENOTREG 0x0A
#define FCDNS_RJT_IPPNOTREG 0x0B
#define FCDNS_RJT_FPNAMENOTREG 0x0C
#define FCDNS_RJT_HRDADDNOTREG 0x0D
#define FCDNS_RJT_FC4DESNOTREG 0x0E
#define FCDNS_RJT_FC4FEANOTREG 0x0F
#define FCDNS_RJT_ACCRJT 0x10
#define FCDNS_RJT_PTYPEFMT 0x11
#define FCDNS_RJT_DBEMPTY 0x12
#define FCDNS_RJT_NOOBJSCOPE 0x13
#define FCDNS_RJT_AUTHRZN_EXCEPTION 0xF0
#define FCDNS_RJT_AUTH_EXCEPTION 0xF1
#define FCDNS_RJT_DB_FULL 0xF2
#define FCDNS_RJT_DB_EMPTY 0xF3
static const value_string fc_dns_rjt_det_code_val [] = {
{FCDNS_RJT_NOREASON , "No Additional Info"},
{FCDNS_RJT_PIDNOTREG , "PortID Not Regd."},
{FCDNS_RJT_PNAMENOTREG , "PortName Not Regd."},
{FCDNS_RJT_NNAMENOTREG , "NodeName Not Regd."},
{FCDNS_RJT_CLASSNOTREG , "Class Not Regd."},
{FCDNS_RJT_IPNNOTREG , "IP Addr (Node) Not Regd."},
{FCDNS_RJT_IPANOTREG , "IPA Not Regd."},
{FCDNS_RJT_FC4NOTREG , "FC4 TYPEs Not Regd."},
{FCDNS_RJT_SPNAMENOTREG, "Symbolic PortName Not Regd."},
{FCDNS_RJT_SNNAMENOTREG, "Symbolic NodeName Not Regd."},
{FCDNS_RJT_PTYPENOTREG , "PortType Not Regd."},
{FCDNS_RJT_IPPNOTREG , "IP Addr (Port) Not Regd."},
{FCDNS_RJT_FPNAMENOTREG, "Fabric Port Name Not Regd."},
{FCDNS_RJT_HRDADDNOTREG, "Hard Addr Not Regd."},
{FCDNS_RJT_FC4DESNOTREG, "FC4 Descriptors Not Regd."},
{FCDNS_RJT_FC4FEANOTREG, "FC4 Features Not Regd."},
{FCDNS_RJT_ACCRJT , "Access Denied"},
{FCDNS_RJT_PTYPEFMT , "Unacceptable PortId"},
{FCDNS_RJT_DBEMPTY , "Database Empty"},
{FCDNS_RJT_NOOBJSCOPE , "No Objects Regd. in Scope"},
{FCDNS_RJT_AUTHRZN_EXCEPTION, "Authorization Exception"},
{FCDNS_RJT_AUTH_EXCEPTION, "Authentication Exception"},
{FCDNS_RJT_DB_FULL, "Database Full"},
{FCDNS_RJT_DB_EMPTY, "Database Empty"},
{0, NULL},
};
/* Actual servers serving the directory service type identified by subtype */
#define FCDNS_GSSUBTYPE_DNS 0x02
#define FCDNS_GSSUBTYPE_IP 0x03
static int proto_fcdns;
static int hf_fcdns_cos_1;
static int hf_fcdns_cos_2;
static int hf_fcdns_cos_3;
static int hf_fcdns_cos_4;
static int hf_fcdns_cos_6;
static int hf_fcdns_cos_f;
static int hf_fcdns_fc4features;
static int hf_fcdns_fc4features_i;
static int hf_fcdns_fc4features_t;
static int hf_fcdns_fc4type;
static int hf_fcdns_fc4type_fcp;
static int hf_fcdns_fc4type_gs3;
static int hf_fcdns_fc4type_ip;
static int hf_fcdns_fc4type_llcsnap;
static int hf_fcdns_fc4type_snmp;
static int hf_fcdns_fc4type_swils;
static int hf_fcdns_fc4type_vi;
static int hf_fcdns_id_length;
static int hf_fcdns_maxres_size;
static int hf_fcdns_num_entries;
static int hf_fcdns_num_fc4desc;
static int hf_fcdns_opcode;
static int hf_fcdns_portip;
static int hf_fcdns_reason;
static int hf_fcdns_reply_cos;
static int hf_fcdns_req_areascope;
static int hf_fcdns_req_cos;
static int hf_fcdns_req_domainscope;
static int hf_fcdns_req_fc4type;
static int hf_fcdns_req_fc4types;
static int hf_fcdns_req_fdesc;
static int hf_fcdns_req_fdesclen;
static int hf_fcdns_req_ip;
static int hf_fcdns_req_nname;
static int hf_fcdns_req_pname;
static int hf_fcdns_req_portid;
static int hf_fcdns_req_ptype;
static int hf_fcdns_req_sname;
static int hf_fcdns_req_snamelen;
static int hf_fcdns_req_spname;
static int hf_fcdns_req_spnamelen;
static int hf_fcdns_rjtdetail;
static int hf_fcdns_rply_fc4desc;
static int hf_fcdns_rply_fc4desclen;
static int hf_fcdns_rply_fc4type;
static int hf_fcdns_rply_fpname;
static int hf_fcdns_rply_gft;
static int hf_fcdns_rply_hrdaddr;
static int hf_fcdns_rply_ipa;
static int hf_fcdns_rply_ipnode;
static int hf_fcdns_rply_ipport;
static int hf_fcdns_rply_nname;
static int hf_fcdns_rply_ownerid;
static int hf_fcdns_rply_pname;
static int hf_fcdns_rply_portid;
static int hf_fcdns_rply_ptype;
static int hf_fcdns_rply_sname;
static int hf_fcdns_rply_snamelen;
static int hf_fcdns_rply_spname;
static int hf_fcdns_rply_spnamelen;
static int hf_fcdns_sw2_objfmt;
static int hf_fcdns_vendor;
static int hf_fcdns_zone_flags;
static int hf_fcdns_zone_mbrid;
static int hf_fcdns_zone_mbrid_fc;
static int hf_fcdns_zone_mbrid_uint;
static int hf_fcdns_zone_mbrid_wwn;
static int hf_fcdns_zone_mbrtype;
static int hf_fcdns_zonelen;
static int hf_fcdns_zonenm;
/* Initialize the subtree pointers */
static int ett_fcdns;
static int ett_cos_flags;
static int ett_fc4flags;
static int ett_fc4features;
static expert_field ei_fcdns_no_record_of_exchange;
static expert_field ei_fcdns_zone_mbrid;
typedef struct _fcdns_conv_key {
uint32_t conv_idx;
} fcdns_conv_key_t;
typedef struct _fcdns_conv_data {
uint32_t opcode;
} fcdns_conv_data_t;
static wmem_map_t *fcdns_req_hash;
/*
* Hash Functions
*/
static int
fcdns_equal(const void *v, const void *w)
{
const fcdns_conv_key_t *v1 = (const fcdns_conv_key_t *)v;
const fcdns_conv_key_t *v2 = (const fcdns_conv_key_t *)w;
return (v1->conv_idx == v2->conv_idx);
}
static unsigned
fcdns_hash (const void *v)
{
const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
unsigned val;
val = key->conv_idx;
return val;
}
static void
dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
{
static int * const flags[] = {
&hf_fcdns_cos_f,
&hf_fcdns_cos_1,
&hf_fcdns_cos_2,
&hf_fcdns_cos_3,
&hf_fcdns_cos_4,
&hf_fcdns_cos_6,
NULL
};
proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfindex,
ett_cos_flags, flags, ENC_BIG_ENDIAN, BMT_NO_FALSE|BMT_NO_TFS);
}
/* The feature routines just decode FCP's FC-4 features field
* based on the flahs in offset and the type in offset+1
*/
static void
dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
uint8_t type;
static int * const flags[] = {
&hf_fcdns_fc4features_i,
&hf_fcdns_fc4features_t,
NULL
};
type = tvb_get_uint8(tvb, offset+1);
if(type==FC_TYPE_SCSI){
proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_fcdns_fc4features,
ett_fc4features, flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS);
} else {
proto_tree_add_item(parent_tree, hf_fcdns_fc4features, tvb, offset, 1, ENC_NA);
}
proto_tree_add_item (parent_tree, hf_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
}
/* The feature routines just decode FCP's FC-4 features field
*/
static void
dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
static int * const flags[] = {
&hf_fcdns_fc4features_i,
&hf_fcdns_fc4features_t,
NULL
};
proto_tree_add_bitmask(parent_tree, tvb, offset, hf_fcdns_fc4features,
ett_fc4features, flags, ENC_NA);
}
/* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
static void
dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
{
proto_item *item;
proto_tree *tree;
uint32_t flags;
item=proto_tree_add_item(parent_tree, hfindex, tvb, offset,
32, ENC_NA);
tree=proto_item_add_subtree(item, ett_fc4flags);
flags = tvb_get_ntohl (tvb, offset);
proto_tree_add_boolean(tree, hf_fcdns_fc4type_fcp, tvb, offset, 4, flags);
if (flags&0x0100){
proto_item_append_text(item, " FCP");
}
flags&=(~( 0x0100 ));
proto_tree_add_boolean(tree, hf_fcdns_fc4type_ip, tvb, offset, 4, flags);
if (flags&0x0020){
proto_item_append_text(item, " IP");
}
flags&=(~( 0x0020 ));
proto_tree_add_boolean(tree, hf_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
if (flags&0x0010){
proto_item_append_text(item, " LLC/SNAP");
}
/*flags&=(~( 0x0010 ));*/
flags = tvb_get_ntohl (tvb, offset+4);
proto_tree_add_boolean(tree, hf_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
if (flags&0x0010){
proto_item_append_text(item, " SW_ILS");
}
flags&=(~( 0x0010 ));
proto_tree_add_boolean(tree, hf_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
if (flags&0x0004){
proto_item_append_text(item, " SNMP");
}
flags&=(~( 0x0004 ));
proto_tree_add_boolean(tree, hf_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
if (flags&0x0001){
proto_item_append_text(item, " GS3");
}
/*flags&=(~( 0x0001 ));*/
flags = tvb_get_ntohl (tvb, offset+8);
proto_tree_add_boolean(tree, hf_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
if (flags&0x0001){
proto_item_append_text(item, " VI");
}
/*flags&=(~( 0x0001 ));*/
}
/* Code to actually dissect the packets */
/* A bunch of get routines have a similar req packet format. The first few
* routines deal with this decoding. All assume that tree is valid */
static void
dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_tree_add_item (tree, hf_fcdns_req_portid, tvb, offset, 3, ENC_NA);
}
static void
dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t len;
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb, offset,
1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb,
offset+4, 8, ENC_NA);
len = tvb_get_uint8 (tvb, offset+12);
proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb,
offset+12, 1, ENC_BIG_ENDIAN);
if (!tvb_offset_exists (tvb, 29+len))
return;
if (len) {
proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
offset+13, len, ENC_ASCII);
}
if (tvb_offset_exists (tvb, 292)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
offset+268, 8, ENC_NA);
}
if (tvb_offset_exists (tvb, 548)) {
len = tvb_get_uint8 (tvb, offset+276);
proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
offset+276, 1, ENC_BIG_ENDIAN);
if (len) {
proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
offset+277, len, ENC_ASCII);
}
}
if (tvb_offset_exists (tvb, 556)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_ipa, tvb,
offset+532, 8, ENC_NA);
}
if (tvb_offset_exists (tvb, 572)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb,
offset+540, 16, ENC_NA);
}
if (tvb_offset_exists (tvb, 576)) {
dissect_cos_flags(req_tree, tvb, offset+556, hf_fcdns_reply_cos);
}
if (tvb_offset_exists (tvb, 608)) {
dissect_fc4type(req_tree, tvb, offset+560, hf_fcdns_rply_gft);
}
if (tvb_offset_exists (tvb, 624)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb,
offset+592, 16, ENC_NA);
}
if (tvb_offset_exists (tvb, 632)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
offset+608, 8, ENC_NA);
}
if (tvb_offset_exists (tvb, 635)) {
proto_tree_add_item (req_tree, hf_fcdns_rply_hrdaddr, tvb,
offset+617, 3, ENC_NA);
}
}
}
}
static void
dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb, offset,
8, ENC_NA);
}
}
}
static void
dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
offset, 8, ENC_NA);
}
}
}
static void
dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset);
}
else {
dissect_cos_flags(req_tree, tvb, offset, hf_fcdns_reply_cos);
}
}
}
static void
dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
dissect_fc4type(req_tree, tvb, offset, hf_fcdns_rply_gft);
}
}
}
static void
dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t len;
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
len = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen,
tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
offset+1, len, ENC_ASCII);
}
}
}
static void
dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb,
offset, 1, ENC_BIG_ENDIAN);
}
}
}
static void
dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
offset, 8, ENC_NA);
}
}
}
static void
dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
int tot_len, desclen;
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_fc4type);
}
else {
tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
while (tot_len > 0) {
/* The count of the descriptors is not returned and so we have
* to track the display by the length field */
desclen = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_fc4desc, tvb,
offset, desclen, ENC_NA);
tot_len -= 255; /* descriptors are aligned to 255 bytes */
offset += 256;
}
}
}
}
static void
dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
dissect_fcdns_req_portid (tvb, req_tree, offset+1);
}
else {
dissect_fc4features(req_tree, tvb, offset);
}
}
}
static void
dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
offset, 8, ENC_NA);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
offset+1, 3, ENC_NA);
}
}
}
static void
dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
offset, 8, ENC_NA);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset,
16, ENC_NA);
}
}
}
static void
dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
offset, 8, ENC_NA);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
offset += 4;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
offset, 8, ENC_NA);
}
else {
proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset,
16, ENC_NA);
}
}
}
static void
dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
offset, 8, ENC_NA);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
tvb, offset+8, 8, ENC_NA);
offset += 16;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t len;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
offset, 8, ENC_NA);
}
else {
len = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
offset+1, len, ENC_ASCII);
}
}
}
static void
dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
tvb, offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
tvb, offset+3, 1, ENC_BIG_ENDIAN);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
offset += 4;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
tvb, offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
tvb, offset+3, 1, ENC_BIG_ENDIAN);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
tvb, offset+4, 8, ENC_NA);
offset += 16;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
tvb, offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
tvb, offset+3, 1, ENC_BIG_ENDIAN);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_rply_nname,
tvb, offset+4, 8, ENC_NA);
offset += 16;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast = 0;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_ptype,
tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
tvb, offset+2, 1, ENC_BIG_ENDIAN);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
offset += 4;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset,
16, ENC_NA);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
offset += 4;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t islast;
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_domainscope, tvb,
offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_areascope, tvb,
offset+2, 1, ENC_BIG_ENDIAN);
dissect_fc4features_and_type(req_tree, tvb, offset+6);
}
else {
do {
islast = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
tvb, offset+1, 3, ENC_NA);
offset += 4;
} while (!(islast & 0x80));
}
}
}
static void
dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid,
tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
offset+4, 8, ENC_NA);
}
}
}
static void
dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree) {
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid,
tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
offset+4, 8, ENC_NA);
}
}
}
static void
dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (req_tree && isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
dissect_cos_flags(req_tree, tvb, offset+4, hf_fcdns_req_cos);
}
}
static void
dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb,
offset+4, 1, ENC_BIG_ENDIAN);
}
}
static void
dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
}
}
static void
dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t len;
if (req_tree && isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb,
offset+4, 1, ENC_BIG_ENDIAN);
len = tvb_get_uint8 (tvb, offset+4);
proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5,
len, ENC_ASCII);
}
}
static void
dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb,
offset+4, 16, ENC_NA);
}
}
static void
dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
int len;
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
offset+1, 3, ENC_NA);
dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
offset += 36;
len = tvb_reported_length_remaining (tvb, offset);
while (len > 0) {
proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset,
1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_fdesc, tvb, offset+1,
len, ENC_ASCII);
offset += 256;
len -= 256;
}
}
}
static void
dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
dissect_fc4features_and_type(req_tree, tvb, offset+6);
}
}
static void
dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
}
}
static void
dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
uint8_t len;
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
len = tvb_get_uint8 (tvb, offset+8);
proto_tree_add_item (req_tree, hf_fcdns_req_snamelen, tvb, offset+8,
1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_req_sname, tvb, offset+9,
len, ENC_ASCII);
}
}
static void
dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
}
}
static uint8_t *
zonenm_to_str (wmem_allocator_t *scope, tvbuff_t *tvb, int offset)
{
int len = tvb_get_uint8 (tvb, offset);
return tvb_get_string_enc(scope, tvb, offset+4, len, ENC_ASCII);
}
static void
dissect_fcdns_zone_mbr (tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree, int offset)
{
uint8_t mbrtype;
int idlen;
proto_item* ti;
mbrtype = tvb_get_uint8 (tvb, offset);
ti = proto_tree_add_uint (zmbr_tree, hf_fcdns_zone_mbrtype, tvb,
offset, 1, mbrtype);
proto_tree_add_item(zmbr_tree, hf_fcdns_zone_flags, tvb, offset+2, 1, ENC_NA);
idlen = tvb_get_uint8 (tvb, offset+3);
proto_tree_add_item(zmbr_tree, hf_fcdns_id_length, tvb, offset+3, 1, ENC_NA);
switch (mbrtype) {
case FC_SWILS_ZONEMBR_WWN:
proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_wwn, tvb,
offset+4, 8, ENC_NA);
break;
case FC_SWILS_ZONEMBR_DP:
proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_uint, tvb,
offset+4, 4, ENC_BIG_ENDIAN);
break;
case FC_SWILS_ZONEMBR_FCID:
proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_fc, tvb,
offset+4, 3, ENC_NA);
break;
case FC_SWILS_ZONEMBR_ALIAS:
proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
offset+4, idlen, zonenm_to_str (pinfo->pool, tvb, offset+4));
break;
default:
expert_add_info(pinfo, ti, &ei_fcdns_zone_mbrid);
}
}
static void
dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
{
int numrec, i, len;
uint8_t objfmt;
if (tree) {
numrec = tvb_get_ntohl (tvb, offset);
proto_tree_add_uint(tree, hf_fcdns_num_entries, tvb, offset, 4, numrec);
offset += 4;
for (i = 0; i < numrec; i++) {
objfmt = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_rply_ownerid, tvb, offset+1, 3, ENC_NA);
proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_rply_portid, tvb, offset+5, 3, ENC_NA);
proto_tree_add_item (tree, hf_fcdns_rply_pname, tvb, offset+8, 8, ENC_NA);
offset += 16;
if (!(objfmt & 0x1)) {
len = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (tree, hf_fcdns_rply_spnamelen, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_rply_spname, tvb,
offset+1, len, ENC_ASCII);
offset += 256;
}
proto_tree_add_item (tree, hf_fcdns_rply_nname, tvb, offset, 8, ENC_NA);
offset += 8;
if (!(objfmt & 0x1)) {
len = tvb_get_uint8 (tvb, offset);
proto_tree_add_item (tree, hf_fcdns_rply_snamelen, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_rply_sname, tvb,
offset+1, len, ENC_ASCII);
offset += 256;
}
proto_tree_add_item (tree, hf_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
proto_tree_add_item (tree, hf_fcdns_rply_ipnode, tvb, offset+8, 16,
ENC_NA);
dissect_cos_flags(tree, tvb, offset+24, hf_fcdns_reply_cos);
dissect_fc4type(tree, tvb, offset+28, hf_fcdns_rply_gft);
proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60,
16, ENC_NA);
proto_tree_add_item (tree, hf_fcdns_rply_fpname, tvb, offset+76,
8, ENC_NA);
proto_tree_add_item (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85,
3, ENC_NA);
offset += 88;
if (objfmt & 0x2) {
dissect_fc4features(tree, tvb, offset);
if (tvb_get_uint8 (tvb, offset+129)) {
proto_tree_add_item (tree, hf_fcdns_rply_fc4type, tvb,
offset+128, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
offset+129, 1, ENC_BIG_ENDIAN);
len = tvb_get_uint8 (tvb, offset+132);
proto_tree_add_item (tree, hf_fcdns_rply_fc4desclen, tvb,
offset+132, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_fcdns_rply_fc4desc, tvb,
offset+133, len, ENC_NA);
}
else {
proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
offset+129, 1, ENC_BIG_ENDIAN);
}
offset += 388; /* FC4 desc is 260 bytes, maybe padded */
}
}
}
}
static void
dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item(req_tree, hf_fcdns_req_pname, tvb, offset, 8, ENC_NA);
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
if (req_tree) {
proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset, 16, ENC_NA);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
if (req_tree) {
dissect_fc4type(req_tree, tvb, offset, hf_fcdns_fc4type);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
if (req_tree) {
proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+3,
1, ENC_BIG_ENDIAN);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_gezm (tvbuff_t *tvb, packet_info* pinfo, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
dissect_fcdns_zone_mbr (tvb, pinfo, req_tree, offset);
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
int str_len;
if (isreq) {
if (req_tree) {
str_len = tvb_get_uint8 (tvb, offset);
proto_tree_add_uint(req_tree, hf_fcdns_zonelen, tvb, offset, 1, str_len);
proto_tree_add_item (req_tree, hf_fcdns_zonenm, tvb, offset+3,
str_len, ENC_ASCII);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
if (req_tree) {
proto_tree_add_item (req_tree, hf_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
{
int offset = 16; /* past the fc_ct header */
if (isreq) {
if (req_tree) {
dissect_fc4features(req_tree, tvb, offset);
}
}
else {
dissect_fcdns_swils_entries (tvb, req_tree, offset);
}
}
static void
dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
{
int offset = 0;
if (req_tree) {
proto_tree_add_item (req_tree, hf_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_rjtdetail, tvb, offset+14, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (req_tree, hf_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
}
}
static int
dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti = NULL;
proto_tree *fcdns_tree = NULL;
int offset = 0;
int opcode,
failed_opcode = 0;
int isreq = 1;
fc_ct_preamble cthdr;
conversation_t *conversation;
fcdns_conv_data_t *cdata;
fcdns_conv_key_t ckey, *req_key;
fc_hdr *fchdr;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
fchdr = (fc_hdr *)data;
tvb_memcpy (tvb, (uint8_t *)&cthdr, offset, FCCT_PRMBL_SIZE);
cthdr.revision = tvb_get_uint8 (tvb, offset);
cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
cthdr.opcode = g_ntohs (cthdr.opcode);
opcode = cthdr.opcode;
cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
/* Determine the type of server the request/response is for */
if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
else
col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
if (tree) {
if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
-1,
"dNS");
fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
}
else {
ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
-1,
"Unzoned NS");
fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
}
}
if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
fchdr->rxid, NO_PORT_B);
if (!conversation) {
conversation = conversation_new (pinfo->num, &pinfo->src, &pinfo->dst,
conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
fchdr->rxid, NO_PORT2);
}
ckey.conv_idx = conversation->conv_index;
cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash,
&ckey);
if (cdata) {
/* Since we never free the memory used by an exchange, this maybe a
* case of another request using the same exchange as a previous
* req.
*/
cdata->opcode = opcode;
}
else {
req_key = wmem_new(wmem_file_scope(), fcdns_conv_key_t);
req_key->conv_idx = conversation->conv_index;
cdata = wmem_new(wmem_file_scope(), fcdns_conv_data_t);
cdata->opcode = opcode;
wmem_map_insert (fcdns_req_hash, req_key, cdata);
}
col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
"0x%x"));
}
else {
/* Opcode is ACC or RJT */
conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
fchdr->rxid, NO_PORT_B);
isreq = 0;
if (!conversation) {
if (opcode == FCCT_MSG_ACC) {
col_add_str (pinfo->cinfo, COL_INFO,
val_to_str (opcode, fc_dns_opcode_val,
"0x%x"));
/* No record of what this accept is for. Can't decode */
proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
return 0;
}
}
else {
ckey.conv_idx = conversation->conv_index;
cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash, &ckey);
if (cdata != NULL) {
if (opcode == FCCT_MSG_ACC) {
opcode = cdata->opcode;
}
else
failed_opcode = cdata->opcode;
}
if (opcode != FCCT_MSG_RJT) {
col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
val_to_str (opcode, fc_dns_opcode_val,
"0x%x"));
}
else {
col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
val_to_str (failed_opcode,
fc_dns_opcode_val,
"0x%x"));
}
if (tree) {
if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
/* No record of what this accept is for. Can't decode */
proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
return 0;
}
}
}
}
if (tree) {
proto_tree_add_item (fcdns_tree, hf_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10,
2, ENC_BIG_ENDIAN);
}
switch (opcode) {
case FCCT_MSG_RJT:
dissect_fcdns_rjt (tvb, fcdns_tree);
break;
case FCDNS_GA_NXT:
dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
break;
case FCDNS_GPN_ID:
dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GNN_ID:
dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GCS_ID:
dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GFT_ID:
dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GSPN_ID:
dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GPT_ID:
dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GFPN_ID:
dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GFD_ID:
dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GFF_ID:
dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_PN:
dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GIPP_PN:
dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_NN:
dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GPN_NN:
dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GIP_NN:
dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GSNN_NN:
dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_FT:
dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
break;
case FCDNS_GPN_FT:
dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
break;
case FCDNS_GNN_FT:
dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_PT:
dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_IPP:
dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
break;
case FCDNS_GID_FF:
dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
break;
case FCDNS_RPN_ID:
dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RNN_ID:
dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RCS_ID:
dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RPT_ID:
dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RFT_ID:
dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RSPN_ID:
dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RIPP_ID:
dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RFD_ID:
dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RFF_ID:
dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
break;
case FCDNS_RIP_NN:
dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_RSNN_NN:
dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
break;
case FCDNS_DA_ID:
dissect_fcdns_daid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_ID:
dissect_fcdns_geid (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_PN:
dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_NN:
dissect_fcdns_genn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_IP:
dissect_fcdns_geip (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_FT:
dissect_fcdns_geft (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_PT:
dissect_fcdns_gept (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_ZM:
dissect_fcdns_gezm (tvb, pinfo, fcdns_tree, isreq);
break;
case FCDNS_GE_ZN:
dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_IPP:
dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
break;
case FCDNS_GE_FF:
dissect_fcdns_geff (tvb, fcdns_tree, isreq);
break;
default:
break;
}
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
void
proto_register_fcdns (void)
{
static hf_register_info hf[] = {
{ &hf_fcdns_opcode,
{ "Opcode", "fcdns.opcode",
FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_reason,
{ "Reason Code", "fcdns.rply.reason",
FT_UINT8, BASE_HEX, VALS (fc_ct_rjt_code_vals), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_vendor,
{ "Vendor Unique Reject Code", "fcdns.rply.vendor",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_portid,
{ "Port Identifier", "fcdns.req.portid",
FT_BYTES, SEP_DOT, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_pname,
{ "Port Name", "fcdns.rply.pname",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_nname,
{ "Node Name", "fcdns.rply.nname",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_gft,
{ "FC-4 Types Supported", "fcdns.rply.gft",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_snamelen,
{ "Symbolic Node Name Length", "fcdns.rply.snamelen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_sname,
{ "Symbolic Node Name", "fcdns.rply.sname",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_ptype,
{ "Port Type", "fcdns.rply.porttype",
FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_fpname,
{ "Fabric Port Name", "fcdns.rply.fpname",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_fc4type,
{ "FC-4 Types", "fcdns.req.fc4types",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_fc4type,
{ "FC-4 Descriptor Type", "fcdns.rply.fc4type",
FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_fc4desc,
{ "FC-4 Descriptor", "fcdns.rply.fc4desc",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_pname,
{ "Port Name", "fcdns.req.portname",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_portid,
{ "Port Identifier", "fcdns.rply.portid",
FT_BYTES, SEP_DOT, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_nname,
{ "Node Name", "fcdns.req.nname",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_domainscope,
{ "Domain ID Scope", "fcdns.req.domainid",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_areascope,
{ "Area ID Scope", "fcdns.req.areaid",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_ptype,
{ "Port Type", "fcdns.req.porttype",
FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_cos,
{ "Requested Class of Service", "fcdns.req.class",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_fc4types,
{ "FC-4 Types Supported", "fcdns.req.fc4types",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_snamelen,
{ "Symbolic Name Length", "fcdns.req.snamelen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_sname,
{ "Symbolic Port Name", "fcdns.req.sname",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_spnamelen,
{ "Symbolic Port Name Length", "fcdns.rply.spnamelen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_spname,
{ "Symbolic Port Name", "fcdns.rply.spname",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_spnamelen,
{ "Symbolic Port Name Length", "fcdns.req.spnamelen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_spname,
{ "Symbolic Port Name", "fcdns.req.spname",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_ipa,
{ "Initial Process Associator", "fcdns.rply.ipa",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_ipnode,
{ "Node IP Address", "fcdns.rply.ipnode",
FT_IPv6, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_ipport,
{ "Port IP Address", "fcdns.rply.ipport",
FT_IPv6, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_fc4desclen,
{ "FC-4 Descriptor Length", "fcdns.rply.fc4desclen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_hrdaddr,
{ "Hard Address", "fcdns.rply.hrdaddr",
FT_BYTES, SEP_DOT, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_fdesclen,
{ "FC-4 Descriptor Length", "fcdns.req.fc4desclen",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_fdesc,
{ "FC-4 Descriptor", "fcdns.req.fc4desc",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_req_ip,
{ "IP Address", "fcdns.req.ip",
FT_IPv6, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rjtdetail,
{ "Reason Code Explanation", "fcdns.rply.reasondet",
FT_UINT8, BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_mbrtype,
{ "Zone Member Type", "fcdns.zone.mbrtype",
FT_UINT8, BASE_HEX, VALS (fc_swils_zonembr_type_val), 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_mbrid,
{ "Member Identifier", "fcdns.zone.mbrid",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_mbrid_wwn,
{ "Member Identifier", "fcdns.zone.mbrid.wwn",
FT_FCWWN, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_mbrid_uint,
{ "Member Identifier", "fcdns.zone.mbrid.uint",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_mbrid_fc,
{ "Member Identifier", "fcdns.zone.mbrid.fc",
FT_BYTES, SEP_DOT, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_id_length,
{ "Identifier Length", "fcdns.id_length",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zone_flags,
{ "Flags", "fcdns.zone_flags",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zonelen,
{ "Name Length", "fcdns.zone_len",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_zonenm,
{ "Zone Name", "fcdns.zonename",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_portip,
{ "Port IP Address", "fcdns.portip",
FT_IPv4, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_num_entries,
{ "Number of Entries", "fcdns.num_entries",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_sw2_objfmt,
{ "Name Entry Object Format", "fcdns.entry.objfmt",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_num_fc4desc,
{ "Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_rply_ownerid,
{ "Owner Id", "fcdns.rply.ownerid",
FT_BYTES, SEP_DOT, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_maxres_size,
{ "Maximum/Residual Size", "fcdns.maxres_size",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_reply_cos,
{ "Class of Service Supported", "fcdns.reply.cos",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_cos_f,
{ "F", "fcdns.cos.f",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
NULL, HFILL }
},
{ &hf_fcdns_cos_1,
{ "1", "fcdns.cos.1",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002,
NULL, HFILL }
},
{ &hf_fcdns_cos_2,
{ "2", "fcdns.cos.2",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
NULL, HFILL }
},
{ &hf_fcdns_cos_3,
{ "3", "fcdns.cos.3",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008,
NULL, HFILL }
},
{ &hf_fcdns_cos_4,
{ "4", "fcdns.cos.4",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
NULL, HFILL }
},
{ &hf_fcdns_cos_6,
{ "6", "fcdns.cos.6",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_llcsnap,
{ "LLC/SNAP", "fcdns.fc4types.llc_snap",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_ip,
{ "IP", "fcdns.fc4types.ip",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_fcp,
{ "FCP", "fcdns.fc4types.fcp",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000100,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_swils,
{ "SW_ILS", "fcdns.fc4types.swils",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_snmp,
{ "SNMP", "fcdns.fc4types.snmp",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_gs3,
{ "GS3", "fcdns.fc4types.gs3",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
NULL, HFILL }
},
{ &hf_fcdns_fc4type_vi,
{ "VI", "fcdns.fc4types.vi",
FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
NULL, HFILL }
},
{ &hf_fcdns_fc4features,
{ "FC-4 Feature Bits", "fcdns.fc4features",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_fcdns_fc4features_i,
{ "I", "fcdns.fc4features.i",
FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
NULL, HFILL }
},
{ &hf_fcdns_fc4features_t,
{ "T", "fcdns.fc4features.t",
FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
NULL, HFILL }
},
{ &hf_fcdns_req_fc4type,
{ "FC-4 Type", "fcdns.req.fc4type",
FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
NULL, HFILL }
},
};
static int *ett[] = {
&ett_fcdns,
&ett_cos_flags,
&ett_fc4flags,
&ett_fc4features,
};
static ei_register_info ei[] = {
{ &ei_fcdns_no_record_of_exchange, { "fcdns.no_record_of_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode MSG_ACC/RJT", EXPFILL }},
{ &ei_fcdns_zone_mbrid, { "fcdns.zone.mbrid.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown member type format", EXPFILL }},
};
expert_module_t* expert_fcdns;
proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns");
proto_register_field_array(proto_fcdns, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_fcdns = expert_register_protocol(proto_fcdns);
expert_register_field_array(expert_fcdns, ei, array_length(ei));
fcdns_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcdns_hash, fcdns_equal);
dns_handle = register_dissector("fcdns", dissect_fcdns, proto_fcdns);
}
void
proto_reg_handoff_fcdns (void)
{
dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_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:
*/
|