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
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!-- lifted from troff+ms+XMan by doclifter -->
<book id="xsmpms">
<bookinfo>
<title>X Session Management Protocol</title>
<subtitle>X Consortium Standard</subtitle>
<releaseinfo>X Version 11, Release 7</releaseinfo>
<authorgroup>
<author>
<firstname>Mike</firstname><surname>Wexler</surname>
</author>
</authorgroup>
<corpname>Kubota Pacific Computer, Inc</corpname>
<copyright>
<year>1992</year><year>1993</year><year>1994</year><year>2002</year>
<holder>The Open Group</holder>
</copyright>
<releaseinfo>Version 1.0</releaseinfo>
<affiliation><orgname>X Consortium</orgname></affiliation>
<productnumber>X Version 11, Release 7</productnumber>
<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 X CONSORTIUM 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 X Consortium
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 X Consortium.
</para>
<para>
X Window System is a trademark of The Open Group.
</para>
</legalnotice>
<abstract>
<para>
This document specifies a protocol that facilitates the management of
groups of client applications by a session manager. The session
manager can cause clients to save their state, to shut down, and to be
restarted into a previously saved state. This protocol is layered on
top of the X.Org <acronym>ICE</acronym> protocol.
</para>
</abstract>
</bookinfo>
<chapter id="acknowledgments">
<title>Acknowledgments</title>
<para>
First I would like to thank the entire <acronym>ICCCM</acronym> and Intrinsics
working groups for the comments and suggestions. I would like to make special
thanks to the following people (in alphabetical order), Jordan Brown,
Ellis Cohen, Donna Converse, Vania Joloboff, Stuart Marks, Ralph Mor
and Bob Scheifler.
</para>
</chapter>
<chapter id="definitions_and_goals">
<title>Definitions and Goals</title>
<para>
The purpose of the X Session Management Protocol (<acronym>XSMP</acronym>) is
to provide a uniform mechanism for users to save and restore their sessions.
A <firstterm>session</firstterm> is a group of clients, each
of which has a particular state. The session is controlled by a
network service called the <firstterm>session manager</firstterm>.
The session manager issues commands to its
clients on behalf of the user. These commands may cause clients to
save their state or to terminate. It is expected that the client will
save its state in such a way that the client can be restarted at a
later time and resume its operation as if it had never been
terminated. A client's state might include information about the file
currently being edited, the current position of the insertion point
within the file, or the start of an uncommitted transaction. The
means by which clients are restarted is unspecified by this
protocol.
</para>
<para>
For purposes of this protocol, a <firstterm>client</firstterm>
of the session manager is defined as a connection to the session
manager. A client is typically, though not necessarily, a process
running an application program connected to an X Window System
display. However, a client may be connected to more than one X
display or not be connected to any X displays at all.
</para>
<para>
This protocol is layered on top of the X Consortium's <acronym>ICE</acronym> protocol and
relies on the <acronym>ICE</acronym> protocol to handle connection management and authentication.
</para>
</chapter>
<chapter id="overview_of_the_protocol">
<title>Overview of the Protocol</title>
<para>
Clients use XSMP to register themselves with the session manager (SM).
When a client starts up, it should connect to the SM. The client
should remain connected for as long as it runs. A client may resign
from the session by issuing the proper protocol messages before
disconnecting. Termination of the connection without notice will be
taken as an indication that the client died unexpectedly.
</para>
<para>
Clients are expected to save their state in such a way as to allow
multiple instantiations of themselves to be managed independently. A
unique value called a <firstterm>client-ID</firstterm> is
provided by the protocol for the purpose of disambiguating multiple
instantiations of clients. Clients may use this ID, for example, as
part of a filename in which to store the state for a particular
instantiation. The client-ID should be saved as part of the command
used to restart this client
(the <property>RestartCommand</property>) so that the client
will retain the same ID after it is restarted. Certain small pieces
of state might also be stored in the RestartCommand. For example, an
X11 client might place a '-twoWindow' option in its RestartCommand to
indicate that it should start up in two window mode when it is
restarted.
</para>
<para>
The client finds the network address of the SM in a system-dependent
way. On <acronym>POSIX</acronym> systems an environment
variable called <envar>SESSION_MANAGER</envar>
will contain a list of network IDs. Each id will contain the
transport name followed by a slash and the (transport-specific)
address. A TCP/IP address would look like this:
<informalexample><para>
<literal>tcp/</literal><replaceable>hostname</replaceable><literal>:</literal><replaceable>portnumber</replaceable>
</para></informalexample>
where the hostname is a fully qualified domain name.
A Unix Domain address looks like this:
<informalexample><para>
<literal>local/</literal><replaceable>hostname</replaceable><literal>:</literal><replaceable>path</replaceable>
</para></informalexample>
A DECnet address would look like this:
<informalexample><para>
<literal>decnet/</literal><replaceable>nodename</replaceable><literal>::</literal><replaceable>objname</replaceable>
</para></informalexample>
</para>
<para>
If multiple network IDs are specified, they should be separated by commas.
</para>
<note remap='NT'>
<para>
There was much discussion over whether the XSMP protocol should use X
as the transport protocol or whether it should use its own independent
transport. It was decided that it would use an independent protocol
for several reasons. First, the Session Manager should be able to
manage programs that do not maintain an X connection. Second, the X
protocol is not appropriate to use as a general-purpose transport
protocol. Third, a session might span multiple displays.
</para>
<para>
The protocol is connection based, because there is no other way for
the SM to determine reliably when clients terminate.
</para>
<para>
It should be noted that this protocol introduces another single point
of failure into the system. Although it is possible for clients to
continue running after the SM has exited, this will probably not be
the case in normal practice. Normally the program that starts the SM
will consider the session to be terminated when the SM exits (either
normally or abnormally).
</para>
<para>
To get around this would require some sort of rendezvous server that
would also introduce a single point of failure. In the absence of a
generally available rendezvous server, XSMP is kept simple in the
hopes of making simple reliable SMs.
</para>
</note>
<para>
Some clients may wish to manage the programs they start. For example,
a mail program could start a text editor for editing the text of a
mail message. A client that does this is a session manager itself; it
should supply the clients it starts with the appropriate connection
information (i.e., the <envar>SESSION_MANAGER</envar> environment variable)
that specifies a connection to itself instead of to the top level session
manager.
</para>
<para>
Each client has associated with it a list of properties. A property
set by one client is not visible to any other client. These
properties are used for the client to inform the SM of the client's
current state. When a client initially connects to the SM, there are
no properties set.
</para>
</chapter>
<chapter id="data_types">
<title>Data Types</title>
<para>
XSMP messages contain several types of data. Both the SM and the
client always send messages in their native byte order. Thus, both
sides may need to byte-swap the messages received. The need to do
byte-swapping is determined at run-time by the <acronym>ICE</acronym> protocol.
</para>
<para>
If an invalid value is specified for a field of any of the enumerated
types, a <function>BadValue</function> error message must be sent by
the receiver of the message to the sender of the message.
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<thead>
<row>
<entry align='left'>Type Name</entry>
<entry align='left'>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>BOOL</entry>
<entry align='left'><para><constant>False</constant> or <constant>True</constant></para></entry>
</row>
<row>
<entry align='left'>INTERACT_STYLE</entry>
<entry align='left'><function>None</function> <function>Errors</function> or <function>Any</function></entry>
</row>
<row>
<entry align='left'>DIALOG_TYPE</entry>
<entry align='left'><function>Error</function> or <function>Normal</function></entry>
</row>
<row>
<entry align='left'>SAVE_TYPE</entry>
<entry align='left'><function>Global</function> <function>Local</function> or <function>Both</function></entry>
</row>
<row>
<entry align='left'>CARD8</entry>
<entry align='left'>a one-byte unsigned integer</entry>
</row>
<row>
<entry align='left'>CARD16</entry>
<entry align='left'>a two-byte unsigned integer</entry>
</row>
<row>
<entry align='left'>CARD32</entry>
<entry align='left'>a four-byte unsigned integer</entry>
</row>
<row>
<entry align='left'>ARRAY8</entry>
<entry align='left'>a sequence of CARD8s</entry>
</row>
<row>
<entry align='left'>LISTofARRAY8</entry>
<entry align='left'>a sequence of ARRAY8s</entry>
</row>
<row>
<entry align='left'>PROPERTY</entry>
<entry align='left'>a property name (an ARRAY8), a type name, and a value of that type</entry>
</row>
<row>
<entry align='left'>LISTofPROPERTY</entry>
<entry align='left'>a counted collection of ­PROPERTYs.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</chapter>
<chapter id="protocol_setup_and_message_format">
<title>Protocol Setup and Message Format</title>
<para>
To start the XSMP protocol, the client sends the server an
<acronym>ICE</acronym> <function>ProtocolSetup</function> message. All XSMP messages are
in the standard <acronym>ICE</acronym> message format. The message's major opcode is
assigned to XSMP by <acronym>ICE</acronym> at run-time. The different parties (client
and SM) may be assigned different major opcodes for XSMP. Once
assigned, all XSMP messages issued by this party will use the same
major opcode. The message's minor opcode specifies which protocol
message this message contains.
</para>
</chapter>
<chapter id="client_identification_string">
<title>Client Identification String</title>
<para>
A client ID is a string of XPCS characters encoded in ISO Latin 1 (ISO
8859-1). No null characters are allowed in this string. The client
ID string is used in the <function>Register­Client</function>
and <function>Register­ClientReply</function> messages.
</para>
<para>
Client IDs consist of the pieces described below. The ID is formed by
concatenating the pieces in sequence, without separator characters.
All pieces are padded on the left with '<literal>0</literal>'
characters so as to fill the specified length. Decimal numbers are
encoded using the characters '<literal>0</literal>' through
'<literal>9</literal>', and hexadecimal numbers using the characters
'<literal>0</literal>' through '<literal>9</literal>' and
'<literal>A</literal>' through '<literal>F</literal>'.
</para>
<itemizedlist mark='bullet'>
<listitem><para>
Version. This is currently the character '<literal>1</literal>'.
</para></listitem>
<listitem>
<para>Address type and address. The address type will be one of
<literallayout remap='DS'>
'<literal>1</literal>' a 4-byte IPv4 address encoded as 8 hexadecimal digits
'<literal>2</literal>' a 6-byte DECNET address encoded as 12 hexadecimal digits
'<literal>6</literal>' a 16-byte IPv6 address encoded as 32 hexadecimal digits
</literallayout>
</para>
<para>
The address is the one of the network addresses of the machine where
the session manager (not the client) is running. For example, the IP
address 198.112.45.11 would be encoded as the string
"<literal>QC6702D0B</literal>".
</para>
</listitem>
<listitem><para>
Time stamp. A 13-digit decimal number specifying
the number of milliseconds since 00:00:00 UTC, January 1, 1970.
</para></listitem>
<listitem>
<para>
Process-ID type and process-ID. The process-ID type will be one of
<literallayout remap='DS'>
'<literal>1</literal>' a <acronym>POSIX</acronym> process-ID encoded as a 10-digit decimal number.
</literallayout>
</para>
<para>
The process-ID is the process-ID of the session manager, not of a client.
</para>
</listitem>
<listitem>
<para>
Sequence number. This is a four-digit decimal number. It is
incremented every time the session manager creates an ID. After
reaching "Q9999" it wraps to "Q0000".
</para>
<note remap='NT'>
<para>
Once a client ID has been assigned to the client, the client keeps
this ID indefinitely. If the client is terminated and restarted, it
will be reassigned the same ID. It is desirable to be able to pass
client IDs around from machine to machine, from user to user, and from
session manager to session manager, while retaining the identity of
the client. This, combined with the indefinite persistence of client
IDs, means that client IDs need to be globally unique. The
construction specified above will ensure that any client ID created by
any user, session manager, and machine will be different from any other.
</para>
</note>
</listitem>
</itemizedlist>
</chapter>
<chapter id="protocol">
<title>Protocol</title>
<para>
The protocol consists of a sequence of messages as described below.
Each message type is specified by an <acronym>ICE</acronym> minor opcode. A given
message type is sent either from a client to the session manager or
from the session manager to a client; the appropriate direction is
listed with each message's description. For each message type, the
set of valid responses and possible error messages are listed. The
<acronym>ICE</acronym> severity is given in parentheses following each error class.
</para>
<para><function>RegisterClient</function> [Client → SM]</para>
<para><emphasis remap='I'>previous-ID</emphasis>: ARRAY8</para>
<para>Valid Responses: <function>RegisterClientReply</function></para>
<para>Possible Errors: <function>BadValue</function> (<symbol role='Pn'>CanContinue</symbol>)</para>
<para>
The client must send this message to the SM to register the client's
existence. If a client is being restarted from a previous session,
the previous-ID field must contain the client ID from the previous
session. For new clients, previous-ID should be of zero length.
</para>
<para>
If previous-ID is not valid, the SM will send a <function>BadValue</function>
error message to the client. At this point the SM reverts to the
register state and waits for another <function>RegisterClient</function>
The client should then send a <function>RegisterClient</function> with a
null previous-ID field.
</para>
<para><function>RegisterClientReply</function> [Client ← SM]</para>
<para><emphasis remap='I'>client-ID</emphasis>: ARRAY8</para>
<para>
The client-ID specifies a unique identification for this client. If
the client had specified an ID in the previous-ID field of
the <function>RegisterClient</function> message, client-ID will be
identical to the previously specified ID. If previous-ID was null,
client-ID will be a unique ID freshly generated by the SM. The
client-ID format is specified in section 6.
</para>
<para>
If the client didn't supply a previous-ID field to
the <function>Register­Client</function> message, the SM must send
a <function>SaveYourself</function> message with type = Local,
shutdown = False, interact-style = None, and fast = False immediately
after the <function>RegisterClientReply</function> The client should
respond to this like any other <function>Save­Yourself</function>
message.
</para>
<para><function>SaveYourself</function> [Client ← SM]</para>
<para><emphasis remap='I'>type</emphasis>: SAVE_TYPE</para>
<para><emphasis remap='I'>shutdown</emphasis>: BOOL</para>
<para><emphasis remap='I'>interact-style</emphasis>: INTERACT_STYLE</para>
<para><emphasis remap='I'>fast</emphasis>: BOOL</para>
<para>Valid Responses:
<function>SetProperties</function>
<function>DeleteProperties</function>
<function>GetProperties</function>
<function>SaveYourselfDone</function>
<function>SaveYourselfPhase2Request</function>
<function>InteractRequest</function></para>
<para>
The SM sends this message to a client to ask it to save its state.
The client writes a state file, if necessary, and, if necessary,
uses <function>SetProperties</function> to inform the SM of how to
restart it and how to discard the saved state. During this process it
can, if allowed by interact-style, request permission to interact with
the user by sending an <function>InteractRequest</function> message.
After the state has been saved, or if it cannot be successfully saved,
and the properties are appropriately set, the client sends
a <function>SaveYourselfDone</function> message. If the client wants
to save additional information after all the other clients have
finished changing their own state, the client should
send <function>SaveYourselfPhase2Request</function> instead
of <function>SaveYourselfDone</function> The client must then freeze
interaction with the user and wait until it receives
a <function>SaveComplete</function> <function>Die</function> or
a <function>ShutdownCancelled</function> message.
</para>
<para>
If interact-style is <function>None</function> the client must not
interact with the user while saving state. If the interact-style
is <function>Errors</function> the client may interact with the user
only if an error condition arises. If interact-style
is <function>Any</function> then the client may interact with the user
for any purpose. This is done by sending
an <function>Interact­Request</function> message. The SM will
send an <function>Interact</function> message to each client that sent
an <function>Interact­Request</function> The client must postpone
all interaction until it gets the <function>Interact</function>
message. When the client is done interacting it should send the SM
an <function>Interact­Done</function> message.
The <function>Interact­Request</function> message can be sent any
time after a <function>Save­Yourself</function> and before
a <function>Save­Yourself­Done</function>
</para>
<para>
Unusual circumstances may dictate multiple interactions. The client
may initiate as many <function>Interact­Request</function>
- <function>Interact</function> - <function>InteractDone</function>
sequences as it needs before it sends <function>SaveYourselfDone</function>
</para>
<para>
When a client receives <function>Save­Yourself</function> and has
not yet responded <function>Save­Yourself­Done</function> to a
previous <function>Save­Yourself</function> it must send
a <function>Save­Yourself­Done</function> and may then begin
responding as appropriate to the newly received
<function>Save­Yourself</function>
</para>
<para>
The type field specifies the type of information that should be
saved: <function>Global</function> <function>Local</function>
or <function>Both</function> The <function>Local</function> type
indicates that the application must update the properties to reflect
its current state, send
a <function>Save­Yourself­Done</function> and continue.
Specifically it should save enough information to restore the state as
seen by the user of this client. It should not affect the state as
seen by other users. The <function>Global</function> type indicates
that the user wants the client to commit all of its data to permanent,
globally-accessible storage. <function>Both</function> indicates that
the client should do both of these. If <function>Both</function> is
specified, the client should first commit the data to permanent
storage before updating its SM properties.
</para>
<note remap='NT'>
<para>
If a word processor was sent a <function>SaveYourself</function> with
a type of <function>Local</function> it could create a temporary file
that included the current contents of the file, the location of the
cursor, and other aspects of the current editing session. It would
then update its <function>Restart­Command</function> property with
enough information to find the temporary file, and
its <function>Discard­Command</function> with enough information
to remove it.
</para>
<para>
If a word processor was sent a <function>SaveYourself</function> with
a type of <function>Global</function> it would simply save the
currently edited file.
</para>
<para>
If a word processor was sent a <function>SaveYourself</function> with
a type of <function>Both</function> it would first save the currently
edited file. It would then create a temporary file with information
such as the current position of the cursor and what file is being
edited. It would then update
its <function>Restart­Command</function> property with enough
information to find the temporary file, and
its <function>Discard­Command</function> with enough information
to remove it.
</para>
<para>
Once the SM has send <function>SaveYourself</function> to a client, it can't send another <function>SaveYourself</function> to that client until the client either responds with a <function>SaveYourselfDone</function> or the SM sends a <function>ShutdownCancelled</function>
</para>
</note>
<note remap='NT'>
<para>
If the client stores local any state in a file or similar "Qexternal"
storage, it must create a distinct copy in response to
each <function>SaveYourself</function> message.
It <emphasis remap='I'>must not</emphasis> simply refer to a previous
copy, because the SM may discard that previous saved state using
a <function>DiscardCommand</function> without knowing that it is
needed for the new checkpoint.
</para>
</note>
<para>
The shutdown field specifies whether the system is being shut down.
</para>
<note remap='NT'>
<para>
The interaction may be different depending on whether or not shutdown is set.
</para>
</note>
<para>
The client must save and then must prevent interaction until it
receives a <function>SaveComplete</function> <function>Die</function>
or a <function>Shutdown­Cancelled</function> because anything the
user does after the save will be lost.
</para>
<para>
The fast field specifies whether or not the client should save its
state as quickly as possible. For example, if the SM knows that power
is about to fail, it should set the fast field to <constant>True</constant>
</para>
<para><function>SaveYourselfPhase2</function> [Client → SM]</para>
<para>Valid Responses:
<function>SetProperties</function>
<function>DeleteProperties</function>
<function>GetProperties</function>
<function>SaveYourselfDone</function>
<function>InteractRequest</function></para>
<para>
The SM sends this message to a client that has previously sent
a <function>SaveYourselfPhase2Request</function> message. This
message informs the client that all other clients are in a fixed state
and this client can save state that is associated with other clients.
</para>
<note remap='NT'>
<para>
Clients that manager other clients (window managers, workspace
managers, etc) need to know when all clients they are managing are
idle, so that the manager can save state related to each of the
clients without being concerned with that state changing.
</para>
</note>
<para>
The client writes a state file, if necessary, and, if necessary,
uses <function>SetProperties</function> to inform the SM of how to
restart it and how to discard the saved state. During this process it
can request permission to interact with the user by sending
an <function>InteractRequest</function> message. This should only be
done if an error occurs that requires user interaction to resolve.
After the state has been saved, or if it cannot be successfully saved,
and the properties are appropriately set, the client sends
a <function>SaveYourselfDone</function> message.
</para>
<para><function>SaveYourselfRequest</function> [Client → SM]</para>
<para><emphasis remap='I'>type</emphasis>: SAVE_TYPE</para>
<para><emphasis remap='I'>shutdown</emphasis>: BOOL</para>
<para><emphasis remap='I'>interact-style</emphasis>: INTERACT_STYLE</para>
<para><emphasis remap='I'>fast</emphasis>: BOOL</para>
<para><emphasis remap='I'>global</emphasis>: BOOL</para>
<para>Valid Responses: <function>SaveYourself</function></para>
<para>
An application sends this to the SM to request a checkpoint. When the
SM receives this request it may generate a <function>SaveYourself</function>
message in response and it may leave the fields intact.
</para>
<note remap='NT'> <para>
A vendor of a <acronym>UPS</acronym> (Uninterruptible Power Supply)
might include an SM client that would monitor the status of
the <acronym>UPS</acronym> and generate a fast shutdown if the power
is about to be lost.
</para></note>
<para>
If global is set to <constant>True</constant> then the
resulting <function>SaveYourself</function> should be sent to all
applications. If global is set to <constant>False</constant> then the
resulting <function>SaveYourself</function> should be sent to the
application that sent the <function>Save­Yourself­Request</function>
</para>
<para><function>InteractRequest</function> [Client → SM]</para>
<para><emphasis remap='I'>dialog-type</emphasis>: DIALOG_TYPE</para>
<para>Valid Responses: <function>Interact</function> <function>ShutdownCancelled</function></para>
<para>Possible Errors: <function>BadState</function> (<symbol role='Pn'>CanContinue</symbol>)</para>
<para>
During a checkpoint or session-save operation, only one client at a
time might be granted the privilege of interacting with the user.
The <function>InteractRequest</function> message causes the SM to emit
an <function>Interact</function> message at some later time if the
shutdown is not cancelled by another client first.
</para>
<para>
The dialog-type field specifies either <function>Errors</function>
indicating that the client wants to start an error dialog
or <function>Normal</function> meaning the client wishes to start a
non-error dialog.
</para>
<para><function>Interact</function> [Client ← SM]</para>
<para>Valid Responses: <function>InteractDone</function></para>
<para>
This message grants the client the privilege of interacting with the
user. When the client is done interacting with the user it must send
an <function>InteractDone</function> message to the SM unless a
shutdown cancel is received.
</para>
<note remap='NT'> <para> If a client receives a ShutdownCancelled
after receiving an <function>Interact</function> message, but before
sending a <function>InteractDone</function> the client should abort
the interaction and send a <function>SaveYourselfDone</function>
</para></note>
<para><function>InteractDone</function> [Client → SM]</para>
<para><emphasis remap='I'>cancel-shutdown</emphasis>: BOOL</para>
<para>Valid Responses: <function>ShutdownCancelled</function></para>
<para>
This message is used by a client to notify the SM that it is done interacting.
</para>
<para>
Setting the cancel-shutdown field to <constant>True</constant>
indicates that the user has requested that the entire shutdown be
cancelled. Cancel-shutdown may only be <constant>True</constant> if
the corresponding <function>SaveYourself</function> message
specified <constant>True</constant> for the shutdown field
and <function>Any</function> or <function>Errors</function> for the
interact-style field. Otherwise, cancel-shutdown must
be <constant>False</constant>
</para>
<para><function>SaveYourselfDone</function> [Client → SM]</para>
<para><emphasis remap='I'>success</emphasis>: BOOL</para>
<para>Valid Responses:
<function>SaveComplete</function>
<function>Die</function>
<function>ShutdownCancelled</function>
</para>
<para>
This message is sent by a client to indicate that all of the
properties representing its state have been updated. After
sending <function>SaveYourselfDone</function> the client must wait for
a <function>SaveComplete</function> <function>ShutdownCancelled</function>
or <function>Die</function> message before changing its state. If
the <function>SaveYourself</function> operation was successful, then
the client should set the success field to <constant>True</constant>
otherwise the client should set it to <constant>False</constant>
</para>
<note remap='NT'>
<para>
If a client tries to save its state and runs out of disk space, it
should return <constant>False</constant> in the success field of
the <function>SaveYourselfDone</function> message.
</para>
</note>
<para><function>SaveYourselfPhase2Request</function> [Client → SM]</para>
<para>Valid Responses:
<function>ShutdownCancelled</function>
<function>SaveYourselfPhase2</function>
</para>
<para>
This message is sent by a client to indicate that it needs to be informed
when all the other clients are quiescent, so it can continue its state.
</para>
<para><function>Die</function> [Client ← SM]</para>
<para>Valid Responses: <function>ConnectionClosed</function></para>
<para>
When the SM wants a client to die it sends a <function>Die</function>
message. Before the client dies it responds by sending
a <function>ConnectionClosed</function> message and may then close its
connection to the SM at any time.
</para>
<para><function>SaveComplete</function> [Client → SM]</para>
<para>Valid Responses:</para>
<para>
When the SM is done with a checkpoint, it will send each of the
clients a <function>SaveComplete</function> message. The client is
then free to change its state.
</para>
<para><function>ShutdownCancelled</function> [Client ← SM]</para>
<para>
The shutdown currently in process has been aborted. The client can
now continue as if the shutdown had never happened. If the client has
not sent <function>SaveYourselfDone</function> yet, the client can
either abort the save and send <function>SaveYourselfDone</function>
with the success field set to <constant>False</constant> or it can
continue with the save and send a <function>SaveYourselfDone</function>
with the success field set to reflect the outcome of the save.
</para>
<para><function>ConnectionClosed</function> [Client → SM]</para>
<para><emphasis remap='I'>reason</emphasis>: LISTofARRAY8</para>
<para>
Specifies that the client has decided to terminate. It should be
immediately followed by closing the connection.
</para>
<para>
The reason field specifies why the client is resigning from the
session. It is encoded as an array of Compound Text strings. If the
resignation is expected by the user, there will typically be zero
ARRAY8s here. But if the client encountered an unexpected fatal
error, the error message (which might otherwise be printed on stderr
on a <acronym>POSIX</acronym> system) should be forwarded to the SM here, one ARRAY8 per
line of the message. It is the responsibility of the SM to display
this reason to the user.
</para>
<para>
After sending this message, the client must not send any additional
XSMP messages to the SM.
</para>
<note remap='NT'><para>
If additional messages are received, they should be discarded.
</para></note>
<note remap='NT'><para>
The reason for sending the <function>ConnectionClosed</function>
message before actually closing the connections is that some transport
protocols will not provide immediate notification of connection
closure.
</para></note>
<para><function>SetProperties</function> [Client → SM]</para>
<para><emphasis remap='I'>properties</emphasis>: LISTofPROPERTY</para>
<para>
Sets the specified properties to the specified values. Existing
properties not specified in the <function>Set­Properties</function>
message are unaffected. Some properties have predefined semantics.
See section 11, "Predefined Properties."
</para>
<para>
The protocol specification recommends that property names used for
properties not defined by the standard should begin with an
underscore. To prevent conflicts among organizations, additional
prefixes should be chosen (for example, _KPC_FAST_SAVE_OPTION). The
organizational prefixes should be registered with the X Registry. The
XSMP reserves all property names not beginning with an underscore for
future use.
</para>
<para><function>DeleteProperties</function> [Client → SM]</para>
<para><emphasis remap='I'>property-names</emphasis>: LISTofARRAY8</para>
<para>Removes the named properties.</para>
<para><function>GetProperties</function> [Client → SM]</para>
<para>Valid Responses: <function>GetPropertiesReply</function></para>
<para>
Requests that the SM respond with the values of all the properties for
this client.
</para>
<para><function>GetPropertiesReply</function> [Client ← SM]</para>
<para><emphasis remap='I'>values</emphasis>: LISTofPROPERTY</para>
<para>
This message is sent in reply to a <function>GetProperties</function>
message and includes the values of all the properties.
</para>
</chapter>
<chapter id="errors">
<title>Errors</title>
<para>
When the receiver of a message detects an error condition, the
receiver sends an <acronym>ICE</acronym> error message to the sender. There are only two
types of errors that are used by the XSMP:
<function>BadValue</function> and <function>BadState</function>
These are both defined in the <acronym>ICE</acronym> protocol.
</para>
<para>
Any message received out-of-sequence will generate
a <function>BadState</function> error message.
</para>
</chapter>
<chapter id="state_diagrams">
<title>State Diagrams</title>
<para>
These state diagrams are designed to cover all actions of both the
client and the SM.
</para>
<sect1 id='client_state_diagram'>
<title>Client State Diagram</title>
<!-- <literallayout remap='DS'> -->
<literallayout>
<emphasis remap='I'>start:</emphasis>
<acronym>ICE</acronym> protocol setup complete → <emphasis remap='C'>register</emphasis></literallayout>
<literallayout>
<emphasis remap='I'>register:</emphasis>
send <emphasis remap='B'>RegisterClient</emphasis> → <emphasis remap='C'>collect-id</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>collect-id:</emphasis>
receive <emphasis remap='B'>RegisterClientReply</emphasis> → <emphasis remap='C'>idle</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>shutdown-cancelled:</emphasis>
send <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>idle</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>idle:</emphasis> [Undoes any freeze of interaction with user.]
receive <emphasis remap='B'>Die</emphasis> → <emphasis remap='C'>die</emphasis>
receive <emphasis remap='B'>SaveYourself</emphasis> → <emphasis remap='C'>freeze-interaction</emphasis>
send <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>GetPropertiesReply</emphasis> → <emphasis remap='C'>idle</emphasis>
send <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>idle</emphasis>
send <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>idle</emphasis>
send <emphasis remap='B'>ConnectionClosed</emphasis> → <emphasis remap='C'>connection-closed</emphasis>
send <emphasis remap='B'>SaveYourselfRequest</emphasis> → <emphasis remap='C'>idle</emphasis>
</literallayout> <!-- remap='DE' -->
<literallayout remap='DS'>
<emphasis remap='I'>die:</emphasis>
send <emphasis remap='B'>ConnectionClosed</emphasis> → <emphasis remap='C'>connection-closed</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>freeze-interaction:</emphasis>
freeze interaction with user → <emphasis remap='C'>save-yourself</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>save-yourself:</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>shutdown-cancelled</emphasis>
send <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
receive <emphasis remap='B'>GetPropertiesReply</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>InteractRequest</emphasis> → <emphasis remap='C'>interact-request</emphasis>
send <emphasis remap='B'>SaveYourselfPhase2Request</emphasis> → waiting-for-phase2
<emphasis remap='I'>save-yourself:</emphasis>
if shutdown mode:
send <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>save-yourself-done</emphasis>
otherwise:
send <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>idle</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>waiting-for-phase2:</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>shutdown-cancelled</emphasis>
receive <emphasis remap='B'>SaveYourselfPhase2</emphasis> → <emphasis remap='C'>phase2</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>phase2:</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>shutdown-cancelled</emphasis>
send <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
receive <emphasis remap='B'>GetPropertiesReply</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>InteractRequest</emphasis> → <emphasis remap='C'>interact-request</emphasis> (errors only)
if shutdown mode:
send <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>save-yourself-done</emphasis>
otherwise:
send <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>idle</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>interact-request:</emphasis>
receive <emphasis remap='B'>Interact</emphasis> → <emphasis remap='C'>interact</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>shutdown-cancelled</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>interact:</emphasis>
send <emphasis remap='B'>InteractDone</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>shutdown-cancelled</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>save-yourself-done:</emphasis> (changing state is forbidden)
receive <emphasis remap='B'>SaveComplete</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>Die</emphasis> → <emphasis remap='C'>die</emphasis>
receive <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>idle</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>connection-closed:</emphasis>
client stops participating in session </literallayout>
</sect1>
<sect1 id='session_manager_state_diagram'>
<title>Session Manager State Diagram</title>
<literallayout remap='DS'>
<emphasis remap='I'>start:</emphasis>
receive <emphasis remap='B'>ProtocolSetup</emphasis> → <emphasis remap='C'>protocol-setup</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>protocol-setup:</emphasis>
send <emphasis remap='B'>ProtocolSetupReply</emphasis> → <emphasis remap='C'>register</emphasis></literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>register:</emphasis>
receive <emphasis remap='B'>RegisterClient</emphasis> → <emphasis remap='C'>acknowledge-register</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>acknowledge-register:</emphasis>
send <emphasis remap='B'>RegisterClientReply</emphasis> → <emphasis remap='C'>idle</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>idle:</emphasis>
receive <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>ConnectionClosed</emphasis> → <emphasis remap='C'>start</emphasis>
receive <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>get-properties</emphasis>
receive <emphasis remap='B'>SaveYourselfRequest</emphasis> → <emphasis remap='C'>save-yourself</emphasis>
send <emphasis remap='B'>SaveYourself</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>save-yourself:</emphasis>
send <emphasis remap='B'>SaveYourself</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>get-properties:</emphasis>
send <emphasis remap='B'>GetPropertiesReply</emphasis> → <emphasis remap='C'>idle</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>saving-get-properties:</emphasis>
send <emphasis remap='B'>GetPropertiesReply</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>saving-yourself:</emphasis>
receive <emphasis remap='B'>InteractRequest</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
send <emphasis remap='B'>Interact</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
send <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>InteractDone</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>saving-get-properties</emphasis>
receive <emphasis remap='B'>SaveYourselfPhase2Request</emphasis> → <emphasis remap='C'>start-phase2</emphasis>
receive <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>save-yourself-done</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>start-phase2:</emphasis>
If all clients have sent either SaveYourselfPhase2Request or SaveYourselfDone:
send <emphasis remap='B'>SaveYourselfPhase2</emphasis> → <emphasis remap='C'>phase2</emphasis>
else
→ <emphasis remap='C'>saving-yourself</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>phase2:</emphasis>
receive <emphasis remap='B'>InteractRequest</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
send <emphasis remap='B'>Interact</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
send <emphasis remap='B'>ShutdownCancelled</emphasis> → <emphasis remap='C'>idle</emphasis>
receive <emphasis remap='B'>InteractDone</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>SetProperties</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>DeleteProperties</emphasis> → <emphasis remap='C'>saving-yourself</emphasis>
receive <emphasis remap='B'>GetProperties</emphasis> → <emphasis remap='C'>saving-get-properties</emphasis>
receive <emphasis remap='B'>SaveYourselfDone</emphasis> → <emphasis remap='C'>save-yourself-done</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>save-yourself-done:</emphasis>
If all clients are saved:
If shutting down:
send <emphasis remap='B'>Die</emphasis> → <emphasis remap='C'>die</emphasis>
otherwise
send <emphasis remap='B'>SaveComplete</emphasis> → <emphasis remap='C'>idle</emphasis>
If some clients are not saved:
→ <emphasis remap='C'>saving-yourself</emphasis>
</literallayout>
<literallayout remap='DS'>
<emphasis remap='I'>die:</emphasis>
SM stops accepting connections
</literallayout>
</sect1>
</chapter>
<chapter id='protocol_encoding'>
<title>Protocol Encoding</title>
<sect1 id="types">
<title>Types</title>
<informaltable pgwide='0' frame='all'>
<tgroup cols='2' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align='center'>BOOL</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>0</entry>
<entry align='left'>False</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>True</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='2' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align='center'>INTERACT_STYLE</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>0</entry>
<entry align='left'>None</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>Errors</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'>Any</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='2' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align='center'>DIALOG_TYPE</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>0</entry>
<entry align='left'>Error</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>Normal</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='2' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align='center'>SAVE_TYPE</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>0</entry>
<entry align='left'>Global</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>Local</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'>Both</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'>ARRAY8</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>4</entry>
<entry align='left'>CARD32</entry>
<entry align='left'>length</entry>
</row>
<row>
<entry align='left'>n</entry>
<entry align='left'>ListofCARD8, the array</entry>
<entry align='left'>p = pad (4 + n, 8)</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'>Both</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'>LISTofARRAY8</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>4</entry>
<entry align='left'>CARD32</entry>
<entry align='left'>count</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>first array</entry>
</row>
<row>
<entry align='left'>b</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>second array</entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>q</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>last array</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'>PROPERTY</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>a</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>name</entry>
</row>
<row>
<entry align='left'>b</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>type (XPCS encoded in Latin-1, case sensitive)</entry>
</row>
<row>
<entry align='left'>c</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='left'>values</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='1.0in' colname='c1'/>
<colspec colwidth='1.0in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'>LISTofPROPERTY</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>4</entry>
<entry align='left'>CARD32</entry>
<entry align='left'>count</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>PROPERTY</entry>
<entry align='left'>first property</entry>
</row>
<row>
<entry align='left'>b</entry>
<entry align='left'>PROPERTY</entry>
<entry align='left'>second property</entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>.</entry>
<entry align='left'></entry>
<entry align='left'></entry>
</row>
<row>
<entry align='left'>q</entry>
<entry align='left'>PROPERTY</entry>
<entry align='left'>last property</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
<sect1 id='messages'>
<title>Messages</title>
<para>
XSMP is a sub-protocol of <acronym>ICE</acronym>. The major opcode is
assigned at run-time by <acronym>ICE</acronym> and is represented here
by '<literal>?</literal>'.
</para>
<para>
To start the XSMP protocol, the client sends the server an
<acronym>ICE</acronym> <function>ProtocolSetup</function> message.
The protocol-name field should be specified as "<literal>XSMP</literal>",
the major version of the protocol is 1, the minor version is 0. These
values may change if the protocol is revised. The minor version
number will be incremented if the change is compatible, otherwise the
major version number will be incremented.
</para>
<para>
In <function>ProtocolReply</function> message sent by the session
manager, the XSMP protocol defines the vendor parameter as product
identification of the session manager, and defines the release
parameter as the software release identification of the session
manager. The session manager should supply this information in the
<acronym>ICE</acronym> <function>ProtocolReply</function> message.
</para>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.1in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>RegisterClient</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>1</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>previous-ID</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.1in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>RegisterClientReply</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>2</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>client-ID</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveYourself</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>3</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>1</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>SAVE_TYPE</entry>
<entry align='left'>type</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>shutdown</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>INTERACT_STYLE</entry>
<entry align='left'>interact-style</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>fast</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveYourselfRequest</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>4</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>1</entry>
<entry align='left'>length of remainning data in 8-byte units</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>SAVE_TYPE</entry>
<entry align='left'>type</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>shutdown</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>INTERACT_STYLE</entry>
<entry align='left'>interact-style</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>fast</entry>
</row>
<row>
<entry align='left'>3</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>InteractRequest</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>5</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>DIALOG_TYPE</entry>
<entry align='left'>dialog type</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>Interact</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>6</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>InteractDone</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>7</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>cancel-shutdown</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>InteractDone</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>7</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>cancel-shutdown</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveYourselfDone</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>8</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>BOOL</entry>
<entry align='left'>success</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>Die</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>9</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>ShutdownCancelled</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>10</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>ConnectionClosed</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>11</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='left'>reason</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SetProperties</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>12</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>LISTofPROPERTY</entry>
<entry align='left'>properties</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>DeleteProperties</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>13</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>LISTofPROPERTY</entry>
<entry align='left'>properties</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>GetProperties</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>14</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='1.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>GetPropertiesReply</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>15</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>a/8</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
<row>
<entry align='left'>a</entry>
<entry align='left'>LISTofPROPERTY</entry>
<entry align='left'>properties</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveYourselfPhase2Request</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>16</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveYourselfPhase2</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>17</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable pgwide='0' frame='all'>
<tgroup cols='3' align='center'>
<colspec colwidth='0.5in' colname='c1'/>
<colspec colwidth='0.5in' colname='c2'/>
<colspec colwidth='1.0in' colname='c3'/>
<thead>
<row>
<entry namest="c1" nameend="c3" align='center'><function>SaveComplete</function></entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>1</entry>
<entry align='left'>?</entry>
<entry align='left'>XSMP</entry>
</row>
<row>
<entry align='left'>1</entry>
<entry align='left'>18</entry>
<entry align='left'>opcode</entry>
</row>
<row>
<entry align='left'>2</entry>
<entry align='left'></entry>
<entry align='left'>unused</entry>
</row>
<row>
<entry align='left'>4</entry>
<entry align='left'>0</entry>
<entry align='left'>length of remaining data in 8-byte units</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
</chapter>
<chapter id='predefined_properties'>
<title>Predefined Properties</title>
<para>
All property values are stored in a LISTofARRAY8. If the type of the
property is CARD8, the value is stored as a LISTofARRAY8 with one
ARRAY8 that is one byte long. That single byte contains the CARD8.
If the type of the property is ARRAY8, the value is stored in the
first element of a single element LISTofARRAY8.
</para>
<para>
The required properties must be set each time a client connects with
the SM. The properties must be set after the client
sends <function>RegisterClient</function> and before the client
sends <function>SaveYourselfDone</function> Otherwise, the behavior of
the session manager is not defined.
</para>
<para>
Clients may set, get, and delete nonstandard properties. The lifetime
of stored properties does not extend into subsequent sessions.
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='4' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<thead>
<row>
<entry align='left'>Name</entry>
<entry align='left'>Type</entry>
<entry align='left'>Posix Type</entry>
<entry align='center'>Required?</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>CloneCommand</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>Yes</entry>
</row>
<row>
<entry align='left'>CurrentDirectory</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>ARRAY8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>DiscardCommand</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>No*</entry>
</row>
<row>
<entry align='left'>Environment</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>ProcessID</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>ARRAY8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>Program</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>ARRAY8</entry>
<entry align='center'>Yes</entry>
</row>
<row>
<entry align='left'>RestartCommand</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>Yes</entry>
</row>
<row>
<entry align='left'>ResignCommand</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>RestartStyleHint</entry>
<entry align='left'>CARD8</entry>
<entry align='left'>CARD8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>ShutdownCommand</entry>
<entry align='left'>OS-specific</entry>
<entry align='left'>LISTofARRAY8</entry>
<entry align='center'>No</entry>
</row>
<row>
<entry align='left'>UserID</entry>
<entry align='left'>ARRAY8</entry>
<entry align='left'>ARRAY8</entry>
<entry align='center'>Yes</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
* Required if any state is stored in an external repository (e.g., state file).
</para>
<variablelist remap='IP'>
<varlistentry>
<term>CloneCommand</term>
<listitem> <para>
This is like the <function>RestartCommand</function> except it
restarts a copy of the application. The only difference is that the
application doesn't supply its client id at register time. On <acronym>POSIX</acronym>
systems the type should be a LISTofARRAY8.
</para></listitem>
</varlistentry>
<varlistentry>
<term>CurrentDirectory</term>
<listitem><para>
On <acronym>POSIX</acronym>-based systems specifies the value of the current directory that
needs to be set up prior to starting the program and should be of type ARRAY8.
</para></listitem>
</varlistentry>
<varlistentry>
<term>DiscardCommand</term>
<listitem><para>
The discard command contains a command that when delivered to the host
that the client is running on (determined from the connection), will
cause it to discard any information about the current state. If this
command is not specified, the SM will assume that all of the client's
state is encoded in the <function>Restart­Command</function> On
<acronym>POSIX</acronym> systems the type should be LISTofARRAY8.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Environment</term>
<listitem><para>
On <acronym>POSIX</acronym> based systems, this will be of type LISTofARRAY8 where the
ARRAY8s alternate between environment variable name and environment
variable value.
</para></listitem>
</varlistentry>
<varlistentry>
<term>ProcessID</term>
<listitem><para>
This specifies an OS-specific identifier for the process. On <acronym>POSIX</acronym>
systems this should of type ARRAY8 and contain the return value of
getpid() turned into a Latin-1 (decimal) string.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Program</term>
<listitem><para>
The name of the program that is running. On <acronym>POSIX</acronym> systems this should
be the first parameter passed to execve and should be of type ARRAY8.
</para></listitem>
</varlistentry>
<varlistentry>
<term>RestartCommand</term>
<listitem><para>
The restart command contains a command that when delivered to the host
that the client is running on (determined from the connection), will
cause the client to restart in its current state. On <acronym>POSIX</acronym>-based
systems this is of type LISTofARRAY8 and each of the elements in the
array represents an element in the argv array. This restart command
should ensure that the client restarts with the specified
client-ID.
</para></listitem>
</varlistentry>
<varlistentry>
<term>ResignCommand</term>
<listitem>
<para>
A client that sets the <function>RestartStyleHint</function>
to <function>RestartAnyway</function> uses this property to specify a
command that undoes the effect of the client and removes any saved
state.
</para>
<note remap='NT'><para>
A user runs xmodmap. xmodmap registers with the SM,
sets <function>Restart­Style­Hint</function>
to <function>Restart­Anyway</function> and then terminates. In
order to allow the SM (at the user's request) to undo this, xmodmap
would register a <function>Resign­Command</function> that undoes
the effects of the xmodmap.
</para></note>
</listitem>
</varlistentry>
<varlistentry>
<term>RestartStyleHint</term>
<listitem>
<para>
If the RestartStyleHint property is present, it will contain the style
of restarting the client prefers. If this flag isn't
specified, <function>RestartIfRunning</function> is assumed. The
possible values are as follows:
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<thead>
<row>
<entry align='left'>Name</entry>
<entry align='right'>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry align='left'>RestartIfRunning</entry>
<entry align='right'>0</entry>
</row>
<row>
<entry align='left'>RestartAnyway</entry>
<entry align='right'>1</entry>
</row>
<row>
<entry align='left'>RestartImmediately</entry>
<entry align='right'>2</entry>
</row>
<row>
<entry align='left'>RestartNever</entry>
<entry align='right'>3</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
The <function>RestartIfRunning</function> style is used in the usual
case. The client should be restarted in the next session if it is
connected to the session manager at the end of the current session.
</para>
<para>
The <function>RestartAnyway</function> style is used to tell the SM
that the application should be restarted in the next session even if
it exits before the current session is terminated. It should be noted
that this is only a hint and the SM will follow the policies specified
by its users in determining what applications to restart.
</para>
<note remap='NT'><para>
This can be specified by a client which supports (as MS-Windows
clients do) a means for the user to indicate while exiting that
restarting is desired. It can also be used for clients that spawn
other clients and then go away, but which want to be restarted.
</para></note>
<para>
A client that uses <function>RestartAnyway</function> should also set
the <function>ResignCommand</function> and <function>ShutdownCommand</function>
properties to commands that undo the state of the client after it exits.
</para>
<para>
The <function>RestartImmediately</function> style is
like <function>RestartAnyway</function> but in addition, the client is
meant to run continuously. If the client exits, the SM should try to
restart it in the current session.
</para>
<note remap='NT'><para>
It would be wise to sanity-check the frequency which
which <function>RestartImmediately</function> clients are restarted,
to avoid a sick client being restarted continuously.
</para></note>
<para>
The <function>RestartNever</function> style specifies that the client
does not wish to be restarted in the next session.
</para>
<note remap='NT'> <para>
This should be used rarely, if at all. It will cause the client to be
silently left out of sessions when they are restarted and will
probably be confusing to users.
</para></note> <!-- remap='NE' -->
<!-- .RE -->
</listitem>
</varlistentry>
<varlistentry>
<term>ShutdownCommand</term>
<listitem>
<para>
This command is executed at shutdown time to clean up after a client
that is no longer running but retained its state by
setting <function>RestartStyleHint</function>
to <function>RestartAnyway</function> The command must not remove any
saved state as the client is still part of the session.
</para>
<note remap='NT'><para>
A client is run at start up time that turns on a camera. This client
then exits. At session shutdown, the user wants the camera turned
off. This client would set the <function>Restart­Style­Hint</function>
to <function>Restart­Anyway</function> and would register a
<function>Shutdown­Command</function> that would turn off the camera.
</para></note>
</listitem>
</varlistentry>
<varlistentry>
<term>UserID</term>
<listitem><para>
Specifies the user's ID. On <acronym>POSIX</acronym>-based systems
this will contain the the user's name (the <structfield>pw_name</structfield>
field of <structname>struct passwd</structname>).
</para></listitem>
</varlistentry>
</variablelist>
</chapter>
</book>
|