1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
|
/*
File: OpenTransportProtocol.h
Contains: Definitions likely to be used by low-level protocol stack implementation.
Version: QuickTime 7.3
Copyright: (c) 2007 (c) 1993-2001 by Apple Computer, Inc. and Mentat Inc., all rights reserved.
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __OPENTRANSPORTPROTOCOL__
#define __OPENTRANSPORTPROTOCOL__
#ifndef __CONDITIONALMACROS__
#include <ConditionalMacros.h>
#endif
#if CALL_NOT_IN_CARBON
#ifndef __FILES__
#include <Files.h>
#endif
#ifndef __CODEFRAGMENTS__
#include <CodeFragments.h>
#endif
#endif /* CALL_NOT_IN_CARBON */
#ifndef __OPENTRANSPORT__
#include <OpenTransport.h>
#endif
#ifdef __cplusplus
#include <stddef.h>
#endif
#if PRAGMA_ONCE
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT
#pragma import on
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
#if defined(__MWERKS__) && TARGET_CPU_68K
#pragma push
#pragma pointers_in_D0
#endif
/* ***** Setup Default Compiler Variables ******/
/*
OTKERNEL is used to indicate whether the code is being built
for the kernel environment. It defaults to 0. If you include
"OpenTransportKernel.h" before including this file,
it will be 1 and you will only be able to see stuff available
to kernel code.
As we've included "OpenTransport.h" and it defaults this variable
to 0 if it's not already been defined, it should always be defined
by the time we get here. So we just assert that. Assertions in
header files! Cool (-:
*/
#ifndef OTKERNEL
#error OpenTransportProtocol.h expects OpenTransport.h to set up OTKERNEL.
#endif /* !defined(OTKERNEL) */
/* ***** Shared Client Memory ******/
#if !OTKERNEL
/*
These allocators allocate memory in the shared client pool,
which is shared between all clients and is not disposed when
a particular client goes away. See DTS Technote ooo
"Understanding Open Transport Memory Management" for details.
*/
#if CALL_NOT_IN_CARBON
/*
* OTAllocSharedClientMem()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void * )
OTAllocSharedClientMem(OTByteCount size);
/*
* OTFreeSharedClientMem()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTFreeSharedClientMem(void * mem);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
/* ***** UNIX Types ******/
#if CALL_NOT_IN_CARBON
/*
On UNIX, uid_t and gid_t are defined to be big enough
to hold a user ID and group ID respectively. As Mac OS
has no such concepts, we just define them as UInt32 place
holders.
*/
typedef UInt32 uid_t;
typedef UInt32 gid_t;
/* Similarly, dev_t is a UNIX type for denoting a device number.*/
typedef UInt32 dev_t;
/* ***** From the Mentat "strstat.h" ******/
/* module statistics structure */
struct module_stat {
long ms_pcnt; /* count of calls to put proc */
long ms_scnt; /* count of calls to service proc */
long ms_ocnt; /* count of calls to open proc */
long ms_ccnt; /* count of calls to close proc */
long ms_acnt; /* count of calls to admin proc */
char * ms_xptr; /* pointer to private statistics */
short ms_xsize; /* length of private statistics buffer */
};
typedef struct module_stat module_stat;
/* ***** From the Mentat "cred.h" ******/
struct cred {
UInt16 cr_ref; /* reference count on processes using cred structures */
UInt16 cr_ngroups; /* number of groups in cr_groups */
uid_t cr_uid; /* effective user id */
gid_t cr_gid; /* effective group id */
uid_t cr_ruid; /* real user id */
gid_t cr_rgid; /* real group id */
uid_t cr_suid; /* user id saved by exec */
gid_t cr_sgid; /* group id saved by exec */
gid_t cr_groups[1]; /* supplementary groups list */
};
typedef struct cred cred;
typedef cred cred_t;
/* Free return structure for esballoc */
typedef CALLBACK_API_C( void , FreeFuncType )(char * arg);
struct free_rtn {
FreeFuncType free_func; /* Routine to call to free buffer */
char * free_arg; /* Parameter to free_func */
};
typedef struct free_rtn free_rtn;
typedef free_rtn frtn_t;
/* data descriptor */
typedef struct datab datab;
union datab_db_f {
datab * freep;
free_rtn * frtnp;
};
typedef union datab_db_f datab_db_f;
struct datab {
datab_db_f db_f;
unsigned char * db_base; /* first byte of buffer */
unsigned char * db_lim; /* last byte+1 of buffer */
unsigned char db_ref; /* count of messages pointing to block*/
unsigned char db_type; /* message type */
unsigned char db_iswhat; /* message status */
unsigned char db_filler2; /* for spacing */
UInt32 db_size; /* used internally */
unsigned char * db_msgaddr; /* used internally */
long db_filler;
};
typedef datab dblk_t;
#define db_freep db_f.freep
#define db_frtnp db_f.frtnp
/* message block */
struct msgb {
struct msgb * b_next; /* next message on queue */
struct msgb * b_prev; /* previous message on queue */
struct msgb * b_cont; /* next message block of message */
unsigned char * b_rptr; /* first unread data byte in buffer */
unsigned char * b_wptr; /* first unwritten data byte */
datab * b_datap; /* data block */
unsigned char b_band; /* message priority */
unsigned char b_pad1;
unsigned short b_flag;
#ifdef MSGB_XTRA
MSGB_XTRA
#endif
};
typedef struct msgb msgb;
typedef msgb mblk_t;
/* mblk flags */
enum {
MSGMARK = 0x01, /* last byte of message is tagged */
MSGNOLOOP = 0x02, /* don't pass message to write-side of stream */
MSGDELIM = 0x04, /* message is delimited */
MSGNOGET = 0x08
};
/* STREAMS environments are expected to define these constants in a public header file.*/
enum {
STRCTLSZ = 256, /* Maximum Control buffer size for messages */
STRMSGSZ = 8192 /* Maximum # data bytes for messages */
};
/* Message types */
enum {
QNORM = 0,
M_DATA = 0, /* Ordinary data */
M_PROTO = 1, /* Internal control info and data */
M_BREAK = 0x08, /* Request a driver to send a break */
M_PASSFP = 0x09, /* Used to pass a file pointer */
M_SIG = 0x0B, /* Requests a signal to be sent */
M_DELAY = 0x0C, /* Request a real-time delay */
M_CTL = 0x0D, /* For inter-module communication */
M_IOCTL = 0x0E, /* Used internally for I_STR requests */
M_SETOPTS = 0x10, /* Alters characteristics of Stream head */
M_RSE = 0x11 /* Reserved for internal use */
};
/* MPS private type */
enum {
M_MI = 0x40,
M_MI_READ_RESET = 1,
M_MI_READ_SEEK = 2,
M_MI_READ_END = 4
};
/* Priority messages types */
enum {
QPCTL = 0x80,
M_IOCACK = 0x81, /* Positive ack of previous M_IOCTL */
M_IOCNAK = 0x82, /* Previous M_IOCTL failed */
M_PCPROTO = 0x83, /* Same as M_PROTO except for priority */
M_PCSIG = 0x84, /* Priority signal */
M_FLUSH = 0x86, /* Requests modules to flush queues */
M_STOP = 0x87, /* Request drivers to stop output */
M_START = 0x88, /* Request drivers to start output */
M_HANGUP = 0x89, /* Driver can no longer produce data */
M_ERROR = 0x8A, /* Reports downstream error condition */
M_READ = 0x8B, /* Reports client read at Stream head */
M_COPYIN = 0x8C, /* Requests the Stream to copy data in for a module */
M_COPYOUT = 0x8D, /* Requests the Stream to copy data out for a module */
M_IOCDATA = 0x8E, /* Status from M_COPYIN/M_COPYOUT message */
M_PCRSE = 0x90, /* Reserved for internal use */
M_STOPI = 0x91, /* Request drivers to stop input */
M_STARTI = 0x92, /* Request drivers to start input */
M_HPDATA = 0x93 /* MPS-private type; high priority data */
};
/* Defines for flush messages */
enum {
FLUSHALL = 1,
FLUSHDATA = 0
};
enum {
NOERROR = -1 /* used in M_ERROR messages */
};
typedef struct sth_s sth_s;
typedef struct sqh_s sqh_s;
typedef struct q_xtra q_xtra;
#if OTKERNEL
/*
module_info is aligned differently on 68K than
on PowerPC. Yucky. I can't defined a conditionalised
pad field because a) you can't conditionalise specific
fields in the interface definition language used to
create Universal Interfaces, and b) lots of code
assigns C structured constants to global variables
of this type, and these assignments break if you
add an extra field to the type. Instead, I
set the alignment appropriately before defining the
structure. The problem with doing that is that
the interface definition language doesn't allow
my to set the alignment in the middle of a file,
so I have to do this via "pass throughs". This
works fine for the well known languages (C, Pascal),
but may cause problems for other languages (Java,
Asm).
*/
#if TARGET_CPU_PPC
#pragma options align=power
#endif
struct module_info {
unsigned short mi_idnum; /* module ID number */
char * mi_idname; /* module name */
long mi_minpsz; /* min pkt size, for developer use */
long mi_maxpsz; /* max pkt size, for developer use */
unsigned long mi_hiwat; /* hi-water mark, for flow control */
unsigned long mi_lowat; /* lo-water mark, for flow control */
};
typedef struct module_info module_info;
typedef module_info * module_infoPtr;
#if TARGET_CPU_PPC
#pragma options align=reset
#endif
typedef struct queue queue;
typedef CALLBACK_API_C( OTInt32 , admin_t )(void);
typedef CALLBACK_API_C( void , bufcall_t )(long size);
typedef CALLBACK_API_C( void , bufcallp_t )(long size);
typedef CALLBACK_API_C( OTInt32 , closep_t )(queue *q, OTInt32 foo, cred_t *cred);
typedef CALLBACK_API_C( OTInt32 , old_closep_t )(queue * q);
typedef CALLBACK_API_C( OTInt32 , openp_t )(queue *q, dev_t *dev, OTInt32 foo, OTInt32 bar, cred_t *cred);
typedef CALLBACK_API_C( OTInt32 , openOld_t )(queue *q, dev_t dev, OTInt32 foo, OTInt32 bar);
typedef CALLBACK_API_C( OTInt32 , old_openp_t )(queue *q, dev_t dev, OTInt32 foo, OTInt32 bar);
typedef CALLBACK_API_C( OTInt32 , closeOld_t )(queue * q);
typedef CALLBACK_API_C( OTInt32 , putp_t )(queue *q, msgb *mp);
typedef CALLBACK_API_C( OTInt32 , srvp_t )(queue * q);
struct qinit {
putp_t qi_putp; /* put procedure */
srvp_t qi_srvp; /* service procedure */
openp_t qi_qopen; /* called on each open or a push */
closep_t qi_qclose; /* called on last close or a pop */
admin_t qi_qadmin; /* reserved for future use */
module_info * qi_minfo; /* information structure */
module_stat * qi_mstat; /* statistics structure - optional */
};
typedef struct qinit qinit;
/* defines module or driver */
struct streamtab {
qinit * st_rdinit; /* defines read QUEUE */
qinit * st_wrinit; /* defines write QUEUE */
qinit * st_muxrinit; /* for multiplexing drivers only */
qinit * st_muxwinit; /* ditto */
};
typedef struct streamtab streamtab;
struct qband {
struct qband * qb_next; /* next band for this queue */
unsigned long qb_count; /* weighted count of characters in this band */
msgb * qb_first; /* head of message queue */
msgb * qb_last; /* tail of message queue */
unsigned long qb_hiwat; /* high water mark */
unsigned long qb_lowat; /* low water mark */
unsigned short qb_flag; /* ooo.state */
short qb_pad1; /* ooo reserved */
};
typedef struct qband qband;
typedef qband qband_t;
union queue_q_u {
queue * q_u_link; /* link to scheduling queue */
sqh_s * q_u_sqh_parent;
};
typedef union queue_q_u queue_q_u;
struct queue {
qinit * q_qinfo; /* procedures and limits for queue */
msgb * q_first; /* head of message queue */
msgb * q_last; /* tail of message queue */
struct queue * q_next; /* next queue in Stream */
queue_q_u q_u;
char * q_ptr; /* to private data structure */
unsigned long q_count; /* weighted count of characters on q */
long q_minpsz; /* min packet size accepted */
long q_maxpsz; /* max packet size accepted */
unsigned long q_hiwat; /* high water mark, for flow control */
unsigned long q_lowat; /* low water mark */
qband * q_bandp; /* band information */
unsigned short q_flag; /* ooo queue state */
unsigned char q_nband; /* ooo number of bands */
unsigned char q_pad1[1]; /* ooo reserved */
q_xtra * q_osx; /* Pointer to OS-dependent extra stuff */
struct queue * q_ffcp; /* Forward flow control pointer */
struct queue * q_bfcp; /* Backward flow control pointer */
};
typedef queue * queuePtr;
typedef queue queue_t;
#define q_link q_u.q_u_link
#define q_sqh_parent q_u.q_u_sqh_parent
/* queue_t flag defines */
enum {
QREADR = 0x01, /* This queue is a read queue */
QNOENB = 0x02, /* Don't enable in putq */
QFULL = 0x04, /* The queue is full */
QWANTR = 0x08, /* The queue should be scheduled in the next putq */
QWANTW = 0x10, /* The stream should be back enabled when this queue drains */
QUSE = 0x20, /* The queue is allocated and ready for use */
QENAB = 0x40, /* The queue is scheduled (on the run queue) */
QBACK = 0x80, /* The queue has been back enabled */
QOLD = 0x0100, /* Module supports old style opens and closes */
QHLIST = 0x0200, /* The Stream head is doing something with this queue (Not supported by MPS) */
QWELDED = 0x0400, /* Mentat flag for welded queues */
QUNWELDING = 0x0800, /* Queue is scheduled to be unwelded */
QPROTECTED = 0x1000, /* Mentat flag for unsafe q access */
QEXCOPENCLOSE = 0x2000 /* Queue wants exclusive open/close calls */
};
/* qband_t flag defines */
enum {
QB_FULL = 0x01, /* The band is full */
QB_WANTW = 0x02, /* The stream should be back enabled when this band/queue drains */
QB_BACK = 0x04 /* The queue has been back enabled */
};
#else
/*
Client code views a queue_t as a simple cookie.
The real definition lives above and is only available
to kernel code.
*/
typedef SInt32 queue_t;
#endif /* OTKERNEL */
/* structure contained in M_COPYIN/M_COPYOUT messages */
typedef char * caddr_t;
struct copyreq {
SInt32 cq_cmd; /* ioctl command (from ioc_cmd) */
cred * cq_cr; /* pointer to full credentials */
UInt32 cq_id; /* ioctl id (from ioc_id) */
caddr_t cq_addr; /* address to copy data to/from */
UInt32 cq_size; /* number of bytes to copy */
SInt32 cq_flag; /* state */
mblk_t * cq_private; /* private state information */
long cq_filler[4];
};
typedef struct copyreq copyreq;
#define cq_uid cq_cr->cr_uid
#define cq_gid cq_cr->cr_gid
/* copyreq defines */
enum {
STRCANON = 0x01, /* b_cont data block contains canonical format specifier */
RECOPY = 0x02 /* perform I_STR copyin again this time using canonical format specifier */
};
/* structure contained in M_IOCDATA message block */
struct copyresp {
SInt32 cp_cmd; /* ioctl command (from ioc_cmd) */
cred * cp_cr; /* pointer to full credentials */
UInt32 cp_id; /* ioctl id (from ioc_id) */
caddr_t cp_rval; /* status of request; 0 for success; error value for failure */
UInt32 cp_pad1;
SInt32 cp_pad2;
mblk_t * cp_private; /* private state information */
long cp_filler[4];
};
typedef struct copyresp copyresp;
#define cp_uid cp_cr->cr_uid
#define cp_gid cp_cr->cr_gid
/* structure contained in an M_IOCTL message block */
struct iocblk {
SInt32 ioc_cmd; /* ioctl command type */
cred * ioc_cr; /* pointer to full credentials */
UInt32 ioc_id; /* ioctl id */
UInt32 ioc_count; /* count of bytes in data field */
SInt32 ioc_error; /* error code */
SInt32 ioc_rval; /* return value */
long ioc_filler[4];
};
typedef struct iocblk iocblk;
#define ioc_uid ioc_cr->cr_uid
#define ioc_gid ioc_cr->cr_gid
enum {
TRANSPARENT = (unsigned long)0xFFFFFFFF
};
/* Used in M_IOCTL mblks to muxes (ioc_cmd I_LINK) */
struct linkblk {
queue_t * l_qtop; /* lowest level write queue of upper stream */
queue_t * l_qbot; /* highest level write queue of lower stream */
SInt32 l_index; /* system-unique index for lower stream */
long l_pad[5];
};
typedef struct linkblk linkblk;
/* structure contained in an M_PASSFP message block */
struct strpfp {
unsigned long pass_file_cookie; /* file 'pointer' */
unsigned short pass_uid; /* user id of sending stream */
unsigned short pass_gid;
sth_s * pass_sth; /* Stream head pointer of passed stream */
};
typedef struct strpfp strpfp;
/* structure contained in an M_SETOPTS message block */
struct stroptions {
unsigned long so_flags; /* options to set */
short so_readopt; /* read option */
unsigned short so_wroff; /* write offset */
long so_minpsz; /* minimum read packet size */
long so_maxpsz; /* maximum read packet size */
unsigned long so_hiwat; /* read queue high-water mark */
unsigned long so_lowat; /* read queue low-water mark */
unsigned char so_band; /* band for water marks */
unsigned char so_filler[3]; /* added for alignment */
unsigned long so_poll_set; /* poll events to set */
unsigned long so_poll_clr; /* poll events to clear */
};
typedef struct stroptions stroptions;
/* definitions for so_flags field */
enum {
SO_ALL = 0x7FFF, /* Update all options */
SO_READOPT = 0x0001, /* Set the read mode */
SO_WROFF = 0x0002, /* Insert an offset in write M_DATA mblks */
SO_MINPSZ = 0x0004, /* Change the min packet size on sth rq */
SO_MAXPSZ = 0x0008, /* Change the max packet size on sth rq */
SO_HIWAT = 0x0010, /* Change the high water mark on sth rq */
SO_LOWAT = 0x0020, /* Change the low water mark */
SO_MREADON = 0x0040, /* Request M_READ messages */
SO_MREADOFF = 0x0080, /* Don't gen M_READ messages */
SO_NDELON = 0x0100, /* old TTY semantics for O_NDELAY reads and writes */
SO_NDELOFF = 0x0200, /* STREAMS semantics for O_NDELAY reads and writes */
SO_ISTTY = 0x0400, /* Become a controlling tty */
SO_ISNTTY = 0x0800, /* No longer a controlling tty */
SO_TOSTOP = 0x1000, /* Stop on background writes */
SO_TONSTOP = 0x2000, /* Don't stop on background writes */
SO_BAND = 0x4000, /* Water marks are for a band */
SO_POLL_SET = 0x8000, /* Set events to poll */
SO_POLL_CLR = 0x00010000 /* Clear events to poll */
};
/* Buffer Allocation Priority */
enum {
BPRI_LO = 1,
BPRI_MED = 2,
BPRI_HI = 3
};
enum {
INFPSZ = -1
};
/** Test whether message is a data message */
#define datamsg(type) ((type) == M_DATA || (type) == M_PROTO || (type) == M_PCPROTO || (type) == M_DELAY)
enum {
CLONEOPEN = 0x02,
MODOPEN = 0x01,
OPENFAIL = -1
};
/* Enumeration values for strqget and strqset */
typedef SInt32 qfields;
enum {
QHIWAT = 0,
QLOWAT = 1,
QMAXPSZ = 2,
QMINPSZ = 3,
QCOUNT = 4,
QFIRST = 5,
QLAST = 6,
QFLAG = 7,
QBAD = 8
};
typedef qfields qfields_t;
#endif /* CALL_NOT_IN_CARBON */
/* ***** From the Mentat "stropts.h" ******/
enum {
I_NREAD = ((MIOC_STREAMIO << 8) | 1), /* return the number of bytes in 1st msg */
I_PUSH = ((MIOC_STREAMIO << 8) | 2), /* push module just below stream head */
I_POP = ((MIOC_STREAMIO << 8) | 3), /* pop module below stream head */
I_LOOK = ((MIOC_STREAMIO << 8) | 4), /* retrieve name of first stream module */
I_FLUSH = ((MIOC_STREAMIO << 8) | 5), /* flush all input and/or output queues */
I_SRDOPT = ((MIOC_STREAMIO << 8) | 6), /* set the read mode */
I_GRDOPT = ((MIOC_STREAMIO << 8) | 7), /* get the current read mode */
I_STR = ((MIOC_STREAMIO << 8) | 8), /* create an internal ioctl message */
I_SETSIG = ((MIOC_STREAMIO << 8) | 9), /* request SIGPOLL signal on events */
I_GETSIG = ((MIOC_STREAMIO << 8) | 10), /* query the registered events */
I_FIND = ((MIOC_STREAMIO << 8) | 11), /* check for module in stream */
I_LINK = ((MIOC_STREAMIO << 8) | 12), /* connect stream under mux fd */
I_UNLINK = ((MIOC_STREAMIO << 8) | 13), /* disconnect two streams */
I_PEEK = ((MIOC_STREAMIO << 8) | 15), /* peek at data on read queue */
I_FDINSERT = ((MIOC_STREAMIO << 8) | 16), /* create a message and send downstream */
I_SENDFD = ((MIOC_STREAMIO << 8) | 17), /* send an fd to a connected pipe stream */
I_RECVFD = ((MIOC_STREAMIO << 8) | 18), /* retrieve a file descriptor */
I_FLUSHBAND = ((MIOC_STREAMIO << 8) | 19), /* flush a particular input and/or output band */
I_SWROPT = ((MIOC_STREAMIO << 8) | 20), /* set the write mode */
I_GWROPT = ((MIOC_STREAMIO << 8) | 21), /* get the current write mode */
I_LIST = ((MIOC_STREAMIO << 8) | 22), /* get a list of all modules on a stream */
I_ATMARK = ((MIOC_STREAMIO << 8) | 23), /* check to see if the next message is "marked" */
I_CKBAND = ((MIOC_STREAMIO << 8) | 24), /* check for a message of a particular band */
I_GETBAND = ((MIOC_STREAMIO << 8) | 25), /* get the band of the next message to be read */
I_CANPUT = ((MIOC_STREAMIO << 8) | 26), /* check to see if a message may be passed on a stream */
I_SETCLTIME = ((MIOC_STREAMIO << 8) | 27), /* set the close timeout wait */
I_GETCLTIME = ((MIOC_STREAMIO << 8) | 28), /* get the current close timeout wait */
I_PLINK = ((MIOC_STREAMIO << 8) | 29), /* permanently connect a stream under a mux */
I_PUNLINK = ((MIOC_STREAMIO << 8) | 30), /* disconnect a permanent link */
I_GETMSG = ((MIOC_STREAMIO << 8) | 40), /* getmsg() system call */
I_PUTMSG = ((MIOC_STREAMIO << 8) | 41), /* putmsg() system call */
I_POLL = ((MIOC_STREAMIO << 8) | 42), /* poll() system call */
I_SETDELAY = ((MIOC_STREAMIO << 8) | 43), /* set blocking status */
I_GETDELAY = ((MIOC_STREAMIO << 8) | 44), /* get blocking status */
I_RUN_QUEUES = ((MIOC_STREAMIO << 8) | 45), /* sacrifice for the greater good */
I_GETPMSG = ((MIOC_STREAMIO << 8) | 46), /* getpmsg() system call */
I_PUTPMSG = ((MIOC_STREAMIO << 8) | 47), /* putpmsg() system call */
I_AUTOPUSH = ((MIOC_STREAMIO << 8) | 48), /* for systems that cannot do the autopush in open */
I_PIPE = ((MIOC_STREAMIO << 8) | 49), /* for pipe library call */
I_HEAP_REPORT = ((MIOC_STREAMIO << 8) | 50), /* get heap statistics */
I_FIFO = ((MIOC_STREAMIO << 8) | 51) /* for fifo library call */
};
/* priority message request on putmsg() or strpeek */
enum {
RS_HIPRI = 0x01
};
/* flags for getpmsg and putpmsg */
enum {
MSG_HIPRI = 0x01,
MSG_BAND = 0x02, /* Retrieve a message from a particular band */
MSG_ANY = 0x04 /* Retrieve a message from any band */
};
/* return values from getmsg(), 0 indicates all ok */
enum {
MORECTL = 0x01, /* more control info available */
MOREDATA = 0x02 /* more data available */
};
enum {
FMNAMESZ = 31 /* maximum length of a module or device name */
};
/* Infinite poll wait time */
enum {
INFTIM = (unsigned long)0xFFFFFFFF
};
/* flush requests */
enum {
FLUSHR = 0x01, /* Flush the read queue */
FLUSHW = 0x02, /* Flush the write queue */
FLUSHRW = (FLUSHW | FLUSHR) /* Flush both */
};
enum {
FLUSHBAND = 0x40 /* Flush a particular band */
};
/* I_FLUSHBAND */
struct bandinfo {
unsigned char bi_pri; /* Band to flush */
char pad1;
SInt32 bi_flag; /* One of the above flush requests */
};
typedef struct bandinfo bandinfo;
/* flags for I_ATMARK */
enum {
ANYMARK = 0x01, /* Check if message is marked */
LASTMARK = 0x02 /* Check if this is the only message marked */
};
/* signal event masks */
enum {
S_INPUT = 0x01, /* A non-M_PCPROTO message has arrived */
S_HIPRI = 0x02, /* A priority (M_PCPROTO) message is available */
S_OUTPUT = 0x04, /* The write queue is no longer full */
S_MSG = 0x08, /* A signal message has reached the front of read queue */
S_RDNORM = 0x10, /* A non-priority message is available */
S_RDBAND = 0x20, /* A banded messsage is available */
S_WRNORM = 0x40, /* Same as S_OUTPUT */
S_WRBAND = 0x80, /* A priority band exists and is writable */
S_ERROR = 0x0100, /* Error message has arrived */
S_HANGUP = 0x0200, /* Hangup message has arrived */
S_BANDURG = 0x0400 /* Use SIGURG instead of SIGPOLL on S_RDBAND signals */
};
/* read mode bits for I_S|GRDOPT; choose one of the following */
enum {
RNORM = 0x01, /* byte-stream mode, default */
RMSGD = 0x02, /* message-discard mode */
RMSGN = 0x04, /* message-nondiscard mode */
RFILL = 0x08 /* fill read buffer mode (PSE private) */
};
/* More read modes, these are bitwise or'ed with the modes above */
enum {
RPROTNORM = 0x10, /* Normal handling of M_PROTO/M_PCPROTO messages, default */
RPROTDIS = 0x20, /* Discard M_PROTO/M_PCPROTO message blocks */
RPROTDAT = 0x40 /* Convert M_PROTO/M_PCPROTO message blocks into M_DATA */
};
/* write modes for I_S|GWROPT */
enum {
SNDZERO = 0x01 /* Send a zero-length message downstream on a write of zero bytes */
};
enum {
MUXID_ALL = -1 /* Unlink all lower streams for I_UNLINK and I_PUNLINK */
};
/*
strbuf is moved to "OpenTransport.h" because that header file
exports provider routines that take it as a parameter.
*/
/* structure of ioctl data on I_FDINSERT */
struct strfdinsert {
strbuf ctlbuf;
strbuf databuf;
long flags; /* type of message, 0 or RS_HIPRI */
long fildes; /* fd of other stream (FDCELL) */
SInt32 offset; /* where to put other stream read qp */
};
typedef struct strfdinsert strfdinsert;
/* I_LIST structures */
struct str_mlist {
char l_name[32];
};
typedef struct str_mlist str_mlist;
struct str_list {
SInt32 sl_nmods; /* number of modules in sl_modlist array */
str_mlist * sl_modlist;
};
typedef struct str_list str_list;
/* I_PEEK structure */
struct strpeek {
strbuf ctlbuf;
strbuf databuf;
long flags; /* if RS_HIPRI, get priority messages only */
};
typedef struct strpeek strpeek;
/* structure for getpmsg and putpmsg */
struct strpmsg {
strbuf ctlbuf;
strbuf databuf;
SInt32 band;
long flags;
};
typedef struct strpmsg strpmsg;
/* structure of ioctl data on I_RECVFD */
struct strrecvfd {
long fd; /* new file descriptor (FDCELL) */
unsigned short uid; /* user id of sending stream */
unsigned short gid;
char fill[8];
};
typedef struct strrecvfd strrecvfd;
/* structure of ioctl data on I_STR */
struct strioctl {
SInt32 ic_cmd; /* downstream command */
SInt32 ic_timout; /* ACK/NAK timeout */
SInt32 ic_len; /* length of data arg */
char * ic_dp; /* ptr to data arg */
};
typedef struct strioctl strioctl;
/* ***** From the Mentat "strlog.h" ******/
struct log_ctl {
short mid;
short sid;
char level;
char pad1;
short flags;
long ltime;
long ttime;
SInt32 seq_no;
};
typedef struct log_ctl log_ctl;
enum {
SL_FATAL = 0x01, /* Fatal error */
SL_NOTIFY = 0x02, /* Notify the system administrator */
SL_ERROR = 0x04, /* Pass message to error logger */
SL_TRACE = 0x08, /* Pass message to tracer */
SL_CONSOLE = 0x00, /* Console messages are disabled */
SL_WARN = 0x20, /* Warning */
SL_NOTE = 0x40 /* Notice this message */
};
struct trace_ids {
short ti_mid;
short ti_sid;
char ti_level;
};
typedef struct trace_ids trace_ids;
enum {
I_TRCLOG = ((MIOC_STRLOG << 8) | 1),
I_ERRLOG = ((MIOC_STRLOG << 8) | 2)
};
enum {
LOGMSGSZ = 128
};
/* ***** From the Mentat "tihdr.h" ******/
#if CALL_NOT_IN_CARBON
/* TPI Primitives*/
enum {
T_BIND_REQ = 101,
T_CONN_REQ = 102, /* connection request */
T_CONN_RES = 103, /* respond to connection indication */
T_DATA_REQ = 104,
T_DISCON_REQ = 105,
T_EXDATA_REQ = 106,
T_INFO_REQ = 107,
T_OPTMGMT_REQ = 108,
T_ORDREL_REQ = 109,
T_UNBIND_REQ = 110,
T_UNITDATA_REQ = 111,
T_ADDR_REQ = 112, /* Get address request */
T_UREQUEST_REQ = 113, /* UnitRequest (transaction) req */
T_REQUEST_REQ = 114, /* Request (CO transaction) req */
T_UREPLY_REQ = 115, /* UnitRequest (transaction) req */
T_REPLY_REQ = 116, /* REPLY (CO transaction) req */
T_CANCELREQUEST_REQ = 117, /* Cancel outgoing request */
T_CANCELREPLY_REQ = 118, /* Cancel incoming request */
T_REGNAME_REQ = 119, /* Request name registration */
T_DELNAME_REQ = 120, /* Request delete name registration */
T_LKUPNAME_REQ = 121, /* Request name lookup */
T_BIND_ACK = 122,
T_CONN_CON = 123, /* connection confirmation */
T_CONN_IND = 124, /* incoming connection indication */
T_DATA_IND = 125,
T_DISCON_IND = 126,
T_ERROR_ACK = 127,
T_EXDATA_IND = 128,
T_INFO_ACK = 129,
T_OK_ACK = 130,
T_OPTMGMT_ACK = 131,
T_ORDREL_IND = 132,
T_UNITDATA_IND = 133,
T_UDERROR_IND = 134,
T_ADDR_ACK = 135, /* Get address ack */
T_UREQUEST_IND = 136, /* UnitRequest (transaction) ind */
T_REQUEST_IND = 137, /* Request (CO transaction) ind */
T_UREPLY_IND = 138, /* Incoming unit reply */
T_REPLY_IND = 139, /* Incoming reply */
T_UREPLY_ACK = 140, /* outgoing Unit Reply is complete */
T_REPLY_ACK = 141, /* outgoing Reply is complete */
T_RESOLVEADDR_REQ = 142,
T_RESOLVEADDR_ACK = 143,
T_LKUPNAME_CON = 146, /* Results of name lookup */
T_LKUPNAME_RES = 147, /* Partial results of name lookup */
T_REGNAME_ACK = 148, /* Request name registration */
T_SEQUENCED_ACK = 149, /* Sequenced version of OK or ERROR ACK */
T_EVENT_IND = 160 /* Miscellaneous event Indication */
};
/* State values */
enum {
TS_UNBND = 1,
TS_WACK_BREQ = 2,
TS_WACK_UREQ = 3,
TS_IDLE = 4,
TS_WACK_OPTREQ = 5,
TS_WACK_CREQ = 6,
TS_WCON_CREQ = 7,
TS_WRES_CIND = 8,
TS_WACK_CRES = 9,
TS_DATA_XFER = 10,
TS_WIND_ORDREL = 11,
TS_WREQ_ORDREL = 12,
TS_WACK_DREQ6 = 13,
TS_WACK_DREQ7 = 14,
TS_WACK_DREQ9 = 15,
TS_WACK_DREQ10 = 16,
TS_WACK_DREQ11 = 17,
TS_WACK_ORDREL = 18,
TS_NOSTATES = 19,
TS_BAD_STATE = 19
};
/* Transport events */
enum {
TE_OPENED = 1,
TE_BIND = 2,
TE_OPTMGMT = 3,
TE_UNBIND = 4,
TE_CLOSED = 5,
TE_CONNECT1 = 6,
TE_CONNECT2 = 7,
TE_ACCEPT1 = 8,
TE_ACCEPT2 = 9,
TE_ACCEPT3 = 10,
TE_SND = 11,
TE_SNDDIS1 = 12,
TE_SNDDIS2 = 13,
TE_SNDREL = 14,
TE_SNDUDATA = 15,
TE_LISTEN = 16,
TE_RCVCONNECT = 17,
TE_RCV = 18,
TE_RCVDIS1 = 19,
TE_RCVDIS2 = 20,
TE_RCVDIS3 = 21,
TE_RCVREL = 22,
TE_RCVUDATA = 23,
TE_RCVUDERR = 24,
TE_PASS_CONN = 25,
TE_BAD_EVENT = 26
};
struct T_addr_ack {
long PRIM_type; /* Always T_ADDR_ACK */
long LOCADDR_length;
long LOCADDR_offset;
long REMADDR_length;
long REMADDR_offset;
};
typedef struct T_addr_ack T_addr_ack;
struct T_addr_req {
long PRIM_type; /* Always T_ADDR_REQ */
};
typedef struct T_addr_req T_addr_req;
struct T_bind_ack {
long PRIM_type; /* always T_BIND_ACK */
long ADDR_length;
long ADDR_offset;
unsigned long CONIND_number;
};
typedef struct T_bind_ack T_bind_ack;
struct T_bind_req {
long PRIM_type; /* always T_BIND_REQ */
long ADDR_length;
long ADDR_offset;
unsigned long CONIND_number;
};
typedef struct T_bind_req T_bind_req;
struct T_conn_con {
long PRIM_type; /* always T_CONN_CON */
long RES_length; /* responding address length */
long RES_offset;
long OPT_length;
long OPT_offset;
};
typedef struct T_conn_con T_conn_con;
struct T_conn_ind {
long PRIM_type; /* always T_CONN_IND */
long SRC_length;
long SRC_offset;
long OPT_length;
long OPT_offset;
long SEQ_number;
};
typedef struct T_conn_ind T_conn_ind;
struct T_conn_req {
long PRIM_type; /* always T_CONN_REQ */
long DEST_length;
long DEST_offset;
long OPT_length;
long OPT_offset;
};
typedef struct T_conn_req T_conn_req;
struct T_conn_res {
long PRIM_type; /* always T_CONN_RES */
queue_t * QUEUE_ptr;
long OPT_length;
long OPT_offset;
long SEQ_number;
};
typedef struct T_conn_res T_conn_res;
struct T_data_ind {
long PRIM_type; /* always T_DATA_IND */
long MORE_flag;
};
typedef struct T_data_ind T_data_ind;
struct T_data_req {
long PRIM_type; /* always T_DATA_REQ */
long MORE_flag;
};
typedef struct T_data_req T_data_req;
struct T_discon_ind {
long PRIM_type; /* always T_DISCON_IND */
long DISCON_reason;
long SEQ_number;
};
typedef struct T_discon_ind T_discon_ind;
struct T_discon_req {
long PRIM_type; /* always T_DISCON_REQ */
long SEQ_number;
};
typedef struct T_discon_req T_discon_req;
struct T_exdata_ind {
long PRIM_type; /* always T_EXDATA_IND */
long MORE_flag;
};
typedef struct T_exdata_ind T_exdata_ind;
struct T_exdata_req {
long PRIM_type; /* always T_EXDATA_REQ */
long MORE_flag;
};
typedef struct T_exdata_req T_exdata_req;
struct T_error_ack {
long PRIM_type; /* always T_ERROR_ACK */
long ERROR_prim; /* primitive in error */
long TLI_error;
long UNIX_error;
};
typedef struct T_error_ack T_error_ack;
struct T_info_ack {
long PRIM_type; /* always T_INFO_ACK */
long TSDU_size; /* max TSDU size */
long ETSDU_size; /* max ETSDU size */
long CDATA_size; /* connect data size */
long DDATA_size; /* disconnect data size */
long ADDR_size; /* TSAP size */
long OPT_size; /* options size */
long TIDU_size; /* TIDU size */
long SERV_type; /* service type */
long CURRENT_state; /* current state */
long PROVIDER_flag; /* provider flags (see xti.h for defines) */
};
typedef struct T_info_ack T_info_ack;
/* Provider flags */
enum {
SENDZERO = 0x0001, /* supports 0-length TSDU's */
XPG4_1 = 0x0002 /* provider supports recent stuff */
};
struct T_info_req {
long PRIM_type; /* always T_INFO_REQ */
};
typedef struct T_info_req T_info_req;
struct T_ok_ack {
long PRIM_type; /* always T_OK_ACK */
long CORRECT_prim;
};
typedef struct T_ok_ack T_ok_ack;
struct T_optmgmt_ack {
long PRIM_type; /* always T_OPTMGMT_ACK */
long OPT_length;
long OPT_offset;
long MGMT_flags;
};
typedef struct T_optmgmt_ack T_optmgmt_ack;
struct T_optmgmt_req {
long PRIM_type; /* always T_OPTMGMT_REQ */
long OPT_length;
long OPT_offset;
long MGMT_flags;
};
typedef struct T_optmgmt_req T_optmgmt_req;
struct T_ordrel_ind {
long PRIM_type; /* always T_ORDREL_IND */
};
typedef struct T_ordrel_ind T_ordrel_ind;
struct T_ordrel_req {
long PRIM_type; /* always T_ORDREL_REQ */
};
typedef struct T_ordrel_req T_ordrel_req;
struct T_unbind_req {
long PRIM_type; /* always T_UNBIND_REQ */
};
typedef struct T_unbind_req T_unbind_req;
struct T_uderror_ind {
long PRIM_type; /* always T_UDERROR_IND */
long DEST_length;
long DEST_offset;
long OPT_length;
long OPT_offset;
long ERROR_type;
};
typedef struct T_uderror_ind T_uderror_ind;
struct T_unitdata_ind {
long PRIM_type; /* always T_UNITDATA_IND */
long SRC_length;
long SRC_offset;
long OPT_length;
long OPT_offset;
};
typedef struct T_unitdata_ind T_unitdata_ind;
struct T_unitdata_req {
long PRIM_type; /* always T_UNITDATA_REQ */
long DEST_length;
long DEST_offset;
long OPT_length;
long OPT_offset;
};
typedef struct T_unitdata_req T_unitdata_req;
struct T_resolveaddr_ack {
long PRIM_type; /* always T_RESOLVEADDR_ACK */
long SEQ_number;
long ADDR_length;
long ADDR_offset;
long ORIG_client;
long ORIG_data;
long TLI_error;
long UNIX_error;
};
typedef struct T_resolveaddr_ack T_resolveaddr_ack;
struct T_resolveaddr_req {
long PRIM_type; /* always T_RESOLVEADDR_REQ */
long SEQ_number;
long ADDR_length;
long ADDR_offset;
long ORIG_client;
long ORIG_data;
long MAX_milliseconds;
};
typedef struct T_resolveaddr_req T_resolveaddr_req;
struct T_unitreply_ind {
long PRIM_type; /* Always T_UREPLY_IND */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REP_flags;
long TLI_error;
long UNIX_error;
};
typedef struct T_unitreply_ind T_unitreply_ind;
struct T_unitrequest_ind {
long PRIM_type; /* Always T_UREQUEST_IND */
long SEQ_number;
long SRC_length;
long SRC_offset;
long OPT_length;
long OPT_offset;
long REQ_flags;
};
typedef struct T_unitrequest_ind T_unitrequest_ind;
struct T_unitrequest_req {
long PRIM_type; /* Always T_UREQUEST_REQ */
long SEQ_number;
long DEST_length;
long DEST_offset;
long OPT_length;
long OPT_offset;
long REQ_flags;
};
typedef struct T_unitrequest_req T_unitrequest_req;
struct T_unitreply_req {
long PRIM_type; /* Always T_UREPLY_REQ */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REP_flags;
};
typedef struct T_unitreply_req T_unitreply_req;
struct T_unitreply_ack {
long PRIM_type; /* Always T_UREPLY_ACK */
long SEQ_number;
long TLI_error;
long UNIX_error;
};
typedef struct T_unitreply_ack T_unitreply_ack;
struct T_cancelrequest_req {
long PRIM_type; /* Always T_CANCELREQUEST_REQ */
long SEQ_number;
};
typedef struct T_cancelrequest_req T_cancelrequest_req;
struct T_cancelreply_req {
long PRIM_type; /* Always T_CANCELREPLY_REQ */
long SEQ_number;
};
typedef struct T_cancelreply_req T_cancelreply_req;
struct T_reply_ind {
long PRIM_type; /* Always T_REPLY_IND */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REP_flags;
long TLI_error;
long UNIX_error;
};
typedef struct T_reply_ind T_reply_ind;
struct T_request_ind {
long PRIM_type; /* Always T_REQUEST_IND */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REQ_flags;
};
typedef struct T_request_ind T_request_ind;
struct T_request_req {
long PRIM_type; /* Always T_REQUEST_REQ */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REQ_flags;
};
typedef struct T_request_req T_request_req;
struct T_reply_req {
long PRIM_type; /* Always T_REPLY_REQ */
long SEQ_number;
long OPT_length;
long OPT_offset;
long REP_flags;
};
typedef struct T_reply_req T_reply_req;
struct T_reply_ack {
long PRIM_type; /* Always T_REPLY_ACK */
long SEQ_number;
long TLI_error;
long UNIX_error;
};
typedef struct T_reply_ack T_reply_ack;
struct T_regname_req {
long PRIM_type; /* Always T_REGNAME_REQ */
long SEQ_number; /* Reply is sequence ack */
long NAME_length;
long NAME_offset;
long ADDR_length;
long ADDR_offset;
long REQ_flags;
};
typedef struct T_regname_req T_regname_req;
struct T_regname_ack {
long PRIM_type; /* always T_REGNAME_ACK */
long SEQ_number;
long REG_id;
long ADDR_length;
long ADDR_offset;
};
typedef struct T_regname_ack T_regname_ack;
struct T_delname_req {
long PRIM_type; /* Always T_DELNAME_REQ */
long SEQ_number; /* Reply is sequence ack */
long NAME_length;
long NAME_offset;
};
typedef struct T_delname_req T_delname_req;
struct T_lkupname_req {
long PRIM_type; /* Always T_LKUPNAME_REQ */
long SEQ_number; /* Reply is sequence ack */
long NAME_length; /* ... or T_LKUPNAME_CON */
long NAME_offset;
long ADDR_length;
long ADDR_offset;
long MAX_number;
long MAX_milliseconds;
long REQ_flags;
};
typedef struct T_lkupname_req T_lkupname_req;
struct T_lkupname_con {
long PRIM_type; /* Either T_LKUPNAME_CON */
long SEQ_number; /* Or T_LKUPNAME_RES */
long NAME_length;
long NAME_offset;
long RSP_count;
long RSP_cumcount;
};
typedef struct T_lkupname_con T_lkupname_con;
struct T_sequence_ack {
long PRIM_type; /* always T_SEQUENCED_ACK */
long ORIG_prim; /* original primitive */
long SEQ_number;
long TLI_error;
long UNIX_error;
};
typedef struct T_sequence_ack T_sequence_ack;
struct T_event_ind {
long PRIM_type; /* always T_EVENT_IND */
long EVENT_code;
long EVENT_cookie;
};
typedef struct T_event_ind T_event_ind;
union T_primitives {
long type;
long primType;
T_addr_ack taddrack;
T_bind_ack tbindack;
T_bind_req tbindreq;
T_conn_con tconncon;
T_conn_ind tconnind;
T_conn_req tconnreq;
T_conn_res tconnres;
T_data_ind tdataind;
T_data_req tdatareq;
T_discon_ind tdisconind;
T_discon_req tdisconreq;
T_exdata_ind texdataind;
T_exdata_req texdatareq;
T_error_ack terrorack;
T_info_ack tinfoack;
T_info_req tinforeq;
T_ok_ack tokack;
T_optmgmt_ack toptmgmtack;
T_optmgmt_req toptmgmtreq;
T_ordrel_ind tordrelind;
T_ordrel_req tordrelreq;
T_unbind_req tunbindreq;
T_uderror_ind tuderrorind;
T_unitdata_ind tunitdataind;
T_unitdata_req tunitdatareq;
T_unitreply_ind tunitreplyind;
T_unitrequest_ind tunitrequestind;
T_unitrequest_req tunitrequestreq;
T_unitreply_req tunitreplyreq;
T_unitreply_ack tunitreplyack;
T_reply_ind treplyind;
T_request_ind trequestind;
T_request_req trequestreq;
T_reply_req treplyreq;
T_reply_ack treplyack;
T_cancelrequest_req tcancelreqreq;
T_resolveaddr_req tresolvereq;
T_resolveaddr_ack tresolveack;
T_regname_req tregnamereq;
T_regname_ack tregnameack;
T_delname_req tdelnamereq;
T_lkupname_req tlkupnamereq;
T_lkupname_con tlkupnamecon;
T_sequence_ack tsequenceack;
T_event_ind teventind;
};
typedef union T_primitives T_primitives;
/* ***** From the Mentat "dlpi.h" ******/
/*
This header file has encoded the values so an existing driver
or user which was written with the Logical Link Interface(LLI)
can migrate to the DLPI interface in a binary compatible manner.
Any fields which require a specific format or value are flagged
with a comment containing the message LLI compatibility.
*/
/* DLPI revision definition history*/
enum {
DL_CURRENT_VERSION = 0x02, /* current version of dlpi */
DL_VERSION_2 = 0x02 /* version of dlpi March 12,1991 */
};
enum {
DL_INFO_REQ = 0x00, /* Information Req, LLI compatibility */
DL_INFO_ACK = 0x03, /* Information Ack, LLI compatibility */
DL_ATTACH_REQ = 0x0B, /* Attach a PPA */
DL_DETACH_REQ = 0x0C, /* Detach a PPA */
DL_BIND_REQ = 0x01, /* Bind dlsap address, LLI compatibility */
DL_BIND_ACK = 0x04, /* Dlsap address bound, LLI compatibility */
DL_UNBIND_REQ = 0x02, /* Unbind dlsap address, LLI compatibility */
DL_OK_ACK = 0x06, /* Success acknowledgment, LLI compatibility */
DL_ERROR_ACK = 0x05, /* Error acknowledgment, LLI compatibility */
DL_SUBS_BIND_REQ = 0x1B, /* Bind Subsequent DLSAP address */
DL_SUBS_BIND_ACK = 0x1C, /* Subsequent DLSAP address bound */
DL_SUBS_UNBIND_REQ = 0x15, /* Subsequent unbind */
DL_ENABMULTI_REQ = 0x1D, /* Enable multicast addresses */
DL_DISABMULTI_REQ = 0x1E, /* Disable multicast addresses */
DL_PROMISCON_REQ = 0x1F, /* Turn on promiscuous mode */
DL_PROMISCOFF_REQ = 0x20, /* Turn off promiscuous mode */
DL_UNITDATA_REQ = 0x07, /* datagram send request, LLI compatibility */
DL_UNITDATA_IND = 0x08, /* datagram receive indication, LLI compatibility */
DL_UDERROR_IND = 0x09, /* datagram error indication, LLI compatibility */
DL_UDQOS_REQ = 0x0A, /* set QOS for subsequent datagram transmissions */
DL_CONNECT_REQ = 0x0D, /* Connect request */
DL_CONNECT_IND = 0x0E, /* Incoming connect indication */
DL_CONNECT_RES = 0x0F, /* Accept previous connect indication */
DL_CONNECT_CON = 0x10, /* Connection established */
DL_TOKEN_REQ = 0x11, /* Passoff token request */
DL_TOKEN_ACK = 0x12, /* Passoff token ack */
DL_DISCONNECT_REQ = 0x13, /* Disconnect request */
DL_DISCONNECT_IND = 0x14, /* Disconnect indication */
DL_RESET_REQ = 0x17, /* Reset service request */
DL_RESET_IND = 0x18, /* Incoming reset indication */
DL_RESET_RES = 0x19, /* Complete reset processing */
DL_RESET_CON = 0x1A, /* Reset processing complete */
DL_DATA_ACK_REQ = 0x21, /* data unit transmission request */
DL_DATA_ACK_IND = 0x22, /* Arrival of a command PDU */
DL_DATA_ACK_STATUS_IND = 0x23, /* Status indication of DATA_ACK_REQ*/
DL_REPLY_REQ = 0x24, /* Request a DLSDU from the remote */
DL_REPLY_IND = 0x25, /* Arrival of a command PDU */
DL_REPLY_STATUS_IND = 0x26, /* Status indication of REPLY_REQ */
DL_REPLY_UPDATE_REQ = 0x27, /* Hold a DLSDU for transmission */
DL_REPLY_UPDATE_STATUS_IND = 0x28, /* Status of REPLY_UPDATE req */
DL_XID_REQ = 0x29, /* Request to send an XID PDU */
DL_XID_IND = 0x2A, /* Arrival of an XID PDU */
DL_XID_RES = 0x2B, /* request to send a response XID PDU*/
DL_XID_CON = 0x2C, /* Arrival of a response XID PDU */
DL_TEST_REQ = 0x2D, /* TEST command request */
DL_TEST_IND = 0x2E, /* TEST response indication */
DL_TEST_RES = 0x2F, /* TEST response */
DL_TEST_CON = 0x30, /* TEST Confirmation */
DL_PHYS_ADDR_REQ = 0x31, /* Request to get physical addr */
DL_PHYS_ADDR_ACK = 0x32, /* Return physical addr */
DL_SET_PHYS_ADDR_REQ = 0x33, /* set physical addr */
DL_GET_STATISTICS_REQ = 0x34, /* Request to get statistics */
DL_GET_STATISTICS_ACK = 0x35 /* Return statistics */
};
/* DLPI interface states*/
enum {
DL_UNATTACHED = 0x04, /* PPA not attached */
DL_ATTACH_PENDING = 0x05, /* Waiting ack of DL_ATTACH_REQ */
DL_DETACH_PENDING = 0x06, /* Waiting ack of DL_DETACH_REQ */
DL_UNBOUND = 0x00, /* PPA attached, LLI compatibility */
DL_BIND_PENDING = 0x01, /* Waiting ack of DL_BIND_REQ, LLI compatibility */
DL_UNBIND_PENDING = 0x02, /* Waiting ack of DL_UNBIND_REQ, LLI compatibility */
DL_IDLE = 0x03, /* dlsap bound, awaiting use, LLI compatibility */
DL_UDQOS_PENDING = 0x07, /* Waiting ack of DL_UDQOS_REQ */
DL_OUTCON_PENDING = 0x08, /* outgoing connection, awaiting DL_CONN_CON */
DL_INCON_PENDING = 0x09, /* incoming connection, awaiting DL_CONN_RES */
DL_CONN_RES_PENDING = 0x0A, /* Waiting ack of DL_CONNECT_RES */
DL_DATAXFER = 0x0B, /* connection-oriented data transfer */
DL_USER_RESET_PENDING = 0x0C, /* user initiated reset, awaiting DL_RESET_CON */
DL_PROV_RESET_PENDING = 0x0D, /* provider initiated reset, awaiting DL_RESET_RES */
DL_RESET_RES_PENDING = 0x0E, /* Waiting ack of DL_RESET_RES */
DL_DISCON8_PENDING = 0x0F, /* Waiting ack of DL_DISC_REQ when in DL_OUTCON_PENDING */
DL_DISCON9_PENDING = 0x10, /* Waiting ack of DL_DISC_REQ when in DL_INCON_PENDING */
DL_DISCON11_PENDING = 0x11, /* Waiting ack of DL_DISC_REQ when in DL_DATAXFER */
DL_DISCON12_PENDING = 0x12, /* Waiting ack of DL_DISC_REQ when in DL_USER_RESET_PENDING */
DL_DISCON13_PENDING = 0x13, /* Waiting ack of DL_DISC_REQ when in DL_DL_PROV_RESET_PENDING */
DL_SUBS_BIND_PND = 0x14, /* Waiting ack of DL_SUBS_BIND_REQ */
DL_SUBS_UNBIND_PND = 0x15 /* Waiting ack of DL_SUBS_UNBIND_REQ */
};
/* DL_ERROR_ACK error return values*/
enum {
DL_ACCESS = 0x02, /* Improper permissions for request, LLI compatibility */
DL_BADADDR = 0x01, /* DLSAP address in improper format or invalid */
DL_BADCORR = 0x05, /* Sequence number not from outstanding DL_CONN_IND */
DL_BADDATA = 0x06, /* User data exceeded provider limit */
DL_BADPPA = 0x08, /* Specified PPA was invalid */
DL_BADPRIM = 0x09, /* Primitive received is not known by DLS provider */
DL_BADQOSPARAM = 0x0A, /* QOS parameters contained invalid values */
DL_BADQOSTYPE = 0x0B, /* QOS structure type is unknown or unsupported */
DL_BADSAP = 0x00, /* Bad LSAP selector, LLI compatibility */
DL_BADTOKEN = 0x0C, /* Token used not associated with an active stream */
DL_BOUND = 0x0D, /* Attempted second bind with dl_max_conind or */
/* dl_conn_mgmt > 0 on same DLSAP or PPA */
DL_INITFAILED = 0x0E, /* Physical Link initialization failed */
DL_NOADDR = 0x0F, /* Provider couldn't allocate alternate address */
DL_NOTINIT = 0x10, /* Physical Link not initialized */
DL_OUTSTATE = 0x03, /* Primitive issued in improper state, LLI compatibility */
DL_SYSERR = 0x04, /* UNIX system error occurred, LLI compatibility */
DL_UNSUPPORTED = 0x07, /* Requested service not supplied by provider */
DL_UNDELIVERABLE = 0x11, /* Previous data unit could not be delivered */
DL_NOTSUPPORTED = 0x12, /* Primitive is known but not supported by DLS provider */
DL_TOOMANY = 0x13, /* limit exceeded */
DL_NOTENAB = 0x14, /* Promiscuous mode not enabled */
DL_BUSY = 0x15, /* Other streams for a particular PPA in the post-attached state */
DL_NOAUTO = 0x16, /* Automatic handling of XID & TEST responses not supported */
DL_NOXIDAUTO = 0x17, /* Automatic handling of XID not supported */
DL_NOTESTAUTO = 0x18, /* Automatic handling of TEST not supported */
DL_XIDAUTO = 0x19, /* Automatic handling of XID response */
DL_TESTAUTO = 0x1A, /* AUtomatic handling of TEST response*/
DL_PENDING = 0x1B /* pending outstanding connect indications */
};
/* DLPI media types supported*/
enum {
DL_CSMACD = 0x00, /* IEEE 802.3 CSMA/CD network, LLI Compatibility */
DL_TPB = 0x01, /* IEEE 802.4 Token Passing Bus, LLI Compatibility */
DL_TPR = 0x02, /* IEEE 802.5 Token Passing Ring, LLI Compatibility */
DL_METRO = 0x03, /* IEEE 802.6 Metro Net, LLI Compatibility */
DL_ETHER = 0x04, /* Ethernet Bus, LLI Compatibility */
DL_HDLC = 0x05, /* ISO HDLC protocol support, bit synchronous */
DL_CHAR = 0x06, /* Character Synchronous protocol support, eg BISYNC */
DL_CTCA = 0x07, /* IBM Channel-to-Channel Adapter */
DL_FDDI = 0x08, /* Fiber Distributed data interface */
DL_OTHER = 0x09 /* Any other medium not listed above */
};
/*
DLPI provider service supported.
These must be allowed to be bitwise-OR for dl_service_mode in
DL_INFO_ACK.
*/
enum {
DL_CODLS = 0x01, /* support connection-oriented service */
DL_CLDLS = 0x02, /* support connectionless data link service */
DL_ACLDLS = 0x04 /* support acknowledged connectionless service*/
};
/*
DLPI provider style.
The DLPI provider style which determines whether a provider
requires a DL_ATTACH_REQ to inform the provider which PPA
user messages should be sent/received on.
*/
enum {
DL_STYLE1 = 0x0500, /* PPA is implicitly bound by open(2) */
DL_STYLE2 = 0x0501 /* PPA must be explicitly bound via DL_ATTACH_REQ */
};
/* DLPI Originator for Disconnect and Resets*/
enum {
DL_PROVIDER = 0x0700,
DL_USER = 0x0701
};
/* DLPI Disconnect Reasons*/
enum {
DL_CONREJ_DEST_UNKNOWN = 0x0800,
DL_CONREJ_DEST_UNREACH_PERMANENT = 0x0801,
DL_CONREJ_DEST_UNREACH_TRANSIENT = 0x0802,
DL_CONREJ_QOS_UNAVAIL_PERMANENT = 0x0803,
DL_CONREJ_QOS_UNAVAIL_TRANSIENT = 0x0804,
DL_CONREJ_PERMANENT_COND = 0x0805,
DL_CONREJ_TRANSIENT_COND = 0x0806,
DL_DISC_ABNORMAL_CONDITION = 0x0807,
DL_DISC_NORMAL_CONDITION = 0x0808,
DL_DISC_PERMANENT_CONDITION = 0x0809,
DL_DISC_TRANSIENT_CONDITION = 0x080A,
DL_DISC_UNSPECIFIED = 0x080B
};
/* DLPI Reset Reasons*/
enum {
DL_RESET_FLOW_CONTROL = 0x0900,
DL_RESET_LINK_ERROR = 0x0901,
DL_RESET_RESYNCH = 0x0902
};
/* DLPI status values for acknowledged connectionless data transfer*/
enum {
DL_CMD_MASK = 0x0F, /* mask for command portion of status */
DL_CMD_OK = 0x00, /* Command Accepted */
DL_CMD_RS = 0x01, /* Unimplemented or inactivated service */
DL_CMD_UE = 0x05, /* Data Link User interface error */
DL_CMD_PE = 0x06, /* Protocol error */
DL_CMD_IP = 0x07, /* Permanent implementation dependent error*/
DL_CMD_UN = 0x09, /* Resources temporarily unavailable */
DL_CMD_IT = 0x0F, /* Temporary implementation dependent error */
DL_RSP_MASK = 0xF0, /* mask for response portion of status */
DL_RSP_OK = 0x00, /* Response DLSDU present */
DL_RSP_RS = 0x10, /* Unimplemented or inactivated service */
DL_RSP_NE = 0x30, /* Response DLSDU never submitted */
DL_RSP_NR = 0x40, /* Response DLSDU not requested */
DL_RSP_UE = 0x50, /* Data Link User interface error */
DL_RSP_IP = 0x70, /* Permanent implementation dependent error */
DL_RSP_UN = 0x90, /* Resources temporarily unavailable */
DL_RSP_IT = 0xF0 /* Temporary implementation dependent error */
};
/* Service Class values for acknowledged connectionless data transfer*/
enum {
DL_RQST_RSP = 0x01, /* Use acknowledge capability in MAC sublayer*/
DL_RQST_NORSP = 0x02 /* No acknowledgement service requested */
};
/* DLPI address type definition*/
enum {
DL_FACT_PHYS_ADDR = 0x01, /* factory physical address */
DL_CURR_PHYS_ADDR = 0x02 /* current physical address */
};
/* DLPI flag definitions*/
enum {
DL_POLL_FINAL = 0x01 /* if set,indicates poll/final bit set*/
};
/* XID and TEST responses supported by the provider*/
enum {
DL_AUTO_XID = 0x01, /* provider will respond to XID */
DL_AUTO_TEST = 0x02 /* provider will respond to TEST */
};
/* Subsequent bind type*/
enum {
DL_PEER_BIND = 0x01, /* subsequent bind on a peer addr */
DL_HIERARCHICAL_BIND = 0x02 /* subs_bind on a hierarchical addr*/
};
/* DLPI promiscuous mode definitions*/
enum {
DL_PROMISC_PHYS = 0x01, /* promiscuous mode at phys level */
DL_PROMISC_SAP = 0x02, /* promiscous mode at sap level */
DL_PROMISC_MULTI = 0x03 /* promiscuous mode for multicast */
};
/* M_DATA "raw" mode */
#define DLIOCRAW MIOC_CMD(MIOC_DLPI,1)
/*
DLPI Quality Of Service definition for use in QOS structure definitions.
The QOS structures are used in connection establishment, DL_INFO_ACK,
and setting connectionless QOS values.
*/
/*
Throughput
This parameter is specified for both directions.
*/
struct dl_through_t {
SInt32 dl_target_value; /* desired bits/second desired */
SInt32 dl_accept_value; /* min. acceptable bits/second */
};
typedef struct dl_through_t dl_through_t;
/*
transit delay specification
This parameter is specified for both directions.
expressed in milliseconds assuming a DLSDU size of 128 octets.
The scaling of the value to the current DLSDU size is provider dependent.
*/
struct dl_transdelay_t {
SInt32 dl_target_value; /* desired value of service */
SInt32 dl_accept_value; /* min. acceptable value of service */
};
typedef struct dl_transdelay_t dl_transdelay_t;
/*
priority specification
priority range is 0-100, with 0 being highest value.
*/
struct dl_priority_t {
SInt32 dl_min;
SInt32 dl_max;
};
typedef struct dl_priority_t dl_priority_t;
/* protection specification*/
enum {
DL_NONE = 0x0B01, /* no protection supplied */
DL_MONITOR = 0x0B02, /* protection against passive monitoring */
DL_MAXIMUM = 0x0B03 /* protection against modification, replay, addition, or deletion */
};
struct dl_protect_t {
SInt32 dl_min;
SInt32 dl_max;
};
typedef struct dl_protect_t dl_protect_t;
/*
Resilience specification
probabilities are scaled by a factor of 10,000 with a time interval
of 10,000 seconds.
*/
struct dl_resilience_t {
SInt32 dl_disc_prob; /* probability of provider init DISC */
SInt32 dl_reset_prob; /* probability of provider init RESET */
};
typedef struct dl_resilience_t dl_resilience_t;
/*
QOS type definition to be used for negotiation with the
remote end of a connection, or a connectionless unitdata request.
There are two type definitions to handle the negotiation
process at connection establishment. The typedef dl_qos_range_t
is used to present a range for parameters. This is used
in the DL_CONNECT_REQ and DL_CONNECT_IND messages. The typedef
dl_qos_sel_t is used to select a specific value for the QOS
parameters. This is used in the DL_CONNECT_RES, DL_CONNECT_CON,
and DL_INFO_ACK messages to define the selected QOS parameters
for a connection.
NOTE
A DataLink provider which has unknown values for any of the fields
will use a value of DL_UNKNOWN for all values in the fields.
NOTE
A QOS parameter value of DL_QOS_DONT_CARE informs the DLS
provider the user requesting this value doesn't care
what the QOS parameter is set to. This value becomes the
least possible value in the range of QOS parameters.
The order of the QOS parameter range is then:
DL_QOS_DONT_CARE < 0 < MAXIMUM QOS VALUE
*/
enum {
DL_UNKNOWN = -1,
DL_QOS_DONT_CARE = -2
};
/*
Every QOS structure has the first 4 bytes containing a type
field, denoting the definition of the rest of the structure.
This is used in the same manner has the dl_primitive variable
is in messages.
The following list is the defined QOS structure type values and structures.
*/
enum {
DL_QOS_CO_RANGE1 = 0x0101, /* QOS range struct. for Connection modeservice */
DL_QOS_CO_SEL1 = 0x0102, /* QOS selection structure */
DL_QOS_CL_RANGE1 = 0x0103, /* QOS range struct. for connectionless*/
DL_QOS_CL_SEL1 = 0x0104 /* QOS selection for connectionless mode*/
};
struct dl_qos_co_range1_t {
UInt32 dl_qos_type;
dl_through_t dl_rcv_throughput; /* desired and acceptable*/
dl_transdelay_t dl_rcv_trans_delay; /* desired and acceptable*/
dl_through_t dl_xmt_throughput;
dl_transdelay_t dl_xmt_trans_delay;
dl_priority_t dl_priority; /* min and max values */
dl_protect_t dl_protection; /* min and max values */
SInt32 dl_residual_error;
dl_resilience_t dl_resilience;
};
typedef struct dl_qos_co_range1_t dl_qos_co_range1_t;
struct dl_qos_co_sel1_t {
UInt32 dl_qos_type;
SInt32 dl_rcv_throughput;
SInt32 dl_rcv_trans_delay;
SInt32 dl_xmt_throughput;
SInt32 dl_xmt_trans_delay;
SInt32 dl_priority;
SInt32 dl_protection;
SInt32 dl_residual_error;
dl_resilience_t dl_resilience;
};
typedef struct dl_qos_co_sel1_t dl_qos_co_sel1_t;
struct dl_qos_cl_range1_t {
UInt32 dl_qos_type;
dl_transdelay_t dl_trans_delay;
dl_priority_t dl_priority;
dl_protect_t dl_protection;
SInt32 dl_residual_error;
};
typedef struct dl_qos_cl_range1_t dl_qos_cl_range1_t;
struct dl_qos_cl_sel1_t {
UInt32 dl_qos_type;
SInt32 dl_trans_delay;
SInt32 dl_priority;
SInt32 dl_protection;
SInt32 dl_residual_error;
};
typedef struct dl_qos_cl_sel1_t dl_qos_cl_sel1_t;
/*
DLPI interface primitive definitions.
Each primitive is sent as a stream message. It is possible that
the messages may be viewed as a sequence of bytes that have the
following form without any padding. The structure definition
of the following messages may have to change depending on the
underlying hardware architecture and crossing of a hardware
boundary with a different hardware architecture.
Fields in the primitives having a name of the form
dl_reserved cannot be used and have the value of
binary zero, no bits turned on.
Each message has the name defined followed by the
stream message type (M_PROTO, M_PCPROTO, M_DATA)
*/
/* LOCAL MANAGEMENT SERVICE PRIMITIVES*/
/* DL_INFO_REQ, M_PCPROTO type*/
struct dl_info_req_t {
UInt32 dl_primitive; /* set to DL_INFO_REQ */
};
typedef struct dl_info_req_t dl_info_req_t;
/* DL_INFO_ACK, M_PCPROTO type*/
struct dl_info_ack_t {
UInt32 dl_primitive; /* set to DL_INFO_ACK */
UInt32 dl_max_sdu; /* Max bytes in a DLSDU */
UInt32 dl_min_sdu; /* Min bytes in a DLSDU */
UInt32 dl_addr_length; /* length of DLSAP address */
UInt32 dl_mac_type; /* type of medium supported*/
UInt32 dl_reserved; /* value set to zero */
UInt32 dl_current_state; /* state of DLPI interface */
SInt32 dl_sap_length; /* current length of SAP part of dlsap address */
UInt32 dl_service_mode; /* CO, CL or ACL */
UInt32 dl_qos_length; /* length of qos values */
UInt32 dl_qos_offset; /* offset from beg. of block*/
UInt32 dl_qos_range_length; /* available range of qos */
UInt32 dl_qos_range_offset; /* offset from beg. of block*/
UInt32 dl_provider_style; /* style1 or style2 */
UInt32 dl_addr_offset; /* offset of the dlsap addr */
UInt32 dl_version; /* version number */
UInt32 dl_brdcst_addr_length; /* length of broadcast addr */
UInt32 dl_brdcst_addr_offset; /* offset from beg. of block*/
UInt32 dl_growth; /* set to zero */
};
typedef struct dl_info_ack_t dl_info_ack_t;
/* DL_ATTACH_REQ, M_PROTO type*/
struct dl_attach_req_t {
UInt32 dl_primitive; /* set to DL_ATTACH_REQ*/
UInt32 dl_ppa; /* id of the PPA */
};
typedef struct dl_attach_req_t dl_attach_req_t;
/* DL_DETACH_REQ, M_PROTO type*/
struct dl_detach_req_t {
UInt32 dl_primitive; /* set to DL_DETACH_REQ */
};
typedef struct dl_detach_req_t dl_detach_req_t;
/* DL_BIND_REQ, M_PROTO type*/
struct dl_bind_req_t {
UInt32 dl_primitive; /* set to DL_BIND_REQ */
UInt32 dl_sap; /* info to identify dlsap addr*/
UInt32 dl_max_conind; /* max # of outstanding con_ind*/
UInt16 dl_service_mode; /* CO, CL or ACL */
UInt16 dl_conn_mgmt; /* if non-zero, is con-mgmt stream*/
UInt32 dl_xidtest_flg; /* if set to 1 indicates automatic initiation of test and xid frames */
};
typedef struct dl_bind_req_t dl_bind_req_t;
/* DL_BIND_ACK, M_PCPROTO type*/
struct dl_bind_ack_t {
UInt32 dl_primitive; /* DL_BIND_ACK */
UInt32 dl_sap; /* DLSAP addr info */
UInt32 dl_addr_length; /* length of complete DLSAP addr */
UInt32 dl_addr_offset; /* offset from beginning of M_PCPROTO*/
UInt32 dl_max_conind; /* allowed max. # of con-ind */
UInt32 dl_xidtest_flg; /* responses supported by provider*/
};
typedef struct dl_bind_ack_t dl_bind_ack_t;
/* DL_SUBS_BIND_REQ, M_PROTO type*/
struct dl_subs_bind_req_t {
UInt32 dl_primitive; /* DL_SUBS_BIND_REQ */
UInt32 dl_subs_sap_offset; /* offset of subs_sap */
UInt32 dl_subs_sap_length; /* length of subs_sap */
UInt32 dl_subs_bind_class; /* peer or hierarchical */
};
typedef struct dl_subs_bind_req_t dl_subs_bind_req_t;
/* DL_SUBS_BIND_ACK, M_PCPROTO type*/
struct dl_subs_bind_ack_t {
UInt32 dl_primitive; /* DL_SUBS_BIND_ACK */
UInt32 dl_subs_sap_offset; /* offset of subs_sap */
UInt32 dl_subs_sap_length; /* length of subs_sap */
};
typedef struct dl_subs_bind_ack_t dl_subs_bind_ack_t;
/* DL_UNBIND_REQ, M_PROTO type*/
struct dl_unbind_req_t {
UInt32 dl_primitive; /* DL_UNBIND_REQ */
};
typedef struct dl_unbind_req_t dl_unbind_req_t;
/* DL_SUBS_UNBIND_REQ, M_PROTO type*/
struct dl_subs_unbind_req_t {
UInt32 dl_primitive; /* DL_SUBS_UNBIND_REQ */
UInt32 dl_subs_sap_offset; /* offset of subs_sap */
UInt32 dl_subs_sap_length; /* length of subs_sap */
};
typedef struct dl_subs_unbind_req_t dl_subs_unbind_req_t;
/* DL_OK_ACK, M_PCPROTO type*/
struct dl_ok_ack_t {
UInt32 dl_primitive; /* DL_OK_ACK */
UInt32 dl_correct_primitive; /* primitive being acknowledged */
};
typedef struct dl_ok_ack_t dl_ok_ack_t;
/* DL_ERROR_ACK, M_PCPROTO type*/
struct dl_error_ack_t {
UInt32 dl_primitive; /* DL_ERROR_ACK */
UInt32 dl_error_primitive; /* primitive in error */
UInt32 dl_errno; /* DLPI error code */
UInt32 dl_unix_errno; /* UNIX system error code */
};
typedef struct dl_error_ack_t dl_error_ack_t;
/* DL_ENABMULTI_REQ, M_PROTO type*/
struct dl_enabmulti_req_t {
UInt32 dl_primitive; /* DL_ENABMULTI_REQ */
UInt32 dl_addr_length; /* length of multicast address */
UInt32 dl_addr_offset; /* offset from beg. of M_PROTO block*/
};
typedef struct dl_enabmulti_req_t dl_enabmulti_req_t;
/* DL_DISABMULTI_REQ, M_PROTO type*/
struct dl_disabmulti_req_t {
UInt32 dl_primitive; /* DL_DISABMULTI_REQ */
UInt32 dl_addr_length; /* length of multicast address */
UInt32 dl_addr_offset; /* offset from beg. of M_PROTO block*/
};
typedef struct dl_disabmulti_req_t dl_disabmulti_req_t;
/* DL_PROMISCON_REQ, M_PROTO type*/
struct dl_promiscon_req_t {
UInt32 dl_primitive; /* DL_PROMISCON_REQ */
UInt32 dl_level; /* physical,SAP level or ALL multicast*/
};
typedef struct dl_promiscon_req_t dl_promiscon_req_t;
/* DL_PROMISCOFF_REQ, M_PROTO type*/
struct dl_promiscoff_req_t {
UInt32 dl_primitive; /* DL_PROMISCOFF_REQ */
UInt32 dl_level; /* Physical,SAP level or ALL multicast*/
};
typedef struct dl_promiscoff_req_t dl_promiscoff_req_t;
/* Primitives to get and set the Physical address*/
/* DL_PHYS_ADDR_REQ, M_PROTO type*/
struct dl_phys_addr_req_t {
UInt32 dl_primitive; /* DL_PHYS_ADDR_REQ */
UInt32 dl_addr_type; /* factory or current physical addr */
};
typedef struct dl_phys_addr_req_t dl_phys_addr_req_t;
/* DL_PHYS_ADDR_ACK, M_PCPROTO type*/
struct dl_phys_addr_ack_t {
UInt32 dl_primitive; /* DL_PHYS_ADDR_ACK */
UInt32 dl_addr_length; /* length of the physical addr */
UInt32 dl_addr_offset; /* offset from beg. of block */
};
typedef struct dl_phys_addr_ack_t dl_phys_addr_ack_t;
/* DL_SET_PHYS_ADDR_REQ, M_PROTO type*/
struct dl_set_phys_addr_req_t {
UInt32 dl_primitive; /* DL_SET_PHYS_ADDR_REQ */
UInt32 dl_addr_length; /* length of physical addr */
UInt32 dl_addr_offset; /* offset from beg. of block */
};
typedef struct dl_set_phys_addr_req_t dl_set_phys_addr_req_t;
/* Primitives to get statistics*/
/* DL_GET_STATISTICS_REQ, M_PROTO type*/
struct dl_get_statistics_req_t {
UInt32 dl_primitive; /* DL_GET_STATISTICS_REQ */
};
typedef struct dl_get_statistics_req_t dl_get_statistics_req_t;
/* DL_GET_STATISTICS_ACK, M_PCPROTO type*/
struct dl_get_statistics_ack_t {
UInt32 dl_primitive; /* DL_GET_STATISTICS_ACK */
UInt32 dl_stat_length; /* length of statistics structure*/
UInt32 dl_stat_offset; /* offset from beg. of block */
};
typedef struct dl_get_statistics_ack_t dl_get_statistics_ack_t;
/* CONNECTION-ORIENTED SERVICE PRIMITIVES*/
/* DL_CONNECT_REQ, M_PROTO type*/
struct dl_connect_req_t {
UInt32 dl_primitive; /* DL_CONNECT_REQ */
UInt32 dl_dest_addr_length; /* len. of dlsap addr*/
UInt32 dl_dest_addr_offset; /* offset */
UInt32 dl_qos_length; /* len. of QOS parm val*/
UInt32 dl_qos_offset; /* offset */
UInt32 dl_growth; /* set to zero */
};
typedef struct dl_connect_req_t dl_connect_req_t;
/* DL_CONNECT_IND, M_PROTO type*/
struct dl_connect_ind_t {
UInt32 dl_primitive; /* DL_CONNECT_IND */
UInt32 dl_correlation; /* provider's correlation token*/
UInt32 dl_called_addr_length; /* length of called address */
UInt32 dl_called_addr_offset; /* offset from beginning of block */
UInt32 dl_calling_addr_length; /* length of calling address */
UInt32 dl_calling_addr_offset; /* offset from beginning of block */
UInt32 dl_qos_length; /* length of qos structure */
UInt32 dl_qos_offset; /* offset from beginning of block */
UInt32 dl_growth; /* set to zero */
};
typedef struct dl_connect_ind_t dl_connect_ind_t;
/* DL_CONNECT_RES, M_PROTO type*/
struct dl_connect_res_t {
UInt32 dl_primitive; /* DL_CONNECT_RES */
UInt32 dl_correlation; /* provider's correlation token */
UInt32 dl_resp_token; /* token associated with responding stream */
UInt32 dl_qos_length; /* length of qos structure */
UInt32 dl_qos_offset; /* offset from beginning of block */
UInt32 dl_growth; /* set to zero */
};
typedef struct dl_connect_res_t dl_connect_res_t;
/* DL_CONNECT_CON, M_PROTO type*/
struct dl_connect_con_t {
UInt32 dl_primitive; /* DL_CONNECT_CON*/
UInt32 dl_resp_addr_length; /* length of responder's address */
UInt32 dl_resp_addr_offset; /* offset from beginning of block*/
UInt32 dl_qos_length; /* length of qos structure */
UInt32 dl_qos_offset; /* offset from beginning of block*/
UInt32 dl_growth; /* set to zero */
};
typedef struct dl_connect_con_t dl_connect_con_t;
/* DL_TOKEN_REQ, M_PCPROTO type*/
struct dl_token_req_t {
UInt32 dl_primitive; /* DL_TOKEN_REQ */
};
typedef struct dl_token_req_t dl_token_req_t;
/* DL_TOKEN_ACK, M_PCPROTO type*/
struct dl_token_ack_t {
UInt32 dl_primitive; /* DL_TOKEN_ACK */
UInt32 dl_token; /* Connection response token associated with the stream */
};
typedef struct dl_token_ack_t dl_token_ack_t;
/* DL_DISCONNECT_REQ, M_PROTO type*/
struct dl_disconnect_req_t {
UInt32 dl_primitive; /* DL_DISCONNECT_REQ */
UInt32 dl_reason; /*normal, abnormal, perm. or transient*/
UInt32 dl_correlation; /* association with connect_ind */
};
typedef struct dl_disconnect_req_t dl_disconnect_req_t;
/* DL_DISCONNECT_IND, M_PROTO type*/
struct dl_disconnect_ind_t {
UInt32 dl_primitive; /* DL_DISCONNECT_IND */
UInt32 dl_originator; /* USER or PROVIDER */
UInt32 dl_reason; /* permanent or transient */
UInt32 dl_correlation; /* association with connect_ind */
};
typedef struct dl_disconnect_ind_t dl_disconnect_ind_t;
/* DL_RESET_REQ, M_PROTO type*/
struct dl_reset_req_t {
UInt32 dl_primitive; /* DL_RESET_REQ */
};
typedef struct dl_reset_req_t dl_reset_req_t;
/* DL_RESET_IND, M_PROTO type*/
struct dl_reset_ind_t {
UInt32 dl_primitive; /* DL_RESET_IND */
UInt32 dl_originator; /* Provider or User */
UInt32 dl_reason; /* flow control, link error or resynch*/
};
typedef struct dl_reset_ind_t dl_reset_ind_t;
/* DL_RESET_RES, M_PROTO type*/
struct dl_reset_res_t {
UInt32 dl_primitive; /* DL_RESET_RES */
};
typedef struct dl_reset_res_t dl_reset_res_t;
/* DL_RESET_CON, M_PROTO type*/
struct dl_reset_con_t {
UInt32 dl_primitive; /* DL_RESET_CON */
};
typedef struct dl_reset_con_t dl_reset_con_t;
/* CONNECTIONLESS SERVICE PRIMITIVES*/
/* DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s)*/
struct dl_unitdata_req_t {
UInt32 dl_primitive; /* DL_UNITDATA_REQ */
UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
dl_priority_t dl_priority; /* priority value */
};
typedef struct dl_unitdata_req_t dl_unitdata_req_t;
/* DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s)*/
struct dl_unitdata_ind_t {
UInt32 dl_primitive; /* DL_UNITDATA_IND */
UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
UInt32 dl_src_addr_length; /* DLSAP addr length of sending user*/
UInt32 dl_src_addr_offset; /* offset from beg. of block */
UInt32 dl_group_address; /* set to one if multicast/broadcast*/
};
typedef struct dl_unitdata_ind_t dl_unitdata_ind_t;
/*
DL_UDERROR_IND, M_PROTO type
(or M_PCPROTO type if LLI-based provider)
*/
struct dl_uderror_ind_t {
UInt32 dl_primitive; /* DL_UDERROR_IND */
UInt32 dl_dest_addr_length; /* Destination DLSAP */
UInt32 dl_dest_addr_offset; /* Offset from beg. of block */
UInt32 dl_unix_errno; /* unix system error code*/
UInt32 dl_errno; /* DLPI error code */
};
typedef struct dl_uderror_ind_t dl_uderror_ind_t;
/* DL_UDQOS_REQ, M_PROTO type*/
struct dl_udqos_req_t {
UInt32 dl_primitive; /* DL_UDQOS_REQ */
UInt32 dl_qos_length; /* length in bytes of requested qos*/
UInt32 dl_qos_offset; /* offset from beg. of block */
};
typedef struct dl_udqos_req_t dl_udqos_req_t;
/* Primitives to handle XID and TEST operations*/
/* DL_TEST_REQ, M_PROTO type*/
struct dl_test_req_t {
UInt32 dl_primitive; /* DL_TEST_REQ */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
};
typedef struct dl_test_req_t dl_test_req_t;
/* DL_TEST_IND, M_PROTO type*/
struct dl_test_ind_t {
UInt32 dl_primitive; /* DL_TEST_IND */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
UInt32 dl_src_addr_length; /* dlsap length of source user */
UInt32 dl_src_addr_offset; /* offset from beg. of block */
};
typedef struct dl_test_ind_t dl_test_ind_t;
/* DL_TEST_RES, M_PROTO type*/
struct dl_test_res_t {
UInt32 dl_primitive; /* DL_TEST_RES */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
};
typedef struct dl_test_res_t dl_test_res_t;
/* DL_TEST_CON, M_PROTO type*/
struct dl_test_con_t {
UInt32 dl_primitive; /* DL_TEST_CON */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
UInt32 dl_src_addr_length; /* dlsap length of source user */
UInt32 dl_src_addr_offset; /* offset from beg. of block */
};
typedef struct dl_test_con_t dl_test_con_t;
/* DL_XID_REQ, M_PROTO type*/
struct dl_xid_req_t {
UInt32 dl_primitive; /* DL_XID_REQ */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
};
typedef struct dl_xid_req_t dl_xid_req_t;
/* DL_XID_IND, M_PROTO type*/
struct dl_xid_ind_t {
UInt32 dl_primitive; /* DL_XID_IND */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
UInt32 dl_src_addr_length; /* dlsap length of source user */
UInt32 dl_src_addr_offset; /* offset from beg. of block */
};
typedef struct dl_xid_ind_t dl_xid_ind_t;
/* DL_XID_RES, M_PROTO type*/
struct dl_xid_res_t {
UInt32 dl_primitive; /* DL_XID_RES */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
};
typedef struct dl_xid_res_t dl_xid_res_t;
/* DL_XID_CON, M_PROTO type*/
struct dl_xid_con_t {
UInt32 dl_primitive; /* DL_XID_CON */
UInt32 dl_flag; /* poll/final */
UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
UInt32 dl_dest_addr_offset; /* offset from beg. of block */
UInt32 dl_src_addr_length; /* dlsap length of source user */
UInt32 dl_src_addr_offset; /* offset from beg. of block */
};
typedef struct dl_xid_con_t dl_xid_con_t;
/* ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES*/
/* DL_DATA_ACK_REQ, M_PROTO type*/
struct dl_data_ack_req_t {
UInt32 dl_primitive; /* DL_DATA_ACK_REQ */
UInt32 dl_correlation; /* User's correlation token */
UInt32 dl_dest_addr_length; /* length of destination addr */
UInt32 dl_dest_addr_offset; /* offset from beginning of block */
UInt32 dl_src_addr_length; /* length of source address */
UInt32 dl_src_addr_offset; /* offset from beginning of block */
UInt32 dl_priority; /* priority */
UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
};
typedef struct dl_data_ack_req_t dl_data_ack_req_t;
/* DL_DATA_ACK_IND, M_PROTO type*/
struct dl_data_ack_ind_t {
UInt32 dl_primitive; /* DL_DATA_ACK_IND */
UInt32 dl_dest_addr_length; /* length of destination addr */
UInt32 dl_dest_addr_offset; /* offset from beginning of block */
UInt32 dl_src_addr_length; /* length of source address */
UInt32 dl_src_addr_offset; /* offset from beginning of block */
UInt32 dl_priority; /* priority for data unit transm. */
UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
};
typedef struct dl_data_ack_ind_t dl_data_ack_ind_t;
/* DL_DATA_ACK_STATUS_IND, M_PROTO type*/
struct dl_data_ack_status_ind_t {
UInt32 dl_primitive; /* DL_DATA_ACK_STATUS_IND */
UInt32 dl_correlation; /* User's correlation token */
UInt32 dl_status; /* success or failure of previous req*/
};
typedef struct dl_data_ack_status_ind_t dl_data_ack_status_ind_t;
/* DL_REPLY_REQ, M_PROTO type*/
struct dl_reply_req_t {
UInt32 dl_primitive; /* DL_REPLY_REQ */
UInt32 dl_correlation; /* User's correlation token */
UInt32 dl_dest_addr_length; /* length of destination address */
UInt32 dl_dest_addr_offset; /* offset from beginning of block */
UInt32 dl_src_addr_length; /* source address length */
UInt32 dl_src_addr_offset; /* offset from beginning of block */
UInt32 dl_priority; /* priority for data unit transmission*/
UInt32 dl_service_class;
};
typedef struct dl_reply_req_t dl_reply_req_t;
/* DL_REPLY_IND, M_PROTO type*/
struct dl_reply_ind_t {
UInt32 dl_primitive; /* DL_REPLY_IND */
UInt32 dl_dest_addr_length; /* length of destination address */
UInt32 dl_dest_addr_offset; /* offset from beginning of block*/
UInt32 dl_src_addr_length; /* length of source address */
UInt32 dl_src_addr_offset; /* offset from beginning of block */
UInt32 dl_priority; /* priority for data unit transmission*/
UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
};
typedef struct dl_reply_ind_t dl_reply_ind_t;
/* DL_REPLY_STATUS_IND, M_PROTO type*/
struct dl_reply_status_ind_t {
UInt32 dl_primitive; /* DL_REPLY_STATUS_IND */
UInt32 dl_correlation; /* User's correlation token */
UInt32 dl_status; /* success or failure of previous req*/
};
typedef struct dl_reply_status_ind_t dl_reply_status_ind_t;
/* DL_REPLY_UPDATE_REQ, M_PROTO type*/
struct dl_reply_update_req_t {
UInt32 dl_primitive; /* DL_REPLY_UPDATE_REQ */
UInt32 dl_correlation; /* user's correlation token */
UInt32 dl_src_addr_length; /* length of source address */
UInt32 dl_src_addr_offset; /* offset from beginning of block */
};
typedef struct dl_reply_update_req_t dl_reply_update_req_t;
/* DL_REPLY_UPDATE_STATUS_IND, M_PROTO type*/
struct dl_reply_update_status_ind_t {
UInt32 dl_primitive; /* DL_REPLY_UPDATE_STATUS_IND */
UInt32 dl_correlation; /* User's correlation token */
UInt32 dl_status; /* success or failure of previous req*/
};
typedef struct dl_reply_update_status_ind_t dl_reply_update_status_ind_t;
union DL_primitives {
UInt32 dl_primitive;
dl_info_req_t info_req;
dl_info_ack_t info_ack;
dl_attach_req_t attach_req;
dl_detach_req_t detach_req;
dl_bind_req_t bind_req;
dl_bind_ack_t bind_ack;
dl_unbind_req_t unbind_req;
dl_subs_bind_req_t subs_bind_req;
dl_subs_bind_ack_t subs_bind_ack;
dl_subs_unbind_req_t subs_unbind_req;
dl_ok_ack_t ok_ack;
dl_error_ack_t error_ack;
dl_connect_req_t connect_req;
dl_connect_ind_t connect_ind;
dl_connect_res_t connect_res;
dl_connect_con_t connect_con;
dl_token_req_t token_req;
dl_token_ack_t token_ack;
dl_disconnect_req_t disconnect_req;
dl_disconnect_ind_t disconnect_ind;
dl_reset_req_t reset_req;
dl_reset_ind_t reset_ind;
dl_reset_res_t reset_res;
dl_reset_con_t reset_con;
dl_unitdata_req_t unitdata_req;
dl_unitdata_ind_t unitdata_ind;
dl_uderror_ind_t uderror_ind;
dl_udqos_req_t udqos_req;
dl_enabmulti_req_t enabmulti_req;
dl_disabmulti_req_t disabmulti_req;
dl_promiscon_req_t promiscon_req;
dl_promiscoff_req_t promiscoff_req;
dl_phys_addr_req_t physaddr_req;
dl_phys_addr_ack_t physaddr_ack;
dl_set_phys_addr_req_t set_physaddr_req;
dl_get_statistics_req_t get_statistics_req;
dl_get_statistics_ack_t get_statistics_ack;
dl_test_req_t test_req;
dl_test_ind_t test_ind;
dl_test_res_t test_res;
dl_test_con_t test_con;
dl_xid_req_t xid_req;
dl_xid_ind_t xid_ind;
dl_xid_res_t xid_res;
dl_xid_con_t xid_con;
dl_data_ack_req_t data_ack_req;
dl_data_ack_ind_t data_ack_ind;
dl_data_ack_status_ind_t data_ack_status_ind;
dl_reply_req_t reply_req;
dl_reply_ind_t reply_ind;
dl_reply_status_ind_t reply_status_ind;
dl_reply_update_req_t reply_update_req;
dl_reply_update_status_ind_t reply_update_status_ind;
};
typedef union DL_primitives DL_primitives;
enum {
DL_INFO_REQ_SIZE = sizeof(dl_info_req_t),
DL_INFO_ACK_SIZE = sizeof(dl_info_ack_t),
DL_ATTACH_REQ_SIZE = sizeof(dl_attach_req_t),
DL_DETACH_REQ_SIZE = sizeof(dl_detach_req_t),
DL_BIND_REQ_SIZE = sizeof(dl_bind_req_t),
DL_BIND_ACK_SIZE = sizeof(dl_bind_ack_t),
DL_UNBIND_REQ_SIZE = sizeof(dl_unbind_req_t),
DL_SUBS_BIND_REQ_SIZE = sizeof(dl_subs_bind_req_t),
DL_SUBS_BIND_ACK_SIZE = sizeof(dl_subs_bind_ack_t),
DL_SUBS_UNBIND_REQ_SIZE = sizeof(dl_subs_unbind_req_t),
DL_OK_ACK_SIZE = sizeof(dl_ok_ack_t),
DL_ERROR_ACK_SIZE = sizeof(dl_error_ack_t),
DL_CONNECT_REQ_SIZE = sizeof(dl_connect_req_t),
DL_CONNECT_IND_SIZE = sizeof(dl_connect_ind_t),
DL_CONNECT_RES_SIZE = sizeof(dl_connect_res_t),
DL_CONNECT_CON_SIZE = sizeof(dl_connect_con_t),
DL_TOKEN_REQ_SIZE = sizeof(dl_token_req_t),
DL_TOKEN_ACK_SIZE = sizeof(dl_token_ack_t),
DL_DISCONNECT_REQ_SIZE = sizeof(dl_disconnect_req_t),
DL_DISCONNECT_IND_SIZE = sizeof(dl_disconnect_ind_t),
DL_RESET_REQ_SIZE = sizeof(dl_reset_req_t),
DL_RESET_IND_SIZE = sizeof(dl_reset_ind_t),
DL_RESET_RES_SIZE = sizeof(dl_reset_res_t),
DL_RESET_CON_SIZE = sizeof(dl_reset_con_t),
DL_UNITDATA_REQ_SIZE = sizeof(dl_unitdata_req_t),
DL_UNITDATA_IND_SIZE = sizeof(dl_unitdata_ind_t),
DL_UDERROR_IND_SIZE = sizeof(dl_uderror_ind_t),
DL_UDQOS_REQ_SIZE = sizeof(dl_udqos_req_t),
DL_ENABMULTI_REQ_SIZE = sizeof(dl_enabmulti_req_t),
DL_DISABMULTI_REQ_SIZE = sizeof(dl_disabmulti_req_t),
DL_PROMISCON_REQ_SIZE = sizeof(dl_promiscon_req_t),
DL_PROMISCOFF_REQ_SIZE = sizeof(dl_promiscoff_req_t),
DL_PHYS_ADDR_REQ_SIZE = sizeof(dl_phys_addr_req_t),
DL_PHYS_ADDR_ACK_SIZE = sizeof(dl_phys_addr_ack_t),
DL_SET_PHYS_ADDR_REQ_SIZE = sizeof(dl_set_phys_addr_req_t),
DL_GET_STATISTICS_REQ_SIZE = sizeof(dl_get_statistics_req_t),
DL_GET_STATISTICS_ACK_SIZE = sizeof(dl_get_statistics_ack_t),
DL_XID_REQ_SIZE = sizeof(dl_xid_req_t),
DL_XID_IND_SIZE = sizeof(dl_xid_ind_t),
DL_XID_RES_SIZE = sizeof(dl_xid_res_t),
DL_XID_CON_SIZE = sizeof(dl_xid_con_t),
DL_TEST_REQ_SIZE = sizeof(dl_test_req_t),
DL_TEST_IND_SIZE = sizeof(dl_test_ind_t),
DL_TEST_RES_SIZE = sizeof(dl_test_res_t),
DL_TEST_CON_SIZE = sizeof(dl_test_con_t),
DL_DATA_ACK_REQ_SIZE = sizeof(dl_data_ack_req_t),
DL_DATA_ACK_IND_SIZE = sizeof(dl_data_ack_ind_t),
DL_DATA_ACK_STATUS_IND_SIZE = sizeof(dl_data_ack_status_ind_t),
DL_REPLY_REQ_SIZE = sizeof(dl_reply_req_t),
DL_REPLY_IND_SIZE = sizeof(dl_reply_ind_t),
DL_REPLY_STATUS_IND_SIZE = sizeof(dl_reply_status_ind_t),
DL_REPLY_UPDATE_REQ_SIZE = sizeof(dl_reply_update_req_t),
DL_REPLY_UPDATE_STATUS_IND_SIZE = sizeof(dl_reply_update_status_ind_t)
};
enum {
DL_IOC_HDR_INFO = ((MIOC_DLPI << 8) | 10) /* Fast path request */
};
/* ***** From the Mentat "modnames.h" ******/
#define MI_AFU_NAME "afu"
#define MI_AHARP_NAME "ahar"
#define MI_AHENET_NAME "ahen"
#define MI_ARP_NAME "arp"
#define MI_ARPM_NAME "arpm"
#define MI_COURMUX_NAME "courmux"
#define MI_CLONE_NAME "clone"
#define MI_DLB_NAME "dlb"
#define MI_DLM_NAME "dlm"
#define MI_DMODD_NAME "disdlpi"
#define MI_DMODT_NAME "distpi"
#define MI_DN_NAME "dn"
#define MI_DNF_NAME "dnf"
#define MI_DRVE_NAME "drve"
#define MI_ECHO_NAME "echo"
#define MI_ENXR_NAME "enxr"
#define MI_RAWIP_NAME "rawip"
#define MI_RAWIPM_NAME "rawipm"
#define MI_HAVOC_NAME "havoc"
#define MI_HAVOCM_NAME "havocm"
#define MI_IP_NAME "ip"
#define MI_IPM_NAME "ipm"
#define MI_IPX_NAME "ipx"
#define MI_LOG_NAME "log"
#define MI_MODE_NAME "mode"
#define MI_MUX_NAME "mux"
#define MI_NECHO_NAME "necho"
#define MI_NPEP_NAME "npep"
#define MI_NULS_NAME "nuls"
#define MI_NULZ_NAME "nulz"
#define MI_PASS_NAME "pass"
#define MI_PIPEMOD_NAME "pipemod"
#define MI_SAD_NAME "sad"
#define MI_SC_NAME "sc"
#define MI_SOCKMOD_NAME "sockmod"
#define MI_SPASS_NAME "spass"
#define MI_SPX_NAME "spx"
#define MI_STH_NAME "mi_sth"
#define MI_TCP_NAME "tcp"
#define MI_TCPM_NAME "tcpm"
#define MI_TIMOD_NAME "timod"
#define MI_TIRDWR_NAME "tirdwr"
#define MI_TMOD_NAME "tmod"
#define MI_TMUX_NAME "tmux"
#define MI_TPIT_NAME "tpit"
#define MI_TRSR_NAME "trsr"
#define MI_TRXR_NAME "trxr"
#define MI_UDP_NAME "udp"
#define MI_UDPM_NAME "udpm"
#define MI_WELD_NAME "mi_weld"
#define MI_XDG_NAME "xdg"
#define MI_XECHO_NAME "xecho"
#define MI_XF_NAME "xf"
#define MI_XFIPX_NAME "xfipx"
#define MI_XFXNS_NAME "xfxns"
#define MI_XPE_NAME "xpe"
#define MI_XS_NAME "xs"
#define MI_XTINDG_NAME "xtindg"
#define MI_XTINVC_NAME "xtinvc"
#define MI_XTM_NAME "xtm"
#define MI_XTMIP_NAME "xtmip"
#define MI_AFU_DEVICE "/dev/afu"
#define MI_ARP_DEVICE "/dev/arp"
#define MI_COURMUX_DEVICE "/dev/courmux"
#define MI_CLONE_DEVICE "/dev/clone"
#define MI_DLB_DEVICE "/dev/dlb"
#define MI_DN_DEVICE "/dev/dn"
#define MI_DNF_DEVICE "/dev/dnf"
#define MI_DRVE_DEVICE "/dev/drve"
#define MI_ECHO_DEVICE "/dev/echo"
#define MI_RAWIP_DEVICE "/dev/rawip"
#define MI_HAVOC_DEVICE "/dev/havoc"
#define MI_IP_DEVICE "/dev/ip"
#define MI_IPX_DEVICE "/dev/ipx"
#define MI_LOG_DEVICE "/dev/log"
#define MI_MODE_DEVICE "/dev/mode"
#define MI_MUX_DEVICE "/dev/mux"
#define MI_NECHO_DEVICE "/dev/necho"
#define MI_NPEP_DEVICE "/dev/npep"
#define MI_NULS_DEVICE "/dev/nuls"
#define MI_NULZ_DEVICE "/dev/nulz"
#define MI_SAD_DEVICE "/dev/sad"
#define MI_SPX_DEVICE "/dev/spx"
#define MI_TCP_DEVICE "/dev/tcp"
#define MI_TMUX_DEVICE "/dev/tmux"
#define MI_TMUX0_DEVICE "/dev/tmux#0"
#define MI_TMUX1_DEVICE "/dev/tmux#1"
#define MI_TPIT_DEVICE "/dev/tpit"
#define MI_UDP_DEVICE "/dev/udp"
#define MI_XDG_DEVICE "/dev/xdg"
#define MI_XECHO_DEVICE "/dev/xecho"
#define MI_XF_DEVICE "/dev/xf"
#define MI_XPE_DEVICE "/dev/xpe"
#define MI_XS_DEVICE "/dev/xs"
#define MI_XTINDG_DEVICE "/dev/xtindg"
#define MI_XTINVC_DEVICE "/dev/xtinvc"
/* Streamtab entries */
#define MI_AFU_STREAMTAB afuinfo
#define MI_AHARP_STREAMTAB aharinfo
#define MI_AHENET_STREAMTAB aheninfo
#define MI_ARP_STREAMTAB arpinfo
#define MI_ARPM_STREAMTAB arpminfo
#define MI_COURMUX_STREAMTAB courmuxinfo
#define MI_CLONE_STREAMTAB cloneinfo
#define MI_DLB_STREAMTAB dlbinfo
#define MI_DLM_STREAMTAB dlminfo
#define MI_DMODD_STREAMTAB dmoddinfo
#define MI_DMODT_STREAMTAB dmodtinfo
#define MI_DN_STREAMTAB dninfo
#define MI_DNF_STREAMTAB dnfinfo
#define MI_DRVE_STREAMTAB drveinfo
#define MI_ECHO_STREAMTAB echoinfo
#define MI_ENXR_STREAMTAB enxrinfo
#define MI_HAVOC_STREAMTAB hvcinfo
#define MI_HAVOCM_STREAMTAB hvcminfo
#define MI_IP_STREAMTAB ipinfo
#define MI_IPM_STREAMTAB ipminfo
#define MI_IPX_STREAMTAB ipxinfo
#define MI_LOG_STREAMTAB loginfo
#define MI_MODE_STREAMTAB modeinfo
#define MI_MUX_STREAMTAB muxinfo
#define MI_NECHO_STREAMTAB nechoinfo
#define MI_NPEP_STREAMTAB npepinfo
#define MI_NULS_STREAMTAB nulsinfo
#define MI_NULZ_STREAMTAB nulzinfo
#define MI_PASS_STREAMTAB passinfo
#define MI_PIPEMOD_STREAMTAB pmodinfo
#define MI_RAWIP_STREAMTAB rawipinfo
#define MI_RAWIPM_STREAMTAB rawipminfo
#define MI_SAD_STREAMTAB sadinfo
#define MI_SC_STREAMTAB scinfo
#define MI_SOCKMOD_STREAMTAB sockmodinfo
#define MI_SPASS_STREAMTAB spassinfo
#define MI_SPX_STREAMTAB spxinfo
#define MI_STH_STREAMTAB mi_sthinfo
#define MI_TCP_STREAMTAB tcpinfo
#define MI_TCPM_STREAMTAB tcpminfo
#define MI_TIMOD_STREAMTAB timodinfo
#define MI_TIRDWR_STREAMTAB tirdwrinfo
#define MI_TMOD_STREAMTAB tmodinfo
#define MI_TMUX_STREAMTAB tmuxinfo
#define MI_TPIT_STREAMTAB tpitinfo
#define MI_TRSR_STREAMTAB trsrinfo
#define MI_TRXR_STREAMTAB trxrinfo
#define MI_UDP_STREAMTAB udpinfo
#define MI_UDPM_STREAMTAB udpminfo
#define MI_WELD_STREAMTAB mi_weldinfo
#define MI_XDG_STREAMTAB xdginfo
#define MI_XECHO_STREAMTAB xechoinfo
#define MI_XF_STREAMTAB xfinfo
#define MI_XFIPX_STREAMTAB xfipxinfo
#define MI_XFXNS_STREAMTAB xfxnsinfo
#define MI_XPE_STREAMTAB xpeinfo
#define MI_XS_STREAMTAB xsinfo
#define MI_XTINDG_STREAMTAB xtindginfo
#define MI_XTINVC_STREAMTAB xtinvcinfo
#define MI_XTM_STREAMTAB xtminfo
#define MI_XTMIP_STREAMTAB xtmipinfo
#define MI_AFU_DEVFLAG afudevflag
#define MI_AHARP_DEVFLAG ahardevflag
#define MI_AHENET_DEVFLAG ahendevflag
#define MI_ARP_DEVFLAG arpdevflag
#define MI_ARPM_DEVFLAG arpmdevflag
#define MI_COURMUX_DEVFLAG courmuxdevflag
#define MI_CLONE_DEVFLAG clonedevflag
#define MI_DLB_DEVFLAG dlbdevflag
#define MI_DLM_DEVFLAG dlmdevflag
#define MI_DMODD_DEVFLAG dmodddevflag
#define MI_DMODT_DEVFLAG dmodtdevflag
#define MI_DN_DEVFLAG dndevflag
#define MI_DNF_DEVFLAG dnfdevflag
#define MI_DRVE_DEVFLAG drvedevflag
#define MI_ECHO_DEVFLAG echodevflag
#define MI_ENXR_DEVFLAG enxrdevflag
#define MI_HAVOC_DEVFLAG hvcdevflag
#define MI_HAVOCM_DEVFLAG hvcmdevflag
#define MI_IP_DEVFLAG ipdevflag
#define MI_IPM_DEVFLAG ipmdevflag
#define MI_IPX_DEVFLAG ipxdevflag
#define MI_LOG_DEVFLAG logdevflag
#define MI_MODE_DEVFLAG modedevflag
#define MI_MUX_DEVFLAG muxdevflag
#define MI_NECHO_DEVFLAG nechodevflag
#define MI_NPEP_DEVFLAG npepdevflag
#define MI_NULS_DEVFLAG nulsdevflag
#define MI_NULZ_DEVFLAG nulzdevflag
#define MI_PASS_DEVFLAG passdevflag
#define MI_PIPEMOD_DEVFLAG pipemoddevflag
#define MI_RAWIP_DEVFLAG rawipdevflag
#define MI_RAWIPM_DEVFLAG rawipmdevflag
#define MI_SAD_DEVFLAG saddevflag
#define MI_SC_DEVFLAG scdevflag
#define MI_SOCKMOD_DEVFLAG sockmoddevflag
#define MI_SPASS_DEVFLAG spassdevflag
#define MI_SPX_DEVFLAG spxdevflag
#define MI_TCP_DEVFLAG tcpdevflag
#define MI_TCPM_DEVFLAG tcpmdevflag
#define MI_TIMOD_DEVFLAG timoddevflag
#define MI_TIRDWR_DEVFLAG tirdwrdevflag
#define MI_TMOD_DEVFLAG tmoddevflag
#define MI_TMUX_DEVFLAG tmuxdevflag
#define MI_TPIT_DEVFLAG tpitdevflag
#define MI_TRSR_DEVFLAG trsrdevflag
#define MI_TRXR_DEVFLAG trxrdevflag
#define MI_UDP_DEVFLAG udpdevflag
#define MI_UDPM_DEVFLAG udpmdevflag
#define MI_XDG_DEVFLAG xdgdevflag
#define MI_XECHO_DEVFLAG xechodevflag
#define MI_XF_DEVFLAG xfdevflag
#define MI_XFIPX_DEVFLAG xfipxdevflag
#define MI_XFXNS_DEVFLAG xfxnsdevflag
#define MI_XPE_DEVFLAG xpedevflag
#define MI_XS_DEVFLAG xsdevflag
#define MI_XTINDG_DEVFLAG xtindgdevflag
#define MI_XTINVC_DEVFLAG xtinvcdevflag
#define MI_XTM_DEVFLAG xtmdevflag
#define MI_XTMIP_DEVFLAG xtmipdevflag
#define MI_AFU_SQLVL SQLVL_QUEUEPAIR
#define MI_AHARP_SQLVL SQLVL_QUEUE
#define MI_AHENET_SQLVL SQLVL_QUEUE
#define MI_ARP_SQLVL SQLVL_MODULE
#define MI_ARPM_SQLVL SQLVL_MODULE
#define MI_COURMUX_SQLVL SQLVL_MODULE
#define MI_CLONE_SQLVL SQLVL_MODULE
#define MI_DLB_SQLVL SQLVL_QUEUE
#define MI_DLM_SQLVL SQLVL_QUEUE
#define MI_DMODD_SQLVL SQLVL_QUEUE
#define MI_DMODT_SQLVL SQLVL_QUEUE
#define MI_DN_SQLVL SQLVL_QUEUE
#define MI_DNF_SQLVL SQLVL_QUEUE
#define MI_DRVE_SQLVL SQLVL_QUEUEPAIR
#define MI_ECHO_SQLVL SQLVL_QUEUE
#define MI_ENXR_SQLVL SQLVL_QUEUE
#define MI_RAWIP_SQLVL SQLVL_QUEUE
#define MI_RAWIPM_SQLVL SQLVL_QUEUE
#define MI_HAVOC_SQLVL SQLVL_QUEUE
#define MI_HAVOCM_SQLVL SQLVL_QUEUE
#define MI_IP_SQLVL SQLVL_QUEUEPAIR
#define MI_IPM_SQLVL SQLVL_QUEUEPAIR
#define MI_IPX_SQLVL SQLVL_QUEUE
#define MI_LOG_SQLVL SQLVL_MODULE
#define MI_MODE_SQLVL SQLVL_QUEUEPAIR
#define MI_MUX_SQLVL SQLVL_MODULE
#define MI_NECHO_SQLVL SQLVL_QUEUE
#define MI_NPEP_SQLVL SQLVL_QUEUE
#define MI_NULS_SQLVL SQLVL_QUEUE
#define MI_NULZ_SQLVL SQLVL_QUEUE
#define MI_PASS_SQLVL SQLVL_QUEUE
#define MI_PIPEMOD_SQLVL SQLVL_QUEUE
#define MI_SAD_SQLVL SQLVL_MODULE
#define MI_SC_SQLVL SQLVL_QUEUE
#define MI_SOCKMOD_SQLVL SQLVL_QUEUEPAIR
#define MI_SPASS_SQLVL SQLVL_QUEUE
#define MI_SPX_SQLVL SQLVL_QUEUE
#define MI_TCP_SQLVL SQLVL_QUEUEPAIR
#define MI_TCPM_SQLVL SQLVL_QUEUEPAIR
#define MI_TIMOD_SQLVL SQLVL_QUEUEPAIR
#define MI_TIRDWR_SQLVL SQLVL_QUEUE
#define MI_TMOD_SQLVL SQLVL_QUEUEPAIR
#define MI_TMUX_SQLVL SQLVL_MODULE
#define MI_TPIT_SQLVL SQLVL_MODULE
#define MI_TRSR_SQLVL SQLVL_MODULE
#define MI_TRXR_SQLVL SQLVL_QUEUE
#define MI_UDP_SQLVL SQLVL_QUEUE
#define MI_UDPM_SQLVL SQLVL_QUEUE
#define MI_XDG_SQLVL SQLVL_QUEUE
#define MI_XECHO_SQLVL SQLVL_QUEUE
#define MI_XF_SQLVL SQLVL_MODULE
#define MI_XFIPX_SQLVL SQLVL_MODULE
#define MI_XFXNS_SQLVL SQLVL_MODULE
#define MI_XPE_SQLVL SQLVL_QUEUE
#define MI_XS_SQLVL SQLVL_QUEUEPAIR
#define MI_XTINDG_SQLVL SQLVL_QUEUEPAIR
#define MI_XTINVC_SQLVL SQLVL_QUEUEPAIR
#define MI_XTM_SQLVL SQLVL_QUEUEPAIR
#define MI_XTMIP_SQLVL SQLVL_QUEUEPAIR
/* ***** Raw Streams ******/
/*
Flags used in the fType field of OTReadInfo for functions.
I've removed the terse and confusing comments in this header
file. For a full description, read "Open Transport Advanced
Client Programming".
*/
enum {
kOTNoMessagesAvailable = (unsigned long)0xFFFFFFFF,
kOTAnyMsgType = (unsigned long)0xFFFFFFFE,
kOTDataMsgTypes = (unsigned long)0xFFFFFFFC,
kOTMProtoMsgTypes = (unsigned long)0xFFFFFFFB,
kOTOnlyMProtoMsgTypes = (unsigned long)0xFFFFFFFA
};
#if !OTKERNEL
/* StreamRef is an opaque reference to a raw stream.*/
typedef struct OpaqueStreamRef* StreamRef;
#define kOTInvalidStreamRef ((StreamRef)0L)
/* PollRef structure is used with the OTStreamPoll function.*/
struct PollRef {
SInt32 filler; /* holds a file descriptor an a UNIX system, replaced by ref (at end of structure) under OT*/
SInt16 events;
SInt16 revents;
StreamRef ref;
};
typedef struct PollRef PollRef;
/* Poll masks for use with OTStreamPoll: */
#define POLLIN 0x001 /* A non-priority message is available */
#define POLLPRI 0x002 /* A high priority message is available */
#define POLLOUT 0x004 /* The stream is writable for non-priority messages */
#define POLLERR 0x008 /* A error message has arrived */
#define POLLHUP 0x010 /* A hangup has occurred */
#define POLLNVAL 0x020 /* This fd is bogus */
#define POLLRDNORM 0x040 /* A non-priority message is available */
#define POLLRDBAND 0x080 /* A priority message (band > 0) message is available */
#define POLLWRNORM 0x100 /* Same as POLLOUT */
#define POLLWRBAND 0x200 /* A priority band exists and is writable */
#define POLLMSG 0x400 /* A signal message has reached the front of the queue */
/* OTReadInfo structure is used with the various functions that read and peek at the stream head.*/
struct OTReadInfo {
UInt32 fType;
OTCommand fCommand;
UInt32 fFiller; /* For compatibility with OT 1.0 and 1.1 */
ByteCount fBytes;
OSStatus fError;
};
typedef struct OTReadInfo OTReadInfo;
/* Opening and closing raw streams*/
#if CALL_NOT_IN_CARBON
/*
* OTStreamOpen()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( StreamRef )
OTStreamOpen(
const char * name,
OTOpenFlags oFlags,
OSStatus * errPtr);
/*
* OTAsyncStreamOpen()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTAsyncStreamOpen(
const char * name,
OTOpenFlags oFlags,
OTNotifyUPP proc,
void * contextPtr);
/*
* OTCreateStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( StreamRef )
OTCreateStream(
OTConfigurationRef cfig,
OTOpenFlags oFlags,
OSStatus * errPtr);
/*
* OTAsyncCreateStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTAsyncCreateStream(
OTConfigurationRef cfig,
OTOpenFlags oFlags,
OTNotifyUPP proc,
void * contextPtr);
/*
* OTStreamClose()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTStreamClose(StreamRef strm);
/* Polling a stream for activity*/
/*
* OTStreamPoll()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamPoll(
PollRef * fds,
UInt32 nfds,
OTTimeout timeout);
/*
* OTAsyncStreamPoll()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTAsyncStreamPoll(
PollRef * fds,
UInt32 nfds,
OTTimeout timeout,
OTNotifyUPP proc,
void * contextPtr);
/* Classic UNIX file descriptor operations*/
/*
* OTStreamRead()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamRead(
StreamRef strm,
void * buf,
OTByteCount len);
/*
* OTStreamWrite()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamWrite(
StreamRef strm,
void * buf,
OTByteCount len);
/*
* OTStreamIoctl()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamIoctl(
StreamRef strm,
UInt32 cmd,
void * data);
/*
* OTStreamPipe()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamPipe(StreamRef streamsToPipe[]);
/* there can be only 2!*/
/* Notifiers and modes of operation*/
/*
* OTStreamInstallNotifier()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTStreamInstallNotifier(
StreamRef strm,
OTNotifyUPP proc,
void * contextPtr);
/*
* OTStreamRemoveNotifier()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamRemoveNotifier(StreamRef strm);
/*
* OTStreamUseSyncIdleEvents()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTStreamUseSyncIdleEvents(
StreamRef strm,
Boolean useEvents);
/*
* OTStreamSetBlocking()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamSetBlocking(StreamRef strm);
/*
* OTStreamSetNonBlocking()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamSetNonBlocking(StreamRef strm);
/*
* OTStreamIsBlocking()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( Boolean )
OTStreamIsBlocking(StreamRef strm);
/*
* OTStreamSetSynchronous()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamSetSynchronous(StreamRef strm);
/*
* OTStreamSetAsynchronous()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamSetAsynchronous(StreamRef strm);
/*
* OTStreamIsSynchronous()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( Boolean )
OTStreamIsSynchronous(StreamRef strm);
/* STREAMS primitives*/
/*
* OTStreamGetMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamGetMessage(
StreamRef strm,
strbuf * ctlbuf,
strbuf * databuf,
OTFlags * flags);
/*
* OTStreamGetPriorityMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTResult )
OTStreamGetPriorityMessage(
StreamRef strm,
strbuf * ctlbuf,
strbuf * databuf,
OTBand * band,
OTFlags * flags);
/*
* OTStreamPutMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTStreamPutMessage(
StreamRef strm,
const strbuf * ctlbuf,
const strbuf * databuf,
OTFlags flags);
/*
* OTStreamPutPriorityMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTStreamPutPriorityMessage(
StreamRef strm,
const strbuf * ctlbuf,
const strbuf * databuf,
OTBand band,
OTFlags flags);
/* Miscellaneous stuff*/
/*
* OTStreamSetControlMask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTStreamSetControlMask(
StreamRef strm,
UInt32 mask,
Boolean setClear);
/*
Opening endpoints and mappers on a Stream - these calls are synchronous, and may
only be used at System Task time. Once the stream has been installed into a provider
or endpoint, you should not continue to use STREAMS APIs on it
*/
/*
* OTOpenProviderOnStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( ProviderRef )
OTOpenProviderOnStream(
StreamRef strm,
OSStatus * errPtr);
/*
* OTOpenEndpointOnStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( EndpointRef )
OTOpenEndpointOnStream(
StreamRef strm,
OSStatus * errPtr);
/*
To quote an earlier version of this header file:
Some functions that should only be used if
you really know what you're doing.
*/
/*
* OTRemoveStreamFromProvider()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( StreamRef )
OTRemoveStreamFromProvider(ProviderRef ref);
/*
* OTPeekMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSStatus )
OTPeekMessage(
StreamRef strm,
OTReadInfo * readInfo);
/*
* OTReadMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTBuffer * )
OTReadMessage(
StreamRef strm,
OTReadInfo * readInfo);
/*
* OTPutBackBuffer()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTPutBackBuffer(
StreamRef strm,
OTBuffer * buffer);
/*
* OTPutBackPartialBuffer()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( void )
OTPutBackPartialBuffer(
StreamRef strm,
OTBufferInfo * readInfo,
OTBuffer * buffer);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
#endif /* CALL_NOT_IN_CARBON */
/* ***** Port Utilities ******/
#if !OTKERNEL
/*
These types and routines are used during sophisticated
port management. High-level clients may get involved
for things like request a port to be yielding, but typically
this stuff is used by protocol infrastructure.
*/
/*
OTPortCloseStruct is used when processing the kOTClosePortRequest
and kOTYieldPortRequest events.
*/
struct OTPortCloseStruct {
OTPortRef fPortRef; /* The port requested to be closed.*/
ProviderRef fTheProvider; /* The provider using the port.*/
OSStatus fDenyReason; /* Set to a negative number to deny the request*/
};
typedef struct OTPortCloseStruct OTPortCloseStruct;
/* OTClientList structure is used with the OTYieldPortRequest function.*/
struct OTClientList {
ItemCount fNumClients;
UInt8 fBuffer[4];
};
typedef struct OTClientList OTClientList;
/*
Returns a buffer containing all of the clients that refused to yield the port.
"size" is the total number of bytes @ buffer, including the fNumClients field.
*/
#if CALL_NOT_IN_CARBON
/*
* OTYieldPortRequest()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTYieldPortRequest(
ProviderRef ref,
OTPortRef portRef,
OTClientList * buffer,
OTByteCount size);
/* Send a notification to all Open Transport registered clients*/
/*
* OTNotifyAllClients()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTNotifyAllClients(
OTEventCode code,
OTResult result,
void * cookie);
/* Determine if "child" is a child port of "parent"*/
/*
* OTIsDependentPort()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTIsDependentPort(
OTPortRef parent,
OTPortRef child);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
/* ***** Timers ***** */
/*
STREAMS plug-ins code should not use these timers, instead
they should use timer messages, ie mi_timer etc.
*/
#if !OTKERNEL
typedef long OTTimerTask;
/*
Under Carbon, OTCreateTimerTask takes a client context pointer. Applications may pass NULL
after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
valid client context.
*/
/*
* OTCreateTimerTaskInContext()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API( long )
OTCreateTimerTaskInContext(
OTProcessUPP upp,
void * arg,
OTClientContextPtr clientContext);
#if CALL_NOT_IN_CARBON
/*
* OTCreateTimerTask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OTTimerTask )
OTCreateTimerTask(
OTProcessUPP proc,
void * arg);
#endif /* CALL_NOT_IN_CARBON */
/*
* OTCancelTimerTask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API( Boolean )
OTCancelTimerTask(OTTimerTask timerTask);
/*
* OTDestroyTimerTask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API( void )
OTDestroyTimerTask(OTTimerTask timerTask);
/*
* OTScheduleTimerTask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API( Boolean )
OTScheduleTimerTask(
OTTimerTask timerTask,
OTTimeout milliSeconds);
#if OTCARBONAPPLICATION
/* The following macro may be used by applications only.*/
#define OTCreateTimerTask(upp, arg) OTCreateTimerTaskInContext(upp, arg, NULL)
#endif /* OTCARBONAPPLICATION */
#endif /* !OTKERNEL */
/* ***** Miscellaneous Helpful Functions ******/
#if !OTKERNEL
/*
These routines allow you to manipulate OT's buffer structures.
If you use no-copy receives (described in "OpenTransport.h")
you will need some of these routines, and may choose to use others.
See "Open Tranport Advanced Client Programming" for documentation.
*/
/*
* OTBufferDataSize()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( OTByteCount )
OTBufferDataSize(OTBuffer * buffer);
/*
* OTReadBuffer()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( Boolean )
OTReadBuffer(
OTBufferInfo * buffer,
void * dest,
OTByteCount * len);
/*
* OTReleaseBuffer()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( void )
OTReleaseBuffer(OTBuffer * buffer);
#if CALL_NOT_IN_CARBON
/*
* StoreIntoNetbuf()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
StoreIntoNetbuf(
TNetbuf * netBuf,
void * source,
SInt32 len);
/*
* StoreMsgIntoNetbuf()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
StoreMsgIntoNetbuf(
TNetbuf * netBuf,
OTBuffer * buffer);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
/* ***** OTConfiguration ******/
#if CALL_NOT_IN_CARBON
#if !OTKERNEL
/*
As promised in "OpenTransport.h", here are the routines
for advanced operations on configurations.
*/
/* Manipulating a configuration*/
#if CALL_NOT_IN_CARBON
/*
* OTCfigNewConfiguration()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigNewConfiguration(const char * path);
/*
* OTCfigDeleteConfiguration()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCfigDeleteConfiguration(OTConfigurationRef cfig);
/*
* OTCfigCloneConfiguration()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigCloneConfiguration(OTConfigurationRef cfig);
/*
* OTCfigPushNewSingleChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigPushNewSingleChild(
OTConfigurationRef cfig,
const char * path,
OSStatus * errPtr);
/*
* OTCfigPushParent()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigPushParent(
OTConfigurationRef cfig,
const char * path,
OSStatus * errPtr);
/*
* OTCfigPushChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigPushChild(
OTConfigurationRef cfig,
OTItemCount index,
const char * path,
OSStatus * errPtr);
/*
* OTCfigPopChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTCfigPopChild(
OTConfigurationRef cfig,
OTItemCount index);
/*
* OTCfigGetChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigGetChild(
OTConfigurationRef cfig,
OTItemCount index);
/*
* OTCfigSetPath()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTCfigSetPath(
OTConfigurationRef cfig,
const char * path);
/*
* OTCfigNewChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigNewChild(
OTConfigurationRef cfig,
const char * path,
OSStatus * errPtr);
/*
* OTCfigAddChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTCfigAddChild(
OTConfigurationRef cfig,
OTConfigurationRef child);
/*
* OTCfigRemoveChild()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigRemoveChild(
OTConfigurationRef cfig,
OTItemCount index);
/*
* OTCfigSetPortRef()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCfigSetPortRef(
OTConfigurationRef cfig,
OTPortRef portRef);
/*
* OTCfigChangeProviderName()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCfigChangeProviderName(
OTConfigurationRef cfig,
const char * name);
/* Query a configuration*/
/*
* OTCfigNumberOfChildren()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt16 )
OTCfigNumberOfChildren(OTConfigurationRef cfig);
/*
* OTCfigGetParent()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTConfigurationRef )
OTCfigGetParent(OTConfigurationRef cfig);
/*
* OTCfigGetOptionNetbuf()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( TNetbuf * )
OTCfigGetOptionNetbuf(OTConfigurationRef cfig);
/*
* OTCfigGetPortRef()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTPortRef )
OTCfigGetPortRef(OTConfigurationRef cfig);
/*
* OTCfigGetInstallFlags()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt32 )
OTCfigGetInstallFlags(OTConfigurationRef cfig);
/*
* OTCfigGetProviderName()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( const char * )
OTCfigGetProviderName(OTConfigurationRef cfig);
/*
* OTCfigIsPort()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTCfigIsPort(OTConfigurationRef cfig);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
/* ***** Configurators ******/
/*
The kOTConfiguratorInterfaceID define is what you need to add to your
export file for the "interfaceID = " clause to export a configurator
for ASLM. Similarly, kOTConfiguratorCFMTag is used for CFM-based
configurators.
*/
#define kOTConfiguratorInterfaceID kOTClientPrefix "cfigMkr"
#define kOTConfiguratorCFMTag kOTClientPrefix "cfigMkr"
#if !OTKERNEL
#ifdef __cplusplus
class TOTConfigurator;
typedef class TOTConfigurator* TOTConfiguratorRef;
#else
typedef struct TOTConfigurator TOTConfigurator;
typedef TOTConfigurator* TOTConfiguratorRef;
#endif
/*
Typedef for the OTCanConfigure function, and the enum for which pass we're doing.
The first (kOTSpecificConfigPass) is to give configurators a shot at the configuration
before we start allowing the generic configurators to get into the act.
*/
enum {
kOTSpecificConfigPass = 0,
kOTGenericConfigPass = 1
};
typedef CALLBACK_API_C( Boolean , OTCanConfigureProcPtr )(OTConfigurationRef cfig, UInt32 pass);
/* Typedef for the function to create and return a configurator object*/
typedef CALLBACK_API_C( OSStatus , OTCreateConfiguratorProcPtr )(TOTConfiguratorRef * cfigor);
/*
Typedef for the "OTSetupConfigurator" function that your configurator library must export.
The enum is for the type of configurator that it is.
*/
#define kOTSetupConfiguratorID "OTSetupConfigurator"
enum {
kOTDefaultConfigurator = 0,
kOTProtocolFamilyConfigurator = 1,
kOTLinkDriverConfigurator = 2
};
typedef CALLBACK_API_C( OSStatus , OTSetupConfiguratorProcPtr )(OTCanConfigureProcPtr *canConfigure, OTCreateConfiguratorProcPtr *createConfigurator, UInt8 *configuratorType);
/*
Procedure pointer definitions for the three key callbacks associated
with a configurator, as established by OTNewConfigurator.
*/
typedef CALLBACK_API_C( OSStatus , OTCFConfigureProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig);
typedef CALLBACK_API_C( OSStatus , OTCFCreateStreamProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig, OTOpenFlags oFlags, OTNotifyUPP proc, void *contextPtr);
typedef CALLBACK_API_C( void , OTCFHandleSystemEventProcPtr )(TOTConfiguratorRef cfigor, OTEventCode code, OTResult result, void *cookie);
/*
Determine if this instance of your configurator is the "master"
(the one that can create and destroy control streams)
*/
#if CALL_NOT_IN_CARBON
/*
* OTIsMasterConfigurator()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTIsMasterConfigurator(TOTConfiguratorRef cfigor);
/* Get back the userData you passed in to OTNewConfigurator*/
/*
* OTGetConfiguratorUserData()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void * )
OTGetConfiguratorUserData(TOTConfiguratorRef cfigor);
/* Create a configurator object for use by Open Transport*/
/*
* OTNewConfigurator()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( TOTConfiguratorRef )
OTNewConfigurator(
void * userData,
OTCFConfigureProcPtr configure,
OTCFCreateStreamProcPtr createStream,
OTCFHandleSystemEventProcPtr handleEvent);
/* Delete a configurator object created by OTNewConfigurator*/
/*
* OTDeleteConfigurator()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTDeleteConfigurator(TOTConfiguratorRef cfigor);
/*
A utility function to send notifications to the user - it takes care of calls
from deferred tasks
*/
/*
* OTNotifyUser()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTNotifyUser(
FSSpec * theFile,
SInt32 rsrcID,
OTItemCount index,
char * parm1,
char * parm2);
/* Call when the configurator unloads from memory*/
/*
* OTConfiguratorUnloaded()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTConfiguratorUnloaded(TOTConfiguratorRef cfigor);
/*
Call to create your control stream if you're not the master
configurator. You can also use the state machine function
OTSMCreateControlStream(OTStateMachine*, OTConfigurationRef, TOTConfiguratorRef cfigor).
*/
/*
* OTCreateControlStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTCreateControlStream(
OTConfigurationRef cfig,
TOTConfiguratorRef cfigor,
OTNotifyUPP proc,
void * contextPtr);
/*
A helpful function for the configurators to
be able to recursively configure the children.
*/
/*
* OTConfigureChildren()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTConfigureChildren(OTConfigurationRef cfig);
/* Allocate a bit in the system-wide control mask for streams.*/
/*
* OTNewControlMask()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt32 )
OTNewControlMask(void);
/* Warning: These 2 APIs is going away*/
/*
* OTCloseProvidersByUseCount()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCloseProvidersByUseCount(
SInt32 * useCount,
OTResult reason,
OTBooleanParam doneDeal);
/*
* OTCloseProvidersByPortRef()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCloseProvidersByPortRef(
OTPortRef ref,
OTResult reason,
OTBooleanParam doneDeal);
/* These are the "real" APIs*/
/*
* OTCloseProviderByStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCloseProviderByStream(
StreamRef ref,
OTResult reason,
OTBooleanParam doneDeal);
/*
* OTCloseMatchingProviders()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTCloseMatchingProviders(
UInt32 mask,
OTPortRef port,
OTResult reason,
OTBooleanParam doneDeal);
/* The following defines are for use in building an 'epcf' resource: */
/* Defines for fFlags field: */
#define kIsReliable 0x00000001
#define kIsNotReliable 0x00000002
#define kSupportsOrderlyRelease 0x00000004
/* Defines for fProtocolType field: */
#define kStream 0x0001
#define kUStream 0x0002
#define kTransaction 0x0004
#define kUTransaction 0x0008
#define kMapper 0x0010
#define kGenericProtocol 0x0020
/* Defines for optionType field: */
#define kBooleanOption 0
#define kUnsignedValueOption 1
#define kSignedValueOption 2
#define kHexValueOption 3
#define kPrintableStringOption 4
#define kOctetStringOption 5
/* Defines for fUpperInterface and fLowerInterface: */
#define kTPIInterface 'TPI '
#define kDLPIInterface 'DLPI'
#define kMapperInterface 'MAPR'
#define kPrivateInterface -1
#define kNoInterface 0
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
#endif /* CALL_NOT_IN_CARBON */
/* ***** OTStateMachine ******/
#if CALL_NOT_IN_CARBON
/*
This utility set allows you to write an asynchronous chain of code that looks
somewhat like it is synchronous. This is primarily used for plumbing
streams asynchronously, especially in configurators
*/
#if !OTKERNEL
/* Alas, the state machine is only available to client code. Sorry.*/
/*
There are 12 or 8 bytes of reserved space at the front of
the OTStateMachine structure, depending on whether you're
building PowerPC or 68K code.. The OTStateMachineDataPad
type compensates for this.
*/
#if TARGET_CPU_PPC
typedef UInt8 OTStateMachineDataPad[12];
#else
typedef UInt8 OTStateMachineDataPad[8];
#endif /* TARGET_CPU_PPC */
/*
Forward define OTStateMachine so that OTStateProcPtr has
access to it.
*/
typedef struct OTStateMachine OTStateMachine;
/*
This type is is the required prototype of a state machine
entry point.
*/
typedef CALLBACK_API( void , OTStateProcPtr )(OTStateMachine * sm);
/*
This type defines a routine that the state machine will
call when the top level completes.
*/
typedef CALLBACK_API_C( void , OTSMCompleteProcPtr )(void * contextPtr);
/* And now for the state machine structure itself.*/
struct OTStateMachine {
OTStateMachineDataPad fData;
void * fCookie;
OTEventCode fCode;
OTResult fResult;
#ifdef __cplusplus
// C++ inline methods on this structure.
void* GetClientData();
Boolean CallStateProc(OTStateProcPtr proc, UInt32 state = 0);
UInt16 GetState();
void SetState(UInt32 state);
void Complete();
void Complete(OTResult result);
void Complete(OTResult result, OTEventCode code, void* contextPtr);
void CompleteToClient();
void CompleteToClient(OTResult result);
void CompleteToClient(OTResult result, OTEventCode code, void* contexPtr);
void PopCallback();
Boolean CreateStream(OTConfigurationRef cfig, OTOpenFlags flags);
Boolean OpenStream(const char* name, OTOpenFlags flags);
Boolean SendIoctl(StreamRef ref, UInt32 type, void* data);
Boolean SendIoctl(StreamRef ref, UInt32 type, long data);
Boolean PutMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags flags);
Boolean GetMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags* flagPtr);
OSStatus ReturnToCaller();
#endif
};
#define kOTSMBufferSize(callDepth) (80 + (callDepth * 8))
/*
For structSize, pass the size of your structure that you want associated with
the state machine. It can later be obtained by calling OTSMGetClientData.
For bufSize, use the kOTSMBufferSize macro, plus the size of your structure
to create a buffer on the stack. For synchronous calls, the stack buffer will
be used (unless you pass in NULL). The callDepth is the depth level of nested
calls using OTSMCallStateProc.
*/
#if CALL_NOT_IN_CARBON
/*
* OTCreateStateMachine()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTStateMachine * )
OTCreateStateMachine(
void * buf,
OTByteCount bufSize,
OTByteCount structSize,
OTNotifyUPP proc,
void * contextPtr);
/*
* OTDestroyStateMachine()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTDestroyStateMachine(OTStateMachine * sm);
/*
OTSMCallStateProc used to take a parameter of type UInt16_p,
which was defined to be the same as UInt32. In an attempt
to reduce the number of wacky types defined by the OT
interfaces, we've changed these routines to just take a
straight UInt32. You should be warned that the current
implementation does not support values outside of the
range 0..32767. The same applies to OTSMSetState.
*/
/*
* OTSMCallStateProc()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMCallStateProc(
OTStateMachine * sm,
OTStateProcPtr proc,
UInt32 state);
/*
* OTSMGetState()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt16 )
OTSMGetState(OTStateMachine * sm);
/*
* OTSMSetState()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTSMSetState(
OTStateMachine * sm,
UInt32 state);
/* Fill out the fCookie, fCode, and fResult fields before calling!*/
/*
* OTSMComplete()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTSMComplete(OTStateMachine * sm);
/*
* OTSMPopCallback()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTSMPopCallback(OTStateMachine * sm);
/*
* OTSMWaitForComplete()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMWaitForComplete(OTStateMachine * sm);
/*
* OTSMCreateStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMCreateStream(
OTStateMachine * sm,
OTConfigurationRef cfig,
OTOpenFlags flags);
/*
* OTSMOpenStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMOpenStream(
OTStateMachine * sm,
const char * name,
OTOpenFlags flags);
/*
* OTSMIoctl()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMIoctl(
OTStateMachine * sm,
StreamRef strm,
UInt32 cmd,
long data);
/*
* OTSMPutMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMPutMessage(
OTStateMachine * sm,
StreamRef strm,
strbuf * ctlbuf,
strbuf * databuf,
OTFlags flags);
/*
* OTSMGetMessage()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMGetMessage(
OTStateMachine * sm,
StreamRef strm,
strbuf * ctlbuf,
strbuf * databuf,
OTFlags * flagsPtr);
/*
* OTSMReturnToCaller()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTSMReturnToCaller(OTStateMachine * sm);
/*
* OTSMGetClientData()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void * )
OTSMGetClientData(OTStateMachine * sm);
/*
* OTSMInstallCompletionProc()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTSMInstallCompletionProc(
OTStateMachine * sm,
OTSMCompleteProcPtr completeProc,
void * contextPtr);
/*
* OTSMCreateControlStream()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTSMCreateControlStream(
OTStateMachine * sm,
OTConfigurationRef cfig,
TOTConfiguratorRef cfigor);
#ifdef __cplusplus
inline void* OTStateMachine::GetClientData() { return OTSMGetClientData(this); }
inline Boolean OTStateMachine::CallStateProc(OTStateProcPtr proc, UInt32 state)
{ return OTSMCallStateProc(this, proc, state); }
inline UInt16 OTStateMachine::GetState() { return OTSMGetState(this); }
inline void OTStateMachine::SetState(UInt32 state)
{ OTSMSetState(this, state); }
inline void OTStateMachine::PopCallback() { OTSMPopCallback(this); }
inline void OTStateMachine::Complete() { OTSMComplete(this); }
inline void OTStateMachine::Complete(OTResult result, OTEventCode code, void* cookie)
{ fCookie = cookie; fCode = code; fResult = result; Complete(); }
inline void OTStateMachine::Complete(OTResult result)
{ fResult = result; Complete(); }
inline void OTStateMachine::CompleteToClient()
{ PopCallback(); Complete(); }
inline void OTStateMachine::CompleteToClient(OTResult result)
{ fResult = result; CompleteToClient(); }
inline void OTStateMachine::CompleteToClient(OTResult result, OTEventCode code, void* cookie)
{ fCookie = cookie; fCode = code; fResult = result; CompleteToClient(); }
inline Boolean OTStateMachine::CreateStream(OTConfigurationRef cfig, OTOpenFlags flags)
{ return OTSMCreateStream(this, cfig, flags); }
inline Boolean OTStateMachine::OpenStream(const char* name, OTOpenFlags flags)
{ return OTSMOpenStream(this, name, flags); }
inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, void* data)
{ return OTSMIoctl(this, ref, type, (long)data); }
inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, long data)
{ return OTSMIoctl(this, ref, type, data); }
inline Boolean OTStateMachine::PutMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags flags)
{ return OTSMPutMessage(this, ref, ctl, data, flags); }
inline Boolean OTStateMachine::GetMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags* flagPtr)
{ return OTSMGetMessage(this, ref, ctl, data, flagPtr); }
inline OSStatus OTStateMachine::ReturnToCaller()
{ return OTSMReturnToCaller(this); }
#endif
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
/* ***** Autopush Definitions ******/
/*
The autopush functionality for Open Transport is based on the names of
devices and modules, rather than on the major number information like
SVR4. This is so that autopush information can be set up for modules
that are not yet loaded.
*/
/* The name of the STREAMS driver you open and send the ioctls to.*/
#define kSADModuleName "sad"
/* Autopush ioctls.*/
enum {
I_SAD_SAP = ((MIOC_SAD << 8) | 1), /* Set autopush information */
I_SAD_GAP = ((MIOC_SAD << 8) | 2), /* Get autopush information */
I_SAD_VML = ((MIOC_SAD << 8) | 3) /* Validate a list of modules (uses str_list structure) */
};
/* Maximum number of modules autopushed on a driver.*/
enum {
kOTAutopushMax = 8
};
/* ioctl structure used for SAD_SAP and SAD_GAP commands.*/
struct OTAutopushInfo {
UInt32 sap_cmd;
char sap_device_name[32];
SInt32 sap_minor;
SInt32 sap_lastminor;
SInt32 sap_npush;
char sap_list[8][32];
};
typedef struct OTAutopushInfo OTAutopushInfo;
/* Command values for sap_cmd field of the above.*/
enum {
kSAP_ONE = 1, /* Configure a single minor device */
kSAP_RANGE = 2, /* Configure a range of minor devices */
kSAP_ALL = 3, /* Configure all minor devices */
kSAP_CLEAR = 4 /* Clear autopush information */
};
/* ***** Configuration Helpers ******/
/*
These definitions are used by device driver and port scanner
developers to provide a library giving client-side information about
the registered ports, such as a user-visible name or an icon.
*/
/* Configuration helper library prefix*/
/*
This prefix is prepended to the string found in the "fResourceInfo"
field of the OTPortRecord to build the actual library name of the
configuration helper library.
*/
#define kPortConfigLibPrefix "OTPortCfg$"
/* Get user visible port name entry point.*/
/*
This entry point returns the user visible name of the port. If includeSlot
is true, a slot distinguishing suffix (eg "slot X") should be added. If
includePort is true, a port distinguishing suffix (eg " port X") should be added for
multiport cards.
*/
#define kOTGetUserPortNameID "OTGetUserPortName"
typedef CALLBACK_API_C( void , OTGetPortNameProcPtr )(OTPortRecord *port, OTBooleanParam includeSlot, OTBooleanParam includePort, Str255 userVisibleName);
/* Get icon entry point.*/
/*
This entry point returns the location of the icon for the port. Return false if no
icon is provided.
*/
#define kOTGetPortIconID "OTGetPortIcon"
struct OTResourceLocator {
FSSpec fFile;
UInt16 fResID;
};
typedef struct OTResourceLocator OTResourceLocator;
typedef CALLBACK_API_C( Boolean , OTGetPortIconProcPtr )(OTPortRecord *port, OTResourceLocator *iconLocation);
/* ***** Application Access to Configuration Helpers ******/
#if !OTKERNEL
/*
These routines are used by clients to get information about ports.
The canonical user of these routines is the OT control panel(s),
but applications may want to use them as well (to display the list
of available Ethernet cards, for example).
*/
/* Returns a user friendly name for a port.*/
#if CALL_NOT_IN_CARBON
/*
* OTGetUserPortNameFromPortRef()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTGetUserPortNameFromPortRef(
OTPortRef ref,
Str255 friendlyName);
/*
Returns the location for the icon familly representing the port.
Returns false if the port has no icon.
*/
/*
* OTGetPortIconFromPortRef()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTGetPortIconFromPortRef(
OTPortRef ref,
OTResourceLocator * iconLocation);
#endif /* CALL_NOT_IN_CARBON */
/* Returns true if the port can be used with the specified protocol.*/
#if CALL_NOT_IN_CARBON
/*
* OTIsPortCompatibleWith()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTIsPortCompatibleWith(
const OTPortRecord * port,
char * protocolName);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
#endif /* CALL_NOT_IN_CARBON */
/* ***** Common Utilities ******/
/*
The utilities defined in this section are available to both client
and kernel code. Cool huh? These utilities differ from those
provided in "OpenTransport.h" in that they are only available to native
architecture clients.
*/
/* Bitmap functions*/
/* These functions atomically deal with a bitmap that is multiple-bytes long*/
/*
Set the first clear bit in "bitMap", starting with bit "startBit",
giving up after "numBits". Returns the bit # that was set, or
a kOTNotFoundErr if there was no clear bit available
*/
/*
* OTSetFirstClearBit()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( OTResult )
OTSetFirstClearBit(
UInt8 * bitMap,
OTByteCount startBit,
OTByteCount numBits);
/* Standard clear, set and test bit functions*/
/*
* OTClearBit()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( Boolean )
OTClearBit(
UInt8 * bitMap,
OTByteCount bitNo);
/*
* OTSetBit()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( Boolean )
OTSetBit(
UInt8 * bitMap,
OTByteCount bitNo);
/*
* OTTestBit()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( Boolean )
OTTestBit(
UInt8 * bitMap,
OTByteCount bitNo);
/* OTHashList*/
/*
This implements a simple, but efficient hash list. It is not
thread-safe.
*/
typedef CALLBACK_API_C( UInt32 , OTHashProcPtr )(OTLink * linkToHash);
typedef CALLBACK_API_C( Boolean , OTHashSearchProcPtr )(const void *ref, OTLink *linkToCheck);
struct OTHashList {
OTHashProcPtr fHashProc;
ByteCount fHashTableSize;
OTLink ** fHashBuckets;
#ifdef __cplusplus
// C++ inline methods on this structure.
void Add(OTLink* toAdd);
Boolean RemoveLink(OTLink* toRemove);
OTLink* Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue);
Boolean IsInList(OTLink* toFind);
OTLink* FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash);
#endif
};
typedef struct OTHashList OTHashList;
/*
Return the number of bytes of memory needed to create a hash list
of at least "numEntries" entries.
*/
#if CALL_NOT_IN_CARBON
/*
* OTCalculateHashListMemoryNeeds()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTByteCount )
OTCalculateHashListMemoryNeeds(OTItemCount numEntries);
/*
Create an OTHashList from "memory". Return an error if it
couldn't be done.
*/
/*
* OTInitHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTResult )
OTInitHashList(
void * memory,
OTByteCount numBytes,
OTHashProcPtr hashProc);
/*
* OTAddToHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTAddToHashList(
OTHashList * hashList,
OTLink * linkToAdd);
/*
* OTRemoveLinkFromHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTRemoveLinkFromHashList(
OTHashList * hashList,
OTLink * linkToRemove);
/*
* OTIsInHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTIsInHashList(
OTHashList * hashList,
OTLink * link);
/*
* OTFindInHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTLink * )
OTFindInHashList(
OTHashList * hashList,
OTHashSearchProcPtr searchProc,
const void * refPtr,
UInt32 hashValue);
/*
* OTRemoveFromHashList()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OTLink * )
OTRemoveFromHashList(
OTHashList * hashList,
OTHashSearchProcPtr searchProc,
const void * refPtr,
UInt32 hashValue);
#endif /* CALL_NOT_IN_CARBON */
#ifdef __cplusplus
#if CALL_NOT_IN_CARBON
// C++ inline methods on this structure.
inline void OTHashList::Add(OTLink* toAdd) { OTAddToHashList(this, toAdd); }
inline Boolean OTHashList::RemoveLink(OTLink* toRemove)
{ return OTRemoveLinkFromHashList(this, toRemove); }
inline OTLink* OTHashList::Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue)
{ return OTRemoveFromHashList(this, proc, refPtr, hashValue); }
inline Boolean OTHashList::IsInList(OTLink* toFind)
{ return OTIsInHashList(this, toFind); }
inline OTLink* OTHashList::FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash)
{ return OTFindInHashList(this, proc, refPtr, hash); }
#endif
#endif
/* Random functions*/
/*
These implement a very simple random number generator, suitable
for protocol implementations but not "cryptographically" random.
*/
#if CALL_NOT_IN_CARBON
/*
* OTGetRandomSeed()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt32 )
OTGetRandomSeed(void);
/*
* OTGetRandomNumber()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( UInt32 )
OTGetRandomNumber(
UInt32 * seed,
UInt32 lo,
UInt32 hi);
/* Concurrency Control*/
/*
OTGate implements a cool concurrency control primitive.
You're not going to understand it without reading the documentation!
See "Open Transport Advanced Client Programming" for details.
WARNING:
This structure must be on a 4-byte boundary.
*/
#endif /* CALL_NOT_IN_CARBON */
typedef CALLBACK_API_C( Boolean , OTGateProcPtr )(OTLink * thisLink);
struct OTGate {
OTLIFO fLIFO;
OTList fList;
OTGateProcPtr fProc;
SInt32 fNumQueued;
SInt32 fInside;
};
typedef struct OTGate OTGate;
#if CALL_NOT_IN_CARBON
/*
* OTInitGate()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTInitGate(
OTGate * gate,
OTGateProcPtr proc);
/*
* OTEnterGate()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTEnterGate(
OTGate * gate,
OTLink * withLink);
/*
* OTLeaveGate()
*
* Availability:
* Non-Carbon CFM: in OTUtilityLib 1.0 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( Boolean )
OTLeaveGate(OTGate * gate);
/* ***** Shared Library Bonus Extras ******/
#endif /* CALL_NOT_IN_CARBON */
#if CALL_NOT_IN_CARBON
/*
These routines provide addition shared library support beyond
that provided by the base shared library mechanism.
*/
/*
Some flags which can be passed to the "loadFlags" parameter of the
various CFM routines. Not all flags can be used with all routines.
See "Open Transport Advanced Client Programming" for details.
*/
enum {
kOTGetDataSymbol = 0,
kOTGetCodeSymbol = 1,
kOTLoadNewCopy = 2,
kOTLoadACopy = 4,
kOTFindACopy = 8,
kOTLibMask = kOTLoadNewCopy | kOTLoadACopy | kOTFindACopy,
kOTLoadLibResident = 0x20
};
/* Finding all matching CFM libraries.*/
/*
The routine OTFindCFMLibraries allows you to find all CFM libraries
that match specific criteria. The result is placed in a list
of CFMLibraryInfo structures. OT allocates those structures using
a routine of type OTAllocMemProcPtr that you pass to OTFindCFMLibraries.
*/
/*
A list of CFMLibraryInfo structures is returned by the OTFindCFMLibraries routine.
The list is created out of the data that is passed to the function.
IMPORTANT:
Only the first 3 fields are valid when using OT 1.2 and older.
*/
struct CFMLibraryInfo {
OTLink link; /* To link them all up on a list */
char * libName; /* "C" String which is fragment name */
StringPtr intlName; /* Pascal String which is internationalized name */
FSSpec * fileSpec; /* location of fragment's file */
StringPtr pstring2; /* Secondary string from extended cfrg */
StringPtr pstring3; /* Extra info from extended cfrg */
};
typedef struct CFMLibraryInfo CFMLibraryInfo;
/*
You must pass a routine of type OTAllocMemProcPtr to OTFindCFMLibraries
which it calls to allocate memory for the CFMLibraryInfo structures.
*/
typedef CALLBACK_API_C( void *, OTAllocMemProcPtr )(OTByteCount size);
/* Find CFM libraries of the specified kind and type*/
#if CALL_NOT_IN_CARBON
/*
* OTFindCFMLibraries()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTFindCFMLibraries(
OSType libKind,
const char * libType,
OTList * theList,
OTAllocMemProcPtr allocator);
/* Loading libraries and connecting to symbols.*/
/* Load a CFM library by name*/
/*
* OTLoadCFMLibrary()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTLoadCFMLibrary(
const char * libName,
UInt32 * connID,
UInt32 loadFlags);
/* Load a CFM library and get a named pointer from it*/
/*
* OTGetCFMPointer()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void * )
OTGetCFMPointer(
const char * libName,
const char * entryName,
UInt32 * connID,
UInt32 loadFlags);
/* Get a named pointer from a CFM library that's already loaded*/
/*
* OTGetCFMSymbol()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void * )
OTGetCFMSymbol(
const char * entryName,
UInt32 connID,
UInt32 loadFlags);
/* Release a connection to a CFM library*/
/*
* OTReleaseCFMConnection()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTReleaseCFMConnection(UInt32 * connID);
#endif /* CALL_NOT_IN_CARBON */
#if !TARGET_CPU_68K
/*
You can call these routines in your CFM initialisation and termination
routines to hold or unhold your libraries sections.
*/
/*
Used in a CFM InitProc, will hold the executable code, if applicable.
This can also be the InitProc of the library
*/
#if CALL_NOT_IN_CARBON
/*
* OTHoldThisCFMLibrary()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTHoldThisCFMLibrary(const CFragInitBlock * initBlock);
/*
Used in a CFM terminate proc, will unhold the executable code, if applicable.
This can also be the terminate proc of the library
*/
/*
* OTUnholdThisCFMLibrary()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTUnholdThisCFMLibrary(void);
#endif /* CALL_NOT_IN_CARBON */
#endif /* !TARGET_CPU_68K */
/* ASLM Utilities*/
/* Load an ASLM library*/
#if CALL_NOT_IN_CARBON
/*
* OTLoadASLMLibrary()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSStatus )
OTLoadASLMLibrary(const char * libName);
/* Unload an ASLM library*/
/*
* OTUnloadASLMLibrary()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
OTUnloadASLMLibrary(const char * libName);
/*
This is an ASLM utility routine. You can get it by including
"LibraryManagerUtilities.h", but since we only use a few ASLM utilities,
we put the prototype here for convenience.
*/
/*
* UnloadUnusedLibraries()
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
UnloadUnusedLibraries(void);
#endif /* CALL_NOT_IN_CARBON */
#if !OTKERNEL
/*******************************************************************************
** A few C++ objects for C++ fans
********************************************************************************/
#if CALL_NOT_IN_CARBON
#ifdef __cplusplus
} // Terminate C definitions
class OTConfiguration
{
public:
OTConfigurationRef Clone()
{ return OTCfigCloneConfiguration(this); }
//
// The Path for PushChild and PushParent must be a single module
//
OTConfigurationRef PushChild(const char* path, OSStatus* errPtr)
{ return OTCfigPushNewSingleChild(this, path, errPtr); }
OTConfigurationRef PushParent(const char* path, OSStatus* errPtr)
{ return OTCfigPushParent(this, path, errPtr); }
OTConfigurationRef PushNthChild(OTItemCount index, const char* path,
OSStatus* errPtr)
{ return OTCfigPushChild(this, index, path, errPtr); }
OSStatus PopChild(OTItemCount index)
{ return OTCfigPopChild(this, index); }
OTConfigurationRef GetChild(OTItemCount index = 0)
{ return OTCfigGetChild(this, index); }
OTConfigurationRef GetParent()
{ return OTCfigGetParent(this); }
OSStatus AddChild(OTConfigurationRef child)
{ return OTCfigAddChild(this, child); }
OTConfigurationRef NewChild(const char* path, OSStatus* errPtr)
{ return OTCfigNewChild(this, path, errPtr); }
OSStatus SetPath(const char* path)
{ return OTCfigSetPath(this, path); }
Boolean HasOptions()
{ return OTCfigGetOptionNetbuf(this)->len != 0; }
};
/* -------------------------------------------------------------------------
Class TOTConfigurator
This class is subclassed to do configuration for a protocol or protocol stack.
Of course, you can also use OTNewConfigurator to do it from C.
If you subclass it using C++, you MUST have a UInt32 field as the first
field of your object that you do not touch or use.
------------------------------------------------------------------------- */
#if TARGET_CPU_68K && !defined(__SC__) && !defined(THINK_CPLUS)
class TOTConfigurator : public SingleObject
#else
class TOTConfigurator
#endif
{
#if defined(__SC__) || defined(THINK_CPLUS) || defined(__MRC__)
private:
virtual void DummyVirtualFunction();
#endif
public:
void* operator new(size_t size)
{ return OTAllocSharedClientMem((OTByteCount)size); }
void operator delete(void* mem)
{ OTFreeSharedClientMem(mem); };
_MDECL TOTConfigurator();
virtual ~ _MDECL TOTConfigurator();
virtual void _MDECL HandleSystemEvent(OTEventCode event, OTResult result,
void* cookie) = 0;
virtual OSStatus _MDECL Configure(OTConfigurationRef) = 0;
virtual OSStatus _MDECL CreateStream(OTConfigurationRef, OTOpenFlags,
OTNotifyUPP, void* contextPtr) = 0;
};
extern "C" { // resume C definitions
#endif /*__cplusplus*/
#endif /* CALL_NOT_IN_CARBON */
#endif /* !OTKERNEL */
#endif /* CALL_NOT_IN_CARBON */
#if defined(__MWERKS__) && TARGET_CPU_68K
#pragma pop
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif
#endif /* __OPENTRANSPORTPROTOCOL__ */
|