xsmp.xml revision 555991fd
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
4
5
6<!-- lifted from troff+ms+XMan by doclifter -->
7<book id="xsmpms">
8
9<bookinfo>
10   <title>X Session Management Protocol</title>
11   <subtitle>X Consortium Standard</subtitle>
12   <releaseinfo>X Version 11, Release 7</releaseinfo>
13   <authorgroup>
14      <author>
15         <firstname>Mike</firstname><surname>Wexler</surname>
16      </author>
17   </authorgroup>
18   <corpname>Kubota Pacific Computer, Inc</corpname>
19   <copyright>
20     <year>1992</year><year>1993</year><year>1994</year><year>2002</year>
21     <holder>The Open Group</holder>
22   </copyright>
23   <releaseinfo>Version 1.0</releaseinfo>
24   <affiliation><orgname>X Consortium</orgname></affiliation>
25   <productnumber>X Version 11, Release 7</productnumber>
26
27   <legalnotice>
28     <para>
29Permission is hereby granted, free of charge, to any person
30obtaining a copy of this software and associated documentation files
31(the &ldquo;Software&rdquo;), to deal in the Software without
32restriction, including without limitation the rights to use, copy,
33modify, merge, publish, distribute, sublicense, and/or sell copies of
34the Software, and to permit persons to whom the Software is furnished
35to do so, subject to the following conditions:
36     </para>
37
38     <para>
39The above copyright notice and this permission notice shall be
40included in all copies or substantial portions of the Software.
41     </para>
42
43     <para>
44THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY
45OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
46WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
47NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
48CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51     </para>
52
53     <para>
54Except as contained in this notice, the name of the X Consortium
55shall not be used in advertising or otherwise to promote the sale, use
56or other dealings in this Software without prior written authorization
57from the X Consortium.
58     </para>
59
60     <para>
61X Window System is a trademark of The Open Group.
62     </para>
63   </legalnotice>
64
65   <abstract>
66     <para>
67This document specifies a protocol that facilitates the management of
68groups of client applications by a session manager.  The session
69manager can cause clients to save their state, to shut down, and to be
70restarted into a previously saved state.  This protocol is layered on
71top of the X.Org <acronym>ICE</acronym> protocol.
72     </para>
73   </abstract>
74
75</bookinfo>
76
77<chapter id="acknowledgments">
78  <title>Acknowledgments</title>
79
80  <para>
81First I would like to thank the entire <acronym>ICCCM</acronym> and Intrinsics
82working groups for the comments and suggestions. I would like to make special
83thanks to the following people (in alphabetical order), Jordan Brown,
84Ellis Cohen, Donna Converse, Vania Joloboff, Stuart Marks, Ralph Mor
85and Bob Scheifler.
86  </para>
87</chapter>
88
89<chapter id="definitions_and_goals">
90  <title>Definitions and Goals</title>
91
92  <para>
93The purpose of the X Session Management Protocol (<acronym>XSMP</acronym>) is
94to provide a uniform mechanism for users to save and restore their sessions.
95A <firstterm>session</firstterm> is a group of clients, each
96of which has a particular state.  The session is controlled by a
97network service called the <firstterm>session manager</firstterm>.
98The session manager issues commands to its
99clients on behalf of the user.  These commands may cause clients to
100save their state or to terminate.  It is expected that the client will
101save its state in such a way that the client can be restarted at a
102later time and resume its operation as if it had never been
103terminated.  A client's state might include information about the file
104currently being edited, the current position of the insertion point
105within the file, or the start of an uncommitted transaction.  The
106means by which clients are restarted is unspecified by this
107protocol.
108  </para>
109
110  <para>
111For purposes of this protocol, a <firstterm>client</firstterm>
112of the session manager is defined as a connection to the session
113manager.  A client is typically, though not necessarily, a process
114running an application program connected to an X Window System
115display.  However, a client may be connected to more than one X
116display or not be connected to any X displays at all.
117  </para>
118
119  <para>
120This protocol is layered on top of the X Consortium's <acronym>ICE</acronym> protocol and
121relies on the <acronym>ICE</acronym> protocol to handle connection management and authentication.
122  </para>
123
124</chapter>
125
126<chapter id="overview_of_the_protocol">
127  <title>Overview of the Protocol</title>
128
129  <para>
130Clients use XSMP to register themselves with the session manager (SM).
131When a client starts up, it should connect to the SM.  The client
132should remain connected for as long as it runs.  A client may resign
133from the session by issuing the proper protocol messages before
134disconnecting.  Termination of the connection without notice will be
135taken as an indication that the client died unexpectedly.
136  </para>
137
138  <para>
139Clients are expected to save their state in such a way as to allow
140multiple instantiations of themselves to be managed independently.  A
141unique value called a <firstterm>client-ID</firstterm> is
142provided by the protocol for the purpose of disambiguating multiple
143instantiations of clients.  Clients may use this ID, for example, as
144part of a filename in which to store the state for a particular
145instantiation.  The client-ID should be saved as part of the command
146used to restart this client
147(the <property>RestartCommand</property>) so that the client
148will retain the same ID after it is restarted.  Certain small pieces
149of state might also be stored in the RestartCommand.  For example, an
150X11 client might place a '-twoWindow' option in its RestartCommand to
151indicate that it should start up in two window mode when it is
152restarted.
153  </para>
154
155  <para>
156The client finds the network address of the SM in a system-dependent
157way.  On <acronym>POSIX</acronym> systems an environment
158variable called <envar>SESSION_MANAGER</envar>
159will contain a list of network IDs.  Each id will contain the
160transport name followed by a slash and the (transport-specific)
161address.  A TCP/IP address would look like this:
162    <informalexample><para>
163      <literal>tcp/</literal><replaceable>hostname</replaceable><literal>:</literal><replaceable>portnumber</replaceable>
164    </para></informalexample>
165where the hostname is a fully qualified domain name.
166A Unix Domain address looks like this:
167    <informalexample><para>
168	<literal>local/</literal><replaceable>hostname</replaceable><literal>:</literal><replaceable>path</replaceable>
169    </para></informalexample>
170A DECnet address would look like this:
171    <informalexample><para>
172	<literal>decnet/</literal><replaceable>nodename</replaceable><literal>::</literal><replaceable>objname</replaceable>
173    </para></informalexample>
174  </para>
175
176  <para>
177If multiple network IDs are specified, they should be separated by commas.
178  </para>
179
180  <note><title>Rationale</title>
181    <para>
182There was much discussion over whether the XSMP protocol should use X
183as the transport protocol or whether it should use its own independent
184transport.  It was decided that it would use an independent protocol
185for several reasons.  First, the Session Manager should be able to
186manage programs that do not maintain an X connection.  Second, the X
187protocol is not appropriate to use as a general-purpose transport
188protocol.  Third, a session might span multiple displays.
189    </para>
190
191    <para>
192The protocol is connection based, because there is no other way for
193the SM to determine reliably when clients terminate.
194    </para>
195
196    <para>
197It should be noted that this protocol introduces another single point
198of failure into the system.  Although it is possible for clients to
199continue running after the SM has exited, this will probably not be
200the case in normal practice.  Normally the program that starts the SM
201will consider the session to be terminated when the SM exits (either
202normally or abnormally).
203    </para>
204
205    <para>
206To get around this would require some sort of rendezvous server that
207would also introduce a single point of failure.  In the absence of a
208generally available rendezvous server, XSMP is kept simple in the
209hopes of making simple reliable SMs.
210    </para>
211  </note>
212
213  <para>
214Some clients may wish to manage the programs they start.  For example,
215a mail program could start a text editor for editing the text of a
216mail message.  A client that does this is a session manager itself; it
217should supply the clients it starts with the appropriate connection
218information (i.e., the <envar>SESSION_MANAGER</envar> environment variable)
219that specifies a connection to itself instead of to the top level session
220manager.
221  </para>
222
223  <para>
224Each client has associated with it a list of properties.  A property
225set by one client is not visible to any other client.  These
226properties are used for the client to inform the SM of the client's
227current state.  When a client initially connects to the SM, there are
228no properties set.
229  </para>
230</chapter>
231
232<chapter id="data_types">
233  <title>Data Types</title>
234
235  <para>
236XSMP messages contain several types of data.  Both the SM and the
237client always send messages in their native byte order.  Thus, both
238sides may need to byte-swap the messages received.  The need to do
239byte-swapping is determined at run-time by the <acronym>ICE</acronym> protocol.
240  </para>
241
242  <para>
243If an invalid value is specified for a field of any of the enumerated
244types, a <errorname>BadValue</errorname> error message must be sent by
245the receiver of the message to the sender of the message.
246  </para>
247
248<informaltable pgwide='0' frame='none'>
249  <tgroup cols='2' align='left'>
250    <colspec colname='c1'/>
251    <colspec colname='c2'/>
252    <thead>
253      <row>
254        <entry>Type Name</entry>
255        <entry>Description</entry>
256      </row>
257    </thead>
258    <tbody>
259      <row>
260        <entry>BOOL</entry>
261        <entry><para><constant>False</constant> or <constant>True</constant></para></entry>
262      </row>
263      <row>
264        <entry>INTERACT_STYLE</entry>
265        <entry><function>None</function> <function>Errors</function> or <function>Any</function></entry>
266      </row>
267      <row>
268        <entry>DIALOG_TYPE</entry>
269        <entry><function>Error</function> or <function>Normal</function></entry>
270      </row>
271      <row>
272        <entry>SAVE_TYPE</entry>
273        <entry><function>Global</function> <function>Local</function> or <function>Both</function></entry>
274      </row>
275      <row>
276        <entry>CARD8</entry>
277        <entry>a one-byte unsigned integer</entry>
278      </row>
279      <row>
280        <entry>CARD16</entry>
281        <entry>a two-byte unsigned integer</entry>
282      </row>
283      <row>
284        <entry>CARD32</entry>
285        <entry>a four-byte unsigned integer</entry>
286      </row>
287      <row>
288        <entry>ARRAY8</entry>
289        <entry>a sequence of CARD8s</entry>
290      </row>
291      <row>
292        <entry>LISTofARRAY8</entry>
293        <entry>a sequence of ARRAY8s</entry>
294      </row>
295      <row>
296        <entry>PROPERTY</entry>
297        <entry>a property name (an ARRAY8), a type name, and a value of that type</entry>
298      </row>
299      <row>
300        <entry>LISTofPROPERTY</entry>
301        <entry>a counted collection of &shy;PROPERTYs.</entry>
302      </row>
303    </tbody>
304  </tgroup>
305</informaltable>
306
307</chapter>
308
309<chapter id="protocol_setup_and_message_format">
310  <title>Protocol Setup and Message Format</title>
311
312  <para>
313To start the XSMP protocol, the client sends the server an
314<acronym>ICE</acronym> <function>ProtocolSetup</function> message.  All XSMP messages are
315in the standard <acronym>ICE</acronym> message format.  The message's major opcode is
316assigned to XSMP by <acronym>ICE</acronym> at run-time.  The different parties (client
317and SM) may be assigned different major opcodes for XSMP.  Once
318assigned, all XSMP messages issued by this party will use the same
319major opcode.  The message's minor opcode specifies which protocol
320message this message contains.
321  </para>
322</chapter>
323
324<chapter id="client_identification_string">
325  <title>Client Identification String</title>
326  <para>
327A client ID is a string of XPCS characters encoded in ISO Latin 1 (ISO
3288859-1).  No null characters are allowed in this string.  The client
329ID string is used in the <function>Register&shy;Client</function>
330and <function>Register&shy;ClientReply</function> messages.
331  </para>
332
333  <para>
334Client IDs consist of the pieces described below.  The ID is formed by
335concatenating the pieces in sequence, without separator characters.
336All pieces are padded on the left with '<literal>0</literal>'
337characters so as to fill the specified length.  Decimal numbers are
338encoded using the characters '<literal>0</literal>' through
339'<literal>9</literal>', and hexadecimal numbers using the characters
340'<literal>0</literal>' through '<literal>9</literal>' and
341'<literal>A</literal>' through '<literal>F</literal>'.
342  </para>
343
344  <itemizedlist mark='bullet'>
345     <listitem><para>
346Version.  This is currently the character '<literal>1</literal>'.
347     </para></listitem>
348     <listitem>
349       <para>Address type and address.  The address type will be one of
350<literallayout remap='DS'>
351     '<literal>1</literal>'     a 4-byte IPv4 address encoded as 8 hexadecimal digits
352     '<literal>2</literal>'     a 6-byte DECNET address encoded as 12 hexadecimal digits
353     '<literal>6</literal>'     a 16-byte IPv6 address encoded as 32 hexadecimal digits
354</literallayout>
355       </para>
356
357       <para>
358The address is the one of the network addresses of the machine where
359the session manager (not the client) is running.  For example, the IP
360address 198.112.45.11 would be encoded as the string
361"<literal>QC6702D0B</literal>".
362       </para>
363     </listitem>
364     <listitem><para>
365	 Time stamp.  A 13-digit decimal number specifying
366	 the number of milliseconds since 00:00:00 UTC, January 1, 1970.
367     </para></listitem>
368     <listitem>
369       <para>
370	Process-ID type and process-ID.  The process-ID type will be one of
371<literallayout remap='DS'>
372     '<literal>1</literal>'	a <acronym>POSIX</acronym> process-ID encoded as a 10-digit decimal number.
373</literallayout>
374       </para>
375       <para>
376The process-ID is the process-ID of the session manager, not of a client.
377       </para>
378     </listitem>
379     <listitem>
380       <para>
381Sequence number.  This is a four-digit decimal number.  It is
382incremented every time the session manager creates an ID.  After
383reaching "Q9999" it wraps to "Q0000".
384       </para>
385       <note><title>Rationale</title>
386	 <para>
387Once a client ID has been assigned to the client, the client keeps
388this ID indefinitely.  If the client is terminated and restarted, it
389will be reassigned the same ID.  It is desirable to be able to pass
390client IDs around from machine to machine, from user to user, and from
391session manager to session manager, while retaining the identity of
392the client.  This, combined with the indefinite persistence of client
393IDs, means that client IDs need to be globally unique.  The
394construction specified above will ensure that any client ID created by
395any user, session manager, and machine will be different from any other.
396	 </para>
397       </note>
398     </listitem>
399  </itemizedlist>
400</chapter>
401
402<chapter id="protocol">
403  <title>Protocol</title>
404  <para>
405The protocol consists of a sequence of messages as described below.
406Each message type is specified by an <acronym>ICE</acronym> minor opcode.  A given
407message type is sent either from a client to the session manager or
408from the session manager to a client; the appropriate direction is
409listed with each message's description.  For each message type, the
410set of valid responses and possible error messages are listed.  The
411<acronym>ICE</acronym> severity is given in parentheses following each error class.
412  </para>
413
414  <synopsis>
415<function>RegisterClient</function> [Client &rarr; SM]
416
417  <parameter>previous-ID</parameter>: ARRAY8
418
419  Valid Responses: <function>RegisterClientReply</function>
420
421  Possible Errors: <errorname>BadValue</errorname> (<symbol role='Pn'>CanContinue</symbol>)
422  </synopsis>
423
424  <para>
425The client must send this message to the SM to register the client's
426existence.  If a client is being restarted from a previous session,
427the <parameter>previous-ID</parameter> field must contain the client
428ID from the previous session.  For new clients, 
429<parameter>previous-ID</parameter> should be of zero length.
430  </para>
431
432  <para>
433If <parameter>previous-ID</parameter> is not valid, 
434the SM will send a <errorname>BadValue</errorname>
435error message to the client.  At this point the SM reverts to the
436register state and waits for another <function>RegisterClient</function>
437The client should then send a <function>RegisterClient</function> with a
438null <parameter>previous-ID</parameter> field.
439  </para>
440
441  <synopsis>
442<function>RegisterClientReply</function> [Client &larr; SM]
443
444  <parameter>client-ID</parameter>: <type>ARRAY8</type>
445  </synopsis>
446
447  <para>
448The <parameter>client-ID</parameter> specifies a unique identification
449for this client.  If the client had specified an ID in the 
450<parameter>previous-ID</parameter> field of the 
451<function>RegisterClient</function> message, 
452<parameter>client-ID</parameter> will be identical to the previously
453specified ID.  If <parameter>previous-ID</parameter> was null,
454<parameter>client-ID</parameter> will be a unique ID freshly generated
455by the SM.  The <parameter>client-ID</parameter> format is specified in
456<link linkend="client_identification_string">section 6</link>.
457  </para>
458
459  <para>
460If the client didn't supply a <parameter>previous-ID</parameter> field to
461the <function>Register&shy;Client</function> message, the SM must send
462a <function>SaveYourself</function> message with type = Local,
463shutdown = False, interact-style = None, and fast = False immediately
464after the <function>RegisterClientReply</function> The client should
465respond to this like any other <function>Save&shy;Yourself</function>
466message.
467  </para>
468
469  <synopsis>
470<function>SaveYourself</function> [Client &larr; SM]
471
472  <parameter>type</parameter>: <type>SAVE_TYPE</type>
473  <parameter>shutdown</parameter>: <type>BOOL</type>
474  <parameter>interact-style</parameter>: <type>INTERACT_STYLE</type>
475  <parameter>fast</parameter>: <type>BOOL</type>
476
477  Valid Responses:
478    <function>SetProperties</function>
479    <function>DeleteProperties</function>
480    <function>GetProperties</function>
481    <function>SaveYourselfDone</function>
482    <function>SaveYourselfPhase2Request</function>
483    <function>InteractRequest</function>
484  </synopsis>
485
486  <para>
487The SM sends this message to a client to ask it to save its state.
488The client writes a state file, if necessary, and, if necessary,
489uses <function>SetProperties</function> to inform the SM of how to
490restart it and how to discard the saved state.  During this process it
491can, if allowed by <parameter>interact-style</parameter>, request permission
492to interact with
493the user by sending an <function>InteractRequest</function> message.
494After the state has been saved, or if it cannot be successfully saved,
495and the properties are appropriately set, the client sends
496a <function>SaveYourselfDone</function> message.  If the client wants
497to save additional information after all the other clients have
498finished changing their own state, the client should
499send <function>SaveYourselfPhase2Request</function> instead
500of <function>SaveYourselfDone</function> The client must then freeze
501interaction with the user and wait until it receives
502a <function>SaveComplete</function> <function>Die</function> or
503a <function>ShutdownCancelled</function> message.
504  </para>
505
506  <para>
507If <parameter>interact-style</parameter> is <function>None</function> the
508client must not interact with the user while saving state.  If the
509<parameter>interact-style</parameter>
510is <function>Errors</function> the client may interact with the user
511only if an error condition arises.  If <parameter>interact-style</parameter>
512is <function>Any</function> then the client may interact with the user
513for any purpose.  This is done by sending
514an <function>Interact&shy;Request</function> message.  The SM will
515send an <function>Interact</function> message to each client that sent
516an <function>Interact&shy;Request</function> The client must postpone
517all interaction until it gets the <function>Interact</function>
518message.  When the client is done interacting it should send the SM
519an <function>Interact&shy;Done</function> message.
520The <function>Interact&shy;Request</function> message can be sent any
521time after a <function>Save&shy;Yourself</function> and before
522a <function>Save&shy;Yourself&shy;Done</function>
523  </para>
524
525  <para>
526Unusual circumstances may dictate multiple interactions.  The client
527may initiate as many <function>Interact&shy;Request</function>
528- <function>Interact</function> - <function>InteractDone</function>
529sequences as it needs before it sends <function>SaveYourselfDone</function>
530  </para>
531
532  <para>
533When a client receives <function>Save&shy;Yourself</function> and has
534not yet responded <function>Save&shy;Yourself&shy;Done</function> to a
535previous <function>Save&shy;Yourself</function> it must send
536a <function>Save&shy;Yourself&shy;Done</function> and may then begin
537responding as appropriate to the newly received
538<function>Save&shy;Yourself</function>
539</para>
540
541  <para>
542The <parameter>type</parameter> field specifies the type of information that
543should be saved: <function>Global</function> <function>Local</function>
544or <function>Both</function> The <function>Local</function> type
545indicates that the application must update the properties to reflect
546its current state, send
547a <function>Save&shy;Yourself&shy;Done</function> and continue.
548Specifically it should save enough information to restore the state as
549seen by the user of this client.  It should not affect the state as
550seen by other users.  The <function>Global</function> type indicates
551that the user wants the client to commit all of its data to permanent,
552globally-accessible storage.  <function>Both</function> indicates that
553the client should do both of these.  If <function>Both</function> is
554specified, the client should first commit the data to permanent
555storage before updating its SM properties.
556  </para>
557
558  <note><title>Examples</title>
559    <para>
560If a word processor was sent a <function>SaveYourself</function> with
561a type of <function>Local</function> it could create a temporary file
562that included the current contents of the file, the location of the
563cursor, and other aspects of the current editing session.  It would
564then update its <function>Restart&shy;Command</function> property with
565enough information to find the temporary file, and
566its <function>Discard&shy;Command</function> with enough information
567to remove it.
568    </para>
569
570    <para>
571If a word processor was sent a <function>SaveYourself</function> with
572a type of <function>Global</function> it would simply save the
573currently edited file.
574    </para>
575
576    <para>
577If a word processor was sent a <function>SaveYourself</function> with
578a type of <function>Both</function> it would first save the currently
579edited file.  It would then create a temporary file with information
580such as the current position of the cursor and what file is being
581edited.  It would then update
582its <function>Restart&shy;Command</function> property with enough
583information to find the temporary file, and
584its <function>Discard&shy;Command</function> with enough information
585to remove it.
586    </para>
587
588    <para>
589Once the SM has send <function>SaveYourself</function> to a client, it
590can't send another <function>SaveYourself</function> to that client until
591the client either responds with a <function>SaveYourselfDone</function> or
592the SM sends a <function>ShutdownCancelled</function>
593    </para>
594  </note>
595
596  <note><title>Advice to Implementors</title>
597    <para>
598If the client stores local any state in a file or similar "external"
599storage, it must create a distinct copy in response to
600each <function>SaveYourself</function> message.
601It <emphasis remap='I'>must not</emphasis> simply refer to a previous
602copy, because the SM may discard that previous saved state using
603a <function>DiscardCommand</function> without knowing that it is
604needed for the new checkpoint.
605    </para>
606  </note>
607
608  <para>
609The <parameter>shutdown</parameter> field specifies whether the system is
610being shut down.
611  </para>
612
613  <note><title>Rationale</title>
614    <para>
615The interaction may be different depending on whether or not shutdown is set.
616    </para>
617  </note>
618
619  <para>
620The client must save and then must prevent interaction until it
621receives a <function>SaveComplete</function> <function>Die</function>
622or a <function>Shutdown&shy;Cancelled</function> because anything the
623user does after the save will be lost.
624  </para>
625
626  <para>
627The <parameter>fast</parameter> field specifies whether or not the client
628should save its state as quickly as possible.  For example, if the SM knows
629that power is about to fail, it should set the <parameter>fast</parameter>
630field to <constant>True</constant>.
631  </para>
632
633  <synopsis>
634<function>SaveYourselfPhase2</function> [Client &rarr; SM]
635
636  Valid Responses:
637    <function>SetProperties</function>
638    <function>DeleteProperties</function>
639    <function>GetProperties</function>
640    <function>SaveYourselfDone</function>
641    <function>InteractRequest</function>
642  </synopsis>
643
644  <para>
645The SM sends this message to a client that has previously sent
646a <function>SaveYourselfPhase2Request</function> message.  This
647message informs the client that all other clients are in a fixed state
648and this client can save state that is associated with other clients.
649  </para>
650
651  <note><title>Rationale</title>
652    <para>
653Clients that manager other clients (window managers, workspace
654managers, etc) need to know when all clients they are managing are
655idle, so that the manager can save state related to each of the
656clients without being concerned with that state changing.
657    </para>
658  </note>
659  <para>
660The client writes a state file, if necessary, and, if necessary,
661uses <function>SetProperties</function> to inform the SM of how to
662restart it and how to discard the saved state.  During this process it
663can request permission to interact with the user by sending
664an <function>InteractRequest</function> message.  This should only be
665done if an error occurs that requires user interaction to resolve.
666After the state has been saved, or if it cannot be successfully saved,
667and the properties are appropriately set, the client sends
668a <function>SaveYourselfDone</function> message.
669  </para>
670
671  <synopsis>
672<function>SaveYourselfRequest</function> [Client &rarr; SM]
673
674  <parameter>type</parameter>: <type>SAVE_TYPE</type>
675  <parameter>shutdown</parameter>: <type>BOOL</type>
676  <parameter>interact-style</parameter>: <type>INTERACT_STYLE</type>
677  <parameter>fast</parameter>: <type>BOOL</type>
678  <parameter>global</parameter>: <type>BOOL</type>
679
680  Valid Responses: <function>SaveYourself</function>
681  </synopsis>
682
683  <para>
684An application sends this to the SM to request a checkpoint.  When the
685SM receives this request it may generate a <function>SaveYourself</function>
686message in response and it may leave the fields intact.
687  </para>
688
689  <note><title>Example</title> <para>
690A vendor of a <acronym>UPS</acronym> (Uninterruptible Power Supply)
691might include an SM client that would monitor the status of
692the <acronym>UPS</acronym> and generate a fast shutdown if the power
693is about to be lost.
694  </para></note>
695
696  <para>
697If <parameter>global</parameter> is set to <constant>True</constant> then the
698resulting <function>SaveYourself</function> should be sent to all
699applications.  If <parameter>global</parameter> is set to
700<constant>False</constant> then the
701resulting <function>SaveYourself</function> should be sent to the
702application that sent the <function>Save&shy;Yourself&shy;Request</function>
703  </para>
704
705  <synopsis>
706<function>InteractRequest</function> [Client &rarr; SM]
707
708  <parameter>dialog-type</parameter>: <type>DIALOG_TYPE</type>
709
710  Valid Responses: <function>Interact</function> <function>ShutdownCancelled</function>
711
712  Possible Errors: <errorname>BadState</errorname> (<symbol role='Pn'>CanContinue</symbol>)
713  </synopsis>
714
715  <para>
716During a checkpoint or session-save operation, only one client at a
717time might be granted the privilege of interacting with the user.
718The <function>InteractRequest</function> message causes the SM to emit
719an <function>Interact</function> message at some later time if the
720shutdown is not cancelled by another client first.
721  </para>
722
723  <para>
724The <parameter>dialog-type</parameter> field specifies either
725<function>Errors</function> indicating that the client wants to start an
726error dialog or <function>Normal</function> meaning the client wishes
727to start a non-error dialog.
728  </para>
729
730  <synopsis>
731<function>Interact</function> [Client &larr; SM]
732
733  Valid Responses: <function>InteractDone</function>
734  </synopsis>
735
736  <para>
737This message grants the client the privilege of interacting with the
738user.  When the client is done interacting with the user it must send
739an <function>InteractDone</function> message to the SM unless a
740shutdown cancel is received.
741  </para>
742  <note><title>Advice to Implementors</title>
743    <para>If a client receives a ShutdownCancelled
744after receiving an <function>Interact</function> message, but before
745sending a <function>InteractDone</function> the client should abort
746the interaction and send a <function>SaveYourselfDone</function>
747  </para></note>
748
749  <synopsis>
750<function>InteractDone</function> [Client &rarr; SM]
751
752  <parameter>cancel-shutdown</parameter>: <type>BOOL</type>
753
754  Valid Responses: <function>ShutdownCancelled</function>
755  </synopsis>
756
757  <para>
758This message is used by a client to notify the SM that it is done interacting.
759  </para>
760
761  <para>
762Setting the <parameter>cancel-shutdown</parameter> field to <constant>True</constant>
763indicates that the user has requested that the entire shutdown be
764cancelled.  <parameter>Cancel-shutdown</parameter> may only be <constant>True</constant> if
765the corresponding <function>SaveYourself</function> message
766specified <constant>True</constant> for the shutdown field
767and <function>Any</function> or <function>Errors</function> for the
768<parameter>interact-style</parameter> field.  Otherwise,
769<parameter>cancel-shutdown</parameter> must be <constant>False</constant>.
770  </para>
771
772  <synopsis>
773<function>SaveYourselfDone</function> [Client &rarr; SM]
774
775  <parameter>success</parameter>: <type>BOOL</type>
776
777  Valid Responses:
778    <function>SaveComplete</function>
779    <function>Die</function>
780    <function>ShutdownCancelled</function>
781  
782  </synopsis>
783
784  <para>
785This message is sent by a client to indicate that all of the
786properties representing its state have been updated.  After
787sending <function>SaveYourselfDone</function> the client must wait for
788a <function>SaveComplete</function> <function>ShutdownCancelled</function>
789or <function>Die</function> message before changing its state.  If
790the <function>SaveYourself</function> operation was successful, then
791the client should set the <parameter>success</parameter> field to
792<constant>True</constant> otherwise the client should set it to
793<constant>False</constant>.
794  </para>
795
796  <note><title>Example</title>
797    <para>
798If a client tries to save its state and runs out of disk space, it
799should return <constant>False</constant> in the <parameter>success</parameter>
800field of the <function>SaveYourselfDone</function> message.
801    </para>
802  </note>
803
804  <synopsis>
805<function>SaveYourselfPhase2Request</function> [Client &rarr; SM]
806
807  Valid Responses:
808    <function>ShutdownCancelled</function>
809    <function>SaveYourselfPhase2</function>
810  
811  </synopsis>
812
813  <para>
814This message is sent by a client to indicate that it needs to be informed
815when all the other clients are quiescent, so it can continue its state.
816  </para>
817
818  <synopsis>
819<function>Die</function> [Client &larr; SM]
820
821  Valid Responses: <function>ConnectionClosed</function>
822  </synopsis>
823
824  <para>
825When the SM wants a client to die it sends a <function>Die</function>
826message.  Before the client dies it responds by sending
827a <function>ConnectionClosed</function> message and may then close its
828connection to the SM at any time.
829  </para>
830
831  <synopsis>
832<function>SaveComplete</function> [Client &rarr; SM]
833
834  Valid Responses:
835  </synopsis>
836
837  <para>
838When the SM is done with a checkpoint, it will send each of the
839clients a <function>SaveComplete</function> message.  The client is
840then free to change its state.
841  </para>
842
843  <synopsis>
844<function>ShutdownCancelled</function> [Client &larr; SM]
845  </synopsis>
846
847  <para>
848The shutdown currently in process has been aborted.  The client can
849now continue as if the shutdown had never happened.  If the client has
850not sent <function>SaveYourselfDone</function> yet, the client can
851either abort the save and send <function>SaveYourselfDone</function>
852with the success field set to <constant>False</constant> or it can
853continue with the save and send a <function>SaveYourselfDone</function>
854with the success field set to reflect the outcome of the save.
855  </para>
856
857  <synopsis>
858<function>ConnectionClosed</function> [Client &rarr; SM]
859
860  <parameter>reason</parameter>: <type>LISTofARRAY8</type>
861  </synopsis>
862
863  <para>
864Specifies that the client has decided to terminate.  It should be
865immediately followed by closing the connection.
866  </para>
867
868  <para>
869The <parameter>reason</parameter> field specifies why the client is resigning
870from the session.  It is encoded as an array of Compound Text strings.  If the
871resignation is expected by the user, there will typically be zero
872ARRAY8s here.  But if the client encountered an unexpected fatal
873error, the error message (which might otherwise be printed on stderr
874on a <acronym>POSIX</acronym> system) should be forwarded to the SM here, one ARRAY8 per
875line of the message.  It is the responsibility of the SM to display
876this reason to the user.
877  </para>
878
879  <para>
880After sending this message, the client must not send any additional
881XSMP messages to the SM.
882  </para>
883  <note><title>Advice to Implementors</title><para>
884If additional messages are received, they should be discarded.
885  </para></note>
886  <note><title>Rationale</title><para>
887The reason for sending the <function>ConnectionClosed</function>
888message before actually closing the connections is that some transport
889protocols will not provide immediate notification of connection
890closure.
891  </para></note>
892
893  <synopsis>
894<function>SetProperties</function> [Client &rarr; SM]
895
896  <parameter>properties</parameter>: <type>LISTofPROPERTY</type>
897  </synopsis>
898
899  <para>
900Sets the specified <parameter>properties</parameter> to the specified values.
901Existing
902properties not specified in the <function>Set&shy;Properties</function>
903message are unaffected. Some properties have predefined semantics.
904See <link linkend='predefined_properties'>section 11, 
905&ldquo;Predefined Properties.&rdquo;</link>
906  </para>
907
908  <para>
909The protocol specification recommends that property names used for
910properties not defined by the standard should begin with an
911underscore.  To prevent conflicts among organizations, additional
912prefixes should be chosen (for example, _KPC_FAST_SAVE_OPTION).  The
913organizational prefixes should be registered with the X Registry.  The
914XSMP reserves all property names not beginning with an underscore for
915future use.
916  </para>
917
918  <synopsis>
919<function>DeleteProperties</function> [Client &rarr; SM]
920
921  <parameter>property-names</parameter>: <type>LISTofARRAY8</type>
922  </synopsis>
923
924  <para>Removes the named properties.</para>
925
926  <synopsis>
927<function>GetProperties</function> [Client &rarr; SM]
928
929  Valid Responses: <function>GetPropertiesReply</function>
930  </synopsis>
931
932  <para>
933Requests that the SM respond with the values of all the properties for
934this client.
935  </para>
936
937  <synopsis>
938<function>GetPropertiesReply</function> [Client &larr; SM]
939
940  <parameter>values</parameter>: <type>LISTofPROPERTY</type>
941  </synopsis>
942
943  <para>
944This message is sent in reply to a <function>GetProperties</function>
945message and includes the <parameter>values</parameter> of all the properties.
946  </para>
947</chapter>
948
949<chapter id="errors">
950  <title>Errors</title>
951
952  <para>
953When the receiver of a message detects an error condition, the
954receiver sends an <acronym>ICE</acronym> error message to the sender.  There are only two
955types of errors that are used by the XSMP:
956<errorname>BadValue</errorname> and <errorname>BadState</errorname>
957These are both defined in the <acronym>ICE</acronym> protocol.
958  </para>
959
960  <para>
961Any message received out-of-sequence will generate
962a <errorname>BadState</errorname> error message.
963  </para>
964</chapter>
965
966<chapter id="state_diagrams">
967  <title>State Diagrams</title>
968  <para>
969These state diagrams are designed to cover all actions of both the
970client and the SM.
971  </para>
972
973  <sect1 id='client_state_diagram'>
974    <title>Client State Diagram</title>
975
976<!-- <literallayout remap='DS'> -->
977<literallayout>
978<emphasis remap='I'>start:</emphasis>
979     <acronym>ICE</acronym> protocol setup complete &rarr; <emphasis remap='C'>register</emphasis></literallayout>
980
981<literallayout>
982<emphasis remap='I'>register:</emphasis>
983     send <emphasis remap='B'>RegisterClient</emphasis> &rarr; <emphasis remap='C'>collect-id</emphasis></literallayout>
984
985<literallayout remap='DS'>
986<emphasis remap='I'>collect-id:</emphasis>
987     receive <emphasis remap='B'>RegisterClientReply</emphasis> &rarr; <emphasis remap='C'>idle</emphasis></literallayout>
988
989<literallayout remap='DS'>
990<emphasis remap='I'>shutdown-cancelled:</emphasis>
991     send <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>idle</emphasis></literallayout>
992
993<literallayout remap='DS'>
994<emphasis remap='I'>idle:</emphasis> [Undoes any freeze of interaction with user.]
995     receive <emphasis remap='B'>Die</emphasis> &rarr; <emphasis remap='C'>die</emphasis>
996     receive <emphasis remap='B'>SaveYourself</emphasis> &rarr; <emphasis remap='C'>freeze-interaction</emphasis>
997     send <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
998     receive <emphasis remap='B'>GetPropertiesReply</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
999     send <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1000     send <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1001     send <emphasis remap='B'>ConnectionClosed</emphasis> &rarr; <emphasis remap='C'>connection-closed</emphasis>
1002     send <emphasis remap='B'>SaveYourselfRequest</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1003</literallayout> <!-- remap='DE' -->
1004
1005<literallayout remap='DS'>
1006<emphasis remap='I'>die:</emphasis>
1007     send <emphasis remap='B'>ConnectionClosed</emphasis> &rarr; <emphasis remap='C'>connection-closed</emphasis></literallayout>
1008
1009<literallayout remap='DS'>
1010<emphasis remap='I'>freeze-interaction:</emphasis>
1011     freeze interaction with user &rarr; <emphasis remap='C'>save-yourself</emphasis></literallayout>
1012
1013<literallayout remap='DS'>
1014<emphasis remap='I'>save-yourself:</emphasis>
1015     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>shutdown-cancelled</emphasis>
1016     send <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1017     send <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1018     send <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1019     receive <emphasis remap='B'>GetPropertiesReply</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1020     send <emphasis remap='B'>InteractRequest</emphasis> &rarr; <emphasis remap='C'>interact-request</emphasis>
1021     send <emphasis remap='B'>SaveYourselfPhase2Request</emphasis> &rarr; waiting-for-phase2
1022
1023<emphasis remap='I'>save-yourself:</emphasis>
1024     if shutdown mode:
1025          send <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>save-yourself-done</emphasis>
1026     otherwise:
1027          send <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>idle</emphasis></literallayout>
1028
1029<literallayout remap='DS'>
1030<emphasis remap='I'>waiting-for-phase2:</emphasis>
1031     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>shutdown-cancelled</emphasis>
1032     receive <emphasis remap='B'>SaveYourselfPhase2</emphasis> &rarr; <emphasis remap='C'>phase2</emphasis></literallayout>
1033
1034<literallayout remap='DS'>
1035<emphasis remap='I'>phase2:</emphasis>
1036     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>shutdown-cancelled</emphasis>
1037     send <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1038     send <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1039     send <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1040     receive <emphasis remap='B'>GetPropertiesReply</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1041     send <emphasis remap='B'>InteractRequest</emphasis> &rarr; <emphasis remap='C'>interact-request</emphasis> (errors only)
1042     if shutdown mode:
1043          send <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>save-yourself-done</emphasis>
1044     otherwise:
1045          send <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>idle</emphasis></literallayout>
1046
1047<literallayout remap='DS'>
1048<emphasis remap='I'>interact-request:</emphasis>
1049     receive <emphasis remap='B'>Interact</emphasis> &rarr; <emphasis remap='C'>interact</emphasis>
1050     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>shutdown-cancelled</emphasis></literallayout>
1051
1052<literallayout remap='DS'>
1053<emphasis remap='I'>interact:</emphasis>
1054     send <emphasis remap='B'>InteractDone</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1055     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>shutdown-cancelled</emphasis></literallayout>
1056
1057<literallayout remap='DS'>
1058<emphasis remap='I'>save-yourself-done:</emphasis> (changing state is forbidden)
1059     receive <emphasis remap='B'>SaveComplete</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1060     receive <emphasis remap='B'>Die</emphasis> &rarr; <emphasis remap='C'>die</emphasis>
1061     receive <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>idle</emphasis></literallayout>
1062
1063<literallayout remap='DS'>
1064<emphasis remap='I'>connection-closed:</emphasis>
1065     client stops participating in session </literallayout>
1066</sect1>
1067
1068<sect1 id='session_manager_state_diagram'>
1069<title>Session Manager State Diagram</title>
1070
1071<literallayout remap='DS'>
1072<emphasis remap='I'>start:</emphasis>
1073     receive <emphasis remap='B'>ProtocolSetup</emphasis> &rarr; <emphasis remap='C'>protocol-setup</emphasis></literallayout>
1074
1075<literallayout remap='DS'>
1076<emphasis remap='I'>protocol-setup:</emphasis>
1077     send <emphasis remap='B'>ProtocolSetupReply</emphasis> &rarr; <emphasis remap='C'>register</emphasis></literallayout>
1078
1079<literallayout remap='DS'>
1080<emphasis remap='I'>register:</emphasis>
1081     receive <emphasis remap='B'>RegisterClient</emphasis> &rarr; <emphasis remap='C'>acknowledge-register</emphasis>
1082</literallayout>
1083
1084<literallayout remap='DS'>
1085<emphasis remap='I'>acknowledge-register:</emphasis>
1086     send <emphasis remap='B'>RegisterClientReply</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1087</literallayout>
1088
1089<literallayout remap='DS'>
1090<emphasis remap='I'>idle:</emphasis>
1091     receive <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1092     receive <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1093     receive <emphasis remap='B'>ConnectionClosed</emphasis> &rarr; <emphasis remap='C'>start</emphasis>
1094     receive <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>get-properties</emphasis>
1095     receive <emphasis remap='B'>SaveYourselfRequest</emphasis> &rarr; <emphasis remap='C'>save-yourself</emphasis>
1096     send <emphasis remap='B'>SaveYourself</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1097</literallayout>
1098
1099<literallayout remap='DS'>
1100<emphasis remap='I'>save-yourself:</emphasis>
1101     send <emphasis remap='B'>SaveYourself</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1102</literallayout>
1103
1104<literallayout remap='DS'>
1105<emphasis remap='I'>get-properties:</emphasis>
1106     send <emphasis remap='B'>GetPropertiesReply</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1107</literallayout>
1108
1109<literallayout remap='DS'>
1110<emphasis remap='I'>saving-get-properties:</emphasis>
1111     send <emphasis remap='B'>GetPropertiesReply</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1112</literallayout>
1113
1114<literallayout remap='DS'>
1115<emphasis remap='I'>saving-yourself:</emphasis>
1116     receive <emphasis remap='B'>InteractRequest</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1117     send <emphasis remap='B'>Interact</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1118     send <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1119     receive <emphasis remap='B'>InteractDone</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1120     receive <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1121      receive <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1122     receive <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>saving-get-properties</emphasis>
1123     receive <emphasis remap='B'>SaveYourselfPhase2Request</emphasis> &rarr; <emphasis remap='C'>start-phase2</emphasis>
1124     receive <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>save-yourself-done</emphasis>
1125</literallayout>
1126
1127<literallayout remap='DS'>
1128<emphasis remap='I'>start-phase2:</emphasis>
1129     If all clients have sent either SaveYourselfPhase2Request or SaveYourselfDone:
1130          send <emphasis remap='B'>SaveYourselfPhase2</emphasis> &rarr; <emphasis remap='C'>phase2</emphasis>
1131     else
1132          &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1133</literallayout>
1134
1135<literallayout remap='DS'>
1136<emphasis remap='I'>phase2:</emphasis>
1137     receive <emphasis remap='B'>InteractRequest</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1138     send <emphasis remap='B'>Interact</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1139     send <emphasis remap='B'>ShutdownCancelled</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1140     receive <emphasis remap='B'>InteractDone</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1141     receive <emphasis remap='B'>SetProperties</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1142      receive <emphasis remap='B'>DeleteProperties</emphasis> &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1143     receive <emphasis remap='B'>GetProperties</emphasis> &rarr; <emphasis remap='C'>saving-get-properties</emphasis>
1144     receive <emphasis remap='B'>SaveYourselfDone</emphasis> &rarr; <emphasis remap='C'>save-yourself-done</emphasis>
1145</literallayout>
1146
1147<literallayout remap='DS'>
1148<emphasis remap='I'>save-yourself-done:</emphasis>
1149     If all clients are saved:
1150          If shutting down:
1151               send <emphasis remap='B'>Die</emphasis> &rarr; <emphasis remap='C'>die</emphasis>
1152          otherwise
1153               send <emphasis remap='B'>SaveComplete</emphasis> &rarr; <emphasis remap='C'>idle</emphasis>
1154
1155     If some clients are not saved:
1156     &rarr; <emphasis remap='C'>saving-yourself</emphasis>
1157</literallayout>
1158
1159<literallayout remap='DS'>
1160<emphasis remap='I'>die:</emphasis>
1161     SM stops accepting connections
1162</literallayout>
1163  </sect1>
1164</chapter>
1165
1166<chapter id='protocol_encoding'>
1167  <title>Protocol Encoding</title>
1168  <sect1 id="types">
1169    <title>Types</title>
1170
1171<informaltable pgwide='0' frame='none'>
1172  <tgroup cols='4'>
1173    <colspec colwidth='0.5in' colname='c0'/>
1174    <colspec colwidth='1.0in' colname='c1'/>
1175    <colspec colwidth='1.0in' colname='c2'/>
1176    <colspec colwidth='1.0in' colname='c3'/>
1177    <spanspec spanname="typename" namest="c0" nameend="c3" />
1178    <tbody>
1179      <row>
1180        <entry spanname="typename"><emphasis role="bold">BOOL</emphasis></entry>
1181      </row>
1182      <row>
1183        <entry namest="c1">0</entry>
1184        <entry namest="c2">False</entry>
1185      </row>
1186      <row>
1187        <entry namest="c1">1</entry>
1188        <entry namest="c2">True</entry>
1189      </row>
1190
1191      <row>
1192        <entry spanname="typename"><emphasis role="bold">INTERACT_STYLE</emphasis></entry>
1193      </row>
1194      <row>
1195        <entry namest="c1">0</entry>
1196        <entry namest="c2">None</entry>
1197      </row>
1198      <row>
1199        <entry namest="c1">1</entry>
1200        <entry namest="c2">Errors</entry>
1201      </row>
1202      <row>
1203        <entry namest="c1">2</entry>
1204        <entry namest="c2">Any</entry>
1205      </row>
1206
1207      <row>
1208        <entry spanname="typename"><emphasis role="bold">DIALOG_TYPE</emphasis></entry>
1209      </row>
1210      <row>
1211        <entry namest="c1">0</entry>
1212        <entry namest="c2">Error</entry>
1213      </row>
1214      <row>
1215        <entry namest="c1">1</entry>
1216        <entry namest="c2">Normal</entry>
1217      </row>
1218
1219      <row>
1220        <entry spanname="typename"><emphasis role="bold">SAVE_TYPE</emphasis></entry>
1221      </row>
1222      <row>
1223        <entry namest="c1">0</entry>
1224        <entry namest="c2">Global</entry>
1225      </row>
1226      <row>
1227        <entry namest="c1">1</entry>
1228        <entry namest="c2">Local</entry>
1229      </row>
1230      <row>
1231        <entry namest="c1">2</entry>
1232        <entry namest="c2">Both</entry>
1233      </row>
1234
1235      <row>
1236        <entry spanname="typename"><emphasis role="bold">ARRAY8</emphasis></entry>
1237      </row>
1238      <row>
1239        <entry namest="c1">4</entry>
1240        <entry namest="c2">CARD32</entry>
1241        <entry namest="c3">length</entry>
1242      </row>
1243      <row>
1244        <entry namest="c1">n</entry>
1245        <entry namest="c2">ListofCARD8, the array</entry>
1246        <entry namest="c3">p = pad (4 + n, 8)</entry>
1247      </row>
1248      <row>
1249        <entry namest="c1">2</entry>
1250        <entry namest="c2">Both</entry>
1251      </row>
1252
1253      <row>
1254        <entry spanname="typename"><emphasis role="bold">LISTofARRAY8</emphasis></entry>
1255      </row>
1256      <row>
1257        <entry namest="c1">4</entry>
1258        <entry namest="c2">CARD32</entry>
1259        <entry namest="c3">count</entry>
1260      </row>
1261      <row>
1262        <entry namest="c1">4</entry>
1263        <entry namest="c2"></entry>
1264        <entry namest="c3">unused</entry>
1265      </row>
1266      <row>
1267        <entry namest="c1">a</entry>
1268        <entry namest="c2">ARRAY8</entry>
1269        <entry namest="c3">first array</entry>
1270      </row>
1271      <row>
1272        <entry namest="c1">b</entry>
1273        <entry namest="c2">ARRAY8</entry>
1274        <entry namest="c3">second array</entry>
1275      </row>
1276      <row>
1277        <entry namest="c1">.</entry>
1278        <entry namest="c2"></entry>
1279        <entry namest="c3"></entry>
1280      </row>
1281      <row>
1282        <entry namest="c1">.</entry>
1283        <entry namest="c2"></entry>
1284        <entry namest="c3"></entry>
1285      </row>
1286      <row>
1287        <entry namest="c1">.</entry>
1288        <entry namest="c2"></entry>
1289        <entry namest="c3"></entry>
1290      </row>
1291      <row>
1292        <entry namest="c1">q</entry>
1293        <entry namest="c2">ARRAY8</entry>
1294        <entry namest="c3">last array</entry>
1295      </row>
1296
1297      <row>
1298        <entry spanname="typename"><emphasis role="bold">PROPERTY</emphasis></entry>
1299      </row>
1300      <row>
1301        <entry namest="c1">a</entry>
1302        <entry namest="c2">ARRAY8</entry>
1303        <entry namest="c3">name</entry>
1304      </row>
1305      <row>
1306        <entry namest="c1">b</entry>
1307        <entry namest="c2">ARRAY8</entry>
1308        <entry namest="c3">type (XPCS encoded in Latin-1, case sensitive)</entry>
1309      </row>
1310      <row>
1311        <entry namest="c1">c</entry>
1312        <entry namest="c2">LISTofARRAY8</entry>
1313        <entry namest="c3">values</entry>
1314      </row>
1315
1316      <row>
1317        <entry spanname="typename"><emphasis role="bold">LISTofPROPERTY</emphasis></entry>
1318      </row>
1319      <row>
1320        <entry namest="c1">4</entry>
1321        <entry namest="c2">CARD32</entry>
1322        <entry namest="c3">count</entry>
1323      </row>
1324      <row>
1325        <entry namest="c1">4</entry>
1326        <entry namest="c2"></entry>
1327        <entry namest="c3">unused</entry>
1328      </row>
1329      <row>
1330        <entry namest="c1">a</entry>
1331        <entry namest="c2">PROPERTY</entry>
1332        <entry namest="c3">first property</entry>
1333      </row>
1334      <row>
1335        <entry namest="c1">b</entry>
1336        <entry namest="c2">PROPERTY</entry>
1337        <entry namest="c3">second property</entry>
1338      </row>
1339      <row>
1340        <entry namest="c1">.</entry>
1341        <entry namest="c2"></entry>
1342        <entry namest="c3"></entry>
1343      </row>
1344      <row>
1345        <entry namest="c1">.</entry>
1346        <entry namest="c2"></entry>
1347        <entry namest="c3"></entry>
1348      </row>
1349      <row>
1350        <entry namest="c1">.</entry>
1351        <entry namest="c2"></entry>
1352        <entry namest="c3"></entry>
1353      </row>
1354      <row>
1355        <entry namest="c1">q</entry>
1356        <entry namest="c2">PROPERTY</entry>
1357        <entry namest="c3">last property</entry>
1358      </row>
1359     </tbody>
1360  </tgroup>
1361</informaltable>
1362
1363  </sect1>
1364
1365  <sect1 id='messages'>
1366    <title>Messages</title>
1367    <para>
1368XSMP is a sub-protocol of <acronym>ICE</acronym>.  The major opcode is
1369assigned at run-time by <acronym>ICE</acronym> and is represented here
1370by '<literal>?</literal>'.
1371    </para>
1372
1373    <para>
1374To start the XSMP protocol, the client sends the server an
1375<acronym>ICE</acronym> <function>ProtocolSetup</function> message.
1376The protocol-name field should be specified as "<literal>XSMP</literal>",
1377the major version of the protocol is 1, the minor version is 0.  These
1378values may change if the protocol is revised.  The minor version
1379number will be incremented if the change is compatible, otherwise the
1380major version number will be incremented.
1381    </para>
1382
1383    <para>
1384In <function>ProtocolReply</function> message sent by the session
1385manager, the XSMP protocol defines the vendor parameter as product
1386identification of the session manager, and defines the release
1387parameter as the software release identification of the session
1388manager.  The session manager should supply this information in the
1389<acronym>ICE</acronym> <function>ProtocolReply</function> message.
1390    </para>
1391
1392<informaltable pgwide='0' frame='none'>
1393  <tgroup cols='4' align='left'>
1394    <colspec  colwidth='0.5in' colname='c0'/>
1395    <colspec  colwidth='0.5in' colname='c1'/>
1396    <colspec  colwidth='1.1in' colname='c2'/>
1397    <colspec  colwidth='1.0in' colname='c3'/>
1398    <spanspec spanname="messagename" namest="c0" nameend="c3" />
1399    <tbody>
1400      <row>
1401	<entry spanname="messagename"><emphasis role="bold"><function>RegisterClient</function></emphasis></entry>
1402      </row>
1403      <row>
1404        <entry namest="c1">1</entry>
1405        <entry namest="c2">?</entry>
1406        <entry namest="c3">XSMP</entry>
1407      </row>
1408      <row>
1409        <entry namest="c1">1</entry>
1410        <entry namest="c2">1</entry>
1411        <entry namest="c3">opcode</entry>
1412      </row>
1413      <row>
1414        <entry namest="c1">2</entry>
1415        <entry namest="c2"></entry>
1416        <entry namest="c3">unused</entry>
1417      </row>
1418      <row>
1419        <entry namest="c1">4</entry>
1420        <entry namest="c2">a/8</entry>
1421        <entry namest="c3">length of remaining data in 8-byte units</entry>
1422      </row>
1423      <row>
1424        <entry namest="c1">a</entry>
1425        <entry namest="c2">ARRAY8</entry>
1426        <entry namest="c3">previous-ID</entry>
1427      </row>
1428
1429      <row>
1430        <entry spanname="messagename"><emphasis role="bold"><function>RegisterClientReply</function></emphasis></entry>
1431      </row>
1432      <row>
1433        <entry namest="c1">1</entry>
1434        <entry namest="c2">?</entry>
1435        <entry namest="c3">XSMP</entry>
1436      </row>
1437      <row>
1438        <entry namest="c1">1</entry>
1439        <entry namest="c2">2</entry>
1440        <entry namest="c3">opcode</entry>
1441      </row>
1442      <row>
1443        <entry namest="c1">2</entry>
1444        <entry namest="c2"></entry>
1445        <entry namest="c3">unused</entry>
1446      </row>
1447      <row>
1448        <entry namest="c1">4</entry>
1449        <entry namest="c2">a/8</entry>
1450        <entry namest="c3">length of remaining data in 8-byte units</entry>
1451      </row>
1452      <row>
1453        <entry namest="c1">a</entry>
1454        <entry namest="c2">ARRAY8</entry>
1455        <entry namest="c3">client-ID</entry>
1456      </row>
1457
1458      <row>
1459        <entry spanname="messagename"><emphasis role="bold"><function>SaveYourself</function></emphasis></entry>
1460      </row>
1461      <row>
1462        <entry namest="c1">1</entry>
1463        <entry namest="c2">?</entry>
1464        <entry namest="c3">XSMP</entry>
1465      </row>
1466      <row>
1467        <entry namest="c1">1</entry>
1468        <entry namest="c2">3</entry>
1469        <entry namest="c3">opcode</entry>
1470      </row>
1471      <row>
1472        <entry namest="c1">2</entry>
1473        <entry namest="c2"></entry>
1474        <entry namest="c3">unused</entry>
1475      </row>
1476      <row>
1477        <entry namest="c1">4</entry>
1478        <entry namest="c2">1</entry>
1479        <entry namest="c3">length of remaining data in 8-byte units</entry>
1480      </row>
1481      <row>
1482        <entry namest="c1">1</entry>
1483        <entry namest="c2">SAVE_TYPE</entry>
1484        <entry namest="c3">type</entry>
1485      </row>
1486      <row>
1487        <entry namest="c1">1</entry>
1488        <entry namest="c2">BOOL</entry>
1489        <entry namest="c3">shutdown</entry>
1490      </row>
1491      <row>
1492        <entry namest="c1">1</entry>
1493        <entry namest="c2">INTERACT_STYLE</entry>
1494        <entry namest="c3">interact-style</entry>
1495      </row>
1496      <row>
1497        <entry namest="c1">1</entry>
1498        <entry namest="c2">BOOL</entry>
1499        <entry namest="c3">fast</entry>
1500      </row>
1501      <row>
1502        <entry namest="c1">4</entry>
1503        <entry namest="c2"></entry>
1504        <entry namest="c3">unused</entry>
1505      </row>
1506
1507      <row>
1508        <entry spanname="messagename"><emphasis role="bold"><function>SaveYourselfRequest</function></emphasis></entry>
1509      </row>
1510      <row>
1511        <entry namest="c1">1</entry>
1512        <entry namest="c2">?</entry>
1513        <entry namest="c3">XSMP</entry>
1514      </row>
1515      <row>
1516        <entry namest="c1">1</entry>
1517        <entry namest="c2">4</entry>
1518        <entry namest="c3">opcode</entry>
1519      </row>
1520      <row>
1521        <entry namest="c1">2</entry>
1522        <entry namest="c2"></entry>
1523        <entry namest="c3">unused</entry>
1524      </row>
1525      <row>
1526        <entry namest="c1">4</entry>
1527        <entry namest="c2">1</entry>
1528        <entry namest="c3">length of remainning data in 8-byte units</entry>
1529      </row>
1530      <row>
1531        <entry namest="c1">1</entry>
1532        <entry namest="c2">SAVE_TYPE</entry>
1533        <entry namest="c3">type</entry>
1534      </row>
1535      <row>
1536        <entry namest="c1">1</entry>
1537        <entry namest="c2">BOOL</entry>
1538        <entry namest="c3">shutdown</entry>
1539      </row>
1540      <row>
1541        <entry namest="c1">1</entry>
1542        <entry namest="c2">INTERACT_STYLE</entry>
1543        <entry namest="c3">interact-style</entry>
1544      </row>
1545      <row>
1546        <entry namest="c1">1</entry>
1547        <entry namest="c2">BOOL</entry>
1548        <entry namest="c3">fast</entry>
1549      </row>
1550      <row>
1551        <entry namest="c1">3</entry>
1552        <entry namest="c2"></entry>
1553        <entry namest="c3">unused</entry>
1554      </row>
1555
1556      <row>
1557        <entry spanname="messagename"><emphasis role="bold"><function>InteractRequest</function></emphasis></entry>
1558      </row>
1559      <row>
1560        <entry namest="c1">1</entry>
1561        <entry namest="c2">?</entry>
1562        <entry namest="c3">XSMP</entry>
1563      </row>
1564      <row>
1565        <entry namest="c1">1</entry>
1566        <entry namest="c2">5</entry>
1567        <entry namest="c3">opcode</entry>
1568      </row>
1569      <row>
1570        <entry namest="c1">1</entry>
1571        <entry namest="c2">DIALOG_TYPE</entry>
1572        <entry namest="c3">dialog type</entry>
1573      </row>
1574      <row>
1575        <entry namest="c1">1</entry>
1576        <entry namest="c2"></entry>
1577        <entry namest="c3">unused</entry>
1578      </row>
1579      <row>
1580        <entry namest="c1">4</entry>
1581        <entry namest="c2">0</entry>
1582        <entry namest="c3">length of remaining data in 8-byte units</entry>
1583      </row>
1584
1585      <row>
1586        <entry spanname="messagename"><emphasis role="bold"><function>Interact</function></emphasis></entry>
1587      </row>
1588      <row>
1589        <entry namest="c1">1</entry>
1590        <entry namest="c2">?</entry>
1591        <entry namest="c3">XSMP</entry>
1592      </row>
1593      <row>
1594        <entry namest="c1">1</entry>
1595        <entry namest="c2">6</entry>
1596        <entry namest="c3">opcode</entry>
1597      </row>
1598      <row>
1599        <entry namest="c1">2</entry>
1600        <entry namest="c2"></entry>
1601        <entry namest="c3">unused</entry>
1602      </row>
1603      <row>
1604        <entry namest="c1">4</entry>
1605        <entry namest="c2">0</entry>
1606        <entry namest="c3">length of remaining data in 8-byte units</entry>
1607      </row>
1608
1609      <row>
1610        <entry spanname="messagename"><emphasis role="bold"><function>InteractDone</function></emphasis></entry>
1611      </row>
1612      <row>
1613        <entry namest="c1">1</entry>
1614        <entry namest="c2">?</entry>
1615        <entry namest="c3">XSMP</entry>
1616      </row>
1617      <row>
1618        <entry namest="c1">1</entry>
1619        <entry namest="c2">7</entry>
1620        <entry namest="c3">opcode</entry>
1621      </row>
1622      <row>
1623        <entry namest="c1">1</entry>
1624        <entry namest="c2">BOOL</entry>
1625        <entry namest="c3">cancel-shutdown</entry>
1626      </row>
1627      <row>
1628        <entry namest="c1">1</entry>
1629        <entry namest="c2"></entry>
1630        <entry namest="c3">unused</entry>
1631      </row>
1632
1633      <row>
1634        <entry spanname="messagename"><emphasis role="bold"><function>InteractDone</function></emphasis></entry>
1635      </row>
1636      <row>
1637        <entry namest="c1">1</entry>
1638        <entry namest="c2">?</entry>
1639        <entry namest="c3">XSMP</entry>
1640      </row>
1641      <row>
1642        <entry namest="c1">1</entry>
1643        <entry namest="c2">7</entry>
1644        <entry namest="c3">opcode</entry>
1645      </row>
1646      <row>
1647        <entry namest="c1">1</entry>
1648        <entry namest="c2">BOOL</entry>
1649        <entry namest="c3">cancel-shutdown</entry>
1650      </row>
1651      <row>
1652        <entry namest="c1">1</entry>
1653        <entry namest="c2"></entry>
1654        <entry namest="c3">unused</entry>
1655      </row>
1656      <row>
1657        <entry namest="c1">4</entry>
1658        <entry namest="c2">0</entry>
1659        <entry namest="c3">length of remaining data in 8-byte units</entry>
1660      </row>
1661
1662      <row>
1663        <entry spanname="messagename"><emphasis role="bold"><function>SaveYourselfDone</function></emphasis></entry>
1664      </row>
1665      <row>
1666        <entry namest="c1">1</entry>
1667        <entry namest="c2">?</entry>
1668        <entry namest="c3">XSMP</entry>
1669      </row>
1670      <row>
1671        <entry namest="c1">1</entry>
1672        <entry namest="c2">8</entry>
1673        <entry namest="c3">opcode</entry>
1674      </row>
1675      <row>
1676        <entry namest="c1">1</entry>
1677        <entry namest="c2">BOOL</entry>
1678        <entry namest="c3">success</entry>
1679      </row>
1680      <row>
1681        <entry namest="c1">1</entry>
1682        <entry namest="c2"></entry>
1683        <entry namest="c3">unused</entry>
1684      </row>
1685      <row>
1686        <entry namest="c1">4</entry>
1687        <entry namest="c2">0</entry>
1688        <entry namest="c3">length of remaining data in 8-byte units</entry>
1689      </row>
1690
1691      <row>
1692        <entry spanname="messagename"><emphasis role="bold"><function>Die</function></emphasis></entry>
1693      </row>
1694      <row>
1695        <entry namest="c1">1</entry>
1696        <entry namest="c2">?</entry>
1697        <entry namest="c3">XSMP</entry>
1698      </row>
1699      <row>
1700        <entry namest="c1">1</entry>
1701        <entry namest="c2">9</entry>
1702        <entry namest="c3">opcode</entry>
1703      </row>
1704      <row>
1705        <entry namest="c1">1</entry>
1706        <entry namest="c2"></entry>
1707        <entry namest="c3">unused</entry>
1708      </row>
1709      <row>
1710        <entry namest="c1">4</entry>
1711        <entry namest="c2">0</entry>
1712        <entry namest="c3">length of remaining data in 8-byte units</entry>
1713      </row>
1714
1715      <row>
1716        <entry spanname="messagename"><emphasis role="bold"><function>ShutdownCancelled</function></emphasis></entry>
1717      </row>
1718      <row>
1719        <entry namest="c1">1</entry>
1720        <entry namest="c2">?</entry>
1721        <entry namest="c3">XSMP</entry>
1722      </row>
1723      <row>
1724        <entry namest="c1">1</entry>
1725        <entry namest="c2">10</entry>
1726        <entry namest="c3">opcode</entry>
1727      </row>
1728      <row>
1729        <entry namest="c1">2</entry>
1730        <entry namest="c2"></entry>
1731        <entry namest="c3">unused</entry>
1732      </row>
1733      <row>
1734        <entry namest="c1">4</entry>
1735        <entry namest="c2">0</entry>
1736        <entry namest="c3">length of remaining data in 8-byte units</entry>
1737      </row>
1738
1739      <row>
1740        <entry spanname="messagename"><emphasis role="bold"><function>ConnectionClosed</function></emphasis></entry>
1741      </row>
1742      <row>
1743        <entry namest="c1">1</entry>
1744        <entry namest="c2">?</entry>
1745        <entry namest="c3">XSMP</entry>
1746      </row>
1747      <row>
1748        <entry namest="c1">1</entry>
1749        <entry namest="c2">11</entry>
1750        <entry namest="c3">opcode</entry>
1751      </row>
1752      <row>
1753        <entry namest="c1">2</entry>
1754        <entry namest="c2"></entry>
1755        <entry namest="c3">unused</entry>
1756      </row>
1757      <row>
1758        <entry namest="c1">4</entry>
1759        <entry namest="c2">a/8</entry>
1760        <entry namest="c3">length of remaining data in 8-byte units</entry>
1761      </row>
1762      <row>
1763        <entry namest="c1">a</entry>
1764        <entry namest="c2">LISTofARRAY8</entry>
1765        <entry namest="c3">reason</entry>
1766      </row>
1767
1768      <row>
1769        <entry spanname="messagename"><emphasis role="bold"><function>SetProperties</function></emphasis></entry>
1770      </row>
1771      <row>
1772        <entry namest="c1">1</entry>
1773        <entry namest="c2">?</entry>
1774        <entry namest="c3">XSMP</entry>
1775      </row>
1776      <row>
1777        <entry namest="c1">1</entry>
1778        <entry namest="c2">12</entry>
1779        <entry namest="c3">opcode</entry>
1780      </row>
1781      <row>
1782        <entry namest="c1">2</entry>
1783        <entry namest="c2"></entry>
1784        <entry namest="c3">unused</entry>
1785      </row>
1786      <row>
1787        <entry namest="c1">4</entry>
1788        <entry namest="c2">a/8</entry>
1789        <entry namest="c3">length of remaining data in 8-byte units</entry>
1790      </row>
1791      <row>
1792        <entry namest="c1">a</entry>
1793        <entry namest="c2">LISTofPROPERTY</entry>
1794        <entry namest="c3">properties</entry>
1795      </row>
1796
1797      <row>
1798        <entry spanname="messagename"><emphasis role="bold"><function>DeleteProperties</function></emphasis></entry>
1799      </row>
1800      <row>
1801        <entry namest="c1">1</entry>
1802        <entry namest="c2">?</entry>
1803        <entry namest="c3">XSMP</entry>
1804      </row>
1805      <row>
1806        <entry namest="c1">1</entry>
1807        <entry namest="c2">13</entry>
1808        <entry namest="c3">opcode</entry>
1809      </row>
1810      <row>
1811        <entry namest="c1">2</entry>
1812        <entry namest="c2"></entry>
1813        <entry namest="c3">unused</entry>
1814      </row>
1815      <row>
1816        <entry namest="c1">4</entry>
1817        <entry namest="c2">a/8</entry>
1818        <entry namest="c3">length of remaining data in 8-byte units</entry>
1819      </row>
1820      <row>
1821        <entry namest="c1">a</entry>
1822        <entry namest="c2">LISTofPROPERTY</entry>
1823        <entry namest="c3">properties</entry>
1824      </row>
1825
1826      <row>
1827        <entry spanname="messagename"><emphasis role="bold"><function>GetProperties</function></emphasis></entry>
1828      </row>
1829      <row>
1830        <entry namest="c1">1</entry>
1831        <entry namest="c2">?</entry>
1832        <entry namest="c3">XSMP</entry>
1833      </row>
1834      <row>
1835        <entry namest="c1">1</entry>
1836        <entry namest="c2">14</entry>
1837        <entry namest="c3">opcode</entry>
1838      </row>
1839      <row>
1840        <entry namest="c1">2</entry>
1841        <entry namest="c2"></entry>
1842        <entry namest="c3">unused</entry>
1843      </row>
1844      <row>
1845        <entry namest="c1">4</entry>
1846        <entry namest="c2">0</entry>
1847        <entry namest="c3">length of remaining data in 8-byte units</entry>
1848      </row>
1849
1850      <row>
1851        <entry spanname="messagename"><emphasis role="bold"><function>GetPropertiesReply</function></emphasis></entry>
1852      </row>
1853      <row>
1854        <entry namest="c1">1</entry>
1855        <entry namest="c2">?</entry>
1856        <entry namest="c3">XSMP</entry>
1857      </row>
1858      <row>
1859        <entry namest="c1">1</entry>
1860        <entry namest="c2">15</entry>
1861        <entry namest="c3">opcode</entry>
1862      </row>
1863      <row>
1864        <entry namest="c1">2</entry>
1865        <entry namest="c2"></entry>
1866        <entry namest="c3">unused</entry>
1867      </row>
1868      <row>
1869        <entry namest="c1">4</entry>
1870        <entry namest="c2">a/8</entry>
1871        <entry namest="c3">length of remaining data in 8-byte units</entry>
1872      </row>
1873      <row>
1874        <entry namest="c1">a</entry>
1875        <entry namest="c2">LISTofPROPERTY</entry>
1876        <entry namest="c3">properties</entry>
1877      </row>
1878
1879      <row>
1880        <entry spanname="messagename"><emphasis role="bold"><function>SaveYourselfPhase2Request</function></emphasis></entry>
1881      </row>
1882      <row>
1883        <entry namest="c1">1</entry>
1884        <entry namest="c2">?</entry>
1885        <entry namest="c3">XSMP</entry>
1886      </row>
1887      <row>
1888        <entry namest="c1">1</entry>
1889        <entry namest="c2">16</entry>
1890        <entry namest="c3">opcode</entry>
1891      </row>
1892      <row>
1893        <entry namest="c1">2</entry>
1894        <entry namest="c2"></entry>
1895        <entry namest="c3">unused</entry>
1896      </row>
1897      <row>
1898        <entry namest="c1">4</entry>
1899        <entry namest="c2">0</entry>
1900        <entry namest="c3">length of remaining data in 8-byte units</entry>
1901      </row>
1902
1903      <row>
1904        <entry spanname="messagename"><emphasis role="bold"><function>SaveYourselfPhase2</function></emphasis></entry>
1905      </row>
1906      <row>
1907        <entry namest="c1">1</entry>
1908        <entry namest="c2">?</entry>
1909        <entry namest="c3">XSMP</entry>
1910      </row>
1911      <row>
1912        <entry namest="c1">1</entry>
1913        <entry namest="c2">17</entry>
1914        <entry namest="c3">opcode</entry>
1915      </row>
1916      <row>
1917        <entry namest="c1">2</entry>
1918        <entry namest="c2"></entry>
1919        <entry namest="c3">unused</entry>
1920      </row>
1921      <row>
1922        <entry namest="c1">4</entry>
1923        <entry namest="c2">0</entry>
1924        <entry namest="c3">length of remaining data in 8-byte units</entry>
1925      </row>
1926
1927      <row>
1928        <entry spanname="messagename"><emphasis role="bold"><function>SaveComplete</function></emphasis></entry>
1929      </row>
1930      <row>
1931        <entry namest="c1">1</entry>
1932        <entry namest="c2">?</entry>
1933        <entry namest="c3">XSMP</entry>
1934      </row>
1935      <row>
1936        <entry namest="c1">1</entry>
1937        <entry namest="c2">18</entry>
1938        <entry namest="c3">opcode</entry>
1939      </row>
1940      <row>
1941        <entry namest="c1">2</entry>
1942        <entry namest="c2"></entry>
1943        <entry namest="c3">unused</entry>
1944      </row>
1945      <row>
1946        <entry namest="c1">4</entry>
1947        <entry namest="c2">0</entry>
1948        <entry namest="c3">length of remaining data in 8-byte units</entry>
1949      </row>
1950     </tbody>
1951  </tgroup>
1952</informaltable>
1953
1954  </sect1>
1955</chapter>
1956
1957<chapter id='predefined_properties'>
1958  <title>Predefined Properties</title>
1959  <para>
1960All property values are stored in a LISTofARRAY8.  If the type of the
1961property is CARD8, the value is stored as a LISTofARRAY8 with one
1962ARRAY8 that is one byte long.  That single byte contains the CARD8.
1963If the type of the property is ARRAY8, the value is stored in the
1964first element of a single element LISTofARRAY8.
1965  </para>
1966
1967  <para>
1968The required properties must be set each time a client connects with
1969the SM.  The properties must be set after the client
1970sends <function>RegisterClient</function> and before the client
1971sends <function>SaveYourselfDone</function> Otherwise, the behavior of
1972the session manager is not defined.
1973  </para>
1974
1975  <para>
1976Clients may set, get, and delete nonstandard properties.  The lifetime
1977of stored properties does not extend into subsequent sessions.
1978  </para>
1979
1980<informaltable pgwide='0' frame='none'>
1981  <tgroup cols='4'>
1982    <colspec colname='c1' align='left'  />
1983    <colspec colname='c2' align='left'  />
1984    <colspec colname='c3' align='left'  />
1985    <colspec colname='c4' align='center'/>
1986    <thead>
1987      <row>
1988        <entry>Name</entry>
1989        <entry>Type</entry>
1990        <entry>Posix Type</entry>
1991        <entry>Required?</entry>
1992      </row>
1993    </thead>
1994    <tbody>
1995      <row>
1996        <entry>CloneCommand</entry>
1997        <entry>OS-specific</entry>
1998        <entry>LISTofARRAY8</entry>
1999        <entry>Yes</entry>
2000      </row>
2001      <row>
2002        <entry>CurrentDirectory</entry>
2003        <entry>OS-specific</entry>
2004        <entry>ARRAY8</entry>
2005        <entry>No</entry>
2006      </row>
2007      <row>
2008        <entry>DiscardCommand</entry>
2009        <entry>OS-specific</entry>
2010        <entry>LISTofARRAY8</entry>
2011        <entry>No*</entry>
2012      </row>
2013      <row>
2014        <entry>Environment</entry>
2015        <entry>OS-specific</entry>
2016        <entry>LISTofARRAY8</entry>
2017        <entry>No</entry>
2018      </row>
2019      <row>
2020        <entry>ProcessID</entry>
2021        <entry>OS-specific</entry>
2022        <entry>ARRAY8</entry>
2023        <entry>No</entry>
2024      </row>
2025      <row>
2026        <entry>Program</entry>
2027        <entry>OS-specific</entry>
2028        <entry>ARRAY8</entry>
2029        <entry>Yes</entry>
2030      </row>
2031      <row>
2032        <entry>RestartCommand</entry>
2033        <entry>OS-specific</entry>
2034        <entry>LISTofARRAY8</entry>
2035        <entry>Yes</entry>
2036      </row>
2037      <row>
2038        <entry>ResignCommand</entry>
2039        <entry>OS-specific</entry>
2040        <entry>LISTofARRAY8</entry>
2041        <entry>No</entry>
2042      </row>
2043      <row>
2044        <entry>RestartStyleHint</entry>
2045        <entry>CARD8</entry>
2046        <entry>CARD8</entry>
2047        <entry>No</entry>
2048      </row>
2049      <row>
2050        <entry>ShutdownCommand</entry>
2051        <entry>OS-specific</entry>
2052        <entry>LISTofARRAY8</entry>
2053        <entry>No</entry>
2054      </row>
2055      <row>
2056        <entry>UserID</entry>
2057        <entry>ARRAY8</entry>
2058        <entry>ARRAY8</entry>
2059        <entry>Yes</entry>
2060      </row>
2061    </tbody>
2062  </tgroup>
2063</informaltable>
2064
2065  <para>
2066* Required if any state is stored in an external repository (e.g., state file).
2067  </para>
2068
2069  <variablelist remap='IP'>
2070    <varlistentry>
2071      <term>CloneCommand</term>
2072      <listitem> <para>
2073This is like the <function>RestartCommand</function> except it
2074restarts a copy of the application.  The only difference is that the
2075application doesn't supply its client id at register time.  On <acronym>POSIX</acronym>
2076systems the type should be a LISTofARRAY8.
2077      </para></listitem>
2078    </varlistentry>
2079    <varlistentry>
2080      <term>CurrentDirectory</term>
2081      <listitem><para>
2082On <acronym>POSIX</acronym>-based systems specifies the value of the current directory that
2083needs to be set up prior to starting the program and should be of type ARRAY8.
2084      </para></listitem>
2085    </varlistentry>
2086    <varlistentry>
2087      <term>DiscardCommand</term>
2088      <listitem><para>
2089The discard command contains a command that when delivered to the host
2090that the client is running on (determined from the connection), will
2091cause it to discard any information about the current state.  If this
2092command is not specified, the SM will assume that all of the client's
2093state is encoded in the <function>Restart&shy;Command</function> On
2094<acronym>POSIX</acronym> systems the type should be LISTofARRAY8.
2095      </para></listitem>
2096    </varlistentry>
2097    <varlistentry>
2098      <term>Environment</term>
2099      <listitem><para>
2100On <acronym>POSIX</acronym> based systems, this will be of type LISTofARRAY8 where the
2101ARRAY8s alternate between environment variable name and environment
2102variable value.
2103      </para></listitem>
2104    </varlistentry>
2105    <varlistentry>
2106      <term>ProcessID</term>
2107      <listitem><para>
2108This specifies an OS-specific identifier for the process.  On <acronym>POSIX</acronym>
2109systems this should of type ARRAY8 and contain the return value of
2110getpid() turned into a Latin-1 (decimal) string.
2111      </para></listitem>
2112    </varlistentry>
2113    <varlistentry>
2114      <term>Program</term>
2115      <listitem><para>
2116The name of the program that is running.  On <acronym>POSIX</acronym> systems this should
2117be the first parameter passed to execve and should be of type ARRAY8.
2118      </para></listitem>
2119    </varlistentry>
2120    <varlistentry>
2121      <term>RestartCommand</term>
2122      <listitem><para>
2123The restart command contains a command that when delivered to the host
2124that the client is running on (determined from the connection), will
2125cause the client to restart in its current state.  On <acronym>POSIX</acronym>-based
2126systems this is of type LISTofARRAY8 and each of the elements in the
2127array represents an element in the argv array.  This restart command
2128should ensure that the client restarts with the specified
2129client-ID.
2130      </para></listitem>
2131    </varlistentry>
2132    <varlistentry>
2133      <term>ResignCommand</term>
2134      <listitem>
2135	<para>
2136A client that sets the <function>RestartStyleHint</function>
2137to <function>RestartAnyway</function> uses this property to specify a
2138command that undoes the effect of the client and removes any saved
2139state.
2140	</para>
2141	<note><title>Example</title><para>
2142A user runs xmodmap.  xmodmap registers with the SM,
2143sets <function>Restart&shy;Style&shy;Hint</function>
2144to <function>Restart&shy;Anyway</function> and then terminates.  In
2145order to allow the SM (at the user's request) to undo this, xmodmap
2146would register a <function>Resign&shy;Command</function> that undoes
2147the effects of the xmodmap.
2148	</para></note>
2149      </listitem>
2150    </varlistentry>
2151    <varlistentry>
2152      <term>RestartStyleHint</term>
2153      <listitem>
2154	<para>
2155If the RestartStyleHint property is present, it will contain the style
2156of restarting the client prefers.  If this flag isn't
2157specified, <function>RestartIfRunning</function> is assumed.  The
2158possible values are as follows:
2159	</para>
2160
2161<informaltable pgwide='0' frame='none'>
2162  <tgroup cols='2'>
2163    <colspec colname='c1' align='left'/>
2164    <colspec colname='c2' align='right'/>
2165    <thead>
2166      <row>
2167        <entry namest="c1">Name</entry>
2168        <entry namest="c2">Value</entry>
2169      </row>
2170    </thead>
2171    <tbody>
2172      <row>
2173        <entry namest="c1">RestartIfRunning</entry>
2174        <entry namest="c2">0</entry>
2175      </row>
2176      <row>
2177        <entry namest="c1">RestartAnyway</entry>
2178        <entry namest="c2">1</entry>
2179      </row>
2180      <row>
2181        <entry namest="c1">RestartImmediately</entry>
2182        <entry namest="c2">2</entry>
2183      </row>
2184      <row>
2185        <entry namest="c1">RestartNever</entry>
2186        <entry namest="c2">3</entry>
2187      </row>
2188    </tbody>
2189  </tgroup>
2190</informaltable>
2191
2192	<para>
2193The <function>RestartIfRunning</function> style is used in the usual
2194case.  The client should be restarted in the next session if it is
2195connected to the session manager at the end of the current session.
2196	</para>
2197
2198	<para>
2199The <function>RestartAnyway</function> style is used to tell the SM
2200that the application should be restarted in the next session even if
2201it exits before the current session is terminated.  It should be noted
2202that this is only a hint and the SM will follow the policies specified
2203by its users in determining what applications to restart.
2204	</para>
2205
2206	<note><title>Rationale</title><para>
2207This can be specified by a client which supports (as MS-Windows
2208clients do) a means for the user to indicate while exiting that
2209restarting is desired.  It can also be used for clients that spawn
2210other clients and then go away, but which want to be restarted.
2211	</para></note>
2212
2213	<para>
2214A client that uses <function>RestartAnyway</function> should also set
2215the <function>ResignCommand</function> and <function>ShutdownCommand</function>
2216properties to commands that undo the state of the client after it exits.
2217	</para>
2218
2219	<para>
2220The <function>RestartImmediately</function> style is
2221like <function>RestartAnyway</function> but in addition, the client is
2222meant to run continuously.  If the client exits, the SM should try to
2223restart it in the current session.
2224	</para>
2225
2226	<note><title>Advice to Implementors</title><para>
2227It would be wise to sanity-check the frequency which
2228which <function>RestartImmediately</function> clients are restarted,
2229to avoid a sick client being restarted continuously.
2230	</para></note>
2231
2232	<para>
2233The <function>RestartNever</function> style specifies that the client
2234does not wish to be restarted in the next session.
2235	</para>
2236
2237	<note><title>Advice to Implementors</title> <para>
2238This should be used rarely, if at all.  It will cause the client to be
2239silently left out of sessions when they are restarted and will
2240probably be confusing to users.
2241	</para></note> <!-- remap='NE' -->
2242	<!-- .RE -->
2243      </listitem>
2244    </varlistentry>
2245    <varlistentry>
2246      <term>ShutdownCommand</term>
2247      <listitem>
2248	<para>
2249This command is executed at shutdown time to clean up after a client
2250that is no longer running but retained its state by
2251setting <function>RestartStyleHint</function>
2252to <function>RestartAnyway</function> The command must not remove any
2253saved state as the client is still part of the session.
2254	</para>
2255	<note><title>Example</title><para>
2256A client is run at start up time that turns on a camera.  This client
2257then exits.  At session shutdown, the user wants the camera turned
2258off.  This client would set the <function>Restart&shy;Style&shy;Hint</function>
2259to <function>Restart&shy;Anyway</function> and would register a
2260<function>Shutdown&shy;Command</function> that would turn off the camera.
2261	</para></note>
2262      </listitem>
2263    </varlistentry>
2264    <varlistentry>
2265      <term>UserID</term>
2266    <listitem><para>
2267Specifies the user's ID.  On <acronym>POSIX</acronym>-based systems
2268this will contain the the user's name (the <structfield>pw_name</structfield>
2269field of <structname>struct passwd</structname>).
2270    </para></listitem>
2271    </varlistentry>
2272  </variablelist>
2273</chapter>
2274</book>
2275