Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:23

0001 /*
0002 
0003 Copyright 1993, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 */
0026 
0027 /*
0028  * Author: Ralph Mor, X Consortium
0029  */
0030 
0031 #ifndef _SMLIB_H_
0032 #define _SMLIB_H_
0033 
0034 #include <X11/SM/SM.h>
0035 #include <X11/ICE/ICElib.h>
0036 
0037 
0038 /*
0039  * Generic SM pointer
0040  */
0041 
0042 typedef IcePointer SmPointer;
0043 
0044 
0045 /*
0046  * Connection objects.  Defined in SMlibint.h
0047  */
0048 
0049 typedef struct _SmcConn *SmcConn;
0050 typedef struct _SmsConn *SmsConn;
0051 
0052 
0053 /*
0054  * Session Management property
0055  */
0056 
0057 typedef struct {
0058     int     length;     /* length (in bytes) of the value */
0059     SmPointer   value;      /* the value */
0060 } SmPropValue;
0061 
0062 typedef struct {
0063     char    *name;      /* name of property */
0064     char    *type;      /* type of property */
0065     int     num_vals;   /* number of values in property */
0066     SmPropValue *vals;      /* the values */
0067 } SmProp;
0068 
0069 
0070 
0071 /*
0072  * SmcCloseConnection status return
0073  */
0074 
0075 typedef enum {
0076     SmcClosedNow,
0077     SmcClosedASAP,
0078     SmcConnectionInUse
0079 } SmcCloseStatus;
0080 
0081 
0082 
0083 /*
0084  * Client callbacks
0085  */
0086 
0087 typedef void (*SmcSaveYourselfProc) (
0088     SmcConn     /* smcConn */,
0089     SmPointer       /* clientData */,
0090     int         /* saveType */,
0091     Bool        /* shutdown */,
0092     int         /* interactStyle */,
0093     Bool        /* fast */
0094 );
0095 
0096 typedef void (*SmcSaveYourselfPhase2Proc) (
0097     SmcConn     /* smcConn */,
0098     SmPointer       /* clientData */
0099 );
0100 
0101 typedef void (*SmcInteractProc) (
0102     SmcConn     /* smcConn */,
0103     SmPointer       /* clientData */
0104 );
0105 
0106 typedef void (*SmcDieProc) (
0107     SmcConn     /* smcConn */,
0108     SmPointer       /* clientData */
0109 );
0110 
0111 typedef void (*SmcShutdownCancelledProc) (
0112     SmcConn     /* smcConn */,
0113     SmPointer       /* clientData */
0114 );
0115 
0116 typedef void (*SmcSaveCompleteProc) (
0117     SmcConn     /* smcConn */,
0118     SmPointer       /* clientData */
0119 );
0120 
0121 typedef void (*SmcPropReplyProc) (
0122     SmcConn     /* smcConn */,
0123     SmPointer       /* clientData */,
0124     int         /* numProps */,
0125     SmProp **       /* props */
0126 );
0127 
0128 
0129 /*
0130  * Callbacks set up at SmcOpenConnection time
0131  */
0132 
0133 typedef struct {
0134 
0135     struct {
0136     SmcSaveYourselfProc  callback;
0137     SmPointer        client_data;
0138     } save_yourself;
0139 
0140     struct {
0141     SmcDieProc       callback;
0142     SmPointer        client_data;
0143     } die;
0144 
0145     struct {
0146     SmcSaveCompleteProc  callback;
0147     SmPointer        client_data;
0148     } save_complete;
0149 
0150     struct {
0151     SmcShutdownCancelledProc callback;
0152     SmPointer        client_data;
0153     } shutdown_cancelled;
0154 
0155 } SmcCallbacks;
0156 
0157 #define SmcSaveYourselfProcMask     (1L << 0)
0158 #define SmcDieProcMask          (1L << 1)
0159 #define SmcSaveCompleteProcMask     (1L << 2)
0160 #define SmcShutdownCancelledProcMask    (1L << 3)
0161 
0162 
0163 
0164 /*
0165  * Session manager callbacks
0166  */
0167 
0168 typedef Status (*SmsRegisterClientProc) (
0169     SmsConn         /* smsConn */,
0170     SmPointer       /* managerData */,
0171     char *      /* previousId */
0172 );
0173 
0174 typedef void (*SmsInteractRequestProc) (
0175     SmsConn     /* smsConn */,
0176     SmPointer       /* managerData */,
0177     int         /* dialogType */
0178 );
0179 
0180 typedef void (*SmsInteractDoneProc) (
0181     SmsConn     /* smsConn */,
0182     SmPointer       /* managerData */,
0183     Bool        /* cancelShutdown */
0184 );
0185 
0186 typedef void (*SmsSaveYourselfRequestProc) (
0187     SmsConn     /* smsConn */,
0188     SmPointer       /* managerData */,
0189     int         /* saveType */,
0190     Bool        /* shutdown */,
0191     int         /* interactStyle */,
0192     Bool        /* fast */,
0193     Bool        /* global */
0194 );
0195 
0196 typedef void (*SmsSaveYourselfPhase2RequestProc) (
0197     SmsConn     /* smsConn */,
0198     SmPointer       /* managerData */
0199 );
0200 
0201 typedef void (*SmsSaveYourselfDoneProc) (
0202     SmsConn     /* smsConn */,
0203     SmPointer       /* managerData */,
0204     Bool        /* success */
0205 );
0206 
0207 typedef void (*SmsCloseConnectionProc) (
0208     SmsConn     /* smsConn */,
0209     SmPointer       /* managerData */,
0210     int         /* count */,
0211     char **     /* reasonMsgs */
0212 );
0213 
0214 typedef void (*SmsSetPropertiesProc) (
0215     SmsConn     /* smsConn */,
0216     SmPointer       /* managerData */,
0217     int         /* numProps */,
0218     SmProp **       /* props */
0219 );
0220 
0221 typedef void (*SmsDeletePropertiesProc) (
0222     SmsConn     /* smsConn */,
0223     SmPointer       /* managerData */,
0224     int         /* numProps */,
0225     char **     /* propNames */
0226 );
0227 
0228 typedef void (*SmsGetPropertiesProc) (
0229     SmsConn     /* smsConn */,
0230     SmPointer       /* managerData */
0231 );
0232 
0233 
0234 /*
0235  * Callbacks set up by a session manager when a new client connects.
0236  */
0237 
0238 typedef struct {
0239 
0240     struct {
0241     SmsRegisterClientProc   callback;
0242     SmPointer       manager_data;
0243     } register_client;
0244 
0245     struct {
0246     SmsInteractRequestProc  callback;
0247     SmPointer       manager_data;
0248     } interact_request;
0249 
0250     struct {
0251     SmsInteractDoneProc callback;
0252     SmPointer       manager_data;
0253     } interact_done;
0254 
0255     struct {
0256     SmsSaveYourselfRequestProc  callback;
0257     SmPointer           manager_data;
0258     } save_yourself_request;
0259 
0260     struct {
0261     SmsSaveYourselfPhase2RequestProc    callback;
0262     SmPointer               manager_data;
0263     } save_yourself_phase2_request;
0264 
0265     struct {
0266     SmsSaveYourselfDoneProc callback;
0267     SmPointer       manager_data;
0268     } save_yourself_done;
0269 
0270     struct {
0271     SmsCloseConnectionProc  callback;
0272     SmPointer       manager_data;
0273     } close_connection;
0274 
0275     struct {
0276     SmsSetPropertiesProc    callback;
0277     SmPointer       manager_data;
0278     } set_properties;
0279 
0280     struct {
0281     SmsDeletePropertiesProc callback;
0282     SmPointer       manager_data;
0283     } delete_properties;
0284 
0285     struct {
0286     SmsGetPropertiesProc    callback;
0287     SmPointer       manager_data;
0288     } get_properties;
0289 
0290 } SmsCallbacks;
0291 
0292 
0293 #define SmsRegisterClientProcMask       (1L << 0)
0294 #define SmsInteractRequestProcMask      (1L << 1)
0295 #define SmsInteractDoneProcMask         (1L << 2)
0296 #define SmsSaveYourselfRequestProcMask      (1L << 3)
0297 #define SmsSaveYourselfP2RequestProcMask    (1L << 4)
0298 #define SmsSaveYourselfDoneProcMask     (1L << 5)
0299 #define SmsCloseConnectionProcMask      (1L << 6)
0300 #define SmsSetPropertiesProcMask        (1L << 7)
0301 #define SmsDeletePropertiesProcMask     (1L << 8)
0302 #define SmsGetPropertiesProcMask        (1L << 9)
0303 
0304 
0305 
0306 typedef Status (*SmsNewClientProc) (
0307     SmsConn         /* smsConn */,
0308     SmPointer       /* managerData */,
0309     unsigned long * /* maskRet */,
0310     SmsCallbacks *  /* callbacksRet */,
0311     char **     /* failureReasonRet */
0312 );
0313 
0314 
0315 
0316 /*
0317  * Error handlers
0318  */
0319 
0320 typedef void (*SmcErrorHandler) (
0321     SmcConn     /* smcConn */,
0322     Bool        /* swap */,
0323     int         /* offendingMinorOpcode */,
0324     unsigned long   /* offendingSequence */,
0325     int         /* errorClass */,
0326     int         /* severity */,
0327     SmPointer       /* values */
0328 );
0329 
0330 typedef void (*SmsErrorHandler) (
0331     SmsConn     /* smsConn */,
0332     Bool        /* swap */,
0333     int         /* offendingMinorOpcode */,
0334     unsigned long   /* offendingSequence */,
0335     int         /* errorClass */,
0336     int         /* severity */,
0337     SmPointer       /* values */
0338 );
0339 
0340 
0341 
0342 /*
0343  * Function Prototypes
0344  */
0345 
0346 _XFUNCPROTOBEGIN
0347 
0348 extern SmcConn SmcOpenConnection (
0349     char *      /* networkIdsList */,
0350     SmPointer       /* context */,
0351     int         /* xsmpMajorRev */,
0352     int         /* xsmpMinorRev */,
0353     unsigned long   /* mask */,
0354     SmcCallbacks *  /* callbacks */,
0355     const char *    /* previousId */,
0356     char **     /* clientIdRet */,
0357     int         /* errorLength */,
0358     char *      /* errorStringRet */
0359 );
0360 
0361 extern SmcCloseStatus SmcCloseConnection (
0362     SmcConn     /* smcConn */,
0363     int         /* count */,
0364     char **     /* reasonMsgs */
0365 );
0366 
0367 extern void SmcModifyCallbacks (
0368     SmcConn     /* smcConn */,
0369     unsigned long   /* mask */,
0370     SmcCallbacks *  /* callbacks */
0371 );
0372 
0373 extern void SmcSetProperties (
0374     SmcConn     /* smcConn */,
0375     int                 /* numProps */,
0376     SmProp **       /* props */
0377 );
0378 
0379 extern void SmcDeleteProperties (
0380     SmcConn     /* smcConn */,
0381     int                 /* numProps */,
0382     char **     /* propNames */
0383 );
0384 
0385 extern Status SmcGetProperties (
0386     SmcConn     /* smcConn */,
0387     SmcPropReplyProc    /* propReplyProc */,
0388     SmPointer       /* clientData */
0389 );
0390 
0391 extern Status SmcInteractRequest (
0392     SmcConn     /* smcConn */,
0393     int         /* dialogType */,
0394     SmcInteractProc /* interactProc */,
0395     SmPointer       /* clientData */
0396 );
0397 
0398 extern void SmcInteractDone (
0399     SmcConn     /* smcConn */,
0400     Bool        /* cancelShutdown */
0401 );
0402 
0403 extern void SmcRequestSaveYourself (
0404     SmcConn     /* smcConn */,
0405     int         /* saveType */,
0406     Bool        /* shutdown */,
0407     int         /* interactStyle */,
0408     Bool        /* fast */,
0409     Bool        /* global */
0410 );
0411 
0412 extern Status SmcRequestSaveYourselfPhase2 (
0413     SmcConn         /* smcConn */,
0414     SmcSaveYourselfPhase2Proc   /* saveYourselfPhase2Proc */,
0415     SmPointer           /* clientData */
0416 );
0417 
0418 extern void SmcSaveYourselfDone (
0419     SmcConn     /* smcConn */,
0420     Bool        /* success */
0421 );
0422 
0423 extern int SmcProtocolVersion (
0424     SmcConn     /* smcConn */
0425 );
0426 
0427 extern int SmcProtocolRevision (
0428     SmcConn     /* smcConn */
0429 );
0430 
0431 extern char *SmcVendor (
0432     SmcConn     /* smcConn */
0433 );
0434 
0435 extern char *SmcRelease (
0436     SmcConn     /* smcConn */
0437 );
0438 
0439 extern char *SmcClientID (
0440     SmcConn     /* smcConn */
0441 );
0442 
0443 extern IceConn SmcGetIceConnection (
0444     SmcConn     /* smcConn */
0445 );
0446 
0447 extern Status SmsInitialize (
0448     const char *        /* vendor */,
0449     const char *        /* release */,
0450     SmsNewClientProc        /* newClientProc */,
0451     SmPointer           /* managerData */,
0452     IceHostBasedAuthProc    /* hostBasedAuthProc */,
0453     int             /* errorLength */,
0454     char *          /* errorStringRet */
0455 );
0456 
0457 extern char *SmsClientHostName (
0458     SmsConn     /* smsConn */
0459 );
0460 
0461 extern char *SmsGenerateClientID (
0462     SmsConn     /* smsConn */
0463 );
0464 
0465 extern Status SmsRegisterClientReply (
0466     SmsConn     /* smsConn */,
0467     char *      /* clientId */
0468 );
0469 
0470 extern void SmsSaveYourself (
0471     SmsConn     /* smsConn */,
0472     int         /* saveType */,
0473     Bool        /* shutdown */,
0474     int         /* interactStyle */,
0475     Bool        /* fast */
0476 );
0477 
0478 extern void SmsSaveYourselfPhase2 (
0479     SmsConn     /* smsConn */
0480 );
0481 
0482 extern void SmsInteract (
0483     SmsConn     /* smsConn */
0484 );
0485 
0486 extern void SmsDie (
0487     SmsConn     /* smsConn */
0488 );
0489 
0490 extern void SmsSaveComplete (
0491     SmsConn     /* smsConn */
0492 );
0493 
0494 extern void SmsShutdownCancelled (
0495     SmsConn     /* smsConn */
0496 );
0497 
0498 extern void SmsReturnProperties (
0499     SmsConn     /* smsConn */,
0500     int         /* numProps */,
0501     SmProp **       /* props */
0502 );
0503 
0504 extern void SmsCleanUp (
0505     SmsConn     /* smsConn */
0506 );
0507 
0508 extern int SmsProtocolVersion (
0509     SmsConn     /* smsConn */
0510 );
0511 
0512 extern int SmsProtocolRevision (
0513     SmsConn     /* smsConn */
0514 );
0515 
0516 extern char *SmsClientID (
0517     SmsConn     /* smsConn */
0518 );
0519 
0520 extern IceConn SmsGetIceConnection (
0521     SmsConn     /* smsConn */
0522 );
0523 
0524 extern SmcErrorHandler SmcSetErrorHandler (
0525     SmcErrorHandler     /* handler */
0526 );
0527 
0528 extern SmsErrorHandler SmsSetErrorHandler (
0529     SmsErrorHandler     /* handler */
0530 );
0531 
0532 extern void SmFreeProperty (
0533     SmProp *        /* prop */
0534 );
0535 
0536 extern void SmFreeReasons (
0537     int         /* count */,
0538     char **     /* reasonMsgs */
0539 );
0540 
0541 _XFUNCPROTOEND
0542 
0543 #endif /* _SMLIB_H_ */