1266e564dSmrg/****************************************************************************** 2266e564dSmrg 3266e564dSmrg 4266e564dSmrgCopyright 1993, 1998 The Open Group 5266e564dSmrg 6266e564dSmrgPermission to use, copy, modify, distribute, and sell this software and its 7266e564dSmrgdocumentation for any purpose is hereby granted without fee, provided that 8266e564dSmrgthe above copyright notice appear in all copies and that both that 9266e564dSmrgcopyright notice and this permission notice appear in supporting 10266e564dSmrgdocumentation. 11266e564dSmrg 12266e564dSmrgThe above copyright notice and this permission notice shall be included in 13266e564dSmrgall copies or substantial portions of the Software. 14266e564dSmrg 15266e564dSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16266e564dSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17266e564dSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18266e564dSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 19266e564dSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20266e564dSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21266e564dSmrg 22266e564dSmrgExcept as contained in this notice, the name of The Open Group shall not be 23266e564dSmrgused in advertising or otherwise to promote the sale, use or other dealings 24266e564dSmrgin this Software without prior written authorization from The Open Group. 25266e564dSmrg 26266e564dSmrgAuthor: Ralph Mor, X Consortium 27266e564dSmrg******************************************************************************/ 28266e564dSmrg 29266e564dSmrg#ifndef _ICELIB_H_ 30266e564dSmrg#define _ICELIB_H_ 31266e564dSmrg 32266e564dSmrg#include <X11/ICE/ICE.h> 33266e564dSmrg#include <X11/Xfuncproto.h> 34266e564dSmrg 35266e564dSmrg#define Bool int 36266e564dSmrg#define Status int 37266e564dSmrg#define True 1 38266e564dSmrg#define False 0 39266e564dSmrg 40266e564dSmrgtypedef void *IcePointer; 41266e564dSmrg 42266e564dSmrgtypedef enum { 43266e564dSmrg IcePoAuthHaveReply, 44266e564dSmrg IcePoAuthRejected, 45266e564dSmrg IcePoAuthFailed, 46266e564dSmrg IcePoAuthDoneCleanup 47266e564dSmrg} IcePoAuthStatus; 48266e564dSmrg 49266e564dSmrgtypedef enum { 50266e564dSmrg IcePaAuthContinue, 51266e564dSmrg IcePaAuthAccepted, 52266e564dSmrg IcePaAuthRejected, 53266e564dSmrg IcePaAuthFailed 54266e564dSmrg} IcePaAuthStatus; 55266e564dSmrg 56266e564dSmrgtypedef enum { 57266e564dSmrg IceConnectPending, 58266e564dSmrg IceConnectAccepted, 59266e564dSmrg IceConnectRejected, 60266e564dSmrg IceConnectIOError 61266e564dSmrg} IceConnectStatus; 62266e564dSmrg 63266e564dSmrgtypedef enum { 64266e564dSmrg IceProtocolSetupSuccess, 65266e564dSmrg IceProtocolSetupFailure, 66266e564dSmrg IceProtocolSetupIOError, 67266e564dSmrg IceProtocolAlreadyActive 68266e564dSmrg} IceProtocolSetupStatus; 69266e564dSmrg 70266e564dSmrgtypedef enum { 71266e564dSmrg IceAcceptSuccess, 72266e564dSmrg IceAcceptFailure, 73266e564dSmrg IceAcceptBadMalloc 74266e564dSmrg} IceAcceptStatus; 75266e564dSmrg 76266e564dSmrgtypedef enum { 77266e564dSmrg IceClosedNow, 78266e564dSmrg IceClosedASAP, 79266e564dSmrg IceConnectionInUse, 80266e564dSmrg IceStartedShutdownNegotiation 81266e564dSmrg} IceCloseStatus; 82266e564dSmrg 83266e564dSmrgtypedef enum { 84266e564dSmrg IceProcessMessagesSuccess, 85266e564dSmrg IceProcessMessagesIOError, 86266e564dSmrg IceProcessMessagesConnectionClosed 87266e564dSmrg} IceProcessMessagesStatus; 88266e564dSmrg 89266e564dSmrgtypedef struct { 90266e564dSmrg unsigned long sequence_of_request; 91266e564dSmrg int major_opcode_of_request; 92266e564dSmrg int minor_opcode_of_request; 93266e564dSmrg IcePointer reply; 94266e564dSmrg} IceReplyWaitInfo; 95266e564dSmrg 96266e564dSmrgtypedef struct _IceConn *IceConn; 97266e564dSmrgtypedef struct _IceListenObj *IceListenObj; 98266e564dSmrg 99266e564dSmrgtypedef void (*IceWatchProc) ( 100266e564dSmrg IceConn /* iceConn */, 101266e564dSmrg IcePointer /* clientData */, 102266e564dSmrg Bool /* opening */, 103266e564dSmrg IcePointer * /* watchData */ 104266e564dSmrg); 105266e564dSmrg 106266e564dSmrgtypedef void (*IcePoProcessMsgProc) ( 107266e564dSmrg IceConn /* iceConn */, 108266e564dSmrg IcePointer /* clientData */, 109266e564dSmrg int /* opcode */, 110266e564dSmrg unsigned long /* length */, 111266e564dSmrg Bool /* swap */, 112266e564dSmrg IceReplyWaitInfo * /* replyWait */, 113266e564dSmrg Bool * /* replyReadyRet */ 114266e564dSmrg); 115266e564dSmrg 116266e564dSmrgtypedef void (*IcePaProcessMsgProc) ( 117266e564dSmrg IceConn /* iceConn */, 118266e564dSmrg IcePointer /* clientData */, 119266e564dSmrg int /* opcode */, 120266e564dSmrg unsigned long /* length */, 121266e564dSmrg Bool /* swap */ 122266e564dSmrg); 123266e564dSmrg 124266e564dSmrgtypedef struct { 125266e564dSmrg int major_version; 126266e564dSmrg int minor_version; 127266e564dSmrg IcePoProcessMsgProc process_msg_proc; 128266e564dSmrg} IcePoVersionRec; 129266e564dSmrg 130266e564dSmrgtypedef struct { 131266e564dSmrg int major_version; 132266e564dSmrg int minor_version; 133266e564dSmrg IcePaProcessMsgProc process_msg_proc; 134266e564dSmrg} IcePaVersionRec; 135266e564dSmrg 136266e564dSmrgtypedef IcePoAuthStatus (*IcePoAuthProc) ( 137266e564dSmrg IceConn /* iceConn */, 138266e564dSmrg IcePointer * /* authStatePtr */, 139266e564dSmrg Bool /* cleanUp */, 140266e564dSmrg Bool /* swap */, 141266e564dSmrg int /* authDataLen */, 142266e564dSmrg IcePointer /* authData */, 143266e564dSmrg int * /* replyDataLenRet */, 144266e564dSmrg IcePointer * /* replyDataRet */, 145266e564dSmrg char ** /* errorStringRet */ 146266e564dSmrg); 147266e564dSmrg 148266e564dSmrgtypedef IcePaAuthStatus (*IcePaAuthProc) ( 149266e564dSmrg IceConn /* iceConn */, 150266e564dSmrg IcePointer * /* authStatePtr */, 151266e564dSmrg Bool /* swap */, 152266e564dSmrg int /* authDataLen */, 153266e564dSmrg IcePointer /* authData */, 154266e564dSmrg int * /* replyDataLenRet */, 155266e564dSmrg IcePointer * /* replyDataRet */, 156266e564dSmrg char ** /* errorStringRet */ 157266e564dSmrg); 158266e564dSmrg 159266e564dSmrgtypedef Bool (*IceHostBasedAuthProc) ( 160266e564dSmrg char * /* hostName */ 161266e564dSmrg); 162266e564dSmrg 163266e564dSmrgtypedef Status (*IceProtocolSetupProc) ( 164266e564dSmrg IceConn /* iceConn */, 165266e564dSmrg int /* majorVersion */, 166266e564dSmrg int /* minorVersion */, 167266e564dSmrg char * /* vendor */, 168266e564dSmrg char * /* release */, 169266e564dSmrg IcePointer * /* clientDataRet */, 170266e564dSmrg char ** /* failureReasonRet */ 171266e564dSmrg); 172266e564dSmrg 173266e564dSmrgtypedef void (*IceProtocolActivateProc) ( 174266e564dSmrg IceConn /* iceConn */, 175266e564dSmrg IcePointer /* clientData */ 176266e564dSmrg); 177266e564dSmrg 178266e564dSmrgtypedef void (*IceIOErrorProc) ( 179266e564dSmrg IceConn /* iceConn */ 180266e564dSmrg); 181266e564dSmrg 182266e564dSmrgtypedef void (*IcePingReplyProc) ( 183266e564dSmrg IceConn /* iceConn */, 184266e564dSmrg IcePointer /* clientData */ 185266e564dSmrg); 186266e564dSmrg 187266e564dSmrgtypedef void (*IceErrorHandler) ( 188266e564dSmrg IceConn /* iceConn */, 189266e564dSmrg Bool /* swap */, 190266e564dSmrg int /* offendingMinorOpcode */, 191266e564dSmrg unsigned long /* offendingSequence */, 192266e564dSmrg int /* errorClass */, 193266e564dSmrg int /* severity */, 194266e564dSmrg IcePointer /* values */ 195266e564dSmrg); 196266e564dSmrg 197266e564dSmrgtypedef void (*IceIOErrorHandler) ( 198266e564dSmrg IceConn /* iceConn */ 199266e564dSmrg); 200266e564dSmrg 201266e564dSmrg 202266e564dSmrg/* 203266e564dSmrg * Function prototypes 204266e564dSmrg */ 205266e564dSmrg 206266e564dSmrg_XFUNCPROTOBEGIN 207266e564dSmrg 208266e564dSmrgextern int IceRegisterForProtocolSetup ( 2099ef0b394Smrg const char * /* protocolName */, 2109ef0b394Smrg const char * /* vendor */, 2119ef0b394Smrg const char * /* release */, 212266e564dSmrg int /* versionCount */, 213266e564dSmrg IcePoVersionRec * /* versionRecs */, 214266e564dSmrg int /* authCount */, 215c5629e66Smrg const char ** /* authNames */, 216266e564dSmrg IcePoAuthProc * /* authProcs */, 217266e564dSmrg IceIOErrorProc /* IOErrorProc */ 218266e564dSmrg); 219266e564dSmrg 220266e564dSmrgextern int IceRegisterForProtocolReply ( 2219ef0b394Smrg const char * /* protocolName */, 2229ef0b394Smrg const char * /* vendor */, 2239ef0b394Smrg const char * /* release */, 224266e564dSmrg int /* versionCount */, 225266e564dSmrg IcePaVersionRec * /* versionRecs */, 226266e564dSmrg int /* authCount */, 227c5629e66Smrg const char ** /* authNames */, 228266e564dSmrg IcePaAuthProc * /* authProcs */, 229266e564dSmrg IceHostBasedAuthProc /* hostBasedAuthProc */, 230266e564dSmrg IceProtocolSetupProc /* protocolSetupProc */, 231266e564dSmrg IceProtocolActivateProc /* protocolActivateProc */, 232266e564dSmrg IceIOErrorProc /* IOErrorProc */ 233266e564dSmrg); 234266e564dSmrg 235266e564dSmrgextern IceConn IceOpenConnection ( 236266e564dSmrg char * /* networkIdsList */, 237266e564dSmrg IcePointer /* context */, 238266e564dSmrg Bool /* mustAuthenticate */, 239266e564dSmrg int /* majorOpcodeCheck */, 240266e564dSmrg int /* errorLength */, 241266e564dSmrg char * /* errorStringRet */ 242266e564dSmrg); 243266e564dSmrg 244266e564dSmrgextern IcePointer IceGetConnectionContext ( 245266e564dSmrg IceConn /* iceConn */ 246266e564dSmrg); 247266e564dSmrg 248266e564dSmrgextern Status IceListenForConnections ( 249266e564dSmrg int * /* countRet */, 250266e564dSmrg IceListenObj ** /* listenObjsRet */, 251266e564dSmrg int /* errorLength */, 252266e564dSmrg char * /* errorStringRet */ 253266e564dSmrg); 254266e564dSmrg 255266e564dSmrgextern Status IceListenForWellKnownConnections ( 256266e564dSmrg char * /* port */, 257266e564dSmrg int * /* countRet */, 258266e564dSmrg IceListenObj ** /* listenObjsRet */, 259266e564dSmrg int /* errorLength */, 260266e564dSmrg char * /* errorStringRet */ 261266e564dSmrg); 262266e564dSmrg 263266e564dSmrgextern int IceGetListenConnectionNumber ( 264266e564dSmrg IceListenObj /* listenObj */ 265266e564dSmrg); 266266e564dSmrg 267266e564dSmrgextern char *IceGetListenConnectionString ( 268266e564dSmrg IceListenObj /* listenObj */ 269266e564dSmrg); 270266e564dSmrg 271266e564dSmrgextern char *IceComposeNetworkIdList ( 272266e564dSmrg int /* count */, 273266e564dSmrg IceListenObj * /* listenObjs */ 274266e564dSmrg); 275266e564dSmrg 276266e564dSmrgextern void IceFreeListenObjs ( 277266e564dSmrg int /* count */, 278266e564dSmrg IceListenObj * /* listenObjs */ 279266e564dSmrg); 280266e564dSmrg 281266e564dSmrgextern void IceSetHostBasedAuthProc ( 282266e564dSmrg IceListenObj /* listenObj */, 283266e564dSmrg IceHostBasedAuthProc /* hostBasedAuthProc */ 284266e564dSmrg); 285266e564dSmrg 286266e564dSmrgextern IceConn IceAcceptConnection ( 287266e564dSmrg IceListenObj /* listenObj */, 288266e564dSmrg IceAcceptStatus * /* statusRet */ 289266e564dSmrg); 290266e564dSmrg 291266e564dSmrgextern void IceSetShutdownNegotiation ( 292266e564dSmrg IceConn /* iceConn */, 293266e564dSmrg Bool /* negotiate */ 294266e564dSmrg); 295266e564dSmrg 296266e564dSmrgextern Bool IceCheckShutdownNegotiation ( 297266e564dSmrg IceConn /* iceConn */ 298266e564dSmrg); 299266e564dSmrg 300266e564dSmrgextern IceCloseStatus IceCloseConnection ( 301266e564dSmrg IceConn /* iceConn */ 302266e564dSmrg); 303266e564dSmrg 304266e564dSmrgextern Status IceAddConnectionWatch ( 305266e564dSmrg IceWatchProc /* watchProc */, 306266e564dSmrg IcePointer /* clientData */ 307266e564dSmrg); 308266e564dSmrg 309266e564dSmrgextern void IceRemoveConnectionWatch ( 310266e564dSmrg IceWatchProc /* watchProc */, 311266e564dSmrg IcePointer /* clientData */ 312266e564dSmrg); 313266e564dSmrg 314266e564dSmrgextern IceProtocolSetupStatus IceProtocolSetup ( 315266e564dSmrg IceConn /* iceConn */, 316266e564dSmrg int /* myOpcode */, 317266e564dSmrg IcePointer /* clientData */, 318266e564dSmrg Bool /* mustAuthenticate */, 319266e564dSmrg int * /* majorVersionRet */, 320266e564dSmrg int * /* minorVersionRet */, 321266e564dSmrg char ** /* vendorRet */, 322266e564dSmrg char ** /* releaseRet */, 323266e564dSmrg int /* errorLength */, 324266e564dSmrg char * /* errorStringRet */ 325266e564dSmrg); 326266e564dSmrg 327266e564dSmrgextern Status IceProtocolShutdown ( 328266e564dSmrg IceConn /* iceConn */, 329266e564dSmrg int /* majorOpcode */ 330266e564dSmrg); 331266e564dSmrg 332266e564dSmrgextern IceProcessMessagesStatus IceProcessMessages ( 333266e564dSmrg IceConn /* iceConn */, 334266e564dSmrg IceReplyWaitInfo * /* replyWait */, 335266e564dSmrg Bool * /* replyReadyRet */ 336266e564dSmrg); 337266e564dSmrg 338266e564dSmrgextern Status IcePing ( 339266e564dSmrg IceConn /* iceConn */, 340266e564dSmrg IcePingReplyProc /* pingReplyProc */, 341266e564dSmrg IcePointer /* clientData */ 342266e564dSmrg); 343266e564dSmrg 344266e564dSmrgextern char *IceAllocScratch ( 345266e564dSmrg IceConn /* iceConn */, 346266e564dSmrg unsigned long /* size */ 347266e564dSmrg); 348266e564dSmrg 349266e564dSmrgextern int IceFlush ( 350266e564dSmrg IceConn /* iceConn */ 351266e564dSmrg); 352266e564dSmrg 353266e564dSmrgextern int IceGetOutBufSize ( 354266e564dSmrg IceConn /* iceConn */ 355266e564dSmrg); 356266e564dSmrg 357266e564dSmrgextern int IceGetInBufSize ( 358266e564dSmrg IceConn /* iceConn */ 359266e564dSmrg); 360266e564dSmrg 361266e564dSmrgextern IceConnectStatus IceConnectionStatus ( 362266e564dSmrg IceConn /* iceConn */ 363266e564dSmrg); 364266e564dSmrg 365266e564dSmrgextern char *IceVendor ( 366266e564dSmrg IceConn /* iceConn */ 367266e564dSmrg); 368266e564dSmrg 369266e564dSmrgextern char *IceRelease ( 370266e564dSmrg IceConn /* iceConn */ 371266e564dSmrg); 372266e564dSmrg 373266e564dSmrgextern int IceProtocolVersion ( 374266e564dSmrg IceConn /* iceConn */ 375266e564dSmrg); 376266e564dSmrg 377266e564dSmrgextern int IceProtocolRevision ( 378266e564dSmrg IceConn /* iceConn */ 379266e564dSmrg); 380266e564dSmrg 381266e564dSmrgextern int IceConnectionNumber ( 382266e564dSmrg IceConn /* iceConn */ 383266e564dSmrg); 384266e564dSmrg 385266e564dSmrgextern char *IceConnectionString ( 386266e564dSmrg IceConn /* iceConn */ 387266e564dSmrg); 388266e564dSmrg 389266e564dSmrgextern unsigned long IceLastSentSequenceNumber ( 390266e564dSmrg IceConn /* iceConn */ 391266e564dSmrg); 392266e564dSmrg 393266e564dSmrgextern unsigned long IceLastReceivedSequenceNumber ( 394266e564dSmrg IceConn /* iceConn */ 395266e564dSmrg); 396266e564dSmrg 397266e564dSmrgextern Bool IceSwapping ( 398266e564dSmrg IceConn /* iceConn */ 399266e564dSmrg); 400266e564dSmrg 401266e564dSmrgextern IceErrorHandler IceSetErrorHandler ( 402266e564dSmrg IceErrorHandler /* handler */ 403266e564dSmrg); 404266e564dSmrg 405266e564dSmrgextern IceIOErrorHandler IceSetIOErrorHandler ( 406266e564dSmrg IceIOErrorHandler /* handler */ 407266e564dSmrg); 408266e564dSmrg 409266e564dSmrgextern char *IceGetPeerName ( 410266e564dSmrg IceConn /* iceConn */ 411266e564dSmrg); 412266e564dSmrg 413266e564dSmrg/* 414266e564dSmrg * Multithread Routines 415266e564dSmrg */ 416266e564dSmrg 417266e564dSmrgextern Status IceInitThreads ( 418266e564dSmrg void 419266e564dSmrg); 420266e564dSmrg 421266e564dSmrgextern void IceAppLockConn ( 422266e564dSmrg IceConn /* iceConn */ 423266e564dSmrg); 424266e564dSmrg 425266e564dSmrgextern void IceAppUnlockConn ( 426266e564dSmrg IceConn /* iceConn */ 427266e564dSmrg); 428266e564dSmrg 429266e564dSmrg_XFUNCPROTOEND 430266e564dSmrg 431266e564dSmrg#endif /* _ICELIB_H_ */ 432