1555991fdSmrg<?xml version="1.0" encoding="UTF-8" ?> 23c15da26Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 33c15da26Smrg "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 43c15da26Smrg[ 53c15da26Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs; 63c15da26Smrg]> 7555991fdSmrg 8555991fdSmrg 9555991fdSmrg<!-- lifted from troff+ms+XMan by doclifter --> 103c15da26Smrg<book id="SMlib"> 11555991fdSmrg 12555991fdSmrg<bookinfo> 13555991fdSmrg <title>X Session Management Library</title> 14555991fdSmrg <subtitle>X Consortium Standard</subtitle> 153c15da26Smrg <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 16555991fdSmrg <authorgroup> 17555991fdSmrg <author> 18555991fdSmrg <firstname>Ralph</firstname><surname>Mor</surname> 193c15da26Smrg <affiliation><orgname>X Consortium</orgname></affiliation> 20555991fdSmrg </author> 21555991fdSmrg </authorgroup> 22555991fdSmrg <copyright> 23555991fdSmrg <year>1993</year><year>1994</year> 24555991fdSmrg <holder>X Consortium</holder> 25555991fdSmrg </copyright> 26555991fdSmrg <releaseinfo>Version 1.0</releaseinfo> 27555991fdSmrg 28555991fdSmrg <legalnotice> 29555991fdSmrg <para> 30555991fdSmrgPermission is hereby granted, free of charge, to any person obtaining 31555991fdSmrga copy of this software and associated documentation files (the 32555991fdSmrg“Software”), to deal in the Software without restriction, 33555991fdSmrgincluding without limitation the rights to use, copy, modify, merge, 34555991fdSmrgpublish, distribute, sublicense, and/or sell copies of the Software, 35555991fdSmrgand to permit persons to whom the Software is furnished to do so, 36555991fdSmrgsubject to the following conditions: 37555991fdSmrg </para> 38555991fdSmrg 39555991fdSmrg <para> 40555991fdSmrgThe above copyright notice and this permission notice shall be 41555991fdSmrgincluded in all copies or substantial portions of the Software. 42555991fdSmrg </para> 43555991fdSmrg 44555991fdSmrg <para> 45555991fdSmrgTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF 46555991fdSmrgANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 47555991fdSmrgWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 48555991fdSmrgAND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR 49555991fdSmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 50555991fdSmrgCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 51555991fdSmrgWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 52555991fdSmrg </para> 53555991fdSmrg 54555991fdSmrg <para> 55555991fdSmrgExcept as contained in this notice, the name of the X Consortium shall 56555991fdSmrgnot be used in advertising or otherwise to promote the sale, use or 57555991fdSmrgother dealings in this Software without prior written authorization 58555991fdSmrgfrom the X Consortium. 59555991fdSmrg </para> 60555991fdSmrg 61555991fdSmrg <para> 62555991fdSmrgX Window System is a trademark of The Open Group. 63555991fdSmrg </para> 64555991fdSmrg </legalnotice> 65555991fdSmrg 66555991fdSmrg</bookinfo> 67555991fdSmrg 683c15da26Smrg<chapter id='Overview_of_Session_Management'> 69555991fdSmrg <title>Overview of Session Management</title> 70555991fdSmrg 71555991fdSmrg <abstract> 72555991fdSmrg <para> 73555991fdSmrgThe purpose of the X Session Management Protocol (<acronym>XSMP</acronym>) 74555991fdSmrgis to provide a uniform mechanism for users to save and restore their 75555991fdSmrgsessions. A <firstterm>session</firstterm> is a group of clients, 76555991fdSmrgeach of which has a particular state. The session is controlled by a 77555991fdSmrgnetwork service called the <firstterm>session manager</firstterm>. 78555991fdSmrgThe session manager issues commands to its clients on behalf of the 79555991fdSmrguser. These commands may cause clients to save their state or to 80555991fdSmrgterminate. It is expected that the client will save its state in such 81555991fdSmrga way that the client can be restarted at a later time and resume its 82555991fdSmrgoperation as if it had never been terminated. A client's state might 83555991fdSmrginclude information about the file currently being edited, the current 84555991fdSmrgposition of the insertion point within the file, or the start of an 85555991fdSmrguncommitted transaction. The means by which clients are restarted is 86555991fdSmrgunspecified by this protocol. 87555991fdSmrg </para> 88555991fdSmrg 89555991fdSmrg <para> 90555991fdSmrgFor purposes of this protocol, a <firstterm>client</firstterm> of the 91555991fdSmrgsession manager is defined as a connection to the session manager. A 92555991fdSmrgclient is typically, though not necessarily, a process running an 93555991fdSmrgapplication program connected to an X display. However, a client may 94555991fdSmrgbe connected to more than one X display or not be connected to any X 95555991fdSmrgdisplays at all. 96555991fdSmrg </para> 97555991fdSmrg </abstract> 98555991fdSmrg</chapter> 99555991fdSmrg 1003c15da26Smrg<chapter id='The_Session_Management_Library'> 101555991fdSmrg <title>The Session Management Library</title> 102555991fdSmrg <abstract> 103555991fdSmrg <para> 104555991fdSmrgThe Session Management Library (<abbrev>SMlib</abbrev>) is a low-level 105555991fdSmrg"C" language interface to XSMP. It is expected that higher level 106555991fdSmrgtoolkits, such as Xt, will hide many of the details of session 107555991fdSmrgmanagement from clients. Higher level toolkits might also be developed 108555991fdSmrgfor session managers to use, but no such effort is currently under way. 109555991fdSmrg </para> 110555991fdSmrg </abstract> 111555991fdSmrg 112555991fdSmrg <para> 113555991fdSmrg SMlib has two parts to it: 114555991fdSmrg <itemizedlist mark='bullet'> 115555991fdSmrg <listitem><para>One set of functions for clients that want to be part of a session</para></listitem> 116555991fdSmrg <listitem><para>One set of functions for session managers to call</para></listitem> 117555991fdSmrg </itemizedlist> 118555991fdSmrg </para> 119555991fdSmrg 120555991fdSmrg <para> 121555991fdSmrgSome applications will use both sets of functions and act as 122555991fdSmrg<firstterm>nested session managers</firstterm>. That is, they will be 123555991fdSmrgboth a session manager and a client of another session. An example is 124555991fdSmrga mail program that could start a text editor for editing the text of 125555991fdSmrga mail message. The mail program is part of a regular session and, at 126555991fdSmrgthe same time, is also acting as a session manager to the editor. 127555991fdSmrg </para> 128555991fdSmrg 129555991fdSmrg <para> 130555991fdSmrgClients initialize by connecting to the session manager and obtaining 131555991fdSmrga <firstterm>client-ID</firstterm> that uniquely identifies them in 132555991fdSmrgthe session. The session manager maintains a list of properties for 133555991fdSmrgeach client in the session. These properties describe the client's 134555991fdSmrgenvironment and, most importantly, describe how the client can be 135555991fdSmrgrestarted (via an <property>SmRestartCommand</property>). Clients are 136555991fdSmrgexpected to save their state in such a way as to allow multiple 137555991fdSmrginstantiations of themselves to be managed independently. For 138555991fdSmrgexample, clients may use their client-ID as part of a filename in 139555991fdSmrgwhich to store the state for a particular instantiation. The 140555991fdSmrgclient-ID should be saved as part of the <property>SmRestartCommand</property> 141555991fdSmrgso that the client will retain the same ID after it is restarted. 142555991fdSmrg </para> 143555991fdSmrg 144555991fdSmrg <para> 145555991fdSmrgOnce the client initializes itself with the session manager, it must 146555991fdSmrgbe ready to respond to messages from the session manager. For 147555991fdSmrgexample, it might be asked to save its state or to terminate. In the 148555991fdSmrgcase of a shutdown, the session manager might give each client a 149555991fdSmrgchance to interact with the user and cancel the shutdown. 150555991fdSmrg </para> 151555991fdSmrg</chapter> 152555991fdSmrg 1533c15da26Smrg<chapter id='Understanding_SMlibs_Dependence_on_ICE'> 154555991fdSmrg <title>Understanding SMlib's Dependence on ICE</title> 155555991fdSmrg 156555991fdSmrg <para> 157555991fdSmrgThe X Session Management Protocol is layered on top of the 158555991fdSmrgInter-Client Exchange (<acronym>ICE</acronym>) Protocol. The ICE 159555991fdSmrgprotocol is designed to multiplex several protocols over a single 160555991fdSmrgconnection. As a result, working with SMlib requires a little 161555991fdSmrgknowledge of how the ICE library works. 162555991fdSmrg </para> 163555991fdSmrg 164555991fdSmrg <para> 165555991fdSmrgThe ICE library utilizes callbacks to process messages. When a client 166555991fdSmrgdetects that there is data to read on an ICE connection, it should 1673c15da26Smrgcall the <olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> function. 1683c15da26Smrg<olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> will read the message header 169555991fdSmrgand look at the major opcode in order to determine which protocol the 170555991fdSmrgmessage was intended for. The appropriate protocol library will then 171555991fdSmrgbe triggered to unpack the message and hand it off to the client via a 172555991fdSmrgcallback. 173555991fdSmrg </para> 174555991fdSmrg 175555991fdSmrg <para> 176555991fdSmrgThe main point to be aware of is that an application using SMlib must 177555991fdSmrghave some code that detects when there is data to read on an ICE 178555991fdSmrgconnection. This can be done via a <function>select</function> call 179555991fdSmrgon the file descriptor for the ICE connection, but more 180555991fdSmrgtypically, <function>XtAppAddInput</function> will be used to register 1813c15da26Smrga callback that will invoke <olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> 182555991fdSmrgeach time there is data to read on the ICE connection. 183555991fdSmrg </para> 184555991fdSmrg 185555991fdSmrg <para> 186555991fdSmrgTo further complicate things, knowing which file descriptors to 187555991fdSmrgcall <function>select</function> on requires an understanding of how 188555991fdSmrgICE connections are created. On the client side, a call must be made 1893c15da26Smrgto <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> in order to open a connection 1903c15da26Smrgwith a session manager. <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> will 1913c15da26Smrginternally makea call into <olink targetdoc='ICElib' targetptr='IceOpenConnection'><function>IceOpenConnection</function></olink> 192555991fdSmrgwhich will, in turn, determine if an ICE connection already exists 193555991fdSmrgbetween the client and session manager. Most likely, a connection 194555991fdSmrgwill not already exist and a new ICE connection will be created. The 195555991fdSmrgmain point to be aware of is that, on the client side, it is not 196555991fdSmrgobvious when ICE connections get created or destroyed, because 197555991fdSmrgconnections are shared when possible. To deal with this, the ICE 198555991fdSmrglibrary lets the application register watch procedures that will be 199555991fdSmrginvoked each time an ICE connection is opened or closed. These watch 200555991fdSmrgprocedures could be used to add or remove ICE file descriptors from 201555991fdSmrgthe list of descriptors to call <function>select</function> on. 202555991fdSmrg </para> 203555991fdSmrg 204555991fdSmrg <para> 205555991fdSmrgOn the session manager side, things work a bit differently. The 206555991fdSmrgsession manager has complete control over the creation of ICE 207555991fdSmrgconnections. The session manager has to first 2083c15da26Smrgcall <olink targetdoc='ICElib' targetptr='IceListenForConnections'><function>IceListenForConnections</function></olink> in order to start 209555991fdSmrglistening for connections from clients. Once a connection attempt is 2103c15da26Smrgdetected, <olink targetdoc='ICElib' targetptr='IceAcceptConnection'><function>IceAcceptConnection</function></olink> must be called, and 211555991fdSmrgthe session manager can simply add the new ICE file descriptor to the 212555991fdSmrglist of descriptors to call <function>select</function> on. 213555991fdSmrg 214555991fdSmrg </para> 215555991fdSmrg 216555991fdSmrg <para> 217555991fdSmrgFor further information on the library functions related to ICE connections, 218555991fdSmrgsee the <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 219555991fdSmrgstandard. 220555991fdSmrg </para> 221555991fdSmrg</chapter> 222555991fdSmrg 2233c15da26Smrg<chapter id='Header_Files_and_Library_Name'> 224555991fdSmrg<title>Header Files and Library Name</title> 225555991fdSmrg 226555991fdSmrg <para> 227555991fdSmrgApplications (both session managers and clients) should include the 228555991fdSmrgheader file <<filename class='headerfile'>X11/SM/SMlib.h</filename>>. 229555991fdSmrgThis header file defines all of the SMlib data structures and function 230555991fdSmrgprototypes. <filename class='headerfile'>SMlib.h</filename> includes the 231555991fdSmrgheader file <<filename class='headerfile'>X11/SM/SM.h</filename>>, 232555991fdSmrgwhich defines all of the SMlib constants. 233555991fdSmrg </para> 234555991fdSmrg 235555991fdSmrg <para> 236555991fdSmrgBecause SMlib is dependent on ICE, applications should link against 237555991fdSmrgSMlib and ICElib by using 238555991fdSmrg<quote><option>-lSM</option> <option>-lICE</option></quote>. 239555991fdSmrg </para> 240555991fdSmrg</chapter> 241555991fdSmrg 2423c15da26Smrg<chapter id='Session_Management_Client_Smc_Functions'> 243555991fdSmrg <title>Session Management Client (<acronym>Smc</acronym>) Functions</title> 244555991fdSmrg 245555991fdSmrg <para> 246555991fdSmrg This section discusses how Session Management clients: 247555991fdSmrg <itemizedlist mark='bullet'> 248555991fdSmrg <listitem><para>Connect to the Session Manager</para></listitem> 249555991fdSmrg <listitem><para>Close the connection</para></listitem> 250555991fdSmrg <listitem><para>Modify callbacks</para></listitem> 251555991fdSmrg <listitem><para>Set, delete, and retrieve Session Manager properties</para></listitem> 252555991fdSmrg <listitem><para>Interact with the user</para></listitem> 253555991fdSmrg <listitem><para>Request a “Save Yourself”</para></listitem> 254555991fdSmrg <listitem><para>Request a “Save Yourself Phase 2”</para></listitem> 255555991fdSmrg <listitem><para>Complete a “Save Yourself”</para></listitem> 256555991fdSmrg <listitem><para>Use Smc informational functions</para></listitem> 257555991fdSmrg <listitem><para>Handle Errors</para></listitem> 258555991fdSmrg </itemizedlist> 259555991fdSmrg </para> 260555991fdSmrg 2613c15da26Smrg <sect1 id='Connecting_to_the_Session_Manager'> 2623c15da26Smrg<title>Connecting to the Session Manager</title> 263555991fdSmrg 264555991fdSmrg <para> 265555991fdSmrgTo open a connection with a session manager, 2663c15da26Smrguse <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> 267555991fdSmrg </para> 268555991fdSmrg 2693c15da26Smrg <funcsynopsis id='SmcOpenConnection'> 270555991fdSmrg <funcprototype> 271555991fdSmrg <funcdef>SmcConn <function>SmcOpenConnection</function></funcdef> 272555991fdSmrg <paramdef>char *<parameter>network_ids_list</parameter></paramdef> 273555991fdSmrg <paramdef>SmPointer <parameter>context</parameter></paramdef> 274555991fdSmrg <paramdef>int <parameter>xsmp_major_rev</parameter></paramdef> 275555991fdSmrg <paramdef>int <parameter>xsmp_minor_rev</parameter></paramdef> 276555991fdSmrg <paramdef>unsigned long <parameter>mask</parameter></paramdef> 277555991fdSmrg <paramdef>SmcCallbacks *<parameter>callbacks</parameter></paramdef> 278555991fdSmrg <paramdef>char *<parameter>previous_id</parameter></paramdef> 279555991fdSmrg <paramdef>char **<parameter>client_id_ret</parameter></paramdef> 280555991fdSmrg <paramdef>int <parameter>error_length</parameter></paramdef> 281555991fdSmrg <paramdef>char *<parameter>error_string_ret</parameter></paramdef> 282555991fdSmrg </funcprototype> 283555991fdSmrg </funcsynopsis> 284555991fdSmrg 285555991fdSmrg <variablelist remap='IP'> 286555991fdSmrg <varlistentry> 287555991fdSmrg <term><parameter>network_ids_list</parameter></term> 288555991fdSmrg <listitem><para>Specifies the network ID(s) of the session manager.</para></listitem> 289555991fdSmrg </varlistentry> 290555991fdSmrg <varlistentry> 291555991fdSmrg <term><parameter>context</parameter></term> 292555991fdSmrg <listitem><para> 293555991fdSmrgA pointer to an opaque object or <constant>NULL</constant>. Used to determine 294555991fdSmrgif an ICE connection can be shared 295555991fdSmrg(see <link linkend='context_sharing'>below</link>). 296555991fdSmrg </para></listitem> 297555991fdSmrg </varlistentry> 298555991fdSmrg <varlistentry> 299555991fdSmrg <term><parameter>xsmp_major_rev</parameter></term> 300555991fdSmrg <listitem><para> 301555991fdSmrgThe highest major version of the XSMP the application supports. 302555991fdSmrg </para></listitem> 303555991fdSmrg </varlistentry> 304555991fdSmrg <varlistentry> 305555991fdSmrg <term><parameter>xsmp_minor_rev</parameter></term> 306555991fdSmrg <listitem><para> 307555991fdSmrgThe highest minor version of the XSMP the application supports (for 308555991fdSmrgthe specified <parameter>xsmp_major_rev</parameter>). 309555991fdSmrg </para></listitem> 310555991fdSmrg </varlistentry> 311555991fdSmrg <varlistentry> 312555991fdSmrg <term><parameter>mask</parameter></term> 313555991fdSmrg <listitem><para>A mask indicating which callbacks to register.</para></listitem> 314555991fdSmrg </varlistentry> 315555991fdSmrg <varlistentry> 316555991fdSmrg <term><parameter>callbacks</parameter></term> 317555991fdSmrg <listitem><para> 318555991fdSmrgThe callbacks to register. These callbacks are used to respond to 319555991fdSmrgmessages from the session manager. 320555991fdSmrg </para></listitem> 321555991fdSmrg </varlistentry> 322555991fdSmrg <varlistentry> 323555991fdSmrg <term><parameter>previous_id</parameter></term> 324555991fdSmrg <listitem><para>The client ID from the previous session.</para></listitem> 325555991fdSmrg </varlistentry> 326555991fdSmrg <varlistentry> 327555991fdSmrg <term><parameter>client_id_ret</parameter></term> 328555991fdSmrg <listitem><para>The client ID for the current session is returned.</para></listitem> 329555991fdSmrg </varlistentry> 330555991fdSmrg <varlistentry> 331555991fdSmrg <term><parameter>error_length</parameter></term> 332555991fdSmrg <listitem><para>Length of the <parameter>error_string_ret</parameter> argument passed in.</para></listitem> 333555991fdSmrg </varlistentry> 334555991fdSmrg <varlistentry> 335555991fdSmrg <term><parameter>error_string_ret</parameter></term> 336555991fdSmrg <listitem><para> 337555991fdSmrgReturns a null-terminated error message, if any. 338555991fdSmrgThe <parameter>error_string_ret</parameter> argument points to user supplied 339555991fdSmrgmemory. No more than <parameter>error_length</parameter> bytes are used. 340555991fdSmrg </para></listitem> 341555991fdSmrg </varlistentry> 342555991fdSmrg </variablelist> 343555991fdSmrg 344555991fdSmrg <para> 345555991fdSmrgThe <parameter>network_ids_list</parameter> argument is a 346555991fdSmrgnull-terminated string containing a list of network IDs for the session 347555991fdSmrgmanager, separated by commas. If <parameter>network_ids_list</parameter> 348555991fdSmrgis <constant>NULL</constant>, the value of 349555991fdSmrgthe <envar>SESSION_MANAGER</envar> environment variable will be used. 350555991fdSmrgEach network ID has the following format: 351555991fdSmrg 3523c15da26Smrg<informaltable frame='none'> 3533c15da26Smrg <?dbfo keep-together="always" ?> 3543c15da26Smrg <tgroup cols='2' align='left' colsep='0' rowsep='0'> 3553c15da26Smrg <colspec colname='c1' colwidth='1.0*'/> 3563c15da26Smrg <colspec colname='c2' colwidth='1.5*'/> 357555991fdSmrg <tbody> 358555991fdSmrg <row> 3593c15da26Smrg <entry><literal>tcp/</literal><parameter><hostname></parameter><literal>:</literal><parameter><portnumber></parameter></entry> 3603c15da26Smrg <entry>or</entry> 361555991fdSmrg </row> 362555991fdSmrg <row> 3633c15da26Smrg <entry><literal>decnet/</literal><parameter><hostname></parameter><literal>::</literal><parameter><objname></parameter></entry> 3643c15da26Smrg <entry>or</entry> 365555991fdSmrg </row> 366555991fdSmrg <row> 3673c15da26Smrg <entry><literal>local/</literal><parameter><hostname></parameter><literal>:</literal><parameter><path></parameter></entry> 3683c15da26Smrg <entry></entry> 369555991fdSmrg </row> 370555991fdSmrg </tbody> 371555991fdSmrg </tgroup> 372555991fdSmrg</informaltable> 373555991fdSmrg </para> 374555991fdSmrg 375555991fdSmrg <para> 376555991fdSmrgAn attempt will be made to use the first network ID. If that fails, 377555991fdSmrgan attempt will be made using the second network ID, and so on. 378555991fdSmrg </para> 379555991fdSmrg 380555991fdSmrg <para> 3813c15da26SmrgAfter the connection is established, <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> 382555991fdSmrgregisters the client with the session manager. If the client is being 383555991fdSmrgrestarted from a previous session, <parameter>previous_id</parameter> 384555991fdSmrgshould contain a null terminated string representing the client ID from the 385555991fdSmrgprevious session. If the client is first joining the session, 386555991fdSmrg<parameter>previous_id</parameter> should be set to <constant>NULL</constant>. 387555991fdSmrgIf <parameter>previous_id</parameter> is specified but is determined 388555991fdSmrgto be invalid by the session manager, SMlib will re-register the 389555991fdSmrgclient with <parameter>previous_id</parameter> set to <constant>NULL</constant>. 390555991fdSmrg </para> 391555991fdSmrg 392555991fdSmrg <para> 3933c15da26SmrgIf <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> succeeds, it returns an 394555991fdSmrgopaque connection pointer of type <function>SmcConn</function> and the 395555991fdSmrg<parameter>client_id_ret</parameter> argument contains the client ID to be 396555991fdSmrgused for this session. The <parameter>client_id_ret</parameter> should be 397555991fdSmrgfreed with a call to <function>free</function> when no longer needed. On 3983c15da26Smrgfailure, <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> returns 399555991fdSmrg<constant>NULL</constant>, and the reason for failure is returned in 400555991fdSmrg<parameter>error_string_ret</parameter>. 401555991fdSmrg </para> 402555991fdSmrg 403555991fdSmrg <para> 404555991fdSmrgNote that SMlib uses the ICE protocol to establish a connection with 405555991fdSmrgthe session manager. If an ICE connection already exists between the 406555991fdSmrgclient and session manager, it might be possible for the same ICE 407555991fdSmrgconnection to be used for session management. 408555991fdSmrg </para> 409555991fdSmrg 410555991fdSmrg <para id='context_sharing'> 411555991fdSmrgThe context argument indicates how willing the client is to share the 412555991fdSmrgICE connection with other protocols. If context is <constant>NULL</constant>, 413555991fdSmrgthen the caller is always willing to share the connection. If context is not 414555991fdSmrg<constant>NULL</constant>, then the caller is not willing to use a previously 415555991fdSmrgopened ICE connection that has a different non-<constant>NULL</constant> 416555991fdSmrgcontext associated with it. 417555991fdSmrg </para> 418555991fdSmrg 419555991fdSmrg <para> 420555991fdSmrgAs previously discussed 4213c15da26Smrg(<link linkend='Understanding_SMlibs_Dependence_on_ICE'>section 3, 422555991fdSmrg“Understanding SMlib's Dependence on ICE”</link>), the 423555991fdSmrgclient will have to keep track of when ICE connections are created or 4243c15da26Smrgdestroyed (using <olink targetdoc='ICElib' targetptr='IceAddConnectionWatch'><function>IceAddConnectionWatch</function></olink> 4253c15da26Smrgand <olink targetdoc='ICElib' targetptr='IceRemoveConnectionWatch'><function>IceRemoveConnectionWatch</function></olink> and will have to 4263c15da26Smrgcall <olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> each time 427555991fdSmrga <function>select</function> shows that there is data to read on an 428555991fdSmrgICE connection. For further information, see the 429555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 430555991fdSmrgstandard. 431555991fdSmrg </para> 432555991fdSmrg 433555991fdSmrg <para> 434555991fdSmrgThe callbacks argument contains a set of callbacks used to respond to 435555991fdSmrgsession manager events. The mask argument specifies which callbacks 436555991fdSmrgare set. All of the callbacks specified in this version of SMlib are 437555991fdSmrgmandatory. The mask argument is necessary in order to maintain 438555991fdSmrgbackwards compatibility in future versions of the library. 439555991fdSmrg </para> 440555991fdSmrg 441555991fdSmrg <para> 442555991fdSmrgThe following values may be ORed together to obtain a 443555991fdSmrg<parameter>mask</parameter> value: 444555991fdSmrg 445555991fdSmrg <simplelist type='vert'> 446555991fdSmrg <member><constant>SmcSaveYourselfProcMask</constant></member> 447555991fdSmrg <member><constant>SmcDieProcMask</constant></member> 448555991fdSmrg <member><constant>SmcSaveCompleteProcMask</constant></member> 449555991fdSmrg <member><constant>SmcShutdownCancelledProcMask</constant></member> 450555991fdSmrg </simplelist> 451555991fdSmrg </para> 452555991fdSmrg 453555991fdSmrg <para> 454555991fdSmrgFor each callback, the client can register a pointer to client data. 455555991fdSmrgWhen SMlib invokes the callback, it will pass the client data pointer. 456555991fdSmrg </para> 457555991fdSmrg 458555991fdSmrg<!-- .ne 4 IGNORED --> 459555991fdSmrg 460555991fdSmrg<synopsis> 461555991fdSmrgtypedef struct { 462555991fdSmrg 463555991fdSmrg struct { 464555991fdSmrg SmcSaveYourselfProc callback; 465555991fdSmrg SmPointer client_data; 466555991fdSmrg } save_yourself; 467555991fdSmrg 468555991fdSmrg struct { 469555991fdSmrg SmcDieProc callback; 470555991fdSmrg SmPointer client_data; 471555991fdSmrg } die; 472555991fdSmrg 473555991fdSmrg struct { 474555991fdSmrg SmcSaveCompleteProc callback; 475555991fdSmrg SmPointer client_data; 476555991fdSmrg } save_complete; 477555991fdSmrg 478555991fdSmrg struct { 479555991fdSmrg SmcShutdownCancelledProc callback; 480555991fdSmrg SmPointer client_data; 481555991fdSmrg } shutdown_cancelled; 482555991fdSmrg 483555991fdSmrg} SmcCallbacks; 484555991fdSmrg</synopsis> 485555991fdSmrg 4863c15da26Smrg <sect2 id='The_Save_Yourself_Callback'> 4873c15da26Smrg<title>The Save Yourself Callback</title> 488555991fdSmrg 489555991fdSmrg <para> 490555991fdSmrgThe Save Yourself callback is of type <function>SmcSaveYourselfProc</function> 491555991fdSmrg </para> 492555991fdSmrg 4933c15da26Smrg<funcsynopsis id='SaveYourselfProc'> 494555991fdSmrg<funcprototype> 495555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfProc</function>)</funcdef> 496555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 497300346aeSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 498555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 499555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 500555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 501555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 502555991fdSmrg</funcprototype> 503555991fdSmrg</funcsynopsis> 504555991fdSmrg 505555991fdSmrg<variablelist remap='IP'> 506555991fdSmrg <varlistentry> 507555991fdSmrg <term><parameter>smc_conn</parameter></term> 508555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 509555991fdSmrg </varlistentry> 510555991fdSmrg <varlistentry> 511555991fdSmrg <term><parameter>client_data</parameter></term> 512555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 513555991fdSmrg </varlistentry> 514555991fdSmrg <varlistentry> 515555991fdSmrg <term><parameter>save_type</parameter></term> 516555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 517555991fdSmrg </varlistentry> 518555991fdSmrg <varlistentry> 519555991fdSmrg <term><parameter>shut_down</parameter></term> 520555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 521555991fdSmrg </varlistentry> 522555991fdSmrg <varlistentry> 523555991fdSmrg <term><parameter>interact_style</parameter></term> 524555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 525555991fdSmrg </varlistentry> 526555991fdSmrg <varlistentry> 527555991fdSmrg <term><parameter>fast</parameter></term> 528555991fdSmrg <listitem><para>if <symbol>True</symbol>, then client should save its state as quickly as possible.</para></listitem> 529555991fdSmrg </varlistentry> 530555991fdSmrg</variablelist> 531555991fdSmrg 532555991fdSmrg <para> 533555991fdSmrgThe session manager sends a “Save Yourself” message to a 534555991fdSmrgclient either to checkpoint it or just before termination so that it 535555991fdSmrgcan save its state. The client responds with zero or more calls 5363c15da26Smrgto <xref linkend='SmcSetProperties' xrefstyle='select: title'/> to update the properties 537555991fdSmrgindicating how to restart the client. When all the properties have 5383c15da26Smrgbeen set, the client calls <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> 539555991fdSmrg </para> 540555991fdSmrg 541555991fdSmrg <para> 542555991fdSmrgIf <parameter>interact_style</parameter> is 543555991fdSmrg<constant>SmInteractStyleNone</constant> the 544555991fdSmrgclient must not interact with the user while saving state. 545555991fdSmrgIf <parameter>interact_style</parameter> is 546555991fdSmrg<constant>SmInteractStyleErrors</constant> the 547555991fdSmrgclient may interact with the user only if an error condition arises. 548555991fdSmrgIf <parameter>interact_style</parameter> is 549555991fdSmrg<constant>SmInteractStyleAny</constant> then the 550555991fdSmrgclient may interact with the user for any purpose. Because only one 551555991fdSmrgclient can interact with the user at a time, the client must 5523c15da26Smrgcall <xref linkend='SmcInteractRequest' xrefstyle='select: title'/> and wait for an 553555991fdSmrg“Interact” message from the session manager. When the 554555991fdSmrgclient is done interacting with the user, it 5553c15da26Smrgcalls <xref linkend='SmcInteractDone' xrefstyle='select: title'/> The client may only 5563c15da26Smrgcall <xref linkend='SmcInteractRequest' xrefstyle='select: title'/> after it receives a 557555991fdSmrg“Save Yourself” message and before it 5583c15da26Smrgcalls <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> 559555991fdSmrg </para> 560555991fdSmrg 561555991fdSmrg <para> 562555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveLocal</constant> the 563555991fdSmrgclient must update the properties to reflect its current state. Specifically, 564555991fdSmrgit should save enough information to restore the state as seen by the 565555991fdSmrguser of this client. It should not affect the state as seen by other users. 566555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveGlobal</constant> 567555991fdSmrgthe user wants the client to commit all of its data to permanent, globally 568555991fdSmrgaccessible storage. 569555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveBoth</constant> 570555991fdSmrgthe client should do both of these (it should first commit the data to 571555991fdSmrgpermanent storage before updating its properties). 572555991fdSmrg </para> 573555991fdSmrg 574555991fdSmrg <para> 575555991fdSmrgSome examples are as follows: 576555991fdSmrg 577555991fdSmrg <itemizedlist mark='bullet'> 578555991fdSmrg <listitem><para> 579555991fdSmrgIf a word processor were sent a “Save Yourself” with a 580555991fdSmrgtype of <constant>SmSaveLocal</constant> it could create a temporary 581555991fdSmrgfile that included the current contents of the file, the location of 582555991fdSmrgthe cursor, and other aspects of the current editing session. It 583555991fdSmrgwould then update its <property>SmRestartCommand</property> property with 584555991fdSmrgenough information to find this temporary file. 585555991fdSmrg </para></listitem> 586555991fdSmrg <listitem><para> 587555991fdSmrgIf a word processor were sent a “Save Yourself” with a 588555991fdSmrgtype of <constant>SmSaveGlobal</constant> it would simply save the 589555991fdSmrgcurrently edited file. 590555991fdSmrg </para></listitem> 591555991fdSmrg <listitem><para> 592555991fdSmrgIf a word processor were sent a “Save Yourself” with a 593555991fdSmrgtype of <constant>SmSaveBoth</constant> it would first save the 594555991fdSmrgcurrently edited file. It would then create a temporary file with 595555991fdSmrginformation such as the current position of the cursor and what file 596555991fdSmrgis being edited. Finally, it would update its 597555991fdSmrg<property>SmRestartCommand</property> property with enough information 598555991fdSmrgto find the temporary file. 599555991fdSmrg </para></listitem> 600555991fdSmrg </itemizedlist> 601555991fdSmrg </para> 602555991fdSmrg 603555991fdSmrg <para> 604555991fdSmrgThe <parameter>shutdown</parameter> argument specifies whether the 605555991fdSmrgsystem is being shut down. 606555991fdSmrgThe interaction is different depending on whether or not shutdown is 607555991fdSmrgset. If not shutting down, the client should save its state and wait 608555991fdSmrgfor a “Save Complete” message. If shutting down, the 609555991fdSmrgclient must save state and then prevent interaction until it receives 610555991fdSmrgeither a “Die” or a “Shutdown Cancelled.” 611555991fdSmrg </para> 612555991fdSmrg 613555991fdSmrg <para> 614555991fdSmrgThe <parameter>fast</parameter> argument specifies that the client 615555991fdSmrgshould save its state as quickly as possible. For example, if the 616555991fdSmrgsession manager knows that power is about to fail, it would 617555991fdSmrgset <parameter>fast</parameter> to <constant>True</constant>. 618555991fdSmrg </para> 619555991fdSmrg </sect2> 620555991fdSmrg 6213c15da26Smrg <sect2 id='The_Die_Callback'> 6223c15da26Smrg<title>The Die Callback</title> 623555991fdSmrg 624555991fdSmrg <para> 6253c15da26SmrgThe Die callback is of type <xref linkend='SmcDieProc' xrefstyle='select: title'/> 626555991fdSmrg </para> 627555991fdSmrg 6283c15da26Smrg<funcsynopsis id='SmcDieProc'> 629555991fdSmrg<funcprototype> 630555991fdSmrg <funcdef>typedef void (*<function>SmcDieProc</function>)</funcdef> 631555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 632300346aeSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 633555991fdSmrg</funcprototype> 634555991fdSmrg</funcsynopsis> 635555991fdSmrg 636555991fdSmrg<variablelist remap='IP'> 637555991fdSmrg <varlistentry> 638555991fdSmrg <term><parameter>smc_conn</parameter></term> 639555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 640555991fdSmrg </varlistentry> 641555991fdSmrg <varlistentry> 642555991fdSmrg <term><parameter>client_data</parameter></term> 643555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 644555991fdSmrg </varlistentry> 645555991fdSmrg</variablelist> 646555991fdSmrg 647555991fdSmrg 648555991fdSmrg <para> 649555991fdSmrgThe session manager sends a “Die” message to a client when 650555991fdSmrgit wants it to die. The client should respond by calling 6513c15da26Smrg<xref linkend='SmcCloseConnection' xrefstyle='select: title'/>. A session manager that 652555991fdSmrgbehaves properly will send a “Save Yourself” message 653555991fdSmrgbefore the “Die” message. 654555991fdSmrg </para> 655555991fdSmrg </sect2> 656555991fdSmrg 6573c15da26Smrg <sect2 id='The_Save_Complete_Callback'> 6583c15da26Smrg<title>The Save Complete Callback</title> 659555991fdSmrg 660555991fdSmrg <para> 6613c15da26SmrgThe Save Complete callback is of type <xref linkend='SmcSaveCompleteProc' xrefstyle='select: title'/> 662555991fdSmrg </para> 663555991fdSmrg 6643c15da26Smrg<funcsynopsis id='SmcSaveCompleteProc'> 665555991fdSmrg <funcprototype> 666555991fdSmrg <funcdef>typedef void (*<function>SmcSaveCompleteProc</function>)</funcdef> 667555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 668555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 669555991fdSmrg </funcprototype> 670555991fdSmrg</funcsynopsis> 671555991fdSmrg 672555991fdSmrg<variablelist remap='IP'> 673555991fdSmrg <varlistentry> 674555991fdSmrg <term><parameter>smc_conn</parameter></term> 675555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 676555991fdSmrg </varlistentry> 677555991fdSmrg <varlistentry> 678555991fdSmrg <term><parameter>client_data</parameter></term> 679555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 680555991fdSmrg </varlistentry> 681555991fdSmrg</variablelist> 682555991fdSmrg </sect2> 683555991fdSmrg 684555991fdSmrg 6853c15da26Smrg <sect2 id='The_Shutdown_Cancelled_Callback'> 6863c15da26Smrg<title>The Shutdown Cancelled Callback</title> 687555991fdSmrg 688555991fdSmrg <para> 689555991fdSmrgThe Shutdown Cancelled callback is of type 6903c15da26Smrg<xref linkend='SmcShutdownCancelledProc' xrefstyle='select: title'/> 691555991fdSmrg </para> 692555991fdSmrg 6933c15da26Smrg<funcsynopsis id='SmcShutdownCancelledProc'> 694555991fdSmrg <funcprototype> 695555991fdSmrg <funcdef>typedef void (*<function>SmcShutdownCancelledProc</function>)</funcdef> 696555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 697555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 698555991fdSmrg </funcprototype> 699555991fdSmrg</funcsynopsis> 700555991fdSmrg 701555991fdSmrg<variablelist remap='IP'> 702555991fdSmrg <varlistentry> 703555991fdSmrg <term><parameter>smc_conn</parameter></term> 704555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 705555991fdSmrg </varlistentry> 706555991fdSmrg <varlistentry> 707555991fdSmrg <term><parameter>client_data</parameter></term> 708555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 709555991fdSmrg </varlistentry> 710555991fdSmrg</variablelist> 711555991fdSmrg 712555991fdSmrg <para> 713555991fdSmrgThe session manager sends a “Shutdown Cancelled” message 714555991fdSmrgwhen the user cancelled the shutdown during an interaction 7153c15da26Smrg(see <link linkend='Interacting_With_the_User'>section 5.5, 716555991fdSmrg“Interacting With the User”</link>). The client can now 717555991fdSmrgcontinue as if the shutdown had never happened. If the client has not 7183c15da26Smrgcalled <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> yet, it can either 7193c15da26Smrgabort the save and then call <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> 720555991fdSmrgwith the success argument set to <constant>False</constant> or it can 7213c15da26Smrgcontinue with the save and then call <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> 722555991fdSmrgwith the <parameter>success</parameter> argument set to reflect the outcome 723555991fdSmrgof the save. 724555991fdSmrg </para> 725555991fdSmrg </sect2> 726555991fdSmrg </sect1> 727555991fdSmrg 7283c15da26Smrg <sect1 id='Closing_the_Connection'> 7293c15da26Smrg<title>Closing the Connection</title> 730555991fdSmrg 731555991fdSmrg <para> 732555991fdSmrgTo close a connection with a session manager, 7333c15da26Smrguse <xref linkend='SmcCloseConnection' xrefstyle='select: title'/> 734555991fdSmrg </para> 735555991fdSmrg 7363c15da26Smrg<funcsynopsis id='SmcCloseConnection'> 737555991fdSmrg <funcprototype> 738555991fdSmrg <funcdef>SmcCloseStatus <function>SmcCloseConnection</function></funcdef> 739555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 740555991fdSmrg <paramdef>int <parameter>count</parameter></paramdef> 741555991fdSmrg <paramdef>char **<parameter>reason_msgs</parameter></paramdef> 742555991fdSmrg </funcprototype> 743555991fdSmrg</funcsynopsis> 744555991fdSmrg<variablelist remap='IP'> 745555991fdSmrg <varlistentry> 746555991fdSmrg <term><parameter>smc_conn</parameter></term> 747555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 748555991fdSmrg </varlistentry> 749555991fdSmrg <varlistentry> 750555991fdSmrg <term><parameter>count</parameter></term> 751555991fdSmrg <listitem><para>The number of reasons for closing the connection.</para></listitem> 752555991fdSmrg </varlistentry> 753555991fdSmrg <varlistentry> 754555991fdSmrg <term><parameter>reason_msgs</parameter></term> 755555991fdSmrg <listitem><para>The reasons for closing the connection.</para></listitem> 756555991fdSmrg </varlistentry> 757555991fdSmrg</variablelist> 758555991fdSmrg 759555991fdSmrg <para> 760555991fdSmrgThe <parameter>reason_msgs</parameter> argument will most likely be 761555991fdSmrg<constant>NULL</constant> if resignation is expected by the client. 762555991fdSmrgOtherwise, it contains a list of null-terminated Compound Text strings 763555991fdSmrgrepresenting the reason for termination. The session manager should 764555991fdSmrgdisplay these reason messages to the user. 765555991fdSmrg </para> 766555991fdSmrg 767555991fdSmrg <para> 768555991fdSmrgNote that SMlib used the ICE protocol to establish a connection with 769555991fdSmrgthe session manager, and various protocols other than session 770555991fdSmrgmanagement may be active on the ICE connection. 7713c15da26SmrgWhen <xref linkend='SmcCloseConnection' xrefstyle='select: title'/> is called, the ICE 772555991fdSmrgconnection will be closed only if all protocols have been shutdown on 773555991fdSmrgthe connection. Check the ICElib standard 7743c15da26Smrgfor <olink targetdoc='ICElib' targetptr='IceAddConnectionWatch'><function>IceAddConnectionWatch</function></olink> 7753c15da26Smrgand <olink targetdoc='ICElib' targetptr='IceRemoveConnectionWatch'><function>IceRemoveConnectionWatch</function></olink> to learn how to set 776555991fdSmrgup a callback to be invoked each time an ICE connection is opened or 777555991fdSmrgclosed. Typically this callback adds/removes the ICE file descriptor 778555991fdSmrgfrom the list of active descriptors to call <function>select</function> on 779555991fdSmrg(or calls <function>XtAppAddInput</function> or 780555991fdSmrg<function>XtRemoveInput</function>). 781555991fdSmrg </para> 782555991fdSmrg 783555991fdSmrg 784555991fdSmrg <para> 7853c15da26Smrg<xref linkend='SmcCloseConnection' xrefstyle='select: title'/> returns one of the following values: 786555991fdSmrg 787555991fdSmrg <itemizedlist mark='bullet'> 788555991fdSmrg <listitem><para> 789555991fdSmrg<constant>SmcClosedNow</constant> - the ICE connection was closed at 790555991fdSmrgthis time, the watch procedures were invoked, and the connection was freed. 791555991fdSmrg </para></listitem> 792555991fdSmrg <listitem><para> 793555991fdSmrg<constant>SmcClosedASAP</constant> - an IO error had occurred on the 7943c15da26Smrgconnection, but <xref linkend='SmcCloseConnection' xrefstyle='select: title'/> is being 7953c15da26Smrgcalled within a nested <olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> The 796555991fdSmrgwatch procedures have been invoked at this time, but the connection 797555991fdSmrgwill be freed as soon as possible (when the nesting level reaches zero 7983c15da26Smrgand <olink targetdoc='ICElib' targetptr='IceProcessMessages'><function>IceProcessMessages</function></olink> returns a status 799555991fdSmrgof <function>IceProcessMessagesConnectionClosed</function> 800555991fdSmrg </para> </listitem> 801555991fdSmrg <listitem><para> 802555991fdSmrg<constant>SmcConnectionInUse</constant> - the connection was not closed at 803555991fdSmrgthis time, because it is being used by other active protocols. 804555991fdSmrg </para> </listitem> 805555991fdSmrg </itemizedlist> 806555991fdSmrg </para> 807555991fdSmrg </sect1> 808555991fdSmrg 809555991fdSmrg 8103c15da26Smrg <sect1 id='Modifying_Callbacks'> 8113c15da26Smrg<title>Modifying Callbacks</title> 812555991fdSmrg 813555991fdSmrg <para> 8143c15da26SmrgTo modify callbacks set up in <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> 8153c15da26Smrguse <xref linkend='SmcModifyCallbacks' xrefstyle='select: title'/> 816555991fdSmrg </para> 817555991fdSmrg 8183c15da26Smrg<funcsynopsis id='SmcModifyCallbacks'> 819555991fdSmrg <funcprototype> 820555991fdSmrg <funcdef>void <function>SmcModifyCallbacks</function></funcdef> 821555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 822555991fdSmrg <paramdef>unsigned long <parameter>mask</parameter></paramdef> 823555991fdSmrg <paramdef>SmcCallbacks *<parameter>callbacks</parameter></paramdef> 824555991fdSmrg </funcprototype> 825555991fdSmrg</funcsynopsis> 826555991fdSmrg<variablelist remap='IP'> 827555991fdSmrg <varlistentry> 828555991fdSmrg <term><parameter>smc_conn</parameter></term> 829555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 830555991fdSmrg </varlistentry> 831555991fdSmrg <varlistentry> 832555991fdSmrg <term><parameter>mask</parameter></term> 833555991fdSmrg <listitem><para>A mask indicating which callbacks to modify.</para></listitem> 834555991fdSmrg </varlistentry> 835555991fdSmrg <varlistentry> 836555991fdSmrg <term><parameter>callbacks</parameter></term> 837555991fdSmrg <listitem><para>The new callbacks.</para></listitem> 838555991fdSmrg </varlistentry> 839555991fdSmrg</variablelist> 840555991fdSmrg 841555991fdSmrg <para> 842555991fdSmrgWhen specifying a value for the <parameter>mask</parameter> argument, 843555991fdSmrgthe following values may be ORed together: 844555991fdSmrg 845555991fdSmrg <simplelist type='vert'> 846555991fdSmrg <member><constant>SmcSaveYourselfProcMask</constant></member> 847555991fdSmrg <member><constant>SmcDieProcMask</constant></member> 848555991fdSmrg <member><constant>SmcSaveCompleteProcMask</constant></member> 849555991fdSmrg <member><constant>SmcShutdownCancelledProcMask</constant></member> 850555991fdSmrg </simplelist> 851555991fdSmrg </para> 852555991fdSmrg </sect1> 853555991fdSmrg 8543c15da26Smrg <sect1 id='Setting_Deleting_and_Retrieving_Session_Management_Properties'> 8553c15da26Smrg<title>Setting, Deleting, and Retrieving Session Management Properties</title> 856555991fdSmrg 857555991fdSmrg <para> 858555991fdSmrgTo set session management properties for this client, 8593c15da26Smrguse <xref linkend='SmcSetProperties' xrefstyle='select: title'/> 860555991fdSmrg </para> 861555991fdSmrg 8623c15da26Smrg<funcsynopsis id='SmcSetProperties'> 863555991fdSmrg <funcprototype> 864555991fdSmrg <funcdef>void <function>SmcSetProperties</function></funcdef> 865555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 866555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 867555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 868555991fdSmrg </funcprototype> 869555991fdSmrg</funcsynopsis> 870555991fdSmrg 871555991fdSmrg<variablelist remap='IP'> 872555991fdSmrg <varlistentry> 873555991fdSmrg <term><parameter>smc_conn</parameter></term> 874555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 875555991fdSmrg </varlistentry> 876555991fdSmrg <varlistentry> 877555991fdSmrg <term><parameter>num_props</parameter></term> 878555991fdSmrg <listitem><para>The number of properties.</para></listitem> 879555991fdSmrg </varlistentry> 880555991fdSmrg <varlistentry> 881555991fdSmrg <term><parameter>props</parameter></term> 882555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 883555991fdSmrg </varlistentry> 884555991fdSmrg</variablelist> 885555991fdSmrg 886555991fdSmrg 887555991fdSmrg <para> 888555991fdSmrgThe properties are specified as an array of property pointers. 889555991fdSmrgPreviously set property values may be over-written using 8903c15da26Smrgthe <xref linkend='SmcSetProperties' xrefstyle='select: title'/> function. Note that the 891555991fdSmrgsession manager is not expected to restore property values when the 892555991fdSmrgsession is restarted. Because of this, clients should not try to use 893555991fdSmrgthe session manager as a database for storing application specific state. 894555991fdSmrg </para> 895555991fdSmrg 896555991fdSmrg <para> 897555991fdSmrgFor a description of session management properties and 898555991fdSmrgthe <structname>SmProp</structname> structure, 8993c15da26Smrgsee <link linkend='Session_Management_Properties'>section 7, 900555991fdSmrg“Session Management Properties.”</link> 901555991fdSmrg </para> 902555991fdSmrg 903555991fdSmrg 904555991fdSmrg <para> 905555991fdSmrgTo delete properties previously set by the client, 9063c15da26Smrguse <xref linkend='SmcDeleteProperties' xrefstyle='select: title'/> 907555991fdSmrg </para> 908555991fdSmrg 9093c15da26Smrg<funcsynopsis id='SmcDeleteProperties'> 910555991fdSmrg <funcprototype> 911555991fdSmrg <funcdef>void <function>SmcDeleteProperties</function></funcdef> 912555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 913555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 914555991fdSmrg <paramdef>char **<parameter>prop_names</parameter></paramdef> 915555991fdSmrg </funcprototype> 916555991fdSmrg</funcsynopsis> 917555991fdSmrg<variablelist remap='IP'> 918555991fdSmrg <varlistentry> 919555991fdSmrg <term><parameter>smc_conn</parameter></term> 920555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 921555991fdSmrg </varlistentry> 922555991fdSmrg <varlistentry> 923555991fdSmrg <term><parameter>num_props</parameter></term> 924555991fdSmrg <listitem><para>The number of properties.</para></listitem> 925555991fdSmrg </varlistentry> 926555991fdSmrg <varlistentry> 927555991fdSmrg <term><parameter>prop_names</parameter></term> 928555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 929555991fdSmrg </varlistentry> 930555991fdSmrg</variablelist> 931555991fdSmrg 932555991fdSmrg <para> 933555991fdSmrgTo get properties previously stored by the client, 9343c15da26Smrguse <xref linkend='SmcGetProperties' xrefstyle='select: title'/> 935555991fdSmrg </para> 936555991fdSmrg 9373c15da26Smrg<funcsynopsis id='SmcGetProperties'> 938555991fdSmrg <funcprototype> 939555991fdSmrg <funcdef>Status <function>SmcGetProperties</function></funcdef> 940555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 941555991fdSmrg <paramdef>SmcPropReplyProc <parameter>prop_reply_proc</parameter></paramdef> 942555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 943555991fdSmrg </funcprototype> 944555991fdSmrg</funcsynopsis> 945555991fdSmrg 946555991fdSmrg<variablelist remap='IP'> 947555991fdSmrg <varlistentry> 948555991fdSmrg <term><parameter>smc_conn</parameter></term> 949555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 950555991fdSmrg </varlistentry> 951555991fdSmrg <varlistentry> 952555991fdSmrg <term><parameter>prop_reply_proc</parameter></term> 953555991fdSmrg <listitem><para>The callback to be invoked when the properties reply comes back.</para></listitem> 954555991fdSmrg </varlistentry> 955555991fdSmrg <varlistentry> 956555991fdSmrg <term><parameter>client_data</parameter></term> 9573c15da26Smrg <listitem><para>This pointer to client data will be passed to the <xref linkend='SmcPropReplyProc' xrefstyle='select: title'/> callback.</para></listitem> 958555991fdSmrg </varlistentry> 959555991fdSmrg</variablelist> 960555991fdSmrg 961555991fdSmrg <para> 9623c15da26SmrgThe return value of <xref linkend='SmcGetProperties' xrefstyle='select: title'/> is zero for 963555991fdSmrgfailure and a positive value for success. 964555991fdSmrg </para> 965555991fdSmrg 966555991fdSmrg <para> 967555991fdSmrgNote that the library does not block until the properties reply comes 9683c15da26Smrgback. Rather, a callback of type <xref linkend='SmcPropReplyProc' xrefstyle='select: title'/> 969555991fdSmrgis invoked when the data is ready. 970555991fdSmrg </para> 971555991fdSmrg 9723c15da26Smrg<funcsynopsis id='SmcPropReplyProc'> 973555991fdSmrg <funcprototype> 974555991fdSmrg <funcdef>typedef void (*<function>SmcPropReplyProc</function>)</funcdef> 975555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 976555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 977555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 978555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 979555991fdSmrg </funcprototype> 980555991fdSmrg</funcsynopsis> 981555991fdSmrg 982555991fdSmrg<variablelist remap='IP'> 983555991fdSmrg <varlistentry> 984555991fdSmrg <term><parameter>smc_conn</parameter></term> 985555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 986555991fdSmrg </varlistentry> 987555991fdSmrg <varlistentry> 988555991fdSmrg <term><parameter>client_data</parameter></term> 9893c15da26Smrg <listitem><para>This pointer to client data will be passed to the <xref linkend='SmcPropReplyProc' xrefstyle='select: title'/> callback.</para></listitem> 990555991fdSmrg </varlistentry> 991555991fdSmrg <varlistentry> 992555991fdSmrg <term><parameter>num_props</parameter></term> 993555991fdSmrg <listitem><para>The number of properties returned.</para></listitem> 994555991fdSmrg </varlistentry> 995555991fdSmrg <varlistentry> 996555991fdSmrg <term><parameter>props</parameter></term> 997555991fdSmrg <listitem><para>The list of properties returned.</para></listitem> 998555991fdSmrg </varlistentry> 999555991fdSmrg</variablelist> 1000555991fdSmrg 1001555991fdSmrg <para> 10023c15da26SmrgTo free each property, use <xref linkend='SmFreeProperty' xrefstyle='select: title'/> 10033c15da26Smrg(see <link linkend='Freeing_Data'>section 8, “Freeing 1004555991fdSmrgData”</link>). To free the actual array of pointers, 1005555991fdSmrguse <function>free</function> 1006555991fdSmrg </para> 1007555991fdSmrg </sect1> 1008555991fdSmrg 10093c15da26Smrg <sect1 id='Interacting_With_the_User'> 10103c15da26Smrg<title>Interacting With the User</title> 1011555991fdSmrg 1012555991fdSmrg <para> 1013555991fdSmrgAfter receiving a “Save Yourself” message with an 1014555991fdSmrg<parameter>interact_style</parameter> of 1015555991fdSmrg<constant>SmInteractStyleErrors</constant> 1016555991fdSmrgor <constant>SmInteractStyleAny</constant> the client may choose to 1017555991fdSmrginteract with the user. Because only one client can interact with the 10183c15da26Smrguser at a time, the client must call <xref linkend='SmcInteractRequest' xrefstyle='select: title'/> 1019555991fdSmrgand wait for an “Interact” message from the session manager. 1020555991fdSmrg </para> 1021555991fdSmrg 10223c15da26Smrg<funcsynopsis id='SmcInteractRequest'> 1023555991fdSmrg <funcprototype> 1024555991fdSmrg <funcdef>Status <function>SmcInteractRequest</function></funcdef> 1025555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1026555991fdSmrg <paramdef>int <parameter>dialog_type</parameter></paramdef> 1027555991fdSmrg <paramdef>SmcInteractProc <parameter>interact_proc</parameter></paramdef> 1028555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1029555991fdSmrg </funcprototype> 1030555991fdSmrg</funcsynopsis> 1031555991fdSmrg 1032555991fdSmrg<variablelist remap='IP'> 1033555991fdSmrg <varlistentry> 1034555991fdSmrg <term><parameter>smc_conn</parameter></term> 1035555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1036555991fdSmrg </varlistentry> 1037555991fdSmrg <varlistentry> 1038555991fdSmrg <term><parameter>dialog_type</parameter></term> 1039555991fdSmrg <listitem><para>The type of dialog the client wishes to present to the user.</para></listitem> 1040555991fdSmrg </varlistentry> 1041555991fdSmrg <varlistentry> 1042555991fdSmrg <term><parameter>interact_proc</parameter></term> 1043555991fdSmrg <listitem><para>The callback to be invoked when the “Interact” message arrives from the session manager.</para></listitem> 1044555991fdSmrg </varlistentry> 1045555991fdSmrg <varlistentry> 1046555991fdSmrg <term><parameter>client_data</parameter></term> 1047555991fdSmrg <listitem><para> 1048555991fdSmrgThis pointer to client data will be passed to 10493c15da26Smrgthe <xref linkend='SmcInteractProc' xrefstyle='select: title'/> callback when the 1050555991fdSmrg“Interact” message arrives. 1051555991fdSmrg </para></listitem> 1052555991fdSmrg </varlistentry> 1053555991fdSmrg</variablelist> 1054555991fdSmrg 1055555991fdSmrg <para> 10563c15da26SmrgThe return value of <xref linkend='SmcInteractRequest' xrefstyle='select: title'/> is zero 1057555991fdSmrgfor failure and a positive value for success. 1058555991fdSmrg </para> 1059555991fdSmrg 1060555991fdSmrg <para> 1061555991fdSmrgThe <parameter>dialog_type</parameter> argument specifies 1062555991fdSmrgeither <constant>SmDialogError</constant> indicating that the client 1063555991fdSmrgwants to start an error dialog, or <constant>SmDialogNormal</constant> 1064555991fdSmrgmeaning that the client wishes to start a nonerror dialog. 1065555991fdSmrg </para> 1066555991fdSmrg 1067555991fdSmrg <para> 1068555991fdSmrgNote that if a shutdown is in progress, the user may have the option 1069555991fdSmrgof cancelling the shutdown. If the shutdown is cancelled, the clients 1070555991fdSmrgthat have not interacted yet with the user will receive a 1071555991fdSmrg“Shutdown Cancelled” message instead of the 1072555991fdSmrg“Interact” message. 1073555991fdSmrg </para> 1074555991fdSmrg 1075555991fdSmrg <para> 10763c15da26SmrgThe <xref linkend='SmcInteractProc' xrefstyle='select: title'/> callback will be invoked when 1077555991fdSmrgthe “Interact” message arrives from the session manager. 1078555991fdSmrg </para> 1079555991fdSmrg 10803c15da26Smrg<funcsynopsis id='SmcInteractProc'> 1081555991fdSmrg <funcprototype> 1082555991fdSmrg <funcdef>typedef void (*<function>SmcInteractProc</function>)</funcdef> 1083555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1084555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1085555991fdSmrg </funcprototype> 1086555991fdSmrg</funcsynopsis> 1087555991fdSmrg 1088555991fdSmrg<variablelist remap='IP'> 1089555991fdSmrg <varlistentry> 1090555991fdSmrg <term><parameter>smc_conn</parameter></term> 1091555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1092555991fdSmrg </varlistentry> 1093555991fdSmrg <varlistentry> 1094555991fdSmrg <term><parameter>client_data</parameter></term> 1095555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 1096555991fdSmrg </varlistentry> 1097555991fdSmrg</variablelist> 1098555991fdSmrg 1099555991fdSmrg <para> 1100555991fdSmrgAfter interacting with the user (in response to an “Interact” 11013c15da26Smrgmessage), you should call <xref linkend='SmcInteractDone' xrefstyle='select: title'/> 1102555991fdSmrg </para> 1103555991fdSmrg 11043c15da26Smrg<funcsynopsis id='SmcInteractDone'> 1105555991fdSmrg <funcprototype> 1106555991fdSmrg <funcdef>void <function>SmcInteractDone</function></funcdef> 1107555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1108555991fdSmrg <paramdef>Bool <parameter>cancel_shutdown</parameter></paramdef> 1109555991fdSmrg </funcprototype> 1110555991fdSmrg</funcsynopsis> 1111555991fdSmrg 1112555991fdSmrg<variablelist remap='IP'> 1113555991fdSmrg <varlistentry> 1114555991fdSmrg <term><parameter>smc_conn</parameter></term> 1115555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1116555991fdSmrg </varlistentry> 1117555991fdSmrg <varlistentry> 1118555991fdSmrg <term><parameter>cancel_shutdown</parameter></term> 1119555991fdSmrg <listitem><para>If <constant>True</constant>, indicates that the user requests that the entire shutdown be cancelled.</para></listitem> 1120555991fdSmrg </varlistentry> 1121555991fdSmrg</variablelist> 1122555991fdSmrg <para> 1123555991fdSmrgThe <parameter>cancel_shutdown</parameter> argument may only be 1124555991fdSmrg<constant>True</constant> if the corresponding “Save Yourself” 1125555991fdSmrgspecified <constant>True</constant> for shutdown 1126555991fdSmrgand <constant>SmInteractStyleErrors</constant> 1127555991fdSmrgor <constant>SmInteractStyleAny</constant> for 1128555991fdSmrgthe <parameter>interact_style</parameter>. 1129555991fdSmrg </para> 1130555991fdSmrg </sect1> 1131555991fdSmrg 11323c15da26Smrg <sect1 id='Requesting_a_Save_Yourself'> 11333c15da26Smrg<title>Requesting a Save Yourself</title> 1134555991fdSmrg 1135555991fdSmrg <para> 1136555991fdSmrgTo request a checkpoint from the session manager, 11373c15da26Smrguse <xref linkend='SmcRequestSaveYourself' xrefstyle='select: title'/> 1138555991fdSmrg </para> 1139555991fdSmrg 11403c15da26Smrg<funcsynopsis id='SmcRequestSaveYourself'> 1141555991fdSmrg <funcprototype> 1142555991fdSmrg <funcdef>void <function>SmcRequestSaveYourself</function></funcdef> 1143555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1144555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 1145555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 1146555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 1147555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 1148555991fdSmrg <paramdef>Bool <parameter>global</parameter></paramdef> 1149555991fdSmrg </funcprototype> 1150555991fdSmrg</funcsynopsis> 1151555991fdSmrg 1152555991fdSmrg 1153555991fdSmrg<variablelist remap='IP'> 1154555991fdSmrg <varlistentry> 1155555991fdSmrg <term><parameter>smc_conn</parameter></term> 1156555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1157555991fdSmrg </varlistentry> 1158555991fdSmrg <varlistentry> 1159555991fdSmrg <term><parameter>save_type</parameter></term> 1160555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 1161555991fdSmrg </varlistentry> 1162555991fdSmrg <varlistentry> 1163555991fdSmrg <term><parameter>shutdown</parameter></term> 1164555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 1165555991fdSmrg </varlistentry> 1166555991fdSmrg <varlistentry> 1167555991fdSmrg <term><parameter>interact_style</parameter></term> 1168555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 1169555991fdSmrg </varlistentry> 1170555991fdSmrg <varlistentry> 1171555991fdSmrg <term><parameter>fast</parameter></term> 1172555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 1173555991fdSmrg </varlistentry> 1174555991fdSmrg <varlistentry> 1175555991fdSmrg <term><parameter>global</parameter></term> 1176555991fdSmrg <listitem><para>Controls who gets the “Save Yourself.”</para></listitem> 1177555991fdSmrg </varlistentry> 1178555991fdSmrg</variablelist> 1179555991fdSmrg 1180555991fdSmrg <para> 1181555991fdSmrgThe <parameter>save_type</parameter>, <parameter>shutdown</parameter>, 1182555991fdSmrg<parameter>interact_style</parameter>, and <parameter>fast</parameter> 1183555991fdSmrgarguments are discussed in more detail in 11843c15da26Smrg<link linkend='The_Save_Yourself_Callback'>section 5.1.1, 1185555991fdSmrg“The Save Yourself Callback.”</link> 1186555991fdSmrg </para> 1187555991fdSmrg 1188555991fdSmrg <para> 1189555991fdSmrgIf <parameter>global</parameter> is set to <constant>True</constant> then 1190555991fdSmrgthe resulting “Save Yourself” should be sent to all clients in the 1191555991fdSmrgsession. For example, a vendor of a Uninterruptible Power Supply 1192555991fdSmrg(<acronym>UPS</acronym>) might include a Session Management client 1193555991fdSmrgthat would monitor the status of the UPS and generate a fast shutdown 1194555991fdSmrgif the power is about to be lost. 1195555991fdSmrg </para> 1196555991fdSmrg 1197555991fdSmrg <para> 1198555991fdSmrgIf global is set to <constant>False</constant> then the “Save 1199555991fdSmrgYourself” should only be sent to the client that requested it. 1200555991fdSmrg </para> 1201555991fdSmrg </sect1> 1202555991fdSmrg 12033c15da26Smrg <sect1 id='Requesting_a_Save_Yourself_Phase_2_2'> 12043c15da26Smrg<title>Requesting a Save Yourself Phase 2</title> 1205555991fdSmrg 1206555991fdSmrg <para> 1207555991fdSmrgIn response to a “Save Yourself”, the client may request to be 1208555991fdSmrginformed when all the other clients are quiescent so that it can save their 12093c15da26Smrgstate. To do so, use <xref linkend='SmcRequestSaveYourselfPhase2' xrefstyle='select: title'/> 1210555991fdSmrg </para> 1211555991fdSmrg 12123c15da26Smrg<funcsynopsis id='SmcRequestSaveYourselfPhase2'> 1213555991fdSmrg <funcprototype> 1214555991fdSmrg <funcdef>Status <function>SmcRequestSaveYourselfPhase2</function></funcdef> 1215555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1216555991fdSmrg <paramdef>SmcSaveYourselfPhase2Proc <parameter>save_yourself_phase2_proc</parameter></paramdef> 1217555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1218555991fdSmrg </funcprototype> 1219555991fdSmrg</funcsynopsis> 1220555991fdSmrg 1221555991fdSmrg<variablelist remap='IP'> 1222555991fdSmrg <varlistentry> 1223555991fdSmrg <term><parameter>smc_conn</parameter></term> 1224555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1225555991fdSmrg </varlistentry> 1226555991fdSmrg <varlistentry> 1227555991fdSmrg <term><parameter>save_type_phase2_proc</parameter></term> 1228555991fdSmrg <listitem><para>The callback to be invoked when the “Save Yourself Phase 2” message arrives from the session manager.</para></listitem> 1229555991fdSmrg </varlistentry> 1230555991fdSmrg <varlistentry> 1231555991fdSmrg <term><parameter>client_data</parameter></term> 1232555991fdSmrg <listitem><para>This pointer to client data will be passed to the <function>SmcSaveYourselfPhase2Proc</function> callback when the “Save Yourself Phase 2” message arrives.</para></listitem> 1233555991fdSmrg </varlistentry> 1234555991fdSmrg</variablelist> 1235555991fdSmrg 1236555991fdSmrg <para> 12373c15da26SmrgThe return value of <xref linkend='SmcRequestSaveYourselfPhase2' xrefstyle='select: title'/> 1238555991fdSmrgis zero for failure and a positive value for success. 1239555991fdSmrg </para> 1240555991fdSmrg 1241555991fdSmrg <para> 1242555991fdSmrgThis request is needed by clients that manage other clients (for 1243555991fdSmrgexample, window managers, workspace managers, and so on). The manager 1244555991fdSmrgmust make sure that all of the clients that are being managed are in 1245555991fdSmrgan idle state so that their state can be saved. 1246555991fdSmrg </para> 1247555991fdSmrg </sect1> 1248555991fdSmrg 12493c15da26Smrg <sect1 id='Completing_a_Save_Yourself'> 12503c15da26Smrg<title>Completing a Save Yourself</title> 1251555991fdSmrg 1252555991fdSmrg <para> 1253555991fdSmrgAfter saving state in response to a “Save Yourself” 12543c15da26Smrgmessage, you should call <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> 1255555991fdSmrg </para> 1256555991fdSmrg 12573c15da26Smrg<funcsynopsis id='SmcSaveYourselfDone'> 1258555991fdSmrg <funcprototype> 1259555991fdSmrg <funcdef>void <function>SmcSaveYourselfDone</function></funcdef> 1260555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1261555991fdSmrg <paramdef>Bool <parameter>success</parameter></paramdef> 1262555991fdSmrg </funcprototype> 1263555991fdSmrg</funcsynopsis> 1264555991fdSmrg 1265555991fdSmrg<variablelist remap='IP'> 1266555991fdSmrg <varlistentry> 1267555991fdSmrg <term><parameter>smc_conn</parameter></term> 1268555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1269555991fdSmrg </varlistentry> 1270555991fdSmrg <varlistentry> 1271555991fdSmrg <term><parameter>success</parameter></term> 1272555991fdSmrg <listitem><para>If <constant>True</constant> the “Save Yourself” operation was completed successfully.</para></listitem> 1273555991fdSmrg </varlistentry> 1274555991fdSmrg</variablelist> 1275555991fdSmrg 1276555991fdSmrg <para> 12773c15da26SmrgBefore calling <xref linkend='SmcSaveYourselfDone' xrefstyle='select: title'/> the client 1278555991fdSmrgmust have set each required property at least once since the client 1279555991fdSmrgregistered with the session manager. 1280555991fdSmrg </para> 1281555991fdSmrg </sect1> 1282555991fdSmrg 12833c15da26Smrg <sect1 id='Using_Smc_Informational_Functions'> 12843c15da26Smrg<title>Using Smc Informational Functions</title> 1285555991fdSmrg 12863c15da26Smrg<funcsynopsis id='SmcProtocolVersion'> 1287555991fdSmrg <funcprototype> 1288555991fdSmrg <funcdef>int <function>SmcProtocolVersion</function></funcdef> 1289555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1290555991fdSmrg </funcprototype> 1291555991fdSmrg</funcsynopsis> 1292555991fdSmrg 1293555991fdSmrg <para> 12943c15da26Smrg<xref linkend='SmcProtocolVersion' xrefstyle='select: title'/> returns the major version of 1295555991fdSmrgthe session management protocol associated with this session. 1296555991fdSmrg </para> 1297555991fdSmrg 1298555991fdSmrg 12993c15da26Smrg<funcsynopsis id='SmcProtocolRevision'> 1300555991fdSmrg <funcprototype> 1301555991fdSmrg <funcdef>int <function>SmcProtocolRevision</function></funcdef> 1302555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1303555991fdSmrg </funcprototype> 1304555991fdSmrg</funcsynopsis> 1305555991fdSmrg 1306555991fdSmrg <para> 13073c15da26Smrg<xref linkend='SmcProtocolRevision' xrefstyle='select: title'/> returns the minor version of 1308555991fdSmrgthe session management protocol associated with this session. 1309555991fdSmrg </para> 1310555991fdSmrg 13113c15da26Smrg<funcsynopsis id='SmcVendor'> 1312555991fdSmrg <funcprototype> 1313555991fdSmrg <funcdef>char *<function>SmcVendor</function></funcdef> 1314555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1315555991fdSmrg </funcprototype> 1316555991fdSmrg</funcsynopsis> 1317555991fdSmrg 1318555991fdSmrg <para> 13193c15da26Smrg<xref linkend='SmcVendor' xrefstyle='select: title'/> returns a string that provides some 1320555991fdSmrgidentification of the owner of the session manager. The string should 1321555991fdSmrgbe freed with a call to <function>free</function> 1322555991fdSmrg </para> 1323555991fdSmrg 13243c15da26Smrg<funcsynopsis id='SmcRelease'> 1325555991fdSmrg <funcprototype> 1326555991fdSmrg <funcdef>char *<function>SmcRelease</function></funcdef> 1327555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1328555991fdSmrg </funcprototype> 1329555991fdSmrg</funcsynopsis> 1330555991fdSmrg 1331555991fdSmrg <para> 13323c15da26Smrg<xref linkend='SmcRelease' xrefstyle='select: title'/> returns a string that provides the 1333555991fdSmrgrelease number of the session manager. The string should be freed 1334555991fdSmrgwith a call to <function>free</function> 1335555991fdSmrg </para> 1336555991fdSmrg 13373c15da26Smrg<funcsynopsis id='SmcClientID'> 1338555991fdSmrg <funcprototype> 1339555991fdSmrg <funcdef>char *<function>SmcClientID</function></funcdef> 1340555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1341555991fdSmrg </funcprototype> 1342555991fdSmrg</funcsynopsis> 1343555991fdSmrg 1344555991fdSmrg <para> 13453c15da26Smrg<xref linkend='SmcClientID' xrefstyle='select: title'/> returns a null-terminated string for 1346555991fdSmrgthe client ID associated with this connection. This information was 13473c15da26Smrgalso returned in <xref linkend='SmcOpenConnection' xrefstyle='select: title'/> (it is 1348555991fdSmrgprovided here for convenience). Call <function>free</function> on 1349555991fdSmrgthis pointer when the client ID is no longer needed. 1350555991fdSmrg </para> 1351555991fdSmrg 13523c15da26Smrg<funcsynopsis id='SmcGetIceConnection'> 1353555991fdSmrg <funcprototype> 1354555991fdSmrg <funcdef>IceConn <function>SmcGetIceConnection</function></funcdef> 1355555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1356555991fdSmrg </funcprototype> 1357555991fdSmrg</funcsynopsis> 1358555991fdSmrg 1359555991fdSmrg <para> 13603c15da26Smrg<xref linkend='SmcGetIceConnection' xrefstyle='select: title'/> returns the ICE connection 1361555991fdSmrgobject associated with this session management connection object. The 1362555991fdSmrgICE connection object can be used to get some additional information 1363555991fdSmrgabout the connection. Some of the more useful functions which can be 1364555991fdSmrgused on the IceConn are <function>IceConnectionNumber</function>, 1365555991fdSmrg<function>IceConnectionString</function>, 13663c15da26Smrg<olink targetdoc='ICElib' targetptr='IceLastSentSequenceNumber'><function>IceLastSentSequenceNumber</function></olink>, 1367555991fdSmrg<function>IceLastReceivedSequenceNumber</function>, 13683c15da26Smrgand <olink targetdoc='ICElib' targetptr='IcePing'><function>IcePing</function></olink>. For further information, see 1369555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 1370555991fdSmrgstandard. 1371555991fdSmrg </para> 1372555991fdSmrg </sect1> 1373555991fdSmrg 13743c15da26Smrg <sect1 id='Error_Handling'> 13753c15da26Smrg<title>Error Handling</title> 1376555991fdSmrg 1377555991fdSmrg <para> 1378555991fdSmrgIf the client receives an unexpected protocol error from the session 1379555991fdSmrgmanager, an error handler is invoked by SMlib. A default error 1380555991fdSmrghandler exists that simply prints the error message 1381555991fdSmrgto <varname>stderr</varname> and exits if the severity of the error 1382555991fdSmrgis fatal. The client can change this error handler by calling 13833c15da26Smrgthe <xref linkend='SmcSetErrorHandler' xrefstyle='select: title'/> function. 1384555991fdSmrg </para> 1385555991fdSmrg 13863c15da26Smrg<funcsynopsis id='SmcSetErrorHandler'> 1387555991fdSmrg <funcprototype> 1388555991fdSmrg <funcdef>SmcErrorHandler <function>SmcSetErrorHandler</function></funcdef> 1389555991fdSmrg <paramdef>SmcErrorHandler <parameter>handler</parameter></paramdef> 1390555991fdSmrg </funcprototype> 1391555991fdSmrg</funcsynopsis> 1392555991fdSmrg 1393555991fdSmrg <para> 1394555991fdSmrgThe error handler. You should pass <constant>NULL</constant> to 1395555991fdSmrgrestore the default handler. 1396555991fdSmrg </para> 1397555991fdSmrg 1398555991fdSmrg 1399555991fdSmrg <para> 14003c15da26Smrg<xref linkend='SmcSetErrorHandler' xrefstyle='select: title'/> returns the previous error handler. 1401555991fdSmrg </para> 1402555991fdSmrg 1403555991fdSmrg <para> 14043c15da26SmrgThe <xref linkend='SmcErrorHandler' xrefstyle='select: title'/> has the following type: 1405555991fdSmrg </para> 1406555991fdSmrg 14073c15da26Smrg<funcsynopsis id='SmcErrorHandler'> 1408555991fdSmrg <funcprototype> 1409555991fdSmrg <funcdef>typedef void (*<function>SmcErrorHandler</function>)</funcdef> 1410555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1411555991fdSmrg <paramdef>Bool <parameter>swap</parameter></paramdef> 1412555991fdSmrg <paramdef>int <parameter>offending_minor_opcode</parameter></paramdef> 1413555991fdSmrg <paramdef>unsigned long <parameter>offending_sequence_num</parameter></paramdef> 1414555991fdSmrg <paramdef>int <parameter>error_class</parameter></paramdef> 1415555991fdSmrg <paramdef>int <parameter>severity</parameter></paramdef> 1416555991fdSmrg <paramdef>IcePointer <parameter>values</parameter></paramdef> 1417555991fdSmrg </funcprototype> 1418555991fdSmrg</funcsynopsis> 1419555991fdSmrg 1420555991fdSmrg<variablelist remap='IP'> 1421555991fdSmrg <varlistentry> 1422555991fdSmrg <term><parameter>smc_conn</parameter></term> 1423555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1424555991fdSmrg </varlistentry> 1425555991fdSmrg <varlistentry> 1426555991fdSmrg <term><parameter>swap</parameter></term> 1427555991fdSmrg <listitem><para>A flag that indicates if the specified values need byte swapping.</para></listitem> 1428555991fdSmrg </varlistentry> 1429555991fdSmrg <varlistentry> 1430555991fdSmrg <term><parameter>offending_minor_opcode</parameter></term> 1431555991fdSmrg <listitem><para>The minor opcode of the offending message.</para></listitem> 1432555991fdSmrg </varlistentry> 1433555991fdSmrg <varlistentry> 1434555991fdSmrg <term><parameter>offending_sequence_num</parameter></term> 1435555991fdSmrg <listitem><para>The sequence number of the offending message.</para></listitem> 1436555991fdSmrg </varlistentry> 1437555991fdSmrg <varlistentry> 1438555991fdSmrg <term><parameter>error_class</parameter></term> 1439555991fdSmrg <listitem><para>The error class of the offending message.</para></listitem> 1440555991fdSmrg </varlistentry> 1441555991fdSmrg <varlistentry> 1442555991fdSmrg <term><parameter>severity</parameter></term> 1443555991fdSmrg <listitem><para><constant>IceCanContinue</constant>, 1444555991fdSmrg <constant>IceFatalToProtocol</constant>, or 1445555991fdSmrg <constant>IceFatalToConnection</constant> 1446555991fdSmrg </para></listitem> 1447555991fdSmrg </varlistentry> 1448555991fdSmrg <varlistentry> 1449555991fdSmrg <term><parameter>values</parameter></term> 1450555991fdSmrg <listitem><para>Any additional error values specific to the minor opcode and class.</para></listitem> 1451555991fdSmrg </varlistentry> 1452555991fdSmrg</variablelist> 1453555991fdSmrg 1454555991fdSmrg <para> 1455555991fdSmrgNote that this error handler is invoked for protocol related errors. 1456555991fdSmrgTo install an error handler to be invoked when an IO error occurs, use 14573c15da26Smrg<olink targetdoc='ICElib' targetptr='IceSetIOErrorHandler'><function>IceSetIOErrorHandler</function></olink> For further information, see 1458555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 1459555991fdSmrgstandard. 1460555991fdSmrg </para> 1461555991fdSmrg </sect1> 1462555991fdSmrg</chapter> 1463555991fdSmrg 14643c15da26Smrg<chapter id='Session_Management_Server_Sms_Functions'> 1465555991fdSmrg <title>Session Management Server (<acronym>Sms</acronym>) Functions</title> 1466555991fdSmrg 1467555991fdSmrg <para> 1468555991fdSmrgThis section discusses how Session Management servers: 1469555991fdSmrg 1470555991fdSmrg <itemizedlist mark='bullet'> 1471555991fdSmrg <listitem><para>Initialize the library</para></listitem> 1472555991fdSmrg <listitem><para>Register the client</para></listitem> 1473555991fdSmrg <listitem><para>Send a “Save Yourself” message</para></listitem> 1474555991fdSmrg <listitem><para>Send a “Save Yourself Phase 2” message</para></listitem> 1475555991fdSmrg <listitem><para>Send an “Interact” message</para></listitem> 1476555991fdSmrg <listitem><para>Send a “Save Complete” message</para></listitem> 1477555991fdSmrg <listitem><para>Send a “Die” message</para></listitem> 1478555991fdSmrg <listitem><para>Cancel a shutdown</para></listitem> 1479555991fdSmrg <listitem><para>Return properties</para></listitem> 1480555991fdSmrg <listitem><para>Ping a client</para></listitem> 1481555991fdSmrg <listitem><para>Clean up after a client disconnects</para></listitem> 1482555991fdSmrg <listitem><para>Use Sms informational functions</para></listitem> 1483555991fdSmrg <listitem><para>Handle errors</para></listitem> 1484555991fdSmrg </itemizedlist> 1485555991fdSmrg </para> 1486555991fdSmrg 14873c15da26Smrg <sect1 id='Initializing_the_Library'> 14883c15da26Smrg<title>Initializing the Library</title> 1489555991fdSmrg 1490555991fdSmrg <para> 14913c15da26Smrg<xref linkend='SmsInitialize' xrefstyle='select: title'/> is the first SMlib function that 1492555991fdSmrgshould be called by a session manager. It provides information about 1493555991fdSmrgthe session manager and registers a callback that will be invoked each 1494555991fdSmrgtime a new client connects to the session manager. 1495555991fdSmrg </para> 1496555991fdSmrg 14973c15da26Smrg<funcsynopsis id='SmsInitialize'> 1498555991fdSmrg <funcprototype> 1499555991fdSmrg <funcdef>Status <function>SmsInitialize</function></funcdef> 15003c15da26Smrg <paramdef>const char *<parameter>vendor</parameter></paramdef> 15013c15da26Smrg <paramdef>const char *<parameter>release</parameter></paramdef> 1502555991fdSmrg <paramdef>SmsNewClientProc <parameter>new_client_proc</parameter></paramdef> 1503555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1504555991fdSmrg <paramdef>IceHostBasedAuthProc <parameter>host_based_auth_proc</parameter></paramdef> 1505555991fdSmrg <paramdef>int <parameter>error_length</parameter></paramdef> 1506555991fdSmrg <paramdef>char *<parameter>error_string_ret</parameter></paramdef> 1507555991fdSmrg </funcprototype> 1508555991fdSmrg</funcsynopsis> 1509555991fdSmrg 1510555991fdSmrg 1511555991fdSmrg 1512555991fdSmrg<variablelist remap='IP'> 1513555991fdSmrg <varlistentry> 1514555991fdSmrg <term><parameter>vendor</parameter></term> 1515555991fdSmrg <listitem><para>A string specifying the session manager vendor.</para></listitem> 1516555991fdSmrg </varlistentry> 1517555991fdSmrg <varlistentry> 1518555991fdSmrg <term><parameter>release</parameter></term> 1519555991fdSmrg <listitem><para>A string specifying the session manager release number.</para></listitem> 1520555991fdSmrg </varlistentry> 1521555991fdSmrg <varlistentry> 1522555991fdSmrg <term><parameter>new_client_proc</parameter></term> 1523555991fdSmrg <listitem><para>Callback to be invoked each time a new client connects to the session manager.</para></listitem> 1524555991fdSmrg </varlistentry> 1525555991fdSmrg <varlistentry> 1526555991fdSmrg <term><parameter>manager_data</parameter></term> 15273c15da26Smrg <listitem><para>When the <xref linkend='SmsNewClientProc' xrefstyle='select: title'/> callback is invoked, this pointer to manager data will be passed.</para></listitem> 1528555991fdSmrg </varlistentry> 1529555991fdSmrg <varlistentry> 1530555991fdSmrg <term><parameter>host_based_auth_proc</parameter></term> 1531555991fdSmrg <listitem><para>Host based authentication callback.</para></listitem> 1532555991fdSmrg </varlistentry> 1533555991fdSmrg <varlistentry> 1534555991fdSmrg <term><parameter>error_length</parameter></term> 1535555991fdSmrg <listitem><para>Length of the <parameter>error_string_ret</parameter> argument passed in.</para></listitem> 1536555991fdSmrg </varlistentry> 1537555991fdSmrg <varlistentry> 1538555991fdSmrg <term><parameter>error_string_ret</parameter></term> 1539555991fdSmrg <listitem><para> 1540555991fdSmrgReturns a null-terminated error message, if any. 1541555991fdSmrgThe <parameter>error_string_ret</parameter> points to user supplied memory. 1542555991fdSmrgNo more than <parameter>error_length</parameter> bytes are used. 1543555991fdSmrg </para></listitem> 1544555991fdSmrg </varlistentry> 1545555991fdSmrg</variablelist> 1546555991fdSmrg 1547555991fdSmrg <para> 15483c15da26SmrgAfter the <xref linkend='SmsInitialize' xrefstyle='select: title'/> function is called, the 15493c15da26Smrgsession manager should call the <olink targetdoc='ICElib' targetptr='IceListenForConnections'><function>IceListenForConnections</function></olink> 1550555991fdSmrgfunction to listen for new connections. Afterwards, each time a 1551555991fdSmrgclient connects, the session manager should 15523c15da26Smrgcall <olink targetdoc='ICElib' targetptr='IceAcceptConnection'><function>IceAcceptConnection</function></olink> 1553555991fdSmrg </para> 1554555991fdSmrg 1555555991fdSmrg <para> 15563c15da26SmrgSee <link linkend='Authentication_of_Clients'>section 9, 1557555991fdSmrg“Authentication of Clients,”</link> for more details on 1558555991fdSmrgauthentication (including host based authentication). Also see 1559555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange 1560555991fdSmrgLibrary</citetitle> standard for further details on listening for and 1561555991fdSmrgaccepting ICE connections. 1562555991fdSmrg </para> 1563555991fdSmrg 1564555991fdSmrg <para> 1565555991fdSmrgEach time a new client connects to the session manager, 15663c15da26Smrgthe <xref linkend='SmsNewClientProc' xrefstyle='select: title'/> callback is invoked. The 1567555991fdSmrgsession manager obtains a new opaque connection object that it should 1568555991fdSmrguse for all future interaction with the client. At this time, the 1569555991fdSmrgsession manager must also register a set of callbacks to respond to 1570555991fdSmrgthe different messages that the client might send. 1571555991fdSmrg </para> 1572555991fdSmrg 15733c15da26Smrg<funcsynopsis id='SmsNewClientProc'> 1574555991fdSmrg <funcprototype> 1575555991fdSmrg <funcdef>typedef Status (*<function>SmsNewClientProc</function>)</funcdef> 1576555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1577555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1578555991fdSmrg <paramdef>unsigned long *<parameter>mask_ret</parameter></paramdef> 1579555991fdSmrg <paramdef>SmsCallbacks *<parameter>callbacks_ret</parameter></paramdef> 1580555991fdSmrg <paramdef>char **<parameter>failure_reason_ret</parameter></paramdef> 1581555991fdSmrg </funcprototype> 1582555991fdSmrg</funcsynopsis> 1583555991fdSmrg 1584555991fdSmrg<variablelist remap='IP'> 1585555991fdSmrg <varlistentry> 1586555991fdSmrg <term><parameter>sms_conn</parameter></term> 1587555991fdSmrg <listitem><para>A new opaque connection object.</para></listitem> 1588555991fdSmrg </varlistentry> 1589555991fdSmrg <varlistentry> 1590555991fdSmrg <term><parameter>manager_data</parameter></term> 1591555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1592555991fdSmrg </varlistentry> 1593555991fdSmrg <varlistentry> 1594555991fdSmrg <term><parameter>mask_ret</parameter></term> 1595555991fdSmrg <listitem><para>On return, indicates which callbacks were set by the session manager.</para></listitem> 1596555991fdSmrg </varlistentry> 1597555991fdSmrg <varlistentry> 1598555991fdSmrg <term><parameter>callbacks_ret</parameter></term> 1599555991fdSmrg <listitem><para>On return, contains the callbacks registered by the session manager.</para></listitem> 1600555991fdSmrg </varlistentry> 1601555991fdSmrg <varlistentry> 1602555991fdSmrg <term><parameter>failure_reason_ret</parameter></term> 1603555991fdSmrg <listitem><para>Failure reason returned.</para></listitem> 1604555991fdSmrg </varlistentry> 1605555991fdSmrg</variablelist> 1606555991fdSmrg 1607555991fdSmrg <para> 16083c15da26SmrgIf a failure occurs, the <xref linkend='SmsNewClientProc' xrefstyle='select: title'/> should 1609555991fdSmrgreturn a zero status as well as allocate and return a failure reason 1610555991fdSmrgstring in <parameter>failure_reason_ret</parameter>. 1611555991fdSmrgSMlib will be responsible for freeing this memory. 1612555991fdSmrg </para> 1613555991fdSmrg 1614555991fdSmrg <para> 1615555991fdSmrgThe session manager must register a set of callbacks to respond to 1616555991fdSmrgclient events. The <parameter>mask_ret</parameter> argument specifies 1617555991fdSmrgwhich callbacks are set. All of the callbacks specified in this version of 1618555991fdSmrgSMlib are mandatory. The <parameter>mask_ret</parameter> argument is 1619555991fdSmrgnecessary in order to maintain backwards compatibility in future versions 1620555991fdSmrgof the library. 1621555991fdSmrg </para> 1622555991fdSmrg 1623555991fdSmrg <para> 1624555991fdSmrgThe following values may be ORed together to obtain a mask value: 1625555991fdSmrg 1626555991fdSmrg <simplelist type='vert'> 1627555991fdSmrg <member><constant>SmsRegisterClientProcMask</constant></member> 1628555991fdSmrg <member><constant>SmsInteractRequestProcMask</constant></member> 1629555991fdSmrg <member><constant>SmsInteractDoneProcMask</constant></member> 1630555991fdSmrg <member><constant>SmsSaveYourselfRequestProcMask</constant></member> 1631555991fdSmrg <member><constant>SmsSaveYourselfP2RequestProcMask</constant></member> 1632555991fdSmrg <member><constant>SmsSaveYourselfDoneProcMask</constant></member> 1633555991fdSmrg <member><constant>SmsCloseConnectionProcMask</constant></member> 1634555991fdSmrg <member><constant>SmsSetPropertiesProcMask</constant></member> 1635555991fdSmrg <member><constant>SmsDeletePropertiesProcMask</constant></member> 1636555991fdSmrg <member><constant>SmsGetPropertiesProcMask</constant></member> 1637555991fdSmrg </simplelist> 1638555991fdSmrg </para> 1639555991fdSmrg 1640555991fdSmrg <para> 1641555991fdSmrgFor each callback, the session manager can register a pointer to 1642555991fdSmrgmanager data specific to that callback. This pointer will be passed 1643555991fdSmrgto the callback when it is invoked by SMlib. 1644555991fdSmrg </para> 1645555991fdSmrg 1646555991fdSmrg<synopsis> 1647555991fdSmrgtypedef struct { 1648555991fdSmrg struct { 1649555991fdSmrg SmsRegisterClientProc callback; 1650555991fdSmrg SmPointer manager_data; 1651555991fdSmrg } register_client; 1652555991fdSmrg 1653555991fdSmrg struct { 1654555991fdSmrg SmsInteractRequestProc callback; 1655555991fdSmrg SmPointer manager_data; 1656555991fdSmrg } interact_request; 1657555991fdSmrg 1658555991fdSmrg struct { 1659555991fdSmrg SmsInteractDoneProc callback; 1660555991fdSmrg SmPointer manager_data; 1661555991fdSmrg } interact_done; 1662555991fdSmrg 1663555991fdSmrg struct { 1664555991fdSmrg SmsSaveYourselfRequestProc callback; 1665555991fdSmrg SmPointer manager_data; 1666555991fdSmrg } save_yourself_request; 1667555991fdSmrg 1668555991fdSmrg struct { 1669555991fdSmrg SmsSaveYourselfPhase2RequestProc callback; 1670555991fdSmrg SmPointer manager_data; 1671555991fdSmrg } save_yourself_phase2_request; 1672555991fdSmrg 1673555991fdSmrg struct { 1674555991fdSmrg SmsSaveYourselfDoneProc callback; 1675555991fdSmrg SmPointer manager_data; 1676555991fdSmrg } save_yourself_done; 1677555991fdSmrg 1678555991fdSmrg struct { 1679555991fdSmrg SmsCloseConnectionProc callback; 1680555991fdSmrg SmPointer manager_data; 1681555991fdSmrg } close_connection; 1682555991fdSmrg 1683555991fdSmrg struct { 1684555991fdSmrg SmsSetPropertiesProc callback; 1685555991fdSmrg SmPointer manager_data; 1686555991fdSmrg } set_properties; 1687555991fdSmrg 1688555991fdSmrg struct { 1689555991fdSmrg SmsDeletePropertiesProc callback; 1690555991fdSmrg SmPointer manager_data; 1691555991fdSmrg } delete_properties; 1692555991fdSmrg 1693555991fdSmrg struct { 1694555991fdSmrg SmsGetPropertiesProc callback; 1695555991fdSmrg SmPointer manager_data; 1696555991fdSmrg } get_properties; 1697555991fdSmrg 1698555991fdSmrg} SmsCallbacks; 1699555991fdSmrg</synopsis> 1700555991fdSmrg 17013c15da26Smrg <sect2 id='The_Register_Client_Callback'> 17023c15da26Smrg<title>The Register Client Callback</title> 1703555991fdSmrg 1704555991fdSmrg <para> 1705555991fdSmrgThe Register Client callback is the first callback that will be 1706555991fdSmrginvoked after the client connects to the session manager. Its type 17073c15da26Smrgis <xref linkend='SmsRegisterClientProc' xrefstyle='select: title'/> 1708555991fdSmrg </para> 1709555991fdSmrg 17103c15da26Smrg<funcsynopsis id='SmsRegisterClientProc'> 1711555991fdSmrg <funcprototype> 1712555991fdSmrg <funcdef>typedef Status (*<function>SmsRegisterClientProc</function>)</funcdef> 1713555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1714555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1715555991fdSmrg <paramdef>char *<parameter>previous_id</parameter></paramdef> 1716555991fdSmrg </funcprototype> 1717555991fdSmrg</funcsynopsis> 1718555991fdSmrg 1719555991fdSmrg<variablelist remap='IP'> 1720555991fdSmrg <varlistentry> 1721555991fdSmrg <term><parameter>sms_conn</parameter></term> 1722555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1723555991fdSmrg </varlistentry> 1724555991fdSmrg <varlistentry> 1725555991fdSmrg <term><parameter>manager_data</parameter></term> 1726555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1727555991fdSmrg </varlistentry> 1728555991fdSmrg <varlistentry> 1729555991fdSmrg <term><parameter>previous_id</parameter></term> 1730555991fdSmrg <listitem><para>The client ID from the previous session.</para></listitem> 1731555991fdSmrg </varlistentry> 1732555991fdSmrg</variablelist> 1733555991fdSmrg 1734555991fdSmrg <para> 1735555991fdSmrgBefore any further interaction takes place with the client, the client 1736555991fdSmrgmust be registered with the session manager. 1737555991fdSmrg </para> 1738555991fdSmrg 1739555991fdSmrg <para> 1740555991fdSmrgIf the client is being restarted from a previous session, 1741555991fdSmrg<parameter>previous_id</parameter> will contain a null-terminated string 1742555991fdSmrgrepresenting the client ID from the previous session. 1743555991fdSmrgCall <function>free</function> on the <parameter>previous_id</parameter> 1744555991fdSmrgpointer when it is no longer needed. If the client is first joining the 1745555991fdSmrgsession, <parameter>previous_id</parameter> will be <constant>NULL</constant>. 1746555991fdSmrg </para> 1747555991fdSmrg 1748555991fdSmrg <para> 1749555991fdSmrgIf <parameter>previous_id</parameter> is invalid, the session manager should 1750555991fdSmrgnot register the client at this time. This callback should return a status 1751555991fdSmrgof zero, which will cause an error message to be sent to the client. The 1752555991fdSmrgclient should re-register with previous_id set to <constant>NULL</constant>. 1753555991fdSmrg </para> 1754555991fdSmrg 1755555991fdSmrg <para> 1756555991fdSmrgOtherwise, the session manager should register the client with a unique 17573c15da26Smrgclient ID by calling the <xref linkend='SmsRegisterClientReply' xrefstyle='select: title'/> 1758555991fdSmrgfunction (to be discussed shortly), and the 17593c15da26Smrg<xref linkend='SmsRegisterClientProc' xrefstyle='select: title'/> callback should return a 1760555991fdSmrgstatus of one. 1761555991fdSmrg </para> 1762555991fdSmrg </sect2> 1763555991fdSmrg 17643c15da26Smrg <sect2 id='The_Interact_Request_Callback'> 17653c15da26Smrg<title>The Interact Request Callback</title> 1766555991fdSmrg 1767555991fdSmrg <para> 1768555991fdSmrgThe Interact Request callback is of 17693c15da26Smrgtype <xref linkend='SmsInteractRequestProc' xrefstyle='select: title'/> 1770555991fdSmrg </para> 1771555991fdSmrg 17723c15da26Smrg<funcsynopsis id='SmsInteractRequestProc'> 1773555991fdSmrg <funcprototype> 1774555991fdSmrg <funcdef>typedef void (*<function>SmsInteractRequestProc</function>)</funcdef> 1775555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1776555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1777555991fdSmrg <paramdef>int <parameter>dialog_type</parameter></paramdef> 1778555991fdSmrg </funcprototype> 1779555991fdSmrg</funcsynopsis> 1780555991fdSmrg 1781555991fdSmrg<variablelist remap='IP'> 1782555991fdSmrg <varlistentry> 1783555991fdSmrg <term><parameter>sms_conn</parameter></term> 1784555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1785555991fdSmrg </varlistentry> 1786555991fdSmrg <varlistentry> 1787555991fdSmrg <term><parameter>manager_data</parameter></term> 1788555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1789555991fdSmrg </varlistentry> 1790555991fdSmrg <varlistentry> 1791555991fdSmrg <term><parameter>dialog_type</parameter></term> 1792555991fdSmrg <listitem><para>The type of dialog the client wishes to present to the user.</para></listitem> 1793555991fdSmrg </varlistentry> 1794555991fdSmrg</variablelist> 1795555991fdSmrg 1796555991fdSmrg <para> 1797555991fdSmrgWhen a client receives a “Save Yourself” message with an 1798555991fdSmrg<parameter>interact_style</parameter> of 1799555991fdSmrg<constant>SmInteractStyleErrors</constant> 1800555991fdSmrgor <constant>SmInteractStyleAny</constant> the client may choose to 1801555991fdSmrginteract with the user. Because only one client can interact with the 1802555991fdSmrguser at a time, the client must request to interact with the user. 1803555991fdSmrgThe session manager should keep a queue of all clients wishing to 1804555991fdSmrginteract. It should send an “Interact” message to one 1805555991fdSmrgclient at a time and wait for an “Interact Done” message 1806555991fdSmrgbefore continuing with the next client. 1807555991fdSmrg </para> 1808555991fdSmrg 1809555991fdSmrg <para> 1810555991fdSmrgThe <parameter>dialog_type</parameter> argument specifies 1811555991fdSmrgeither <constant>SmDialogError</constant> indicating that the client 1812555991fdSmrgwants to start an error dialog, or <constant>SmDialogNormal</constant> 1813555991fdSmrgmeaning that the client wishes to start a nonerror dialog. 1814555991fdSmrg </para> 1815555991fdSmrg 1816555991fdSmrg <para> 1817555991fdSmrgIf a shutdown is in progress, the user may have the option of 1818555991fdSmrgcancelling the shutdown. If the shutdown is cancelled (specified in 1819555991fdSmrgthe “Interact Done” message), the session manager should 1820555991fdSmrgsend a “Shutdown Cancelled” message to each client that 1821555991fdSmrgrequested to interact. 1822555991fdSmrg </para> 1823555991fdSmrg </sect2> 1824555991fdSmrg 18253c15da26Smrg <sect2 id='The_Interact_Done_Callback'> 18263c15da26Smrg<title>The Interact Done Callback</title> 1827555991fdSmrg 1828555991fdSmrg <para> 1829555991fdSmrgWhen the client is done interacting with the user, 18303c15da26Smrgthe <xref linkend='SmsInteractDoneProc' xrefstyle='select: title'/> callback will be invoked. 1831555991fdSmrg </para> 1832555991fdSmrg 18333c15da26Smrg<funcsynopsis id='SmsInteractDoneProc'> 1834555991fdSmrg <funcprototype> 1835555991fdSmrg <funcdef>typedef void (*<function>SmsInteractDoneProc</function>)</funcdef> 1836555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1837555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1838555991fdSmrg <paramdef>Bool <parameter>cancel_shutdown</parameter></paramdef> 1839555991fdSmrg </funcprototype> 1840555991fdSmrg</funcsynopsis> 1841555991fdSmrg 1842555991fdSmrg<variablelist remap='IP'> 1843555991fdSmrg <varlistentry> 1844555991fdSmrg <term><parameter>sms_conn</parameter></term> 1845555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1846555991fdSmrg </varlistentry> 1847555991fdSmrg <varlistentry> 1848555991fdSmrg <term><parameter>manager_data</parameter></term> 1849555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1850555991fdSmrg </varlistentry> 1851555991fdSmrg <varlistentry> 1852555991fdSmrg <term><parameter>cancel_shutdown</parameter></term> 1853555991fdSmrg <listitem><para>Specifies if the user requests that the entire shutdown be cancelled.</para></listitem> 1854555991fdSmrg </varlistentry> 1855555991fdSmrg</variablelist> 1856555991fdSmrg 1857555991fdSmrg <para> 1858555991fdSmrgNote that the shutdown can be cancelled only if the corresponding 1859555991fdSmrg“Save Yourself” specified <constant>True</constant> for 1860555991fdSmrgshutdown and <constant>SmInteractStyleErrors</constant> 1861555991fdSmrgor <constant>SmInteractStyleAny</constant> for the 1862555991fdSmrg<parameter>interact_style</parameter>. 1863555991fdSmrg </para> 1864555991fdSmrg </sect2> 1865555991fdSmrg 1866555991fdSmrg 18673c15da26Smrg <sect2 id='The_Save_Yourself_Request_Callback'> 18683c15da26Smrg<title>The Save Yourself Request Callback</title> 1869555991fdSmrg 1870555991fdSmrg <para> 1871555991fdSmrgThe Save Yourself Request callback is of 1872555991fdSmrgtype <function>SmsSaveYourselfRequestProc</function> 1873555991fdSmrg </para> 1874555991fdSmrg 18753c15da26Smrg<funcsynopsis id='SaveYourselfRequestProc'> 1876555991fdSmrg <funcprototype> 1877555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfRequestProc</function>)</funcdef> 1878555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1879555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1880555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 1881555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 1882555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 1883555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 1884555991fdSmrg <paramdef>Bool <parameter>global</parameter></paramdef> 1885555991fdSmrg </funcprototype> 1886555991fdSmrg</funcsynopsis> 1887555991fdSmrg 1888555991fdSmrg<variablelist remap='IP'> 1889555991fdSmrg <varlistentry> 1890555991fdSmrg <term><parameter>sms_conn</parameter></term> 1891555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1892555991fdSmrg </varlistentry> 1893555991fdSmrg <varlistentry> 1894555991fdSmrg <term><parameter>manager_data</parameter></term> 1895555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1896555991fdSmrg </varlistentry> 1897555991fdSmrg <varlistentry> 1898555991fdSmrg <term><parameter>save_type</parameter></term> 1899555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 1900555991fdSmrg </varlistentry> 1901555991fdSmrg <varlistentry> 1902555991fdSmrg <term><parameter>shutdown</parameter></term> 1903555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 1904555991fdSmrg </varlistentry> 1905555991fdSmrg <varlistentry> 1906555991fdSmrg <term><parameter>interact_style</parameter></term> 1907555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 1908555991fdSmrg </varlistentry> 1909555991fdSmrg <varlistentry> 1910555991fdSmrg <term><parameter>fast</parameter></term> 1911555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 1912555991fdSmrg </varlistentry> 1913555991fdSmrg <varlistentry> 1914555991fdSmrg <term><parameter>global</parameter></term> 1915555991fdSmrg <listitem><para>Controls who gets the “Save Yourself.”</para></listitem> 1916555991fdSmrg </varlistentry> 1917555991fdSmrg</variablelist> 1918555991fdSmrg 1919555991fdSmrg <para> 1920555991fdSmrgThe Save Yourself Request prompts the session manager to initiate a 1921555991fdSmrgcheckpoint or shutdown. For information on the 1922555991fdSmrg<parameter>save_type</parameter>, <parameter>shutdown</parameter>, 1923555991fdSmrg<parameter>interact_style</parameter>, and <parameter>fast</parameter> 19243c15da26Smrgarguments, see <link linkend='Sending_a_Save_Yourself_Message'>section 6.3, 1925555991fdSmrg“Sending a Save Yourself Message.”</link> 1926555991fdSmrg </para> 1927555991fdSmrg 1928555991fdSmrg <para> 1929555991fdSmrgIf <parameter>global</parameter> is set to <constant>True</constant> then the 1930555991fdSmrgresulting “Save Yourself” should be sent to all applications. 1931555991fdSmrgIf <parameter>global</parameter> is set to <constant>False</constant> then the 1932555991fdSmrg“Save Yourself” should only be sent to the client that requested it. 1933555991fdSmrg </para> 1934555991fdSmrg </sect2> 1935555991fdSmrg 19363c15da26Smrg <sect2 id='The_Save_Yourself_Phase_2_Request_Callback'> 19373c15da26Smrg<title>The Save Yourself Phase 2 Request Callback</title> 1938555991fdSmrg 1939555991fdSmrg <para> 1940555991fdSmrgThe Save Yourself Phase 2 Request callback is of 19413c15da26Smrgtype <xref linkend='SmsSaveYourselfPhase2RequestProc' xrefstyle='select: title'/> 1942555991fdSmrg </para> 1943555991fdSmrg 19443c15da26Smrg<funcsynopsis id='SmsSaveYourselfPhase2RequestProc'> 1945555991fdSmrg <funcprototype> 1946555991fdSmrg <funcdef>typedef void (*<function>SmsSaveYourselfPhase2RequestProc</function>)</funcdef> 1947555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1948555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1949555991fdSmrg </funcprototype> 1950555991fdSmrg</funcsynopsis> 1951555991fdSmrg 1952555991fdSmrg<variablelist remap='IP'> 1953555991fdSmrg <varlistentry> 1954555991fdSmrg <term><parameter>sms_conn</parameter></term> 1955555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1956555991fdSmrg </varlistentry> 1957555991fdSmrg <varlistentry> 1958555991fdSmrg <term><parameter>manager_data</parameter></term> 1959555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1960555991fdSmrg </varlistentry> 1961555991fdSmrg</variablelist> 1962555991fdSmrg 1963555991fdSmrg <para> 1964555991fdSmrgThis request is sent by clients that manage other clients (for 1965555991fdSmrgexample, window managers, workspace managers, and so on). Such 1966555991fdSmrgmanagers must make sure that all of the clients that are being managed 1967555991fdSmrgare in an idle state so that their state can be saved. 1968555991fdSmrg </para> 1969555991fdSmrg </sect2> 1970555991fdSmrg 19713c15da26Smrg <sect2 id='The_Save_Yourself_Done_Callback'> 19723c15da26Smrg<title>The Save Yourself Done Callback</title> 1973555991fdSmrg 1974555991fdSmrg <para> 1975555991fdSmrgWhen the client is done saving its state in response to a 1976555991fdSmrg“Save Yourself” message, 1977555991fdSmrgthe <function>SmsSaveYourselfDoneProc</function> will be invoked. 1978555991fdSmrg </para> 1979555991fdSmrg 19803c15da26Smrg<funcsynopsis id='SaveYourselfDoneProc'> 1981555991fdSmrg <funcprototype> 1982555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfDoneProc</function>)</funcdef> 1983555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1984555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1985555991fdSmrg <paramdef>Bool <parameter>success</parameter></paramdef> 1986555991fdSmrg </funcprototype> 1987555991fdSmrg</funcsynopsis> 1988555991fdSmrg 1989555991fdSmrg<variablelist remap='IP'> 1990555991fdSmrg <varlistentry> 1991555991fdSmrg <term><parameter>sms_conn</parameter></term> 1992555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1993555991fdSmrg </varlistentry> 1994555991fdSmrg <varlistentry> 1995555991fdSmrg <term><parameter>manager_data</parameter></term> 1996555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1997555991fdSmrg </varlistentry> 1998555991fdSmrg <varlistentry> 1999555991fdSmrg <term><parameter>success</parameter></term> 2000555991fdSmrg <listitem><para>If <constant>True</constant> the Save Yourself operation was completed successfully.</para></listitem> 2001555991fdSmrg </varlistentry> 2002555991fdSmrg</variablelist> 2003555991fdSmrg 2004555991fdSmrg <para> 2005555991fdSmrgBefore the “Save Yourself Done” was sent, the client must 2006555991fdSmrghave set each required property at least once since it registered with 2007555991fdSmrgthe session manager. 2008555991fdSmrg </para> 2009555991fdSmrg </sect2> 2010555991fdSmrg 20113c15da26Smrg <sect2 id='The_Connection_Closed_Callback'> 20123c15da26Smrg<title>The Connection Closed Callback</title> 2013555991fdSmrg 2014555991fdSmrg <para> 2015555991fdSmrgIf the client properly terminates (that is, it 20163c15da26Smrgcalls <xref linkend='SmcCloseConnection' xrefstyle='select: title'/>, 20173c15da26Smrgthe <xref linkend='SmsCloseConnectionProc' xrefstyle='select: title'/> callback is invoked. 2018555991fdSmrg </para> 2019555991fdSmrg 20203c15da26Smrg<funcsynopsis id='SmsCloseConnectionProc'> 2021555991fdSmrg <funcprototype> 2022555991fdSmrg <funcdef>typedef void (*<function>SmsCloseConnectionProc</function>)</funcdef> 2023555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2024555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2025555991fdSmrg <paramdef>int <parameter>count</parameter></paramdef> 2026555991fdSmrg <paramdef>char **<parameter>reason_msgs</parameter></paramdef> 2027555991fdSmrg </funcprototype> 2028555991fdSmrg</funcsynopsis> 2029555991fdSmrg 2030555991fdSmrg<variablelist remap='IP'> 2031555991fdSmrg <varlistentry> 2032555991fdSmrg <term><parameter>sms_conn</parameter></term> 2033555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2034555991fdSmrg </varlistentry> 2035555991fdSmrg<varlistentry> 2036555991fdSmrg <term><parameter>manager_data</parameter></term> 2037555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2038555991fdSmrg </varlistentry> 2039555991fdSmrg <varlistentry> 2040555991fdSmrg <term><parameter>count</parameter></term> 2041555991fdSmrg <listitem><para>The number of reason messages.</para></listitem> 2042555991fdSmrg </varlistentry> 2043555991fdSmrg <varlistentry> 2044555991fdSmrg <term><parameter>reason_msgs</parameter></term> 2045555991fdSmrg <listitem><para>The reasons for closing the connection.</para></listitem> 2046555991fdSmrg </varlistentry> 2047555991fdSmrg</variablelist> 2048555991fdSmrg 2049555991fdSmrg <para> 2050555991fdSmrgThe <parameter>reason_msgs</parameter> argument will most likely 2051555991fdSmrgbe <constant>NULL</constant> and the <parameter>count</parameter> 2052555991fdSmrgargument zero (0) if resignation is expected by the user. Otherwise, 2053555991fdSmrgit contains a list of null-terminated Compound Text strings 2054555991fdSmrgrepresenting the reason for termination. The session manager should 2055555991fdSmrgdisplay these reason messages to the user. 2056555991fdSmrg </para> 2057555991fdSmrg 2058555991fdSmrg <para> 20593c15da26SmrgCall <xref linkend='SmFreeReasons' xrefstyle='select: title'/> to free the reason messages. 2060555991fdSmrgFor further information, see 20613c15da26Smrg<link linkend='Freeing_Data'>section 8, “Freeing Data”</link> 2062555991fdSmrg </para> 2063555991fdSmrg </sect2> 2064555991fdSmrg 20653c15da26Smrg <sect2 id='The_Set_Properties_Callback'> 20663c15da26Smrg<title>The Set Properties Callback</title> 2067555991fdSmrg 2068555991fdSmrg <para> 2069555991fdSmrgWhen the client sets session management properties, 20703c15da26Smrgthe <xref linkend='SmsSetPropertiesProc' xrefstyle='select: title'/> callback will be invoked. 2071555991fdSmrg </para> 2072555991fdSmrg 20733c15da26Smrg<funcsynopsis id='SmsSetPropertiesProc'> 2074555991fdSmrg <funcprototype> 2075555991fdSmrg <funcdef>typedef void (*<function>SmsSetPropertiesProc</function>)</funcdef> 2076555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2077555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2078555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2079555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 2080555991fdSmrg </funcprototype> 2081555991fdSmrg</funcsynopsis> 2082555991fdSmrg 2083555991fdSmrg<variablelist remap='IP'> 2084555991fdSmrg <varlistentry> 2085555991fdSmrg <term><parameter>sms_conn</parameter></term> 2086555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2087555991fdSmrg </varlistentry> 2088555991fdSmrg <varlistentry> 2089555991fdSmrg <term><parameter>manager_data</parameter></term> 2090555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2091555991fdSmrg </varlistentry> 2092555991fdSmrg <varlistentry> 2093555991fdSmrg <term><parameter>num_props</parameter></term> 2094555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2095555991fdSmrg </varlistentry> 2096555991fdSmrg <varlistentry> 2097555991fdSmrg <term><parameter>props</parameter></term> 2098555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 2099555991fdSmrg </varlistentry> 2100555991fdSmrg</variablelist> 2101555991fdSmrg 2102555991fdSmrg <para> 2103555991fdSmrgThe properties are specified as an array of property pointers. For a 2104555991fdSmrgdescription of session management properties and 2105555991fdSmrgthe <structname>SmProp</structname> structure, 21063c15da26Smrgsee <link linkend='Session_Management_Properties'>section 7, 2107555991fdSmrg“Session Management Properties.”</link> 2108555991fdSmrg </para> 2109555991fdSmrg 2110555991fdSmrg <para> 2111555991fdSmrgPreviously set property values may be over-written. Some properties 2112555991fdSmrghave predefined semantics. The session manager is required to store 2113555991fdSmrgnonpredefined properties. 2114555991fdSmrg </para> 2115555991fdSmrg 2116555991fdSmrg <para> 21173c15da26SmrgTo free each property, use <xref linkend='SmFreeProperty' xrefstyle='select: title'/>. 21183c15da26SmrgFor further information, see <link linkend='Freeing_Data'>section 8, 2119555991fdSmrg“Freeing Data”</link> You should free the actual array of 2120555991fdSmrgpointers with a call to <function>free</function> 2121555991fdSmrg </para> 2122555991fdSmrg </sect2> 2123555991fdSmrg 21243c15da26Smrg <sect2 id='The_Delete_Properties_Callback'> 21253c15da26Smrg<title>The Delete Properties Callback</title> 2126555991fdSmrg 2127555991fdSmrg <para> 2128555991fdSmrgWhen the client deletes session management properties, 21293c15da26Smrgthe <xref linkend='SmsDeletePropertiesProc' xrefstyle='select: title'/> callback will be invoked. 2130555991fdSmrg </para> 2131555991fdSmrg 21323c15da26Smrg<funcsynopsis id='SmsDeletePropertiesProc'> 2133555991fdSmrg <funcprototype> 2134555991fdSmrg <funcdef>typedef void (*<function>SmsDeletePropertiesProc</function>)</funcdef> 2135555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2136555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2137555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2138555991fdSmrg <paramdef>char **<parameter>prop_names</parameter></paramdef> 2139555991fdSmrg </funcprototype> 2140555991fdSmrg</funcsynopsis> 2141555991fdSmrg 2142555991fdSmrg<variablelist remap='IP'> 2143555991fdSmrg <varlistentry> 2144555991fdSmrg <term><parameter>sms_conn</parameter></term> 2145555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2146555991fdSmrg </varlistentry> 2147555991fdSmrg <varlistentry> 2148555991fdSmrg <term><parameter>manager_data</parameter></term> 2149555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2150555991fdSmrg </varlistentry> 2151555991fdSmrg <varlistentry> 2152555991fdSmrg <term><parameter>num_props</parameter></term> 2153555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2154555991fdSmrg </varlistentry> 2155555991fdSmrg <varlistentry> 2156555991fdSmrg <term><parameter>prop_names</parameter></term> 2157555991fdSmrg <listitem><para>The list of properties to delete.</para></listitem> 2158555991fdSmrg </varlistentry> 2159555991fdSmrg</variablelist> 2160555991fdSmrg 2161555991fdSmrg <para> 2162555991fdSmrgThe properties are specified as an array of strings. For a 2163555991fdSmrgdescription of session management properties and 2164555991fdSmrgthe <structname>SmProp</structname> structure, 21653c15da26Smrgsee <link linkend='Session_Management_Properties'>section 7, 2166555991fdSmrg“Session Management Properties.”</link> 2167555991fdSmrg </para> 2168555991fdSmrg </sect2> 2169555991fdSmrg 21703c15da26Smrg <sect2 id='The_Get_Properties_Callback'> 21713c15da26Smrg<title>The Get Properties Callback</title> 2172555991fdSmrg 2173555991fdSmrg <para> 21743c15da26SmrgThe <xref linkend='SmsGetPropertiesProc' xrefstyle='select: title'/> callback is invoked when 2175555991fdSmrgthe client wants to retrieve properties it set. 2176555991fdSmrg </para> 2177555991fdSmrg 21783c15da26Smrg<funcsynopsis id='SmsGetPropertiesProc'> 2179555991fdSmrg <funcprototype> 2180555991fdSmrg <funcdef>typedef void (*<function>SmsGetPropertiesProc</function>)</funcdef> 2181555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2182555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2183555991fdSmrg </funcprototype> 2184555991fdSmrg</funcsynopsis> 2185555991fdSmrg 2186555991fdSmrg<variablelist remap='IP'> 2187555991fdSmrg <varlistentry> 2188555991fdSmrg <term><parameter>sms_conn</parameter></term> 2189555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2190555991fdSmrg </varlistentry> 2191555991fdSmrg <varlistentry> 2192555991fdSmrg <term><parameter>manager_data</parameter></term> 2193555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2194555991fdSmrg </varlistentry> 2195555991fdSmrg</variablelist> 2196555991fdSmrg 2197555991fdSmrg <para> 2198555991fdSmrgThe session manager should respond by 21993c15da26Smrgcalling <xref linkend='SmsReturnProperties' xrefstyle='select: title'/>. 2200555991fdSmrgAll of the properties set for this client should be returned. 2201555991fdSmrg </para> 2202555991fdSmrg </sect2> 2203555991fdSmrg </sect1> 2204555991fdSmrg 22053c15da26Smrg <sect1 id='Registering_the_Client'> 22063c15da26Smrg<title>Registering the Client</title> 2207555991fdSmrg 2208555991fdSmrg <para> 2209555991fdSmrgTo register a client (in response to 22103c15da26Smrga <xref linkend='SmsRegisterClientProc' xrefstyle='select: title'/> callback), 22113c15da26Smrguse <xref linkend='SmsRegisterClientReply' xrefstyle='select: title'/>. 2212555991fdSmrg </para> 2213555991fdSmrg 22143c15da26Smrg<funcsynopsis id='SmsRegisterClientReply'> 2215555991fdSmrg <funcprototype> 2216555991fdSmrg <funcdef>Status <function>SmsRegisterClientReply</function></funcdef> 2217555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2218555991fdSmrg <paramdef>char *<parameter>client_id</parameter></paramdef> 2219555991fdSmrg </funcprototype> 2220555991fdSmrg</funcsynopsis> 2221555991fdSmrg 2222555991fdSmrg<variablelist remap='IP'> 2223555991fdSmrg <varlistentry> 2224555991fdSmrg <term><parameter>sms_conn</parameter></term> 2225555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2226555991fdSmrg </varlistentry> 2227555991fdSmrg <varlistentry> 2228555991fdSmrg <term><parameter>client_id</parameter></term> 2229555991fdSmrg <listitem><para>A null-terminated string representing a unique client ID.</para></listitem> 2230555991fdSmrg </varlistentry> 2231555991fdSmrg</variablelist> 2232555991fdSmrg 2233555991fdSmrg <para> 22343c15da26SmrgThe return value of <xref linkend='SmsRegisterClientReply' xrefstyle='select: title'/> is 2235555991fdSmrgzero for failure and a positive value for success. Failure will occur 2236555991fdSmrgif SMlib can not allocate memory to hold a copy of the client ID for 2237555991fdSmrgit's own internal needs. 2238555991fdSmrg </para> 2239555991fdSmrg 2240555991fdSmrg <para> 2241555991fdSmrgIf a non-<constant>NULL</constant> <parameter>previous_id</parameter> was 2242555991fdSmrgspecified when the client registered itself, <parameter>client_id</parameter> 2243555991fdSmrgshould be identical to <parameter>previous_id</parameter>. 2244555991fdSmrg </para> 2245555991fdSmrg 2246555991fdSmrg <para> 2247555991fdSmrgOtherwise, <parameter>client_id</parameter> should be a unique ID freshly 2248555991fdSmrggenerated by the session manager. In addition, the session manager should 2249555991fdSmrgsend a “Save Yourself” message with 2250555991fdSmrg<parameter>type</parameter> = <constant>Local</constant>, 2251555991fdSmrg<parameter>shutdown</parameter> = <constant>False</constant>, 2252555991fdSmrg<parameter>interact-style</parameter> = <constant>None</constant>, 2253555991fdSmrgand <parameter>fast</parameter> = <constant>False</constant> 2254555991fdSmrgimmediately after registering the client. 2255555991fdSmrg </para> 2256555991fdSmrg 2257555991fdSmrg <para> 2258555991fdSmrgNote that once a client ID has been assigned to the client, the client 2259555991fdSmrgkeeps this ID indefinitely. If the client is terminated and 2260555991fdSmrgrestarted, it will be reassigned the same ID. It is desirable to be 2261555991fdSmrgable to pass client IDs around from machine to machine, from user to 2262555991fdSmrguser, and from session manager to session manager, while retaining the 2263555991fdSmrgidentity of the client. This, combined with the indefinite 2264555991fdSmrgpersistence of client IDs, means that client IDs need to be globally 2265555991fdSmrgunique. 2266555991fdSmrg </para> 2267555991fdSmrg 2268555991fdSmrg <para> 22693c15da26SmrgYou should call the <xref linkend='SmsGenerateClientID' xrefstyle='select: title'/> function 2270555991fdSmrgto generate a globally unique client ID. 2271555991fdSmrg </para> 2272555991fdSmrg 22733c15da26Smrg<funcsynopsis id='SmsGenerateClientID'> 2274555991fdSmrg <funcprototype> 2275555991fdSmrg <funcdef>char *<function>SmsGenerateClientID</function></funcdef> 2276555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2277555991fdSmrg </funcprototype> 2278555991fdSmrg</funcsynopsis> 2279555991fdSmrg 2280555991fdSmrg<variablelist remap='IP'> 2281555991fdSmrg <varlistentry> 2282555991fdSmrg <term><parameter>sms_conn</parameter></term> 2283555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2284555991fdSmrg </varlistentry> 2285555991fdSmrg</variablelist> 2286555991fdSmrg 2287555991fdSmrg 2288555991fdSmrg <para> 2289555991fdSmrg<constant>NULL</constant> will be returned if the ID could not be generated. 2290555991fdSmrgOtherwise, the return value of the function is the client ID. 2291555991fdSmrgIt should be freed with a call to <function>free</function> when 2292555991fdSmrgno longer needed. 2293555991fdSmrg </para> 2294555991fdSmrg </sect1> 2295555991fdSmrg 22963c15da26Smrg <sect1 id='Sending_a_Save_Yourself_Message'> 22973c15da26Smrg<title>Sending a Save Yourself Message</title> 2298555991fdSmrg 2299555991fdSmrg <para> 2300555991fdSmrgTo send a “Save Yourself” to a client, 23013c15da26Smrguse <xref linkend='SmsSaveYourself' xrefstyle='select: title'/>. 2302555991fdSmrg </para> 2303555991fdSmrg 23043c15da26Smrg<funcsynopsis id='SmsSaveYourself'> 2305555991fdSmrg <funcprototype> 2306555991fdSmrg <funcdef>void <function>SmsSaveYourself</function></funcdef> 2307555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2308555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 2309555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 2310555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 2311555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 2312555991fdSmrg </funcprototype> 2313555991fdSmrg</funcsynopsis> 2314555991fdSmrg 2315555991fdSmrg<variablelist remap='IP'> 2316555991fdSmrg <varlistentry> 2317555991fdSmrg <term><parameter>sms_conn</parameter></term> 2318555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2319555991fdSmrg </varlistentry> 2320555991fdSmrg <varlistentry> 2321555991fdSmrg <term><parameter>save_type</parameter></term> 2322555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 2323555991fdSmrg </varlistentry> 2324555991fdSmrg <varlistentry> 2325555991fdSmrg <term><parameter>shutdown</parameter></term> 2326555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 2327555991fdSmrg </varlistentry> 2328555991fdSmrg <varlistentry> 2329555991fdSmrg <term><parameter>interact_style</parameter></term> 2330555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 2331555991fdSmrg </varlistentry> 2332555991fdSmrg <varlistentry> 2333555991fdSmrg <term><parameter>fast</parameter></term> 2334555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 2335555991fdSmrg </varlistentry> 2336555991fdSmrg</variablelist> 2337555991fdSmrg 2338555991fdSmrg 2339555991fdSmrg <para> 2340555991fdSmrgThe session manager sends a “Save Yourself” message to a 2341555991fdSmrgclient either to checkpoint it or just before termination so that it 2342555991fdSmrgcan save its state. The client responds with zero or more “Set 2343555991fdSmrgProperties” messages to update the properties indicating how to 2344555991fdSmrgrestart the client. When all the properties have been set, the client 2345555991fdSmrgsends a “Save Yourself Done” message. 2346555991fdSmrg </para> 2347555991fdSmrg 2348555991fdSmrg <para> 2349555991fdSmrgIf <parameter>interact_style</parameter> 2350555991fdSmrgis <constant>SmInteractStyleNone</constant> the 2351555991fdSmrgclient must not interact with the user while saving state. 2352555991fdSmrgIf <parameter>interact_style</parameter> 2353555991fdSmrgis <constant>SmInteractStyleErrors</constant> the 2354555991fdSmrgclient may interact with the user only if an error condition arises. 2355555991fdSmrgIf <parameter>interact_style</parameter> 2356555991fdSmrgis <constant>SmInteractStyleAny</constant> then the 2357555991fdSmrgclient may interact with the user for any purpose. The client must 2358555991fdSmrgsend an “Interact Request” message and wait for an 2359555991fdSmrg“Interact” message from the session manager before it can 2360555991fdSmrginteract with the user. When the client is done interacting with the 2361555991fdSmrguser, it should send an “Interact Done” message. The 2362555991fdSmrg“Interact Request” message can be sent any time after a 2363555991fdSmrg“Save Yourself” and before a “Save Yourself 2364555991fdSmrgDone.” 2365555991fdSmrg </para> 2366555991fdSmrg 2367555991fdSmrg <para> 2368555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveLocal</constant> 2369555991fdSmrgthe client must update the properties to reflect its current state. 2370555991fdSmrgSpecifically, it should save enough information to restore the state as 2371555991fdSmrgseen by the user of this client. It should not affect the state as seen 2372555991fdSmrgby other users. 2373555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveGlobal</constant> 2374555991fdSmrgthe user wants the client to commit all of its data to permanent, globally 2375555991fdSmrgaccessible storage. 2376555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveBoth</constant> 2377555991fdSmrgthe client should do both of these (it should first commit the data to 2378555991fdSmrgpermanent storage before updating its properties). 2379555991fdSmrg </para> 2380555991fdSmrg 2381555991fdSmrg <para> 2382555991fdSmrgThe <parameter>shutdown</parameter> argument specifies whether the session 2383555991fdSmrgis being shut down. The interaction is different depending on whether or not 2384555991fdSmrgshutdown is set. If not shutting down, then the client can save and 2385555991fdSmrgresume normal operation. If shutting down, the client must save and 2386555991fdSmrgthen must prevent interaction until it receives either a 2387555991fdSmrg“Die” or a “Shutdown Cancelled,” because 2388555991fdSmrganything the user does after the save will be lost. 2389555991fdSmrg </para> 2390555991fdSmrg 2391555991fdSmrg <para> 2392555991fdSmrgThe <parameter>fast</parameter> argument specifies that the client should 2393555991fdSmrgsave its state as quickly as possible. For example, if the session manager 2394555991fdSmrgknows that power is about to fail, it should set <parameter>fast</parameter> 2395555991fdSmrgto <constant>True</constant>. 2396555991fdSmrg </para> 2397555991fdSmrg </sect1> 2398555991fdSmrg 23993c15da26Smrg <sect1 id='Sending_a_Save_Yourself_Phase_2_Message'> 24003c15da26Smrg<title>Sending a Save Yourself Phase 2 Message</title> 2401555991fdSmrg 2402555991fdSmrg <para> 2403555991fdSmrgIn order to send a “Save Yourself Phase 2” message to a 24043c15da26Smrgclient, use <xref linkend='SmsSaveYourselfPhase2' xrefstyle='select: title'/> 2405555991fdSmrg </para> 2406555991fdSmrg 24073c15da26Smrg<funcsynopsis id='SmsSaveYourselfPhase2'> 2408555991fdSmrg <funcprototype> 2409555991fdSmrg <funcdef>void <function>SmsSaveYourselfPhase2</function></funcdef> 2410555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2411555991fdSmrg </funcprototype> 2412555991fdSmrg</funcsynopsis> 2413555991fdSmrg 2414555991fdSmrg<variablelist remap='IP'> 2415555991fdSmrg <varlistentry> 2416555991fdSmrg <term><parameter>sms_conn</parameter></term> 2417555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2418555991fdSmrg </varlistentry> 2419555991fdSmrg</variablelist> 2420555991fdSmrg 2421555991fdSmrg <para> 2422555991fdSmrgThe session manager sends this message to a client that has previously 2423555991fdSmrgsent a “Save Yourself Phase 2 Request” message. This 2424555991fdSmrgmessage informs the client that all other clients are in a fixed state 2425555991fdSmrgand this client can save state that is associated with other clients. 2426555991fdSmrg </para> 2427555991fdSmrg </sect1> 2428555991fdSmrg 24293c15da26Smrg <sect1 id='Sending_an_Interact_Message'> 24303c15da26Smrg<title>Sending an Interact Message</title> 2431555991fdSmrg 2432555991fdSmrg <para> 2433555991fdSmrgTo send an “Interact” message to a client, 24343c15da26Smrguse <xref linkend='SmsInteract' xrefstyle='select: title'/>. 2435555991fdSmrg </para> 2436555991fdSmrg 24373c15da26Smrg<funcsynopsis id='SmsInteract'> 2438555991fdSmrg <funcprototype> 2439555991fdSmrg <funcdef>void <function>SmsInteract</function></funcdef> 2440555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2441555991fdSmrg </funcprototype> 2442555991fdSmrg</funcsynopsis> 2443555991fdSmrg 2444555991fdSmrg<variablelist remap='IP'> 2445555991fdSmrg <varlistentry> 2446555991fdSmrg <term><parameter>sms_conn</parameter></term> 2447555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2448555991fdSmrg </varlistentry> 2449555991fdSmrg</variablelist> 2450555991fdSmrg 2451555991fdSmrg <para> 2452555991fdSmrgThe “Interact” message grants the client the privilege of 2453555991fdSmrginteracting with the user. When the client is done interacting with 2454555991fdSmrgthe user, it must send an “Interact Done” message to the 2455555991fdSmrgsession manager. 2456555991fdSmrg </para> 2457555991fdSmrg </sect1> 2458555991fdSmrg 24593c15da26Smrg <sect1 id='Sending_a_Save_Complete_Message'> 24603c15da26Smrg<title>Sending a Save Complete Message</title> 2461555991fdSmrg 2462555991fdSmrg <para> 2463555991fdSmrgTo send a “Save Complete” message to a client, 24643c15da26Smrguse <xref linkend='SmsSaveComplete' xrefstyle='select: title'/>. 2465555991fdSmrg </para> 2466555991fdSmrg 24673c15da26Smrg<funcsynopsis id='SmsSaveComplete'> 2468555991fdSmrg <funcprototype> 2469555991fdSmrg <funcdef>void <function>SmsSaveComplete</function></funcdef> 2470555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2471555991fdSmrg </funcprototype> 2472555991fdSmrg</funcsynopsis> 2473555991fdSmrg 2474555991fdSmrg<variablelist remap='IP'> 2475555991fdSmrg <varlistentry> 2476555991fdSmrg <term><parameter>sms_conn</parameter></term> 2477555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2478555991fdSmrg </varlistentry> 2479555991fdSmrg</variablelist> 2480555991fdSmrg 2481555991fdSmrg <para> 2482555991fdSmrgThe session manager sends this message when it is done with a 2483555991fdSmrgcheckpoint. The client is then free to change its state. 2484555991fdSmrg </para> 2485555991fdSmrg </sect1> 2486555991fdSmrg 24873c15da26Smrg <sect1 id='Sending_a_Die_Message'> 24883c15da26Smrg<title>Sending a Die Message</title> 2489555991fdSmrg 2490555991fdSmrg <para> 2491555991fdSmrgTo send a “Die” message to a client, 24923c15da26Smrguse <xref linkend='SmsDie' xrefstyle='select: title'/>. 2493555991fdSmrg </para> 2494555991fdSmrg 24953c15da26Smrg<funcsynopsis id='SmsDie'> 2496555991fdSmrg <funcprototype> 2497555991fdSmrg <funcdef>void <function>SmsDie</function></funcdef> 2498555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2499555991fdSmrg </funcprototype> 2500555991fdSmrg</funcsynopsis> 2501555991fdSmrg 2502555991fdSmrg<variablelist remap='IP'> 2503555991fdSmrg <varlistentry> 2504555991fdSmrg <term><parameter>sms_conn</parameter></term> 2505555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2506555991fdSmrg </varlistentry> 2507555991fdSmrg</variablelist> 2508555991fdSmrg 2509555991fdSmrg <para> 2510555991fdSmrgBefore the session manager terminates, it should wait for a 2511555991fdSmrg“Connection Closed” message from each client that it sent 2512555991fdSmrga “Die” message to, timing out appropriately. 2513555991fdSmrg </para> 2514555991fdSmrg </sect1> 2515555991fdSmrg 25163c15da26Smrg <sect1 id='Cancelling_a_Shutdown'> 25173c15da26Smrg<title>Cancelling a Shutdown</title> 2518555991fdSmrg 2519555991fdSmrg <para> 25203c15da26SmrgTo cancel a shutdown, use <xref linkend='SmsShutdownCancelled' xrefstyle='select: title'/>. 2521555991fdSmrg </para> 2522555991fdSmrg 25233c15da26Smrg<funcsynopsis id='SmsShutdownCancelled'> 2524555991fdSmrg <funcprototype> 2525555991fdSmrg <funcdef>void <function>SmsShutdownCancelled</function></funcdef> 2526555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2527555991fdSmrg </funcprototype> 2528555991fdSmrg</funcsynopsis> 2529555991fdSmrg 2530555991fdSmrg<variablelist remap='IP'> 2531555991fdSmrg <varlistentry> 2532555991fdSmrg <term><parameter>sms_conn</parameter></term> 2533555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2534555991fdSmrg </varlistentry> 2535555991fdSmrg</variablelist> 2536555991fdSmrg 2537555991fdSmrg <para> 2538555991fdSmrgThe client can now continue as if the shutdown had never happened. If 2539555991fdSmrgthe client has not sent a “Save Yourself Done” message 2540555991fdSmrgyet, it can either abort the save and send a “Save Yourself 2541555991fdSmrgDone” with the success argument set to <constant>False</constant> 2542555991fdSmrgor it can continue with the save and send a “Save Yourself Done” 2543555991fdSmrgwith the <parameter>success</parameter> argument set to reflect the outcome 2544555991fdSmrgof the save. 2545555991fdSmrg </para> 2546555991fdSmrg </sect1> 2547555991fdSmrg<!-- aaaaaaaaaaaaaaaaa --> 2548555991fdSmrg 25493c15da26Smrg <sect1 id='Returning_Properties'> 25503c15da26Smrg<title>Returning Properties</title> 2551555991fdSmrg 2552555991fdSmrg <para> 2553555991fdSmrgIn response to a “Get Properties” message, the session 25543c15da26Smrgmanager should call <xref linkend='SmsReturnProperties' xrefstyle='select: title'/>. 2555555991fdSmrg </para> 2556555991fdSmrg 25573c15da26Smrg<funcsynopsis id='SmsReturnProperties'> 2558555991fdSmrg <funcprototype> 2559555991fdSmrg <funcdef>void <function>SmsReturnProperties</function></funcdef> 2560555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2561555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2562555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 2563555991fdSmrg </funcprototype> 2564555991fdSmrg</funcsynopsis> 2565555991fdSmrg 2566555991fdSmrg<variablelist remap='IP'> 2567555991fdSmrg <varlistentry> 2568555991fdSmrg <term><parameter>sms_conn</parameter></term> 2569555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2570555991fdSmrg </varlistentry> 2571555991fdSmrg <varlistentry> 2572555991fdSmrg <term><parameter>num_props</parameter></term> 2573555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2574555991fdSmrg </varlistentry> 2575555991fdSmrg <varlistentry> 2576555991fdSmrg <term><parameter>props</parameter></term> 2577555991fdSmrg <listitem><para>The list of properties to return to the client.</para></listitem> 2578555991fdSmrg </varlistentry> 2579555991fdSmrg</variablelist> 2580555991fdSmrg 2581555991fdSmrg <para> 2582555991fdSmrgThe properties are returned as an array of property pointers. For a 2583555991fdSmrgdescription of session management properties and 2584555991fdSmrgthe <structname>SmProp</structname> structure, 25853c15da26Smrgsee <link linkend='Session_Management_Properties'>section 7, 2586555991fdSmrg“Session Management Properties.”</link> 2587555991fdSmrg </para> 2588555991fdSmrg </sect1> 2589555991fdSmrg 25903c15da26Smrg <sect1 id='Pinging_a_Client'> 25913c15da26Smrg<title>Pinging a Client</title> 2592555991fdSmrg 2593555991fdSmrg <para> 2594555991fdSmrgTo check that a client is still alive, you should use 25953c15da26Smrgthe <olink targetdoc='ICElib' targetptr='IcePing'><function>IcePing</function></olink> function provided by the ICE library. 2596555991fdSmrgTo do so, the ICE connection must be obtained using 25973c15da26Smrgthe <xref linkend='SmsGetIceConnection' xrefstyle='select: title'/> 25983c15da26Smrg(see <link linkend='Using_Sms_Informational_Functions'>section 6.12, 2599555991fdSmrg“Using Sms Informational Functions”</link>). 2600555991fdSmrg </para> 2601555991fdSmrg 2602555991fdSmrg 26033c15da26Smrg<funcsynopsis id='IcePing'> 2604555991fdSmrg <funcprototype> 2605555991fdSmrg <funcdef>void <function>IcePing</function></funcdef> 2606555991fdSmrg <paramdef>IceConn <parameter>ice_conn</parameter></paramdef> 2607555991fdSmrg <paramdef>IcePingReplyProc <parameter>ping_reply_proc</parameter></paramdef> 2608555991fdSmrg <paramdef>IcePointer <parameter>client_data</parameter></paramdef> 2609555991fdSmrg </funcprototype> 2610555991fdSmrg</funcsynopsis> 2611555991fdSmrg 2612555991fdSmrg<variablelist remap='IP'> 2613555991fdSmrg <varlistentry> 2614555991fdSmrg <term><parameter>ice_conn</parameter></term> 2615555991fdSmrg <listitem><para>A valid ICE connection object.</para></listitem> 2616555991fdSmrg </varlistentry> 2617555991fdSmrg <varlistentry> 2618555991fdSmrg <term><parameter>ping_reply_proc</parameter></term> 2619555991fdSmrg <listitem><para>The callback to invoke when the Ping reply arrives.</para></listitem> 2620555991fdSmrg </varlistentry> 2621555991fdSmrg <varlistentry> 2622555991fdSmrg <term><parameter>client_data</parameter></term> 26233c15da26Smrg <listitem><para>This pointer will be passed to the <xref linkend='IcePingReplyProc' xrefstyle='select: title'/> callback.</para></listitem> 2624555991fdSmrg </varlistentry> 2625555991fdSmrg</variablelist> 2626555991fdSmrg 2627555991fdSmrg 2628555991fdSmrg <para> 2629555991fdSmrgWhen the Ping reply is ready (if ever), 26303c15da26Smrgthe <xref linkend='IcePingReplyProc' xrefstyle='select: title'/> callback will be invoked. A 2631555991fdSmrgsession manager should have some sort of timeout period, after which 2632555991fdSmrgit assumes the client has unexpectedly died. 2633555991fdSmrg </para> 2634555991fdSmrg 26353c15da26Smrg<funcsynopsis id='IcePingReplyProc'> 2636555991fdSmrg <funcprototype> 2637555991fdSmrg <funcdef>typedef void (*<function>IcePingReplyProc</function>)</funcdef> 2638555991fdSmrg <paramdef>IceConn <parameter>ice_conn</parameter></paramdef> 2639555991fdSmrg <paramdef>IcePointer <parameter>client_data</parameter></paramdef> 2640555991fdSmrg </funcprototype> 2641555991fdSmrg</funcsynopsis> 2642555991fdSmrg 2643555991fdSmrg<variablelist remap='IP'> 2644555991fdSmrg <varlistentry> 2645555991fdSmrg <term><parameter>ice_conn</parameter></term> 2646555991fdSmrg <listitem><para>A valid ICE connection object.</para></listitem> 2647555991fdSmrg </varlistentry> 2648555991fdSmrg <varlistentry> 2649555991fdSmrg <term><parameter>client_data</parameter></term> 26503c15da26Smrg <listitem><para>The client data specified in the call to <olink targetdoc='ICElib' targetptr='IcePing'><function>IcePing</function></olink></para></listitem> 2651555991fdSmrg </varlistentry> 2652555991fdSmrg</variablelist> 2653555991fdSmrg 2654555991fdSmrg </sect1> 2655555991fdSmrg 26563c15da26Smrg <sect1 id='Cleaning_Up_After_a_Client_Disconnects'> 26573c15da26Smrg<title>Cleaning Up After a Client Disconnects</title> 2658555991fdSmrg 2659555991fdSmrg <para> 2660555991fdSmrgWhen the session manager receives a “Connection Closed” 2661555991fdSmrgmessage or otherwise detects that the client aborted the connection, 26623c15da26Smrgit should call the <xref linkend='SmsCleanUp' xrefstyle='select: title'/> function in order 2663555991fdSmrgto free up the connection object. 2664555991fdSmrg </para> 2665555991fdSmrg 26663c15da26Smrg<funcsynopsis id='SmsCleanUp'> 2667555991fdSmrg <funcprototype> 2668555991fdSmrg <funcdef>void <function>SmsCleanUp</function></funcdef> 2669555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2670555991fdSmrg </funcprototype> 2671555991fdSmrg</funcsynopsis> 2672555991fdSmrg 2673555991fdSmrg<variablelist remap='IP'> 2674555991fdSmrg <varlistentry> 2675555991fdSmrg <term><parameter>sms_conn</parameter></term> 2676555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2677555991fdSmrg </varlistentry> 2678555991fdSmrg</variablelist> 2679555991fdSmrg 2680555991fdSmrg </sect1> 2681555991fdSmrg 26823c15da26Smrg <sect1 id='Using_Sms_Informational_Functions'> 26833c15da26Smrg<title>Using Sms Informational Functions</title> 2684555991fdSmrg 26853c15da26Smrg<funcsynopsis id='SmsProtocolVersion'> 2686555991fdSmrg <funcprototype> 2687555991fdSmrg <funcdef>int <function>SmsProtocolVersion</function></funcdef> 2688555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2689555991fdSmrg </funcprototype> 2690555991fdSmrg</funcsynopsis> 2691555991fdSmrg 2692555991fdSmrg <para> 26933c15da26Smrg<xref linkend='SmsProtocolVersion' xrefstyle='select: title'/> returns the major version of 2694555991fdSmrgthe session management protocol associated with this session. 2695555991fdSmrg </para> 2696555991fdSmrg 26973c15da26Smrg<funcsynopsis id='SmsProtocolRevision'> 2698555991fdSmrg <funcprototype> 2699555991fdSmrg <funcdef>int <function>SmsProtocolRevision</function></funcdef> 2700555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2701555991fdSmrg </funcprototype> 2702555991fdSmrg</funcsynopsis> 2703555991fdSmrg 2704555991fdSmrg <para> 27053c15da26Smrg<xref linkend='SmsProtocolRevision' xrefstyle='select: title'/> returns the minor version of 2706555991fdSmrgthe session management protocol associated with this session. 2707555991fdSmrg </para> 2708555991fdSmrg 27093c15da26Smrg<funcsynopsis id='SmsClientID'> 2710555991fdSmrg <funcprototype> 2711555991fdSmrg <funcdef>char *<function>SmsClientID</function></funcdef> 2712555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2713555991fdSmrg </funcprototype> 2714555991fdSmrg</funcsynopsis> 2715555991fdSmrg 2716555991fdSmrg <para> 27173c15da26Smrg<xref linkend='SmsClientID' xrefstyle='select: title'/> returns a null-terminated string for 2718555991fdSmrgthe client ID associated with this connection. You should 2719555991fdSmrgcall <function>free</function> on this pointer when the client ID is 2720555991fdSmrgno longer needed. 2721555991fdSmrg </para> 2722555991fdSmrg 2723555991fdSmrg 2724555991fdSmrg <para> 2725555991fdSmrgTo obtain the host name of a client, 27263c15da26Smrguse <xref linkend='SmsClientHostName' xrefstyle='select: title'/>. 2727555991fdSmrgThis host name will be needed to restart the client. 2728555991fdSmrg </para> 2729555991fdSmrg 27303c15da26Smrg<funcsynopsis id='SmsClientHostName'> 2731555991fdSmrg <funcprototype> 2732555991fdSmrg <funcdef>char *<function>SmsClientHostName</function></funcdef> 2733555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2734555991fdSmrg </funcprototype> 2735555991fdSmrg</funcsynopsis> 2736555991fdSmrg 2737555991fdSmrg <para> 2738555991fdSmrgThe string returned is of the form 2739555991fdSmrg<parameter>protocol</parameter><literal>/</literal><parameter>hostname</parameter>, 2740555991fdSmrgwhere <parameter>protocol</parameter> is one of 2741555991fdSmrg{<literal>tcp</literal>, <literal>decnet</literal>, <literal>local</literal>}. 2742555991fdSmrgYou should call <function>free</function> on the string returned when 2743555991fdSmrgit is no longer needed. 2744555991fdSmrg </para> 2745555991fdSmrg 27463c15da26Smrg<funcsynopsis id='SmsGetIceConnection'> 2747555991fdSmrg <funcprototype> 2748555991fdSmrg <funcdef>IceConn <function>SmsGetIceConnection</function></funcdef> 2749555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2750555991fdSmrg </funcprototype> 2751555991fdSmrg</funcsynopsis> 2752555991fdSmrg 2753555991fdSmrg <para> 27543c15da26Smrg<xref linkend='SmsGetIceConnection' xrefstyle='select: title'/> returns the ICE connection 2755555991fdSmrgobject associated with this session management connection object. The 2756555991fdSmrgICE connection object can be used to get some additional information 2757555991fdSmrgabout the connection. Some of the more useful functions which can be 2758555991fdSmrgused on the IceConn are <function>IceConnectionNumber</function> 2759555991fdSmrgand <function>IceLastSequenceNumber</function>. 2760555991fdSmrgFor further information, see the 2761555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 2762555991fdSmrgstandard. 2763555991fdSmrg </para> 2764555991fdSmrg </sect1> 2765555991fdSmrg 27663c15da26Smrg <sect1 id='Error_Handling_2'> 27673c15da26Smrg<title>Error Handling</title> 2768555991fdSmrg 2769555991fdSmrg <para> 2770555991fdSmrgIf the session manager receives an unexpected protocol error from a 2771555991fdSmrgclient, an error handler is invoked by SMlib. A default error handler 2772555991fdSmrgexists which simply prints the error message (it does not exit). The 2773555991fdSmrgsession manager can change this error handler by 27743c15da26Smrgcalling <xref linkend='SmsSetErrorHandler' xrefstyle='select: title'/>. 2775555991fdSmrg </para> 2776555991fdSmrg 27773c15da26Smrg<funcsynopsis id='SmsSetErrorHandler'> 2778555991fdSmrg <funcprototype> 2779555991fdSmrg <funcdef>SmsErrorHandler <function>SmsSetErrorHandler</function></funcdef> 2780555991fdSmrg <paramdef>SmsErrorHandler <parameter>handler</parameter></paramdef> 2781555991fdSmrg </funcprototype> 2782555991fdSmrg</funcsynopsis> 2783555991fdSmrg 2784555991fdSmrg <para> 2785555991fdSmrgThe error handler. You should pass <constant>NULL</constant> 2786555991fdSmrgto restore the default handler. 2787555991fdSmrg </para> 2788555991fdSmrg 2789555991fdSmrg <para> 27903c15da26Smrg<xref linkend='SmsSetErrorHandler' xrefstyle='select: title'/> returns the previous error handler. 27913c15da26SmrgThe <xref linkend='SmsErrorHandler' xrefstyle='select: title'/> has the following type: 2792555991fdSmrg </para> 2793555991fdSmrg 27943c15da26Smrg<funcsynopsis id='SmsErrorHandler'> 2795555991fdSmrg <funcprototype> 2796555991fdSmrg <funcdef>typedef void (*<function>SmsErrorHandler</function>)</funcdef> 2797555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2798555991fdSmrg <paramdef>Bool <parameter>swap</parameter></paramdef> 2799555991fdSmrg <paramdef>int <parameter>offending_minor_opcode</parameter></paramdef> 2800555991fdSmrg <paramdef>unsigned long <parameter>offending_sequence_num</parameter></paramdef> 2801555991fdSmrg <paramdef>int <parameter>error_class</parameter></paramdef> 2802555991fdSmrg <paramdef>int <parameter>severity</parameter></paramdef> 2803555991fdSmrg <paramdef>IcePointer <parameter>values</parameter></paramdef> 2804555991fdSmrg </funcprototype> 2805555991fdSmrg</funcsynopsis> 2806555991fdSmrg 2807555991fdSmrg<variablelist remap='IP'> 2808555991fdSmrg <varlistentry> 2809555991fdSmrg <term><parameter>sms_conn</parameter></term> 2810555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2811555991fdSmrg </varlistentry> 2812555991fdSmrg <varlistentry> 2813555991fdSmrg <term><parameter>swap</parameter></term> 2814555991fdSmrg <listitem><para>A flag which indicates if the specified values need byte swapping.</para></listitem> 2815555991fdSmrg </varlistentry> 2816555991fdSmrg <varlistentry> 2817555991fdSmrg <term><parameter>offending_minor_opcode</parameter></term> 2818555991fdSmrg <listitem><para>The minor opcode of the offending message.</para></listitem> 2819555991fdSmrg </varlistentry> 2820555991fdSmrg <varlistentry> 2821555991fdSmrg <term><parameter>offending_sequence_num</parameter></term> 2822555991fdSmrg <listitem><para>The sequence number of the offending message.</para></listitem> 2823555991fdSmrg </varlistentry> 2824555991fdSmrg <varlistentry> 2825555991fdSmrg <term><parameter>error_class</parameter></term> 2826555991fdSmrg <listitem><para>The error class of the offending message.</para></listitem> 2827555991fdSmrg </varlistentry> 2828555991fdSmrg <varlistentry> 2829555991fdSmrg <term><parameter>severity</parameter></term> 2830555991fdSmrg <listitem><para> 2831555991fdSmrg <constant>IceCanContinue</constant>, 2832555991fdSmrg <constant>IceFatalToProtocol</constant>, or 2833555991fdSmrg <constant>IceFatalToConnection</constant> 2834555991fdSmrg </para></listitem> 2835555991fdSmrg </varlistentry> 2836555991fdSmrg <varlistentry> 2837555991fdSmrg <term><parameter>values</parameter></term> 2838555991fdSmrg <listitem><para>Any additional error values specific to the minor opcode and class.</para></listitem> 2839555991fdSmrg </varlistentry> 2840555991fdSmrg</variablelist> 2841555991fdSmrg 2842555991fdSmrg <para> 2843555991fdSmrgNote that this error handler is invoked for protocol related errors. 2844555991fdSmrgTo install an error handler to be invoked when an IO error occurs, 28453c15da26Smrguse <olink targetdoc='ICElib' targetptr='IceSetIOErrorHandler'><function>IceSetIOErrorHandler</function></olink>. 2846555991fdSmrgFor further information, see the 2847555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 2848555991fdSmrgstandard. 2849555991fdSmrg </para> 2850555991fdSmrg </sect1> 2851555991fdSmrg</chapter> 2852555991fdSmrg 28533c15da26Smrg<chapter id='Session_Management_Properties'> 2854555991fdSmrg <title>Session Management Properties</title> 2855555991fdSmrg 2856555991fdSmrg <para> 2857555991fdSmrgEach property is defined by the <structname>SmProp</structname> structure: 2858555991fdSmrg 2859555991fdSmrg<synopsis> 2860555991fdSmrgtypedef struct { 2861555991fdSmrg char *name; /* name of property */ 2862555991fdSmrg char *type; /* type of property */ 2863555991fdSmrg int num_vals; /* number of values */ 2864555991fdSmrg SmPropValue *vals; /* the list of values */ 2865555991fdSmrg} SmProp; 2866555991fdSmrg 2867555991fdSmrgtypedef struct { 2868555991fdSmrg int length; /* the length of the value */ 2869555991fdSmrg SmPointer value; /* the value */ 2870555991fdSmrg} SmPropValue; 2871555991fdSmrg</synopsis> 2872555991fdSmrg </para> 2873555991fdSmrg 2874555991fdSmrg <para> 2875555991fdSmrgThe X Session Management Protocol defines a list of predefined 2876555991fdSmrgproperties, several of which are required to be set by the client. 2877555991fdSmrgThe following table specifies the predefined properties and indicates 2878555991fdSmrgwhich ones are required. Each property has a type associated with it. 2879555991fdSmrg </para> 2880555991fdSmrg 2881555991fdSmrg <para> 2882555991fdSmrgA type of <type>SmCARD8</type> indicates that there is a single 1-byte value. 2883555991fdSmrgA type of <type>SmARRAY8</type> indicates that there is a single array of bytes. 2884555991fdSmrgA type of <type>SmLISTofARRAY8</type> indicates that there is a list of array of 2885555991fdSmrgbytes. 2886555991fdSmrg </para> 2887555991fdSmrg 28883c15da26Smrg<informaltable pgwide='0' frame='topbot'> 28893c15da26Smrg <tgroup cols='4' align='left' colsep='0' rowsep='0'> 28903c15da26Smrg <colspec colname='c1' colwidth='2.0*'/> 28913c15da26Smrg <colspec colname='c2' colwidth='2.0*'/> 28923c15da26Smrg <colspec colname='c3' colwidth='2.0*'/> 28933c15da26Smrg <colspec colname='c4' colwidth='1.0*'/> 2894555991fdSmrg <thead> 28953c15da26Smrg <row rowsep='1'> 28963c15da26Smrg <entry>Name</entry> 28973c15da26Smrg <entry>Type</entry> 28983c15da26Smrg <entry><acronym>POSIX</acronym> Type</entry> 28993c15da26Smrg <entry>Required</entry> 2900555991fdSmrg </row> 2901555991fdSmrg </thead> 2902555991fdSmrg <tbody> 2903555991fdSmrg <row> 29043c15da26Smrg <entry><property>SmCloneCommand</property></entry> 29053c15da26Smrg <entry>OS-specific</entry> 29063c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29073c15da26Smrg <entry>Yes</entry> 2908555991fdSmrg </row> 2909555991fdSmrg <row> 29103c15da26Smrg <entry><property>SmCurrentDirectory</property></entry> 29113c15da26Smrg <entry>OS-specific</entry> 29123c15da26Smrg <entry><type>SmARRAY8</type></entry> 29133c15da26Smrg <entry>No</entry> 2914555991fdSmrg </row> 2915555991fdSmrg <row> 29163c15da26Smrg <entry><property>SmDiscardCommand</property></entry> 29173c15da26Smrg <entry>OS-specific</entry> 29183c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29193c15da26Smrg <entry>No*</entry> 2920555991fdSmrg </row> 2921555991fdSmrg <row> 29223c15da26Smrg <entry><property>SmEnvironment</property></entry> 29233c15da26Smrg <entry>OS-specific</entry> 29243c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29253c15da26Smrg <entry>No</entry> 2926555991fdSmrg </row> 2927555991fdSmrg <row> 29283c15da26Smrg <entry><property>SmProcessID</property></entry> 29293c15da26Smrg <entry>OS-specific</entry> 29303c15da26Smrg <entry><type>SmARRAY8</type></entry> 29313c15da26Smrg <entry>No</entry> 2932555991fdSmrg </row> 2933555991fdSmrg <row> 29343c15da26Smrg <entry><property>SmProgram</property></entry> 29353c15da26Smrg <entry>OS-specific</entry> 29363c15da26Smrg <entry><type>SmARRAY8</type></entry> 29373c15da26Smrg <entry>Yes</entry> 2938555991fdSmrg </row> 2939555991fdSmrg <row> 29403c15da26Smrg <entry><property>SmRestartCommand</property></entry> 29413c15da26Smrg <entry>OS-specific</entry> 29423c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29433c15da26Smrg <entry>Yes</entry> 2944555991fdSmrg </row> 2945555991fdSmrg <row> 29463c15da26Smrg <entry><property>SmResignCommand</property></entry> 29473c15da26Smrg <entry>OS-specific</entry> 29483c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29493c15da26Smrg <entry>No</entry> 2950555991fdSmrg </row> 2951555991fdSmrg <row> 29523c15da26Smrg <entry><property>SmRestartStyleHint</property></entry> 29533c15da26Smrg <entry><type>SmCARD8</type></entry> 29543c15da26Smrg <entry><type>SmCARD8</type></entry> 29553c15da26Smrg <entry>No</entry> 2956555991fdSmrg </row> 2957555991fdSmrg <row> 29583c15da26Smrg <entry><property>SmShutdownCommand</property></entry> 29593c15da26Smrg <entry>OS-specific</entry> 29603c15da26Smrg <entry><type>SmLISTofARRAY8</type></entry> 29613c15da26Smrg <entry>No</entry> 2962555991fdSmrg </row> 2963555991fdSmrg <row> 29643c15da26Smrg <entry><property>SmUserID</property></entry> 29653c15da26Smrg <entry><type>SmARRAY8</type></entry> 29663c15da26Smrg <entry><type>SmARRAY8</type></entry> 29673c15da26Smrg <entry>Yes</entry> 2968555991fdSmrg </row> 2969555991fdSmrg </tbody> 2970555991fdSmrg </tgroup> 2971555991fdSmrg</informaltable> 2972555991fdSmrg 2973555991fdSmrg <para> 2974555991fdSmrg* Required if any state is stored in an external repository (for 2975555991fdSmrgexample, state file). 2976555991fdSmrg </para> 2977555991fdSmrg 2978555991fdSmrg <itemizedlist mark='bullet'> 2979555991fdSmrg <listitem><para><property>SmCloneCommand</property></para> 2980555991fdSmrg <para> 2981555991fdSmrgThis is like the <property>SmRestartCommand</property>, except it restarts a 2982555991fdSmrgcopy of the application. The only difference is that the application does not 2983555991fdSmrgsupply its client ID at register time. On <acronym>POSIX</acronym> systems, 2984555991fdSmrgthis should be of type <type>SmLISTofARRAY8</type>. 2985555991fdSmrg </para></listitem> 2986555991fdSmrg <listitem><para><property>SmCurrentDirectory</property></para> 2987555991fdSmrg <para> 2988555991fdSmrgOn <acronym>POSIX</acronym>-based systems, this specifies the value of the 2989555991fdSmrgcurrent directory that needs to be set up prior to starting the 2990555991fdSmrg<property>SmProgram</property> and should of type <type>SmARRAY8</type>. 2991555991fdSmrg </para></listitem> 2992555991fdSmrg <listitem><para><property>SmDiscardCommand</property></para> 2993555991fdSmrg <para> 2994555991fdSmrgThe discard command contains a command that when delivered to the host 2995555991fdSmrgthat the client is running on (determined from the connection), will 2996555991fdSmrgcause it to discard any information about the current state. If this 2997555991fdSmrgcommand is not specified, the Session Manager will assume that all of 2998555991fdSmrgthe client's state is encoded in the <property>SmRestartCommand</property>. 2999555991fdSmrgOn <acronym>POSIX</acronym> systems, the type should be 3000555991fdSmrg<type>SmLISTofARRAY8</type>. 3001555991fdSmrg </para></listitem> 3002555991fdSmrg <listitem><para><property>SmEnvironment</property></para> 3003555991fdSmrg <para> 3004555991fdSmrgOn <acronym>POSIX</acronym> based systems, this will be of type 3005555991fdSmrg<type>SmLISTofARRAY8</type>, where the <type>ARRAY8</type>s alternate between 3006555991fdSmrgenvironment variable name and environment variable value. 3007555991fdSmrg </para></listitem> 3008555991fdSmrg <listitem><para><property>SmProcessID</property></para> 3009555991fdSmrg <para> 3010555991fdSmrgThis specifies an OS-specific identifier for the process. 3011555991fdSmrgOn <acronym>POSIX</acronym> systems, this should contain the return value 3012555991fdSmrgof <function>getpid</function> turned into a Latin-1 (decimal) string. 3013555991fdSmrg </para></listitem> 3014555991fdSmrg <listitem><para><property>SmProgram</property></para> 3015555991fdSmrg <para> 3016555991fdSmrgThis is the name of the program that is running. On <acronym>POSIX</acronym> 3017555991fdSmrgsystems, this should be first parameter passed to <function>execve</function> 3018555991fdSmrgand should be of type <type>SmARRAY8</type>. 3019555991fdSmrg </para></listitem> 3020555991fdSmrg <listitem><para><property>SmRestartCommand</property></para> 3021555991fdSmrg <para> 3022555991fdSmrgThe restart command contains a command that, when delivered to the 3023555991fdSmrghost that the client is running on (determined from the connection), 3024555991fdSmrgwill cause the client to restart in its current state. 3025555991fdSmrgOn <acronym>POSIX</acronym>-based systems, this is of 3026555991fdSmrgtype <type>SmLISTofARRAY8</type>, and each of the elements in 3027555991fdSmrgthe array represents an element in the <varname>argv</varname> 3028555991fdSmrgarray. This restart command should ensure that the client restarts 3029555991fdSmrgwith the specified client-ID. 3030555991fdSmrg </para></listitem> 3031555991fdSmrg <listitem><para><property>SmResignCommand</property></para> 3032555991fdSmrg <para> 3033555991fdSmrgA client that sets the <property>SmRestartStyleHint</property> 3034555991fdSmrgto <constant>SmRestartAnyway</constant> uses this property to specify a 3035555991fdSmrgcommand that undoes the effect of the client and removes any saved state. 3036555991fdSmrgAs an example, consider a user that runs <command>xmodmap</command> which 3037555991fdSmrgregisters with the Session Manager, 3038555991fdSmrgsets <property>SmRestartStyleHint</property> 3039555991fdSmrgto <constant>SmRestartAnyway</constant>, and then 3040555991fdSmrgterminates. To allow the Session Manager (at the user's request) to 3041555991fdSmrgundo this, <command>xmodmap</command> would register a 3042555991fdSmrg<property>SmResignCommand</property> that undoes the effects of 3043555991fdSmrgthe <command>xmodmap</command>. 3044555991fdSmrg </para></listitem> 3045555991fdSmrg <listitem><para><property>SmRestartStyleHint</property></para> 3046555991fdSmrg <para> 3047555991fdSmrgIf the <property>SmRestartStyleHint</property> is present, it will contain the 3048555991fdSmrgstyle of restarting the client prefers. If this style is not specified, 3049555991fdSmrg<constant>SmRestartIfRunning</constant> is assumed. 3050555991fdSmrgThe possible values are as follows: 3051555991fdSmrg 30523c15da26Smrg<informaltable frame='topbot'> 30533c15da26Smrg <?dbfo keep-together="always" ?> 30543c15da26Smrg <tgroup cols='2' align='left' colsep='0' rowsep='0'> 30553c15da26Smrg <colspec colname='c1' colwidth='1.0*'/> 30563c15da26Smrg <colspec colname='c2' colwidth='1.5*'/> 3057555991fdSmrg <thead> 30583c15da26Smrg <row rowsep='1'> 30593c15da26Smrg <entry>Name</entry> 30603c15da26Smrg <entry>Value</entry> 3061555991fdSmrg </row> 3062555991fdSmrg </thead> 3063555991fdSmrg <tbody> 3064555991fdSmrg <row> 30653c15da26Smrg <entry><constant>SmRestartIfRunning</constant></entry> 30663c15da26Smrg <entry>0</entry> 3067555991fdSmrg </row> 3068555991fdSmrg <row> 30693c15da26Smrg <entry><constant>SmRestartAnyway</constant></entry> 30703c15da26Smrg <entry>1</entry> 3071555991fdSmrg </row> 3072555991fdSmrg <row> 30733c15da26Smrg <entry><constant>SmRestartImmediately</constant></entry> 30743c15da26Smrg <entry>2</entry> 3075555991fdSmrg </row> 3076555991fdSmrg <row> 30773c15da26Smrg <entry><constant>SmRestartNever</constant></entry> 30783c15da26Smrg <entry>3</entry> 3079555991fdSmrg </row> 3080555991fdSmrg </tbody> 3081555991fdSmrg </tgroup> 3082555991fdSmrg</informaltable> 3083555991fdSmrg </para> 3084555991fdSmrg 3085555991fdSmrg <para> 3086555991fdSmrgThe <constant>SmRestartIfRunning</constant> style is used in the usual case. 3087555991fdSmrgThe client should be restarted in the next session if it was running at 3088555991fdSmrgthe end of the current session. 3089555991fdSmrg </para> 3090555991fdSmrg 3091555991fdSmrg <para> 3092555991fdSmrgThe <constant>SmRestartAnyway</constant> style is used to tell the Session 3093555991fdSmrgManager that the application should be restarted in the next session even if 3094555991fdSmrgit exits before the current session is terminated. It should be noted that 3095555991fdSmrgthis is only a hint and the Session Manager will follow the policies 3096555991fdSmrgspecified by its users in determining what applications to restart. 3097555991fdSmrg </para> 3098555991fdSmrg 3099555991fdSmrg <para> 3100555991fdSmrgA client that uses <constant>SmRestartAnyway</constant> should also set the 3101555991fdSmrg<property>SmResignCommand</property> and <property>SmShutdownCommand</property> 3102555991fdSmrgproperties to commands that undo the state of the client after it exits. 3103555991fdSmrg </para> 3104555991fdSmrg 3105555991fdSmrg <para> 3106555991fdSmrgThe SmRestartImmediately style is like SmRestartAnyway, but, in addition, the client is meant to run continuously. If the client exits, the Session Manager should try to restart it in the current session. 3107555991fdSmrg </para> 3108555991fdSmrg 3109555991fdSmrg <para> 3110555991fdSmrg<constant>SmRestartNever</constant> style specifies that the client does not 3111555991fdSmrgwish to be restarted in the next session. 3112555991fdSmrg </para> 3113555991fdSmrg </listitem> 3114555991fdSmrg <listitem><para><property>SmShutdownCommand</property></para> 3115555991fdSmrg <para> 3116555991fdSmrgThis command is executed at shutdown time to clean up after a client 3117555991fdSmrgthat is no longer running but retained its state by setting 3118555991fdSmrg<property>SmRestartStyleHint</property> to 3119555991fdSmrg<constant>SmRestartAnyway</constant>. The client must not remove any saved 3120555991fdSmrgstate as the client is still part of the session. As an 3121555991fdSmrgexample, consider a client that turns on a camera at start up time. 3122555991fdSmrgThis client then exits. At session shutdown, the user wants the 3123555991fdSmrgcamera turned off. This client would set the 3124555991fdSmrg<property>SmRestartStyleHint</property> to 3125555991fdSmrg<constant>SmRestartAnyway</constant> and would register 3126555991fdSmrga <property>SmShutdownCommand</property> that would turn off the camera. 3127555991fdSmrg </para></listitem> 3128555991fdSmrg <listitem><para><property>SmUserID</property></para> 3129555991fdSmrg <para> 3130555991fdSmrgSpecifies the user ID. On <acronym>POSIX</acronym>-based systems, this will 3131555991fdSmrgcontain the user's name (the <structfield>pw_name</structfield> member of 3132555991fdSmrg<structname>struct passwd</structname>). 3133555991fdSmrg </para></listitem> 3134555991fdSmrg </itemizedlist> 3135555991fdSmrg</chapter> 3136555991fdSmrg 31373c15da26Smrg<chapter id='Freeing_Data'> 3138555991fdSmrg <title>Freeing Data</title> 3139555991fdSmrg 3140555991fdSmrg <para> 31413c15da26SmrgTo free an individual property, use <xref linkend='SmFreeProperty' xrefstyle='select: title'/> 3142555991fdSmrg </para> 3143555991fdSmrg 31443c15da26Smrg<funcsynopsis id='SmFreeProperty'> 3145555991fdSmrg <funcprototype> 3146555991fdSmrg <funcdef>void <function>SmFreeProperty</function></funcdef> 3147555991fdSmrg <paramdef>SmProp *<parameter>prop</parameter></paramdef> 3148555991fdSmrg </funcprototype> 3149555991fdSmrg</funcsynopsis> 3150555991fdSmrg 3151555991fdSmrg<variablelist remap='IP'> 3152555991fdSmrg <varlistentry> 3153555991fdSmrg <term><parameter>prop</parameter></term> 3154555991fdSmrg <listitem><para>The property to free.</para></listitem> 3155555991fdSmrg </varlistentry> 3156555991fdSmrg</variablelist> 3157555991fdSmrg 3158555991fdSmrg <para> 3159555991fdSmrgTo free the reason strings from 31603c15da26Smrgthe <xref linkend='SmsCloseConnectionProc' xrefstyle='select: title'/> callback, 31613c15da26Smrguse <xref linkend='SmFreeReasons' xrefstyle='select: title'/> 3162555991fdSmrg </para> 3163555991fdSmrg 31643c15da26Smrg<funcsynopsis id='SmFreeReasons'> 3165555991fdSmrg <funcprototype> 3166555991fdSmrg <funcdef>void <function>SmFreeReasons</function></funcdef> 3167555991fdSmrg <paramdef>int <parameter>count</parameter></paramdef> 3168555991fdSmrg <paramdef>char **<parameter>reasons</parameter></paramdef> 3169555991fdSmrg </funcprototype> 3170555991fdSmrg</funcsynopsis> 3171555991fdSmrg 3172555991fdSmrg<variablelist remap='IP'> 3173555991fdSmrg <varlistentry> 3174555991fdSmrg <term><parameter>count</parameter></term> 3175555991fdSmrg <listitem><para>The number of reason strings.</para></listitem> 3176555991fdSmrg </varlistentry> 3177555991fdSmrg <varlistentry> 3178555991fdSmrg <term><parameter>reasons</parameter></term> 3179555991fdSmrg <listitem><para>The list of reason strings to free.</para></listitem> 3180555991fdSmrg </varlistentry> 3181555991fdSmrg</variablelist> 3182555991fdSmrg</chapter> 3183555991fdSmrg 31843c15da26Smrg<chapter id='Authentication_of_Clients'> 3185555991fdSmrg <title>Authentication of Clients</title> 3186555991fdSmrg 3187555991fdSmrg <para> 3188555991fdSmrgAs stated earlier, the session management protocol is layered on top 3189555991fdSmrgof ICE. Authentication occurs at two levels in the ICE protocol: 3190555991fdSmrg 3191555991fdSmrg<itemizedlist mark='bullet'> 3192555991fdSmrg <listitem><para>The first is when an ICE connection is opened.</para></listitem> 3193555991fdSmrg <listitem><para>The second is when a Protocol Setup occurs on an ICE connection.</para></listitem> 3194555991fdSmrg</itemizedlist> 3195555991fdSmrg </para> 3196555991fdSmrg 3197555991fdSmrg <para> 3198555991fdSmrgThe authentication methods that are available are 3199555991fdSmrgimplementation-dependent (that is., dependent on the ICElib and SMlib 3200555991fdSmrgimplementations in use). For further information, see the 3201555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 3202555991fdSmrgstandard. 3203555991fdSmrg </para> 3204555991fdSmrg</chapter> 3205555991fdSmrg 32063c15da26Smrg<chapter id='Working_in_a_Multi_Threaded_Environment'> 3207555991fdSmrg <title>Working in a Multi-Threaded Environment</title> 3208555991fdSmrg 3209555991fdSmrg <para> 3210555991fdSmrgTo declare that multiple threads in an application will be using SMlib 3211555991fdSmrg(or any other library layered on top of ICElib), you should 3212555991fdSmrgcall <function>IceInitThreads</function>. 3213555991fdSmrgFor further information, see the 3214555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 3215555991fdSmrgstandard. 3216555991fdSmrg </para> 3217555991fdSmrg</chapter> 3218555991fdSmrg 32193c15da26Smrg<chapter id='Acknowledgements'> 3220555991fdSmrg <title>Acknowledgements</title> 3221555991fdSmrg 3222555991fdSmrg <para> 3223555991fdSmrgThanks to the following people for their participation in the 3224555991fdSmrgX Session Management design: Jordan Brown, Ellis Cohen, Donna Converse, 3225555991fdSmrgStephen Gildea, Vania Joloboff, Stuart Marks, Bob Scheifler, Ralph Swick, 3226555991fdSmrgand Mike Wexler. 3227555991fdSmrg </para> 3228555991fdSmrg 3229555991fdSmrg</chapter> 3230555991fdSmrg</book> 3231