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
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!--
variable names used in equation markup in the authentication chapter
FIXME: Replace with mathml?
-->
<!ENTITY variable.D "<emphasis role='italic'>D</emphasis>">
<!ENTITY variable.N "<emphasis role='italic'>N</emphasis>">
<!ENTITY variable.T "<emphasis role='italic'>T</emphasis>">
<!ENTITY variable.Delta "<emphasis role='italic'>Δ</emphasis>">
<!ENTITY variable.alpha "<emphasis role='italic'>α</emphasis>">
<!ENTITY variable.beta "<emphasis role='italic'>β</emphasis>">
<!ENTITY variable.kappa "<emphasis role='italic'>κ</emphasis>">
<!ENTITY variable.rho "<emphasis role='italic'>ρ</emphasis>">
<!ENTITY variable.sigma "<emphasis role='italic'>σ</emphasis>">
<!ENTITY variable.tau "<emphasis role='italic'>τ</emphasis>">
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>
<book id="xdmcp">
<bookinfo>
<title>X Display Manager Control Protocol</title>
<subtitle>X.Org Standard</subtitle>
<releaseinfo>X Version 11</releaseinfo>
<releaseinfo>Version 1.1</releaseinfo>
<authorgroup>
<author>
<firstname>Keith</firstname><surname>Packard</surname>
<affiliation>
<orgname>Massachusetts Institute of Technology</orgname>
<orgdiv>Laboratory for Computer Science</orgdiv>
<orgdiv>X Consortium</orgdiv>
</affiliation>
</author>
</authorgroup>
<copyright><year>1989</year><year>2004</year>
<holder>The Open Group</holder></copyright>
<legalnotice>
<para>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</para>
<para>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</para>
<para>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</para>
<para>
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
</para>
<para>
<emphasis remap='I'>X Window System</emphasis> is a trademark of The Open Group.
</para>
</legalnotice>
</bookinfo>
<chapter id="Purpose_and_Goals">
<title>Purpose and Goals</title>
<!-- .XS -->
<!-- (SN Purpose and Goals -->
<!-- .XE -->
<para>
<!-- .LP -->
The purpose of the X Display Manager Control Protocol (XDMCP)
is to provide a uniform mechanism for an autonomous
display to request login service from a remote host.
By autonomous, we mean
the display consists of hardware and processes that are independent of any
particular host where login service is desired. (For example, the server
cannot simply be started by a
<function>fork/exec</function>
sequence on the host.)
An X terminal (screen, keyboard, mouse, processor, network interface)
is a prime example of an autonomous display.
</para>
<para>
From the point of view of the end user, it is very important to make
autonomous displays as easy to use as traditional hardwired character
terminals. Specifically, you can typically just power on a hardwired
terminal and be greeted with a login prompt. The same should be possible
with autonomous displays. However, in a network environment with multiple
hosts, the end user may want to choose which host(s) to connect to. In an
environment with many displays and many hosts, a site administrator may want
to associate particular collections of hosts with particular displays. We
would like to support the following options:
</para>
<itemizedlist>
<listitem>
<para>
The display has a single, fixed host to which it should connect. It should be
possible to power on the display and receive a login prompt, without user
intervention.
</para>
</listitem>
<listitem>
<para>
Any one of several hosts on a network or subnetwork may be acceptable
for accepting login from the display.
(For example, the user's file systems can be mounted onto
any such host, providing comparable environments.) It should be possible
for the display to broadcast to find such hosts and to have the display
either automatically choose a host or present the possible hosts to the
user for selection.
</para>
</listitem>
<listitem>
<para>
The display has a fixed set of hosts that it can connect to. It should be
possible for the display to have that set stored in RAM, but it should also be
possible for a site administrator to be able to maintain host sets for a
large number of displays using a centralized facility, without having to
interact (physically or electronically) with each individual display.
Particular hosts should be allowed to refuse login service, based on
whatever local criteria are desired.
</para>
</listitem>
</itemizedlist>
<para>
The control protocol should be designed in such a way that it can be used over
a reasonable variety of communication transport layers. In fact, it is quite
desirable if every major network protocol family that supports the standard X
protocol is also capable of supporting XDMCP, because the end result of XDMCP
negotiation will be standard X protocol connections to the display.
However, because the number of displays per host may be large,
a connection-based protocol appears less desirable
than a connection-less protocol. For this reason the protocol is designed
to use datagram services with the display responsible for sequencing and
retransmission.
</para>
<para>
<!-- .LP -->
To keep the burden on displays at a minimum (because display cost is not
a factor that can be ignored), it is desirable that displays not be required
to maintain permanent state (across power cycles) for the purposes
of the control protocol,
and it is desirable to keep required state at a minimum while the
display is powered on.
</para>
<para>
<!-- .LP -->
Security is an important consideration and must be an integral part of the
design. The important security goals in the context of XDMCP are:
</para>
<itemizedlist>
<listitem>
<para>
It should be possible for the display to verify that it is communicating
with a legitimate host login service. Because the user will present
credentials (for example, password) to this service,
it is important to avoid spoof attacks.
</para>
</listitem>
<listitem>
<para>
It should be possible for the display and the login service to negotiate the
authorization mechanism to be used for the standard X protocol.
</para>
</listitem>
<listitem>
<para>
It should be possible to provide the same level of security in verifying the
login service as is provided by the negotiated authorization mechanism.
</para>
</listitem>
<listitem>
<para>
Because there are no firm standards yet in the area of security,
XDMCP must be flexible enough to accomodate a variety of security mechanisms.
</para>
</listitem>
</itemizedlist>
</chapter>
<chapter id="Overview_of_the_Protocol">
<title>Overview of the Protocol</title>
<!-- .XS -->
<!-- (SN Overview of the Protocol -->
<!-- .XE -->
<para>
<!-- .LP -->
XDMCP is designed to provide authenticated access to display management
services for remote displays. A new network server, called a \fIDisplay
Manager\fP, will use XDMCP to communicate with displays to negotiate the
startup of X sessions. The protocol allows the display to authenticate the
manager. It also allows most of the configuration information to be
centralized with the manager and to ease the burden of system administration
in a large network of displays.
The essential goal is to provide plug-and-play
services similar to those provided in the familiar mainframe/terminal world.
</para>
<para>
<!-- .LP -->
Displays may be turned off by the user at any time. Any existing session
running on a display that has been turned off must be identifiable. This
is made possible by requiring a three-way handshake to start a session. If
the handshake succeeds, any existing session is terminated immediately and a
new session started. There is the problem (at least with TCP) that
connections may not be closed when the display is turned off. In most
environments, the manager should reduce this problem by periodically XSync'ing
on its own connection, perhaps every five to ten minutes, and terminating the
session if its own connection ever closes.
</para>
<para>
<!-- .LP -->
Displays should not be required to retain permanent state for purposes of
the control protocol. One solution to packets received out of sequence
would be to use monotonically increasing message identifiers in each message
to allow both sides to ignore messages that arrive out-of-sequence. For
this to work, displays would at a minimum have to increment a stable crash
count each time they are powered on and use that number as part of a
larger sequence number. But if displays cannot retain permanent state this
cannot work. Instead, the manager assumes the responsibility for permanent
state by generating unique numbers that identify a particular session and
the protocol simply ignores packets that correspond to an invalid session.
</para>
<para>
<!-- .LP -->
The Manager must not be responsible for packet reception. To prevent the
Manager from becoming stuck because of a hostile display, no portion of the
protocol requires the Manager to retransmit a packet. Part of this means
that any valid packet that the Manager does receive must be
acknowledged in some way to prevent the display from continuously resending
packets. The display can keep the protocol running as it will always know
when the Manager has received (at least one copy of) a packet. On the
Manager side, this means that any packet may be received more than once (if
the response was lost) and duplicates must be ignored.
</para>
</chapter>
<chapter id="Data_Types">
<title>Data Types</title>
<!-- .XS -->
<!-- (SN Data Types -->
<!-- .XE -->
<para>
<!-- .LP -->
XDMCP packets contain several types of data. Integer values are always
stored most significant byte first in the packet ("Big Endian" order).
As XDMCP will not be used to transport large quantities of data, this
restriction will not substantially hamper the efficiency of any
implementation. Also, no padding of any sort will occur within the packets.
</para>
<informaltable frame="topbot">
<?dbfo keep-together="always" ?>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth="1.0*"/>
<colspec colname='c2' colwidth="1.0*"/>
<colspec colname='c3' colwidth="2.0*"/>
<thead>
<row rowsep='1'>
<entry>Type Name</entry>
<entry>Length (Bytes)</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>CARD8</entry>
<entry>1</entry>
<entry>A single byte unsigned integer</entry>
</row>
<row>
<entry>CARD16</entry>
<entry>2</entry>
<entry>Two byte unsigned integer</entry>
</row>
<row>
<entry>CARD32</entry>
<entry>4</entry>
<entry>Four byte unsigned integer</entry>
</row>
<row>
<entry>ARRAY8</entry>
<entry>n+2</entry>
<entry>
This is actually a CARD16 followed by
a collection of CARD8. The value of the CARD16
field (n) specifies the number of CARD8 values to follow
</entry>
</row>
<row>
<entry>ARRAY16</entry>
<entry>2*m+1</entry>
<entry>
This is a CARD8 (m) which specifies the
number of CARD16 values to follow
</entry>
</row>
<row>
<entry>ARRAY32</entry>
<entry>4*l+1</entry>
<entry>
This is a CARD8 (l) which specifies the
number of CARD32 values to follow
</entry>
</row>
<row>
<entry>ARRAYofARRAY8</entry>
<entry>?</entry>
<entry>
This is a CARD8 which specifies the
number of ARRAY8 values to follow.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</chapter>
<chapter id="Packet_Format">
<title>Packet Format</title>
<!-- .XS -->
<!-- (SN Packet Format -->
<!-- .XE -->
<para>
All XDMCP packets have the following information:
</para>
<informaltable frame="topbot">
<?dbfo keep-together="always" ?>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth="1.0*" />
<colspec colname='c2' colwidth="1.0*" />
<colspec colname='c3' colwidth="2.0*" />
<thead>
<row rowsep='1'>
<entry>Length (Bytes)</entry>
<entry>Field Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>2</entry>
<entry>CARD16</entry>
<entry>version number</entry>
</row>
<row>
<entry>2</entry>
<entry>CARD16</entry>
<entry>opcode packet header</entry>
</row>
<row>
<entry>2</entry>
<entry>CARD16</entry>
<entry>n = length of remaining data in bytes</entry>
</row>
<row>
<entry>n</entry>
<entry>???</entry>
<entry>packet-specific data</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<!-- .LP -->
The fields are as follows:
</para>
<variablelist>
<varlistentry>
<term>Version number</term>
<listitem>
<para>
This specifies the version of XDMCP that generated this packet in
case changes in this protocol are required. Displays and
managers may choose to support older versions for compatibility.
This field will initially be one (1).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Opcode</term>
<listitem>
<para>
This specifies what step of the protocol this packet represents and should
contain one of the following values (encoding provided in section below):
<emphasis role="bold">BroadcastQuery</emphasis>,
<emphasis role="bold">Query</emphasis>,
<emphasis role="bold">IndirectQuery</emphasis>,
<emphasis role="bold">ForwardQuery</emphasis>,
<emphasis role="bold">Willing</emphasis>,
<emphasis role="bold">Unwilling</emphasis>,
<emphasis role="bold">Request</emphasis>,
<emphasis role="bold">Accept</emphasis>,
<emphasis role="bold">Decline</emphasis>,
<emphasis role="bold">Manage</emphasis>,
<emphasis role="bold">Refuse</emphasis>,
<emphasis role="bold">Failed</emphasis>,
<emphasis role="bold">KeepAlive</emphasis>
or
<emphasis role="bold">Alive</emphasis>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Length of data in bytes</term>
<listitem>
<para>
This specifies the length of the information following the first 6 bytes.
Each packet-type has a different format and will need to be separately
length-checked against this value. Because every data item has either an
explicit or implicit length, this can be easily accomplished.
Packets that have too little or too much data should be ignored.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Packets should be checked to make sure that they satisfy the following
conditions:
</para>
<orderedlist>
<listitem>
<para>
They must contain valid opcodes.
</para>
</listitem>
<listitem>
<para>
The length of the remaining data should correspond to the sum of the
lengths of the individual remaining data items.
</para>
</listitem>
<listitem>
<para>
The opcode should be expected (a finite state diagram is given
in a later section).
</para>
</listitem>
<listitem>
<para>
If the packet is of type
<emphasis role="bold">Manage</emphasis> or
<emphasis role="bold">Refuse</emphasis>,
the Session ID should match the value sent in the preceding
<emphasis role="bold">Accept</emphasis> packet.
</para>
</listitem>
</orderedlist>
</chapter>
<chapter id="Protocol">
<title>Protocol</title>
<!-- .XS -->
<!-- (SN Protocol -->
<!-- .XE -->
<para>
Each of the opcodes is described below. Because a given packet type is only
ever sent one way, each packet description below indicates the direction.
Most of the packets have additional information included beyond the
description above. The additional information is appended to the packet
header in the order described without padding, and the length field is
computed accordingly.
</para>
<informaltable frame="none" colsep='0' rowsep='0'>
<tgroup cols='10' align='left'>
<colspec colname='col1' colwidth="1.0*"/>
<colspec colname='col2' colwidth="1.0*"/>
<colspec colname='col3' colwidth="1.0*"/>
<colspec colname='col4' colwidth="1.0*"/>
<colspec colname='col5' colwidth="1.0*"/>
<colspec colname='col6' colwidth="1.0*"/>
<colspec colname='col7' colwidth="1.0*"/>
<colspec colname='col8' colwidth="1.0*"/>
<colspec colname='col9' colwidth="1.0*"/>
<colspec colname='col10' colwidth="1.0*"/>
<spanspec namest="col1" nameend="col10" spanname="col1_on" align="left"/>
<spanspec namest="col2" nameend="col10" spanname="col2_on" align="left"/>
<spanspec namest="col3" nameend="col10" spanname="col3_on" align="left"/>
<spanspec namest="col4" nameend="col10" spanname="col4_on" align="left"/>
<spanspec namest="col5" nameend="col10" spanname="col5_on" align="left"/>
<tbody>
<row>
<entry spanname="col1_on"><emphasis role="bold">Query</emphasis></entry>
</row>
<row>
<entry spanname="col1_on"><emphasis role="bold">BroadcastQuery</emphasis></entry>
</row>
<row>
<entry spanname="col1_on"><emphasis role="bold">IndirectQuery</emphasis></entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">Display -> Manager</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">Additional Fields:</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis>Authentication Names</emphasis>: ARRAYofARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies a list of authentication names that the display supports. The
manager will choose one of these and return it in the
<emphasis role="bold">Willing</emphasis> packet.
</entry>
</row>
<!-- AAAAAAAAAAAAA -->
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">Semantics</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<para>
A <function>Query</function>
packet is sent from the display to a specific host to ask if
that host is willing to provide management services to this display. The
host should respond with
<function>Willing</function>
if it is willing to service the display or
<function>Unwilling</function>
if it is not.
</para>
<para>
A
<function>BroadcastQuery</function>
packet is similar to the
<function>Query</function>
packet except that it is intended to be received by all hosts on the network
(or subnetwork). However, unlike
<function>Query</function>
requests, hosts that are not willing to service the display
should simply ignore
<function>BroadcastQuery</function>
requests.
</para>
<para>
An
<function>IndirectQuery</function>
packet is sent to a well known manager that forwards
the request to a larger collection of secondary managers using
<function>ForwardQuery</function>
packets.
In this way, the collection of managers that respond can be grouped
on other than network boundaries; the use of a central manager reduces
system administrative overhead.
The primary manager may also send a
<function>Willing</function>
packet in response to this packet.
</para>
<para>
Each packet type has slightly different semantics:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<para>
The
<function>Query</function>
packet is destined only for a single host.
If the display is instructed to
<function>Query</function>
multiple managers, it will send multiple
<function>Query</function>
packets. The
<function>Query</function>
packet also demands a response from the manager, either
<function>Willing</function>
or
<function>Unwilling</function>.
</para>
<para>
The
<function>BroadcastQuery</function>
packet is sent to many hosts.
Each manager that receives this packet will not respond with an
<function>Unwilling</function>
packet.
</para>
<para>
The
<function>IndirectQuery</function>
packet is sent to only one manager with the request
that the request be forwarded to a larger list of managers using
<function>ForwardQuery</function>
packets. This list is expected to be maintained at one
central site to reduce administrative overhead.
The function of this packet type is similar to
<function>BroadcastQuery except that</function>
<function>BroadcastQuery</function>
is not forwarded.
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">Valid Responses:</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<function>Willing</function>,
<function>Unwilling</function>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">Problems/Solutions:</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">Problem:</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<para>Not all managers receive the query packet.</para>
<para>Indication:</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
None if
<function>BroadcastQuery</function>
or
<function>IndirectQuery</function>
was sent, else failure to receive
<function>Willing</function>.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">Solution:</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Repeatedly send the packet while waiting for user to choose a manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
An exponential backoff algorithm should be used here to reduce network load
for long-standing idle displays. Start at 2 seconds, back off by factors of
2 to 32 seconds, and discontinue retransmit after 126 seconds. The display
should reset the timeout when user-input is detected. In this way, the
display will wakeup when touched by the user.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>ForwardQuery</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>Primary Manager -> Secondary Manager</para>
<para>Additional Fields:</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Client Address</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies the network address of the client display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Client Port</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies an identification of the client task on the client display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Authentication Names</emphasis>: ARRAYofARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is a duplicate of Authentication Names array that was received
in the
<function>IndirectQuery</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
When primary manager receives a
<function>IndirectQuery</function>
packet, it is responsible for sending
<function>ForwardQuery</function>
packets to an appropriate list of
managers that can provide service to the display using the same network
type as the one the original
<function>IndirectQuery</function>
packet was received from.
The Client Address and Client Port fields must contain an
address that the secondary manager can use to reach the display also using
this same network. Each secondary manager sends a
<function>Willing</function>
packet to the display if it is willing to provide service.
</para>
<para>
<function>ForwardQuery</function>
packets are similar to
<function>BroadcastQuery</function>
packets in that managers that are not willing to service
particular displays should not send a
<function>Unwilling</function>
packet.
</para>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Valid Responses:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<function>Willing</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Identical to
<function>BroadcastQuery</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from a manager, this packet should never be
retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Willing</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<para>
Specifies the authentication method, selected from the list offered in the
<function>Query ,</function>
<function>BroadcastQuery ,</function>
or
<function>IndirectQuery</function>
packet that the manger expects the display to use in the subsequent
<function>Request</function>
packet.
This choice should remain as constant as feasible so that displays that
send multiple
<function>Query</function>
packets can use the Authentication Name from any
<function>Willing</function>
packet that arrives.
</para>
<para>
The display is free to ignore managers that request an insufficient level
of authentication.
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Hostname</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is a human readable string describing the host from which the packet was sent.
The protocol specifies no interpretation of the data in this field.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Status</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is a human readable string describing the status of the host. This could
include load average/number of users connected or other information. The
protocol specifies no interpretation of the data in this field.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Willing</function>
packet is sent by managers that may service connections from
this display. It is sent in response to either a
<function>Query ,</function>
<function>BroadcastQuery ,</function>
or
<function>ForwardQuery</function>
but does not imply a commitment to provide service
(for example, it may later decide that it has accepted enough
connections already).
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<para>
<function>Willing</function>
not received by the display.
</para>
<para>
Indication:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
None if
<function>BroadcastQuery</function>
or
<function>IndirectQuery</function>
was sent, else failure to receive
<function>Willing .</function>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
The display should continue to send the query until a response is received.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from the manager to the display, this packet should
never be retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Unwilling</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
The Hostname and Status fields as in the
<function>Willing</function>
packet.
The Status field should indicate to the user a reason
for the refusal of service.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
An
<function>Unwilling</function>
packet is sent by managers in response to direct
<function>Query</function>
requests (as opposed to
<function>BroadcastQuery</function>
or
<function>IndirectQuery</function>
requests) if the manager will not accept requests for management.
This is typically sent by managers that wish to only service
particular displays or that handle a limited number of displays at once.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<para>
<function>Unwilling</function>
not received by the display.
</para>
<para>
Indication:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display fails to receive
<function>Unwilling .</function>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
The display should continue to send
<function>Query</function>
messages until a response is received.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from the manager to the display, this packet should
never be retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Request</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Display -> Manager
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Display Number</emphasis>: CARD16
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies the index of this particular server for the host
on which the display is resident.
This value will be zero for most autonomous displays.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Connection Types</emphasis>: ARRAY16
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies an array indicating the stream services accepted by the display.
If the high-order byte in a particular entry is zero, the low-order byte
corresponds to an X-protocol host family type.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Connection Addresses</emphasis>: ARRAYofARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
For each connection type in the previous array, the corresponding entry in
this array indicates the network address of the display device.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
</para>
<para>
<emphasis remap='I'>Authentication Data</emphasis>: ARRAY8
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies the authentication protocol that the display expects
the manager to validate itself with. The Authentication Data is
expected to contain data that the manager will interpret, modify
and use to authenticate itself.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Authorization Names</emphasis>: ARRAYofARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies which types of authorization the display supports. The
manager may decide to reject displays with which it cannot perform
authorization.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Manufacturer Display ID</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Can be used by the manager to determine how to decrypt the
Authentication Data field in this packet. See the section below on
Manufacturer Display ID Format.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Request</function>
packet is sent by a display to a specific host to request a
session ID in preparation for a establishing a connection. If the manager
is willing to service a connection to this display, it should return an
<function>Accept</function>
packet with a valid session ID and should be ready for a subsequent
<function>Manage</function>
request. Otherwise, it should return a
<function>Decline</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Valid Responses:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<function>Accept ,</function>
<function>Decline</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Request not received by manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display timeout waiting for response.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display resends
<function>Request</function>
message.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Message received out of order by manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
None.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Each time a
<function>Request</function>
is sent, the manager sends the Session ID
associated with the next session in the
<function>Accept .</function>
If that next session is not yet started,
the manager will simply resend with the same Session ID.
If the session is in progress, the manager will reply
with a new Session ID; in which case, the
<function>Accept</function>
will be discarded by the display.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Timeout after 2 seconds, exponential backoff to 32 seconds.
After no more than 126 seconds, give up and report an error to the user.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Accept</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Identifies the session that can be started by the manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
<emphasis remap='I'>Authentication Name</emphasis>: ARRAY8
</para>
<para>
<emphasis remap='I'>Authentication Data</emphasis>: ARRAY8
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is the data sent back to the display to authenticate the manager.
If the Authentication Data is not the value expected by the display, it
should terminate the protocol at this point and display an error to the user.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
<emphasis remap='I'>Authorization Name</emphasis>: ARRAY8
</para>
<para>
<emphasis remap='I'>Authorization Data</emphasis>: ARRAY8
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is the data sent to the display to indicate the type of authorization the
manager will be using in the first call to
<olink targetdoc='libX11' targetptr='XOpenDisplay'><function>XOpenDisplay</function></olink>
after the
<function>Manage</function>
packet is received.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
An
<function>Accept</function>
packet is sent by a manager in response to a
<function>Request</function>
packet if the manager is willing to establish a connection for the display.
The Session ID is used to identify this connection from any preceding
ones and will be used by the display in its subsequent
<function>Manage</function>
packet.
The Session ID is a 32-bit number that is incremented each time an
<function>Accept</function>
packet is sent as it must be unique over a reasonably long period of time.
</para>
<para>
If the authentication information is invalid, a
<function>Decline</function>
packet will be returned with an appropriate
<function>Status</function>
message.
</para>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<function>Accept</function>
or
<function>Decline</function>
not received by display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display timeout waiting for response to
<function>Request .</function>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display resends
<function>Request</function>
message.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Message received out of order by display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display receives
<function>Accept</function>
after
<function>Manage</function>
has been sent.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display discards
<function>Accept</function>
messages after it has sent a
<function>Manage</function>
message.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from the manager to the display, this packet should
never be retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Decline</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Status</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is a human readable string indicating the reason for refusal of
service.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
<emphasis remap='I'>Authentication Name</emphasis>:
ARRAY8
</para>
<para>
<emphasis remap='I'>Authentication Data</emphasis>:
ARRAY8
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is the data sent back to the display to authenticate the manager. If the
Authentication Data is not the value expected by the display, it
should terminate the protocol at this point and display an error to the user.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Decline</function>
packet is sent by a manager in response to a
<function>Request</function>
packet if the manager is unwilling to establish a connection for the
display.
This is allowed even if the manager had responded
<function>Willing</function>
to a previous query.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Same as for
<function>Accept .</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from a manager to a display, this packet should never
be retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Manage</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Display -> Manager
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Should contain the nonzero session ID returned in the
<function>Accept</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Display Number</emphasis>: CARD16
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Must match the value sent in the previous
<function>Request</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Display Class</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies the class of the display.
See the Display Class Format section,
which discusses the format of this field.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Manage</function>
packet is sent by a display to ask the manager to begin a
session on the display. If the Session ID is correct the manager
should open a connection; otherwise, it should respond with a
<function>Refuse</function>
or
<function>Failed</function>
packet, unless the Session ID matches a currently
running session or a session that has not yet successfully opened the
display but has not given up the attempt. In this latter case, the
<function>Manage</function>
packet should be ignored.
This will work as stream connections give positive success indication
to both halves of the stream, and positive failure indication
to the connection initiator (which will eventually generate a
<function>Failed</function>
packet).
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Valid Responses:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
X connection with correct auth info,
<function>Refuse ,</function>
<function>Failed .</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<function>Manage</function>
not received by manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display timeout waiting for response.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display resends
<function>Manage</function>
message.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
<function>Manage</function>
received out of order by manager.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Session already in progress with matching Session ID.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<function>Manage</function>
packet ignored.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Session ID does not match next Session ID.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<function>Refuse</function>
message is sent.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Display cannot be opened on selected stream.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display connection setup fails.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<function>Failed</function>
message is sent including a human readable reason.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Display open does not succeed before a second manage packet is received
because of a timeout occuring in the display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<function>Manage</function>
packet received with Session ID matching the session
attempting to connect to the display.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
<function>Manage</function>
packet is ignored. As the stream connection will either
succeed, which will result in an active session, or the stream will
eventually give up hope of connecting and send a
<function>Failed</function>
packet; no response to this
<function>Manage</function>
packet is necessary.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Timeout after 2 seconds, exponential backoff to 32 seconds. After no more
than 126 seconds, give up and report an error to the user.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Refuse</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Should be set to the Session ID received in the
<function>Manage</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Refuse</function>
packet is sent by a manager when the Session ID received in the
<function>Manage</function>
packet does not match the current Session ID.
The display should assume that it received an old
<function>Accept</function>
packet and should resend its
<function>Request</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Error message is lost.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display times out waiting for
new connection,
<function>Refuse</function>
or
<function>Failed .</function>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Display resends
<function>Manage</function>
message.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Timeout/Retransmission policy:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Like all packets sent from a manager to a display, this packet should never be
retransmitted.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Failed</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Should be set to the Session ID received in the
<function>Manage</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Status</emphasis>: ARRAY8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Is a human readable string indicating the reason for failure.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
A
<function>Failed</function>
packet is sent by a manager when it has problems establishing
the initial X connection in response to the
<function>Manage</function>
packet.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Same as for
<function>Refuse .</function>
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>KeepAlive</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Display -> Manager
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Display Number</emphasis>: CARD16
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Set to the display index for the display host.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Should be set to the Session ID received in the
<function>Manage</function>
packet during the negotiation for the current session.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Sematics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<para>
A
<function>KeepAlive</function>
packet can be sent at any time during the session by a
display to discover if the manager is running.
The manager should respond with
<function>Alive</function>
whenever it receives this type of packet.
</para>
<para>
This allows the display to discover when the manager host
is no longer running.
A display is not required to send
<function>KeepAlive</function>
packets and, upon lack of receipt of
<function>Alive</function>
packets, is not required to perform any specific action.
</para>
<para>
The expected use of this packet is to terminate an active session when the
manager host or network link fails. The display should keep track of the
time since any packet has been received from the manager host and use
<function>KeepAlive</function>
packets when a substantial time has elapsed since the
most recent packet.
</para>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Valid Responses:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<function>Alive</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Problems/Solutions:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
Problem:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Manager does not receive the packet or display does not receive the response.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indication:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
No
<function>Alive</function>
packet is returned.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Solution:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col5_on">
Retransmit the packet with an exponential backoff; start at 2 seconds and
assume the host is not up after no less than 30 seconds.
</entry>
</row>
<row>
<entry spanname="col1_on">
<function>Alive</function>
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
<para>
Manager -> Display
</para>
<para>
Additional Fields:
</para>
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session Running</emphasis>: CARD8
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Indicates that the session identified by Session ID is
currently active. The value is zero if no session is active
or one if a session
is active.
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
<emphasis remap='I'>Session ID</emphasis>: CARD32
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry></entry>
<entry spanname="col4_on">
Specifies the ID of the currently running session; if any.
When no session is active this field should be zero.
</entry>
</row>
<row>
<entry></entry>
<entry spanname="col2_on">
Semantics:
</entry>
</row>
<row>
<entry></entry>
<entry></entry>
<entry spanname="col3_on">
An
<function>Alive</function>
packet is sent in response to a
<function>KeepAlive</function>
request.
If a session is currently active on the display, the manager includes the
Session ID in the packet. The display can use this information to
determine the status of the manager.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</chapter>
<chapter id="Session_Termination">
<title>Session Termination</title>
<para>
When the session is over, the initial connection with the display (the one
that acknowledges the
<function>Manage</function>
packet) will be closed by the manager.
If only a single session was active on the display,
all other connections should be closed by the display
and the display should be reset. If multiple sessions
are active simultaneously and the display can identify which connections
belong to the terminated sesssion, those connections should be closed.
Otherwise, all connections should be closed and the display reset only when
all sessions have been terminated (that is, all initial connections closed).
</para>
<para>
The session may also be terminated at any time by the display if the
managing host no longer responds to
<function>KeepAlive</function>
packets.
The exact time-outs for sending
<function>KeepAlive</function>
packets is not specified in this protocol as the trade off
should not be fixed between loading an otherwise idle system with spurious
<function>KeepAlive</function>
packets and not noticing that the manager host is down for a long time.
</para>
</chapter>
<chapter id="State_Diagrams">
<title>State Diagrams</title>
<!-- .XS -->
<!-- (SN State Diagrams -->
<!-- .XE -->
<para>
<!-- .LP -->
The following state diagrams are designed to cover all actions of both
the display and the manager. Any packet that is received out-of-sequence
will be ignored.
</para>
<para>
<!-- .LP -->
Display:
</para>
<variablelist>
<varlistentry>
<term><emphasis remap='I'>start</emphasis>:</term>
<listitem>
<para>
User-requested connect to one host -> <emphasis remap='I'>query</emphasis>
</para>
<para>
User-requested connect to some host -> <emphasis remap='I'>broadcast</emphasis>
</para>
<para>
User-requested connect to site host-list -> <emphasis remap='I'>indirect</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>query</emphasis>:</term>
<listitem>
<para>
Send <function>Query</function> packet
-> <emphasis remap='I'>collect-query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>collect-query</emphasis>:</term>
<listitem>
<para>
Receive <function>Willing</function> ->
<emphasis remap='I'>start-connection</emphasis>
</para>
<para>
Receive <function>Unwilling</function> ->
<emphasis remap='I'>stop-connection</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>broadcast</emphasis>:</term>
<listitem>
<para>
Send <function>BroadcastQuery</function> packet
</para>
<para>
-> <emphasis remap='I'>collect-broadcast-query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>collect-broadcast-query</emphasis>:</term>
<listitem>
<para>
Receive <function>Willing</function> ->
<emphasis remap='I'>update-broadcast-willing</emphasis>
</para>
<para>
User-requested connect to one host ->
<emphasis remap='I'>start-connection</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>broadcast</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>update-broadcast-willing</emphasis>:</term>
<listitem>
<para>
Add new host to the host list presented to the user
</para>
<para>
-> <emphasis remap='I'>collect-broadcast-query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>indirect</emphasis>:</term>
<listitem>
<para>
Send <function>IndirectQuery</function> packet
</para>
<para>
-> <emphasis remap='I'>collect-indirect-query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>collect-indirect-query</emphasis>:</term>
<listitem>
<para>
Receive <function>Willing</function> ->
<emphasis remap='I'>update-indirect-willing</emphasis>
</para>
<para>
User-requested connect to one host ->
<emphasis remap='I'>start-connection</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>indirect</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>update-indirect-willing</emphasis>:</term>
<listitem>
<para>
Add new host to the host list presented to the user
</para>
<para>
-> <emphasis remap='I'>collect-indirect-query</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>start-connection</emphasis>:</term>
<listitem>
<para>
Send <function>Request</function> packet
</para>
<para>
-> <emphasis remap='I'>await-request-response</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>await-request-response</emphasis>:</term>
<listitem>
<para>
Receive <function>Accept</function> ->
<emphasis remap='I'>manage</emphasis>
</para>
<para>
Receive <function>Decline</function> ->
<emphasis remap='I'>stop-connection</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>start-connection</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>manage</emphasis>:</term>
<listitem>
<para>
Save Session ID
</para>
<para>
Send <function>Manage</function> packet with Session ID
</para>
<para>
-> <emphasis remap='I'>await-manage-response</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>await-manage-response</emphasis>:</term>
<listitem>
<para>
Receive <function>XOpenDisplay :</function> ->
<emphasis remap='I'>run-session</emphasis>
</para>
<para>
Receive <function>Refuse</function> with matching Session ID
-> <emphasis remap='I'>start-connection</emphasis>
</para>
<para>
Receive <function>Failed</function> with matching Session ID
-> <emphasis remap='I'>stop-connection</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>manage</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>stop-connection</emphasis>:</term>
<listitem>
<para>
Display cause of termination to user
</para>
<para>
-> <emphasis remap='I'>start</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>run-session</emphasis>:</term>
<listitem>
<para>
Decide to send <function>KeepAlive</function> packet ->
<emphasis remap='I'>keep-alive</emphasis>
</para>
<para>
wait close of first display connection
</para>
<para>
-> <emphasis remap='I'>reset-display</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>keep-alive</emphasis>:</term>
<listitem>
<para>
Send <function>KeepAlive</function> packet with current Session ID
</para>
<para>
-> <emphasis remap='I'>await-alive</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>await-alive</emphasis>:</term>
<listitem>
<para>
Receive <function>Alive</function> with matching Session ID ->
<emphasis remap='I'>run-session</emphasis>
</para>
<para>
Receive <function>Alive</function> with nonmatching Session ID
or FALSE Session Running -> <emphasis remap='I'>reset-display</emphasis>
</para>
<para>
Final timeout without receiving <function>Alive</function>
packet -> <emphasis remap='I'>reset-display</emphasis>
</para>
<para>
Timeout -> <emphasis remap='I'>keep-alive</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>reset-display</emphasis>:</term>
<listitem>
<para>
(if possible) -> close all display connections associated with this session
</para>
<para>
Last session -> close all display connections
</para>
<para>
-> <emphasis remap='I'>start</emphasis>
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Manager:
</para>
<variablelist>
<varlistentry>
<term><emphasis remap='I'>idle</emphasis>:</term>
<listitem>
<para>
Receive <function>Query</function> ->
<emphasis remap='I'>query-respond</emphasis>
</para>
<para>
Receive
<function>BroadcastQuery</function>
-> <emphasis remap='I'>broadcast-respond</emphasis>
</para>
<para>
Receive
<function>IndirectQuery</function>
-> <emphasis remap='I'>indirect-respond</emphasis>
</para>
<para>
Receive
<function>ForwardQuery</function>
-> <emphasis remap='I'>forward-respond</emphasis>
Receive
</para>
<para>
<function>Request</function>
-> <emphasis remap='I'>request-respond</emphasis>
</para>
<para>
Receive
<function>Manage</function>
-> <emphasis remap='I'>manage</emphasis>
</para>
<para>
An active session terminates
-> <emphasis remap='I'>finish-session</emphasis>
</para>
<para>
Receive <function>KeepAlive</function>
-> <emphasis remap='I'>send-alive</emphasis>
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>query-respond</emphasis>:</term>
<listitem>
<para>
If willing to manage -> <emphasis remap='I'>send-willing</emphasis>
</para>
<para>
-> <emphasis remap='I'>send-unwilling</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>broadcast-respond</emphasis>:</term>
<listitem>
<para>
If willing to manage -> <emphasis remap='I'>send-willing</emphasis>
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>indirect-respond</emphasis>:</term>
<listitem>
<para>
Send <function>ForwardQuery</function>
packets to all managers on redirect list
</para>
<para>
If willing to manage -> <emphasis remap='I'>send-willing</emphasis>
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>forward-respond</emphasis>:</term>
<listitem>
<para>
Decode destination address, if willing to manage ->
<emphasis remap='I'>send-willing</emphasis>
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>send-willing</emphasis>:</term>
<listitem>
<para>
Send <function>Willing</function> packet
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>send-unwilling</emphasis>:</term>
<listitem>
<para>
Send <function>Unwilling</function> packet
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>request-respond</emphasis>:</term>
<listitem>
<para>
If manager is willing to allow a session on display
-> <emphasis remap='I'>accept-session</emphasis>
</para>
<para>
-> <emphasis remap='I'>decline-session</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>accept-session</emphasis>:</term>
<listitem>
<para>
Generate Session ID and save Session ID, display address, and
display number somewhere
</para>
<para>
Send <function>Accept</function> packet
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>decline-session</emphasis>:</term>
<listitem>
<para>
Send <function>Decline</function> packet
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>manage</emphasis>:</term>
<listitem>
<para>
If Session ID matches saved Session ID ->
<emphasis remap='I'>run-session</emphasis>
</para>
<para>
If Session ID matches Session ID of session in process of
starting up, or currently active session ->
<emphasis remap='I'>idle</emphasis>
</para>
<para>
-> <emphasis remap='I'>refuse</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>refuse</emphasis>:</term>
<listitem>
<para>
Send <function>Refuse</function> packet
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>run-session</emphasis>:</term>
<listitem>
<para>
Terminate any session in progress
</para>
<para>
<olink targetdoc='libX11' targetptr='XOpenDisplay'><function>XOpenDisplay</function></olink>
</para>
<para>
Open display succeeds ->
<emphasis remap='I'>start-session</emphasis>
</para>
<para>
-> <emphasis remap='I'>failed</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>failed</emphasis>:</term>
<listitem>
<para>
Send <function>Failed</function> packet
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>start-session</emphasis>:</term>
<listitem>
<para>
Start a new session
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>finish-session</emphasis>:</term>
<listitem>
<para>
<function>XCloseDisplay</function>
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>send-alive</emphasis>:</term>
<listitem>
<para>
Send <function>Alive</function> packet containing current status
</para>
<para>
-> <emphasis remap='I'>idle</emphasis>
</para>
</listitem>
</varlistentry>
</variablelist>
</chapter>
<chapter id="Protocol_Encoding">
<title>Protocol Encoding</title>
<para>
When XDMCP is implemented on top of the Internet User Datagram Protocol (UDP),
port number 177 is to be used. When using UDP over IPv4, Broadcast Query
packets are sent via UDP broadcast. When using UDP over IPv6, Broadcast Query
packets are sent via multicast, either to an address in the IANA registered
XDMCP multicast address range of
FF0<emphasis remap='I'>X</emphasis>:0:0:0:0:0:0:12B
(where the <emphasis remap='I'>X</emphasis> is replaced by a valid scope id)
or to a locally assigned
multicast address. The version number in all packets will be 1.
Packet opcodes are 16-bit integers.
</para>
<informaltable frame="topbot">
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth="1.0*"/>
<colspec colname='c2' colwidth="3.0*"/>
<thead>
<row rowsep='1'>
<entry>Packet Name</entry>
<entry>Encoding</entry>
</row>
</thead>
<tbody>
<row>
<entry>BroadcastQuery</entry>
<entry>1</entry>
</row>
<row>
<entry>Query</entry>
<entry>2</entry>
</row>
<row>
<entry>IndirectQuery</entry>
<entry>3</entry>
</row>
<row>
<entry>ForwardQuery</entry>
<entry>4</entry>
</row>
<row>
<entry>Willing</entry>
<entry>5</entry>
</row>
<row>
<entry>Unwilling</entry>
<entry>6</entry>
</row>
<row>
<entry>Request</entry>
<entry>7</entry>
</row>
<row>
<entry>Accept</entry>
<entry>8</entry>
</row>
<row>
<entry>Decline</entry>
<entry>9</entry>
</row>
<row>
<entry>Manage</entry>
<entry>10</entry>
</row>
<row>
<entry>Refuse</entry>
<entry>11</entry>
</row>
<row>
<entry>Failed</entry>
<entry>12</entry>
</row>
<row>
<entry>KeepAlive</entry>
<entry>13
<footnote><para>
A previous version of this document incorrectly reversed the opcodes of
<emphasis role="bold">Alive</emphasis> and
<emphasis role="bold">KeepAlive</emphasis>.
</para></footnote>
</entry>
</row>
<row>
<entry>Alive</entry>
<entry>14
<footnote><para>
A previous version of this document incorrectly reversed the opcodes of
<emphasis role="bold">Alive</emphasis> and
<emphasis role="bold">KeepAlive</emphasis>.
</para></footnote>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Per packet information follows:
</para>
<para>
<function>Query</function>,
<function>BroadcastQuery</function>,
<function>IndirectQuery</function>
</para>
<literallayout class="monospaced">
2 CARD16 version number (always 1)
2 CARD16 opcode (always Query, BroadcastQuery or IndirectQuery)
2 CARD16 length
1 CARD8 number of Authentication Names sent (m)
2 CARD16 length of first Authentication Name (m<emphasis role="subscript">1</emphasis>)
m<emphasis role="subscript">1</emphasis> CARD8 first Authentication Name
... Other Authentication Names
</literallayout>
<para>
Note that these three packets are identical except for the opcode field.
</para>
<literallayout class="monospaced">
<function>ForwardQuery</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always ForwardQuery)
2 CARD16 length
2 CARD16 length of Client Address (m)
m CARD8 Client Address
2 CARD16 length of Client Port (n)
n CARD8 Client Port
1 CARD8 number of Authentication Names sent (o)
2 CARD16 length of first Authentication Name (o<emphasis role="subscript">1</emphasis>)
o<emphasis role="subscript">1</emphasis> CARD8 first Authentication Name
... Other Authentication Names
</literallayout>
<literallayout class="monospaced">
<function>Willing</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Willing)
2 CARD16 length (6 + m + n + o)
2 CARD16 Length of Authentication Name (m)
m CARD8 Authentication Name
2 CARD16 Hostname length (n)
n CARD8 Hostname
2 CARD16 Status length (o)
o CARD8 Status
</literallayout>
<literallayout class="monospaced">
<function>Unwilling</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Unwilling)
2 CARD16 length (4 + m + n)
2 CARD16 Hostname length (m)
m CARD8 Hostname
2 CARD16 Status length (n)
n CARD8 Status
</literallayout>
<literallayout class="monospaced">
<function>Request</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Request)
2 CARD16 length
2 CARD16 Display Number
1 CARD8 Count of Connection Types (m)
2xm CARD16 Connection Types
1 CARD8 Count of Connection Addresses (n)
2 CARD16 Length of first Connection Address (n<emphasis role="subscript">1</emphasis>)
n<emphasis role="subscript">1</emphasis> CARD8 First Connection Address
... Other connection addresses
2 CARD16 Length of Authentication Name (o)
o CARD8 Authentication Name
2 CARD16 Length of Authentication Data (p)
p CARD8 Authentication Data
1 CARD8 Count of Authorization Names (q)
2 CARD16 Length of first Authorization Name (q<emphasis role="subscript">1</emphasis>)
q<emphasis role="subscript">1</emphasis> CARD8 First Authorization Name
... Other authorization names
2 CARD16 Length of Manufacturer Display ID (r)
r CARD8 Manufacturer Display ID
</literallayout>
<literallayout class="monospaced">
<function>Accept</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Accept)
2 CARD16 length (12 + n + m + o + p)
4 CARD32 Session ID
2 CARD16 Length of Authentication Name (n)
n CARD8 Authentication Name
2 CARD16 Length of Authentication Data (m)
m CARD8 Authentication Data
2 CARD16 Length of Authorization Name (o)
o CARD8 Authorization Name
2 CARD16 Length of Authorization Data (p)
p CARD8 Authorization Data
</literallayout>
<literallayout class="monospaced">
<function>Decline</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Decline)
2 CARD16 length (6 + m + n + o)
2 CARD16 Length of Status (m)
m CARD8 Status
2 CARD16 Length of Authentication Name (n)
n CARD8 Authentication Name
2 CARD16 Length of Authentication Data (o)
o CARD8 Authentication Data
</literallayout>
<literallayout class="monospaced">
<function>Manage</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Manage)
2 CARD16 length (8 + m)
4 CARD32 Session ID
2 CARD16 Display Number
2 CARD16 Length of Display Class (m)
m CARD8 Display Class
</literallayout>
<literallayout class="monospaced">
<function>Refuse</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Refuse)
2 CARD16 length (4)
4 CARD32 Session ID
</literallayout>
<literallayout class="monospaced">
<function>Failed</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Failed)
2 CARD16 length (6 + m)
4 CARD32 Session ID
2 CARD16 Length of Status (m)
m CARD8 Status
</literallayout>
<literallayout class="monospaced">
<function>KeepAlive</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always KeepAlive)
2 CARD16 length (6)
2 CARD16 Display Number
4 CARD32 Session ID
</literallayout>
<literallayout class="monospaced">
<function>Alive</function>
2 CARD16 version number (always 1)
2 CARD16 opcode (always Alive)
2 CARD16 length (5)
1 CARD8 Session Running (0: not running 1: running)
4 CARD32 Session ID (0: not running)
</literallayout>
</chapter>
<chapter id="Display_Class_Format">
<title>Display Class Format</title>
<!-- .XS -->
<!-- (SN Display Class Format -->
<!-- .XE -->
<para>
The Display Class field of the
<function>Manage</function>
packet is used by the display manager to collect common sorts of
displays into manageable groups. This field is a string encoded of
ISO-LATIN-1 characters in the following format:
</para>
<literallayout class="monospaced">
<emphasis remap='I'>ManufacturerID</emphasis>-<emphasis remap='I'>ModelNumber</emphasis>
</literallayout>
<para>
Both elements of this string must exclude characters of the set
{ <function>-</function>,
<function>.</function>,
<function>:</function>,
<function>*</function>,
<function>?</function>,
<emphasis remap='I'><space></emphasis> }.
The ManufacturerID is a string that should be registered
with the X Consortium.
The ModelNumber is designed to identify characteristics of the display
within the manufacturer's product line.
This string should be documented in the users manual for the
particular device and should probably not be specifiable by the
display user to avoid unexpected configuration errors.
</para>
</chapter>
<chapter id="Manufacturer_Display_ID_Format">
<title>Manufacturer Display ID Format</title>
<!-- .XS -->
<!-- (SN Manufacturer Display ID Format -->
<!-- .XE -->
<para>
To authenticate the manager, the display and manager will share a private
key.
The manager, then, must be able to discover which key to use for a
particular device.
The Manufacturer Display ID field of the
<function>Request</function>
packet is intended for this purpose. Typically, the manager host will
contain a map between this number and the key. This field is intended to be
unique per display, possibly the ethernet address of the display in the form:
</para>
<literallayout class="monospaced">
-Ethernet-8:0:2b:a:f:d2
</literallayout>
<para>
It can also be a string of the form:
</para>
<literallayout class="monospaced">
<emphasis remap='I'>ManufacturerID</emphasis>-<emphasis remap='I'>ModelNumber</emphasis>-<emphasis remap='I'>SerialNumber</emphasis>
</literallayout>
<para>
The ManufacturerID, ModelNumber and SerialNumber are encoded using
ISO-LATIN-1 characters, excluding {
<function>-</function>,
<function>.</function>,
<function>*</function>,
<function>?</function>,
<emphasis remap='I'><space></emphasis> }
</para>
<para>
When the display is shipped to a customer, it should include both the
Manufacturer Display ID and the private key in the documentation set.
This information should not be modifiable by the display user.
</para>
</chapter>
<chapter id="Authentication">
<title>Authentication</title>
<!-- .XS -->
<!-- (SN Authentication -->
<!-- .XE -->
<para>
In an environment where authentication is not needed, XDMCP can disable
authentication by having the display send empty Authentication Name
and Authentication Data fields in the
<function>Request</function>
packet.
In this case, the manager will not attempt to authenticate itself.
Other authentication protocols may be developed, depending on local needs.
</para>
<para>
In an unsecure environment, the display must be able to verify that the
source of the various packets is a trusted manager. These packets will
contain authentication information. As an example of such a system, the
following discussion describes the "XDM-AUTHENTICATION-1" authentication
system. This system uses a 56-bit shared private key, and 64 bits of
authentication data. An associated example X authorization protocol
"XDM-AUTHORIZATION-1" will also be discussed. The 56-bit key is represented
as a 64-bit number in network order (big endian). This means that the first
octet in the representation will be zero. When incrementing a 64-bit value,
the 8 octets of data will be interpreted in network order (big endian).
That is, the last octet will be incremented, subsequent carries propogate
towards the first octet.
</para>
<para>
Assumptions:
</para>
<orderedlist>
<listitem>
<para>
The display and manager share a private key. This key could be programmed
into the display by the manufacturer and shipped with the unit. It must not
be available from the display itself, but should allow the value to be
modified in some way. The system administrator would be responsible for
managing a database of terminal keys.
</para>
</listitem>
<listitem>
<para>
The display can generate random authentication numbers.
</para>
</listitem>
</orderedlist>
<para>
Some definitions first:
</para>
<!-- FIXME: -->
<!-- double chk math symbols, use mathml to display them? -->
<itemizedlist>
<listitem>
<para>
{&variable.D;}<superscript>&variable.kappa;</superscript> = encryption of plain text D by key &variable.kappa;
</para>
</listitem>
<listitem>
<para>
{&variable.Delta;}*<superscript>&variable.kappa;</superscript> = decryption of crypto text &variable.Delta; with key &variable.kappa;
</para>
</listitem>
<listitem>
<para>
&variable.tau; = private key shared by display and manager
</para>
</listitem>
<listitem>
<para>
&variable.rho; = 64 bit random number generated by display
</para>
</listitem>
<listitem>
<para>
&variable.alpha; = authentication data in XDMCP packets
</para>
</listitem>
<listitem>
<para>
&variable.sigma; = per-session private key, generated by manager
</para>
</listitem>
<listitem>
<para>
&variable.beta; = authorization data
</para>
</listitem>
</itemizedlist>
<para>
Encryption will use the Data Encryption Standard (DES, FIPS 46-3); blocks
shorter than 64 bits will be zero-filled
on the right to 64 bits. Blocks longer than 64 bits will use block chaining:
</para>
<para>
{&variable.D;}<superscript>&variable.kappa;</superscript> = {&variable.D;<subscript>1</subscript>}<superscript>&variable.kappa;</superscript> {&variable.D;<subscript>2</subscript> xor {&variable.D;<subscript>1</subscript>}<superscript>&variable.kappa;</superscript>}<superscript>&variable.kappa;</superscript>
</para>
<para>
The display generates the first authentication data in the
<function>Request</function>
packet:
</para>
<para>
&variable.alpha;<subscript>Request</subscript> = {&variable.rho;}<superscript>&variable.tau;</superscript>
</para>
<para>
For the <function>Accept</function>
packet, the manager decrypts the initial message and returns
&variable.alpha;<subscript>Accept</subscript>:
</para>
<para>
&variable.rho; = {&variable.alpha;<subscript>Request</subscript>}*<superscript>&variable.tau;</superscript>
</para>
<para>
&variable.alpha;<subscript>Accept</subscript> = { &variable.rho; + 1}<superscript>&variable.tau;</superscript>
</para>
<para>
The <function>Accept</function>
packet also contains the authorization intended for use by
the X server. A description of authorization type "XDM-AUTHORIZATION-1"
follows.
</para>
<para>
The <function>Accept</function>
packet contains the authorization name
"XDM-AUTHORIZATION-1". The authorization data is the string:
</para>
<para>
&variable.beta;<subscript>Accept</subscript> = {&variable.sigma;}<superscript>&variable.tau;</superscript>
</para>
<para>
To create authorization information for connection setup with the X server
using the XDM-AUTHORIZATION-1 authorization protocol, the client computes the
following:
</para>
<para>
&variable.N; = X client identifier
</para>
<para>
&variable.T; = Current time in seconds on client host (32 bits)
</para>
<para>
&variable.beta; = {&variable.rho;&variable.N;&variable.T;}<superscript>&variable.sigma;</superscript>
</para>
<para>
For TCP connections &variable.N; is 48 bits long and contains the 32-bit IPv4 address of
the client host followed by the 16-bit port number of the client socket.
Formats for other connections must be registered.
The resulting value, &variable.beta;, is 192 bits of authorization data that is sent
in the connection setup to the server. The server receives the packet,
decrypts the contents. To accept the connection, the following must hold:
</para>
<itemizedlist>
<listitem>
<para>
&variable.rho; must match the value generated for the most recent XDMCP negotiation.
</para>
</listitem>
<listitem>
<para>
&variable.T; must be within 1200 seconds of the internally stored time. If no time
been received before, the current time is set to &variable.T;.
</para>
</listitem>
<listitem>
<para>
No packet containing the same pair (&variable.N;, &variable.T;) can have been received
in the last 1200 seconds (20 minutes).
</para>
</listitem>
</itemizedlist>
</chapter>
</book>
|