1: /* $Xorg: ICElib.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ 2: /****************************************************************************** 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: Author: Ralph Mor, X Consortium 28: ******************************************************************************/ 29: /* $XFree86: xc/lib/ICE/ICElib.h,v 3.4 2001/12/14 19:53:35 dawes Exp $ */ 30: 31: #ifndef _ICELIB_H_ 32: #define _ICELIB_H_ 33: 34: #include <X11/ICE/ICE.h> 35: #include <X11/Xfuncproto.h> 36: 37: #define Bool int 38: #define Status int 39: #define True 1 40: #define False 0 41: 42: typedef void *IcePointer; 43: 44: typedef enum { 45: IcePoAuthHaveReply, 46: IcePoAuthRejected, 47: IcePoAuthFailed, 48: IcePoAuthDoneCleanup 49: } IcePoAuthStatus; 50: 51: typedef enum { 52: IcePaAuthContinue, 53: IcePaAuthAccepted, 54: IcePaAuthRejected, 55: IcePaAuthFailed 56: } IcePaAuthStatus; 57: 58: typedef enum { 59: IceConnectPending, 60: IceConnectAccepted, 61: IceConnectRejected, 62: IceConnectIOError 63: } IceConnectStatus; 64: 65: typedef enum { 66: IceProtocolSetupSuccess, 67: IceProtocolSetupFailure, 68: IceProtocolSetupIOError, 69: IceProtocolAlreadyActive 70: } IceProtocolSetupStatus; 71: 72: typedef enum { 73: IceAcceptSuccess, 74: IceAcceptFailure, 75: IceAcceptBadMalloc 76: } IceAcceptStatus; 77: 78: typedef enum { 79: IceClosedNow, 80: IceClosedASAP, 81: IceConnectionInUse, 82: IceStartedShutdownNegotiation 83: } IceCloseStatus; 84: 85: typedef enum { 86: IceProcessMessagesSuccess, 87: IceProcessMessagesIOError, 88: IceProcessMessagesConnectionClosed 89: } IceProcessMessagesStatus; 90: 91: typedef struct { 92: unsigned long sequence_of_request; 93: int major_opcode_of_request; 94: int minor_opcode_of_request; 95: IcePointer reply; 96: } IceReplyWaitInfo; 97: 98: typedef struct _IceConn *IceConn; 99: typedef struct _IceListenObj *IceListenObj; 100: 101: typedef void (*IceWatchProc) ( 102: IceConn /* iceConn */, 103: IcePointer /* clientData */, 104: Bool /* opening */, 105: IcePointer * /* watchData */ 106: ); 107: 108: typedef void (*IcePoProcessMsgProc) ( 109: IceConn /* iceConn */, 110: IcePointer /* clientData */, 111: int /* opcode */, 112: unsigned long /* length */, 113: Bool /* swap */, 114: IceReplyWaitInfo * /* replyWait */, 115: Bool * /* replyReadyRet */ 116: ); 117: 118: typedef void (*IcePaProcessMsgProc) ( 119: IceConn /* iceConn */, 120: IcePointer /* clientData */, 121: int /* opcode */, 122: unsigned long /* length */, 123: Bool /* swap */ 124: ); 125: 126: typedef struct { 127: int major_version; 128: int minor_version; 129: IcePoProcessMsgProc process_msg_proc; 130: } IcePoVersionRec; 131: 132: typedef struct { 133: int major_version; 134: int minor_version; 135: IcePaProcessMsgProc process_msg_proc; 136: } IcePaVersionRec; 137: 138: typedef IcePoAuthStatus (*IcePoAuthProc) ( 139: IceConn /* iceConn */, 140: IcePointer * /* authStatePtr */, 141: Bool /* cleanUp */, 142: Bool /* swap */, 143: int /* authDataLen */, 144: IcePointer /* authData */, 145: int * /* replyDataLenRet */, 146: IcePointer * /* replyDataRet */, 147: char ** /* errorStringRet */ 148: ); 149: 150: typedef IcePaAuthStatus (*IcePaAuthProc) ( 151: IceConn /* iceConn */, 152: IcePointer * /* authStatePtr */, 153: Bool /* swap */, 154: int /* authDataLen */, 155: IcePointer /* authData */, 156: int * /* replyDataLenRet */, 157: IcePointer * /* replyDataRet */, 158: char ** /* errorStringRet */ 159: ); 160: 161: typedef Bool (*IceHostBasedAuthProc) ( 162: char * /* hostName */ 163: ); 164: 165: typedef Status (*IceProtocolSetupProc) ( 166: IceConn /* iceConn */, 167: int /* majorVersion */, 168: int /* minorVersion */, 169: char * /* vendor */, 170: char * /* release */, 171: IcePointer * /* clientDataRet */, 172: char ** /* failureReasonRet */ 173: ); 174: 175: typedef void (*IceProtocolActivateProc) ( 176: IceConn /* iceConn */, 177: IcePointer /* clientData */ 178: ); 179: 180: typedef void (*IceIOErrorProc) ( 181: IceConn /* iceConn */ 182: ); 183: 184: typedef void (*IcePingReplyProc) ( 185: IceConn /* iceConn */, 186: IcePointer /* clientData */ 187: ); 188: 189: typedef void (*IceErrorHandler) ( 190: IceConn /* iceConn */, 191: Bool /* swap */, 192: int /* offendingMinorOpcode */, 193: unsigned long /* offendingSequence */, 194: int /* errorClass */, 195: int /* severity */, 196: IcePointer /* values */ 197: ); 198: 199: typedef void (*IceIOErrorHandler) ( 200: IceConn /* iceConn */ 201: ); 202: 203: 204: /* 205: * Function prototypes 206: */ 207: 208: _XFUNCPROTOBEGIN 209: 210: extern int IceRegisterForProtocolSetup ( 211: char * /* protocolName */, 212: char * /* vendor */, 213: char * /* release */, 214: int /* versionCount */, 215: IcePoVersionRec * /* versionRecs */, 216: int /* authCount */, 217: char ** /* authNames */, 218: IcePoAuthProc * /* authProcs */, 219: IceIOErrorProc /* IOErrorProc */ 220: ); 221: 222: extern int IceRegisterForProtocolReply ( 223: char * /* protocolName */, 224: char * /* vendor */, 225: char * /* release */, 226: int /* versionCount */, 227: IcePaVersionRec * /* versionRecs */, 228: int /* authCount */, 229: char ** /* authNames */, 230: IcePaAuthProc * /* authProcs */, 231: IceHostBasedAuthProc /* hostBasedAuthProc */, 232: IceProtocolSetupProc /* protocolSetupProc */, 233: IceProtocolActivateProc /* protocolActivateProc */, 234: IceIOErrorProc /* IOErrorProc */ 235: ); 236: 237: extern IceConn IceOpenConnection ( 238: char * /* networkIdsList */, 239: IcePointer /* context */, 240: Bool /* mustAuthenticate */, 241: int /* majorOpcodeCheck */, 242: int /* errorLength */, 243: char * /* errorStringRet */ 244: ); 245: 246: extern IcePointer IceGetConnectionContext ( 247: IceConn /* iceConn */ 248: ); 249: 250: extern Status IceListenForConnections ( 251: int * /* countRet */, 252: IceListenObj ** /* listenObjsRet */, 253: int /* errorLength */, 254: char * /* errorStringRet */ 255: ); 256: 257: extern Status IceListenForWellKnownConnections ( 258: char * /* port */, 259: int * /* countRet */, 260: IceListenObj ** /* listenObjsRet */, 261: int /* errorLength */, 262: char * /* errorStringRet */ 263: ); 264: 265: extern int IceGetListenConnectionNumber ( 266: IceListenObj /* listenObj */ 267: ); 268: 269: extern char *IceGetListenConnectionString ( 270: IceListenObj /* listenObj */ 271: ); 272: 273: extern char *IceComposeNetworkIdList ( 274: int /* count */, 275: IceListenObj * /* listenObjs */ 276: ); 277: 278: extern void IceFreeListenObjs ( 279: int /* count */, 280: IceListenObj * /* listenObjs */ 281: ); 282: 283: extern void IceSetHostBasedAuthProc ( 284: IceListenObj /* listenObj */, 285: IceHostBasedAuthProc /* hostBasedAuthProc */ 286: ); 287: 288: extern IceConn IceAcceptConnection ( 289: IceListenObj /* listenObj */, 290: IceAcceptStatus * /* statusRet */ 291: ); 292: 293: extern void IceSetShutdownNegotiation ( 294: IceConn /* iceConn */, 295: Bool /* negotiate */ 296: ); 297: 298: extern Bool IceCheckShutdownNegotiation ( 299: IceConn /* iceConn */ 300: ); 301: 302: extern IceCloseStatus IceCloseConnection ( 303: IceConn /* iceConn */ 304: ); 305: 306: extern Status IceAddConnectionWatch ( 307: IceWatchProc /* watchProc */, 308: IcePointer /* clientData */ 309: ); 310: 311: extern void IceRemoveConnectionWatch ( 312: IceWatchProc /* watchProc */, 313: IcePointer /* clientData */ 314: ); 315: 316: extern IceProtocolSetupStatus IceProtocolSetup ( 317: IceConn /* iceConn */, 318: int /* myOpcode */, 319: IcePointer /* clientData */, 320: Bool /* mustAuthenticate */, 321: int * /* majorVersionRet */, 322: int * /* minorVersionRet */, 323: char ** /* vendorRet */, 324: char ** /* releaseRet */, 325: int /* errorLength */, 326: char * /* errorStringRet */ 327: ); 328: 329: extern Status IceProtocolShutdown ( 330: IceConn /* iceConn */, 331: int /* majorOpcode */ 332: ); 333: 334: extern IceProcessMessagesStatus IceProcessMessages ( 335: IceConn /* iceConn */, 336: IceReplyWaitInfo * /* replyWait */, 337: Bool * /* replyReadyRet */ 338: ); 339: 340: extern Status IcePing ( 341: IceConn /* iceConn */, 342: IcePingReplyProc /* pingReplyProc */, 343: IcePointer /* clientData */ 344: ); 345: 346: extern char *IceAllocScratch ( 347: IceConn /* iceConn */, 348: unsigned long /* size */ 349: ); 350: 351: extern int IceFlush ( 352: IceConn /* iceConn */ 353: ); 354: 355: extern int IceGetOutBufSize ( 356: IceConn /* iceConn */ 357: ); 358: 359: extern int IceGetInBufSize ( 360: IceConn /* iceConn */ 361: ); 362: 363: extern IceConnectStatus IceConnectionStatus ( 364: IceConn /* iceConn */ 365: ); 366: 367: extern char *IceVendor ( 368: IceConn /* iceConn */ 369: ); 370: 371: extern char *IceRelease ( 372: IceConn /* iceConn */ 373: ); 374: 375: extern int IceProtocolVersion ( 376: IceConn /* iceConn */ 377: ); 378: 379: extern int IceProtocolRevision ( 380: IceConn /* iceConn */ 381: ); 382: 383: extern int IceConnectionNumber ( 384: IceConn /* iceConn */ 385: ); 386: 387: extern char *IceConnectionString ( 388: IceConn /* iceConn */ 389: ); 390: 391: extern unsigned long IceLastSentSequenceNumber ( 392: IceConn /* iceConn */ 393: ); 394: 395: extern unsigned long IceLastReceivedSequenceNumber ( 396: IceConn /* iceConn */ 397: ); 398: 399: extern Bool IceSwapping ( 400: IceConn /* iceConn */ 401: ); 402: 403: extern IceErrorHandler IceSetErrorHandler ( 404: IceErrorHandler /* handler */ 405: ); 406: 407: extern IceIOErrorHandler IceSetIOErrorHandler ( 408: IceIOErrorHandler /* handler */ 409: ); 410: 411: 412: /* 413: * Multithread Routines 414: */ 415: 416: extern Status IceInitThreads ( 417: void 418: ); 419: 420: extern void IceAppLockConn ( 421: IceConn /* iceConn */ 422: ); 423: 424: extern void IceAppUnlockConn ( 425: IceConn /* iceConn */ 426: ); 427: 428: _XFUNCPROTOEND 429: 430: #endif /* _ICELIB_H_ */ 431: