summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nisplus.c
blob: 0c78d88a36c990fdd18bbb4b391164c96e7e0dab (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
/* packet-nisplus.c
 * 2001  Ronnie Sahlberg   <See AUTHORS for email>
 *
 * 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 "packet-rpc.h"
#include "packet-nisplus.h"

void proto_register_nis(void);
void proto_reg_handoff_nis(void);
void proto_register_niscb(void);
void proto_reg_handoff_niscb(void);

static int proto_nisplus = -1;
static int hf_nisplus_procedure_v3 = -1;
static int hf_nisplus_object = -1;
static int hf_nisplus_oid = -1;
static int hf_nisplus_object_ctime = -1;
static int hf_nisplus_object_mtime = -1;
static int hf_nisplus_object_name = -1;
static int hf_nisplus_object_owner = -1;
static int hf_nisplus_object_group = -1;
static int hf_nisplus_object_domain = -1;
static int hf_nisplus_object_ttl = -1;
static int hf_nisplus_object_type = -1;
static int hf_nisplus_object_private = -1;
static int hf_nisplus_directory = -1;
static int hf_nisplus_directory_name = -1;
static int hf_nisplus_directory_type = -1;
static int hf_nisplus_directory_ttl = -1;
static int hf_nisplus_directory_mask = -1;
static int hf_nisplus_directory_mask_list = -1;
static int hf_nisplus_access_mask = -1;
static int hf_nisplus_mask_world_read = -1;
static int hf_nisplus_mask_world_modify = -1;
static int hf_nisplus_mask_world_create = -1;
static int hf_nisplus_mask_world_destroy = -1;
static int hf_nisplus_mask_group_read = -1;
static int hf_nisplus_mask_group_modify = -1;
static int hf_nisplus_mask_group_create = -1;
static int hf_nisplus_mask_group_destroy = -1;
static int hf_nisplus_mask_owner_read = -1;
static int hf_nisplus_mask_owner_modify = -1;
static int hf_nisplus_mask_owner_create = -1;
static int hf_nisplus_mask_owner_destroy = -1;
static int hf_nisplus_mask_nobody_read = -1;
static int hf_nisplus_mask_nobody_modify = -1;
static int hf_nisplus_mask_nobody_create = -1;
static int hf_nisplus_mask_nobody_destroy = -1;
static int hf_nisplus_server_name = -1;
static int hf_nisplus_key_type = -1;
static int hf_nisplus_key_data = -1;
static int hf_nisplus_servers = -1;
static int hf_nisplus_cbservers = -1;
static int hf_nisplus_server = -1;
static int hf_nisplus_endpoints = -1;
static int hf_nisplus_endpoint = -1;
static int hf_nisplus_endpoint_uaddr = -1;
static int hf_nisplus_endpoint_family = -1;
static int hf_nisplus_endpoint_proto = -1;
static int hf_nisplus_link = -1;
static int hf_nisplus_attrs_array = -1;
static int hf_nisplus_attr = -1;
static int hf_nisplus_attr_name = -1;
static int hf_nisplus_attr_val = -1;
static int hf_nisplus_entry = -1;
static int hf_nisplus_entry_type = -1;
static int hf_nisplus_entry_cols = -1;
static int hf_nisplus_entry_col = -1;
/* static int hf_nisplus_entry_flags = -1; */
static int hf_nisplus_entry_val = -1;
static int hf_nisplus_entry_mask = -1;
static int hf_nisplus_entry_mask_binary = -1;
static int hf_nisplus_entry_mask_crypt = -1;
static int hf_nisplus_entry_mask_xdr = -1;
static int hf_nisplus_entry_mask_modified = -1;
static int hf_nisplus_entry_mask_asn = -1;
static int hf_nisplus_table = -1;
static int hf_nisplus_table_type = -1;
static int hf_nisplus_table_maxcol = -1;
static int hf_nisplus_table_sep = -1;
static int hf_nisplus_table_cols = -1;
static int hf_nisplus_table_col = -1;
static int hf_nisplus_table_path = -1;
static int hf_nisplus_table_col_name = -1;
static int hf_nisplus_table_col_mask = -1;
static int hf_nisplus_table_col_mask_binary = -1;
static int hf_nisplus_table_col_mask_encrypted = -1;
static int hf_nisplus_table_col_mask_xdr = -1;
static int hf_nisplus_table_col_mask_searchable = -1;
static int hf_nisplus_table_col_mask_casesensitive = -1;
static int hf_nisplus_table_col_mask_modified = -1;
static int hf_nisplus_table_col_mask_asn = -1;
static int hf_nisplus_group = -1;
static int hf_nisplus_group_flags = -1;
static int hf_nisplus_grps = -1;
static int hf_nisplus_group_name = -1;
static int hf_nisplus_ib_flags = -1;
static int hf_nisplus_ib_bufsize = -1;
static int hf_nisplus_cookie = -1;
static int hf_nisplus_fd_dirname = -1;
static int hf_nisplus_fd_requester = -1;
static int hf_nisplus_taglist = -1;
static int hf_nisplus_tag = -1;
static int hf_nisplus_tag_type = -1;
static int hf_nisplus_tag_val = -1;
static int hf_nisplus_dump_dir = -1;
static int hf_nisplus_dump_time = -1;
static int hf_nisplus_dummy = -1;
static int hf_nisplus_ping_dir = -1;
static int hf_nisplus_ping_time = -1;
static int hf_nisplus_error = -1;
static int hf_nisplus_dir_data = -1;
static int hf_nisplus_signature = -1;
static int hf_nisplus_log_entries = -1;
static int hf_nisplus_log_entry = -1;
static int hf_nisplus_log_type = -1;
static int hf_nisplus_log_time = -1;
static int hf_nisplus_log_principal = -1;
static int hf_nisplus_callback_status = -1;
static int hf_nisplus_cp_status = -1;
static int hf_nisplus_cp_zticks = -1;
static int hf_nisplus_cp_dticks = -1;
static int hf_nisplus_zticks = -1;
static int hf_nisplus_dticks = -1;
static int hf_nisplus_aticks = -1;
static int hf_nisplus_cticks = -1;

static gint ett_nisplus = -1;
static gint ett_nisplus_object = -1;
static gint ett_nisplus_oid = -1;
static gint ett_nisplus_directory = -1;
static gint ett_nisplus_directory_mask = -1;
static gint ett_nisplus_access_mask = -1;
static gint ett_nisplus_server = -1;
static gint ett_nisplus_endpoint = -1;
static gint ett_nisplus_link = -1;
static gint ett_nisplus_attr = -1;
static gint ett_nisplus_entry = -1;
static gint ett_nisplus_entry_col = -1;
static gint ett_nisplus_entry_mask = -1;
static gint ett_nisplus_table = -1;
static gint ett_nisplus_table_col = -1;
static gint ett_nisplus_table_col_mask = -1;
static gint ett_nisplus_group = -1;
static gint ett_nisplus_grps = -1;
static gint ett_nisplus_tag = -1;
static gint ett_nisplus_log_entry = -1;


#define NIS_MASK_TABLE_BINARY   0x00000001
#define NIS_MASK_TABLE_CRYPT    0x00000002
#define NIS_MASK_TABLE_XDR      0x00000004
#define NIS_MASK_TABLE_SRCH     0x00000008
#define NIS_MASK_TABLE_CASE     0x00000010
#define NIS_MASK_TABLE_MODIFIED 0x00000020
#define NIS_MASK_TABLE_ASN      0x00000040


#define NIS_MASK_ENTRY_BINARY   0x00000001
#define NIS_MASK_ENTRY_CRYPT    0x00000002
#define NIS_MASK_ENTRY_XDR      0x00000004
#define NIS_MASK_ENTRY_MODIFIED 0x00000008
#define NIS_MASK_ENTRY_ASN      0x00000040


#define NIS_MASK_WORLD_READ     0x00000001
#define NIS_MASK_WORLD_MODIFY   0x00000002
#define NIS_MASK_WORLD_CREATE   0x00000004
#define NIS_MASK_WORLD_DESTROY  0x00000008
#define NIS_MASK_GROUP_READ     0x00000010
#define NIS_MASK_GROUP_MODIFY   0x00000020
#define NIS_MASK_GROUP_CREATE   0x00000040
#define NIS_MASK_GROUP_DESTROY  0x00000080
#define NIS_MASK_OWNER_READ     0x00000100
#define NIS_MASK_OWNER_MODIFY   0x00000200
#define NIS_MASK_OWNER_CREATE   0x00000400
#define NIS_MASK_OWNER_DESTROY  0x00000800
#define NIS_MASK_NOBODY_READ    0x00001000
#define NIS_MASK_NOBODY_MODIFY  0x00002000
#define NIS_MASK_NOBODY_CREATE  0x00004000
#define NIS_MASK_NOBODY_DESTROY 0x00008000


static const value_string key_type[] = {
#define NIS_KEY_NONE		0
	{	NIS_KEY_NONE,		"No Public Key (unix/sys auth)"	},
#define NIS_KEY_DH		1
	{	NIS_KEY_DH,		"Diffie-Hellman"	},
#define NIS_KEY_RSA		2
	{	NIS_KEY_RSA,		"RSA"	},
#define NIS_KEY_KERB		3
	{	NIS_KEY_KERB,		"Kerberos"	},
#define NIS_KEY_DHEXT		4
	{	NIS_KEY_DHEXT,		"Extended Diffie-Hellman for RPC-GSS"	},
	{	0,	NULL	},
};

static const value_string obj_type[] = {
#define NIS_BOGUS_OBJ		0
	{	NIS_BOGUS_OBJ,		"Bogus Object"	},
#define NIS_NO_OBJ		1
	{	NIS_NO_OBJ,		"NULL Object"	},
#define NIS_DIRECTORY_OBJ	2
	{	NIS_DIRECTORY_OBJ,	"Directory Object"	},
#define NIS_GROUP_OBJ		3
	{	NIS_GROUP_OBJ,		"Group Object"	},
#define NIS_TABLE_OBJ		4
	{	NIS_TABLE_OBJ,		"Table Object"	},
#define NIS_ENTRY_OBJ		5
	{	NIS_ENTRY_OBJ,		"Entry Object"	},
#define NIS_LINK_OBJ		6
	{	NIS_LINK_OBJ,		"Link Object"	},
#define NIS_PRIVATE_OBJ		7
	{	NIS_PRIVATE_OBJ,	"Private Object"	},
	{	0,	NULL	},
};

static const value_string ns_type[] = {
#define NIS_TYPE_UNKNOWN	0
	{	NIS_TYPE_UNKNOWN,	"UNKNOWN"	},
#define NIS_TYPE_NIS		1
	{	NIS_TYPE_NIS,	"NIS Plus Service"	},
#define NIS_TYPE_SUNYP		2
	{	NIS_TYPE_SUNYP,	"Old NIS Service (YP)"	},
#define NIS_TYPE_IVY		3
	{	NIS_TYPE_IVY,	"NIS Plus Plus Service"	},
#define NIS_TYPE_DNS		4
	{	NIS_TYPE_DNS,	"Domain Name Service (DNS)"	},
#define NIS_TYPE_X500		5
	{	NIS_TYPE_X500,	"ISO/CCITT X.500 Service"	},
#define NIS_TYPE_DNANS		6
	{	NIS_TYPE_DNANS,	"Digital DECNet Name Service"	},
#define NIS_TYPE_XCHS		7
	{	NIS_TYPE_XCHS,	"Xerox ClearingHouse Service"	},
#define NIS_TYPE_CDS		8
	{	NIS_TYPE_CDS,	"CDS"	},
	{	0,	NULL	},
};




static int
dissect_nisplus_time(tvbuff_t *tvb, int offset, proto_tree *tree, int hfindex)
{
	nstime_t ts;

	ts.nsecs = 0;
	ts.secs = tvb_get_ntohl(tvb, offset);
	offset += 4;

	proto_tree_add_time(tree, hfindex, tvb, offset, 4, &ts);

	return offset;
}

static int
dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_group_name, offset, NULL);

	return offset;
}


static int
dissect_group_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_group,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_group);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_group_flags, offset);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_group, hf_nisplus_grps);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}


static int
dissect_access_rights(tvbuff_t *tvb, int offset, proto_tree *tree)
{
	static int * const flags[] = {
		&hf_nisplus_mask_world_read,
		&hf_nisplus_mask_world_modify,
		&hf_nisplus_mask_world_create,
		&hf_nisplus_mask_world_destroy,
		&hf_nisplus_mask_group_read,
		&hf_nisplus_mask_group_modify,
		&hf_nisplus_mask_group_create,
		&hf_nisplus_mask_group_destroy,
		&hf_nisplus_mask_owner_read,
		&hf_nisplus_mask_owner_modify,
		&hf_nisplus_mask_owner_create,
		&hf_nisplus_mask_owner_destroy,
		&hf_nisplus_mask_nobody_read,
		&hf_nisplus_mask_nobody_modify,
		&hf_nisplus_mask_nobody_create,
		&hf_nisplus_mask_nobody_destroy,
		NULL
	};

	proto_tree_add_bitmask(tree, tvb, offset, hf_nisplus_access_mask, ett_nisplus_access_mask, flags, ENC_BIG_ENDIAN);
	offset += 4;

	return offset;
}

static int
dissect_table(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item;
	proto_tree* lock_tree;
	int old_offset = offset;
	static int * const flags[] = {
		&hf_nisplus_table_col_mask_binary,
		&hf_nisplus_table_col_mask_encrypted,
		&hf_nisplus_table_col_mask_xdr,
		&hf_nisplus_table_col_mask_searchable,
		&hf_nisplus_table_col_mask_casesensitive,
		&hf_nisplus_table_col_mask_modified,
		&hf_nisplus_table_col_mask_asn,
		NULL
	};

	lock_item = proto_tree_add_item(tree, hf_nisplus_table_col,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_table_col);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_table_col_name, offset, NULL);

	proto_tree_add_bitmask(lock_tree, tvb, offset, hf_nisplus_table_col_mask, ett_nisplus_table_col_mask, flags, ENC_BIG_ENDIAN);
	offset += 4;

	offset = dissect_access_rights(tvb, offset, lock_tree);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_table_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_table,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_table);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_table_type, offset, NULL);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_table_maxcol, offset);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_table_sep, offset);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_table, hf_nisplus_table_cols);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_table_path, offset, NULL);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item;
	proto_tree* lock_tree;
	int old_offset = offset;
	static int * const flags[] = {
		&hf_nisplus_entry_mask_binary,
		&hf_nisplus_entry_mask_crypt,
		&hf_nisplus_entry_mask_xdr,
		&hf_nisplus_entry_mask_modified,
		&hf_nisplus_entry_mask_asn,
		NULL
	};

	lock_item = proto_tree_add_item(tree, hf_nisplus_entry_col,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_entry_col);

	proto_tree_add_bitmask(lock_tree, tvb, offset, hf_nisplus_entry_mask, ett_nisplus_entry_mask, flags, ENC_BIG_ENDIAN);
	offset += 4;

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_entry_val, offset, NULL);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_entry_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_entry,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_entry);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_entry_type, offset, NULL);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_entry, hf_nisplus_entry_cols);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_attr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_attr,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_attr);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_attr_name, offset, NULL);

	offset = dissect_rpc_data(tvb, lock_tree,
			hf_nisplus_attr_val, offset);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_link_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_link,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_link);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_object_type, offset);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_attr, hf_nisplus_attrs_array);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_object_name,	offset, NULL);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}


static int
dissect_endpoint(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_endpoint,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_endpoint);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_endpoint_uaddr, offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_endpoint_family, offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_endpoint_proto, offset, NULL);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}


static int
dissect_directory_server(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_server,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_server);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_server_name, offset, NULL);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_endpoint, hf_nisplus_endpoints);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_key_type, offset);

	offset = dissect_rpc_data(tvb, lock_tree,
			hf_nisplus_key_data, offset);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}


static int
dissect_directory_mask(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_directory_mask,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_directory_mask);

	offset = dissect_access_rights(tvb, offset, lock_tree);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_object_type, offset);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_directory_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_directory,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_directory);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_directory_name, offset, NULL);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_directory_type, offset);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_directory_server, hf_nisplus_servers);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_directory_ttl, offset);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_directory_mask, hf_nisplus_directory_mask_list);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_nisplus_oid(tvbuff_t *tvb, int offset, proto_tree *tree)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_oid, tvb,
			offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_oid);

	offset = dissect_nisplus_time(tvb, offset, lock_tree,
			hf_nisplus_object_ctime);

	offset = dissect_nisplus_time(tvb, offset, lock_tree,
			hf_nisplus_object_mtime);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_nisplus_object(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	gint32	type;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_object, tvb,
			offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_object);

	offset = dissect_nisplus_oid(tvb, offset, lock_tree);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_object_name,	offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_object_owner, offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_object_group, offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_object_domain, offset, NULL);

	offset = dissect_access_rights(tvb, offset, lock_tree);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_object_ttl, offset);

	type = tvb_get_ntohl(tvb, offset);
	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_object_type, offset);
	switch (type) {
	case	NIS_DIRECTORY_OBJ:
		offset = dissect_directory_obj(tvb, offset, pinfo, lock_tree);
		break;
	case	NIS_GROUP_OBJ:
		offset = dissect_group_obj(tvb, offset, pinfo, lock_tree);
		break;
	case	NIS_TABLE_OBJ:
		offset = dissect_table_obj(tvb, offset, pinfo, lock_tree);
		break;
	case	NIS_ENTRY_OBJ:
		offset = dissect_entry_obj(tvb, offset, pinfo, lock_tree);
		break;
	case	NIS_LINK_OBJ:
		offset = dissect_link_obj(tvb, offset, pinfo, lock_tree);
		break;
	case	NIS_PRIVATE_OBJ:
		offset = dissect_rpc_data(tvb, lock_tree,
				hf_nisplus_object_private, offset);
		break;
	case	NIS_NO_OBJ:
		break;
	case	NIS_BOGUS_OBJ:
		break;
	default:
		break;
	};

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	end of nis object, that's right, all this was the definition of
	ONE SINGLE struct.
*/



static int
dissect_ns_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_object_name, offset, NULL);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_nisplus_object, hf_nisplus_object);

	return offset;
}

static int
dissect_ib_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_object_name, offset, NULL);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_attr, hf_nisplus_attrs_array);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_ib_flags, offset);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_nisplus_object, hf_nisplus_object);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_directory_server, hf_nisplus_cbservers);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_ib_bufsize, offset);

	offset = dissect_rpc_data(tvb, tree,
			hf_nisplus_cookie, offset);

	return offset;
}

static int
dissect_fd_args(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_fd_dirname, offset, NULL);

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_fd_requester, offset, NULL);

	return offset;
}

static int
dissect_nisplus_tag(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_tag, tvb,
			offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_tag);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_tag_type, offset);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_tag_val, offset, NULL);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_nisplus_taglist(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_array(tvb, pinfo, tree, 0,
			dissect_nisplus_tag, hf_nisplus_taglist);
}

static int
dissect_dump_args(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_dump_dir, offset, NULL);

	offset = dissect_nisplus_time(tvb, offset, tree,
			hf_nisplus_dump_time);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_directory_server, hf_nisplus_cbservers);

	return offset;
}

static int
dissect_netobj(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_data(tvb, tree, hf_nisplus_dummy, 0);
}

static int
dissect_nisname(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_string(tvb, tree,
			hf_nisplus_object_name, 0, NULL);
}

static int
dissect_ping_args(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_ping_dir, offset, NULL);

	offset = dissect_nisplus_time(tvb, offset, tree,
			hf_nisplus_ping_time);

	return offset;
}


static const value_string nis_error[] = {
#define NIS_SUCCESS		0
	{	NIS_SUCCESS,		"A-ok, let's rock n roll"	},
#define NIS_S_SUCCESS		1
	{	NIS_S_SUCCESS,		"Name found (maybe)"	},
#define NIS_NOTFOUND		2
	{	NIS_NOTFOUND,		"Name definitely not found"	},
#define NIS_S_NOTFOUND		3
	{	NIS_S_NOTFOUND,		"Name maybe not found"	},
#define NIS_CACHEEXPIRED	4
	{	NIS_CACHEEXPIRED,	"Name exists but cache out of date"	},
#define NIS_NAMEUNREACHABLE	5
	{	NIS_NAMEUNREACHABLE,	"Can't get there from here"	},
#define NIS_UNKNOWNOBJ		6
	{	NIS_UNKNOWNOBJ,		"Object type is bogus"	},
#define NIS_TRYAGAIN		7
	{	NIS_TRYAGAIN,		"I'm busy, call back"	},
#define NIS_SYSTEMERROR		8
	{	NIS_SYSTEMERROR,	"Generic system error"	},
#define NIS_CHAINBROKEN		9
	{	NIS_CHAINBROKEN,	"First/Next warning"	},
#define NIS_PERMISSION		10
	{	NIS_PERMISSION,		"Not enough permission to access"	},
#define NIS_NOTOWNER		11
	{	NIS_NOTOWNER,		"You don't own it, sorry"	},
#define NIS_NOT_ME		12
	{	NIS_NOT_ME,		"I don't serve this name"	},
#define NIS_NOMEMORY		13
	{	NIS_NOMEMORY,		"Outta VM! Help!"	},
#define NIS_NAMEEXISTS		14
	{	NIS_NAMEEXISTS,		"Can't create over another name"	},
#define NIS_NOTMASTER		15
	{	NIS_NOTMASTER,		"I'm just a secondary, don't ask me"	},
#define NIS_INVALIDOBJ		16
	{	NIS_INVALIDOBJ,		"Object is broken somehow"	},
#define NIS_BADNAME		17
	{	NIS_BADNAME,		"Unparsable name"	},
#define NIS_NOCALLBACK		18
	{	NIS_NOCALLBACK,		"Couldn't talk to call back proc"	},
#define NIS_CBRESULTS		19
	{	NIS_CBRESULTS,		"Results being called back to you"	},
#define NIS_NOSUCHNAME		20
	{	NIS_NOSUCHNAME,		"Name unknown"	},
#define NIS_NOTUNIQUE		21
	{	NIS_NOTUNIQUE,		"Value is not unique (entry)"	},
#define NIS_IBMODERROR		22
	{	NIS_IBMODERROR,		"Inf. Base. Modify error."	},
#define NIS_NOSUCHTABLE		23
	{	NIS_NOSUCHTABLE,	"Name for table was wrong"	},
#define NIS_TYPEMISMATCH	24
	{	NIS_TYPEMISMATCH,	"Entry and table type mismatch"	},
#define NIS_LINKNAMEERROR	25
	{	NIS_LINKNAMEERROR,	"Link points to bogus name"	},
#define NIS_PARTIAL		26
	{	NIS_PARTIAL,		"Partial success, found table"	},
#define NIS_TOOMANYATTRS	27
	{	NIS_TOOMANYATTRS,	"Too many attributes"	},
#define NIS_RPCERROR		28
	{	NIS_RPCERROR,		"RPC error encountered"	},
#define NIS_BADATTRIBUTE	29
	{	NIS_BADATTRIBUTE,	"Bad or invalid attribute"	},
#define NIS_NOTSEARCHABLE	30
	{	NIS_NOTSEARCHABLE,	"Non-searchable object searched"	},
#define NIS_CBERROR		31
	{	NIS_CBERROR,		"Error during callback (svc crash)"	},
#define NIS_FOREIGNNS		32
	{	NIS_FOREIGNNS,		"Foreign Namespace"	},
#define NIS_BADOBJECT		33
	{	NIS_BADOBJECT,		"Malformed object structure"	},
#define NIS_NOTSAMEOBJ		34
	{	NIS_NOTSAMEOBJ,		"Object swapped during deletion"	},
#define NIS_MODFAIL		35
	{	NIS_MODFAIL,		"Failure during a Modify."	},
#define NIS_BADREQUEST		36
	{	NIS_BADREQUEST,		"Illegal query for table"	},
#define NIS_NOTEMPTY		37
	{	NIS_NOTEMPTY,		"Attempt to remove a non-empty tbl"	},
#define NIS_COLDSTART_ERR	38
	{	NIS_COLDSTART_ERR,	"Error accessing the cold start file"	},
#define NIS_RESYNC		39
	{	NIS_RESYNC,		"Transaction log too far out of date"	},
#define NIS_FAIL		40
	{	NIS_FAIL,		"NIS operation failed."	},
#define NIS_UNAVAIL		41
	{	NIS_UNAVAIL,		"NIS+ service is unavailable (client)"	},
#define NIS_RES2BIG		42
	{	NIS_RES2BIG,		"NIS+ result too big for datagram"	},
#define NIS_SRVAUTH		43
	{	NIS_SRVAUTH,		"NIS+ server wasn't authenticated."	},
#define NIS_CLNTAUTH		44
	{	NIS_CLNTAUTH,		"NIS+ Client wasn't authenticated."	},
#define NIS_NOFILESPACE		45
	{	NIS_NOFILESPACE,	"NIS+ server ran out of disk space"	},
#define NIS_NOPROC		46
	{	NIS_NOPROC,		"NIS+ server couldn't create new proc"	},
#define NIS_DUMPLATER		47
	{	NIS_DUMPLATER,		"NIS+ server already has dump child"	},
	{	0,	NULL	},
};

static int
dissect_nisplus_result(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_error, offset);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_nisplus_object, hf_nisplus_object);

	offset = dissect_rpc_data(tvb, tree,
			hf_nisplus_cookie, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_zticks, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_dticks, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_aticks, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_cticks, offset);

	return offset;
}

static int
dissect_fd_result(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_error, offset);

	offset = dissect_rpc_string(tvb, tree,
			hf_nisplus_fd_dirname, offset, NULL);

	offset = dissect_rpc_data(tvb, tree,
			hf_nisplus_dir_data, offset);

	offset = dissect_rpc_data(tvb, tree,
			hf_nisplus_signature, offset);

	return offset;
}

static const value_string entry_type[] = {
#define LOG_NOP		0
	{	LOG_NOP,		"NOP"	},
#define LOG_ADD_NAME		1
	{	LOG_ADD_NAME,		"Name Was Added"	},
#define LOG_REM_NAME		2
	{	LOG_REM_NAME,		"Name Was Removed"	},
#define LOG_MOD_NAME_OLD	3
	{	LOG_MOD_NAME_OLD,	"Name Was Modified"	},
#define LOG_MOD_NAME_NEW	4
	{	LOG_MOD_NAME_NEW,	"Name Was Modified"	},
#define LOG_ADD_IBASE		5
	{	LOG_ADD_IBASE,		"Entry Added To Information Base"	},
#define LOG_REM_IBASE		6
	{	LOG_REM_IBASE,		"Entry Removed From Information Base"	},
#define LOG_MOD_IBASE		7
	{	LOG_MOD_IBASE,		"Entry Modified In Information Base"	},
#define LOG_UPD_STAMP		8
	{	LOG_UPD_STAMP,		"Update Timestamp"	},
	{	0,	NULL	},
};
static int
dissect_log_entry(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	proto_tree* lock_tree = NULL;
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nisplus_log_entry,
			tvb, offset, -1, ENC_NA);

	lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_log_entry);

	offset = dissect_nisplus_time(tvb, offset, lock_tree,
			hf_nisplus_log_time);

	offset = dissect_rpc_uint32(tvb, lock_tree,
			hf_nisplus_log_type, offset);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_log_principal, offset, NULL);

	offset = dissect_rpc_string(tvb, lock_tree,
			hf_nisplus_directory_name, offset, NULL);

	offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
			dissect_attr, hf_nisplus_attrs_array);

	offset = dissect_nisplus_object(tvb, offset, pinfo, lock_tree, data);

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_log_result(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_error, offset);

	offset = dissect_rpc_data(tvb, tree,
			hf_nisplus_cookie, offset);

	offset = dissect_rpc_array(tvb, pinfo, tree, offset,
			dissect_log_entry, hf_nisplus_log_entries);

	return offset;
}

static int
dissect_callback_result(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_bool(tvb, tree, hf_nisplus_callback_status, 0);
}

static int
dissect_change_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	return dissect_nisplus_time(tvb, 0, tree, hf_nisplus_log_time);
}

static int
dissect_cp_result(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	int offset = 0;

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_cp_status, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_cp_zticks, offset);

	offset = dissect_rpc_uint32(tvb, tree,
			hf_nisplus_cp_dticks, offset);

	return offset;
}

static int
dissect_nisplus_error(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_uint32(tvb, tree, hf_nisplus_error, 0);
}

/* proc number, "proc name", dissect_request, dissect_reply */
static const vsff nisplus3_proc[] = {
	{ NISPROC_NULL,			"NULL",
		dissect_rpc_void,	dissect_rpc_void },
	{ NISPROC_LOOKUP,		"LOOKUP",
		dissect_ns_request,	dissect_nisplus_result },
	{ NISPROC_ADD,			"ADD",
		dissect_ns_request,	dissect_nisplus_result },
	{ NISPROC_MODIFY,		"MODIFY",
		dissect_ns_request,	dissect_nisplus_result },
	{ NISPROC_REMOVE,		"REMOVE",
		dissect_ns_request,	dissect_nisplus_result },
	{ NISPROC_IBLIST,		"IBLIST",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_IBADD,		"IBADD",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_IBMODIFY,		"IBMODIFY",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_IBREMOVE,		"IBREMOVE",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_IBFIRST,		"IBFIRST",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_IBNEXT,		"IBNEXT",
		dissect_ib_request,	dissect_nisplus_result },
	{ NISPROC_FINDDIRECTORY,	"FINDDIRECTORY",
		dissect_fd_args,	dissect_fd_result },
	{ NISPROC_STATUS,		"STATUS",
		dissect_nisplus_taglist, dissect_nisplus_taglist },
	{ NISPROC_DUMPLOG,		"DUMPLOG",
		dissect_dump_args,	dissect_log_result },
	{ NISPROC_DUMP,			"DUMP",
		dissect_dump_args,	dissect_log_result },
	{ NISPROC_CALLBACK,		"CALLBACK",
		dissect_netobj,		dissect_callback_result },
	{ NISPROC_CPTIME,		"CPTIME",
		dissect_nisname,	dissect_change_time },
	{ NISPROC_CHECKPOINT,		"CHECKPOINT",
		dissect_nisname,	dissect_cp_result },
	{ NISPROC_PING,			"PING",
		dissect_ping_args,	dissect_rpc_void },
	{ NISPROC_SERVSTATE,		"SERVSTATE",
		dissect_nisplus_taglist, dissect_nisplus_taglist },
	{ NISPROC_MKDIR,		"MKDIR",
		dissect_nisname,	dissect_nisplus_error },
	{ NISPROC_RMDIR,		"RMDIR",
		dissect_nisname,	dissect_nisplus_error },
	{ NISPROC_UPDKEYS,		"UPDKEYS",
		dissect_nisname,	dissect_nisplus_error },
	{ 0,	NULL,		NULL,				NULL }
};
static const value_string nisplus3_proc_vals[] = {
	{ NISPROC_NULL,			"NULL" },
	{ NISPROC_LOOKUP,		"LOOKUP" },
	{ NISPROC_ADD,			"ADD" },
	{ NISPROC_MODIFY,		"MODIFY" },
	{ NISPROC_REMOVE,		"REMOVE" },
	{ NISPROC_IBLIST,		"IBLIST" },
	{ NISPROC_IBADD,		"IBADD" },
	{ NISPROC_IBMODIFY,		"IBMODIFY" },
	{ NISPROC_IBREMOVE,		"IBREMOVE" },
	{ NISPROC_IBFIRST,		"IBFIRST" },
	{ NISPROC_IBNEXT,		"IBNEXT" },
	{ NISPROC_FINDDIRECTORY,	"FINDDIRECTORY" },
	{ NISPROC_STATUS,		"STATUS" },
	{ NISPROC_DUMPLOG,		"DUMPLOG" },
	{ NISPROC_DUMP,			"DUMP" },
	{ NISPROC_CALLBACK,		"CALLBACK" },
	{ NISPROC_CPTIME,		"CPTIME" },
	{ NISPROC_CHECKPOINT,		"CHECKPOINT" },
	{ NISPROC_PING,			"PING" },
	{ NISPROC_SERVSTATE,		"SERVSTATE" },
	{ NISPROC_MKDIR,		"MKDIR" },
	{ NISPROC_RMDIR,		"RMDIR" },
	{ NISPROC_UPDKEYS,		"UPDKEYS" },
	{ 0,	NULL }
};
static const rpc_prog_vers_info nisplus_vers_info[] = {
	{ 3, nisplus3_proc, &hf_nisplus_procedure_v3 },
};



void
proto_register_nis(void)
{
	static const true_false_string tfs_col_binary = {
		"column is binary",
		"column is NOT binary"
	};
	static const true_false_string tfs_col_encrypted = {
		"column is encrypted",
		"column is NOT encrypted"
	};
	static const true_false_string tfs_col_xdr = {
		"column is xdr encoded",
		"column is NOT xdr encoded"
	};
	static const true_false_string tfs_col_searchable = {
		"column is searchable",
		"column is NOT searchable"
	};
	static const true_false_string tfs_col_casesensitive = {
		"column is case sensitive",
		"column is NOT case sensitive"
	};
	static const true_false_string tfs_col_modified = {
		"column is modified",
		"column is NOT modified"
	};
	static const true_false_string tfs_col_asn = {
		"column is asn.1 encoded",
		"column is NOT asn.1 encoded"
	};

	static const true_false_string tfs_entry_binary = {
		"entry is binary",
		"entry is NOT binary"
	};

	static const true_false_string tfs_entry_crypt = {
		"entry is encrypted",
		"entry is NOT encrypted"
	};

	static const true_false_string tfs_entry_xdr = {
		"entry is xdr encoded",
		"entry is NOT xdr encoded"
	};

	static const true_false_string tfs_entry_modified = {
		"entry is modified",
		"entry is NOT modified"
	};

	static const true_false_string tfs_entry_asn = {
		"entry is asn.1 encoded",
		"entry is NOT asn.1 encoded"
	};

	static const true_false_string tfs_world_read = {
		"world can read",
		"world can NOT read"
	};

	static const true_false_string tfs_world_modify = {
		"world can modify",
		"world can NOT modify"
	};

	static const true_false_string tfs_world_create = {
		"world can create",
		"world can NOT create"
	};

	static const true_false_string tfs_world_destroy = {
		"world can destroy",
		"world can NOT destroy"
	};

	static const true_false_string tfs_group_read = {
		"group can read",
		"group can NOT read"
	};

	static const true_false_string tfs_group_modify = {
		"group can modify",
		"group can NOT modify"
	};

	static const true_false_string tfs_group_create = {
		"group can create",
		"group can NOT create"
	};

	static const true_false_string tfs_group_destroy = {
		"group can destroy",
		"group can NOT destroy"
	};

	static const true_false_string tfs_owner_read = {
		"owner can read",
		"owner can NOT read"
	};

	static const true_false_string tfs_owner_modify = {
		"owner can modify",
		"owner can NOT modify"
	};

	static const true_false_string tfs_owner_create = {
		"owner can create",
		"owner can NOT create"
	};

	static const true_false_string tfs_owner_destroy = {
		"owner can destroy",
		"owner can NOT destroy"
	};

	static const true_false_string tfs_nobody_read = {
		"nobody can read",
		"nobody can NOT read"
	};

	static const true_false_string tfs_nobody_modify = {
		"nobody can modify",
		"nobody can NOT modify"
	};

	static const true_false_string tfs_nobody_create = {
		"nobody can create",
		"nobody can NOT create"
	};

	static const true_false_string tfs_nobody_destroy = {
		"nobody can destroy",
		"nobody can NOT destroy"
	};

	static const true_false_string tfs_callback_status = {
		"callback is running",
		"callback is not running"
	};




	static hf_register_info hf[] = {
		{ &hf_nisplus_procedure_v3, {
			"V3 Procedure", "nisplus.procedure_v3", FT_UINT32, BASE_DEC,
			VALS(nisplus3_proc_vals), 0, NULL, HFILL }},
		{ &hf_nisplus_object, {
			"NIS Object", "nisplus.object", FT_NONE, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_oid, {
			"Object Identity Verifier", "nisplus.object.oid", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Object Identity Verifier", HFILL }},

		{ &hf_nisplus_object_name, {
			"name", "nisplus.object.name", FT_STRING, BASE_NONE,
			NULL, 0, "NIS Name For This Object", HFILL }},

		{ &hf_nisplus_object_owner, {
			"owner", "nisplus.object.owner", FT_STRING, BASE_NONE,
			NULL, 0, "NIS Name Of Object Owner", HFILL }},

		{ &hf_nisplus_object_group, {
			"group", "nisplus.object.group", FT_STRING, BASE_NONE,
			NULL, 0, "NIS Name Of Access Group", HFILL }},

		{ &hf_nisplus_object_domain, {
			"domain", "nisplus.object.domain", FT_STRING, BASE_NONE,
			NULL, 0, "NIS Administrator For This Object", HFILL }},

		{ &hf_nisplus_object_ttl, {
			"ttl", "nisplus.object.ttl", FT_UINT32, BASE_DEC,
			NULL, 0, "NIS Time To Live For This Object", HFILL }},

		{ &hf_nisplus_object_private, {
			"private", "nisplus.object.private", FT_BYTES, BASE_NONE,
			NULL, 0, "NIS Private Object", HFILL }},

		{ &hf_nisplus_directory, {
			"directory", "nisplus.directory", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Directory Object", HFILL }},

		{ &hf_nisplus_directory_name, {
			"directory name", "nisplus.directory.name", FT_STRING, BASE_NONE,
			NULL, 0, "Name Of Directory Being Served", HFILL }},

		{ &hf_nisplus_directory_type, {
			"type", "nisplus.directory.type", FT_UINT32, BASE_DEC,
			VALS(ns_type), 0, "NIS Type Of Name Service", HFILL }},

		{ &hf_nisplus_directory_ttl, {
			"ttl", "nisplus.directory.ttl", FT_UINT32, BASE_DEC,
			NULL, 0, "Time To Live", HFILL }},

		{ &hf_nisplus_directory_mask, {
			"mask", "nisplus.directory.mask", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Directory Create/Destroy Rights", HFILL }},

		{ &hf_nisplus_directory_mask_list, {
			"mask list", "nisplus.directory.mask_list", FT_NONE, BASE_NONE,
			NULL, 0, "List Of Directory Create/Destroy Rights", HFILL }},

		{ &hf_nisplus_mask_world_read, {
			"WORLD READ", "nisplus.directory.mask.world_read",
			FT_BOOLEAN, 32, TFS(&tfs_world_read),
			NIS_MASK_WORLD_READ, "World Read Flag", HFILL }},

		{ &hf_nisplus_mask_world_modify, {
			"WORLD MODIFY", "nisplus.directory.mask.world_modify",
			FT_BOOLEAN, 32, TFS(&tfs_world_modify),
			NIS_MASK_WORLD_MODIFY, "World Modify Flag", HFILL }},

		{ &hf_nisplus_mask_world_create, {
			"WORLD CREATE", "nisplus.directory.mask.world_create",
			FT_BOOLEAN, 32, TFS(&tfs_world_create),
			NIS_MASK_WORLD_CREATE, "World Create Flag", HFILL }},

		{ &hf_nisplus_mask_world_destroy, {
			"WORLD DESTROY", "nisplus.directory.mask.world_destroy",
			FT_BOOLEAN, 32, TFS(&tfs_world_destroy),
			NIS_MASK_WORLD_DESTROY, "World Destroy Flag", HFILL }},

		{ &hf_nisplus_mask_group_read, {
			"GROUP READ", "nisplus.directory.mask.group_read",
			FT_BOOLEAN, 32, TFS(&tfs_group_read),
			NIS_MASK_GROUP_READ, "Group Read Flag", HFILL }},

		{ &hf_nisplus_mask_group_modify, {
			"GROUP MODIFY", "nisplus.directory.mask.group_modify",
			FT_BOOLEAN, 32, TFS(&tfs_group_modify),
			NIS_MASK_GROUP_MODIFY, "Group Modify Flag", HFILL }},

		{ &hf_nisplus_mask_group_create, {
			"GROUP CREATE", "nisplus.directory.mask.group_create",
			FT_BOOLEAN, 32, TFS(&tfs_group_create),
			NIS_MASK_GROUP_CREATE, "Group Create Flag", HFILL }},

		{ &hf_nisplus_mask_group_destroy, {
			"GROUP DESTROY", "nisplus.directory.mask.group_destroy",
			FT_BOOLEAN, 32, TFS(&tfs_group_destroy),
			NIS_MASK_GROUP_DESTROY, "Group Destroy Flag", HFILL }},

		{ &hf_nisplus_mask_owner_read, {
			"OWNER READ", "nisplus.directory.mask.owner_read",
			FT_BOOLEAN, 32, TFS(&tfs_owner_read),
			NIS_MASK_OWNER_READ, "Owner Read Flag", HFILL }},

		{ &hf_nisplus_mask_owner_modify, {
			"OWNER MODIFY", "nisplus.directory.mask.owner_modify",
			FT_BOOLEAN, 32, TFS(&tfs_owner_modify),
			NIS_MASK_OWNER_MODIFY, "Owner Modify Flag", HFILL }},

		{ &hf_nisplus_mask_owner_create, {
			"OWNER CREATE", "nisplus.directory.mask.owner_create",
			FT_BOOLEAN, 32, TFS(&tfs_owner_create),
			NIS_MASK_OWNER_CREATE, "Owner Create Flag", HFILL }},

		{ &hf_nisplus_mask_owner_destroy, {
			"OWNER DESTROY", "nisplus.directory.mask.owner_destroy",
			FT_BOOLEAN, 32, TFS(&tfs_owner_destroy),
			NIS_MASK_OWNER_DESTROY, "Owner Destroy Flag", HFILL }},

		{ &hf_nisplus_mask_nobody_read, {
			"NOBODY READ", "nisplus.directory.mask.nobody_read",
			FT_BOOLEAN, 32, TFS(&tfs_nobody_read),
			NIS_MASK_NOBODY_READ, "Nobody Read Flag", HFILL }},

		{ &hf_nisplus_mask_nobody_modify, {
			"NOBODY MODIFY", "nisplus.directory.mask.nobody_modify",
			FT_BOOLEAN, 32, TFS(&tfs_nobody_modify),
			NIS_MASK_NOBODY_MODIFY, "Nobody Modify Flag", HFILL }},

		{ &hf_nisplus_mask_nobody_create, {
			"NOBODY CREATE", "nisplus.directory.mask.nobody_create",
			FT_BOOLEAN, 32, TFS(&tfs_nobody_create),
			NIS_MASK_NOBODY_CREATE, "Nobody Create Flag", HFILL }},

		{ &hf_nisplus_mask_nobody_destroy, {
			"NOBODY DESTROY", "nisplus.directory.mask.nobody_destroy",
			FT_BOOLEAN, 32, TFS(&tfs_nobody_destroy),
			NIS_MASK_NOBODY_DESTROY, "Nobody Destroy Flag", HFILL }},

		{ &hf_nisplus_access_mask, {
			"access mask", "nisplus.access.mask", FT_UINT32, BASE_HEX,
			NULL, 0, "NIS Access Mask", HFILL }},

		{ &hf_nisplus_object_type, {
			"type", "nisplus.object.type", FT_UINT32, BASE_DEC,
			VALS(obj_type), 0, "NIS Type Of Object", HFILL }},

		{ &hf_nisplus_servers, {
			"nis servers", "nisplus.servers", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Servers For This Directory", HFILL }},

		{ &hf_nisplus_cbservers, {
			"nis servers", "nisplus.servers", FT_NONE, BASE_NONE,
			NULL, 0, "Optional Callback Server", HFILL }},

		{ &hf_nisplus_server, {
			"server", "nisplus.server", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Server For This Directory", HFILL }},

		{ &hf_nisplus_server_name, {
			"name", "nisplus.server.name", FT_STRING, BASE_NONE,
			NULL, 0, "Name Of NIS Server", HFILL }},

		{ &hf_nisplus_key_type, {
			"type", "nisplus.key.type", FT_UINT32, BASE_DEC,
			VALS(key_type), 0, "Type Of Key", HFILL }},

		{ &hf_nisplus_key_data, {
			"key data", "nisplus.key.data", FT_BYTES, BASE_NONE,
			NULL, 0, "Encryption Key", HFILL }},

		{ &hf_nisplus_endpoints, {
			"nis endpoints", "nisplus.endpoints", FT_NONE, BASE_NONE,
			NULL, 0, "Endpoints For This NIS Server", HFILL }},

		{ &hf_nisplus_endpoint, {
			"endpoint", "nisplus.endpoint", FT_NONE, BASE_NONE,
			NULL, 0, "Endpoint For This NIS Server", HFILL }},

		{ &hf_nisplus_endpoint_uaddr, {
			"addr", "nisplus.endpoint.uaddr", FT_STRING, BASE_NONE,
			NULL, 0, "Address", HFILL }},

		{ &hf_nisplus_endpoint_family, {
			"family", "nisplus.endpoint.family", FT_STRING, BASE_NONE,
			NULL, 0, "Transport Family", HFILL }},

		{ &hf_nisplus_endpoint_proto, {
			"proto", "nisplus.endpoint.proto", FT_STRING, BASE_NONE,
			NULL, 0, "Protocol", HFILL }},

		{ &hf_nisplus_link, {
			"link", "nisplus.link", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Link Object", HFILL }},

		{ &hf_nisplus_attrs_array, {
			"Attributes", "nisplus.attributes", FT_NONE, BASE_NONE,
			NULL, 0, "List Of Attributes", HFILL }},

		{ &hf_nisplus_attr, {
			"Attribute", "nisplus.attr", FT_NONE, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_attr_name, {
			"name", "nisplus.attr.name", FT_STRING, BASE_NONE,
			NULL, 0, "Attribute Name", HFILL }},

		{ &hf_nisplus_attr_val, {
			"val", "nisplus.attr.val", FT_BYTES, BASE_NONE,
			NULL, 0, "Attribute Value", HFILL }},

		{ &hf_nisplus_entry, {
			"entry", "nisplus.entry", FT_NONE, BASE_NONE,
			NULL, 0, "Entry Object", HFILL }},

		{ &hf_nisplus_entry_type, {
			"type", "nisplus.entry.type", FT_STRING, BASE_NONE,
			NULL, 0, "Entry Type", HFILL }},

		{ &hf_nisplus_entry_cols, {
			"columns", "nisplus.entry.cols", FT_NONE, BASE_NONE,
			NULL, 0, "Entry Columns", HFILL }},

		{ &hf_nisplus_entry_col, {
			"column", "nisplus.entry.col", FT_NONE, BASE_NONE,
			NULL, 0, "Entry Column", HFILL }},

#if 0
		{ &hf_nisplus_entry_flags, {
			"flags", "nisplus.entry.flags", FT_UINT32, BASE_HEX,
			NULL, 0, "Entry Col Flags", HFILL }},
#endif

		{ &hf_nisplus_entry_val, {
			"val", "nisplus.entry.val", FT_STRING, BASE_NONE,
			NULL, 0, "Entry Value", HFILL }},

		{ &hf_nisplus_entry_mask, {
			"mask", "nisplus.entry.mask", FT_UINT32, BASE_HEX,
			NULL, 0, "Entry Col Mask", HFILL }},

		{ &hf_nisplus_entry_mask_binary, {
			"BINARY", "nisplus.entry.mask.binary",
			FT_BOOLEAN, 32, TFS(&tfs_entry_binary),
			NIS_MASK_ENTRY_BINARY, "Is This Entry BINARY Flag", HFILL }},

		{ &hf_nisplus_entry_mask_crypt, {
			"ENCRYPTED", "nisplus.entry.mask.encrypted",
			FT_BOOLEAN, 32, TFS(&tfs_entry_crypt),
			NIS_MASK_ENTRY_CRYPT, "Is This Entry ENCRYPTED Flag", HFILL }},

		{ &hf_nisplus_entry_mask_xdr, {
			"XDR", "nisplus.entry.mask.xdr",
			FT_BOOLEAN, 32, TFS(&tfs_entry_xdr),
			NIS_MASK_ENTRY_XDR, "Is This Entry XDR Encoded Flag", HFILL }},

		{ &hf_nisplus_entry_mask_modified, {
			"MODIFIED", "nisplus.entry.mask.modified",
			FT_BOOLEAN, 32, TFS(&tfs_entry_modified),
			NIS_MASK_ENTRY_MODIFIED, "Is This Entry MODIFIED Flag", HFILL }},

		{ &hf_nisplus_entry_mask_asn, {
			"ASN.1", "nisplus.entry.mask.asn",
			FT_BOOLEAN, 32, TFS(&tfs_entry_asn),
			NIS_MASK_ENTRY_ASN, "Is This Entry ASN.1 Encoded Flag", HFILL }},

		{ &hf_nisplus_table, {
			"table", "nisplus.table", FT_NONE, BASE_NONE,
			NULL, 0, "Table Object", HFILL }},

		{ &hf_nisplus_table_type, {
			"type", "nisplus.table.type", FT_STRING, BASE_NONE,
			NULL, 0, "Table Type", HFILL }},

		{ &hf_nisplus_table_maxcol, {
			"max columns", "nisplus.table.maxcol", FT_UINT16, BASE_DEC,
			NULL, 0, "Maximum Number Of Columns For Table", HFILL }},

		{ &hf_nisplus_table_sep, {
			"separator", "nisplus.table.separator", FT_UINT8, BASE_HEX,
			NULL, 0, "Separator Character", HFILL }},

		{ &hf_nisplus_table_cols, {
			"columns", "nisplus.table.cols", FT_NONE, BASE_NONE,
			NULL, 0, "Table Columns", HFILL }},

		{ &hf_nisplus_table_col, {
			"column", "nisplus.table.col", FT_NONE, BASE_NONE,
			NULL, 0, "Table Column", HFILL }},

		{ &hf_nisplus_table_path, {
			"path", "nisplus.table.path", FT_STRING, BASE_NONE,
			NULL, 0, "Table Path", HFILL }},

		{ &hf_nisplus_table_col_name, {
			"column name", "nisplus.table.col.name", FT_STRING, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_table_col_mask, {
			"flags", "nisplus.table.col.flags", FT_UINT32, BASE_HEX,
			NULL, 0, "Flags For This Column", HFILL }},

		{ &hf_nisplus_table_col_mask_binary, {
			"binary", "nisplus.table.flags.binary",
			FT_BOOLEAN, 32, TFS(&tfs_col_binary),
			NIS_MASK_TABLE_BINARY, "Is This Column BINARY", HFILL }},

		{ &hf_nisplus_table_col_mask_encrypted, {
			"encrypted", "nisplus.table.flags.encrypted",
			FT_BOOLEAN, 32, TFS(&tfs_col_encrypted),
			NIS_MASK_TABLE_CRYPT, "Is This Column ENCRYPTED", HFILL }},

		{ &hf_nisplus_table_col_mask_xdr, {
			"xdr", "nisplus.table.flags.xdr",
			FT_BOOLEAN, 32, TFS(&tfs_col_xdr),
			NIS_MASK_TABLE_XDR, "Is This Column XDR Encoded", HFILL }},

		{ &hf_nisplus_table_col_mask_searchable, {
			"searchable", "nisplus.table.flags.searchable",
			FT_BOOLEAN, 32, TFS(&tfs_col_searchable),
			NIS_MASK_TABLE_SRCH, "Is This Column SEARCHABLE", HFILL }},

		{ &hf_nisplus_table_col_mask_casesensitive, {
			"casesensitive", "nisplus.table.flags.casesensitive",
			FT_BOOLEAN, 32, TFS(&tfs_col_casesensitive),
			NIS_MASK_TABLE_CASE, "Is This Column CASESENSITIVE", HFILL }},

		{ &hf_nisplus_table_col_mask_modified, {
			"modified", "nisplus.table.flags.modified",
			FT_BOOLEAN, 32, TFS(&tfs_col_modified),
			NIS_MASK_TABLE_MODIFIED, "Is This Column MODIFIED", HFILL }},

		{ &hf_nisplus_table_col_mask_asn, {
			"asn", "nisplus.table.flags.asn",
			FT_BOOLEAN, 32, TFS(&tfs_col_asn),
			NIS_MASK_TABLE_ASN, "Is This Column ASN.1 Encoded", HFILL }},

		{ &hf_nisplus_group, {
			"Group", "nisplus.group", FT_NONE, BASE_NONE,
			NULL, 0, "Group Object", HFILL }},

		{ &hf_nisplus_grps, {
			"Groups", "nisplus.grps", FT_NONE, BASE_NONE,
			NULL, 0, "List Of Groups", HFILL }},

		{ &hf_nisplus_group_flags, {
			"flags", "nisplus.group.flags", FT_UINT32, BASE_HEX,
			NULL, 0, "Group Object Flags", HFILL }},

		{ &hf_nisplus_group_name, {
			"group name", "nisplus.group.name", FT_STRING, BASE_NONE,
			NULL, 0, "Name Of Group Member", HFILL }},

		{ &hf_nisplus_object_ctime, {
			"ctime", "nisplus.ctime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
			NULL, 0, "Time Of Creation", HFILL }},

		{ &hf_nisplus_object_mtime, {
			"mtime", "nisplus.mtime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
			NULL, 0, "Time Last Modified", HFILL }},

		{ &hf_nisplus_ib_flags, {
			"flags", "nisplus.ib.flags", FT_UINT32, BASE_HEX,
			NULL, 0, "Information Base Flags", HFILL }},

		{ &hf_nisplus_ib_bufsize, {
			"bufsize", "nisplus.ib.bufsize", FT_UINT32, BASE_HEX,
			NULL, 0, "Optional First/NextBufSize", HFILL }},

		{ &hf_nisplus_cookie, {
			"cookie", "nisplus.cookie", FT_BYTES, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_fd_dirname, {
			"dirname", "nisplus.fd.dirname", FT_STRING, BASE_NONE,
			NULL, 0, "Directory Name", HFILL }},

		{ &hf_nisplus_fd_requester, {
			"requester", "nisplus.fd.requester", FT_STRING, BASE_NONE,
			NULL, 0, "Host Principal Name For Signature", HFILL }},

		{ &hf_nisplus_taglist, {
			"taglist", "nisplus.taglist", FT_NONE, BASE_NONE,
			NULL, 0, "List Of Tags", HFILL }},

		{ &hf_nisplus_tag, {
			"tag", "nisplus.tag", FT_NONE, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_tag_type, {
			"type", "nisplus.tag.type", FT_UINT32, BASE_DEC,
			NULL, 0, "Type Of Statistics Tag", HFILL }},

		{ &hf_nisplus_tag_val, {
			"value", "nisplus.tag.value", FT_STRING, BASE_NONE,
			NULL, 0, "Value Of Statistics Tag", HFILL }},

		{ &hf_nisplus_dump_dir, {
			"directory", "nisplus.dump.dir", FT_STRING, BASE_NONE,
			NULL, 0, "Directory To Dump", HFILL }},

		{ &hf_nisplus_dump_time, {
			"time", "nisplus.dump.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
			NULL, 0, "From This Timestamp", HFILL }},

		{ &hf_nisplus_dummy, {
			"dummy", "nisplus.dummy", FT_BYTES, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_ping_time, {
			"time", "nisplus.ping.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
			NULL, 0, "Timestamp Of The Transaction", HFILL }},

		{ &hf_nisplus_ping_dir, {
			"directory", "nisplus.ping.dir", FT_STRING, BASE_NONE,
			NULL, 0, "Directory That Had The Change", HFILL }},

		{ &hf_nisplus_error, {
			"status", "nisplus.status", FT_UINT32, BASE_DEC,
			VALS(nis_error), 0, "NIS Status Code", HFILL }},

		{ &hf_nisplus_dir_data, {
			"data", "nisplus.fd.dir.data", FT_BYTES, BASE_NONE,
			NULL, 0, "Directory Data In XDR Format", HFILL }},

		{ &hf_nisplus_signature, {
			"signature", "nisplus.fd.sig", FT_BYTES, BASE_NONE,
			NULL, 0, "Signature Of The Source", HFILL }},

		{ &hf_nisplus_log_entries, {
			"log entries", "nisplus.log.entries", FT_NONE, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_log_entry, {
			"log entry", "nisplus.log.entry", FT_NONE, BASE_NONE,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_log_time, {
			"time", "nisplus.log.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
			NULL, 0, "Time Of Log Entry", HFILL }},

		{ &hf_nisplus_log_type, {
			"type", "nisplus.log.entry.type", FT_UINT32, BASE_DEC,
			VALS(entry_type), 0, "Type Of Entry In Transaction Log", HFILL }},

		{ &hf_nisplus_log_principal, {
			"principal", "nisplus.log.principal", FT_STRING, BASE_NONE,
			NULL, 0, "Principal Making The Change", HFILL }},

		{ &hf_nisplus_callback_status, {
			"status", "nisplus.callback.status",
			FT_BOOLEAN, BASE_NONE, TFS(&tfs_callback_status),
			0x0, "Status Of Callback Thread", HFILL }},

		{ &hf_nisplus_cp_status, {
			"status", "nisplus.checkpoint.status", FT_UINT32, BASE_DEC,
			NULL, 0, "Checkpoint Status", HFILL }},

		{ &hf_nisplus_cp_zticks, {
			"zticks", "nisplus.checkpoint.zticks", FT_UINT32, BASE_DEC,
			NULL, 0, "Service Ticks", HFILL }},

		{ &hf_nisplus_cp_dticks, {
			"dticks", "nisplus.checkpoint.dticks", FT_UINT32, BASE_DEC,
			NULL, 0, "Database Ticks", HFILL }},

		{ &hf_nisplus_zticks, {
			"zticks", "nisplus.zticks", FT_UINT32, BASE_DEC,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_dticks, {
			"dticks", "nisplus.dticks", FT_UINT32, BASE_DEC,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_aticks, {
			"aticks", "nisplus.aticks", FT_UINT32, BASE_DEC,
			NULL, 0, NULL, HFILL }},

		{ &hf_nisplus_cticks, {
			"cticks", "nisplus.cticks", FT_UINT32, BASE_DEC,
			NULL, 0, NULL, HFILL }},

	};

	static gint *ett[] = {
		&ett_nisplus,
		&ett_nisplus_object,
		&ett_nisplus_oid,
		&ett_nisplus_directory,
		&ett_nisplus_directory_mask,
		&ett_nisplus_access_mask,
		&ett_nisplus_server,
		&ett_nisplus_endpoint,
		&ett_nisplus_link,
		&ett_nisplus_attr,
		&ett_nisplus_entry,
		&ett_nisplus_entry_col,
		&ett_nisplus_entry_mask,
		&ett_nisplus_table,
		&ett_nisplus_table_col,
		&ett_nisplus_table_col_mask,
		&ett_nisplus_group,
		&ett_nisplus_grps,
		&ett_nisplus_tag,
		&ett_nisplus_log_entry,
	};

	proto_nisplus = proto_register_protocol("NIS+", "NIS+", "nisplus");
	proto_register_field_array(proto_nisplus, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
}

void
proto_reg_handoff_nis(void)
{
	/* Register the protocol as RPC */
	rpc_init_prog(proto_nisplus, NIS_PROGRAM, ett_nisplus,
	    G_N_ELEMENTS(nisplus_vers_info), nisplus_vers_info);
}






/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   callback protocol for NIS+
   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */

static int proto_nispluscb = -1;
static int hf_nispluscb_procedure_v1 = -1;
static int hf_nispluscb_entries = -1;
static int hf_nispluscb_entry = -1;

static gint ett_nispluscb = -1;
static gint ett_nispluscb_entry = -1;

static int
dissect_cb_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
	proto_item* lock_item = NULL;
	/* proto_tree* lock_tree = NULL; */
	int old_offset = offset;

	lock_item = proto_tree_add_item(tree, hf_nispluscb_entry,
			tvb, offset, -1, ENC_NA);

	/* lock_tree = proto_item_add_subtree(lock_item, ett_nispluscb_entry); */

/*XXXXX Not implemented yet*/

	proto_item_set_len(lock_item, offset-old_offset);
	return offset;
}

static int
dissect_cback_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	return dissect_rpc_array(tvb, pinfo, tree, 0,
			dissect_cb_entry, hf_nispluscb_entries);
}

/* proc number, "proc name", dissect_request, dissect_reply */
static const vsff cb1_proc[] = {
	{ CBPROC_NULL,			"NULL",
		dissect_rpc_void,	dissect_rpc_void },
	{ CBPROC_RECEIVE,		"RECEIVE",
		dissect_cback_data,	dissect_callback_result },
	{ CBPROC_FINISH,		"FINISH",
		dissect_rpc_void,	dissect_rpc_void },
	{ CBPROC_ERROR,			"ERROR",
		dissect_nisplus_error,	dissect_rpc_void },
	{	0,	NULL,	NULL,	NULL },
};
static const value_string nispluscb1_proc_vals[] = {
	{ CBPROC_NULL,		"NULL" },
	{ CBPROC_RECEIVE,	"RECEIVE" },
	{ CBPROC_FINISH,	"FINISH" },
	{ CBPROC_ERROR,		"ERROR" },
	{	0,	NULL }
};
static const rpc_prog_vers_info nispluscb_vers_info[] = {
	{ 1, cb1_proc, &hf_nispluscb_procedure_v1 },
};

void
proto_register_niscb(void)
{
	static hf_register_info hf[] = {
		{ &hf_nispluscb_procedure_v1, {
			"V1 Procedure", "nispluscb.procedure_v1", FT_UINT32, BASE_DEC,
			VALS(nispluscb1_proc_vals), 0, NULL, HFILL }},
		{ &hf_nispluscb_entries, {
			"entries", "nispluscb.entries", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Callback Entries", HFILL }},

		{ &hf_nispluscb_entry, {
			"entry", "nispluscb.entry", FT_NONE, BASE_NONE,
			NULL, 0, "NIS Callback Entry", HFILL }},

	};

	static gint *ett[] = {
		&ett_nispluscb,
		&ett_nispluscb_entry,
	};

	proto_nispluscb = proto_register_protocol("NIS+ Callback",
	    "NIS+ CB", "nispluscb");
	proto_register_field_array(proto_nispluscb, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
}

void
proto_reg_handoff_niscb(void)
{
	/* Register the protocol as RPC */
	rpc_init_prog(proto_nispluscb, CB_PROGRAM, ett_nispluscb,
	    G_N_ELEMENTS(nispluscb_vers_info), nispluscb_vers_info);
}

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