SMlib.xml revision 555991fd
1555991fdSmrg<?xml version="1.0" encoding="UTF-8" ?> 2555991fdSmrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 3555991fdSmrg "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> 4555991fdSmrg 5555991fdSmrg 6555991fdSmrg<!-- lifted from troff+ms+XMan by doclifter --> 7555991fdSmrg<book id="smlibms"> 8555991fdSmrg 9555991fdSmrg<bookinfo> 10555991fdSmrg <title>X Session Management Library</title> 11555991fdSmrg <subtitle>X Consortium Standard</subtitle> 12555991fdSmrg <releaseinfo>X Version 11, Release 6.4</releaseinfo> 13555991fdSmrg <authorgroup> 14555991fdSmrg <author> 15555991fdSmrg <firstname>Ralph</firstname><surname>Mor</surname> 16555991fdSmrg </author> 17555991fdSmrg </authorgroup> 18555991fdSmrg <corpname>X Consortium Standard</corpname> 19555991fdSmrg <copyright> 20555991fdSmrg <year>1993</year><year>1994</year> 21555991fdSmrg <holder>X Consortium</holder> 22555991fdSmrg </copyright> 23555991fdSmrg <releaseinfo>Version 1.0</releaseinfo> 24555991fdSmrg <affiliation><orgname>X Consortium</orgname></affiliation> 25555991fdSmrg <productnumber>X Version 11, Release 7</productnumber> 26555991fdSmrg 27555991fdSmrg <legalnotice> 28555991fdSmrg <para> 29555991fdSmrgPermission is hereby granted, free of charge, to any person obtaining 30555991fdSmrga copy of this software and associated documentation files (the 31555991fdSmrg“Software”), to deal in the Software without restriction, 32555991fdSmrgincluding without limitation the rights to use, copy, modify, merge, 33555991fdSmrgpublish, distribute, sublicense, and/or sell copies of the Software, 34555991fdSmrgand to permit persons to whom the Software is furnished to do so, 35555991fdSmrgsubject to the following conditions: 36555991fdSmrg </para> 37555991fdSmrg 38555991fdSmrg <para> 39555991fdSmrgThe above copyright notice and this permission notice shall be 40555991fdSmrgincluded in all copies or substantial portions of the Software. 41555991fdSmrg </para> 42555991fdSmrg 43555991fdSmrg <para> 44555991fdSmrgTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF 45555991fdSmrgANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 46555991fdSmrgWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 47555991fdSmrgAND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR 48555991fdSmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 49555991fdSmrgCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 50555991fdSmrgWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 51555991fdSmrg </para> 52555991fdSmrg 53555991fdSmrg <para> 54555991fdSmrgExcept as contained in this notice, the name of the X Consortium shall 55555991fdSmrgnot be used in advertising or otherwise to promote the sale, use or 56555991fdSmrgother dealings in this Software without prior written authorization 57555991fdSmrgfrom the X Consortium. 58555991fdSmrg </para> 59555991fdSmrg 60555991fdSmrg <para> 61555991fdSmrgX Window System is a trademark of The Open Group. 62555991fdSmrg </para> 63555991fdSmrg </legalnotice> 64555991fdSmrg 65555991fdSmrg</bookinfo> 66555991fdSmrg 67555991fdSmrg<chapter id="overview_of_session_management"> 68555991fdSmrg <title>Overview of Session Management</title> 69555991fdSmrg 70555991fdSmrg <abstract> 71555991fdSmrg <para> 72555991fdSmrgThe purpose of the X Session Management Protocol (<acronym>XSMP</acronym>) 73555991fdSmrgis to provide a uniform mechanism for users to save and restore their 74555991fdSmrgsessions. A <firstterm>session</firstterm> is a group of clients, 75555991fdSmrgeach of which has a particular state. The session is controlled by a 76555991fdSmrgnetwork service called the <firstterm>session manager</firstterm>. 77555991fdSmrgThe session manager issues commands to its clients on behalf of the 78555991fdSmrguser. These commands may cause clients to save their state or to 79555991fdSmrgterminate. It is expected that the client will save its state in such 80555991fdSmrga way that the client can be restarted at a later time and resume its 81555991fdSmrgoperation as if it had never been terminated. A client's state might 82555991fdSmrginclude information about the file currently being edited, the current 83555991fdSmrgposition of the insertion point within the file, or the start of an 84555991fdSmrguncommitted transaction. The means by which clients are restarted is 85555991fdSmrgunspecified by this protocol. 86555991fdSmrg </para> 87555991fdSmrg 88555991fdSmrg <para> 89555991fdSmrgFor purposes of this protocol, a <firstterm>client</firstterm> of the 90555991fdSmrgsession manager is defined as a connection to the session manager. A 91555991fdSmrgclient is typically, though not necessarily, a process running an 92555991fdSmrgapplication program connected to an X display. However, a client may 93555991fdSmrgbe connected to more than one X display or not be connected to any X 94555991fdSmrgdisplays at all. 95555991fdSmrg </para> 96555991fdSmrg </abstract> 97555991fdSmrg</chapter> 98555991fdSmrg 99555991fdSmrg<chapter id='the_session_management_library'> 100555991fdSmrg <title>The Session Management Library</title> 101555991fdSmrg <abstract> 102555991fdSmrg <para> 103555991fdSmrgThe Session Management Library (<abbrev>SMlib</abbrev>) is a low-level 104555991fdSmrg"C" language interface to XSMP. It is expected that higher level 105555991fdSmrgtoolkits, such as Xt, will hide many of the details of session 106555991fdSmrgmanagement from clients. Higher level toolkits might also be developed 107555991fdSmrgfor session managers to use, but no such effort is currently under way. 108555991fdSmrg </para> 109555991fdSmrg </abstract> 110555991fdSmrg 111555991fdSmrg <para> 112555991fdSmrg SMlib has two parts to it: 113555991fdSmrg <itemizedlist mark='bullet'> 114555991fdSmrg <listitem><para>One set of functions for clients that want to be part of a session</para></listitem> 115555991fdSmrg <listitem><para>One set of functions for session managers to call</para></listitem> 116555991fdSmrg </itemizedlist> 117555991fdSmrg </para> 118555991fdSmrg 119555991fdSmrg <para> 120555991fdSmrgSome applications will use both sets of functions and act as 121555991fdSmrg<firstterm>nested session managers</firstterm>. That is, they will be 122555991fdSmrgboth a session manager and a client of another session. An example is 123555991fdSmrga mail program that could start a text editor for editing the text of 124555991fdSmrga mail message. The mail program is part of a regular session and, at 125555991fdSmrgthe same time, is also acting as a session manager to the editor. 126555991fdSmrg </para> 127555991fdSmrg 128555991fdSmrg <para> 129555991fdSmrgClients initialize by connecting to the session manager and obtaining 130555991fdSmrga <firstterm>client-ID</firstterm> that uniquely identifies them in 131555991fdSmrgthe session. The session manager maintains a list of properties for 132555991fdSmrgeach client in the session. These properties describe the client's 133555991fdSmrgenvironment and, most importantly, describe how the client can be 134555991fdSmrgrestarted (via an <property>SmRestartCommand</property>). Clients are 135555991fdSmrgexpected to save their state in such a way as to allow multiple 136555991fdSmrginstantiations of themselves to be managed independently. For 137555991fdSmrgexample, clients may use their client-ID as part of a filename in 138555991fdSmrgwhich to store the state for a particular instantiation. The 139555991fdSmrgclient-ID should be saved as part of the <property>SmRestartCommand</property> 140555991fdSmrgso that the client will retain the same ID after it is restarted. 141555991fdSmrg </para> 142555991fdSmrg 143555991fdSmrg <para> 144555991fdSmrgOnce the client initializes itself with the session manager, it must 145555991fdSmrgbe ready to respond to messages from the session manager. For 146555991fdSmrgexample, it might be asked to save its state or to terminate. In the 147555991fdSmrgcase of a shutdown, the session manager might give each client a 148555991fdSmrgchance to interact with the user and cancel the shutdown. 149555991fdSmrg </para> 150555991fdSmrg</chapter> 151555991fdSmrg 152555991fdSmrg<chapter id='understanding_smlibs_dependence_on_ice'> 153555991fdSmrg <title>Understanding SMlib's Dependence on ICE</title> 154555991fdSmrg 155555991fdSmrg <para> 156555991fdSmrgThe X Session Management Protocol is layered on top of the 157555991fdSmrgInter-Client Exchange (<acronym>ICE</acronym>) Protocol. The ICE 158555991fdSmrgprotocol is designed to multiplex several protocols over a single 159555991fdSmrgconnection. As a result, working with SMlib requires a little 160555991fdSmrgknowledge of how the ICE library works. 161555991fdSmrg </para> 162555991fdSmrg 163555991fdSmrg <para> 164555991fdSmrgThe ICE library utilizes callbacks to process messages. When a client 165555991fdSmrgdetects that there is data to read on an ICE connection, it should 166555991fdSmrgcall the <function>IceProcessMessages</function> function. 167555991fdSmrg<function>IceProcessMessages</function> will read the message header 168555991fdSmrgand look at the major opcode in order to determine which protocol the 169555991fdSmrgmessage was intended for. The appropriate protocol library will then 170555991fdSmrgbe triggered to unpack the message and hand it off to the client via a 171555991fdSmrgcallback. 172555991fdSmrg </para> 173555991fdSmrg 174555991fdSmrg <para> 175555991fdSmrgThe main point to be aware of is that an application using SMlib must 176555991fdSmrghave some code that detects when there is data to read on an ICE 177555991fdSmrgconnection. This can be done via a <function>select</function> call 178555991fdSmrgon the file descriptor for the ICE connection, but more 179555991fdSmrgtypically, <function>XtAppAddInput</function> will be used to register 180555991fdSmrga callback that will invoke <function>IceProcessMessages</function> 181555991fdSmrgeach time there is data to read on the ICE connection. 182555991fdSmrg </para> 183555991fdSmrg 184555991fdSmrg <para> 185555991fdSmrgTo further complicate things, knowing which file descriptors to 186555991fdSmrgcall <function>select</function> on requires an understanding of how 187555991fdSmrgICE connections are created. On the client side, a call must be made 188555991fdSmrgto <function>SmcOpenConnection</function> in order to open a connection 189555991fdSmrgwith a session manager. <function>SmcOpenConnection</function> will 190555991fdSmrginternally makea call into <function>IceOpenConnection</function> 191555991fdSmrgwhich will, in turn, determine if an ICE connection already exists 192555991fdSmrgbetween the client and session manager. Most likely, a connection 193555991fdSmrgwill not already exist and a new ICE connection will be created. The 194555991fdSmrgmain point to be aware of is that, on the client side, it is not 195555991fdSmrgobvious when ICE connections get created or destroyed, because 196555991fdSmrgconnections are shared when possible. To deal with this, the ICE 197555991fdSmrglibrary lets the application register watch procedures that will be 198555991fdSmrginvoked each time an ICE connection is opened or closed. These watch 199555991fdSmrgprocedures could be used to add or remove ICE file descriptors from 200555991fdSmrgthe list of descriptors to call <function>select</function> on. 201555991fdSmrg </para> 202555991fdSmrg 203555991fdSmrg <para> 204555991fdSmrgOn the session manager side, things work a bit differently. The 205555991fdSmrgsession manager has complete control over the creation of ICE 206555991fdSmrgconnections. The session manager has to first 207555991fdSmrgcall <function>IceListenForConnections</function> in order to start 208555991fdSmrglistening for connections from clients. Once a connection attempt is 209555991fdSmrgdetected, <function>IceAcceptConnection</function> must be called, and 210555991fdSmrgthe session manager can simply add the new ICE file descriptor to the 211555991fdSmrglist of descriptors to call <function>select</function> on. 212555991fdSmrg 213555991fdSmrg </para> 214555991fdSmrg 215555991fdSmrg <para> 216555991fdSmrgFor further information on the library functions related to ICE connections, 217555991fdSmrgsee the <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 218555991fdSmrgstandard. 219555991fdSmrg </para> 220555991fdSmrg</chapter> 221555991fdSmrg 222555991fdSmrg<chapter id='header_files_and_library_name'> 223555991fdSmrg<title>Header Files and Library Name</title> 224555991fdSmrg 225555991fdSmrg <para> 226555991fdSmrgApplications (both session managers and clients) should include the 227555991fdSmrgheader file <<filename class='headerfile'>X11/SM/SMlib.h</filename>>. 228555991fdSmrgThis header file defines all of the SMlib data structures and function 229555991fdSmrgprototypes. <filename class='headerfile'>SMlib.h</filename> includes the 230555991fdSmrgheader file <<filename class='headerfile'>X11/SM/SM.h</filename>>, 231555991fdSmrgwhich defines all of the SMlib constants. 232555991fdSmrg </para> 233555991fdSmrg 234555991fdSmrg <para> 235555991fdSmrgBecause SMlib is dependent on ICE, applications should link against 236555991fdSmrgSMlib and ICElib by using 237555991fdSmrg<quote><option>-lSM</option> <option>-lICE</option></quote>. 238555991fdSmrg </para> 239555991fdSmrg</chapter> 240555991fdSmrg 241555991fdSmrg<chapter id='session_management_client'> 242555991fdSmrg <title>Session Management Client (<acronym>Smc</acronym>) Functions</title> 243555991fdSmrg 244555991fdSmrg <para> 245555991fdSmrg This section discusses how Session Management clients: 246555991fdSmrg <itemizedlist mark='bullet'> 247555991fdSmrg <listitem><para>Connect to the Session Manager</para></listitem> 248555991fdSmrg <listitem><para>Close the connection</para></listitem> 249555991fdSmrg <listitem><para>Modify callbacks</para></listitem> 250555991fdSmrg <listitem><para>Set, delete, and retrieve Session Manager properties</para></listitem> 251555991fdSmrg <listitem><para>Interact with the user</para></listitem> 252555991fdSmrg <listitem><para>Request a “Save Yourself”</para></listitem> 253555991fdSmrg <listitem><para>Request a “Save Yourself Phase 2”</para></listitem> 254555991fdSmrg <listitem><para>Complete a “Save Yourself”</para></listitem> 255555991fdSmrg <listitem><para>Use Smc informational functions</para></listitem> 256555991fdSmrg <listitem><para>Handle Errors</para></listitem> 257555991fdSmrg </itemizedlist> 258555991fdSmrg </para> 259555991fdSmrg 260555991fdSmrg <sect1 id='connecting_to_the_session_manager'> 261555991fdSmrg <title>Connecting to the Session Manager</title> 262555991fdSmrg 263555991fdSmrg <para> 264555991fdSmrgTo open a connection with a session manager, 265555991fdSmrguse <function>SmcOpenConnection</function> 266555991fdSmrg </para> 267555991fdSmrg 268555991fdSmrg <funcsynopsis> 269555991fdSmrg <funcprototype> 270555991fdSmrg <funcdef>SmcConn <function>SmcOpenConnection</function></funcdef> 271555991fdSmrg <paramdef>char *<parameter>network_ids_list</parameter></paramdef> 272555991fdSmrg <paramdef>SmPointer <parameter>context</parameter></paramdef> 273555991fdSmrg <paramdef>int <parameter>xsmp_major_rev</parameter></paramdef> 274555991fdSmrg <paramdef>int <parameter>xsmp_minor_rev</parameter></paramdef> 275555991fdSmrg <paramdef>unsigned long <parameter>mask</parameter></paramdef> 276555991fdSmrg <paramdef>SmcCallbacks *<parameter>callbacks</parameter></paramdef> 277555991fdSmrg <paramdef>char *<parameter>previous_id</parameter></paramdef> 278555991fdSmrg <paramdef>char **<parameter>client_id_ret</parameter></paramdef> 279555991fdSmrg <paramdef>int <parameter>error_length</parameter></paramdef> 280555991fdSmrg <paramdef>char *<parameter>error_string_ret</parameter></paramdef> 281555991fdSmrg </funcprototype> 282555991fdSmrg </funcsynopsis> 283555991fdSmrg 284555991fdSmrg <variablelist remap='IP'> 285555991fdSmrg <varlistentry> 286555991fdSmrg <term><parameter>network_ids_list</parameter></term> 287555991fdSmrg <listitem><para>Specifies the network ID(s) of the session manager.</para></listitem> 288555991fdSmrg </varlistentry> 289555991fdSmrg <varlistentry> 290555991fdSmrg <term><parameter>context</parameter></term> 291555991fdSmrg <listitem><para> 292555991fdSmrgA pointer to an opaque object or <constant>NULL</constant>. Used to determine 293555991fdSmrgif an ICE connection can be shared 294555991fdSmrg(see <link linkend='context_sharing'>below</link>). 295555991fdSmrg </para></listitem> 296555991fdSmrg </varlistentry> 297555991fdSmrg <varlistentry> 298555991fdSmrg <term><parameter>xsmp_major_rev</parameter></term> 299555991fdSmrg <listitem><para> 300555991fdSmrgThe highest major version of the XSMP the application supports. 301555991fdSmrg </para></listitem> 302555991fdSmrg </varlistentry> 303555991fdSmrg <varlistentry> 304555991fdSmrg <term><parameter>xsmp_minor_rev</parameter></term> 305555991fdSmrg <listitem><para> 306555991fdSmrgThe highest minor version of the XSMP the application supports (for 307555991fdSmrgthe specified <parameter>xsmp_major_rev</parameter>). 308555991fdSmrg </para></listitem> 309555991fdSmrg </varlistentry> 310555991fdSmrg <varlistentry> 311555991fdSmrg <term><parameter>mask</parameter></term> 312555991fdSmrg <listitem><para>A mask indicating which callbacks to register.</para></listitem> 313555991fdSmrg </varlistentry> 314555991fdSmrg <varlistentry> 315555991fdSmrg <term><parameter>callbacks</parameter></term> 316555991fdSmrg <listitem><para> 317555991fdSmrgThe callbacks to register. These callbacks are used to respond to 318555991fdSmrgmessages from the session manager. 319555991fdSmrg </para></listitem> 320555991fdSmrg </varlistentry> 321555991fdSmrg <varlistentry> 322555991fdSmrg <term><parameter>previous_id</parameter></term> 323555991fdSmrg <listitem><para>The client ID from the previous session.</para></listitem> 324555991fdSmrg </varlistentry> 325555991fdSmrg <varlistentry> 326555991fdSmrg <term><parameter>client_id_ret</parameter></term> 327555991fdSmrg <listitem><para>The client ID for the current session is returned.</para></listitem> 328555991fdSmrg </varlistentry> 329555991fdSmrg <varlistentry> 330555991fdSmrg <term><parameter>error_length</parameter></term> 331555991fdSmrg <listitem><para>Length of the <parameter>error_string_ret</parameter> argument passed in.</para></listitem> 332555991fdSmrg </varlistentry> 333555991fdSmrg <varlistentry> 334555991fdSmrg <term><parameter>error_string_ret</parameter></term> 335555991fdSmrg <listitem><para> 336555991fdSmrgReturns a null-terminated error message, if any. 337555991fdSmrgThe <parameter>error_string_ret</parameter> argument points to user supplied 338555991fdSmrgmemory. No more than <parameter>error_length</parameter> bytes are used. 339555991fdSmrg </para></listitem> 340555991fdSmrg </varlistentry> 341555991fdSmrg </variablelist> 342555991fdSmrg 343555991fdSmrg <para> 344555991fdSmrgThe <parameter>network_ids_list</parameter> argument is a 345555991fdSmrgnull-terminated string containing a list of network IDs for the session 346555991fdSmrgmanager, separated by commas. If <parameter>network_ids_list</parameter> 347555991fdSmrgis <constant>NULL</constant>, the value of 348555991fdSmrgthe <envar>SESSION_MANAGER</envar> environment variable will be used. 349555991fdSmrgEach network ID has the following format: 350555991fdSmrg 351555991fdSmrg<informaltable pgwide='0' frame='none'> 352555991fdSmrg <tgroup cols='3' align='center'> 353555991fdSmrg <colspec colname='c1'/> 354555991fdSmrg <colspec colname='c2'/> 355555991fdSmrg <colspec colname='c3'/> 356555991fdSmrg <tbody> 357555991fdSmrg <row> 358555991fdSmrg <entry align='left'></entry> 359555991fdSmrg <entry align='left'><literal>tcp/</literal><parameter><hostname></parameter><literal>:</literal><parameter><portnumber></parameter></entry> 360555991fdSmrg <entry align='left'>or</entry> 361555991fdSmrg </row> 362555991fdSmrg <row> 363555991fdSmrg <entry align='left'></entry> 364555991fdSmrg <entry align='left'><literal>decnet/</literal><parameter><hostname></parameter><literal>::</literal><parameter><objname></parameter></entry> 365555991fdSmrg <entry align='left'>or</entry> 366555991fdSmrg </row> 367555991fdSmrg <row> 368555991fdSmrg <entry align='left'></entry> 369555991fdSmrg <entry align='left'><literal>local/</literal><parameter><hostname></parameter><literal>:</literal><parameter><path></parameter></entry> 370555991fdSmrg <entry align='left'></entry> 371555991fdSmrg </row> 372555991fdSmrg </tbody> 373555991fdSmrg </tgroup> 374555991fdSmrg</informaltable> 375555991fdSmrg </para> 376555991fdSmrg 377555991fdSmrg <para> 378555991fdSmrgAn attempt will be made to use the first network ID. If that fails, 379555991fdSmrgan attempt will be made using the second network ID, and so on. 380555991fdSmrg </para> 381555991fdSmrg 382555991fdSmrg <para> 383555991fdSmrgAfter the connection is established, <function>SmcOpenConnection</function> 384555991fdSmrgregisters the client with the session manager. If the client is being 385555991fdSmrgrestarted from a previous session, <parameter>previous_id</parameter> 386555991fdSmrgshould contain a null terminated string representing the client ID from the 387555991fdSmrgprevious session. If the client is first joining the session, 388555991fdSmrg<parameter>previous_id</parameter> should be set to <constant>NULL</constant>. 389555991fdSmrgIf <parameter>previous_id</parameter> is specified but is determined 390555991fdSmrgto be invalid by the session manager, SMlib will re-register the 391555991fdSmrgclient with <parameter>previous_id</parameter> set to <constant>NULL</constant>. 392555991fdSmrg </para> 393555991fdSmrg 394555991fdSmrg <para> 395555991fdSmrgIf <function>SmcOpenConnection</function> succeeds, it returns an 396555991fdSmrgopaque connection pointer of type <function>SmcConn</function> and the 397555991fdSmrg<parameter>client_id_ret</parameter> argument contains the client ID to be 398555991fdSmrgused for this session. The <parameter>client_id_ret</parameter> should be 399555991fdSmrgfreed with a call to <function>free</function> when no longer needed. On 400555991fdSmrgfailure, <function>SmcOpenConnection</function> returns 401555991fdSmrg<constant>NULL</constant>, and the reason for failure is returned in 402555991fdSmrg<parameter>error_string_ret</parameter>. 403555991fdSmrg </para> 404555991fdSmrg 405555991fdSmrg <para> 406555991fdSmrgNote that SMlib uses the ICE protocol to establish a connection with 407555991fdSmrgthe session manager. If an ICE connection already exists between the 408555991fdSmrgclient and session manager, it might be possible for the same ICE 409555991fdSmrgconnection to be used for session management. 410555991fdSmrg </para> 411555991fdSmrg 412555991fdSmrg <para id='context_sharing'> 413555991fdSmrgThe context argument indicates how willing the client is to share the 414555991fdSmrgICE connection with other protocols. If context is <constant>NULL</constant>, 415555991fdSmrgthen the caller is always willing to share the connection. If context is not 416555991fdSmrg<constant>NULL</constant>, then the caller is not willing to use a previously 417555991fdSmrgopened ICE connection that has a different non-<constant>NULL</constant> 418555991fdSmrgcontext associated with it. 419555991fdSmrg </para> 420555991fdSmrg 421555991fdSmrg <para> 422555991fdSmrgAs previously discussed 423555991fdSmrg(<link linkend='understanding_smlibs_dependence_on_ice'>section 3, 424555991fdSmrg“Understanding SMlib's Dependence on ICE”</link>), the 425555991fdSmrgclient will have to keep track of when ICE connections are created or 426555991fdSmrgdestroyed (using <function>IceAddConnectionWatch</function> 427555991fdSmrgand <function>IceRemoveConnectionWatch</function> and will have to 428555991fdSmrgcall <function>IceProcessMessages</function> each time 429555991fdSmrga <function>select</function> shows that there is data to read on an 430555991fdSmrgICE connection. For further information, see the 431555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 432555991fdSmrgstandard. 433555991fdSmrg </para> 434555991fdSmrg 435555991fdSmrg <para> 436555991fdSmrgThe callbacks argument contains a set of callbacks used to respond to 437555991fdSmrgsession manager events. The mask argument specifies which callbacks 438555991fdSmrgare set. All of the callbacks specified in this version of SMlib are 439555991fdSmrgmandatory. The mask argument is necessary in order to maintain 440555991fdSmrgbackwards compatibility in future versions of the library. 441555991fdSmrg </para> 442555991fdSmrg 443555991fdSmrg <para> 444555991fdSmrgThe following values may be ORed together to obtain a 445555991fdSmrg<parameter>mask</parameter> value: 446555991fdSmrg 447555991fdSmrg <simplelist type='vert'> 448555991fdSmrg <member><constant>SmcSaveYourselfProcMask</constant></member> 449555991fdSmrg <member><constant>SmcDieProcMask</constant></member> 450555991fdSmrg <member><constant>SmcSaveCompleteProcMask</constant></member> 451555991fdSmrg <member><constant>SmcShutdownCancelledProcMask</constant></member> 452555991fdSmrg </simplelist> 453555991fdSmrg </para> 454555991fdSmrg 455555991fdSmrg <para> 456555991fdSmrgFor each callback, the client can register a pointer to client data. 457555991fdSmrgWhen SMlib invokes the callback, it will pass the client data pointer. 458555991fdSmrg </para> 459555991fdSmrg 460555991fdSmrg<!-- .ne 4 IGNORED --> 461555991fdSmrg 462555991fdSmrg<synopsis> 463555991fdSmrgtypedef struct { 464555991fdSmrg 465555991fdSmrg struct { 466555991fdSmrg SmcSaveYourselfProc callback; 467555991fdSmrg SmPointer client_data; 468555991fdSmrg } save_yourself; 469555991fdSmrg 470555991fdSmrg struct { 471555991fdSmrg SmcDieProc callback; 472555991fdSmrg SmPointer client_data; 473555991fdSmrg } die; 474555991fdSmrg 475555991fdSmrg struct { 476555991fdSmrg SmcSaveCompleteProc callback; 477555991fdSmrg SmPointer client_data; 478555991fdSmrg } save_complete; 479555991fdSmrg 480555991fdSmrg struct { 481555991fdSmrg SmcShutdownCancelledProc callback; 482555991fdSmrg SmPointer client_data; 483555991fdSmrg } shutdown_cancelled; 484555991fdSmrg 485555991fdSmrg} SmcCallbacks; 486555991fdSmrg</synopsis> 487555991fdSmrg 488555991fdSmrg <sect2 id='the_save_yourself_callback'> 489555991fdSmrg <title>The Save Yourself Callback</title> 490555991fdSmrg 491555991fdSmrg <para> 492555991fdSmrgThe Save Yourself callback is of type <function>SmcSaveYourselfProc</function> 493555991fdSmrg </para> 494555991fdSmrg 495555991fdSmrg<funcsynopsis> 496555991fdSmrg<funcprototype> 497555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfProc</function>)</funcdef> 498555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 499555991fdSmrg <paramdef>SmcConn <parameter>client_data</parameter></paramdef> 500555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 501555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 502555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 503555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 504555991fdSmrg</funcprototype> 505555991fdSmrg</funcsynopsis> 506555991fdSmrg 507555991fdSmrg<variablelist remap='IP'> 508555991fdSmrg <varlistentry> 509555991fdSmrg <term><parameter>smc_conn</parameter></term> 510555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 511555991fdSmrg </varlistentry> 512555991fdSmrg <varlistentry> 513555991fdSmrg <term><parameter>client_data</parameter></term> 514555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 515555991fdSmrg </varlistentry> 516555991fdSmrg <varlistentry> 517555991fdSmrg <term><parameter>save_type</parameter></term> 518555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 519555991fdSmrg </varlistentry> 520555991fdSmrg <varlistentry> 521555991fdSmrg <term><parameter>shut_down</parameter></term> 522555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 523555991fdSmrg </varlistentry> 524555991fdSmrg <varlistentry> 525555991fdSmrg <term><parameter>interact_style</parameter></term> 526555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 527555991fdSmrg </varlistentry> 528555991fdSmrg <varlistentry> 529555991fdSmrg <term><parameter>fast</parameter></term> 530555991fdSmrg <listitem><para>if <symbol>True</symbol>, then client should save its state as quickly as possible.</para></listitem> 531555991fdSmrg </varlistentry> 532555991fdSmrg</variablelist> 533555991fdSmrg 534555991fdSmrg <para> 535555991fdSmrgThe session manager sends a “Save Yourself” message to a 536555991fdSmrgclient either to checkpoint it or just before termination so that it 537555991fdSmrgcan save its state. The client responds with zero or more calls 538555991fdSmrgto <function>SmcSetProperties</function> to update the properties 539555991fdSmrgindicating how to restart the client. When all the properties have 540555991fdSmrgbeen set, the client calls <function>SmcSaveYourselfDone</function> 541555991fdSmrg </para> 542555991fdSmrg 543555991fdSmrg <para> 544555991fdSmrgIf <parameter>interact_style</parameter> is 545555991fdSmrg<constant>SmInteractStyleNone</constant> the 546555991fdSmrgclient must not interact with the user while saving state. 547555991fdSmrgIf <parameter>interact_style</parameter> is 548555991fdSmrg<constant>SmInteractStyleErrors</constant> the 549555991fdSmrgclient may interact with the user only if an error condition arises. 550555991fdSmrgIf <parameter>interact_style</parameter> is 551555991fdSmrg<constant>SmInteractStyleAny</constant> then the 552555991fdSmrgclient may interact with the user for any purpose. Because only one 553555991fdSmrgclient can interact with the user at a time, the client must 554555991fdSmrgcall <function>SmcInteractRequest</function> and wait for an 555555991fdSmrg“Interact” message from the session manager. When the 556555991fdSmrgclient is done interacting with the user, it 557555991fdSmrgcalls <function>SmcInteractDone</function> The client may only 558555991fdSmrgcall <function>SmcInteractRequest</function> after it receives a 559555991fdSmrg“Save Yourself” message and before it 560555991fdSmrgcalls <function>SmcSaveYourselfDone</function> 561555991fdSmrg </para> 562555991fdSmrg 563555991fdSmrg <para> 564555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveLocal</constant> the 565555991fdSmrgclient must update the properties to reflect its current state. Specifically, 566555991fdSmrgit should save enough information to restore the state as seen by the 567555991fdSmrguser of this client. It should not affect the state as seen by other users. 568555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveGlobal</constant> 569555991fdSmrgthe user wants the client to commit all of its data to permanent, globally 570555991fdSmrgaccessible storage. 571555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveBoth</constant> 572555991fdSmrgthe client should do both of these (it should first commit the data to 573555991fdSmrgpermanent storage before updating its properties). 574555991fdSmrg </para> 575555991fdSmrg 576555991fdSmrg <para> 577555991fdSmrgSome examples are as follows: 578555991fdSmrg 579555991fdSmrg <itemizedlist mark='bullet'> 580555991fdSmrg <listitem><para> 581555991fdSmrgIf a word processor were sent a “Save Yourself” with a 582555991fdSmrgtype of <constant>SmSaveLocal</constant> it could create a temporary 583555991fdSmrgfile that included the current contents of the file, the location of 584555991fdSmrgthe cursor, and other aspects of the current editing session. It 585555991fdSmrgwould then update its <property>SmRestartCommand</property> property with 586555991fdSmrgenough information to find this temporary file. 587555991fdSmrg </para></listitem> 588555991fdSmrg <listitem><para> 589555991fdSmrgIf a word processor were sent a “Save Yourself” with a 590555991fdSmrgtype of <constant>SmSaveGlobal</constant> it would simply save the 591555991fdSmrgcurrently edited file. 592555991fdSmrg </para></listitem> 593555991fdSmrg <listitem><para> 594555991fdSmrgIf a word processor were sent a “Save Yourself” with a 595555991fdSmrgtype of <constant>SmSaveBoth</constant> it would first save the 596555991fdSmrgcurrently edited file. It would then create a temporary file with 597555991fdSmrginformation such as the current position of the cursor and what file 598555991fdSmrgis being edited. Finally, it would update its 599555991fdSmrg<property>SmRestartCommand</property> property with enough information 600555991fdSmrgto find the temporary file. 601555991fdSmrg </para></listitem> 602555991fdSmrg </itemizedlist> 603555991fdSmrg </para> 604555991fdSmrg 605555991fdSmrg <para> 606555991fdSmrgThe <parameter>shutdown</parameter> argument specifies whether the 607555991fdSmrgsystem is being shut down. 608555991fdSmrgThe interaction is different depending on whether or not shutdown is 609555991fdSmrgset. If not shutting down, the client should save its state and wait 610555991fdSmrgfor a “Save Complete” message. If shutting down, the 611555991fdSmrgclient must save state and then prevent interaction until it receives 612555991fdSmrgeither a “Die” or a “Shutdown Cancelled.” 613555991fdSmrg </para> 614555991fdSmrg 615555991fdSmrg <para> 616555991fdSmrgThe <parameter>fast</parameter> argument specifies that the client 617555991fdSmrgshould save its state as quickly as possible. For example, if the 618555991fdSmrgsession manager knows that power is about to fail, it would 619555991fdSmrgset <parameter>fast</parameter> to <constant>True</constant>. 620555991fdSmrg </para> 621555991fdSmrg </sect2> 622555991fdSmrg 623555991fdSmrg <sect2 id='the_die_callback'> 624555991fdSmrg <title>The Die Callback</title> 625555991fdSmrg 626555991fdSmrg <para> 627555991fdSmrgThe Die callback is of type <function>SmcDieProc</function> 628555991fdSmrg </para> 629555991fdSmrg 630555991fdSmrg<funcsynopsis> 631555991fdSmrg<funcprototype> 632555991fdSmrg <funcdef>typedef void (*<function>SmcDieProc</function>)</funcdef> 633555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 634555991fdSmrg <paramdef>SmcConn <parameter>client_data</parameter></paramdef> 635555991fdSmrg</funcprototype> 636555991fdSmrg</funcsynopsis> 637555991fdSmrg 638555991fdSmrg<variablelist remap='IP'> 639555991fdSmrg <varlistentry> 640555991fdSmrg <term><parameter>smc_conn</parameter></term> 641555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 642555991fdSmrg </varlistentry> 643555991fdSmrg <varlistentry> 644555991fdSmrg <term><parameter>client_data</parameter></term> 645555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 646555991fdSmrg </varlistentry> 647555991fdSmrg</variablelist> 648555991fdSmrg 649555991fdSmrg 650555991fdSmrg <para> 651555991fdSmrgThe session manager sends a “Die” message to a client when 652555991fdSmrgit wants it to die. The client should respond by calling 653555991fdSmrg<function>SmcCloseConnection</function>. A session manager that 654555991fdSmrgbehaves properly will send a “Save Yourself” message 655555991fdSmrgbefore the “Die” message. 656555991fdSmrg </para> 657555991fdSmrg </sect2> 658555991fdSmrg 659555991fdSmrg <sect2 id='the_save_complete_callback'> 660555991fdSmrg <title>The Save Complete Callback</title> 661555991fdSmrg 662555991fdSmrg <para> 663555991fdSmrgThe Save Complete callback is of type <function>SmcSaveCompleteProc</function> 664555991fdSmrg </para> 665555991fdSmrg 666555991fdSmrg<funcsynopsis> 667555991fdSmrg <funcprototype> 668555991fdSmrg <funcdef>typedef void (*<function>SmcSaveCompleteProc</function>)</funcdef> 669555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 670555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 671555991fdSmrg </funcprototype> 672555991fdSmrg</funcsynopsis> 673555991fdSmrg 674555991fdSmrg<variablelist remap='IP'> 675555991fdSmrg <varlistentry> 676555991fdSmrg <term><parameter>smc_conn</parameter></term> 677555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 678555991fdSmrg </varlistentry> 679555991fdSmrg <varlistentry> 680555991fdSmrg <term><parameter>client_data</parameter></term> 681555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 682555991fdSmrg </varlistentry> 683555991fdSmrg</variablelist> 684555991fdSmrg </sect2> 685555991fdSmrg 686555991fdSmrg 687555991fdSmrg <sect2 id='the_shutdown_cancelled_callback'> 688555991fdSmrg <title>The Shutdown Cancelled Callback</title> 689555991fdSmrg 690555991fdSmrg <para> 691555991fdSmrgThe Shutdown Cancelled callback is of type 692555991fdSmrg<function>SmcShutdownCancelledProc</function> 693555991fdSmrg </para> 694555991fdSmrg 695555991fdSmrg<funcsynopsis> 696555991fdSmrg <funcprototype> 697555991fdSmrg <funcdef>typedef void (*<function>SmcShutdownCancelledProc</function>)</funcdef> 698555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 699555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 700555991fdSmrg </funcprototype> 701555991fdSmrg</funcsynopsis> 702555991fdSmrg 703555991fdSmrg<variablelist remap='IP'> 704555991fdSmrg <varlistentry> 705555991fdSmrg <term><parameter>smc_conn</parameter></term> 706555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 707555991fdSmrg </varlistentry> 708555991fdSmrg <varlistentry> 709555991fdSmrg <term><parameter>client_data</parameter></term> 710555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 711555991fdSmrg </varlistentry> 712555991fdSmrg</variablelist> 713555991fdSmrg 714555991fdSmrg <para> 715555991fdSmrgThe session manager sends a “Shutdown Cancelled” message 716555991fdSmrgwhen the user cancelled the shutdown during an interaction 717555991fdSmrg(see <link linkend='interacting_with_the_user'>section 5.5, 718555991fdSmrg“Interacting With the User”</link>). The client can now 719555991fdSmrgcontinue as if the shutdown had never happened. If the client has not 720555991fdSmrgcalled <function>SmcSaveYourselfDone</function> yet, it can either 721555991fdSmrgabort the save and then call <function>SmcSaveYourselfDone</function> 722555991fdSmrgwith the success argument set to <constant>False</constant> or it can 723555991fdSmrgcontinue with the save and then call <function>SmcSaveYourselfDone</function> 724555991fdSmrgwith the <parameter>success</parameter> argument set to reflect the outcome 725555991fdSmrgof the save. 726555991fdSmrg </para> 727555991fdSmrg </sect2> 728555991fdSmrg </sect1> 729555991fdSmrg 730555991fdSmrg <sect1 id='closing_the_connection'><title>Closing the Connection</title> 731555991fdSmrg 732555991fdSmrg <para> 733555991fdSmrgTo close a connection with a session manager, 734555991fdSmrguse <function>SmcCloseConnection</function> 735555991fdSmrg </para> 736555991fdSmrg 737555991fdSmrg<funcsynopsis> 738555991fdSmrg <funcprototype> 739555991fdSmrg <funcdef>SmcCloseStatus <function>SmcCloseConnection</function></funcdef> 740555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 741555991fdSmrg <paramdef>int <parameter>count</parameter></paramdef> 742555991fdSmrg <paramdef>char **<parameter>reason_msgs</parameter></paramdef> 743555991fdSmrg </funcprototype> 744555991fdSmrg</funcsynopsis> 745555991fdSmrg<variablelist remap='IP'> 746555991fdSmrg <varlistentry> 747555991fdSmrg <term><parameter>smc_conn</parameter></term> 748555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 749555991fdSmrg </varlistentry> 750555991fdSmrg <varlistentry> 751555991fdSmrg <term><parameter>count</parameter></term> 752555991fdSmrg <listitem><para>The number of reasons for closing the connection.</para></listitem> 753555991fdSmrg </varlistentry> 754555991fdSmrg <varlistentry> 755555991fdSmrg <term><parameter>reason_msgs</parameter></term> 756555991fdSmrg <listitem><para>The reasons for closing the connection.</para></listitem> 757555991fdSmrg </varlistentry> 758555991fdSmrg</variablelist> 759555991fdSmrg 760555991fdSmrg <para> 761555991fdSmrgThe <parameter>reason_msgs</parameter> argument will most likely be 762555991fdSmrg<constant>NULL</constant> if resignation is expected by the client. 763555991fdSmrgOtherwise, it contains a list of null-terminated Compound Text strings 764555991fdSmrgrepresenting the reason for termination. The session manager should 765555991fdSmrgdisplay these reason messages to the user. 766555991fdSmrg </para> 767555991fdSmrg 768555991fdSmrg <para> 769555991fdSmrgNote that SMlib used the ICE protocol to establish a connection with 770555991fdSmrgthe session manager, and various protocols other than session 771555991fdSmrgmanagement may be active on the ICE connection. 772555991fdSmrgWhen <function>SmcCloseConnection</function> is called, the ICE 773555991fdSmrgconnection will be closed only if all protocols have been shutdown on 774555991fdSmrgthe connection. Check the ICElib standard 775555991fdSmrgfor <function>IceAddConnectionWatch</function> 776555991fdSmrgand <function>IceRemoveConnectionWatch</function> to learn how to set 777555991fdSmrgup a callback to be invoked each time an ICE connection is opened or 778555991fdSmrgclosed. Typically this callback adds/removes the ICE file descriptor 779555991fdSmrgfrom the list of active descriptors to call <function>select</function> on 780555991fdSmrg(or calls <function>XtAppAddInput</function> or 781555991fdSmrg<function>XtRemoveInput</function>). 782555991fdSmrg </para> 783555991fdSmrg 784555991fdSmrg 785555991fdSmrg <para> 786555991fdSmrg<function>SmcCloseConnection</function> returns one of the following values: 787555991fdSmrg 788555991fdSmrg <itemizedlist mark='bullet'> 789555991fdSmrg <listitem><para> 790555991fdSmrg<constant>SmcClosedNow</constant> - the ICE connection was closed at 791555991fdSmrgthis time, the watch procedures were invoked, and the connection was freed. 792555991fdSmrg </para></listitem> 793555991fdSmrg <listitem><para> 794555991fdSmrg<constant>SmcClosedASAP</constant> - an IO error had occurred on the 795555991fdSmrgconnection, but <function>SmcCloseConnection</function> is being 796555991fdSmrgcalled within a nested <function>IceProcessMessages</function> The 797555991fdSmrgwatch procedures have been invoked at this time, but the connection 798555991fdSmrgwill be freed as soon as possible (when the nesting level reaches zero 799555991fdSmrgand <function>IceProcessMessages</function> returns a status 800555991fdSmrgof <function>IceProcessMessagesConnectionClosed</function> 801555991fdSmrg </para> </listitem> 802555991fdSmrg <listitem><para> 803555991fdSmrg<constant>SmcConnectionInUse</constant> - the connection was not closed at 804555991fdSmrgthis time, because it is being used by other active protocols. 805555991fdSmrg </para> </listitem> 806555991fdSmrg </itemizedlist> 807555991fdSmrg </para> 808555991fdSmrg </sect1> 809555991fdSmrg 810555991fdSmrg 811555991fdSmrg <sect1 id='modifying_callbacks'> 812555991fdSmrg <title>Modifying Callbacks</title> 813555991fdSmrg 814555991fdSmrg <para> 815555991fdSmrgTo modify callbacks set up in <function>SmcOpenConnection</function> 816555991fdSmrguse <function>SmcModifyCallbacks</function> 817555991fdSmrg </para> 818555991fdSmrg 819555991fdSmrg<funcsynopsis> 820555991fdSmrg <funcprototype> 821555991fdSmrg <funcdef>void <function>SmcModifyCallbacks</function></funcdef> 822555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 823555991fdSmrg <paramdef>unsigned long <parameter>mask</parameter></paramdef> 824555991fdSmrg <paramdef>SmcCallbacks *<parameter>callbacks</parameter></paramdef> 825555991fdSmrg </funcprototype> 826555991fdSmrg</funcsynopsis> 827555991fdSmrg<variablelist remap='IP'> 828555991fdSmrg <varlistentry> 829555991fdSmrg <term><parameter>smc_conn</parameter></term> 830555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 831555991fdSmrg </varlistentry> 832555991fdSmrg <varlistentry> 833555991fdSmrg <term><parameter>mask</parameter></term> 834555991fdSmrg <listitem><para>A mask indicating which callbacks to modify.</para></listitem> 835555991fdSmrg </varlistentry> 836555991fdSmrg <varlistentry> 837555991fdSmrg <term><parameter>callbacks</parameter></term> 838555991fdSmrg <listitem><para>The new callbacks.</para></listitem> 839555991fdSmrg </varlistentry> 840555991fdSmrg</variablelist> 841555991fdSmrg 842555991fdSmrg <para> 843555991fdSmrgWhen specifying a value for the <parameter>mask</parameter> argument, 844555991fdSmrgthe following values may be ORed together: 845555991fdSmrg 846555991fdSmrg <simplelist type='vert'> 847555991fdSmrg <member><constant>SmcSaveYourselfProcMask</constant></member> 848555991fdSmrg <member><constant>SmcDieProcMask</constant></member> 849555991fdSmrg <member><constant>SmcSaveCompleteProcMask</constant></member> 850555991fdSmrg <member><constant>SmcShutdownCancelledProcMask</constant></member> 851555991fdSmrg </simplelist> 852555991fdSmrg </para> 853555991fdSmrg </sect1> 854555991fdSmrg 855555991fdSmrg <sect1 id='setting_deleting_and_retrieving_session_management_properties'> 856555991fdSmrg <title>Setting, Deleting, and Retrieving Session Management Properties</title> 857555991fdSmrg 858555991fdSmrg <para> 859555991fdSmrgTo set session management properties for this client, 860555991fdSmrguse <function>SmcSetProperties</function> 861555991fdSmrg </para> 862555991fdSmrg 863555991fdSmrg<funcsynopsis> 864555991fdSmrg <funcprototype> 865555991fdSmrg <funcdef>void <function>SmcSetProperties</function></funcdef> 866555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 867555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 868555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 869555991fdSmrg </funcprototype> 870555991fdSmrg</funcsynopsis> 871555991fdSmrg 872555991fdSmrg<variablelist remap='IP'> 873555991fdSmrg <varlistentry> 874555991fdSmrg <term><parameter>smc_conn</parameter></term> 875555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 876555991fdSmrg </varlistentry> 877555991fdSmrg <varlistentry> 878555991fdSmrg <term><parameter>num_props</parameter></term> 879555991fdSmrg <listitem><para>The number of properties.</para></listitem> 880555991fdSmrg </varlistentry> 881555991fdSmrg <varlistentry> 882555991fdSmrg <term><parameter>props</parameter></term> 883555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 884555991fdSmrg </varlistentry> 885555991fdSmrg</variablelist> 886555991fdSmrg 887555991fdSmrg 888555991fdSmrg <para> 889555991fdSmrgThe properties are specified as an array of property pointers. 890555991fdSmrgPreviously set property values may be over-written using 891555991fdSmrgthe <function>SmcSetProperties</function> function. Note that the 892555991fdSmrgsession manager is not expected to restore property values when the 893555991fdSmrgsession is restarted. Because of this, clients should not try to use 894555991fdSmrgthe session manager as a database for storing application specific state. 895555991fdSmrg </para> 896555991fdSmrg 897555991fdSmrg <para> 898555991fdSmrgFor a description of session management properties and 899555991fdSmrgthe <structname>SmProp</structname> structure, 900555991fdSmrgsee <link linkend='session_management_properties'>section 7, 901555991fdSmrg“Session Management Properties.”</link> 902555991fdSmrg </para> 903555991fdSmrg 904555991fdSmrg 905555991fdSmrg <para> 906555991fdSmrgTo delete properties previously set by the client, 907555991fdSmrguse <function>SmcDeleteProperties</function> 908555991fdSmrg </para> 909555991fdSmrg 910555991fdSmrg<funcsynopsis> 911555991fdSmrg <funcprototype> 912555991fdSmrg <funcdef>void <function>SmcDeleteProperties</function></funcdef> 913555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 914555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 915555991fdSmrg <paramdef>char **<parameter>prop_names</parameter></paramdef> 916555991fdSmrg </funcprototype> 917555991fdSmrg</funcsynopsis> 918555991fdSmrg<variablelist remap='IP'> 919555991fdSmrg <varlistentry> 920555991fdSmrg <term><parameter>smc_conn</parameter></term> 921555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 922555991fdSmrg </varlistentry> 923555991fdSmrg <varlistentry> 924555991fdSmrg <term><parameter>num_props</parameter></term> 925555991fdSmrg <listitem><para>The number of properties.</para></listitem> 926555991fdSmrg </varlistentry> 927555991fdSmrg <varlistentry> 928555991fdSmrg <term><parameter>prop_names</parameter></term> 929555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 930555991fdSmrg </varlistentry> 931555991fdSmrg</variablelist> 932555991fdSmrg 933555991fdSmrg <para> 934555991fdSmrgTo get properties previously stored by the client, 935555991fdSmrguse <function>SmcGetProperties</function> 936555991fdSmrg </para> 937555991fdSmrg 938555991fdSmrg<funcsynopsis> 939555991fdSmrg <funcprototype> 940555991fdSmrg <funcdef>Status <function>SmcGetProperties</function></funcdef> 941555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 942555991fdSmrg <paramdef>SmcPropReplyProc <parameter>prop_reply_proc</parameter></paramdef> 943555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 944555991fdSmrg </funcprototype> 945555991fdSmrg</funcsynopsis> 946555991fdSmrg 947555991fdSmrg<variablelist remap='IP'> 948555991fdSmrg <varlistentry> 949555991fdSmrg <term><parameter>smc_conn</parameter></term> 950555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 951555991fdSmrg </varlistentry> 952555991fdSmrg <varlistentry> 953555991fdSmrg <term><parameter>prop_reply_proc</parameter></term> 954555991fdSmrg <listitem><para>The callback to be invoked when the properties reply comes back.</para></listitem> 955555991fdSmrg </varlistentry> 956555991fdSmrg <varlistentry> 957555991fdSmrg <term><parameter>client_data</parameter></term> 958555991fdSmrg <listitem><para>This pointer to client data will be passed to the <function>SmcPropReplyProc</function> callback.</para></listitem> 959555991fdSmrg </varlistentry> 960555991fdSmrg</variablelist> 961555991fdSmrg 962555991fdSmrg <para> 963555991fdSmrgThe return value of <function>SmcGetProperties</function> is zero for 964555991fdSmrgfailure and a positive value for success. 965555991fdSmrg </para> 966555991fdSmrg 967555991fdSmrg <para> 968555991fdSmrgNote that the library does not block until the properties reply comes 969555991fdSmrgback. Rather, a callback of type <function>SmcPropReplyProc</function> 970555991fdSmrgis invoked when the data is ready. 971555991fdSmrg </para> 972555991fdSmrg 973555991fdSmrg<funcsynopsis> 974555991fdSmrg <funcprototype> 975555991fdSmrg <funcdef>typedef void (*<function>SmcPropReplyProc</function>)</funcdef> 976555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 977555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 978555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 979555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 980555991fdSmrg </funcprototype> 981555991fdSmrg</funcsynopsis> 982555991fdSmrg 983555991fdSmrg<variablelist remap='IP'> 984555991fdSmrg <varlistentry> 985555991fdSmrg <term><parameter>smc_conn</parameter></term> 986555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 987555991fdSmrg </varlistentry> 988555991fdSmrg <varlistentry> 989555991fdSmrg <term><parameter>client_data</parameter></term> 990555991fdSmrg <listitem><para>This pointer to client data will be passed to the <function>SmcPropReplyProc</function> callback.</para></listitem> 991555991fdSmrg </varlistentry> 992555991fdSmrg <varlistentry> 993555991fdSmrg <term><parameter>num_props</parameter></term> 994555991fdSmrg <listitem><para>The number of properties returned.</para></listitem> 995555991fdSmrg </varlistentry> 996555991fdSmrg <varlistentry> 997555991fdSmrg <term><parameter>props</parameter></term> 998555991fdSmrg <listitem><para>The list of properties returned.</para></listitem> 999555991fdSmrg </varlistentry> 1000555991fdSmrg</variablelist> 1001555991fdSmrg 1002555991fdSmrg <para> 1003555991fdSmrgTo free each property, use <function>SmFreeProperty</function> 1004555991fdSmrg(see <link linkend='freeing_data'>section 8, “Freeing 1005555991fdSmrgData”</link>). To free the actual array of pointers, 1006555991fdSmrguse <function>free</function> 1007555991fdSmrg </para> 1008555991fdSmrg </sect1> 1009555991fdSmrg 1010555991fdSmrg <sect1 id='interacting_with_the_user'> 1011555991fdSmrg <title>Interacting With the User</title> 1012555991fdSmrg 1013555991fdSmrg <para> 1014555991fdSmrgAfter receiving a “Save Yourself” message with an 1015555991fdSmrg<parameter>interact_style</parameter> of 1016555991fdSmrg<constant>SmInteractStyleErrors</constant> 1017555991fdSmrgor <constant>SmInteractStyleAny</constant> the client may choose to 1018555991fdSmrginteract with the user. Because only one client can interact with the 1019555991fdSmrguser at a time, the client must call <function>SmcInteractRequest</function> 1020555991fdSmrgand wait for an “Interact” message from the session manager. 1021555991fdSmrg </para> 1022555991fdSmrg 1023555991fdSmrg<funcsynopsis> 1024555991fdSmrg <funcprototype> 1025555991fdSmrg <funcdef>Status <function>SmcInteractRequest</function></funcdef> 1026555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1027555991fdSmrg <paramdef>int <parameter>dialog_type</parameter></paramdef> 1028555991fdSmrg <paramdef>SmcInteractProc <parameter>interact_proc</parameter></paramdef> 1029555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1030555991fdSmrg </funcprototype> 1031555991fdSmrg</funcsynopsis> 1032555991fdSmrg 1033555991fdSmrg<variablelist remap='IP'> 1034555991fdSmrg <varlistentry> 1035555991fdSmrg <term><parameter>smc_conn</parameter></term> 1036555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1037555991fdSmrg </varlistentry> 1038555991fdSmrg <varlistentry> 1039555991fdSmrg <term><parameter>dialog_type</parameter></term> 1040555991fdSmrg <listitem><para>The type of dialog the client wishes to present to the user.</para></listitem> 1041555991fdSmrg </varlistentry> 1042555991fdSmrg <varlistentry> 1043555991fdSmrg <term><parameter>interact_proc</parameter></term> 1044555991fdSmrg <listitem><para>The callback to be invoked when the “Interact” message arrives from the session manager.</para></listitem> 1045555991fdSmrg </varlistentry> 1046555991fdSmrg <varlistentry> 1047555991fdSmrg <term><parameter>client_data</parameter></term> 1048555991fdSmrg <listitem><para> 1049555991fdSmrgThis pointer to client data will be passed to 1050555991fdSmrgthe <function>SmcInteractProc</function> callback when the 1051555991fdSmrg“Interact” message arrives. 1052555991fdSmrg </para></listitem> 1053555991fdSmrg </varlistentry> 1054555991fdSmrg</variablelist> 1055555991fdSmrg 1056555991fdSmrg <para> 1057555991fdSmrgThe return value of <function>SmcInteractRequest</function> is zero 1058555991fdSmrgfor failure and a positive value for success. 1059555991fdSmrg </para> 1060555991fdSmrg 1061555991fdSmrg <para> 1062555991fdSmrgThe <parameter>dialog_type</parameter> argument specifies 1063555991fdSmrgeither <constant>SmDialogError</constant> indicating that the client 1064555991fdSmrgwants to start an error dialog, or <constant>SmDialogNormal</constant> 1065555991fdSmrgmeaning that the client wishes to start a nonerror dialog. 1066555991fdSmrg </para> 1067555991fdSmrg 1068555991fdSmrg <para> 1069555991fdSmrgNote that if a shutdown is in progress, the user may have the option 1070555991fdSmrgof cancelling the shutdown. If the shutdown is cancelled, the clients 1071555991fdSmrgthat have not interacted yet with the user will receive a 1072555991fdSmrg“Shutdown Cancelled” message instead of the 1073555991fdSmrg“Interact” message. 1074555991fdSmrg </para> 1075555991fdSmrg 1076555991fdSmrg <para> 1077555991fdSmrgThe <function>SmcInteractProc</function> callback will be invoked when 1078555991fdSmrgthe “Interact” message arrives from the session manager. 1079555991fdSmrg </para> 1080555991fdSmrg 1081555991fdSmrg<funcsynopsis> 1082555991fdSmrg <funcprototype> 1083555991fdSmrg <funcdef>typedef void (*<function>SmcInteractProc</function>)</funcdef> 1084555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1085555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1086555991fdSmrg </funcprototype> 1087555991fdSmrg</funcsynopsis> 1088555991fdSmrg 1089555991fdSmrg<variablelist remap='IP'> 1090555991fdSmrg <varlistentry> 1091555991fdSmrg <term><parameter>smc_conn</parameter></term> 1092555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1093555991fdSmrg </varlistentry> 1094555991fdSmrg <varlistentry> 1095555991fdSmrg <term><parameter>client_data</parameter></term> 1096555991fdSmrg <listitem><para>Client data specified when the callback was registered.</para></listitem> 1097555991fdSmrg </varlistentry> 1098555991fdSmrg</variablelist> 1099555991fdSmrg 1100555991fdSmrg <para> 1101555991fdSmrgAfter interacting with the user (in response to an “Interact” 1102555991fdSmrgmessage), you should call <function>SmcInteractDone</function> 1103555991fdSmrg </para> 1104555991fdSmrg 1105555991fdSmrg<funcsynopsis> 1106555991fdSmrg <funcprototype> 1107555991fdSmrg <funcdef>void <function>SmcInteractDone</function></funcdef> 1108555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1109555991fdSmrg <paramdef>Bool <parameter>cancel_shutdown</parameter></paramdef> 1110555991fdSmrg </funcprototype> 1111555991fdSmrg</funcsynopsis> 1112555991fdSmrg 1113555991fdSmrg<variablelist remap='IP'> 1114555991fdSmrg <varlistentry> 1115555991fdSmrg <term><parameter>smc_conn</parameter></term> 1116555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1117555991fdSmrg </varlistentry> 1118555991fdSmrg <varlistentry> 1119555991fdSmrg <term><parameter>cancel_shutdown</parameter></term> 1120555991fdSmrg <listitem><para>If <constant>True</constant>, indicates that the user requests that the entire shutdown be cancelled.</para></listitem> 1121555991fdSmrg </varlistentry> 1122555991fdSmrg</variablelist> 1123555991fdSmrg <para> 1124555991fdSmrgThe <parameter>cancel_shutdown</parameter> argument may only be 1125555991fdSmrg<constant>True</constant> if the corresponding “Save Yourself” 1126555991fdSmrgspecified <constant>True</constant> for shutdown 1127555991fdSmrgand <constant>SmInteractStyleErrors</constant> 1128555991fdSmrgor <constant>SmInteractStyleAny</constant> for 1129555991fdSmrgthe <parameter>interact_style</parameter>. 1130555991fdSmrg </para> 1131555991fdSmrg </sect1> 1132555991fdSmrg 1133555991fdSmrg <sect1 id='requesting_a_save_yourself'> 1134555991fdSmrg <title>Requesting a Save Yourself</title> 1135555991fdSmrg 1136555991fdSmrg <para> 1137555991fdSmrgTo request a checkpoint from the session manager, 1138555991fdSmrguse <function>SmcRequestSaveYourself</function> 1139555991fdSmrg </para> 1140555991fdSmrg 1141555991fdSmrg<funcsynopsis> 1142555991fdSmrg <funcprototype> 1143555991fdSmrg <funcdef>void <function>SmcRequestSaveYourself</function></funcdef> 1144555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1145555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 1146555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 1147555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 1148555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 1149555991fdSmrg <paramdef>Bool <parameter>global</parameter></paramdef> 1150555991fdSmrg </funcprototype> 1151555991fdSmrg</funcsynopsis> 1152555991fdSmrg 1153555991fdSmrg 1154555991fdSmrg<variablelist remap='IP'> 1155555991fdSmrg <varlistentry> 1156555991fdSmrg <term><parameter>smc_conn</parameter></term> 1157555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1158555991fdSmrg </varlistentry> 1159555991fdSmrg <varlistentry> 1160555991fdSmrg <term><parameter>save_type</parameter></term> 1161555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 1162555991fdSmrg </varlistentry> 1163555991fdSmrg <varlistentry> 1164555991fdSmrg <term><parameter>shutdown</parameter></term> 1165555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 1166555991fdSmrg </varlistentry> 1167555991fdSmrg <varlistentry> 1168555991fdSmrg <term><parameter>interact_style</parameter></term> 1169555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 1170555991fdSmrg </varlistentry> 1171555991fdSmrg <varlistentry> 1172555991fdSmrg <term><parameter>fast</parameter></term> 1173555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 1174555991fdSmrg </varlistentry> 1175555991fdSmrg <varlistentry> 1176555991fdSmrg <term><parameter>global</parameter></term> 1177555991fdSmrg <listitem><para>Controls who gets the “Save Yourself.”</para></listitem> 1178555991fdSmrg </varlistentry> 1179555991fdSmrg</variablelist> 1180555991fdSmrg 1181555991fdSmrg <para> 1182555991fdSmrgThe <parameter>save_type</parameter>, <parameter>shutdown</parameter>, 1183555991fdSmrg<parameter>interact_style</parameter>, and <parameter>fast</parameter> 1184555991fdSmrgarguments are discussed in more detail in 1185555991fdSmrg<link linkend='the_save_yourself_callback'>section 5.1.1, 1186555991fdSmrg“The Save Yourself Callback.”</link> 1187555991fdSmrg </para> 1188555991fdSmrg 1189555991fdSmrg <para> 1190555991fdSmrgIf <parameter>global</parameter> is set to <constant>True</constant> then 1191555991fdSmrgthe resulting “Save Yourself” should be sent to all clients in the 1192555991fdSmrgsession. For example, a vendor of a Uninterruptible Power Supply 1193555991fdSmrg(<acronym>UPS</acronym>) might include a Session Management client 1194555991fdSmrgthat would monitor the status of the UPS and generate a fast shutdown 1195555991fdSmrgif the power is about to be lost. 1196555991fdSmrg </para> 1197555991fdSmrg 1198555991fdSmrg <para> 1199555991fdSmrgIf global is set to <constant>False</constant> then the “Save 1200555991fdSmrgYourself” should only be sent to the client that requested it. 1201555991fdSmrg </para> 1202555991fdSmrg </sect1> 1203555991fdSmrg 1204555991fdSmrg <sect1 id='requesting_a_save_yourself_phase_2'> 1205555991fdSmrg <title>Requesting a Save Yourself Phase 2</title> 1206555991fdSmrg 1207555991fdSmrg <para> 1208555991fdSmrgIn response to a “Save Yourself”, the client may request to be 1209555991fdSmrginformed when all the other clients are quiescent so that it can save their 1210555991fdSmrgstate. To do so, use <function>SmcRequestSaveYourselfPhase2</function> 1211555991fdSmrg </para> 1212555991fdSmrg 1213555991fdSmrg<funcsynopsis> 1214555991fdSmrg <funcprototype> 1215555991fdSmrg <funcdef>Status <function>SmcRequestSaveYourselfPhase2</function></funcdef> 1216555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1217555991fdSmrg <paramdef>SmcSaveYourselfPhase2Proc <parameter>save_yourself_phase2_proc</parameter></paramdef> 1218555991fdSmrg <paramdef>SmPointer <parameter>client_data</parameter></paramdef> 1219555991fdSmrg </funcprototype> 1220555991fdSmrg</funcsynopsis> 1221555991fdSmrg 1222555991fdSmrg<variablelist remap='IP'> 1223555991fdSmrg <varlistentry> 1224555991fdSmrg <term><parameter>smc_conn</parameter></term> 1225555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1226555991fdSmrg </varlistentry> 1227555991fdSmrg <varlistentry> 1228555991fdSmrg <term><parameter>save_type_phase2_proc</parameter></term> 1229555991fdSmrg <listitem><para>The callback to be invoked when the “Save Yourself Phase 2” message arrives from the session manager.</para></listitem> 1230555991fdSmrg </varlistentry> 1231555991fdSmrg <varlistentry> 1232555991fdSmrg <term><parameter>client_data</parameter></term> 1233555991fdSmrg <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> 1234555991fdSmrg </varlistentry> 1235555991fdSmrg</variablelist> 1236555991fdSmrg 1237555991fdSmrg <para> 1238555991fdSmrgThe return value of <function>SmcRequestSaveYourselfPhase2</function> 1239555991fdSmrgis zero for failure and a positive value for success. 1240555991fdSmrg </para> 1241555991fdSmrg 1242555991fdSmrg <para> 1243555991fdSmrgThis request is needed by clients that manage other clients (for 1244555991fdSmrgexample, window managers, workspace managers, and so on). The manager 1245555991fdSmrgmust make sure that all of the clients that are being managed are in 1246555991fdSmrgan idle state so that their state can be saved. 1247555991fdSmrg </para> 1248555991fdSmrg </sect1> 1249555991fdSmrg 1250555991fdSmrg <sect1 id='completing_a_save_yourself'> 1251555991fdSmrg <title>Completing a Save Yourself</title> 1252555991fdSmrg 1253555991fdSmrg <para> 1254555991fdSmrgAfter saving state in response to a “Save Yourself” 1255555991fdSmrgmessage, you should call <function>SmcSaveYourselfDone</function> 1256555991fdSmrg </para> 1257555991fdSmrg 1258555991fdSmrg<funcsynopsis> 1259555991fdSmrg <funcprototype> 1260555991fdSmrg <funcdef>void <function>SmcSaveYourselfDone</function></funcdef> 1261555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1262555991fdSmrg <paramdef>Bool <parameter>success</parameter></paramdef> 1263555991fdSmrg </funcprototype> 1264555991fdSmrg</funcsynopsis> 1265555991fdSmrg 1266555991fdSmrg<variablelist remap='IP'> 1267555991fdSmrg <varlistentry> 1268555991fdSmrg <term><parameter>smc_conn</parameter></term> 1269555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1270555991fdSmrg </varlistentry> 1271555991fdSmrg <varlistentry> 1272555991fdSmrg <term><parameter>success</parameter></term> 1273555991fdSmrg <listitem><para>If <constant>True</constant> the “Save Yourself” operation was completed successfully.</para></listitem> 1274555991fdSmrg </varlistentry> 1275555991fdSmrg</variablelist> 1276555991fdSmrg 1277555991fdSmrg <para> 1278555991fdSmrgBefore calling <function>SmcSaveYourselfDone</function> the client 1279555991fdSmrgmust have set each required property at least once since the client 1280555991fdSmrgregistered with the session manager. 1281555991fdSmrg </para> 1282555991fdSmrg </sect1> 1283555991fdSmrg 1284555991fdSmrg <sect1 id='using_smc_informational_functions'> 1285555991fdSmrg <title>Using Smc Informational Functions</title> 1286555991fdSmrg 1287555991fdSmrg<funcsynopsis> 1288555991fdSmrg <funcprototype> 1289555991fdSmrg <funcdef>int <function>SmcProtocolVersion</function></funcdef> 1290555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1291555991fdSmrg </funcprototype> 1292555991fdSmrg</funcsynopsis> 1293555991fdSmrg 1294555991fdSmrg <para> 1295555991fdSmrg<function>SmcProtocolVersion</function> returns the major version of 1296555991fdSmrgthe session management protocol associated with this session. 1297555991fdSmrg </para> 1298555991fdSmrg 1299555991fdSmrg 1300555991fdSmrg<funcsynopsis> 1301555991fdSmrg <funcprototype> 1302555991fdSmrg <funcdef>int <function>SmcProtocolRevision</function></funcdef> 1303555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1304555991fdSmrg </funcprototype> 1305555991fdSmrg</funcsynopsis> 1306555991fdSmrg 1307555991fdSmrg <para> 1308555991fdSmrg<function>SmcProtocolRevision</function> returns the minor version of 1309555991fdSmrgthe session management protocol associated with this session. 1310555991fdSmrg </para> 1311555991fdSmrg 1312555991fdSmrg<funcsynopsis> 1313555991fdSmrg <funcprototype> 1314555991fdSmrg <funcdef>char *<function>SmcVendor</function></funcdef> 1315555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1316555991fdSmrg </funcprototype> 1317555991fdSmrg</funcsynopsis> 1318555991fdSmrg 1319555991fdSmrg <para> 1320555991fdSmrg<function>SmcVendor</function> returns a string that provides some 1321555991fdSmrgidentification of the owner of the session manager. The string should 1322555991fdSmrgbe freed with a call to <function>free</function> 1323555991fdSmrg </para> 1324555991fdSmrg 1325555991fdSmrg<funcsynopsis> 1326555991fdSmrg <funcprototype> 1327555991fdSmrg <funcdef>char *<function>SmcRelease</function></funcdef> 1328555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1329555991fdSmrg </funcprototype> 1330555991fdSmrg</funcsynopsis> 1331555991fdSmrg 1332555991fdSmrg <para> 1333555991fdSmrg<function>SmcRelease</function> returns a string that provides the 1334555991fdSmrgrelease number of the session manager. The string should be freed 1335555991fdSmrgwith a call to <function>free</function> 1336555991fdSmrg </para> 1337555991fdSmrg 1338555991fdSmrg<funcsynopsis> 1339555991fdSmrg <funcprototype> 1340555991fdSmrg <funcdef>char *<function>SmcClientID</function></funcdef> 1341555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1342555991fdSmrg </funcprototype> 1343555991fdSmrg</funcsynopsis> 1344555991fdSmrg 1345555991fdSmrg <para> 1346555991fdSmrg<function>SmcClientID</function> returns a null-terminated string for 1347555991fdSmrgthe client ID associated with this connection. This information was 1348555991fdSmrgalso returned in <function>SmcOpenConnection</function> (it is 1349555991fdSmrgprovided here for convenience). Call <function>free</function> on 1350555991fdSmrgthis pointer when the client ID is no longer needed. 1351555991fdSmrg </para> 1352555991fdSmrg 1353555991fdSmrg<funcsynopsis> 1354555991fdSmrg <funcprototype> 1355555991fdSmrg <funcdef>IceConn <function>SmcGetIceConnection</function></funcdef> 1356555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1357555991fdSmrg </funcprototype> 1358555991fdSmrg</funcsynopsis> 1359555991fdSmrg 1360555991fdSmrg <para> 1361555991fdSmrg<function>SmcGetIceConnection</function> returns the ICE connection 1362555991fdSmrgobject associated with this session management connection object. The 1363555991fdSmrgICE connection object can be used to get some additional information 1364555991fdSmrgabout the connection. Some of the more useful functions which can be 1365555991fdSmrgused on the IceConn are <function>IceConnectionNumber</function>, 1366555991fdSmrg<function>IceConnectionString</function>, 1367555991fdSmrg<function>IceLastSentSequenceNumber</function>, 1368555991fdSmrg<function>IceLastReceivedSequenceNumber</function>, 1369555991fdSmrgand <function>IcePing</function>. For further information, see 1370555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 1371555991fdSmrgstandard. 1372555991fdSmrg </para> 1373555991fdSmrg </sect1> 1374555991fdSmrg 1375555991fdSmrg <sect1 id='error_handling'> 1376555991fdSmrg <title>Error Handling</title> 1377555991fdSmrg 1378555991fdSmrg <para> 1379555991fdSmrgIf the client receives an unexpected protocol error from the session 1380555991fdSmrgmanager, an error handler is invoked by SMlib. A default error 1381555991fdSmrghandler exists that simply prints the error message 1382555991fdSmrgto <varname>stderr</varname> and exits if the severity of the error 1383555991fdSmrgis fatal. The client can change this error handler by calling 1384555991fdSmrgthe <function>SmcSetErrorHandler</function> function. 1385555991fdSmrg </para> 1386555991fdSmrg 1387555991fdSmrg<funcsynopsis> 1388555991fdSmrg <funcprototype> 1389555991fdSmrg <funcdef>SmcErrorHandler <function>SmcSetErrorHandler</function></funcdef> 1390555991fdSmrg <paramdef>SmcErrorHandler <parameter>handler</parameter></paramdef> 1391555991fdSmrg </funcprototype> 1392555991fdSmrg</funcsynopsis> 1393555991fdSmrg 1394555991fdSmrg <para> 1395555991fdSmrgThe error handler. You should pass <constant>NULL</constant> to 1396555991fdSmrgrestore the default handler. 1397555991fdSmrg </para> 1398555991fdSmrg 1399555991fdSmrg 1400555991fdSmrg <para> 1401555991fdSmrg<function>SmcSetErrorHandler</function> returns the previous error handler. 1402555991fdSmrg </para> 1403555991fdSmrg 1404555991fdSmrg <para> 1405555991fdSmrgThe <function>SmcErrorHandler</function> has the following type: 1406555991fdSmrg </para> 1407555991fdSmrg 1408555991fdSmrg<funcsynopsis> 1409555991fdSmrg <funcprototype> 1410555991fdSmrg <funcdef>typedef void (*<function>SmcErrorHandler</function>)</funcdef> 1411555991fdSmrg <paramdef>SmcConn <parameter>smc_conn</parameter></paramdef> 1412555991fdSmrg <paramdef>Bool <parameter>swap</parameter></paramdef> 1413555991fdSmrg <paramdef>int <parameter>offending_minor_opcode</parameter></paramdef> 1414555991fdSmrg <paramdef>unsigned long <parameter>offending_sequence_num</parameter></paramdef> 1415555991fdSmrg <paramdef>int <parameter>error_class</parameter></paramdef> 1416555991fdSmrg <paramdef>int <parameter>severity</parameter></paramdef> 1417555991fdSmrg <paramdef>IcePointer <parameter>values</parameter></paramdef> 1418555991fdSmrg </funcprototype> 1419555991fdSmrg</funcsynopsis> 1420555991fdSmrg 1421555991fdSmrg<variablelist remap='IP'> 1422555991fdSmrg <varlistentry> 1423555991fdSmrg <term><parameter>smc_conn</parameter></term> 1424555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1425555991fdSmrg </varlistentry> 1426555991fdSmrg <varlistentry> 1427555991fdSmrg <term><parameter>swap</parameter></term> 1428555991fdSmrg <listitem><para>A flag that indicates if the specified values need byte swapping.</para></listitem> 1429555991fdSmrg </varlistentry> 1430555991fdSmrg <varlistentry> 1431555991fdSmrg <term><parameter>offending_minor_opcode</parameter></term> 1432555991fdSmrg <listitem><para>The minor opcode of the offending message.</para></listitem> 1433555991fdSmrg </varlistentry> 1434555991fdSmrg <varlistentry> 1435555991fdSmrg <term><parameter>offending_sequence_num</parameter></term> 1436555991fdSmrg <listitem><para>The sequence number of the offending message.</para></listitem> 1437555991fdSmrg </varlistentry> 1438555991fdSmrg <varlistentry> 1439555991fdSmrg <term><parameter>error_class</parameter></term> 1440555991fdSmrg <listitem><para>The error class of the offending message.</para></listitem> 1441555991fdSmrg </varlistentry> 1442555991fdSmrg <varlistentry> 1443555991fdSmrg <term><parameter>severity</parameter></term> 1444555991fdSmrg <listitem><para><constant>IceCanContinue</constant>, 1445555991fdSmrg <constant>IceFatalToProtocol</constant>, or 1446555991fdSmrg <constant>IceFatalToConnection</constant> 1447555991fdSmrg </para></listitem> 1448555991fdSmrg </varlistentry> 1449555991fdSmrg <varlistentry> 1450555991fdSmrg <term><parameter>values</parameter></term> 1451555991fdSmrg <listitem><para>Any additional error values specific to the minor opcode and class.</para></listitem> 1452555991fdSmrg </varlistentry> 1453555991fdSmrg</variablelist> 1454555991fdSmrg 1455555991fdSmrg <para> 1456555991fdSmrgNote that this error handler is invoked for protocol related errors. 1457555991fdSmrgTo install an error handler to be invoked when an IO error occurs, use 1458555991fdSmrg<function>IceSetIOErrorHandler</function> For further information, see 1459555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 1460555991fdSmrgstandard. 1461555991fdSmrg </para> 1462555991fdSmrg </sect1> 1463555991fdSmrg</chapter> 1464555991fdSmrg 1465555991fdSmrg<chapter id='session_management_server'> 1466555991fdSmrg <title>Session Management Server (<acronym>Sms</acronym>) Functions</title> 1467555991fdSmrg 1468555991fdSmrg <para> 1469555991fdSmrgThis section discusses how Session Management servers: 1470555991fdSmrg 1471555991fdSmrg <itemizedlist mark='bullet'> 1472555991fdSmrg <listitem><para>Initialize the library</para></listitem> 1473555991fdSmrg <listitem><para>Register the client</para></listitem> 1474555991fdSmrg <listitem><para>Send a “Save Yourself” message</para></listitem> 1475555991fdSmrg <listitem><para>Send a “Save Yourself Phase 2” message</para></listitem> 1476555991fdSmrg <listitem><para>Send an “Interact” message</para></listitem> 1477555991fdSmrg <listitem><para>Send a “Save Complete” message</para></listitem> 1478555991fdSmrg <listitem><para>Send a “Die” message</para></listitem> 1479555991fdSmrg <listitem><para>Cancel a shutdown</para></listitem> 1480555991fdSmrg <listitem><para>Return properties</para></listitem> 1481555991fdSmrg <listitem><para>Ping a client</para></listitem> 1482555991fdSmrg <listitem><para>Clean up after a client disconnects</para></listitem> 1483555991fdSmrg <listitem><para>Use Sms informational functions</para></listitem> 1484555991fdSmrg <listitem><para>Handle errors</para></listitem> 1485555991fdSmrg </itemizedlist> 1486555991fdSmrg </para> 1487555991fdSmrg 1488555991fdSmrg <sect1 id='initializing_the_library'> 1489555991fdSmrg <title>Initializing the Library</title> 1490555991fdSmrg 1491555991fdSmrg <para> 1492555991fdSmrg<function>SmsInitialize</function> is the first SMlib function that 1493555991fdSmrgshould be called by a session manager. It provides information about 1494555991fdSmrgthe session manager and registers a callback that will be invoked each 1495555991fdSmrgtime a new client connects to the session manager. 1496555991fdSmrg </para> 1497555991fdSmrg 1498555991fdSmrg<funcsynopsis> 1499555991fdSmrg <funcprototype> 1500555991fdSmrg <funcdef>Status <function>SmsInitialize</function></funcdef> 1501555991fdSmrg <paramdef>char *<parameter>vendor</parameter></paramdef> 1502555991fdSmrg <paramdef>char *<parameter>release</parameter></paramdef> 1503555991fdSmrg <paramdef>SmsNewClientProc <parameter>new_client_proc</parameter></paramdef> 1504555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1505555991fdSmrg <paramdef>IceHostBasedAuthProc <parameter>host_based_auth_proc</parameter></paramdef> 1506555991fdSmrg <paramdef>int <parameter>error_length</parameter></paramdef> 1507555991fdSmrg <paramdef>char *<parameter>error_string_ret</parameter></paramdef> 1508555991fdSmrg </funcprototype> 1509555991fdSmrg</funcsynopsis> 1510555991fdSmrg 1511555991fdSmrg 1512555991fdSmrg 1513555991fdSmrg<variablelist remap='IP'> 1514555991fdSmrg <varlistentry> 1515555991fdSmrg <term><parameter>vendor</parameter></term> 1516555991fdSmrg <listitem><para>A string specifying the session manager vendor.</para></listitem> 1517555991fdSmrg </varlistentry> 1518555991fdSmrg <varlistentry> 1519555991fdSmrg <term><parameter>release</parameter></term> 1520555991fdSmrg <listitem><para>A string specifying the session manager release number.</para></listitem> 1521555991fdSmrg </varlistentry> 1522555991fdSmrg <varlistentry> 1523555991fdSmrg <term><parameter>new_client_proc</parameter></term> 1524555991fdSmrg <listitem><para>Callback to be invoked each time a new client connects to the session manager.</para></listitem> 1525555991fdSmrg </varlistentry> 1526555991fdSmrg <varlistentry> 1527555991fdSmrg <term><parameter>manager_data</parameter></term> 1528555991fdSmrg <listitem><para>When the <function>SmsNewClientProc</function> callback is invoked, this pointer to manager data will be passed.</para></listitem> 1529555991fdSmrg </varlistentry> 1530555991fdSmrg <varlistentry> 1531555991fdSmrg <term><parameter>host_based_auth_proc</parameter></term> 1532555991fdSmrg <listitem><para>Host based authentication callback.</para></listitem> 1533555991fdSmrg </varlistentry> 1534555991fdSmrg <varlistentry> 1535555991fdSmrg <term><parameter>error_length</parameter></term> 1536555991fdSmrg <listitem><para>Length of the <parameter>error_string_ret</parameter> argument passed in.</para></listitem> 1537555991fdSmrg </varlistentry> 1538555991fdSmrg <varlistentry> 1539555991fdSmrg <term><parameter>error_string_ret</parameter></term> 1540555991fdSmrg <listitem><para> 1541555991fdSmrgReturns a null-terminated error message, if any. 1542555991fdSmrgThe <parameter>error_string_ret</parameter> points to user supplied memory. 1543555991fdSmrgNo more than <parameter>error_length</parameter> bytes are used. 1544555991fdSmrg </para></listitem> 1545555991fdSmrg </varlistentry> 1546555991fdSmrg</variablelist> 1547555991fdSmrg 1548555991fdSmrg <para> 1549555991fdSmrgAfter the <function>SmsInitialize</function> function is called, the 1550555991fdSmrgsession manager should call the <function>IceListenForConnections</function> 1551555991fdSmrgfunction to listen for new connections. Afterwards, each time a 1552555991fdSmrgclient connects, the session manager should 1553555991fdSmrgcall <function>IceAcceptConnection</function> 1554555991fdSmrg </para> 1555555991fdSmrg 1556555991fdSmrg <para> 1557555991fdSmrgSee <link linkend='authentication_of_clients'>section 9, 1558555991fdSmrg“Authentication of Clients,”</link> for more details on 1559555991fdSmrgauthentication (including host based authentication). Also see 1560555991fdSmrgthe <citetitle pubwork='article'>Inter-Client Exchange 1561555991fdSmrgLibrary</citetitle> standard for further details on listening for and 1562555991fdSmrgaccepting ICE connections. 1563555991fdSmrg </para> 1564555991fdSmrg 1565555991fdSmrg <para> 1566555991fdSmrgEach time a new client connects to the session manager, 1567555991fdSmrgthe <function>SmsNewClientProc</function> callback is invoked. The 1568555991fdSmrgsession manager obtains a new opaque connection object that it should 1569555991fdSmrguse for all future interaction with the client. At this time, the 1570555991fdSmrgsession manager must also register a set of callbacks to respond to 1571555991fdSmrgthe different messages that the client might send. 1572555991fdSmrg </para> 1573555991fdSmrg 1574555991fdSmrg<funcsynopsis> 1575555991fdSmrg <funcprototype> 1576555991fdSmrg <funcdef>typedef Status (*<function>SmsNewClientProc</function>)</funcdef> 1577555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1578555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1579555991fdSmrg <paramdef>unsigned long *<parameter>mask_ret</parameter></paramdef> 1580555991fdSmrg <paramdef>SmsCallbacks *<parameter>callbacks_ret</parameter></paramdef> 1581555991fdSmrg <paramdef>char **<parameter>failure_reason_ret</parameter></paramdef> 1582555991fdSmrg </funcprototype> 1583555991fdSmrg</funcsynopsis> 1584555991fdSmrg 1585555991fdSmrg<variablelist remap='IP'> 1586555991fdSmrg <varlistentry> 1587555991fdSmrg <term><parameter>sms_conn</parameter></term> 1588555991fdSmrg <listitem><para>A new opaque connection object.</para></listitem> 1589555991fdSmrg </varlistentry> 1590555991fdSmrg <varlistentry> 1591555991fdSmrg <term><parameter>manager_data</parameter></term> 1592555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1593555991fdSmrg </varlistentry> 1594555991fdSmrg <varlistentry> 1595555991fdSmrg <term><parameter>mask_ret</parameter></term> 1596555991fdSmrg <listitem><para>On return, indicates which callbacks were set by the session manager.</para></listitem> 1597555991fdSmrg </varlistentry> 1598555991fdSmrg <varlistentry> 1599555991fdSmrg <term><parameter>callbacks_ret</parameter></term> 1600555991fdSmrg <listitem><para>On return, contains the callbacks registered by the session manager.</para></listitem> 1601555991fdSmrg </varlistentry> 1602555991fdSmrg <varlistentry> 1603555991fdSmrg <term><parameter>failure_reason_ret</parameter></term> 1604555991fdSmrg <listitem><para>Failure reason returned.</para></listitem> 1605555991fdSmrg </varlistentry> 1606555991fdSmrg</variablelist> 1607555991fdSmrg 1608555991fdSmrg <para> 1609555991fdSmrgIf a failure occurs, the <function>SmsNewClientProc</function> should 1610555991fdSmrgreturn a zero status as well as allocate and return a failure reason 1611555991fdSmrgstring in <parameter>failure_reason_ret</parameter>. 1612555991fdSmrgSMlib will be responsible for freeing this memory. 1613555991fdSmrg </para> 1614555991fdSmrg 1615555991fdSmrg <para> 1616555991fdSmrgThe session manager must register a set of callbacks to respond to 1617555991fdSmrgclient events. The <parameter>mask_ret</parameter> argument specifies 1618555991fdSmrgwhich callbacks are set. All of the callbacks specified in this version of 1619555991fdSmrgSMlib are mandatory. The <parameter>mask_ret</parameter> argument is 1620555991fdSmrgnecessary in order to maintain backwards compatibility in future versions 1621555991fdSmrgof the library. 1622555991fdSmrg </para> 1623555991fdSmrg 1624555991fdSmrg <para> 1625555991fdSmrgThe following values may be ORed together to obtain a mask value: 1626555991fdSmrg 1627555991fdSmrg <simplelist type='vert'> 1628555991fdSmrg <member><constant>SmsRegisterClientProcMask</constant></member> 1629555991fdSmrg <member><constant>SmsInteractRequestProcMask</constant></member> 1630555991fdSmrg <member><constant>SmsInteractDoneProcMask</constant></member> 1631555991fdSmrg <member><constant>SmsSaveYourselfRequestProcMask</constant></member> 1632555991fdSmrg <member><constant>SmsSaveYourselfP2RequestProcMask</constant></member> 1633555991fdSmrg <member><constant>SmsSaveYourselfDoneProcMask</constant></member> 1634555991fdSmrg <member><constant>SmsCloseConnectionProcMask</constant></member> 1635555991fdSmrg <member><constant>SmsSetPropertiesProcMask</constant></member> 1636555991fdSmrg <member><constant>SmsDeletePropertiesProcMask</constant></member> 1637555991fdSmrg <member><constant>SmsGetPropertiesProcMask</constant></member> 1638555991fdSmrg </simplelist> 1639555991fdSmrg </para> 1640555991fdSmrg 1641555991fdSmrg <para> 1642555991fdSmrgFor each callback, the session manager can register a pointer to 1643555991fdSmrgmanager data specific to that callback. This pointer will be passed 1644555991fdSmrgto the callback when it is invoked by SMlib. 1645555991fdSmrg </para> 1646555991fdSmrg 1647555991fdSmrg<synopsis> 1648555991fdSmrgtypedef struct { 1649555991fdSmrg struct { 1650555991fdSmrg SmsRegisterClientProc callback; 1651555991fdSmrg SmPointer manager_data; 1652555991fdSmrg } register_client; 1653555991fdSmrg 1654555991fdSmrg struct { 1655555991fdSmrg SmsInteractRequestProc callback; 1656555991fdSmrg SmPointer manager_data; 1657555991fdSmrg } interact_request; 1658555991fdSmrg 1659555991fdSmrg struct { 1660555991fdSmrg SmsInteractDoneProc callback; 1661555991fdSmrg SmPointer manager_data; 1662555991fdSmrg } interact_done; 1663555991fdSmrg 1664555991fdSmrg struct { 1665555991fdSmrg SmsSaveYourselfRequestProc callback; 1666555991fdSmrg SmPointer manager_data; 1667555991fdSmrg } save_yourself_request; 1668555991fdSmrg 1669555991fdSmrg struct { 1670555991fdSmrg SmsSaveYourselfPhase2RequestProc callback; 1671555991fdSmrg SmPointer manager_data; 1672555991fdSmrg } save_yourself_phase2_request; 1673555991fdSmrg 1674555991fdSmrg struct { 1675555991fdSmrg SmsSaveYourselfDoneProc callback; 1676555991fdSmrg SmPointer manager_data; 1677555991fdSmrg } save_yourself_done; 1678555991fdSmrg 1679555991fdSmrg struct { 1680555991fdSmrg SmsCloseConnectionProc callback; 1681555991fdSmrg SmPointer manager_data; 1682555991fdSmrg } close_connection; 1683555991fdSmrg 1684555991fdSmrg struct { 1685555991fdSmrg SmsSetPropertiesProc callback; 1686555991fdSmrg SmPointer manager_data; 1687555991fdSmrg } set_properties; 1688555991fdSmrg 1689555991fdSmrg struct { 1690555991fdSmrg SmsDeletePropertiesProc callback; 1691555991fdSmrg SmPointer manager_data; 1692555991fdSmrg } delete_properties; 1693555991fdSmrg 1694555991fdSmrg struct { 1695555991fdSmrg SmsGetPropertiesProc callback; 1696555991fdSmrg SmPointer manager_data; 1697555991fdSmrg } get_properties; 1698555991fdSmrg 1699555991fdSmrg} SmsCallbacks; 1700555991fdSmrg</synopsis> 1701555991fdSmrg 1702555991fdSmrg <sect2 id='the_register_client_callback'> 1703555991fdSmrg <title>The Register Client Callback</title> 1704555991fdSmrg 1705555991fdSmrg <para> 1706555991fdSmrgThe Register Client callback is the first callback that will be 1707555991fdSmrginvoked after the client connects to the session manager. Its type 1708555991fdSmrgis <function>SmsRegisterClientProc</function> 1709555991fdSmrg </para> 1710555991fdSmrg 1711555991fdSmrg<funcsynopsis> 1712555991fdSmrg <funcprototype> 1713555991fdSmrg <funcdef>typedef Status (*<function>SmsRegisterClientProc</function>)</funcdef> 1714555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1715555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1716555991fdSmrg <paramdef>char *<parameter>previous_id</parameter></paramdef> 1717555991fdSmrg </funcprototype> 1718555991fdSmrg</funcsynopsis> 1719555991fdSmrg 1720555991fdSmrg<variablelist remap='IP'> 1721555991fdSmrg <varlistentry> 1722555991fdSmrg <term><parameter>sms_conn</parameter></term> 1723555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1724555991fdSmrg </varlistentry> 1725555991fdSmrg <varlistentry> 1726555991fdSmrg <term><parameter>manager_data</parameter></term> 1727555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1728555991fdSmrg </varlistentry> 1729555991fdSmrg <varlistentry> 1730555991fdSmrg <term><parameter>previous_id</parameter></term> 1731555991fdSmrg <listitem><para>The client ID from the previous session.</para></listitem> 1732555991fdSmrg </varlistentry> 1733555991fdSmrg</variablelist> 1734555991fdSmrg 1735555991fdSmrg <para> 1736555991fdSmrgBefore any further interaction takes place with the client, the client 1737555991fdSmrgmust be registered with the session manager. 1738555991fdSmrg </para> 1739555991fdSmrg 1740555991fdSmrg <para> 1741555991fdSmrgIf the client is being restarted from a previous session, 1742555991fdSmrg<parameter>previous_id</parameter> will contain a null-terminated string 1743555991fdSmrgrepresenting the client ID from the previous session. 1744555991fdSmrgCall <function>free</function> on the <parameter>previous_id</parameter> 1745555991fdSmrgpointer when it is no longer needed. If the client is first joining the 1746555991fdSmrgsession, <parameter>previous_id</parameter> will be <constant>NULL</constant>. 1747555991fdSmrg </para> 1748555991fdSmrg 1749555991fdSmrg <para> 1750555991fdSmrgIf <parameter>previous_id</parameter> is invalid, the session manager should 1751555991fdSmrgnot register the client at this time. This callback should return a status 1752555991fdSmrgof zero, which will cause an error message to be sent to the client. The 1753555991fdSmrgclient should re-register with previous_id set to <constant>NULL</constant>. 1754555991fdSmrg </para> 1755555991fdSmrg 1756555991fdSmrg <para> 1757555991fdSmrgOtherwise, the session manager should register the client with a unique 1758555991fdSmrgclient ID by calling the <function>SmsRegisterClientReply</function> 1759555991fdSmrgfunction (to be discussed shortly), and the 1760555991fdSmrg<function>SmsRegisterClientProc</function> callback should return a 1761555991fdSmrgstatus of one. 1762555991fdSmrg </para> 1763555991fdSmrg </sect2> 1764555991fdSmrg 1765555991fdSmrg <sect2 id='the_interact_request_callback'> 1766555991fdSmrg <title>The Interact Request Callback</title> 1767555991fdSmrg 1768555991fdSmrg <para> 1769555991fdSmrgThe Interact Request callback is of 1770555991fdSmrgtype <function>SmsInteractRequestProc</function> 1771555991fdSmrg </para> 1772555991fdSmrg 1773555991fdSmrg<funcsynopsis> 1774555991fdSmrg <funcprototype> 1775555991fdSmrg <funcdef>typedef void (*<function>SmsInteractRequestProc</function>)</funcdef> 1776555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1777555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1778555991fdSmrg <paramdef>int <parameter>dialog_type</parameter></paramdef> 1779555991fdSmrg </funcprototype> 1780555991fdSmrg</funcsynopsis> 1781555991fdSmrg 1782555991fdSmrg<variablelist remap='IP'> 1783555991fdSmrg <varlistentry> 1784555991fdSmrg <term><parameter>sms_conn</parameter></term> 1785555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1786555991fdSmrg </varlistentry> 1787555991fdSmrg <varlistentry> 1788555991fdSmrg <term><parameter>manager_data</parameter></term> 1789555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1790555991fdSmrg </varlistentry> 1791555991fdSmrg <varlistentry> 1792555991fdSmrg <term><parameter>dialog_type</parameter></term> 1793555991fdSmrg <listitem><para>The type of dialog the client wishes to present to the user.</para></listitem> 1794555991fdSmrg </varlistentry> 1795555991fdSmrg</variablelist> 1796555991fdSmrg 1797555991fdSmrg <para> 1798555991fdSmrgWhen a client receives a “Save Yourself” message with an 1799555991fdSmrg<parameter>interact_style</parameter> of 1800555991fdSmrg<constant>SmInteractStyleErrors</constant> 1801555991fdSmrgor <constant>SmInteractStyleAny</constant> the client may choose to 1802555991fdSmrginteract with the user. Because only one client can interact with the 1803555991fdSmrguser at a time, the client must request to interact with the user. 1804555991fdSmrgThe session manager should keep a queue of all clients wishing to 1805555991fdSmrginteract. It should send an “Interact” message to one 1806555991fdSmrgclient at a time and wait for an “Interact Done” message 1807555991fdSmrgbefore continuing with the next client. 1808555991fdSmrg </para> 1809555991fdSmrg 1810555991fdSmrg <para> 1811555991fdSmrgThe <parameter>dialog_type</parameter> argument specifies 1812555991fdSmrgeither <constant>SmDialogError</constant> indicating that the client 1813555991fdSmrgwants to start an error dialog, or <constant>SmDialogNormal</constant> 1814555991fdSmrgmeaning that the client wishes to start a nonerror dialog. 1815555991fdSmrg </para> 1816555991fdSmrg 1817555991fdSmrg <para> 1818555991fdSmrgIf a shutdown is in progress, the user may have the option of 1819555991fdSmrgcancelling the shutdown. If the shutdown is cancelled (specified in 1820555991fdSmrgthe “Interact Done” message), the session manager should 1821555991fdSmrgsend a “Shutdown Cancelled” message to each client that 1822555991fdSmrgrequested to interact. 1823555991fdSmrg </para> 1824555991fdSmrg </sect2> 1825555991fdSmrg 1826555991fdSmrg <sect2 id='the_interact_done_callback'> 1827555991fdSmrg <title>The Interact Done Callback</title> 1828555991fdSmrg 1829555991fdSmrg <para> 1830555991fdSmrgWhen the client is done interacting with the user, 1831555991fdSmrgthe <function>SmsInteractDoneProc</function> callback will be invoked. 1832555991fdSmrg </para> 1833555991fdSmrg 1834555991fdSmrg<funcsynopsis> 1835555991fdSmrg <funcprototype> 1836555991fdSmrg <funcdef>typedef void (*<function>SmsInteractDoneProc</function>)</funcdef> 1837555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1838555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1839555991fdSmrg <paramdef>Bool <parameter>cancel_shutdown</parameter></paramdef> 1840555991fdSmrg </funcprototype> 1841555991fdSmrg</funcsynopsis> 1842555991fdSmrg 1843555991fdSmrg<variablelist remap='IP'> 1844555991fdSmrg <varlistentry> 1845555991fdSmrg <term><parameter>sms_conn</parameter></term> 1846555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1847555991fdSmrg </varlistentry> 1848555991fdSmrg <varlistentry> 1849555991fdSmrg <term><parameter>manager_data</parameter></term> 1850555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1851555991fdSmrg </varlistentry> 1852555991fdSmrg <varlistentry> 1853555991fdSmrg <term><parameter>cancel_shutdown</parameter></term> 1854555991fdSmrg <listitem><para>Specifies if the user requests that the entire shutdown be cancelled.</para></listitem> 1855555991fdSmrg </varlistentry> 1856555991fdSmrg</variablelist> 1857555991fdSmrg 1858555991fdSmrg <para> 1859555991fdSmrgNote that the shutdown can be cancelled only if the corresponding 1860555991fdSmrg“Save Yourself” specified <constant>True</constant> for 1861555991fdSmrgshutdown and <constant>SmInteractStyleErrors</constant> 1862555991fdSmrgor <constant>SmInteractStyleAny</constant> for the 1863555991fdSmrg<parameter>interact_style</parameter>. 1864555991fdSmrg </para> 1865555991fdSmrg </sect2> 1866555991fdSmrg 1867555991fdSmrg 1868555991fdSmrg <sect2 id='the_save_yourself_request_callback'> 1869555991fdSmrg <title>The Save Yourself Request Callback</title> 1870555991fdSmrg 1871555991fdSmrg <para> 1872555991fdSmrgThe Save Yourself Request callback is of 1873555991fdSmrgtype <function>SmsSaveYourselfRequestProc</function> 1874555991fdSmrg </para> 1875555991fdSmrg 1876555991fdSmrg<funcsynopsis> 1877555991fdSmrg <funcprototype> 1878555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfRequestProc</function>)</funcdef> 1879555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1880555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1881555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 1882555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 1883555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 1884555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 1885555991fdSmrg <paramdef>Bool <parameter>global</parameter></paramdef> 1886555991fdSmrg </funcprototype> 1887555991fdSmrg</funcsynopsis> 1888555991fdSmrg 1889555991fdSmrg<variablelist remap='IP'> 1890555991fdSmrg <varlistentry> 1891555991fdSmrg <term><parameter>sms_conn</parameter></term> 1892555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1893555991fdSmrg </varlistentry> 1894555991fdSmrg <varlistentry> 1895555991fdSmrg <term><parameter>manager_data</parameter></term> 1896555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1897555991fdSmrg </varlistentry> 1898555991fdSmrg <varlistentry> 1899555991fdSmrg <term><parameter>save_type</parameter></term> 1900555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 1901555991fdSmrg </varlistentry> 1902555991fdSmrg <varlistentry> 1903555991fdSmrg <term><parameter>shutdown</parameter></term> 1904555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 1905555991fdSmrg </varlistentry> 1906555991fdSmrg <varlistentry> 1907555991fdSmrg <term><parameter>interact_style</parameter></term> 1908555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 1909555991fdSmrg </varlistentry> 1910555991fdSmrg <varlistentry> 1911555991fdSmrg <term><parameter>fast</parameter></term> 1912555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 1913555991fdSmrg </varlistentry> 1914555991fdSmrg <varlistentry> 1915555991fdSmrg <term><parameter>global</parameter></term> 1916555991fdSmrg <listitem><para>Controls who gets the “Save Yourself.”</para></listitem> 1917555991fdSmrg </varlistentry> 1918555991fdSmrg</variablelist> 1919555991fdSmrg 1920555991fdSmrg <para> 1921555991fdSmrgThe Save Yourself Request prompts the session manager to initiate a 1922555991fdSmrgcheckpoint or shutdown. For information on the 1923555991fdSmrg<parameter>save_type</parameter>, <parameter>shutdown</parameter>, 1924555991fdSmrg<parameter>interact_style</parameter>, and <parameter>fast</parameter> 1925555991fdSmrgarguments, see <link linkend='sending_a_save_yourself_message'>section 6.3, 1926555991fdSmrg“Sending a Save Yourself Message.”</link> 1927555991fdSmrg </para> 1928555991fdSmrg 1929555991fdSmrg <para> 1930555991fdSmrgIf <parameter>global</parameter> is set to <constant>True</constant> then the 1931555991fdSmrgresulting “Save Yourself” should be sent to all applications. 1932555991fdSmrgIf <parameter>global</parameter> is set to <constant>False</constant> then the 1933555991fdSmrg“Save Yourself” should only be sent to the client that requested it. 1934555991fdSmrg </para> 1935555991fdSmrg </sect2> 1936555991fdSmrg 1937555991fdSmrg <sect2 id='the_save_yourself_phase_2_request_callback'> 1938555991fdSmrg <title>The Save Yourself Phase 2 Request Callback</title> 1939555991fdSmrg 1940555991fdSmrg <para> 1941555991fdSmrgThe Save Yourself Phase 2 Request callback is of 1942555991fdSmrgtype <function>SmsSaveYourselfPhase2RequestProc</function> 1943555991fdSmrg </para> 1944555991fdSmrg 1945555991fdSmrg<funcsynopsis> 1946555991fdSmrg <funcprototype> 1947555991fdSmrg <funcdef>typedef void (*<function>SmsSaveYourselfPhase2RequestProc</function>)</funcdef> 1948555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1949555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1950555991fdSmrg </funcprototype> 1951555991fdSmrg</funcsynopsis> 1952555991fdSmrg 1953555991fdSmrg<variablelist remap='IP'> 1954555991fdSmrg <varlistentry> 1955555991fdSmrg <term><parameter>sms_conn</parameter></term> 1956555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1957555991fdSmrg </varlistentry> 1958555991fdSmrg <varlistentry> 1959555991fdSmrg <term><parameter>manager_data</parameter></term> 1960555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1961555991fdSmrg </varlistentry> 1962555991fdSmrg</variablelist> 1963555991fdSmrg 1964555991fdSmrg <para> 1965555991fdSmrgThis request is sent by clients that manage other clients (for 1966555991fdSmrgexample, window managers, workspace managers, and so on). Such 1967555991fdSmrgmanagers must make sure that all of the clients that are being managed 1968555991fdSmrgare in an idle state so that their state can be saved. 1969555991fdSmrg </para> 1970555991fdSmrg </sect2> 1971555991fdSmrg 1972555991fdSmrg <sect2 id='the_save_yourself_done_callback'> 1973555991fdSmrg <title>The Save Yourself Done Callback</title> 1974555991fdSmrg 1975555991fdSmrg <para> 1976555991fdSmrgWhen the client is done saving its state in response to a 1977555991fdSmrg“Save Yourself” message, 1978555991fdSmrgthe <function>SmsSaveYourselfDoneProc</function> will be invoked. 1979555991fdSmrg </para> 1980555991fdSmrg 1981555991fdSmrg<funcsynopsis> 1982555991fdSmrg <funcprototype> 1983555991fdSmrg <funcdef>typedef void (*<function>SaveYourselfDoneProc</function>)</funcdef> 1984555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 1985555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 1986555991fdSmrg <paramdef>Bool <parameter>success</parameter></paramdef> 1987555991fdSmrg </funcprototype> 1988555991fdSmrg</funcsynopsis> 1989555991fdSmrg 1990555991fdSmrg<variablelist remap='IP'> 1991555991fdSmrg <varlistentry> 1992555991fdSmrg <term><parameter>sms_conn</parameter></term> 1993555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 1994555991fdSmrg </varlistentry> 1995555991fdSmrg <varlistentry> 1996555991fdSmrg <term><parameter>manager_data</parameter></term> 1997555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 1998555991fdSmrg </varlistentry> 1999555991fdSmrg <varlistentry> 2000555991fdSmrg <term><parameter>success</parameter></term> 2001555991fdSmrg <listitem><para>If <constant>True</constant> the Save Yourself operation was completed successfully.</para></listitem> 2002555991fdSmrg </varlistentry> 2003555991fdSmrg</variablelist> 2004555991fdSmrg 2005555991fdSmrg <para> 2006555991fdSmrgBefore the “Save Yourself Done” was sent, the client must 2007555991fdSmrghave set each required property at least once since it registered with 2008555991fdSmrgthe session manager. 2009555991fdSmrg </para> 2010555991fdSmrg </sect2> 2011555991fdSmrg 2012555991fdSmrg <sect2 id='the_connection_closed_callback'> 2013555991fdSmrg <title>The Connection Closed Callback</title> 2014555991fdSmrg 2015555991fdSmrg <para> 2016555991fdSmrgIf the client properly terminates (that is, it 2017555991fdSmrgcalls <function>SmcCloseConnection</function>, 2018555991fdSmrgthe <function>SmsCloseConnectionProc</function> callback is invoked. 2019555991fdSmrg </para> 2020555991fdSmrg 2021555991fdSmrg<funcsynopsis> 2022555991fdSmrg <funcprototype> 2023555991fdSmrg <funcdef>typedef void (*<function>SmsCloseConnectionProc</function>)</funcdef> 2024555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2025555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2026555991fdSmrg <paramdef>int <parameter>count</parameter></paramdef> 2027555991fdSmrg <paramdef>char **<parameter>reason_msgs</parameter></paramdef> 2028555991fdSmrg </funcprototype> 2029555991fdSmrg</funcsynopsis> 2030555991fdSmrg 2031555991fdSmrg<variablelist remap='IP'> 2032555991fdSmrg <varlistentry> 2033555991fdSmrg <term><parameter>sms_conn</parameter></term> 2034555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2035555991fdSmrg </varlistentry> 2036555991fdSmrg<varlistentry> 2037555991fdSmrg <term><parameter>manager_data</parameter></term> 2038555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2039555991fdSmrg </varlistentry> 2040555991fdSmrg <varlistentry> 2041555991fdSmrg <term><parameter>count</parameter></term> 2042555991fdSmrg <listitem><para>The number of reason messages.</para></listitem> 2043555991fdSmrg </varlistentry> 2044555991fdSmrg <varlistentry> 2045555991fdSmrg <term><parameter>reason_msgs</parameter></term> 2046555991fdSmrg <listitem><para>The reasons for closing the connection.</para></listitem> 2047555991fdSmrg </varlistentry> 2048555991fdSmrg</variablelist> 2049555991fdSmrg 2050555991fdSmrg <para> 2051555991fdSmrgThe <parameter>reason_msgs</parameter> argument will most likely 2052555991fdSmrgbe <constant>NULL</constant> and the <parameter>count</parameter> 2053555991fdSmrgargument zero (0) if resignation is expected by the user. Otherwise, 2054555991fdSmrgit contains a list of null-terminated Compound Text strings 2055555991fdSmrgrepresenting the reason for termination. The session manager should 2056555991fdSmrgdisplay these reason messages to the user. 2057555991fdSmrg </para> 2058555991fdSmrg 2059555991fdSmrg <para> 2060555991fdSmrgCall <function>SmFreeReasons</function> to free the reason messages. 2061555991fdSmrgFor further information, see 2062555991fdSmrg<link linkend='freeing_data'>section 8, “Freeing Data”</link> 2063555991fdSmrg </para> 2064555991fdSmrg </sect2> 2065555991fdSmrg 2066555991fdSmrg <sect2 id='the_set_properties_callback'> 2067555991fdSmrg <title>The Set Properties Callback</title> 2068555991fdSmrg 2069555991fdSmrg <para> 2070555991fdSmrgWhen the client sets session management properties, 2071555991fdSmrgthe <function>SmsSetPropertiesProc</function> callback will be invoked. 2072555991fdSmrg </para> 2073555991fdSmrg 2074555991fdSmrg<funcsynopsis> 2075555991fdSmrg <funcprototype> 2076555991fdSmrg <funcdef>typedef void (*<function>SmsSetPropertiesProc</function>)</funcdef> 2077555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2078555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2079555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2080555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 2081555991fdSmrg </funcprototype> 2082555991fdSmrg</funcsynopsis> 2083555991fdSmrg 2084555991fdSmrg<variablelist remap='IP'> 2085555991fdSmrg <varlistentry> 2086555991fdSmrg <term><parameter>sms_conn</parameter></term> 2087555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2088555991fdSmrg </varlistentry> 2089555991fdSmrg <varlistentry> 2090555991fdSmrg <term><parameter>manager_data</parameter></term> 2091555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2092555991fdSmrg </varlistentry> 2093555991fdSmrg <varlistentry> 2094555991fdSmrg <term><parameter>num_props</parameter></term> 2095555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2096555991fdSmrg </varlistentry> 2097555991fdSmrg <varlistentry> 2098555991fdSmrg <term><parameter>props</parameter></term> 2099555991fdSmrg <listitem><para>The list of properties to set.</para></listitem> 2100555991fdSmrg </varlistentry> 2101555991fdSmrg</variablelist> 2102555991fdSmrg 2103555991fdSmrg <para> 2104555991fdSmrgThe properties are specified as an array of property pointers. For a 2105555991fdSmrgdescription of session management properties and 2106555991fdSmrgthe <structname>SmProp</structname> structure, 2107555991fdSmrgsee <link linkend='session_management_properties'>section 7, 2108555991fdSmrg“Session Management Properties.”</link> 2109555991fdSmrg </para> 2110555991fdSmrg 2111555991fdSmrg <para> 2112555991fdSmrgPreviously set property values may be over-written. Some properties 2113555991fdSmrghave predefined semantics. The session manager is required to store 2114555991fdSmrgnonpredefined properties. 2115555991fdSmrg </para> 2116555991fdSmrg 2117555991fdSmrg <para> 2118555991fdSmrgTo free each property, use <function>SmFreeProperty</function>. 2119555991fdSmrgFor further information, see <link linkend='freeing_data'>section 8, 2120555991fdSmrg“Freeing Data”</link> You should free the actual array of 2121555991fdSmrgpointers with a call to <function>free</function> 2122555991fdSmrg </para> 2123555991fdSmrg </sect2> 2124555991fdSmrg 2125555991fdSmrg <sect2 id='the_delete_properties_callback'> 2126555991fdSmrg <title>The Delete Properties Callback</title> 2127555991fdSmrg 2128555991fdSmrg <para> 2129555991fdSmrgWhen the client deletes session management properties, 2130555991fdSmrgthe <function>SmsDeletePropertiesProc</function> callback will be invoked. 2131555991fdSmrg </para> 2132555991fdSmrg 2133555991fdSmrg<funcsynopsis> 2134555991fdSmrg <funcprototype> 2135555991fdSmrg <funcdef>typedef void (*<function>SmsDeletePropertiesProc</function>)</funcdef> 2136555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2137555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2138555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2139555991fdSmrg <paramdef>char **<parameter>prop_names</parameter></paramdef> 2140555991fdSmrg </funcprototype> 2141555991fdSmrg</funcsynopsis> 2142555991fdSmrg 2143555991fdSmrg<variablelist remap='IP'> 2144555991fdSmrg <varlistentry> 2145555991fdSmrg <term><parameter>sms_conn</parameter></term> 2146555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2147555991fdSmrg </varlistentry> 2148555991fdSmrg <varlistentry> 2149555991fdSmrg <term><parameter>manager_data</parameter></term> 2150555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2151555991fdSmrg </varlistentry> 2152555991fdSmrg <varlistentry> 2153555991fdSmrg <term><parameter>num_props</parameter></term> 2154555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2155555991fdSmrg </varlistentry> 2156555991fdSmrg <varlistentry> 2157555991fdSmrg <term><parameter>prop_names</parameter></term> 2158555991fdSmrg <listitem><para>The list of properties to delete.</para></listitem> 2159555991fdSmrg </varlistentry> 2160555991fdSmrg</variablelist> 2161555991fdSmrg 2162555991fdSmrg <para> 2163555991fdSmrgThe properties are specified as an array of strings. For a 2164555991fdSmrgdescription of session management properties and 2165555991fdSmrgthe <structname>SmProp</structname> structure, 2166555991fdSmrgsee <link linkend='session_management_properties'>section 7, 2167555991fdSmrg“Session Management Properties.”</link> 2168555991fdSmrg </para> 2169555991fdSmrg </sect2> 2170555991fdSmrg 2171555991fdSmrg <sect2 id='the_get_properties_callback'> 2172555991fdSmrg <title>The Get Properties Callback</title> 2173555991fdSmrg 2174555991fdSmrg <para> 2175555991fdSmrgThe <function>SmsGetPropertiesProc</function> callback is invoked when 2176555991fdSmrgthe client wants to retrieve properties it set. 2177555991fdSmrg </para> 2178555991fdSmrg 2179555991fdSmrg<funcsynopsis> 2180555991fdSmrg <funcprototype> 2181555991fdSmrg <funcdef>typedef void (*<function>SmsGetPropertiesProc</function>)</funcdef> 2182555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2183555991fdSmrg <paramdef>SmPointer <parameter>manager_data</parameter></paramdef> 2184555991fdSmrg </funcprototype> 2185555991fdSmrg</funcsynopsis> 2186555991fdSmrg 2187555991fdSmrg<variablelist remap='IP'> 2188555991fdSmrg <varlistentry> 2189555991fdSmrg <term><parameter>sms_conn</parameter></term> 2190555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2191555991fdSmrg </varlistentry> 2192555991fdSmrg <varlistentry> 2193555991fdSmrg <term><parameter>manager_data</parameter></term> 2194555991fdSmrg <listitem><para>Manager data specified when the callback was registered.</para></listitem> 2195555991fdSmrg </varlistentry> 2196555991fdSmrg</variablelist> 2197555991fdSmrg 2198555991fdSmrg <para> 2199555991fdSmrgThe session manager should respond by 2200555991fdSmrgcalling <function>SmsReturnProperties</function>. 2201555991fdSmrgAll of the properties set for this client should be returned. 2202555991fdSmrg </para> 2203555991fdSmrg </sect2> 2204555991fdSmrg </sect1> 2205555991fdSmrg 2206555991fdSmrg <sect1 id='registering_the_client'> 2207555991fdSmrg <title>Registering the Client</title> 2208555991fdSmrg 2209555991fdSmrg <para> 2210555991fdSmrgTo register a client (in response to 2211555991fdSmrga <function>SmsRegisterClientProc</function> callback), 2212555991fdSmrguse <function>SmsRegisterClientReply</function>. 2213555991fdSmrg </para> 2214555991fdSmrg 2215555991fdSmrg<funcsynopsis> 2216555991fdSmrg <funcprototype> 2217555991fdSmrg <funcdef>Status <function>SmsRegisterClientReply</function></funcdef> 2218555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2219555991fdSmrg <paramdef>char *<parameter>client_id</parameter></paramdef> 2220555991fdSmrg </funcprototype> 2221555991fdSmrg</funcsynopsis> 2222555991fdSmrg 2223555991fdSmrg<variablelist remap='IP'> 2224555991fdSmrg <varlistentry> 2225555991fdSmrg <term><parameter>sms_conn</parameter></term> 2226555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2227555991fdSmrg </varlistentry> 2228555991fdSmrg <varlistentry> 2229555991fdSmrg <term><parameter>client_id</parameter></term> 2230555991fdSmrg <listitem><para>A null-terminated string representing a unique client ID.</para></listitem> 2231555991fdSmrg </varlistentry> 2232555991fdSmrg</variablelist> 2233555991fdSmrg 2234555991fdSmrg <para> 2235555991fdSmrgThe return value of <function>SmsRegisterClientReply</function> is 2236555991fdSmrgzero for failure and a positive value for success. Failure will occur 2237555991fdSmrgif SMlib can not allocate memory to hold a copy of the client ID for 2238555991fdSmrgit's own internal needs. 2239555991fdSmrg </para> 2240555991fdSmrg 2241555991fdSmrg <para> 2242555991fdSmrgIf a non-<constant>NULL</constant> <parameter>previous_id</parameter> was 2243555991fdSmrgspecified when the client registered itself, <parameter>client_id</parameter> 2244555991fdSmrgshould be identical to <parameter>previous_id</parameter>. 2245555991fdSmrg </para> 2246555991fdSmrg 2247555991fdSmrg <para> 2248555991fdSmrgOtherwise, <parameter>client_id</parameter> should be a unique ID freshly 2249555991fdSmrggenerated by the session manager. In addition, the session manager should 2250555991fdSmrgsend a “Save Yourself” message with 2251555991fdSmrg<parameter>type</parameter> = <constant>Local</constant>, 2252555991fdSmrg<parameter>shutdown</parameter> = <constant>False</constant>, 2253555991fdSmrg<parameter>interact-style</parameter> = <constant>None</constant>, 2254555991fdSmrgand <parameter>fast</parameter> = <constant>False</constant> 2255555991fdSmrgimmediately after registering the client. 2256555991fdSmrg </para> 2257555991fdSmrg 2258555991fdSmrg <para> 2259555991fdSmrgNote that once a client ID has been assigned to the client, the client 2260555991fdSmrgkeeps this ID indefinitely. If the client is terminated and 2261555991fdSmrgrestarted, it will be reassigned the same ID. It is desirable to be 2262555991fdSmrgable to pass client IDs around from machine to machine, from user to 2263555991fdSmrguser, and from session manager to session manager, while retaining the 2264555991fdSmrgidentity of the client. This, combined with the indefinite 2265555991fdSmrgpersistence of client IDs, means that client IDs need to be globally 2266555991fdSmrgunique. 2267555991fdSmrg </para> 2268555991fdSmrg 2269555991fdSmrg <para> 2270555991fdSmrgYou should call the <function>SmsGenerateClientID</function> function 2271555991fdSmrgto generate a globally unique client ID. 2272555991fdSmrg </para> 2273555991fdSmrg 2274555991fdSmrg<funcsynopsis> 2275555991fdSmrg <funcprototype> 2276555991fdSmrg <funcdef>char *<function>SmsGenerateClientID</function></funcdef> 2277555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2278555991fdSmrg </funcprototype> 2279555991fdSmrg</funcsynopsis> 2280555991fdSmrg 2281555991fdSmrg<variablelist remap='IP'> 2282555991fdSmrg <varlistentry> 2283555991fdSmrg <term><parameter>sms_conn</parameter></term> 2284555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2285555991fdSmrg </varlistentry> 2286555991fdSmrg</variablelist> 2287555991fdSmrg 2288555991fdSmrg 2289555991fdSmrg <para> 2290555991fdSmrg<constant>NULL</constant> will be returned if the ID could not be generated. 2291555991fdSmrgOtherwise, the return value of the function is the client ID. 2292555991fdSmrgIt should be freed with a call to <function>free</function> when 2293555991fdSmrgno longer needed. 2294555991fdSmrg </para> 2295555991fdSmrg </sect1> 2296555991fdSmrg 2297555991fdSmrg <sect1 id='sending_a_save_yourself_message'> 2298555991fdSmrg <title>Sending a Save Yourself Message</title> 2299555991fdSmrg 2300555991fdSmrg <para> 2301555991fdSmrgTo send a “Save Yourself” to a client, 2302555991fdSmrguse <function>SmsSaveYourself</function>. 2303555991fdSmrg </para> 2304555991fdSmrg 2305555991fdSmrg<funcsynopsis> 2306555991fdSmrg <funcprototype> 2307555991fdSmrg <funcdef>void <function>SmsSaveYourself</function></funcdef> 2308555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2309555991fdSmrg <paramdef>int <parameter>save_type</parameter></paramdef> 2310555991fdSmrg <paramdef>Bool <parameter>shutdown</parameter></paramdef> 2311555991fdSmrg <paramdef>int <parameter>interact_style</parameter></paramdef> 2312555991fdSmrg <paramdef>Bool <parameter>fast</parameter></paramdef> 2313555991fdSmrg </funcprototype> 2314555991fdSmrg</funcsynopsis> 2315555991fdSmrg 2316555991fdSmrg<variablelist remap='IP'> 2317555991fdSmrg <varlistentry> 2318555991fdSmrg <term><parameter>sms_conn</parameter></term> 2319555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2320555991fdSmrg </varlistentry> 2321555991fdSmrg <varlistentry> 2322555991fdSmrg <term><parameter>save_type</parameter></term> 2323555991fdSmrg <listitem><para>Specifies the type of information that should be saved.</para></listitem> 2324555991fdSmrg </varlistentry> 2325555991fdSmrg <varlistentry> 2326555991fdSmrg <term><parameter>shutdown</parameter></term> 2327555991fdSmrg <listitem><para>Specifies if a shutdown is taking place.</para></listitem> 2328555991fdSmrg </varlistentry> 2329555991fdSmrg <varlistentry> 2330555991fdSmrg <term><parameter>interact_style</parameter></term> 2331555991fdSmrg <listitem><para>The type of interaction allowed with the user.</para></listitem> 2332555991fdSmrg </varlistentry> 2333555991fdSmrg <varlistentry> 2334555991fdSmrg <term><parameter>fast</parameter></term> 2335555991fdSmrg <listitem><para>If <constant>True</constant> the client should save its state as quickly as possible.</para></listitem> 2336555991fdSmrg </varlistentry> 2337555991fdSmrg</variablelist> 2338555991fdSmrg 2339555991fdSmrg 2340555991fdSmrg <para> 2341555991fdSmrgThe session manager sends a “Save Yourself” message to a 2342555991fdSmrgclient either to checkpoint it or just before termination so that it 2343555991fdSmrgcan save its state. The client responds with zero or more “Set 2344555991fdSmrgProperties” messages to update the properties indicating how to 2345555991fdSmrgrestart the client. When all the properties have been set, the client 2346555991fdSmrgsends a “Save Yourself Done” message. 2347555991fdSmrg </para> 2348555991fdSmrg 2349555991fdSmrg <para> 2350555991fdSmrgIf <parameter>interact_style</parameter> 2351555991fdSmrgis <constant>SmInteractStyleNone</constant> the 2352555991fdSmrgclient must not interact with the user while saving state. 2353555991fdSmrgIf <parameter>interact_style</parameter> 2354555991fdSmrgis <constant>SmInteractStyleErrors</constant> the 2355555991fdSmrgclient may interact with the user only if an error condition arises. 2356555991fdSmrgIf <parameter>interact_style</parameter> 2357555991fdSmrgis <constant>SmInteractStyleAny</constant> then the 2358555991fdSmrgclient may interact with the user for any purpose. The client must 2359555991fdSmrgsend an “Interact Request” message and wait for an 2360555991fdSmrg“Interact” message from the session manager before it can 2361555991fdSmrginteract with the user. When the client is done interacting with the 2362555991fdSmrguser, it should send an “Interact Done” message. The 2363555991fdSmrg“Interact Request” message can be sent any time after a 2364555991fdSmrg“Save Yourself” and before a “Save Yourself 2365555991fdSmrgDone.” 2366555991fdSmrg </para> 2367555991fdSmrg 2368555991fdSmrg <para> 2369555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveLocal</constant> 2370555991fdSmrgthe client must update the properties to reflect its current state. 2371555991fdSmrgSpecifically, it should save enough information to restore the state as 2372555991fdSmrgseen by the user of this client. It should not affect the state as seen 2373555991fdSmrgby other users. 2374555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveGlobal</constant> 2375555991fdSmrgthe user wants the client to commit all of its data to permanent, globally 2376555991fdSmrgaccessible storage. 2377555991fdSmrgIf <parameter>save_type</parameter> is <constant>SmSaveBoth</constant> 2378555991fdSmrgthe client should do both of these (it should first commit the data to 2379555991fdSmrgpermanent storage before updating its properties). 2380555991fdSmrg </para> 2381555991fdSmrg 2382555991fdSmrg <para> 2383555991fdSmrgThe <parameter>shutdown</parameter> argument specifies whether the session 2384555991fdSmrgis being shut down. The interaction is different depending on whether or not 2385555991fdSmrgshutdown is set. If not shutting down, then the client can save and 2386555991fdSmrgresume normal operation. If shutting down, the client must save and 2387555991fdSmrgthen must prevent interaction until it receives either a 2388555991fdSmrg“Die” or a “Shutdown Cancelled,” because 2389555991fdSmrganything the user does after the save will be lost. 2390555991fdSmrg </para> 2391555991fdSmrg 2392555991fdSmrg <para> 2393555991fdSmrgThe <parameter>fast</parameter> argument specifies that the client should 2394555991fdSmrgsave its state as quickly as possible. For example, if the session manager 2395555991fdSmrgknows that power is about to fail, it should set <parameter>fast</parameter> 2396555991fdSmrgto <constant>True</constant>. 2397555991fdSmrg </para> 2398555991fdSmrg </sect1> 2399555991fdSmrg 2400555991fdSmrg <sect1 id='sending_a_save_yourself_phase_2_message'> 2401555991fdSmrg <title>Sending a Save Yourself Phase 2 Message</title> 2402555991fdSmrg 2403555991fdSmrg <para> 2404555991fdSmrgIn order to send a “Save Yourself Phase 2” message to a 2405555991fdSmrgclient, use <function>SmsSaveYourselfPhase2</function> 2406555991fdSmrg </para> 2407555991fdSmrg 2408555991fdSmrg<funcsynopsis> 2409555991fdSmrg <funcprototype> 2410555991fdSmrg <funcdef>void <function>SmsSaveYourselfPhase2</function></funcdef> 2411555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2412555991fdSmrg </funcprototype> 2413555991fdSmrg</funcsynopsis> 2414555991fdSmrg 2415555991fdSmrg<variablelist remap='IP'> 2416555991fdSmrg <varlistentry> 2417555991fdSmrg <term><parameter>sms_conn</parameter></term> 2418555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2419555991fdSmrg </varlistentry> 2420555991fdSmrg</variablelist> 2421555991fdSmrg 2422555991fdSmrg <para> 2423555991fdSmrgThe session manager sends this message to a client that has previously 2424555991fdSmrgsent a “Save Yourself Phase 2 Request” message. This 2425555991fdSmrgmessage informs the client that all other clients are in a fixed state 2426555991fdSmrgand this client can save state that is associated with other clients. 2427555991fdSmrg </para> 2428555991fdSmrg </sect1> 2429555991fdSmrg 2430555991fdSmrg <sect1 id='sending_an_interact_message'> 2431555991fdSmrg <title>Sending an Interact Message</title> 2432555991fdSmrg 2433555991fdSmrg <para> 2434555991fdSmrgTo send an “Interact” message to a client, 2435555991fdSmrguse <function>SmsInteract</function>. 2436555991fdSmrg </para> 2437555991fdSmrg 2438555991fdSmrg<funcsynopsis> 2439555991fdSmrg <funcprototype> 2440555991fdSmrg <funcdef>void <function>SmsInteract</function></funcdef> 2441555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2442555991fdSmrg </funcprototype> 2443555991fdSmrg</funcsynopsis> 2444555991fdSmrg 2445555991fdSmrg<variablelist remap='IP'> 2446555991fdSmrg <varlistentry> 2447555991fdSmrg <term><parameter>sms_conn</parameter></term> 2448555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2449555991fdSmrg </varlistentry> 2450555991fdSmrg</variablelist> 2451555991fdSmrg 2452555991fdSmrg <para> 2453555991fdSmrgThe “Interact” message grants the client the privilege of 2454555991fdSmrginteracting with the user. When the client is done interacting with 2455555991fdSmrgthe user, it must send an “Interact Done” message to the 2456555991fdSmrgsession manager. 2457555991fdSmrg </para> 2458555991fdSmrg </sect1> 2459555991fdSmrg 2460555991fdSmrg <sect1 id='sending_a_save_complete_message'> 2461555991fdSmrg <title>Sending a Save Complete Message</title> 2462555991fdSmrg 2463555991fdSmrg <para> 2464555991fdSmrgTo send a “Save Complete” message to a client, 2465555991fdSmrguse <function>SmsSaveComplete</function>. 2466555991fdSmrg </para> 2467555991fdSmrg 2468555991fdSmrg<funcsynopsis> 2469555991fdSmrg <funcprototype> 2470555991fdSmrg <funcdef>void <function>SmsSaveComplete</function></funcdef> 2471555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2472555991fdSmrg </funcprototype> 2473555991fdSmrg</funcsynopsis> 2474555991fdSmrg 2475555991fdSmrg<variablelist remap='IP'> 2476555991fdSmrg <varlistentry> 2477555991fdSmrg <term><parameter>sms_conn</parameter></term> 2478555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2479555991fdSmrg </varlistentry> 2480555991fdSmrg</variablelist> 2481555991fdSmrg 2482555991fdSmrg <para> 2483555991fdSmrgThe session manager sends this message when it is done with a 2484555991fdSmrgcheckpoint. The client is then free to change its state. 2485555991fdSmrg </para> 2486555991fdSmrg </sect1> 2487555991fdSmrg 2488555991fdSmrg <sect1 id='sending_a_die_message'> 2489555991fdSmrg <title>Sending a Die Message</title> 2490555991fdSmrg 2491555991fdSmrg <para> 2492555991fdSmrgTo send a “Die” message to a client, 2493555991fdSmrguse <function>SmsDie</function>. 2494555991fdSmrg </para> 2495555991fdSmrg 2496555991fdSmrg<funcsynopsis> 2497555991fdSmrg <funcprototype> 2498555991fdSmrg <funcdef>void <function>SmsDie</function></funcdef> 2499555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2500555991fdSmrg </funcprototype> 2501555991fdSmrg</funcsynopsis> 2502555991fdSmrg 2503555991fdSmrg<variablelist remap='IP'> 2504555991fdSmrg <varlistentry> 2505555991fdSmrg <term><parameter>sms_conn</parameter></term> 2506555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2507555991fdSmrg </varlistentry> 2508555991fdSmrg</variablelist> 2509555991fdSmrg 2510555991fdSmrg <para> 2511555991fdSmrgBefore the session manager terminates, it should wait for a 2512555991fdSmrg“Connection Closed” message from each client that it sent 2513555991fdSmrga “Die” message to, timing out appropriately. 2514555991fdSmrg </para> 2515555991fdSmrg </sect1> 2516555991fdSmrg 2517555991fdSmrg <sect1 id='cancelling_a_shutdown'> 2518555991fdSmrg <title>Cancelling a Shutdown</title> 2519555991fdSmrg 2520555991fdSmrg <para> 2521555991fdSmrgTo cancel a shutdown, use <function>SmsShutdownCancelled</function>. 2522555991fdSmrg </para> 2523555991fdSmrg 2524555991fdSmrg<funcsynopsis> 2525555991fdSmrg <funcprototype> 2526555991fdSmrg <funcdef>void <function>SmsShutdownCancelled</function></funcdef> 2527555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2528555991fdSmrg </funcprototype> 2529555991fdSmrg</funcsynopsis> 2530555991fdSmrg 2531555991fdSmrg<variablelist remap='IP'> 2532555991fdSmrg <varlistentry> 2533555991fdSmrg <term><parameter>sms_conn</parameter></term> 2534555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2535555991fdSmrg </varlistentry> 2536555991fdSmrg</variablelist> 2537555991fdSmrg 2538555991fdSmrg <para> 2539555991fdSmrgThe client can now continue as if the shutdown had never happened. If 2540555991fdSmrgthe client has not sent a “Save Yourself Done” message 2541555991fdSmrgyet, it can either abort the save and send a “Save Yourself 2542555991fdSmrgDone” with the success argument set to <constant>False</constant> 2543555991fdSmrgor it can continue with the save and send a “Save Yourself Done” 2544555991fdSmrgwith the <parameter>success</parameter> argument set to reflect the outcome 2545555991fdSmrgof the save. 2546555991fdSmrg </para> 2547555991fdSmrg </sect1> 2548555991fdSmrg<!-- aaaaaaaaaaaaaaaaa --> 2549555991fdSmrg 2550555991fdSmrg <sect1 id='returning_properties'> 2551555991fdSmrg <title>Returning Properties</title> 2552555991fdSmrg 2553555991fdSmrg <para> 2554555991fdSmrgIn response to a “Get Properties” message, the session 2555555991fdSmrgmanager should call <function>SmsReturnProperties</function>. 2556555991fdSmrg </para> 2557555991fdSmrg 2558555991fdSmrg<funcsynopsis> 2559555991fdSmrg <funcprototype> 2560555991fdSmrg <funcdef>void <function>SmsReturnProperties</function></funcdef> 2561555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2562555991fdSmrg <paramdef>int <parameter>num_props</parameter></paramdef> 2563555991fdSmrg <paramdef>SmProp **<parameter>props</parameter></paramdef> 2564555991fdSmrg </funcprototype> 2565555991fdSmrg</funcsynopsis> 2566555991fdSmrg 2567555991fdSmrg<variablelist remap='IP'> 2568555991fdSmrg <varlistentry> 2569555991fdSmrg <term><parameter>sms_conn</parameter></term> 2570555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2571555991fdSmrg </varlistentry> 2572555991fdSmrg <varlistentry> 2573555991fdSmrg <term><parameter>num_props</parameter></term> 2574555991fdSmrg <listitem><para>The number of properties.</para></listitem> 2575555991fdSmrg </varlistentry> 2576555991fdSmrg <varlistentry> 2577555991fdSmrg <term><parameter>props</parameter></term> 2578555991fdSmrg <listitem><para>The list of properties to return to the client.</para></listitem> 2579555991fdSmrg </varlistentry> 2580555991fdSmrg</variablelist> 2581555991fdSmrg 2582555991fdSmrg <para> 2583555991fdSmrgThe properties are returned as an array of property pointers. For a 2584555991fdSmrgdescription of session management properties and 2585555991fdSmrgthe <structname>SmProp</structname> structure, 2586555991fdSmrgsee <link linkend='session_management_properties'>section 7, 2587555991fdSmrg“Session Management Properties.”</link> 2588555991fdSmrg </para> 2589555991fdSmrg </sect1> 2590555991fdSmrg 2591555991fdSmrg <sect1 id='pinging_a_client'> 2592555991fdSmrg <title>Pinging a Client</title> 2593555991fdSmrg 2594555991fdSmrg <para> 2595555991fdSmrgTo check that a client is still alive, you should use 2596555991fdSmrgthe <function>IcePing</function> function provided by the ICE library. 2597555991fdSmrgTo do so, the ICE connection must be obtained using 2598555991fdSmrgthe <function>SmsGetIceConnection</function> 2599555991fdSmrg(see <link linkend='using_sms_informational_functions'>section 6.12, 2600555991fdSmrg“Using Sms Informational Functions”</link>). 2601555991fdSmrg </para> 2602555991fdSmrg 2603555991fdSmrg 2604555991fdSmrg<funcsynopsis> 2605555991fdSmrg <funcprototype> 2606555991fdSmrg <funcdef>void <function>IcePing</function></funcdef> 2607555991fdSmrg <paramdef>IceConn <parameter>ice_conn</parameter></paramdef> 2608555991fdSmrg <paramdef>IcePingReplyProc <parameter>ping_reply_proc</parameter></paramdef> 2609555991fdSmrg <paramdef>IcePointer <parameter>client_data</parameter></paramdef> 2610555991fdSmrg </funcprototype> 2611555991fdSmrg</funcsynopsis> 2612555991fdSmrg 2613555991fdSmrg<variablelist remap='IP'> 2614555991fdSmrg <varlistentry> 2615555991fdSmrg <term><parameter>ice_conn</parameter></term> 2616555991fdSmrg <listitem><para>A valid ICE connection object.</para></listitem> 2617555991fdSmrg </varlistentry> 2618555991fdSmrg <varlistentry> 2619555991fdSmrg <term><parameter>ping_reply_proc</parameter></term> 2620555991fdSmrg <listitem><para>The callback to invoke when the Ping reply arrives.</para></listitem> 2621555991fdSmrg </varlistentry> 2622555991fdSmrg <varlistentry> 2623555991fdSmrg <term><parameter>client_data</parameter></term> 2624555991fdSmrg <listitem><para>This pointer will be passed to the <function>IcePingReplyProc</function> callback.</para></listitem> 2625555991fdSmrg </varlistentry> 2626555991fdSmrg</variablelist> 2627555991fdSmrg 2628555991fdSmrg 2629555991fdSmrg <para> 2630555991fdSmrgWhen the Ping reply is ready (if ever), 2631555991fdSmrgthe <function>IcePingReplyProc</function> callback will be invoked. A 2632555991fdSmrgsession manager should have some sort of timeout period, after which 2633555991fdSmrgit assumes the client has unexpectedly died. 2634555991fdSmrg </para> 2635555991fdSmrg 2636555991fdSmrg<funcsynopsis> 2637555991fdSmrg <funcprototype> 2638555991fdSmrg <funcdef>typedef void (*<function>IcePingReplyProc</function>)</funcdef> 2639555991fdSmrg <paramdef>IceConn <parameter>ice_conn</parameter></paramdef> 2640555991fdSmrg <paramdef>IcePointer <parameter>client_data</parameter></paramdef> 2641555991fdSmrg </funcprototype> 2642555991fdSmrg</funcsynopsis> 2643555991fdSmrg 2644555991fdSmrg<variablelist remap='IP'> 2645555991fdSmrg <varlistentry> 2646555991fdSmrg <term><parameter>ice_conn</parameter></term> 2647555991fdSmrg <listitem><para>A valid ICE connection object.</para></listitem> 2648555991fdSmrg </varlistentry> 2649555991fdSmrg <varlistentry> 2650555991fdSmrg <term><parameter>client_data</parameter></term> 2651555991fdSmrg <listitem><para>The client data specified in the call to <function>IcePing</function></para></listitem> 2652555991fdSmrg </varlistentry> 2653555991fdSmrg</variablelist> 2654555991fdSmrg 2655555991fdSmrg </sect1> 2656555991fdSmrg 2657555991fdSmrg <sect1 id='cleaning_up_after_a_client_disconnects'> 2658555991fdSmrg <title>Cleaning Up After a Client Disconnects</title> 2659555991fdSmrg 2660555991fdSmrg <para> 2661555991fdSmrgWhen the session manager receives a “Connection Closed” 2662555991fdSmrgmessage or otherwise detects that the client aborted the connection, 2663555991fdSmrgit should call the <function>SmsCleanUp</function> function in order 2664555991fdSmrgto free up the connection object. 2665555991fdSmrg </para> 2666555991fdSmrg 2667555991fdSmrg<funcsynopsis> 2668555991fdSmrg <funcprototype> 2669555991fdSmrg <funcdef>void <function>SmsCleanUp</function></funcdef> 2670555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2671555991fdSmrg </funcprototype> 2672555991fdSmrg</funcsynopsis> 2673555991fdSmrg 2674555991fdSmrg<variablelist remap='IP'> 2675555991fdSmrg <varlistentry> 2676555991fdSmrg <term><parameter>sms_conn</parameter></term> 2677555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2678555991fdSmrg </varlistentry> 2679555991fdSmrg</variablelist> 2680555991fdSmrg 2681555991fdSmrg </sect1> 2682555991fdSmrg 2683555991fdSmrg <sect1 id='using_sms_informational_functions'> 2684555991fdSmrg <title>Using Sms Informational Functions</title> 2685555991fdSmrg 2686555991fdSmrg<funcsynopsis> 2687555991fdSmrg <funcprototype> 2688555991fdSmrg <funcdef>int <function>SmsProtocolVersion</function></funcdef> 2689555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2690555991fdSmrg </funcprototype> 2691555991fdSmrg</funcsynopsis> 2692555991fdSmrg 2693555991fdSmrg <para> 2694555991fdSmrg<function>SmsProtocolVersion</function> returns the major version of 2695555991fdSmrgthe session management protocol associated with this session. 2696555991fdSmrg </para> 2697555991fdSmrg 2698555991fdSmrg<funcsynopsis> 2699555991fdSmrg <funcprototype> 2700555991fdSmrg <funcdef>int <function>SmsProtocolRevision</function></funcdef> 2701555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2702555991fdSmrg </funcprototype> 2703555991fdSmrg</funcsynopsis> 2704555991fdSmrg 2705555991fdSmrg <para> 2706555991fdSmrg<function>SmsProtocolRevision</function> returns the minor version of 2707555991fdSmrgthe session management protocol associated with this session. 2708555991fdSmrg </para> 2709555991fdSmrg 2710555991fdSmrg<funcsynopsis> 2711555991fdSmrg <funcprototype> 2712555991fdSmrg <funcdef>char *<function>SmsClientID</function></funcdef> 2713555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2714555991fdSmrg </funcprototype> 2715555991fdSmrg</funcsynopsis> 2716555991fdSmrg 2717555991fdSmrg <para> 2718555991fdSmrg<function>SmsClientID</function> returns a null-terminated string for 2719555991fdSmrgthe client ID associated with this connection. You should 2720555991fdSmrgcall <function>free</function> on this pointer when the client ID is 2721555991fdSmrgno longer needed. 2722555991fdSmrg </para> 2723555991fdSmrg 2724555991fdSmrg 2725555991fdSmrg <para> 2726555991fdSmrgTo obtain the host name of a client, 2727555991fdSmrguse <function>SmsClientHostName</function>. 2728555991fdSmrgThis host name will be needed to restart the client. 2729555991fdSmrg </para> 2730555991fdSmrg 2731555991fdSmrg<funcsynopsis> 2732555991fdSmrg <funcprototype> 2733555991fdSmrg <funcdef>char *<function>SmsClientHostName</function></funcdef> 2734555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2735555991fdSmrg </funcprototype> 2736555991fdSmrg</funcsynopsis> 2737555991fdSmrg 2738555991fdSmrg <para> 2739555991fdSmrgThe string returned is of the form 2740555991fdSmrg<parameter>protocol</parameter><literal>/</literal><parameter>hostname</parameter>, 2741555991fdSmrgwhere <parameter>protocol</parameter> is one of 2742555991fdSmrg{<literal>tcp</literal>, <literal>decnet</literal>, <literal>local</literal>}. 2743555991fdSmrgYou should call <function>free</function> on the string returned when 2744555991fdSmrgit is no longer needed. 2745555991fdSmrg </para> 2746555991fdSmrg 2747555991fdSmrg<funcsynopsis> 2748555991fdSmrg <funcprototype> 2749555991fdSmrg <funcdef>IceConn <function>SmsGetIceConnection</function></funcdef> 2750555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2751555991fdSmrg </funcprototype> 2752555991fdSmrg</funcsynopsis> 2753555991fdSmrg 2754555991fdSmrg <para> 2755555991fdSmrg<function>SmsGetIceConnection</function> returns the ICE connection 2756555991fdSmrgobject associated with this session management connection object. The 2757555991fdSmrgICE connection object can be used to get some additional information 2758555991fdSmrgabout the connection. Some of the more useful functions which can be 2759555991fdSmrgused on the IceConn are <function>IceConnectionNumber</function> 2760555991fdSmrgand <function>IceLastSequenceNumber</function>. 2761555991fdSmrgFor further information, see the 2762555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 2763555991fdSmrgstandard. 2764555991fdSmrg </para> 2765555991fdSmrg </sect1> 2766555991fdSmrg 2767555991fdSmrg <sect1 id='error_handling2'> 2768555991fdSmrg <title>Error Handling</title> 2769555991fdSmrg 2770555991fdSmrg <para> 2771555991fdSmrgIf the session manager receives an unexpected protocol error from a 2772555991fdSmrgclient, an error handler is invoked by SMlib. A default error handler 2773555991fdSmrgexists which simply prints the error message (it does not exit). The 2774555991fdSmrgsession manager can change this error handler by 2775555991fdSmrgcalling <function>SmsSetErrorHandler</function>. 2776555991fdSmrg </para> 2777555991fdSmrg 2778555991fdSmrg<funcsynopsis> 2779555991fdSmrg <funcprototype> 2780555991fdSmrg <funcdef>SmsErrorHandler <function>SmsSetErrorHandler</function></funcdef> 2781555991fdSmrg <paramdef>SmsErrorHandler <parameter>handler</parameter></paramdef> 2782555991fdSmrg </funcprototype> 2783555991fdSmrg</funcsynopsis> 2784555991fdSmrg 2785555991fdSmrg <para> 2786555991fdSmrgThe error handler. You should pass <constant>NULL</constant> 2787555991fdSmrgto restore the default handler. 2788555991fdSmrg </para> 2789555991fdSmrg 2790555991fdSmrg <para> 2791555991fdSmrg<function>SmsSetErrorHandler</function> returns the previous error handler. 2792555991fdSmrgThe <function>SmsErrorHandler</function> has the following type: 2793555991fdSmrg </para> 2794555991fdSmrg 2795555991fdSmrg<funcsynopsis> 2796555991fdSmrg <funcprototype> 2797555991fdSmrg <funcdef>typedef void (*<function>SmsErrorHandler</function>)</funcdef> 2798555991fdSmrg <paramdef>SmsConn <parameter>sms_conn</parameter></paramdef> 2799555991fdSmrg <paramdef>Bool <parameter>swap</parameter></paramdef> 2800555991fdSmrg <paramdef>int <parameter>offending_minor_opcode</parameter></paramdef> 2801555991fdSmrg <paramdef>unsigned long <parameter>offending_sequence_num</parameter></paramdef> 2802555991fdSmrg <paramdef>int <parameter>error_class</parameter></paramdef> 2803555991fdSmrg <paramdef>int <parameter>severity</parameter></paramdef> 2804555991fdSmrg <paramdef>IcePointer <parameter>values</parameter></paramdef> 2805555991fdSmrg </funcprototype> 2806555991fdSmrg</funcsynopsis> 2807555991fdSmrg 2808555991fdSmrg<variablelist remap='IP'> 2809555991fdSmrg <varlistentry> 2810555991fdSmrg <term><parameter>sms_conn</parameter></term> 2811555991fdSmrg <listitem><para>The session management connection object.</para></listitem> 2812555991fdSmrg </varlistentry> 2813555991fdSmrg <varlistentry> 2814555991fdSmrg <term><parameter>swap</parameter></term> 2815555991fdSmrg <listitem><para>A flag which indicates if the specified values need byte swapping.</para></listitem> 2816555991fdSmrg </varlistentry> 2817555991fdSmrg <varlistentry> 2818555991fdSmrg <term><parameter>offending_minor_opcode</parameter></term> 2819555991fdSmrg <listitem><para>The minor opcode of the offending message.</para></listitem> 2820555991fdSmrg </varlistentry> 2821555991fdSmrg <varlistentry> 2822555991fdSmrg <term><parameter>offending_sequence_num</parameter></term> 2823555991fdSmrg <listitem><para>The sequence number of the offending message.</para></listitem> 2824555991fdSmrg </varlistentry> 2825555991fdSmrg <varlistentry> 2826555991fdSmrg <term><parameter>error_class</parameter></term> 2827555991fdSmrg <listitem><para>The error class of the offending message.</para></listitem> 2828555991fdSmrg </varlistentry> 2829555991fdSmrg <varlistentry> 2830555991fdSmrg <term><parameter>severity</parameter></term> 2831555991fdSmrg <listitem><para> 2832555991fdSmrg <constant>IceCanContinue</constant>, 2833555991fdSmrg <constant>IceFatalToProtocol</constant>, or 2834555991fdSmrg <constant>IceFatalToConnection</constant> 2835555991fdSmrg </para></listitem> 2836555991fdSmrg </varlistentry> 2837555991fdSmrg <varlistentry> 2838555991fdSmrg <term><parameter>values</parameter></term> 2839555991fdSmrg <listitem><para>Any additional error values specific to the minor opcode and class.</para></listitem> 2840555991fdSmrg </varlistentry> 2841555991fdSmrg</variablelist> 2842555991fdSmrg 2843555991fdSmrg <para> 2844555991fdSmrgNote that this error handler is invoked for protocol related errors. 2845555991fdSmrgTo install an error handler to be invoked when an IO error occurs, 2846555991fdSmrguse <function>IceSetIOErrorHandler</function>. 2847555991fdSmrgFor further information, see the 2848555991fdSmrg<citetitle pubwork='article'>Inter-Client Exchange Library</citetitle> 2849555991fdSmrgstandard. 2850555991fdSmrg </para> 2851555991fdSmrg </sect1> 2852555991fdSmrg</chapter> 2853555991fdSmrg 2854555991fdSmrg<chapter id='session_management_properties'> 2855555991fdSmrg <title>Session Management Properties</title> 2856555991fdSmrg 2857555991fdSmrg <para> 2858555991fdSmrgEach property is defined by the <structname>SmProp</structname> structure: 2859555991fdSmrg 2860555991fdSmrg<synopsis> 2861555991fdSmrgtypedef struct { 2862555991fdSmrg char *name; /* name of property */ 2863555991fdSmrg char *type; /* type of property */ 2864555991fdSmrg int num_vals; /* number of values */ 2865555991fdSmrg SmPropValue *vals; /* the list of values */ 2866555991fdSmrg} SmProp; 2867555991fdSmrg 2868555991fdSmrgtypedef struct { 2869555991fdSmrg int length; /* the length of the value */ 2870555991fdSmrg SmPointer value; /* the value */ 2871555991fdSmrg} SmPropValue; 2872555991fdSmrg</synopsis> 2873555991fdSmrg </para> 2874555991fdSmrg 2875555991fdSmrg <para> 2876555991fdSmrgThe X Session Management Protocol defines a list of predefined 2877555991fdSmrgproperties, several of which are required to be set by the client. 2878555991fdSmrgThe following table specifies the predefined properties and indicates 2879555991fdSmrgwhich ones are required. Each property has a type associated with it. 2880555991fdSmrg </para> 2881555991fdSmrg 2882555991fdSmrg <para> 2883555991fdSmrgA type of <type>SmCARD8</type> indicates that there is a single 1-byte value. 2884555991fdSmrgA type of <type>SmARRAY8</type> indicates that there is a single array of bytes. 2885555991fdSmrgA type of <type>SmLISTofARRAY8</type> indicates that there is a list of array of 2886555991fdSmrgbytes. 2887555991fdSmrg </para> 2888555991fdSmrg 2889555991fdSmrg<informaltable pgwide='0' frame='none'> 2890555991fdSmrg <tgroup cols='4' align='center'> 2891555991fdSmrg <colspec colname='c1'/> 2892555991fdSmrg <colspec colname='c2'/> 2893555991fdSmrg <colspec colname='c3'/> 2894555991fdSmrg <colspec colname='c4'/> 2895555991fdSmrg <thead> 2896555991fdSmrg <row> 2897555991fdSmrg <entry align='left'>Name</entry> 2898555991fdSmrg <entry align='left'>Type</entry> 2899555991fdSmrg <entry align='left'><acronym>POSIX</acronym> Type</entry> 2900555991fdSmrg <entry align='center'>Required</entry> 2901555991fdSmrg </row> 2902555991fdSmrg </thead> 2903555991fdSmrg <tbody> 2904555991fdSmrg <row> 2905555991fdSmrg <entry align='left'><property>SmCloneCommand</property></entry> 2906555991fdSmrg <entry align='left'>OS-specific</entry> 2907555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2908555991fdSmrg <entry align='center'>Yes</entry> 2909555991fdSmrg </row> 2910555991fdSmrg <row> 2911555991fdSmrg <entry align='left'><property>SmCurrentDirectory</property></entry> 2912555991fdSmrg <entry align='left'>OS-specific</entry> 2913555991fdSmrg <entry align='left'><type>SmARRAY8</type></entry> 2914555991fdSmrg <entry align='center'>No</entry> 2915555991fdSmrg </row> 2916555991fdSmrg <row> 2917555991fdSmrg <entry align='left'><property>SmDiscardCommand</property></entry> 2918555991fdSmrg <entry align='left'>OS-specific</entry> 2919555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2920555991fdSmrg <entry align='center'>No*</entry> 2921555991fdSmrg </row> 2922555991fdSmrg <row> 2923555991fdSmrg <entry align='left'><property>SmEnvironment</property></entry> 2924555991fdSmrg <entry align='left'>OS-specific</entry> 2925555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2926555991fdSmrg <entry align='center'>No</entry> 2927555991fdSmrg </row> 2928555991fdSmrg <row> 2929555991fdSmrg <entry align='left'><property>SmProcessID</property></entry> 2930555991fdSmrg <entry align='left'>OS-specific</entry> 2931555991fdSmrg <entry align='left'><type>SmARRAY8</type></entry> 2932555991fdSmrg <entry align='center'>No</entry> 2933555991fdSmrg </row> 2934555991fdSmrg <row> 2935555991fdSmrg <entry align='left'><property>SmProgram</property></entry> 2936555991fdSmrg <entry align='left'>OS-specific</entry> 2937555991fdSmrg <entry align='left'><type>SmARRAY8</type></entry> 2938555991fdSmrg <entry align='center'>Yes</entry> 2939555991fdSmrg </row> 2940555991fdSmrg <row> 2941555991fdSmrg <entry align='left'><property>SmRestartCommand</property></entry> 2942555991fdSmrg <entry align='left'>OS-specific</entry> 2943555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2944555991fdSmrg <entry align='center'>Yes</entry> 2945555991fdSmrg </row> 2946555991fdSmrg <row> 2947555991fdSmrg <entry align='left'><property>SmResignCommand</property></entry> 2948555991fdSmrg <entry align='left'>OS-specific</entry> 2949555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2950555991fdSmrg <entry align='center'>No</entry> 2951555991fdSmrg </row> 2952555991fdSmrg <row> 2953555991fdSmrg <entry align='left'><property>SmRestartStyleHint</property></entry> 2954555991fdSmrg <entry align='left'><type>SmCARD8</type></entry> 2955555991fdSmrg <entry align='left'><type>SmCARD8</type></entry> 2956555991fdSmrg <entry align='center'>No</entry> 2957555991fdSmrg </row> 2958555991fdSmrg <row> 2959555991fdSmrg <entry align='left'><property>SmShutdownCommand</property></entry> 2960555991fdSmrg <entry align='left'>OS-specific</entry> 2961555991fdSmrg <entry align='left'><type>SmLISTofARRAY8</type></entry> 2962555991fdSmrg <entry align='center'>No</entry> 2963555991fdSmrg </row> 2964555991fdSmrg <row> 2965555991fdSmrg <entry align='left'><property>SmUserID</property></entry> 2966555991fdSmrg <entry align='left'><type>SmARRAY8</type></entry> 2967555991fdSmrg <entry align='left'><type>SmARRAY8</type></entry> 2968555991fdSmrg <entry align='center'>Yes</entry> 2969555991fdSmrg </row> 2970555991fdSmrg </tbody> 2971555991fdSmrg </tgroup> 2972555991fdSmrg</informaltable> 2973555991fdSmrg 2974555991fdSmrg <para> 2975555991fdSmrg* Required if any state is stored in an external repository (for 2976555991fdSmrgexample, state file). 2977555991fdSmrg </para> 2978555991fdSmrg 2979555991fdSmrg <itemizedlist mark='bullet'> 2980555991fdSmrg <listitem><para><property>SmCloneCommand</property></para> 2981555991fdSmrg <para> 2982555991fdSmrgThis is like the <property>SmRestartCommand</property>, except it restarts a 2983555991fdSmrgcopy of the application. The only difference is that the application does not 2984555991fdSmrgsupply its client ID at register time. On <acronym>POSIX</acronym> systems, 2985555991fdSmrgthis should be of type <type>SmLISTofARRAY8</type>. 2986555991fdSmrg </para></listitem> 2987555991fdSmrg <listitem><para><property>SmCurrentDirectory</property></para> 2988555991fdSmrg <para> 2989555991fdSmrgOn <acronym>POSIX</acronym>-based systems, this specifies the value of the 2990555991fdSmrgcurrent directory that needs to be set up prior to starting the 2991555991fdSmrg<property>SmProgram</property> and should of type <type>SmARRAY8</type>. 2992555991fdSmrg </para></listitem> 2993555991fdSmrg <listitem><para><property>SmDiscardCommand</property></para> 2994555991fdSmrg <para> 2995555991fdSmrgThe discard command contains a command that when delivered to the host 2996555991fdSmrgthat the client is running on (determined from the connection), will 2997555991fdSmrgcause it to discard any information about the current state. If this 2998555991fdSmrgcommand is not specified, the Session Manager will assume that all of 2999555991fdSmrgthe client's state is encoded in the <property>SmRestartCommand</property>. 3000555991fdSmrgOn <acronym>POSIX</acronym> systems, the type should be 3001555991fdSmrg<type>SmLISTofARRAY8</type>. 3002555991fdSmrg </para></listitem> 3003555991fdSmrg <listitem><para><property>SmEnvironment</property></para> 3004555991fdSmrg <para> 3005555991fdSmrgOn <acronym>POSIX</acronym> based systems, this will be of type 3006555991fdSmrg<type>SmLISTofARRAY8</type>, where the <type>ARRAY8</type>s alternate between 3007555991fdSmrgenvironment variable name and environment variable value. 3008555991fdSmrg </para></listitem> 3009555991fdSmrg <listitem><para><property>SmProcessID</property></para> 3010555991fdSmrg <para> 3011555991fdSmrgThis specifies an OS-specific identifier for the process. 3012555991fdSmrgOn <acronym>POSIX</acronym> systems, this should contain the return value 3013555991fdSmrgof <function>getpid</function> turned into a Latin-1 (decimal) string. 3014555991fdSmrg </para></listitem> 3015555991fdSmrg <listitem><para><property>SmProgram</property></para> 3016555991fdSmrg <para> 3017555991fdSmrgThis is the name of the program that is running. On <acronym>POSIX</acronym> 3018555991fdSmrgsystems, this should be first parameter passed to <function>execve</function> 3019555991fdSmrgand should be of type <type>SmARRAY8</type>. 3020555991fdSmrg </para></listitem> 3021555991fdSmrg <listitem><para><property>SmRestartCommand</property></para> 3022555991fdSmrg <para> 3023555991fdSmrgThe restart command contains a command that, when delivered to the 3024555991fdSmrghost that the client is running on (determined from the connection), 3025555991fdSmrgwill cause the client to restart in its current state. 3026555991fdSmrgOn <acronym>POSIX</acronym>-based systems, this is of 3027555991fdSmrgtype <type>SmLISTofARRAY8</type>, and each of the elements in 3028555991fdSmrgthe array represents an element in the <varname>argv</varname> 3029555991fdSmrgarray. This restart command should ensure that the client restarts 3030555991fdSmrgwith the specified client-ID. 3031555991fdSmrg </para></listitem> 3032555991fdSmrg <listitem><para><property>SmResignCommand</property></para> 3033555991fdSmrg <para> 3034555991fdSmrgA client that sets the <property>SmRestartStyleHint</property> 3035555991fdSmrgto <constant>SmRestartAnyway</constant> uses this property to specify a 3036555991fdSmrgcommand that undoes the effect of the client and removes any saved state. 3037555991fdSmrgAs an example, consider a user that runs <command>xmodmap</command> which 3038555991fdSmrgregisters with the Session Manager, 3039555991fdSmrgsets <property>SmRestartStyleHint</property> 3040555991fdSmrgto <constant>SmRestartAnyway</constant>, and then 3041555991fdSmrgterminates. To allow the Session Manager (at the user's request) to 3042555991fdSmrgundo this, <command>xmodmap</command> would register a 3043555991fdSmrg<property>SmResignCommand</property> that undoes the effects of 3044555991fdSmrgthe <command>xmodmap</command>. 3045555991fdSmrg </para></listitem> 3046555991fdSmrg <listitem><para><property>SmRestartStyleHint</property></para> 3047555991fdSmrg <para> 3048555991fdSmrgIf the <property>SmRestartStyleHint</property> is present, it will contain the 3049555991fdSmrgstyle of restarting the client prefers. If this style is not specified, 3050555991fdSmrg<constant>SmRestartIfRunning</constant> is assumed. 3051555991fdSmrgThe possible values are as follows: 3052555991fdSmrg 3053555991fdSmrg<informaltable pgwide='0' frame='none'> 3054555991fdSmrg <tgroup cols='2' align='center'> 3055555991fdSmrg <colspec colname='c1'/> 3056555991fdSmrg <colspec colname='c2'/> 3057555991fdSmrg <thead> 3058555991fdSmrg <row> 3059555991fdSmrg <entry align='left'>Name</entry> 3060555991fdSmrg <entry align='right'>Value</entry> 3061555991fdSmrg </row> 3062555991fdSmrg </thead> 3063555991fdSmrg <tbody> 3064555991fdSmrg <row> 3065555991fdSmrg <entry align='left'><constant>SmRestartIfRunning</constant></entry> 3066555991fdSmrg <entry align='right'>0</entry> 3067555991fdSmrg </row> 3068555991fdSmrg <row> 3069555991fdSmrg <entry align='left'><constant>SmRestartAnyway</constant></entry> 3070555991fdSmrg <entry align='right'>1</entry> 3071555991fdSmrg </row> 3072555991fdSmrg <row> 3073555991fdSmrg <entry align='left'><constant>SmRestartImmediately</constant></entry> 3074555991fdSmrg <entry align='right'>2</entry> 3075555991fdSmrg </row> 3076555991fdSmrg <row> 3077555991fdSmrg <entry align='left'><constant>SmRestartNever</constant></entry> 3078555991fdSmrg <entry align='right'>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 3137555991fdSmrg<chapter id='freeing_data'> 3138555991fdSmrg <title>Freeing Data</title> 3139555991fdSmrg 3140555991fdSmrg <para> 3141555991fdSmrgTo free an individual property, use <function>SmFreeProperty</function> 3142555991fdSmrg </para> 3143555991fdSmrg 3144555991fdSmrg<funcsynopsis> 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 3160555991fdSmrgthe <function>SmsCloseConnectionProc</function> callback, 3161555991fdSmrguse <function>SmFreeReasons</function> 3162555991fdSmrg </para> 3163555991fdSmrg 3164555991fdSmrg<funcsynopsis> 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 3184555991fdSmrg<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 3206555991fdSmrg<chapter id='working_in_a_multithreaded_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 3219555991fdSmrg<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