|
root / base / usr / src / uts / common / rpcsvc
rpcsvc Plain Text 3201 lines 83.5 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
# uts/common/rpcsvc/Makefile
#	This makefile installs system header files that go into
#	/usr/include/rpcsvc.
#
# include global definitions
include ../../../Makefile.master

# Protocol descriptions.  Alas, the NFS protocol cannot be expressed
# completely via rpcgen.  The NLM description should go here some day.
# Also, the v3 headers have been hacked so that they no longer
# quite reflect what goes over the wire.
IDMAP_PROT_X=	idmap_prot.x
RPCGEN_SRC=	sm_inter.x nsm_addr.x

# Hammerhead: autofs_prot.h, nlm_prot.h, idmap_prot.h are pre-generated
# and checked into the repo. rpcgen + GNU cpp truncates %#define output.
PREGENERATED_HDRS= autofs_prot.h nlm_prot.h idmap_prot.h

# Hammerhead: pre-generated (rpcgen + GNU cpp truncation bug)
# Headers are now committed source files, not derived.
DERIVED_HDRS=	$(RPCGEN_SRC:%.x=%.h)

ALLHDRS=	$(RPCGEN_SRC) $(DERIVED_HDRS) $(PREGENERATED_HDRS) \
		$(IDMAP_PROT_X) autofs_prot.x nlm_prot.x

ROOTDIRS=	$(ROOT)/usr/include/rpcsvc

ROOTHDRS=	$(ALLHDRS:%=$(ROOTDIRS)/%)

RPCGENFLAGS = -C
# Hammerhead: GNU Make target-specific syntax (was dmake :=)
idmap_prot.h: RPCGENFLAGS += -MN
nlm_prot.h: RPCGENFLAGS += -M
sm_inter.h: RPCGENFLAGS += -M
nsm_addr.h: RPCGENFLAGS += -M

$(ROOTDIRS)/%: %
	$(INS.file)

.KEEP_STATE:

# all_h permits derived headers to be built here in the uts source area
# for the kernel to reference, without going so far as to install them.
#
all_h: $(DERIVED_HDRS)

install_h: all_h $(ROOTDIRS) $(ROOTHDRS)

clean:
	@# Hammerhead: pre-generated files are permanent source, do not delete
	@true

clobber: clean

# Don't check rpcgen-derived files.
check:

$(ROOTDIRS):
	$(INS.dir)

# Hammerhead: pre-generated (rpcgen + GNU cpp truncation bug)
# %.h: %.x
#	$(RPCGEN) $(RPCGENFLAGS) -h $< -o $@
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _AUTOFS_PROT_H_RPCGEN
#define	_AUTOFS_PROT_H_RPCGEN

#include <rpc/rpc.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#include <sys/vfs.h>
#include <sys/dirent.h>
#include <sys/types.h>
#include <sys/types32.h>

#define xdr_dev_t xdr_u_int
#define xdr_bool_t xdr_bool

#define	AUTOFS_MAXPATHLEN 1024
#define	AUTOFS_MAXCOMPONENTLEN 255
#define	AUTOFS_MAXOPTSLEN 1024
#define	AUTOFS_DAEMONCOOKIE 100000

enum autofs_stat {
	AUTOFS_ACTION = 0,
	AUTOFS_DONE = 1
};
typedef enum autofs_stat autofs_stat;

enum autofs_action {
	AUTOFS_MOUNT_RQ = 0,
	AUTOFS_LINK_RQ = 1,
	AUTOFS_NONE = 2
};
typedef enum autofs_action autofs_action;

enum autofs_res {
	AUTOFS_OK = 0,
	AUTOFS_NOENT = 2,
	AUTOFS_ECOMM = 5,
	AUTOFS_NOMEM = 12,
	AUTOFS_NOTDIR = 20,
	AUTOFS_SHUTDOWN = 1000
};
typedef enum autofs_res autofs_res;

struct autofs_lookupargs {
	char *map;
	char *path;
	char *name;
	char *subdir;
	char *opts;
	bool_t isdirect;
	uid_t uid;
};
typedef struct autofs_lookupargs autofs_lookupargs;

struct linka {
	char *dir;
	char *link;
};
typedef struct linka linka;

struct autofs_args {
	struct netbuf addr;
	char *path;
	char *opts;
	char *map;
	char *subdir;
	char *key;
	int mount_to;
	int rpc_to;
	int direct;
};
typedef struct autofs_args autofs_args;
#ifdef _SYSCALL32
/*
 * This is an LP64 representation of the ILP32 autofs_args data structure
 * for use by autofs_mount which may receive the data structure "raw"
 * from a 32-bit program without being processed by XDR.  rpcgen doesn't
 * need to see this structure since RPC/XDR only deals with the "native"
 * version of autofs_args.  If this isn't hidden from rpcgen then it will
 * insist on generating unnecessary code to deal with it.
 */
struct autofs_args32 {
 struct netbuf32 addr; /* daemon address */
 caddr32_t path; /* autofs mountpoint */
 caddr32_t opts; /* default mount options */
 caddr32_t map; /* name of map */
 caddr32_t subdir; /* subdir within map */
 caddr32_t key; /* used in direct mounts */
 int32_t mount_to; /* time in sec the fs is to remain */
 /* mounted after last reference */
 int32_t rpc_to; /* timeout for rpc calls */
 int32_t direct; /* 1 = direct mount */
};
#endif /* _SYSCALL32 */

struct action_list_entry {
	autofs_action action;
	union {
		struct mounta mounta;
		struct linka linka;
	} action_list_entry_u;
};
typedef struct action_list_entry action_list_entry;

struct action_list {
	action_list_entry action;
	struct action_list *next;
};
typedef struct action_list action_list;

struct mount_result_type {
	autofs_stat status;
	union {
		action_list *list;
		int error;
	} mount_result_type_u;
};
typedef struct mount_result_type mount_result_type;

struct autofs_mountres {
	mount_result_type mr_type;
	int mr_verbose;
};
typedef struct autofs_mountres autofs_mountres;

struct lookup_result_type {
	autofs_action action;
	union {
		struct linka lt_linka;
	} lookup_result_type_u;
};
typedef struct lookup_result_type lookup_result_type;

struct autofs_lookupres {
	enum autofs_res lu_res;
	lookup_result_type lu_type;
	int lu_verbose;
};
typedef struct autofs_lookupres autofs_lookupres;

struct umntrequest {
	bool_t isdirect;
	char *mntresource;
	char *mntpnt;
	char *fstype;
	char *mntopts;
	struct umntrequest *next;
};
typedef struct umntrequest umntrequest;

struct umntres {
	int status;
};
typedef struct umntres umntres;

struct autofs_rddirargs {
	char *rda_map;
	u_int rda_offset;
	u_int rda_count;
	uid_t uid;
};
typedef struct autofs_rddirargs autofs_rddirargs;

struct autofsrddir {
	u_int rddir_offset;
	u_int rddir_size;
	bool_t rddir_eof;
	struct dirent64 *rddir_entries;
};
typedef struct autofsrddir autofsrddir;

struct autofs_rddirres {
	enum autofs_res rd_status;
	u_int rd_bufsize;
	struct autofsrddir rd_rddir;
};
typedef struct autofs_rddirres autofs_rddirres;

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_autofs_stat(XDR *, autofs_stat*);
extern  bool_t xdr_autofs_action(XDR *, autofs_action*);
extern  bool_t xdr_autofs_res(XDR *, autofs_res*);
extern  bool_t xdr_autofs_lookupargs(XDR *, autofs_lookupargs*);
extern  bool_t xdr_linka(XDR *, linka*);
extern  bool_t xdr_autofs_args(XDR *, autofs_args*);
extern  bool_t xdr_action_list_entry(XDR *, action_list_entry*);
extern  bool_t xdr_action_list(XDR *, action_list*);
extern  bool_t xdr_mount_result_type(XDR *, mount_result_type*);
extern  bool_t xdr_autofs_mountres(XDR *, autofs_mountres*);
extern  bool_t xdr_lookup_result_type(XDR *, lookup_result_type*);
extern  bool_t xdr_autofs_lookupres(XDR *, autofs_lookupres*);
extern  bool_t xdr_umntrequest(XDR *, umntrequest*);
extern  bool_t xdr_umntres(XDR *, umntres*);
extern  bool_t xdr_autofs_rddirargs(XDR *, autofs_rddirargs*);
extern  bool_t xdr_autofsrddir(XDR *, autofsrddir*);
extern  bool_t xdr_autofs_rddirres(XDR *, autofs_rddirres*);

#else /* K&R C */
extern bool_t xdr_autofs_stat();
extern bool_t xdr_autofs_action();
extern bool_t xdr_autofs_res();
extern bool_t xdr_autofs_lookupargs();
extern bool_t xdr_linka();
extern bool_t xdr_autofs_args();
extern bool_t xdr_action_list_entry();
extern bool_t xdr_action_list();
extern bool_t xdr_mount_result_type();
extern bool_t xdr_autofs_mountres();
extern bool_t xdr_lookup_result_type();
extern bool_t xdr_autofs_lookupres();
extern bool_t xdr_umntrequest();
extern bool_t xdr_umntres();
extern bool_t xdr_autofs_rddirargs();
extern bool_t xdr_autofsrddir();
extern bool_t xdr_autofs_rddirres();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_AUTOFS_PROT_H_RPCGEN */
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
%/*
% * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
% * Use is subject to license terms.
% */
%
%#include <sys/vfs.h>
%#include <sys/dirent.h>
%#include <sys/types.h>
%#include <sys/types32.h>
%
%#define	xdr_dev_t xdr_u_int
%#define	xdr_bool_t xdr_bool
%
/*
 * Autofs/automountd communication protocol.
 */

const AUTOFS_MAXPATHLEN		= 1024;
const AUTOFS_MAXCOMPONENTLEN	= 255;
const AUTOFS_MAXOPTSLEN		= 1024;
const AUTOFS_DAEMONCOOKIE	= 100000;

/*
 * Action Status
 * Automountd replies to autofs indicating whether the operation is done,
 * or further action needs to be taken by autofs.
 */
enum autofs_stat {
	AUTOFS_ACTION=0,	/* list of actions included */
	AUTOFS_DONE=1		/* no further action required by kernel */
};

/*
 * Used by autofs to either create a link, or mount a new filesystem.
 */
enum autofs_action {
	AUTOFS_MOUNT_RQ=0,	/* mount request */
	AUTOFS_LINK_RQ=1,	/* link create */
	AUTOFS_NONE=2		/* no action */
};

enum autofs_res {
	AUTOFS_OK=0,
	AUTOFS_NOENT=2,
	AUTOFS_ECOMM=5,
	AUTOFS_NOMEM=12,
	AUTOFS_NOTDIR=20,
	AUTOFS_SHUTDOWN=1000
};

/*
 * Lookup/Mount request.
 * Argument structure passed to both autofs_lookup() and autofs_mount().
 * autofs_lookup():
 *	Query automountd if 'path/subdir/name' exists in 'map'
 * autofs_mount():
 *	Request automountd to mount the map entry associated with
 *	'path/subdir/name' in 'map' given 'opts' options.
 */
struct autofs_lookupargs {
	string	map<AUTOFS_MAXPATHLEN>;		/* context or map name */
	string	path<AUTOFS_MAXPATHLEN>;	/* mountpoint */
	string	name<AUTOFS_MAXCOMPONENTLEN>;	/* entry we're looking for */
	string	subdir<AUTOFS_MAXPATHLEN>;	/* subdir within map */
	string	opts<AUTOFS_MAXOPTSLEN>;
	bool_t	isdirect;			/* direct mountpoint? */
	uid_t	uid;				/* uid of caller */
};

/*
 * Symbolic link information.
 */
struct linka {
	string	dir<AUTOFS_MAXPATHLEN>;		/* original name */
	string	link<AUTOFS_MAXPATHLEN>;	/* link (new) name */
};

/*
 * We don't define netbuf in RPCL, we include the header file that
 * includes it, and implement the xdr function ourselves.
 */

/*
 * Autofs Mount specific information - used to mount a new
 * autofs filesystem.
 */
struct autofs_args {
	struct netbuf	addr;		/* daemon address */
	string path<AUTOFS_MAXPATHLEN>;	/* autofs mountpoint */
	string opts<AUTOFS_MAXOPTSLEN>;	/* default mount options */
	string map<AUTOFS_MAXPATHLEN>;	/* name of map */
	string subdir<AUTOFS_MAXPATHLEN>; /* subdir within map */
	string key<AUTOFS_MAXCOMPONENTLEN>; /* used in direct mounts only */
	int		mount_to;	/* time in sec the fs is to remain */
					/* mounted after last reference */
	int		rpc_to;		/* timeout for rpc calls */
	int		direct;		/* 1 = direct mount */
};

%#ifdef _SYSCALL32
%/*
% * This is an LP64 representation of the ILP32 autofs_args data structure
% * for use by autofs_mount which may receive the data structure "raw"
% * from a 32-bit program without being processed by XDR.  rpcgen doesn't
% * need to see this structure since RPC/XDR only deals with the "native"
% * version of autofs_args.  If this isn't hidden from rpcgen then it will
% * insist on generating unnecessary code to deal with it.
% */
%struct autofs_args32 {
%	struct netbuf32	addr;		/* daemon address */
%	caddr32_t	path;		/* autofs mountpoint */
%	caddr32_t	opts;		/* default mount options */
%	caddr32_t	map;		/* name of map */
%	caddr32_t	subdir;		/* subdir within map */
%	caddr32_t	key;		/* used in direct mounts */
%	int32_t		mount_to;	/* time in sec the fs is to remain */
%					/* mounted after last reference */
%	int32_t		rpc_to;		/* timeout for rpc calls */
%	int32_t		direct;		/* 1 = direct mount */
%};
%#endif	/* _SYSCALL32 */

/*
 * Contains the necessary information to notify autofs to
 * perfom either a new mount or create a symbolic link.
 */
union action_list_entry switch (autofs_action action) {
case AUTOFS_MOUNT_RQ:
	struct mounta mounta;
case AUTOFS_LINK_RQ:
	struct linka linka;
default:
	void;
};

/*
 * List of actions that need to be performed by autofs to
 * finish the requested operation.
 */
struct action_list {
	action_list_entry action;
	action_list *next;
};

union mount_result_type switch (autofs_stat status) {
case AUTOFS_ACTION:
	action_list *list;
case AUTOFS_DONE:
	int error;
default:
	void;
};

/*
 * Result from mount operation.
 */
struct autofs_mountres {
	mount_result_type mr_type;
	int mr_verbose;
};

union lookup_result_type switch (autofs_action action) {
case AUTOFS_LINK_RQ:
	struct linka lt_linka;
case AUTOFS_MOUNT_RQ:
	void;
default:
	void;
};

/*
 * Result from lookup operation.
 */
struct autofs_lookupres {
	enum autofs_res lu_res;
	lookup_result_type lu_type;
	int lu_verbose;
};

/*
 * Unmount operation request
 * Automountd will issue unmount system call for the
 * given fstype on the given mntpnt.
 */

struct umntrequest {
	bool_t isdirect;			/* direct mount? */
	string mntresource<AUTOFS_MAXPATHLEN>;	/* mntpnt source */
	string mntpnt<AUTOFS_MAXPATHLEN>;	/* mntpnt to unmount */
	string fstype<AUTOFS_MAXCOMPONENTLEN>;	/* filesystem type to umount */
	string mntopts<AUTOFS_MAXOPTSLEN>;	/* mntpnt options */
	struct umntrequest *next;		/* next unmount */
};

/*
 * Unmount operation result
 * status = 0 if unmount was successful,
 * otherwise status = errno.
 */
struct umntres {
	int status;
};

/*
 * AUTOFS readdir request
 * Request list of entries in 'rda_map' map starting at the given
 * offset 'rda_offset', for 'rda_count' bytes.
 */
struct autofs_rddirargs {
	string	rda_map<AUTOFS_MAXPATHLEN>;
	u_int	rda_offset;		/* starting offset */
	u_int	rda_count;		/* total size requested */
	uid_t	uid;			/* uid of caller */
};

struct autofsrddir {
	u_int	rddir_offset;		/* last offset in list */
	u_int	rddir_size;		/* size in bytes of entries */
	bool_t	rddir_eof;		/* TRUE if last entry in result */
	struct dirent64 *rddir_entries;	/* variable number of entries */
};

/*
 * AUTOFS readdir result.
 */
struct autofs_rddirres {
	enum autofs_res rd_status;
	u_int rd_bufsize;		/* autofs request size (not xdr'ed) */
	struct autofsrddir rd_rddir;
};
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _IDMAP_PROT_H_RPCGEN
#define	_IDMAP_PROT_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#include <synch.h>
#include <thread.h>
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_KERNEL)
#include <sys/nvpair.h>
#else
#include <libnvpair.h>
#endif
typedef nvlist_t *nvlist_t_ptr;

typedef char *idmap_utf8str;

typedef struct {
	u_int idmap_utf8str_list_len;
	idmap_utf8str *idmap_utf8str_list_val;
} idmap_utf8str_list;

typedef int idmap_retcode;

enum idmap_id_type {
	IDMAP_NONE = 0,
	IDMAP_UID = 1,
	IDMAP_GID = 1 + 1,
	IDMAP_SID = 1 + 2,
	IDMAP_USID = 1 + 3,
	IDMAP_GSID = 1 + 4,
	IDMAP_POSIXID = 1 + 5
};
typedef enum idmap_id_type idmap_id_type;

enum idmap_map_type {
	IDMAP_MAP_TYPE_UNKNOWN = 0,
	IDMAP_MAP_TYPE_DS_AD = 0 + 1,
	IDMAP_MAP_TYPE_DS_NLDAP = 0 + 2,
	IDMAP_MAP_TYPE_RULE_BASED = 0 + 3,
	IDMAP_MAP_TYPE_EPHEMERAL = 0 + 4,
	IDMAP_MAP_TYPE_LOCAL_SID = 0 + 5,
	IDMAP_MAP_TYPE_KNOWN_SID = 0 + 6,
	IDMAP_MAP_TYPE_IDMU = 0 + 7
};
typedef enum idmap_map_type idmap_map_type;

enum idmap_map_src {
	IDMAP_MAP_SRC_UNKNOWN = 0,
	IDMAP_MAP_SRC_NEW = 0 + 1,
	IDMAP_MAP_SRC_CACHE = 0 + 2,
	IDMAP_MAP_SRC_HARD_CODED = 0 + 3,
	IDMAP_MAP_SRC_ALGORITHMIC = 0 + 4
};
typedef enum idmap_map_src idmap_map_src;

struct idmap_sid {
	char *prefix;
	uint32_t rid;
};
typedef struct idmap_sid idmap_sid;

struct idmap_id {
	idmap_id_type idtype;
	union {
		uint32_t uid;
		uint32_t gid;
		idmap_sid sid;
		idmap_sid usid;
		idmap_sid gsid;
	} idmap_id_u;
};
typedef struct idmap_id idmap_id;

struct idmap_namerule {
	bool_t is_user;
	bool_t is_wuser;
	int direction;
	idmap_utf8str windomain;
	idmap_utf8str winname;
	idmap_utf8str unixname;
	bool_t is_nt4;
};
typedef struct idmap_namerule idmap_namerule;

struct idmap_namerules_res {
	idmap_retcode retcode;
	uint64_t lastrowid;
	struct {
		u_int rules_len;
		idmap_namerule *rules_val;
	} rules;
};
typedef struct idmap_namerules_res idmap_namerules_res;

struct idmap_how_ds_based {
	idmap_utf8str dn;
	idmap_utf8str attr;
	idmap_utf8str value;
};
typedef struct idmap_how_ds_based idmap_how_ds_based;

struct idmap_how {
	idmap_map_type map_type;
	union {
		idmap_how_ds_based ad;
		idmap_how_ds_based nldap;
		idmap_namerule rule;
		idmap_how_ds_based idmu;
	} idmap_how_u;
};
typedef struct idmap_how idmap_how;

struct idmap_info {
	idmap_map_src src;
	idmap_how how;
	nvlist_t_ptr trace;
};
typedef struct idmap_info idmap_info;

struct idmap_id_res {
	idmap_retcode retcode;
	idmap_id id;
	int direction;
	idmap_info info;
};
typedef struct idmap_id_res idmap_id_res;

struct idmap_ids_res {
	idmap_retcode retcode;
	struct {
		u_int ids_len;
		idmap_id_res *ids_val;
	} ids;
};
typedef struct idmap_ids_res idmap_ids_res;
#define	IDMAP_REQ_FLG_NO_NEW_ID_ALLOC 0x00000001
#define	IDMAP_REQ_FLG_VALIDATE 0x00000002
#define	IDMAP_REQ_FLG_NO_NAMESERVICE 0x00000004
#define	IDMAP_REQ_FLG_MAPPING_INFO 0x00000008
#define	IDMAP_REQ_FLG_WK_OR_LOCAL_SIDS_ONLY 0x00000020
#define	IDMAP_REQ_FLG_TRACE 0x00000040
#define	IDMAP_DIRECTION_UNDEF -1
#define	IDMAP_DIRECTION_BI 0
#define	IDMAP_DIRECTION_W2U 1
#define	IDMAP_DIRECTION_U2W 2

struct idmap_mapping {
	int32_t flag;
	int direction;
	idmap_id id1;
	idmap_utf8str id1domain;
	idmap_utf8str id1name;
	idmap_id id2;
	idmap_utf8str id2domain;
	idmap_utf8str id2name;
	idmap_info info;
};
typedef struct idmap_mapping idmap_mapping;

typedef struct {
	u_int idmap_mapping_batch_len;
	idmap_mapping *idmap_mapping_batch_val;
} idmap_mapping_batch;

struct idmap_mappings_res {
	idmap_retcode retcode;
	uint64_t lastrowid;
	struct {
		u_int mappings_len;
		idmap_mapping *mappings_val;
	} mappings;
};
typedef struct idmap_mappings_res idmap_mappings_res;

struct idmap_update_res {
	idmap_retcode retcode;
	int64_t error_index;
	idmap_namerule error_rule;
	idmap_namerule conflict_rule;
};
typedef struct idmap_update_res idmap_update_res;

enum idmap_opnum {
	OP_NONE = 0,
	OP_ADD_NAMERULE = 1,
	OP_RM_NAMERULE = 2,
	OP_FLUSH_NAMERULES = 3
};
typedef enum idmap_opnum idmap_opnum;

struct idmap_update_op {
	idmap_opnum opnum;
	union {
		idmap_namerule rule;
	} idmap_update_op_u;
};
typedef struct idmap_update_op idmap_update_op;

typedef struct {
	u_int idmap_update_batch_len;
	idmap_update_op *idmap_update_batch_val;
} idmap_update_batch;
#define	AD_DISC_MAXHOSTNAME 256

struct idmap_ad_disc_ds_t {
	int port;
	int priority;
	int weight;
	char host[AD_DISC_MAXHOSTNAME];
};
typedef struct idmap_ad_disc_ds_t idmap_ad_disc_ds_t;

enum idmap_prop_type {
	PROP_UNKNOWN = 0,
	PROP_LIST_SIZE_LIMIT = 1,
	PROP_DEFAULT_DOMAIN = 2,
	PROP_DOMAIN_NAME = 3,
	PROP_MACHINE_SID = 4,
	PROP_DOMAIN_CONTROLLER = 5,
	PROP_FOREST_NAME = 6,
	PROP_SITE_NAME = 7,
	PROP_GLOBAL_CATALOG = 8,
	PROP_AD_UNIXUSER_ATTR = 9,
	PROP_AD_UNIXGROUP_ATTR = 10,
	PROP_NLDAP_WINNAME_ATTR = 11,
	PROP_DIRECTORY_BASED_MAPPING = 12
};
typedef enum idmap_prop_type idmap_prop_type;

struct idmap_prop_val {
	idmap_prop_type prop;
	union {
		uint64_t intval;
		idmap_utf8str utf8val;
		idmap_ad_disc_ds_t dsval;
	} idmap_prop_val_u;
};
typedef struct idmap_prop_val idmap_prop_val;

struct idmap_prop_res {
	idmap_retcode retcode;
	idmap_prop_val value;
	bool_t auto_discovered;
};
typedef struct idmap_prop_res idmap_prop_res;

enum idmap_flush_op {
	IDMAP_FLUSH_EXPIRE = 0,
	IDMAP_FLUSH_DELETE = 1
};
typedef enum idmap_flush_op idmap_flush_op;

struct directory_error_rpc {
	idmap_utf8str code;
	idmap_utf8str fmt;
	struct {
		u_int params_len;
		idmap_utf8str *params_val;
	} params;
};
typedef struct directory_error_rpc directory_error_rpc;

typedef struct {
	u_int directory_value_rpc_len;
	char *directory_value_rpc_val;
} directory_value_rpc;

struct directory_values_rpc {
	bool_t found;
	union {
		struct {
			u_int values_len;
			directory_value_rpc *values_val;
		} values;
	} directory_values_rpc_u;
};
typedef struct directory_values_rpc directory_values_rpc;

enum directory_lookup_status_rpc {
	DIRECTORY_NOT_FOUND = 0,
	DIRECTORY_FOUND = 1,
	DIRECTORY_ERROR = 2
};
typedef enum directory_lookup_status_rpc directory_lookup_status_rpc;

struct directory_entry_rpc {
	directory_lookup_status_rpc status;
	union {
		struct {
			u_int attrs_len;
			directory_values_rpc *attrs_val;
		} attrs;
		directory_error_rpc err;
	} directory_entry_rpc_u;
};
typedef struct directory_entry_rpc directory_entry_rpc;

struct directory_results_rpc {
	bool_t failed;
	union {
		directory_error_rpc err;
		struct {
			u_int entries_len;
			directory_entry_rpc *entries_val;
		} entries;
	} directory_results_rpc_u;
};
typedef struct directory_results_rpc directory_results_rpc;

struct idmap_list_mappings_1_argument {
	int64_t lastrowid;
	uint64_t limit;
	int32_t flag;
};
typedef struct idmap_list_mappings_1_argument idmap_list_mappings_1_argument;

struct idmap_list_namerules_1_argument {
	idmap_namerule rule;
	uint64_t lastrowid;
	uint64_t limit;
};
typedef struct idmap_list_namerules_1_argument idmap_list_namerules_1_argument;

struct directory_get_common_1_argument {
	idmap_utf8str_list ids;
	idmap_utf8str types;
	idmap_utf8str_list attrs;
};
typedef struct directory_get_common_1_argument directory_get_common_1_argument;

#define	IDMAP_PROG	100172
#define	IDMAP_V1	1

#if defined(__STDC__) || defined(__cplusplus)
#define	IDMAP_NULL	0
extern  enum clnt_stat idmap_null_1(void *, CLIENT *);
extern  bool_t idmap_null_1_svc(void *, struct svc_req *);
#define	IDMAP_GET_MAPPED_IDS	1
extern  enum clnt_stat idmap_get_mapped_ids_1(idmap_mapping_batch , idmap_ids_res *, CLIENT *);
extern  bool_t idmap_get_mapped_ids_1_svc(idmap_mapping_batch , idmap_ids_res *, struct svc_req *);
#define	IDMAP_LIST_MAPPINGS	2
extern  enum clnt_stat idmap_list_mappings_1(int64_t , uint64_t , int32_t , idmap_mappings_res *, CLIENT *);
extern  bool_t idmap_list_mappings_1_svc(int64_t , uint64_t , int32_t , idmap_mappings_res *, struct svc_req *);
#define	IDMAP_LIST_NAMERULES	3
extern  enum clnt_stat idmap_list_namerules_1(idmap_namerule , uint64_t , uint64_t , idmap_namerules_res *, CLIENT *);
extern  bool_t idmap_list_namerules_1_svc(idmap_namerule , uint64_t , uint64_t , idmap_namerules_res *, struct svc_req *);
#define	IDMAP_UPDATE	4
extern  enum clnt_stat idmap_update_1(idmap_update_batch , idmap_update_res *, CLIENT *);
extern  bool_t idmap_update_1_svc(idmap_update_batch , idmap_update_res *, struct svc_req *);
#define	IDMAP_GET_MAPPED_ID_BY_NAME	5
extern  enum clnt_stat idmap_get_mapped_id_by_name_1(idmap_mapping , idmap_mappings_res *, CLIENT *);
extern  bool_t idmap_get_mapped_id_by_name_1_svc(idmap_mapping , idmap_mappings_res *, struct svc_req *);
#define	IDMAP_GET_PROP	6
extern  enum clnt_stat idmap_get_prop_1(idmap_prop_type , idmap_prop_res *, CLIENT *);
extern  bool_t idmap_get_prop_1_svc(idmap_prop_type , idmap_prop_res *, struct svc_req *);
#define	DIRECTORY_GET_COMMON	7
extern  enum clnt_stat directory_get_common_1(idmap_utf8str_list , idmap_utf8str , idmap_utf8str_list , directory_results_rpc *, CLIENT *);
extern  bool_t directory_get_common_1_svc(idmap_utf8str_list , idmap_utf8str , idmap_utf8str_list , directory_results_rpc *, struct svc_req *);
#define	IDMAP_FLUSH	8
extern  enum clnt_stat idmap_flush_1(idmap_flush_op , idmap_retcode *, CLIENT *);
extern  bool_t idmap_flush_1_svc(idmap_flush_op , idmap_retcode *, struct svc_req *);
extern int idmap_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	IDMAP_NULL	0
extern  enum clnt_stat idmap_null_1();
extern  bool_t idmap_null_1_svc();
#define	IDMAP_GET_MAPPED_IDS	1
extern  enum clnt_stat idmap_get_mapped_ids_1();
extern  bool_t idmap_get_mapped_ids_1_svc();
#define	IDMAP_LIST_MAPPINGS	2
extern  enum clnt_stat idmap_list_mappings_1();
extern  bool_t idmap_list_mappings_1_svc();
#define	IDMAP_LIST_NAMERULES	3
extern  enum clnt_stat idmap_list_namerules_1();
extern  bool_t idmap_list_namerules_1_svc();
#define	IDMAP_UPDATE	4
extern  enum clnt_stat idmap_update_1();
extern  bool_t idmap_update_1_svc();
#define	IDMAP_GET_MAPPED_ID_BY_NAME	5
extern  enum clnt_stat idmap_get_mapped_id_by_name_1();
extern  bool_t idmap_get_mapped_id_by_name_1_svc();
#define	IDMAP_GET_PROP	6
extern  enum clnt_stat idmap_get_prop_1();
extern  bool_t idmap_get_prop_1_svc();
#define	DIRECTORY_GET_COMMON	7
extern  enum clnt_stat directory_get_common_1();
extern  bool_t directory_get_common_1_svc();
#define	IDMAP_FLUSH	8
extern  enum clnt_stat idmap_flush_1();
extern  bool_t idmap_flush_1_svc();
extern int idmap_prog_1_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_idmap_utf8str(XDR *, idmap_utf8str*);
extern  bool_t xdr_idmap_utf8str_list(XDR *, idmap_utf8str_list*);
extern  bool_t xdr_idmap_retcode(XDR *, idmap_retcode*);
extern  bool_t xdr_idmap_id_type(XDR *, idmap_id_type*);
extern  bool_t xdr_idmap_map_type(XDR *, idmap_map_type*);
extern  bool_t xdr_idmap_map_src(XDR *, idmap_map_src*);
extern  bool_t xdr_idmap_sid(XDR *, idmap_sid*);
extern  bool_t xdr_idmap_id(XDR *, idmap_id*);
extern  bool_t xdr_idmap_namerule(XDR *, idmap_namerule*);
extern  bool_t xdr_idmap_namerules_res(XDR *, idmap_namerules_res*);
extern  bool_t xdr_idmap_how_ds_based(XDR *, idmap_how_ds_based*);
extern  bool_t xdr_idmap_how(XDR *, idmap_how*);
extern  bool_t xdr_idmap_info(XDR *, idmap_info*);
extern  bool_t xdr_idmap_id_res(XDR *, idmap_id_res*);
extern  bool_t xdr_idmap_ids_res(XDR *, idmap_ids_res*);
extern  bool_t xdr_idmap_mapping(XDR *, idmap_mapping*);
extern  bool_t xdr_idmap_mapping_batch(XDR *, idmap_mapping_batch*);
extern  bool_t xdr_idmap_mappings_res(XDR *, idmap_mappings_res*);
extern  bool_t xdr_idmap_update_res(XDR *, idmap_update_res*);
extern  bool_t xdr_idmap_opnum(XDR *, idmap_opnum*);
extern  bool_t xdr_idmap_update_op(XDR *, idmap_update_op*);
extern  bool_t xdr_idmap_update_batch(XDR *, idmap_update_batch*);
extern  bool_t xdr_idmap_ad_disc_ds_t(XDR *, idmap_ad_disc_ds_t*);
extern  bool_t xdr_idmap_prop_type(XDR *, idmap_prop_type*);
extern  bool_t xdr_idmap_prop_val(XDR *, idmap_prop_val*);
extern  bool_t xdr_idmap_prop_res(XDR *, idmap_prop_res*);
extern  bool_t xdr_idmap_flush_op(XDR *, idmap_flush_op*);
extern  bool_t xdr_directory_error_rpc(XDR *, directory_error_rpc*);
extern  bool_t xdr_directory_value_rpc(XDR *, directory_value_rpc*);
extern  bool_t xdr_directory_values_rpc(XDR *, directory_values_rpc*);
extern  bool_t xdr_directory_lookup_status_rpc(XDR *, directory_lookup_status_rpc*);
extern  bool_t xdr_directory_entry_rpc(XDR *, directory_entry_rpc*);
extern  bool_t xdr_directory_results_rpc(XDR *, directory_results_rpc*);
extern  bool_t xdr_idmap_list_mappings_1_argument(XDR *, idmap_list_mappings_1_argument*);
extern  bool_t xdr_idmap_list_namerules_1_argument(XDR *, idmap_list_namerules_1_argument*);
extern  bool_t xdr_directory_get_common_1_argument(XDR *, directory_get_common_1_argument*);

#else /* K&R C */
extern bool_t xdr_idmap_utf8str();
extern bool_t xdr_idmap_utf8str_list();
extern bool_t xdr_idmap_retcode();
extern bool_t xdr_idmap_id_type();
extern bool_t xdr_idmap_map_type();
extern bool_t xdr_idmap_map_src();
extern bool_t xdr_idmap_sid();
extern bool_t xdr_idmap_id();
extern bool_t xdr_idmap_namerule();
extern bool_t xdr_idmap_namerules_res();
extern bool_t xdr_idmap_how_ds_based();
extern bool_t xdr_idmap_how();
extern bool_t xdr_idmap_info();
extern bool_t xdr_idmap_id_res();
extern bool_t xdr_idmap_ids_res();
extern bool_t xdr_idmap_mapping();
extern bool_t xdr_idmap_mapping_batch();
extern bool_t xdr_idmap_mappings_res();
extern bool_t xdr_idmap_update_res();
extern bool_t xdr_idmap_opnum();
extern bool_t xdr_idmap_update_op();
extern bool_t xdr_idmap_update_batch();
extern bool_t xdr_idmap_ad_disc_ds_t();
extern bool_t xdr_idmap_prop_type();
extern bool_t xdr_idmap_prop_val();
extern bool_t xdr_idmap_prop_res();
extern bool_t xdr_idmap_flush_op();
extern bool_t xdr_directory_error_rpc();
extern bool_t xdr_directory_value_rpc();
extern bool_t xdr_directory_values_rpc();
extern bool_t xdr_directory_lookup_status_rpc();
extern bool_t xdr_directory_entry_rpc();
extern bool_t xdr_directory_results_rpc();
extern bool_t xdr_idmap_list_mappings_1_argument();
extern bool_t xdr_idmap_list_namerules_1_argument();
extern bool_t xdr_directory_get_common_1_argument();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_IDMAP_PROT_H_RPCGEN */
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 */

%#if	defined(_KERNEL)
%#include <sys/nvpair.h>
%#else
%#include <libnvpair.h>
%#endif

/*
 * XDR support for nvlist_t.  libnvpair includes support for serializing
 * an nvlist, but does not include any direct XDR plug-in support.  Support
 * is made trickier by the fact that on read xdr_pointer() wants to allocate
 * structures on its own, even when there's a custom xdr_*() function for
 * the structure.  nvlist_unpack *also* wants to allocate the nvlist_t,
 * and it seems wrong to burn sizeof(nvlist_t) into the program binary.
 *
 * Another possibility is to use opaque<> in this declaration, but that
 * requires moving part of the encoding (the interaction with nvlist_pack
 * and nvlist_unpack) out into the application, instead of keeping it
 * all encapsulated in this layer.
 *
 * The resolution here is to put an nvlist_t * into a new typedef, and have
 * *that* typedef have a custom xdr_*() function.  xdr allocates space for
 * the pointer, but leaves all initialization of it nvlist_t *) to the
 * custom function.
 */
#if	defined(RPC_HDR)
%typedef nvlist_t *nvlist_t_ptr;
#endif

#if	defined(RPC_XDR)
%#if	!defined(_KERNEL)
%#include <string.h>
%#include <stdio.h>
%#endif
%
%bool_t
%xdr_nvlist_t_ptr(XDR *xdrs, nvlist_t_ptr *n)
%{
%	char *buf;
%	u_int len;
%	bool_t ret;
%	int err;
%	size_t	sz;
%	bool_t	present;
%
%	switch (xdrs->x_op) {
%	case XDR_DECODE:
%		if (!xdr_bool(xdrs, &present))
%			return (FALSE);
%		if (!present) {
%			*n = NULL;
%			return (TRUE);
%		}
%		buf = NULL;
%		if (!xdr_bytes(xdrs, &buf, &len, ~0))
%			return (FALSE);
%
%		err = nvlist_unpack(buf, (size_t)len, n, 0);
%#if	defined(_KERNEL)
%		kmem_free(buf, len);
%#else
%		free(buf);
%#endif
%
%		if (err != 0) {
%#if	!defined(_KERNEL)
%			fprintf(stderr, "xdr_nvlist_t unpack:  %s\n",
%			    strerror(err));
%#endif
%			return (FALSE);
%		}
%		return (TRUE);
%
%	case XDR_ENCODE:
%		present = (*n != NULL);
%		if (!xdr_bool(xdrs, &present))
%			return (FALSE);
%		if (!present)
%			return (TRUE);
%		buf = NULL;
%		err = nvlist_pack(*n, &buf, &sz, NV_ENCODE_XDR, 0);
%		if (err != 0) {
%#if	!defined(_KERNEL)
%			fprintf(stderr, "xdr_nvlist_t pack:  %s\n",
%			    strerror(err));
%#endif
%			return (FALSE);
%		}
%
%		/* nvlist_pack() and xdr_bytes() want different types */
%		len = (u_int) sz;
%
%		ret = xdr_bytes(xdrs, &buf, &len, ~0);
%#if	defined(_KERNEL)
%		kmem_free(buf, len);
%#else
%		free(buf);
%#endif
%
%		return (ret);
%
%	case XDR_FREE:
%		if (*n != NULL) {
%			nvlist_free(*n);
%			*n = NULL;
%		}
%		return (TRUE);
%
%	default:
%		return (FALSE);
%	}
%}
#endif

/* opaque type to support non-ASCII strings */
typedef	string	idmap_utf8str<>;
typedef	idmap_utf8str	idmap_utf8str_list<>;

/* Return status */
typedef int idmap_retcode;

/* Identity types */
enum idmap_id_type {
	IDMAP_NONE = 0,
	IDMAP_UID = 1,
	IDMAP_GID,
	IDMAP_SID,
	IDMAP_USID,
	IDMAP_GSID,
	IDMAP_POSIXID
};

/* The type of ID mapping */
enum idmap_map_type {
	IDMAP_MAP_TYPE_UNKNOWN = 0,
	IDMAP_MAP_TYPE_DS_AD,
	IDMAP_MAP_TYPE_DS_NLDAP,
	IDMAP_MAP_TYPE_RULE_BASED,
	IDMAP_MAP_TYPE_EPHEMERAL,
	IDMAP_MAP_TYPE_LOCAL_SID,
	IDMAP_MAP_TYPE_KNOWN_SID,
	IDMAP_MAP_TYPE_IDMU
};


/* Source of ID mapping */
enum idmap_map_src {
	IDMAP_MAP_SRC_UNKNOWN = 0,
	IDMAP_MAP_SRC_NEW,
	IDMAP_MAP_SRC_CACHE,
	IDMAP_MAP_SRC_HARD_CODED,
	IDMAP_MAP_SRC_ALGORITHMIC
};


/* SID */
struct idmap_sid {
	string		prefix<>;
	uint32_t	rid;
};

/* Identity (sid-posix) */
union idmap_id switch(idmap_id_type idtype) {
	case IDMAP_UID: uint32_t uid;
	case IDMAP_GID: uint32_t gid;
	case IDMAP_SID: idmap_sid sid;
	case IDMAP_USID: idmap_sid usid;
	case IDMAP_GSID: idmap_sid gsid;
	case IDMAP_NONE: void;
	case IDMAP_POSIXID: void;
};


/* Name-based mapping rules */
struct idmap_namerule {
	bool		is_user;
	bool		is_wuser;
	int		direction;
	idmap_utf8str	windomain;
	idmap_utf8str	winname;
	idmap_utf8str	unixname;
	bool		is_nt4;
};
struct idmap_namerules_res {
	idmap_retcode	retcode;
	uint64_t	lastrowid;
	idmap_namerule	rules<>;
};

/* How ID is mapped */ 
struct idmap_how_ds_based {
	idmap_utf8str	dn;
	idmap_utf8str	attr;
	idmap_utf8str	value;
};

union idmap_how switch(idmap_map_type map_type) {
	case IDMAP_MAP_TYPE_UNKNOWN: void;
	case IDMAP_MAP_TYPE_DS_AD: idmap_how_ds_based ad;
	case IDMAP_MAP_TYPE_DS_NLDAP: idmap_how_ds_based nldap;
	case IDMAP_MAP_TYPE_RULE_BASED: idmap_namerule rule;
	case IDMAP_MAP_TYPE_EPHEMERAL: void;
	case IDMAP_MAP_TYPE_LOCAL_SID: void;
	case IDMAP_MAP_TYPE_KNOWN_SID: void;
	case IDMAP_MAP_TYPE_IDMU: idmap_how_ds_based idmu;
};

struct idmap_info {
	idmap_map_src	src;
	idmap_how	how;
	nvlist_t_ptr	trace;
};


/* Id result */
struct idmap_id_res {
	idmap_retcode	retcode;
	idmap_id	id;
	int		direction;
	idmap_info	info;
};
struct idmap_ids_res {
	idmap_retcode	retcode;
	idmap_id_res	ids<>;
};


/*
 * Flag supported by mapping requests
 */

/* Don't allocate a new value for the mapping */
const IDMAP_REQ_FLG_NO_NEW_ID_ALLOC	= 0x00000001;

/* Validate the given identity before mapping */
const IDMAP_REQ_FLG_VALIDATE		= 0x00000002;

/* Avoid name service lookups to prevent looping */
const IDMAP_REQ_FLG_NO_NAMESERVICE	= 0x00000004;

/* Request how a mapping was formed */
const IDMAP_REQ_FLG_MAPPING_INFO	= 0x00000008;

/*
 * This libidmap only flag is defined in idmap.h
 * It enables use of the libidmap cache
 * const IDMAP_REQ_FLG_USE_CACHE	= 0x00000010;
 */

/* Request mapping for well-known or local SIDs only */
const IDMAP_REQ_FLG_WK_OR_LOCAL_SIDS_ONLY	= 0x00000020;

/* Request trace of mapping process */
const IDMAP_REQ_FLG_TRACE	= 0x00000040;


/*
 * Mapping direction definitions
 */
const IDMAP_DIRECTION_UNDEF =	-1;	/* not defined */
const IDMAP_DIRECTION_BI =	0;	/* bi-directional */
const IDMAP_DIRECTION_W2U =	1;	/* windows to unix only */
const IDMAP_DIRECTION_U2W =	2;	/* unix to windows only */


/* Identity mappings (sid-posix) */
struct idmap_mapping {
	int32_t		flag;
	int		direction;
	idmap_id	id1;
	idmap_utf8str	id1domain;
	idmap_utf8str	id1name;
	idmap_id	id2;
	idmap_utf8str	id2domain;
	idmap_utf8str	id2name;
	idmap_info	info;
};

typedef idmap_mapping	idmap_mapping_batch<>;

#ifndef IDMAP_XDR_MAPPING_ONLY
struct idmap_mappings_res {
	idmap_retcode		retcode;
	uint64_t		lastrowid;
	idmap_mapping		mappings<>;
};


/* Update result */
struct idmap_update_res {
	idmap_retcode	retcode;
	int64_t	error_index;
	idmap_namerule	error_rule;
	idmap_namerule	conflict_rule;
};

/* Update requests */
enum idmap_opnum {
	OP_NONE = 0,
	OP_ADD_NAMERULE = 1,
	OP_RM_NAMERULE = 2,
	OP_FLUSH_NAMERULES = 3
};
union idmap_update_op switch(idmap_opnum opnum) {
	case OP_ADD_NAMERULE:
	case OP_RM_NAMERULE:
		idmap_namerule rule;
	default:
		void;
};
typedef idmap_update_op idmap_update_batch<>;

const AD_DISC_MAXHOSTNAME = 256;

struct idmap_ad_disc_ds_t {
	int	port;
	int	priority;
	int	weight;
	char	host[AD_DISC_MAXHOSTNAME];
};


/* get-prop, set-prop */
enum idmap_prop_type {
	PROP_UNKNOWN = 0,
	PROP_LIST_SIZE_LIMIT = 1,
	PROP_DEFAULT_DOMAIN = 2,	/* default domain name */
	PROP_DOMAIN_NAME = 3,		/* AD domain name */
	PROP_MACHINE_SID = 4,		/* machine sid */
	PROP_DOMAIN_CONTROLLER = 5,	/* domain controller hosts */
	PROP_FOREST_NAME = 6,		/* forest name */
	PROP_SITE_NAME = 7,		/* site name */
	PROP_GLOBAL_CATALOG = 8,	/* global catalog hosts */
	PROP_AD_UNIXUSER_ATTR = 9,
	PROP_AD_UNIXGROUP_ATTR = 10,
	PROP_NLDAP_WINNAME_ATTR = 11,
	PROP_DIRECTORY_BASED_MAPPING = 12
};

union idmap_prop_val switch(idmap_prop_type prop) {
	case PROP_LIST_SIZE_LIMIT:
		uint64_t intval;
	case PROP_DEFAULT_DOMAIN:
	case PROP_DOMAIN_NAME:
	case PROP_MACHINE_SID:
	case PROP_FOREST_NAME:
	case PROP_SITE_NAME:
	case PROP_AD_UNIXUSER_ATTR:
	case PROP_AD_UNIXGROUP_ATTR:
	case PROP_NLDAP_WINNAME_ATTR:
	case PROP_DIRECTORY_BASED_MAPPING:
		idmap_utf8str utf8val;
	case PROP_DOMAIN_CONTROLLER:
	case PROP_GLOBAL_CATALOG:
		idmap_ad_disc_ds_t dsval;
	default:
		void;
};

struct idmap_prop_res {
	idmap_retcode	retcode;
	idmap_prop_val	value;
	bool		auto_discovered;
};

enum idmap_flush_op {
	IDMAP_FLUSH_EXPIRE = 0,
	IDMAP_FLUSH_DELETE = 1
};

/*
 * Represents an error from the directory lookup service.
 *
 * code is an ASCII string that is a key for the error.  It is not
 * localized.
 *
 * fmt is a format string with %n markers for where to include
 * params[n-1].  It should be, but NEEDSWORK is not localized to
 * the caller's locale.
 *
 * params is a list of parameters for the error - e.g. the name that
 * encountered a failure, the server that reported the failure, et cetera.
 * The values are to be used both as marked in fmt and for machine
 * interpretation of the error.
 */
struct directory_error_rpc {
	idmap_utf8str	code;
	idmap_utf8str	fmt;
	idmap_utf8str	params<>;
};

/*
 * One value of a multivalued attribute.
 */
typedef opaque			directory_value_rpc<>;

/*
 * The value of an attribute, if found.  Note that this is a list
 * of directory_value_rpc objects, to support multivalued attributes.
 */
union directory_values_rpc switch (bool found) {
	case TRUE:
		directory_value_rpc values<>;
	case FALSE:
		void;
};

/*
 * The status of the lookup for any particular identifier.
 */
enum directory_lookup_status_rpc {
	DIRECTORY_NOT_FOUND = 0,
	DIRECTORY_FOUND = 1,
	DIRECTORY_ERROR = 2
};

/*
 * This is the data returned for a particular identifier, either a
 * list of attribute values or an error.
 */
union directory_entry_rpc switch (directory_lookup_status_rpc status) {
	case DIRECTORY_NOT_FOUND:
		void;
	case DIRECTORY_FOUND:
		directory_values_rpc attrs<>;
	case DIRECTORY_ERROR:
		directory_error_rpc err;
};

/*
 * This is the result from a request, either a list of the entries for
 * the identifiers specified, or an error.
 */
union directory_results_rpc switch (bool failed) {
	case TRUE:
		directory_error_rpc	err;
	case FALSE:
		directory_entry_rpc	entries<>;
};
#endif	/* IDMAP_XDR_MAPPING_ONLY */

program IDMAP_PROG {
	version IDMAP_V1 {
#ifndef	IDMAP_XDR_MAPPING_ONLY
		void
		IDMAP_NULL(void) = 0;
#endif	/* IDMAP_XDR_MAPPING_ONLY */

		/* Batch of requests to get mapped identities */
		idmap_ids_res
		IDMAP_GET_MAPPED_IDS(idmap_mapping_batch batch) = 1;

#ifndef	IDMAP_XDR_MAPPING_ONLY
		/* List all identity mappings */
		idmap_mappings_res
		IDMAP_LIST_MAPPINGS(int64_t lastrowid,
			uint64_t limit, int32_t flag) = 2;

		/* List all name-based mapping rules */
		idmap_namerules_res
		IDMAP_LIST_NAMERULES(idmap_namerule rule,
			uint64_t lastrowid, uint64_t limit) = 3;

		/* Batch of update requests */
		idmap_update_res
		IDMAP_UPDATE(idmap_update_batch batch) = 4;

		/* Get mapped identity by name */
		idmap_mappings_res
		IDMAP_GET_MAPPED_ID_BY_NAME(idmap_mapping request) = 5;

		/* Get configuration property */
		idmap_prop_res
		IDMAP_GET_PROP(idmap_prop_type) = 6;

		/*
		 * Retrieve directory information about a list of users
		 * or groups by name or SID.
		 *
		 * ids is a list of user names, group names, or SIDs.
		 *
		 * types is a list of types of the ids in the id list.
		 * If the type list is shorter than the id list, the last
		 * type listed applies to all of the ids from that point.
		 * The defined types are:
		 *     'n' - name (could be user or group)
		 *     'u' - user
		 *     'g' - group
		 *     's' - SID
		 *
		 * attrs is a list of attribute names to retrieve.
		 */
		directory_results_rpc DIRECTORY_GET_COMMON(
			idmap_utf8str_list ids,
			idmap_utf8str types,
			idmap_utf8str_list attrs) = 7;

		idmap_retcode
		IDMAP_FLUSH(idmap_flush_op) = 8;
#endif	/* IDMAP_XDR_MAPPING_ONLY */
	} = 1;
} = 100172;
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _NLM_PROT_H_RPCGEN
#define	_NLM_PROT_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#include <synch.h>
#include <thread.h>
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif


#include <rpc/rpc_sztypes.h>

#define LM_MAXSTRLEN 1024
#define LM_MAXNAMELEN (LM_MAXSTRLEN + 1)

enum nlm_stats {
	nlm_granted = 0,
	nlm_denied = 1,
	nlm_denied_nolocks = 2,
	nlm_blocked = 3,
	nlm_denied_grace_period = 4,
	nlm_deadlck = 5
};
typedef enum nlm_stats nlm_stats;

struct nlm_holder {
	bool_t exclusive;
	int svid;
	netobj oh;
	u_int l_offset;
	u_int l_len;
};
typedef struct nlm_holder nlm_holder;

struct nlm_testrply {
	nlm_stats stat;
	union {
		struct nlm_holder holder;
	} nlm_testrply_u;
};
typedef struct nlm_testrply nlm_testrply;

struct nlm_stat {
	nlm_stats stat;
};
typedef struct nlm_stat nlm_stat;

struct nlm_res {
	netobj cookie;
	nlm_stat stat;
};
typedef struct nlm_res nlm_res;

struct nlm_testres {
	netobj cookie;
	nlm_testrply stat;
};
typedef struct nlm_testres nlm_testres;

struct nlm_lock {
	char *caller_name;
	netobj fh;
	netobj oh;
	int svid;
	u_int l_offset;
	u_int l_len;
};
typedef struct nlm_lock nlm_lock;

struct nlm_lockargs {
	netobj cookie;
	bool_t block;
	bool_t exclusive;
	struct nlm_lock alock;
	bool_t reclaim;
	int state;
};
typedef struct nlm_lockargs nlm_lockargs;

struct nlm_cancargs {
	netobj cookie;
	bool_t block;
	bool_t exclusive;
	struct nlm_lock alock;
};
typedef struct nlm_cancargs nlm_cancargs;

struct nlm_testargs {
	netobj cookie;
	bool_t exclusive;
	struct nlm_lock alock;
};
typedef struct nlm_testargs nlm_testargs;

struct nlm_unlockargs {
	netobj cookie;
	struct nlm_lock alock;
};
typedef struct nlm_unlockargs nlm_unlockargs;
/*
 * The following enums are actually bit encoded for efficient
 * boolean algebra.... DON'T change them.....
 * The mixed-case enums violate the present style guide, but we're
 * stuck with 'em.
 */

enum fsh_mode {
	fsm_DN = 0,
	fsm_DR = 1,
	fsm_DW = 2,
	fsm_DRW = 3
};
typedef enum fsh_mode fsh_mode;

enum fsh_access {
	fsa_NONE = 0,
	fsa_R = 1,
	fsa_W = 2,
	fsa_RW = 3
};
typedef enum fsh_access fsh_access;

struct nlm_share {
	char *caller_name;
	netobj fh;
	netobj oh;
	fsh_mode mode;
	fsh_access access;
};
typedef struct nlm_share nlm_share;

struct nlm_shareargs {
	netobj cookie;
	nlm_share share;
	bool_t reclaim;
};
typedef struct nlm_shareargs nlm_shareargs;

struct nlm_shareres {
	netobj cookie;
	nlm_stats stat;
	int sequence;
};
typedef struct nlm_shareres nlm_shareres;

struct nlm_notify {
	char *name;
	int state;
};
typedef struct nlm_notify nlm_notify;

enum nlm4_stats {
	nlm4_granted = 0,
	nlm4_denied = 1,
	nlm4_denied_nolocks = 2,
	nlm4_blocked = 3,
	nlm4_denied_grace_period = 4,
	nlm4_deadlck = 5,
	nlm4_rofs = 6,
	nlm4_stale_fh = 7,
	nlm4_fbig = 8,
	nlm4_failed = 9
};
typedef enum nlm4_stats nlm4_stats;

struct nlm4_holder {
	bool_t exclusive;
	int32 svid;
	netobj oh;
	uint64 l_offset;
	uint64 l_len;
};
typedef struct nlm4_holder nlm4_holder;

struct nlm4_testrply {
	nlm4_stats stat;
	union {
		struct nlm4_holder holder;
	} nlm4_testrply_u;
};
typedef struct nlm4_testrply nlm4_testrply;

struct nlm4_stat {
	nlm4_stats stat;
};
typedef struct nlm4_stat nlm4_stat;

struct nlm4_res {
	netobj cookie;
	nlm4_stat stat;
};
typedef struct nlm4_res nlm4_res;

struct nlm4_testres {
	netobj cookie;
	nlm4_testrply stat;
};
typedef struct nlm4_testres nlm4_testres;

struct nlm4_lock {
	char *caller_name;
	netobj fh;
	netobj oh;
	int32 svid;
	uint64 l_offset;
	uint64 l_len;
};
typedef struct nlm4_lock nlm4_lock;

struct nlm4_lockargs {
	netobj cookie;
	bool_t block;
	bool_t exclusive;
	struct nlm4_lock alock;
	bool_t reclaim;
	int32 state;
};
typedef struct nlm4_lockargs nlm4_lockargs;

struct nlm4_cancargs {
	netobj cookie;
	bool_t block;
	bool_t exclusive;
	struct nlm4_lock alock;
};
typedef struct nlm4_cancargs nlm4_cancargs;

struct nlm4_testargs {
	netobj cookie;
	bool_t exclusive;
	struct nlm4_lock alock;
};
typedef struct nlm4_testargs nlm4_testargs;

struct nlm4_unlockargs {
	netobj cookie;
	struct nlm4_lock alock;
};
typedef struct nlm4_unlockargs nlm4_unlockargs;

struct nlm4_share {
	char *caller_name;
	netobj fh;
	netobj oh;
	fsh_mode mode;
	fsh_access access;
};
typedef struct nlm4_share nlm4_share;

struct nlm4_shareargs {
	netobj cookie;
	nlm4_share share;
	bool_t reclaim;
};
typedef struct nlm4_shareargs nlm4_shareargs;

struct nlm4_shareres {
	netobj cookie;
	nlm4_stats stat;
	int32 sequence;
};
typedef struct nlm4_shareres nlm4_shareres;

struct nlm4_notify {
	char *name;
	int32 state;
};
typedef struct nlm4_notify nlm4_notify;

struct nlm_sm_status {
	char *mon_name;
	int32 state;
	char priv[16];
};
typedef struct nlm_sm_status nlm_sm_status;

#define	NLM_PROG	100021
#define	NLM_VERS	1

#if defined(__STDC__) || defined(__cplusplus)
#define	NLM_NULL	0
extern  enum clnt_stat nlm_null_1(void *, void *, CLIENT *);
extern  bool_t nlm_null_1_svc(void *, void *, struct svc_req *);
#define	NLM_TEST	1
extern  enum clnt_stat nlm_test_1(nlm_testargs *, nlm_testres *, CLIENT *);
extern  bool_t nlm_test_1_svc(nlm_testargs *, nlm_testres *, struct svc_req *);
#define	NLM_LOCK	2
extern  enum clnt_stat nlm_lock_1(nlm_lockargs *, nlm_res *, CLIENT *);
extern  bool_t nlm_lock_1_svc(nlm_lockargs *, nlm_res *, struct svc_req *);
#define	NLM_CANCEL	3
extern  enum clnt_stat nlm_cancel_1(nlm_cancargs *, nlm_res *, CLIENT *);
extern  bool_t nlm_cancel_1_svc(nlm_cancargs *, nlm_res *, struct svc_req *);
#define	NLM_UNLOCK	4
extern  enum clnt_stat nlm_unlock_1(nlm_unlockargs *, nlm_res *, CLIENT *);
extern  bool_t nlm_unlock_1_svc(nlm_unlockargs *, nlm_res *, struct svc_req *);
#define	NLM_GRANTED	5
extern  enum clnt_stat nlm_granted_1(nlm_testargs *, nlm_res *, CLIENT *);
extern  bool_t nlm_granted_1_svc(nlm_testargs *, nlm_res *, struct svc_req *);
#define	NLM_TEST_MSG	6
extern  enum clnt_stat nlm_test_msg_1(nlm_testargs *, void *, CLIENT *);
extern  bool_t nlm_test_msg_1_svc(nlm_testargs *, void *, struct svc_req *);
#define	NLM_LOCK_MSG	7
extern  enum clnt_stat nlm_lock_msg_1(nlm_lockargs *, void *, CLIENT *);
extern  bool_t nlm_lock_msg_1_svc(nlm_lockargs *, void *, struct svc_req *);
#define	NLM_CANCEL_MSG	8
extern  enum clnt_stat nlm_cancel_msg_1(nlm_cancargs *, void *, CLIENT *);
extern  bool_t nlm_cancel_msg_1_svc(nlm_cancargs *, void *, struct svc_req *);
#define	NLM_UNLOCK_MSG	9
extern  enum clnt_stat nlm_unlock_msg_1(nlm_unlockargs *, void *, CLIENT *);
extern  bool_t nlm_unlock_msg_1_svc(nlm_unlockargs *, void *, struct svc_req *);
#define	NLM_GRANTED_MSG	10
extern  enum clnt_stat nlm_granted_msg_1(nlm_testargs *, void *, CLIENT *);
extern  bool_t nlm_granted_msg_1_svc(nlm_testargs *, void *, struct svc_req *);
#define	NLM_TEST_RES	11
extern  enum clnt_stat nlm_test_res_1(nlm_testres *, void *, CLIENT *);
extern  bool_t nlm_test_res_1_svc(nlm_testres *, void *, struct svc_req *);
#define	NLM_LOCK_RES	12
extern  enum clnt_stat nlm_lock_res_1(nlm_res *, void *, CLIENT *);
extern  bool_t nlm_lock_res_1_svc(nlm_res *, void *, struct svc_req *);
#define	NLM_CANCEL_RES	13
extern  enum clnt_stat nlm_cancel_res_1(nlm_res *, void *, CLIENT *);
extern  bool_t nlm_cancel_res_1_svc(nlm_res *, void *, struct svc_req *);
#define	NLM_UNLOCK_RES	14
extern  enum clnt_stat nlm_unlock_res_1(nlm_res *, void *, CLIENT *);
extern  bool_t nlm_unlock_res_1_svc(nlm_res *, void *, struct svc_req *);
#define	NLM_GRANTED_RES	15
extern  enum clnt_stat nlm_granted_res_1(nlm_res *, void *, CLIENT *);
extern  bool_t nlm_granted_res_1_svc(nlm_res *, void *, struct svc_req *);
extern int nlm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	NLM_NULL	0
extern  enum clnt_stat nlm_null_1();
extern  bool_t nlm_null_1_svc();
#define	NLM_TEST	1
extern  enum clnt_stat nlm_test_1();
extern  bool_t nlm_test_1_svc();
#define	NLM_LOCK	2
extern  enum clnt_stat nlm_lock_1();
extern  bool_t nlm_lock_1_svc();
#define	NLM_CANCEL	3
extern  enum clnt_stat nlm_cancel_1();
extern  bool_t nlm_cancel_1_svc();
#define	NLM_UNLOCK	4
extern  enum clnt_stat nlm_unlock_1();
extern  bool_t nlm_unlock_1_svc();
#define	NLM_GRANTED	5
extern  enum clnt_stat nlm_granted_1();
extern  bool_t nlm_granted_1_svc();
#define	NLM_TEST_MSG	6
extern  enum clnt_stat nlm_test_msg_1();
extern  bool_t nlm_test_msg_1_svc();
#define	NLM_LOCK_MSG	7
extern  enum clnt_stat nlm_lock_msg_1();
extern  bool_t nlm_lock_msg_1_svc();
#define	NLM_CANCEL_MSG	8
extern  enum clnt_stat nlm_cancel_msg_1();
extern  bool_t nlm_cancel_msg_1_svc();
#define	NLM_UNLOCK_MSG	9
extern  enum clnt_stat nlm_unlock_msg_1();
extern  bool_t nlm_unlock_msg_1_svc();
#define	NLM_GRANTED_MSG	10
extern  enum clnt_stat nlm_granted_msg_1();
extern  bool_t nlm_granted_msg_1_svc();
#define	NLM_TEST_RES	11
extern  enum clnt_stat nlm_test_res_1();
extern  bool_t nlm_test_res_1_svc();
#define	NLM_LOCK_RES	12
extern  enum clnt_stat nlm_lock_res_1();
extern  bool_t nlm_lock_res_1_svc();
#define	NLM_CANCEL_RES	13
extern  enum clnt_stat nlm_cancel_res_1();
extern  bool_t nlm_cancel_res_1_svc();
#define	NLM_UNLOCK_RES	14
extern  enum clnt_stat nlm_unlock_res_1();
extern  bool_t nlm_unlock_res_1_svc();
#define	NLM_GRANTED_RES	15
extern  enum clnt_stat nlm_granted_res_1();
extern  bool_t nlm_granted_res_1_svc();
extern int nlm_prog_1_freeresult();
#endif /* K&R C */
#define	NLM_SM	2

#if defined(__STDC__) || defined(__cplusplus)
#define	NLM_SM_NOTIFY1	17
extern  enum clnt_stat nlm_sm_notify1_2(struct nlm_sm_status *, void *, CLIENT *);
extern  bool_t nlm_sm_notify1_2_svc(struct nlm_sm_status *, void *, struct svc_req *);
#define	NLM_SM_NOTIFY2	18
extern  enum clnt_stat nlm_sm_notify2_2(struct nlm_sm_status *, void *, CLIENT *);
extern  bool_t nlm_sm_notify2_2_svc(struct nlm_sm_status *, void *, struct svc_req *);
extern int nlm_prog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	NLM_SM_NOTIFY1	17
extern  enum clnt_stat nlm_sm_notify1_2();
extern  bool_t nlm_sm_notify1_2_svc();
#define	NLM_SM_NOTIFY2	18
extern  enum clnt_stat nlm_sm_notify2_2();
extern  bool_t nlm_sm_notify2_2_svc();
extern int nlm_prog_2_freeresult();
#endif /* K&R C */
#define	NLM_VERSX	3

#if defined(__STDC__) || defined(__cplusplus)
#define	NLM_SHARE	20
extern  enum clnt_stat nlm_share_3(nlm_shareargs *, nlm_shareres *, CLIENT *);
extern  bool_t nlm_share_3_svc(nlm_shareargs *, nlm_shareres *, struct svc_req *);
#define	NLM_UNSHARE	21
extern  enum clnt_stat nlm_unshare_3(nlm_shareargs *, nlm_shareres *, CLIENT *);
extern  bool_t nlm_unshare_3_svc(nlm_shareargs *, nlm_shareres *, struct svc_req *);
#define	NLM_NM_LOCK	22
extern  enum clnt_stat nlm_nm_lock_3(nlm_lockargs *, nlm_res *, CLIENT *);
extern  bool_t nlm_nm_lock_3_svc(nlm_lockargs *, nlm_res *, struct svc_req *);
#define	NLM_FREE_ALL	23
extern  enum clnt_stat nlm_free_all_3(nlm_notify *, void *, CLIENT *);
extern  bool_t nlm_free_all_3_svc(nlm_notify *, void *, struct svc_req *);
extern int nlm_prog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	NLM_SHARE	20
extern  enum clnt_stat nlm_share_3();
extern  bool_t nlm_share_3_svc();
#define	NLM_UNSHARE	21
extern  enum clnt_stat nlm_unshare_3();
extern  bool_t nlm_unshare_3_svc();
#define	NLM_NM_LOCK	22
extern  enum clnt_stat nlm_nm_lock_3();
extern  bool_t nlm_nm_lock_3_svc();
#define	NLM_FREE_ALL	23
extern  enum clnt_stat nlm_free_all_3();
extern  bool_t nlm_free_all_3_svc();
extern int nlm_prog_3_freeresult();
#endif /* K&R C */
#define	NLM4_VERS	4

#if defined(__STDC__) || defined(__cplusplus)
#define	NLM4_NULL	0
extern  enum clnt_stat nlm4_null_4(void *, void *, CLIENT *);
extern  bool_t nlm4_null_4_svc(void *, void *, struct svc_req *);
#define	NLM4_TEST	1
extern  enum clnt_stat nlm4_test_4(nlm4_testargs *, nlm4_testres *, CLIENT *);
extern  bool_t nlm4_test_4_svc(nlm4_testargs *, nlm4_testres *, struct svc_req *);
#define	NLM4_LOCK	2
extern  enum clnt_stat nlm4_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *);
extern  bool_t nlm4_lock_4_svc(nlm4_lockargs *, nlm4_res *, struct svc_req *);
#define	NLM4_CANCEL	3
extern  enum clnt_stat nlm4_cancel_4(nlm4_cancargs *, nlm4_res *, CLIENT *);
extern  bool_t nlm4_cancel_4_svc(nlm4_cancargs *, nlm4_res *, struct svc_req *);
#define	NLM4_UNLOCK	4
extern  enum clnt_stat nlm4_unlock_4(nlm4_unlockargs *, nlm4_res *, CLIENT *);
extern  bool_t nlm4_unlock_4_svc(nlm4_unlockargs *, nlm4_res *, struct svc_req *);
#define	NLM4_GRANTED	5
extern  enum clnt_stat nlm4_granted_4(nlm4_testargs *, nlm4_res *, CLIENT *);
extern  bool_t nlm4_granted_4_svc(nlm4_testargs *, nlm4_res *, struct svc_req *);
#define	NLM4_TEST_MSG	6
extern  enum clnt_stat nlm4_test_msg_4(nlm4_testargs *, void *, CLIENT *);
extern  bool_t nlm4_test_msg_4_svc(nlm4_testargs *, void *, struct svc_req *);
#define	NLM4_LOCK_MSG	7
extern  enum clnt_stat nlm4_lock_msg_4(nlm4_lockargs *, void *, CLIENT *);
extern  bool_t nlm4_lock_msg_4_svc(nlm4_lockargs *, void *, struct svc_req *);
#define	NLM4_CANCEL_MSG	8
extern  enum clnt_stat nlm4_cancel_msg_4(nlm4_cancargs *, void *, CLIENT *);
extern  bool_t nlm4_cancel_msg_4_svc(nlm4_cancargs *, void *, struct svc_req *);
#define	NLM4_UNLOCK_MSG	9
extern  enum clnt_stat nlm4_unlock_msg_4(nlm4_unlockargs *, void *, CLIENT *);
extern  bool_t nlm4_unlock_msg_4_svc(nlm4_unlockargs *, void *, struct svc_req *);
#define	NLM4_GRANTED_MSG	10
extern  enum clnt_stat nlm4_granted_msg_4(nlm4_testargs *, void *, CLIENT *);
extern  bool_t nlm4_granted_msg_4_svc(nlm4_testargs *, void *, struct svc_req *);
#define	NLM4_TEST_RES	11
extern  enum clnt_stat nlm4_test_res_4(nlm4_testres *, void *, CLIENT *);
extern  bool_t nlm4_test_res_4_svc(nlm4_testres *, void *, struct svc_req *);
#define	NLM4_LOCK_RES	12
extern  enum clnt_stat nlm4_lock_res_4(nlm4_res *, void *, CLIENT *);
extern  bool_t nlm4_lock_res_4_svc(nlm4_res *, void *, struct svc_req *);
#define	NLM4_CANCEL_RES	13
extern  enum clnt_stat nlm4_cancel_res_4(nlm4_res *, void *, CLIENT *);
extern  bool_t nlm4_cancel_res_4_svc(nlm4_res *, void *, struct svc_req *);
#define	NLM4_UNLOCK_RES	14
extern  enum clnt_stat nlm4_unlock_res_4(nlm4_res *, void *, CLIENT *);
extern  bool_t nlm4_unlock_res_4_svc(nlm4_res *, void *, struct svc_req *);
#define	NLM4_GRANTED_RES	15
extern  enum clnt_stat nlm4_granted_res_4(nlm4_res *, void *, CLIENT *);
extern  bool_t nlm4_granted_res_4_svc(nlm4_res *, void *, struct svc_req *);
#define	NLM4_SHARE	20
extern  enum clnt_stat nlm4_share_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *);
extern  bool_t nlm4_share_4_svc(nlm4_shareargs *, nlm4_shareres *, struct svc_req *);
#define	NLM4_UNSHARE	21
extern  enum clnt_stat nlm4_unshare_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *);
extern  bool_t nlm4_unshare_4_svc(nlm4_shareargs *, nlm4_shareres *, struct svc_req *);
#define	NLM4_NM_LOCK	22
extern  enum clnt_stat nlm4_nm_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *);
extern  bool_t nlm4_nm_lock_4_svc(nlm4_lockargs *, nlm4_res *, struct svc_req *);
#define	NLM4_FREE_ALL	23
extern  enum clnt_stat nlm4_free_all_4(nlm4_notify *, void *, CLIENT *);
extern  bool_t nlm4_free_all_4_svc(nlm4_notify *, void *, struct svc_req *);
extern int nlm_prog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	NLM4_NULL	0
extern  enum clnt_stat nlm4_null_4();
extern  bool_t nlm4_null_4_svc();
#define	NLM4_TEST	1
extern  enum clnt_stat nlm4_test_4();
extern  bool_t nlm4_test_4_svc();
#define	NLM4_LOCK	2
extern  enum clnt_stat nlm4_lock_4();
extern  bool_t nlm4_lock_4_svc();
#define	NLM4_CANCEL	3
extern  enum clnt_stat nlm4_cancel_4();
extern  bool_t nlm4_cancel_4_svc();
#define	NLM4_UNLOCK	4
extern  enum clnt_stat nlm4_unlock_4();
extern  bool_t nlm4_unlock_4_svc();
#define	NLM4_GRANTED	5
extern  enum clnt_stat nlm4_granted_4();
extern  bool_t nlm4_granted_4_svc();
#define	NLM4_TEST_MSG	6
extern  enum clnt_stat nlm4_test_msg_4();
extern  bool_t nlm4_test_msg_4_svc();
#define	NLM4_LOCK_MSG	7
extern  enum clnt_stat nlm4_lock_msg_4();
extern  bool_t nlm4_lock_msg_4_svc();
#define	NLM4_CANCEL_MSG	8
extern  enum clnt_stat nlm4_cancel_msg_4();
extern  bool_t nlm4_cancel_msg_4_svc();
#define	NLM4_UNLOCK_MSG	9
extern  enum clnt_stat nlm4_unlock_msg_4();
extern  bool_t nlm4_unlock_msg_4_svc();
#define	NLM4_GRANTED_MSG	10
extern  enum clnt_stat nlm4_granted_msg_4();
extern  bool_t nlm4_granted_msg_4_svc();
#define	NLM4_TEST_RES	11
extern  enum clnt_stat nlm4_test_res_4();
extern  bool_t nlm4_test_res_4_svc();
#define	NLM4_LOCK_RES	12
extern  enum clnt_stat nlm4_lock_res_4();
extern  bool_t nlm4_lock_res_4_svc();
#define	NLM4_CANCEL_RES	13
extern  enum clnt_stat nlm4_cancel_res_4();
extern  bool_t nlm4_cancel_res_4_svc();
#define	NLM4_UNLOCK_RES	14
extern  enum clnt_stat nlm4_unlock_res_4();
extern  bool_t nlm4_unlock_res_4_svc();
#define	NLM4_GRANTED_RES	15
extern  enum clnt_stat nlm4_granted_res_4();
extern  bool_t nlm4_granted_res_4_svc();
#define	NLM4_SHARE	20
extern  enum clnt_stat nlm4_share_4();
extern  bool_t nlm4_share_4_svc();
#define	NLM4_UNSHARE	21
extern  enum clnt_stat nlm4_unshare_4();
extern  bool_t nlm4_unshare_4_svc();
#define	NLM4_NM_LOCK	22
extern  enum clnt_stat nlm4_nm_lock_4();
extern  bool_t nlm4_nm_lock_4_svc();
#define	NLM4_FREE_ALL	23
extern  enum clnt_stat nlm4_free_all_4();
extern  bool_t nlm4_free_all_4_svc();
extern int nlm_prog_4_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_nlm_stats(XDR *, nlm_stats*);
extern  bool_t xdr_nlm_holder(XDR *, nlm_holder*);
extern  bool_t xdr_nlm_testrply(XDR *, nlm_testrply*);
extern  bool_t xdr_nlm_stat(XDR *, nlm_stat*);
extern  bool_t xdr_nlm_res(XDR *, nlm_res*);
extern  bool_t xdr_nlm_testres(XDR *, nlm_testres*);
extern  bool_t xdr_nlm_lock(XDR *, nlm_lock*);
extern  bool_t xdr_nlm_lockargs(XDR *, nlm_lockargs*);
extern  bool_t xdr_nlm_cancargs(XDR *, nlm_cancargs*);
extern  bool_t xdr_nlm_testargs(XDR *, nlm_testargs*);
extern  bool_t xdr_nlm_unlockargs(XDR *, nlm_unlockargs*);
extern  bool_t xdr_fsh_mode(XDR *, fsh_mode*);
extern  bool_t xdr_fsh_access(XDR *, fsh_access*);
extern  bool_t xdr_nlm_share(XDR *, nlm_share*);
extern  bool_t xdr_nlm_shareargs(XDR *, nlm_shareargs*);
extern  bool_t xdr_nlm_shareres(XDR *, nlm_shareres*);
extern  bool_t xdr_nlm_notify(XDR *, nlm_notify*);
extern  bool_t xdr_nlm4_stats(XDR *, nlm4_stats*);
extern  bool_t xdr_nlm4_holder(XDR *, nlm4_holder*);
extern  bool_t xdr_nlm4_testrply(XDR *, nlm4_testrply*);
extern  bool_t xdr_nlm4_stat(XDR *, nlm4_stat*);
extern  bool_t xdr_nlm4_res(XDR *, nlm4_res*);
extern  bool_t xdr_nlm4_testres(XDR *, nlm4_testres*);
extern  bool_t xdr_nlm4_lock(XDR *, nlm4_lock*);
extern  bool_t xdr_nlm4_lockargs(XDR *, nlm4_lockargs*);
extern  bool_t xdr_nlm4_cancargs(XDR *, nlm4_cancargs*);
extern  bool_t xdr_nlm4_testargs(XDR *, nlm4_testargs*);
extern  bool_t xdr_nlm4_unlockargs(XDR *, nlm4_unlockargs*);
extern  bool_t xdr_nlm4_share(XDR *, nlm4_share*);
extern  bool_t xdr_nlm4_shareargs(XDR *, nlm4_shareargs*);
extern  bool_t xdr_nlm4_shareres(XDR *, nlm4_shareres*);
extern  bool_t xdr_nlm4_notify(XDR *, nlm4_notify*);
extern  bool_t xdr_nlm_sm_status(XDR *, nlm_sm_status*);

#else /* K&R C */
extern bool_t xdr_nlm_stats();
extern bool_t xdr_nlm_holder();
extern bool_t xdr_nlm_testrply();
extern bool_t xdr_nlm_stat();
extern bool_t xdr_nlm_res();
extern bool_t xdr_nlm_testres();
extern bool_t xdr_nlm_lock();
extern bool_t xdr_nlm_lockargs();
extern bool_t xdr_nlm_cancargs();
extern bool_t xdr_nlm_testargs();
extern bool_t xdr_nlm_unlockargs();
extern bool_t xdr_fsh_mode();
extern bool_t xdr_fsh_access();
extern bool_t xdr_nlm_share();
extern bool_t xdr_nlm_shareargs();
extern bool_t xdr_nlm_shareres();
extern bool_t xdr_nlm_notify();
extern bool_t xdr_nlm4_stats();
extern bool_t xdr_nlm4_holder();
extern bool_t xdr_nlm4_testrply();
extern bool_t xdr_nlm4_stat();
extern bool_t xdr_nlm4_res();
extern bool_t xdr_nlm4_testres();
extern bool_t xdr_nlm4_lock();
extern bool_t xdr_nlm4_lockargs();
extern bool_t xdr_nlm4_cancargs();
extern bool_t xdr_nlm4_testargs();
extern bool_t xdr_nlm4_unlockargs();
extern bool_t xdr_nlm4_share();
extern bool_t xdr_nlm4_shareargs();
extern bool_t xdr_nlm4_shareres();
extern bool_t xdr_nlm4_notify();
extern bool_t xdr_nlm_sm_status();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_NLM_PROT_H_RPCGEN */
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (C) 1986, 1992, 1993, 1997, 1999 by Sun Microsystems, Inc.
 * All rights reserved.
 *
 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
 *
 * Protocol used between local lock manager and remote lock manager.
 *
 * There are currently 3 versions of the protocol in use.  Versions 1
 * and 3 are used with NFS version 2.  Version 4 is used with NFS
 * version 3.
 *
 * (Note: there is also a version 2, but it defines an orthogonal set of
 * procedures that the status monitor uses to notify the lock manager of
 * changes in monitored systems.)
 */

#if RPC_HDR
%
%#include <rpc/rpc_sztypes.h>
%
#endif

#ifdef RPC_HDR
%#define LM_MAXSTRLEN	1024
%#define LM_MAXNAMELEN	(LM_MAXSTRLEN + 1)
#endif

/*
 * Types for versions 1 and 3.
 */

/*
 * Status of a call to the lock manager.  The lower case enums violate the
 * current style guide, but we're stuck with 'em.
 */

enum nlm_stats {
	nlm_granted = 0,
	nlm_denied = 1,
	nlm_denied_nolocks = 2,
	nlm_blocked = 3,
	nlm_denied_grace_period = 4,
	nlm_deadlck = 5
};

/*
 * The holder of a conflicting lock.
 */

struct nlm_holder {
	bool exclusive;
	int svid;
	netobj oh;
	unsigned l_offset;
	unsigned l_len;
};

union nlm_testrply switch (nlm_stats stat) {
	case nlm_denied:
		struct nlm_holder holder;
	default:
		void;
};

struct nlm_stat {
	nlm_stats stat;
};

struct nlm_res {
	netobj cookie;
	nlm_stat stat;
};

struct nlm_testres {
	netobj cookie;
	nlm_testrply stat;
};

struct nlm_lock {
	string caller_name<LM_MAXSTRLEN>;
	netobj fh;		/* identify a file */
	netobj oh;		/* identify owner of a lock */
	int svid;		/* generated from pid for svid */
	unsigned l_offset;
	unsigned l_len;
};

struct nlm_lockargs {
	netobj cookie;
	bool block;
	bool exclusive;
	struct nlm_lock alock;
	bool reclaim;		/* used for recovering locks */
	int state;		/* specify local status monitor state */
};

struct nlm_cancargs {
	netobj cookie;
	bool block;
	bool exclusive;
	struct nlm_lock alock;
};

struct nlm_testargs {
	netobj cookie;
	bool exclusive;
	struct nlm_lock alock;
};

struct nlm_unlockargs {
	netobj cookie;
	struct nlm_lock alock;
};

#ifdef RPC_HDR
%/*
% * The following enums are actually bit encoded for efficient
% * boolean algebra.... DON'T change them.....
% * The mixed-case enums violate the present style guide, but we're
% * stuck with 'em.
% */
#endif

enum	fsh_mode {
	fsm_DN  = 0,	/* deny none */
	fsm_DR  = 1,	/* deny read */
	fsm_DW  = 2,	/* deny write */
	fsm_DRW = 3	/* deny read/write */
};

enum	fsh_access {
	fsa_NONE = 0,	/* for completeness */
	fsa_R    = 1,	/* read only */
	fsa_W    = 2,	/* write only */
	fsa_RW   = 3	/* read/write */
};

struct	nlm_share {
	string caller_name<LM_MAXSTRLEN>;
	netobj	fh;
	netobj	oh;
	fsh_mode	mode;
	fsh_access	access;
};

struct	nlm_shareargs {
	netobj	cookie;
	nlm_share	share;
	bool	reclaim;
};

struct	nlm_shareres {
	netobj	cookie;
	nlm_stats	stat;
	int	sequence;
};

struct	nlm_notify {
	string name<LM_MAXNAMELEN>;
	int state;
};

/*
 * Types for version 4.
 *
 * This revision is designed to work with NFS V3.  The main changes from
 * NFS V2 to V3 that affect the NLM protocol are that all file offsets
 * and sizes are now unsigned 64-bit ints, and file handles are now
 * variable length.  In NLM V1 and V3, the fixed-length V2 file handle
 * was encoded as a 'netobj', which is a count followed by the data
 * bytes.  For NLM 4, the file handle is already a count followed by
 * data bytes, so the handle is copied directly into the netobj, rather
 * than being encoded with an additional byte count.
 */

/*
 * Status of a call to the lock manager.
 */

enum nlm4_stats {
	nlm4_granted = 0,		/* lock was granted */
	nlm4_denied = 1,		/* lock was not granted, usually */
					/* due to conflicting lock */
	nlm4_denied_nolocks = 2,	/* not granted: out of resources */
	nlm4_blocked = 3,		/* not granted: expect callback */
					/* when granted */
	nlm4_denied_grace_period = 4,	/* not granted: server is */
					/* reestablishing old locks */
	nlm4_deadlck = 5,		/* not granted: deadlock detected */
	nlm4_rofs = 6,			/* not granted: read-only filesystem */
	nlm4_stale_fh = 7,		/* not granted: stale file handle */
	nlm4_fbig = 8,			/* not granted: offset or length */
					/* too big */
	nlm4_failed = 9			/* not granted: some other error */
};

/*
 * The holder of a conflicting lock.
 */

struct nlm4_holder {
	bool exclusive;
	int32 svid;
	netobj oh;
	uint64 l_offset;
	uint64 l_len;
};

union nlm4_testrply switch (nlm4_stats stat) {
	case nlm4_denied:
		struct nlm4_holder holder;
	default:
		void;
};

struct nlm4_stat {
	nlm4_stats stat;
};

struct nlm4_res {
	netobj cookie;
	nlm4_stat stat;
};

struct nlm4_testres {
	netobj cookie;
	nlm4_testrply stat;
};

struct nlm4_lock {
	string caller_name<LM_MAXSTRLEN>;
	netobj fh;		/* identify a file */
	netobj oh;		/* identify owner of a lock */
	int32 svid;		/* generated from pid for svid */
	uint64 l_offset;
	uint64 l_len;
};

struct nlm4_lockargs {
	netobj cookie;
	bool block;
	bool exclusive;
	struct nlm4_lock alock;
	bool reclaim;		/* used for recovering locks */
	int32 state;		/* specify local status monitor state */
};

struct nlm4_cancargs {
	netobj cookie;
	bool block;
	bool exclusive;
	struct nlm4_lock alock;
};

struct nlm4_testargs {
	netobj cookie;
	bool exclusive;
	struct nlm4_lock alock;
};

struct nlm4_unlockargs {
	netobj cookie;
	struct nlm4_lock alock;
};

struct	nlm4_share {
	string caller_name<LM_MAXSTRLEN>;
	netobj	fh;
	netobj	oh;
	fsh_mode	mode;
	fsh_access	access;
};

struct	nlm4_shareargs {
	netobj	cookie;
	nlm4_share	share;
	bool	reclaim;
};

struct	nlm4_shareres {
	netobj	cookie;
	nlm4_stats	stat;
	int32	sequence;
};

struct	nlm4_notify {
	string name<LM_MAXNAMELEN>;
	int32 state;
};

/*
 * Argument for the NLM call-back procedure called by rpc.statd
 * when a monitored host status changes.  The statd calls the
 * NLM prog,vers,proc specified in the SM_MON call.
 * NB: This struct must exactly match sm_inter.x:sm_status
 * and requires LM_MAXSTRLEN == SM_MAXSTRLEN
 */
struct nlm_sm_status {
	string mon_name<LM_MAXSTRLEN>; /* name of host */
	int32 state;			/* new state */
	opaque priv[16];		/* private data */
};

/*
 * Over-the-wire protocol used between the network lock managers
 */

program NLM_PROG {

	version NLM_VERS {

		void
			NLM_NULL(void) =			0;

		nlm_testres
			NLM_TEST(nlm_testargs) =		1;

		nlm_res
			NLM_LOCK(nlm_lockargs) =		2;

		nlm_res
			NLM_CANCEL(nlm_cancargs) =		3;

		nlm_res
			NLM_UNLOCK(nlm_unlockargs) =		4;
		/*
		 * remote lock manager call-back to grant lock
		 */
		nlm_res
			NLM_GRANTED(nlm_testargs) =		5;

		/*
		 * message passing style of requesting lock
		 */

		void
			NLM_TEST_MSG(nlm_testargs) =		6;
		void
			NLM_LOCK_MSG(nlm_lockargs) =		7;
		void
			NLM_CANCEL_MSG(nlm_cancargs) =		8;
		void
			NLM_UNLOCK_MSG(nlm_unlockargs) =	9;
		void
			NLM_GRANTED_MSG(nlm_testargs) =		10;
		void
			NLM_TEST_RES(nlm_testres) =		11;
		void
			NLM_LOCK_RES(nlm_res) =			12;
		void
			NLM_CANCEL_RES(nlm_res) =		13;
		void
			NLM_UNLOCK_RES(nlm_res) =		14;
		void
			NLM_GRANTED_RES(nlm_res) =		15;
	} = 1;

	/*
	 * Private (loopback-only) call-backs from statd,
	 * used to notify that some machine has restarted.
	 * The meaning of these is up to the lock manager
	 * implemenation.  (See the SM_MON calls.)
	 */
	version NLM_SM {
		void NLM_SM_NOTIFY1(struct nlm_sm_status) =	17;
		void NLM_SM_NOTIFY2(struct nlm_sm_status) =	18;
	} = 2;

	version NLM_VERSX {
		nlm_shareres
			NLM_SHARE(nlm_shareargs) =		20;
		nlm_shareres
			NLM_UNSHARE(nlm_shareargs) =		21;
		nlm_res
			NLM_NM_LOCK(nlm_lockargs) =		22;
		void
			NLM_FREE_ALL(nlm_notify) =		23;
	} = 3;

	version NLM4_VERS {
		void
			NLM4_NULL(void) =			0;
		nlm4_testres
			NLM4_TEST(nlm4_testargs) =		1;
		nlm4_res
			NLM4_LOCK(nlm4_lockargs) =		2;
		nlm4_res
			NLM4_CANCEL(nlm4_cancargs) =	3;
		nlm4_res
			NLM4_UNLOCK(nlm4_unlockargs) =	4;
		/*
		 * remote lock manager call-back to grant lock
		 */
		nlm4_res
			NLM4_GRANTED(nlm4_testargs) =	5;

		/*
		 * message passing style of requesting lock
		 */

		void
			NLM4_TEST_MSG(nlm4_testargs) =	6;
		void
			NLM4_LOCK_MSG(nlm4_lockargs) =	7;
		void
			NLM4_CANCEL_MSG(nlm4_cancargs) =	8;
		void
			NLM4_UNLOCK_MSG(nlm4_unlockargs) =	9;
		void
			NLM4_GRANTED_MSG(nlm4_testargs) =	10;
		void
			NLM4_TEST_RES(nlm4_testres) =	11;
		void
			NLM4_LOCK_RES(nlm4_res) =		12;
		void
			NLM4_CANCEL_RES(nlm4_res) =		13;
		void
			NLM4_UNLOCK_RES(nlm4_res) =		14;
		void
			NLM4_GRANTED_RES(nlm4_res) =	15;

		/*
		 * DOS-style file sharing
		 */

		nlm4_shareres
			NLM4_SHARE(nlm4_shareargs) =	20;
		nlm4_shareres
			NLM4_UNSHARE(nlm4_shareargs) =	21;
		nlm4_res
			NLM4_NM_LOCK(nlm4_lockargs) =	22;
		void
			NLM4_FREE_ALL(nlm4_notify) =	23;
	} = 4;

} = 100021;
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _NSM_ADDR_H_RPCGEN
#define	_NSM_ADDR_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#include <synch.h>
#include <thread.h>
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 *
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/* from nsm_addr.x */

/*
 * This is the definition for the REG procedure which is used
 * to register name/address pairs with statd.
 */


enum nsm_addr_res {
	nsm_addr_succ = 0,
	nsm_addr_fail = 1
};
typedef enum nsm_addr_res nsm_addr_res;

struct reg1args {
	u_int family;
	char *name;
	netobj address;
};
typedef struct reg1args reg1args;

struct reg1res {
	nsm_addr_res status;
};
typedef struct reg1res reg1res;

/*
 * This is the definition for the UNREG procedure which is used
 * to unregister an address (and its associated name, if that name
 * has no other addresses registered with it) with statd.
 */

struct unreg1args {
	u_int family;
	char *name;
	netobj address;
};
typedef struct unreg1args unreg1args;

struct unreg1res {
	nsm_addr_res status;
};
typedef struct unreg1res unreg1res;

/*
 * This is the definition for the NSM address registration network
 * protocol which is used to privately support address registration
 * with the status daemon statd (NSM).
 */

#define	NSM_ADDR_PROGRAM	100133
#define	NSM_ADDR_V1	1

#if defined(__STDC__) || defined(__cplusplus)
#define	NSMADDRPROC1_NULL	0
extern  enum clnt_stat nsmaddrproc1_null_1(void *, void *, CLIENT *);
extern  bool_t nsmaddrproc1_null_1_svc(void *, void *, struct svc_req *);
#define	NSMADDRPROC1_REG	1
extern  enum clnt_stat nsmaddrproc1_reg_1(reg1args *, reg1res *, CLIENT *);
extern  bool_t nsmaddrproc1_reg_1_svc(reg1args *, reg1res *, struct svc_req *);
#define	NSMADDRPROC1_UNREG	2
extern  enum clnt_stat nsmaddrproc1_unreg_1(unreg1args *, unreg1res *, CLIENT *);
extern  bool_t nsmaddrproc1_unreg_1_svc(unreg1args *, unreg1res *, struct svc_req *);
extern int nsm_addr_program_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	NSMADDRPROC1_NULL	0
extern  enum clnt_stat nsmaddrproc1_null_1();
extern  bool_t nsmaddrproc1_null_1_svc();
#define	NSMADDRPROC1_REG	1
extern  enum clnt_stat nsmaddrproc1_reg_1();
extern  bool_t nsmaddrproc1_reg_1_svc();
#define	NSMADDRPROC1_UNREG	2
extern  enum clnt_stat nsmaddrproc1_unreg_1();
extern  bool_t nsmaddrproc1_unreg_1_svc();
extern int nsm_addr_program_1_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_nsm_addr_res(XDR *, nsm_addr_res*);
extern  bool_t xdr_reg1args(XDR *, reg1args*);
extern  bool_t xdr_reg1res(XDR *, reg1res*);
extern  bool_t xdr_unreg1args(XDR *, unreg1args*);
extern  bool_t xdr_unreg1res(XDR *, unreg1res*);

#else /* K&R C */
extern bool_t xdr_nsm_addr_res();
extern bool_t xdr_reg1args();
extern bool_t xdr_reg1res();
extern bool_t xdr_unreg1args();
extern bool_t xdr_unreg1res();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_NSM_ADDR_H_RPCGEN */
%/*
% * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
% * Use is subject to license terms.
% *
% * CDDL HEADER START
% *
% * The contents of this file are subject to the terms of the
% * Common Development and Distribution License, Version 1.0 only
% * (the "License").  You may not use this file except in compliance
% * with the License.
% *
% * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
% * or http://www.opensolaris.org/os/licensing.
% * See the License for the specific language governing permissions
% * and limitations under the License.
% *
% * When distributing Covered Code, include this CDDL HEADER in each
% * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
% * If applicable, add the following below this CDDL HEADER, with the
% * fields enclosed by brackets "[]" replaced with your own identifying
% * information: Portions Copyright [yyyy] [name of copyright owner]
% *
% * CDDL HEADER END
% */
%
%/* from nsm_addr.x */
%
%/*
% * This is the definition for the REG procedure which is used
% * to register name/address pairs with statd.
% */
%
enum nsm_addr_res {
	nsm_addr_succ = 0,		/* simple success/failure result */
	nsm_addr_fail = 1
};

struct reg1args {
	unsigned int family;		/* address families from socket.h */
	string name<1024>;		/* name to register with this addr */
	netobj address;
};

struct reg1res {
	nsm_addr_res status;
};
%
%/*
% * This is the definition for the UNREG procedure which is used
% * to unregister an address (and its associated name, if that name
% * has no other addresses registered with it) with statd.
% */
struct unreg1args {
	unsigned int family;		/* address families from socket.h */
	string name<1024>;		/* name under this addr to unregister */
	netobj address;
};

struct unreg1res {
	nsm_addr_res status;
};

%
%/*
% * This is the definition for the NSM address registration network
% * protocol which is used to privately support address registration
% * with the status daemon statd (NSM).
% */
program NSM_ADDR_PROGRAM {
	version NSM_ADDR_V1 {
		void
		 NSMADDRPROC1_NULL(void) = 0;
		reg1res
		 NSMADDRPROC1_REG(reg1args) = 1;
		unreg1res
		 NSMADDRPROC1_UNREG(unreg1args) = 2;
	} = 1;
} = 100133;
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _SM_INTER_H_RPCGEN
#define	_SM_INTER_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#include <synch.h>
#include <thread.h>
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Copyright (c) 1986, 1994 by Sun Microsystems, Inc.
 * All rights reserved.
 */
/* from sm_inter.x */
#define	SM_MAXSTRLEN 1024

struct sm_name {
	char *mon_name;
};
typedef struct sm_name sm_name;

struct my_id {
	char *my_name;
	int my_prog;
	int my_vers;
	int my_proc;
};
typedef struct my_id my_id;

struct mon_id {
	char *mon_name;
	struct my_id my_id;
};
typedef struct mon_id mon_id;

struct mon {
	struct mon_id mon_id;
	char priv[16];
};
typedef struct mon mon;

struct sm_stat {
	int state;
};
typedef struct sm_stat sm_stat;

enum sm_res {
	stat_succ = 0,
	stat_fail = 1
};
typedef enum sm_res sm_res;

struct sm_stat_res {
	sm_res res_stat;
	int state;
};
typedef struct sm_stat_res sm_stat_res;

struct sm_status {
	char *mon_name;
	int state;
	char priv[16];
};
typedef struct sm_status sm_status;

struct stat_chge {
	char *mon_name;
	int state;
};
typedef struct stat_chge stat_chge;

#define	SM_PROG	100024
#define	SM_VERS	1

#if defined(__STDC__) || defined(__cplusplus)
#define	SM_STAT	1
extern  enum clnt_stat sm_stat_1(struct sm_name *, struct sm_stat_res *, CLIENT *);
extern  bool_t sm_stat_1_svc(struct sm_name *, struct sm_stat_res *, struct svc_req *);
#define	SM_MON	2
extern  enum clnt_stat sm_mon_1(struct mon *, struct sm_stat_res *, CLIENT *);
extern  bool_t sm_mon_1_svc(struct mon *, struct sm_stat_res *, struct svc_req *);
#define	SM_UNMON	3
extern  enum clnt_stat sm_unmon_1(struct mon_id *, struct sm_stat *, CLIENT *);
extern  bool_t sm_unmon_1_svc(struct mon_id *, struct sm_stat *, struct svc_req *);
#define	SM_UNMON_ALL	4
extern  enum clnt_stat sm_unmon_all_1(struct my_id *, struct sm_stat *, CLIENT *);
extern  bool_t sm_unmon_all_1_svc(struct my_id *, struct sm_stat *, struct svc_req *);
#define	SM_SIMU_CRASH	5
extern  enum clnt_stat sm_simu_crash_1(void *, void *, CLIENT *);
extern  bool_t sm_simu_crash_1_svc(void *, void *, struct svc_req *);
#define	SM_NOTIFY	6
extern  enum clnt_stat sm_notify_1(struct stat_chge *, void *, CLIENT *);
extern  bool_t sm_notify_1_svc(struct stat_chge *, void *, struct svc_req *);
extern int sm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	SM_STAT	1
extern  enum clnt_stat sm_stat_1();
extern  bool_t sm_stat_1_svc();
#define	SM_MON	2
extern  enum clnt_stat sm_mon_1();
extern  bool_t sm_mon_1_svc();
#define	SM_UNMON	3
extern  enum clnt_stat sm_unmon_1();
extern  bool_t sm_unmon_1_svc();
#define	SM_UNMON_ALL	4
extern  enum clnt_stat sm_unmon_all_1();
extern  bool_t sm_unmon_all_1_svc();
#define	SM_SIMU_CRASH	5
extern  enum clnt_stat sm_simu_crash_1();
extern  bool_t sm_simu_crash_1_svc();
#define	SM_NOTIFY	6
extern  enum clnt_stat sm_notify_1();
extern  bool_t sm_notify_1_svc();
extern int sm_prog_1_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_sm_name(XDR *, sm_name*);
extern  bool_t xdr_my_id(XDR *, my_id*);
extern  bool_t xdr_mon_id(XDR *, mon_id*);
extern  bool_t xdr_mon(XDR *, mon*);
extern  bool_t xdr_sm_stat(XDR *, sm_stat*);
extern  bool_t xdr_sm_res(XDR *, sm_res*);
extern  bool_t xdr_sm_stat_res(XDR *, sm_stat_res*);
extern  bool_t xdr_sm_status(XDR *, sm_status*);
extern  bool_t xdr_stat_chge(XDR *, stat_chge*);

#else /* K&R C */
extern bool_t xdr_sm_name();
extern bool_t xdr_my_id();
extern bool_t xdr_mon_id();
extern bool_t xdr_mon();
extern bool_t xdr_sm_stat();
extern bool_t xdr_sm_res();
extern bool_t xdr_sm_stat_res();
extern bool_t xdr_sm_status();
extern bool_t xdr_stat_chge();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_SM_INTER_H_RPCGEN */
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
%/*
% * Copyright (c) 1986, 1994 by Sun Microsystems, Inc.
% * All rights reserved.
% */

%/* from sm_inter.x */

/*
 * Status monitor protocol specification
 */

program SM_PROG {
	version SM_VERS  {
		/* res_stat = stat_succ if status monitor agrees to monitor */
		/* res_stat = stat_fail if status monitor cannot monitor */
		/* if res_stat == stat_succ, state = state number of site */
                /* sm_name */
		struct sm_stat_res	SM_STAT(struct sm_name) = 1;

		/* res_stat = stat_succ if status monitor agrees to monitor */
		/* res_stat = stat_fail if status monitor cannot monitor */
		/* stat consists of state number of local site */
		struct sm_stat_res	SM_MON(struct mon) = 2;

		/* stat consists of state number of local site */
		struct sm_stat		SM_UNMON(struct mon_id) = 3;

		/* stat consists of state number of local site */
		struct sm_stat		SM_UNMON_ALL(struct my_id) = 4;

		void			SM_SIMU_CRASH(void) = 5;

		void			SM_NOTIFY(struct stat_chge) = 6;
	} = 1;
} = 100024;

const	SM_MAXSTRLEN = 1024;

struct sm_name {
	string mon_name<SM_MAXSTRLEN>;
};

struct my_id {
	string	 my_name<SM_MAXSTRLEN>;	/* name of the site iniates the */
					/* monitoring request */
	int	my_prog;	/* rpc program # of the requesting process */
	int	my_vers;	/* rpc version # of the requesting process */
	int	my_proc;	/* rpc procedure # of the requesting process */
};

struct mon_id {
	string	mon_name<SM_MAXSTRLEN>;	/* name of the site to be monitored */
	struct my_id my_id;
};


struct mon{
	struct mon_id mon_id;
	opaque priv[16]; 	/* private information to store at monitor */
				/* for requesting process */
};


/*
 * state # of status monitor monitonically increases each time
 * status of the site changes:
 * an even number (>= 0) indicates the site is down and
 * an odd number (> 0) indicates the site is up;
 */
struct sm_stat {
	int state;		/* state # of status monitor */
};

enum sm_res {
	stat_succ = 0,		/* status monitor agrees to monitor */
	stat_fail = 1		/* status monitor cannot monitor */
};

struct sm_stat_res {
	sm_res res_stat;
	int state;
};

/*
 * structure of the status message sent by the status monitor to the
 * requesting program when a monitored site changes status.
 */
struct sm_status {
	string mon_name<SM_MAXSTRLEN>;
	int state;
	opaque priv[16];		/* stored private information */
};

/*
 * structure sent between statd's to announce a state change (e.g.,
 * reboot).
 */
struct stat_chge {
	string mon_name<SM_MAXSTRLEN>;
	int state;
};