1 /* $Xorg: xsm.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ 2 /* $XdotOrg: $ */ 3 /****************************************************************************** 4 5 Copyright 1993, 1998 The Open Group 6 7 Permission to use, copy, modify, distribute, and sell this software and its 8 documentation for any purpose is hereby granted without fee, provided that 9 the above copyright notice appear in all copies and that both that 10 copyright notice and this permission notice appear in supporting 11 documentation. 12 13 The above copyright notice and this permission notice shall be included in 14 all copies or substantial portions of the Software. 15 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 23 Except as contained in this notice, the name of The Open Group shall not be 24 used in advertising or otherwise to promote the sale, use or other dealings 25 in this Software without prior written authorization from The Open Group. 26 ******************************************************************************/ 27 /* $XFree86: xc/programs/xsm/xsm.h,v 1.7 2001/12/08 18:33:45 herrb Exp $ */ 28 29 #ifndef _XSM_H_ 30 #define _XSM_H_ 31 32 #ifdef HAVE_CONFIG_H 33 # include "config.h" 34 #endif 35 36 #define _CONST_X_STRING 37 38 #include <X11/Xos.h> 39 #include <X11/Xfuncs.h> 40 41 #ifndef X_NOT_POSIX 42 #ifdef _POSIX_SOURCE 43 #include <limits.h> 44 #else 45 #define _POSIX_SOURCE 46 #include <limits.h> 47 #undef _POSIX_SOURCE 48 #endif 49 #endif /* X_NOT_POSIX */ 50 #ifndef PATH_MAX 51 #include <sys/param.h> 52 #ifndef PATH_MAX 53 #ifdef MAXPATHLEN 54 #define PATH_MAX MAXPATHLEN 55 #else 56 #define PATH_MAX 1024 57 #endif 58 #endif 59 #endif /* PATH_MAX */ 60 61 #ifndef _POSIX_SOURCE 62 #define _POSIX_SOURCE 63 #include <stdio.h> 64 #undef _POSIX_SOURCE 65 #else 66 #include <stdio.h> 67 #endif 68 69 #include <ctype.h> 70 #include <stdlib.h> 71 72 #include <X11/StringDefs.h> 73 #include <X11/Intrinsic.h> 74 75 #include <X11/ICE/ICEutil.h> 76 77 #include <X11/SM/SMlib.h> 78 79 #include "list.h" 80 81 /* 82 * Each time the format of the sm's save file changes, bump up 83 * the version. 84 */ 85 86 #define SAVEFILE_VERSION 3 87 88 #define DEFAULT_SESSION_NAME "Default" 89 #define FAILSAFE_SESSION_NAME "Fail Safe" 90 91 #define RESTART_MANAGERS 1 92 #define RESTART_REST_OF_CLIENTS 2 93 94 typedef struct _ClientRec { 95 SmsConn smsConn; 96 IceConn ice_conn; 97 char *clientId; 98 char *clientHostname; 99 List *props; 100 char *discardCommand; 101 char *saveDiscardCommand; 102 103 unsigned int restarted : 1; 104 unsigned int userIssuedCheckpoint : 1; 105 unsigned int restartHint : 2; 106 unsigned int receivedDiscardCommand : 1; 107 unsigned int freeAfterBadSavePopup : 1; 108 109 } ClientRec; 110 111 typedef struct _PendingClient { 112 char *clientId; 113 char *clientHostname; 114 List *props; 115 } PendingClient; 116 117 typedef struct _Prop { 118 char *name; 119 char *type; 120 List *values; 121 } Prop; 122 123 typedef struct _PropValue { 124 XtPointer value; 125 int length; 126 } PropValue; 127 128 129 extern char **environ; 130 131 extern int Argc; 132 extern char **Argv; 133 134 extern char *display_env, *non_local_display_env; 135 extern char *session_env, *non_local_session_env; 136 extern char *audio_env; 137 138 extern Bool need_to_name_session; 139 140 extern Bool remote_allowed; 141 142 extern Bool verbose; 143 144 extern char *sm_id; 145 146 extern char *networkIds; 147 extern char *session_name; 148 149 extern IceAuthDataEntry *authDataEntries; 150 extern int numTransports; 151 152 extern List *RunningList; 153 extern List *PendingList; 154 extern List *RestartAnywayList; 155 extern List *RestartImmedList; 156 157 extern List *WaitForSaveDoneList; 158 extern List *FailedSaveList; 159 extern List *WaitForInteractList; 160 extern List *WaitForPhase2List; 161 162 extern Bool client_info_visible; 163 extern Bool client_prop_visible; 164 extern Bool client_log_visible; 165 extern String *clientListNames; 166 extern ClientRec **clientListRecs; 167 extern int numClientListNames; 168 extern int current_client_selected; 169 170 extern Bool shutdownInProgress; 171 extern Bool phase2InProgress; 172 extern Bool saveInProgress; 173 extern Bool shutdownCancelled; 174 extern Bool wantShutdown; 175 176 extern int sessionNameCount; 177 extern String *sessionNamesShort; 178 extern String *sessionNamesLong; 179 extern Bool *sessionsLocked; 180 181 extern int num_clients_in_last_session; 182 183 extern char **non_session_aware_clients; 184 extern int non_session_aware_count; 185 186 extern XtAppContext appContext; 187 extern Widget topLevel; 188 extern Widget mainWindow; 189 extern Widget clientInfoButton; 190 extern Widget logButton; 191 extern Widget checkPointButton; 192 extern Widget shutdownButton; 193 extern Widget shutdownDontSave; 194 195 extern XtSignalId sig_term_id, sig_usr1_id; 196 197 extern void fprintfhex(FILE *fp, unsigned int len, char *cp); 198 extern Status StartSession(char *name, Bool use_default); 199 extern void EndSession(int status) _X_NORETURN; 200 extern void SetWM_DELETE_WINDOW(Widget widget, const _XtString delAction); 201 extern void SetAllSensitive(Bool on); 202 extern void FreeClient(ClientRec *client, Bool freeProps); 203 extern void CloseDownClient(ClientRec *client); 204 205 206 /* misc.c */ 207 extern int strbw(const char *a, const char *b); 208 extern void nomem(void) _X_NORETURN; 209 210 211 #define Strstr strstr 212 213 /* remote.c */ 214 extern void remote_start(const char *restart_protocol, 215 const char *restart_machine, 216 const char *program, char **args, 217 const char *cwd, char **env, 218 const char *non_local_display_env, 219 const char *non_local_session_env ); 220 221 /* signals.c */ 222 extern void sig_child_handler(int sig); 223 extern void sig_term_handler(int sig); 224 extern void sig_usr1_handler(int sig); 225 extern void xt_sig_term_handler(XtPointer closure, XtSignalId *id); 226 extern void xt_sig_usr1_handler(XtPointer closure, XtSignalId *id); 227 extern void register_signals(XtAppContext); 228 extern int execute_system_command(char *s); 229 230 extern int checkpoint_from_signal; 231 232 #ifdef XKB 233 #include <X11/extensions/XKBbells.h> 234 #endif 235 236 #endif /* _XSM_H_ */ 237