jpayne@69: /****************************************************************************** jpayne@69: jpayne@69: jpayne@69: Copyright 1993, 1998 The Open Group jpayne@69: jpayne@69: Permission to use, copy, modify, distribute, and sell this software and its jpayne@69: documentation for any purpose is hereby granted without fee, provided that jpayne@69: the above copyright notice appear in all copies and that both that jpayne@69: copyright notice and this permission notice appear in supporting jpayne@69: documentation. jpayne@69: jpayne@69: The above copyright notice and this permission notice shall be included in jpayne@69: all copies or substantial portions of the Software. jpayne@69: jpayne@69: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR jpayne@69: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, jpayne@69: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE jpayne@69: OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN jpayne@69: AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN jpayne@69: CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jpayne@69: jpayne@69: Except as contained in this notice, the name of The Open Group shall not be jpayne@69: used in advertising or otherwise to promote the sale, use or other dealings jpayne@69: in this Software without prior written authorization from The Open Group. jpayne@69: jpayne@69: Author: Ralph Mor, X Consortium jpayne@69: ******************************************************************************/ jpayne@69: jpayne@69: #ifndef _ICELIB_H_ jpayne@69: #define _ICELIB_H_ jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: #define Bool int jpayne@69: #define Status int jpayne@69: #define True 1 jpayne@69: #define False 0 jpayne@69: jpayne@69: typedef void *IcePointer; jpayne@69: jpayne@69: typedef enum { jpayne@69: IcePoAuthHaveReply, jpayne@69: IcePoAuthRejected, jpayne@69: IcePoAuthFailed, jpayne@69: IcePoAuthDoneCleanup jpayne@69: } IcePoAuthStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IcePaAuthContinue, jpayne@69: IcePaAuthAccepted, jpayne@69: IcePaAuthRejected, jpayne@69: IcePaAuthFailed jpayne@69: } IcePaAuthStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IceConnectPending, jpayne@69: IceConnectAccepted, jpayne@69: IceConnectRejected, jpayne@69: IceConnectIOError jpayne@69: } IceConnectStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IceProtocolSetupSuccess, jpayne@69: IceProtocolSetupFailure, jpayne@69: IceProtocolSetupIOError, jpayne@69: IceProtocolAlreadyActive jpayne@69: } IceProtocolSetupStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IceAcceptSuccess, jpayne@69: IceAcceptFailure, jpayne@69: IceAcceptBadMalloc jpayne@69: } IceAcceptStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IceClosedNow, jpayne@69: IceClosedASAP, jpayne@69: IceConnectionInUse, jpayne@69: IceStartedShutdownNegotiation jpayne@69: } IceCloseStatus; jpayne@69: jpayne@69: typedef enum { jpayne@69: IceProcessMessagesSuccess, jpayne@69: IceProcessMessagesIOError, jpayne@69: IceProcessMessagesConnectionClosed jpayne@69: } IceProcessMessagesStatus; jpayne@69: jpayne@69: typedef struct { jpayne@69: unsigned long sequence_of_request; jpayne@69: int major_opcode_of_request; jpayne@69: int minor_opcode_of_request; jpayne@69: IcePointer reply; jpayne@69: } IceReplyWaitInfo; jpayne@69: jpayne@69: typedef struct _IceConn *IceConn; jpayne@69: typedef struct _IceListenObj *IceListenObj; jpayne@69: jpayne@69: typedef void (*IceWatchProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer /* clientData */, jpayne@69: Bool /* opening */, jpayne@69: IcePointer * /* watchData */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IcePoProcessMsgProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer /* clientData */, jpayne@69: int /* opcode */, jpayne@69: unsigned long /* length */, jpayne@69: Bool /* swap */, jpayne@69: IceReplyWaitInfo * /* replyWait */, jpayne@69: Bool * /* replyReadyRet */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IcePaProcessMsgProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer /* clientData */, jpayne@69: int /* opcode */, jpayne@69: unsigned long /* length */, jpayne@69: Bool /* swap */ jpayne@69: ); jpayne@69: jpayne@69: typedef struct { jpayne@69: int major_version; jpayne@69: int minor_version; jpayne@69: IcePoProcessMsgProc process_msg_proc; jpayne@69: } IcePoVersionRec; jpayne@69: jpayne@69: typedef struct { jpayne@69: int major_version; jpayne@69: int minor_version; jpayne@69: IcePaProcessMsgProc process_msg_proc; jpayne@69: } IcePaVersionRec; jpayne@69: jpayne@69: typedef IcePoAuthStatus (*IcePoAuthProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer * /* authStatePtr */, jpayne@69: Bool /* cleanUp */, jpayne@69: Bool /* swap */, jpayne@69: int /* authDataLen */, jpayne@69: IcePointer /* authData */, jpayne@69: int * /* replyDataLenRet */, jpayne@69: IcePointer * /* replyDataRet */, jpayne@69: char ** /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: typedef IcePaAuthStatus (*IcePaAuthProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer * /* authStatePtr */, jpayne@69: Bool /* swap */, jpayne@69: int /* authDataLen */, jpayne@69: IcePointer /* authData */, jpayne@69: int * /* replyDataLenRet */, jpayne@69: IcePointer * /* replyDataRet */, jpayne@69: char ** /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: typedef Bool (*IceHostBasedAuthProc) ( jpayne@69: char * /* hostName */ jpayne@69: ); jpayne@69: jpayne@69: typedef Status (*IceProtocolSetupProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: int /* majorVersion */, jpayne@69: int /* minorVersion */, jpayne@69: char * /* vendor */, jpayne@69: char * /* release */, jpayne@69: IcePointer * /* clientDataRet */, jpayne@69: char ** /* failureReasonRet */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IceProtocolActivateProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer /* clientData */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IceIOErrorProc) ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IcePingReplyProc) ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePointer /* clientData */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IceErrorHandler) ( jpayne@69: IceConn /* iceConn */, jpayne@69: Bool /* swap */, jpayne@69: int /* offendingMinorOpcode */, jpayne@69: unsigned long /* offendingSequence */, jpayne@69: int /* errorClass */, jpayne@69: int /* severity */, jpayne@69: IcePointer /* values */ jpayne@69: ); jpayne@69: jpayne@69: typedef void (*IceIOErrorHandler) ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * Function prototypes jpayne@69: */ jpayne@69: jpayne@69: _XFUNCPROTOBEGIN jpayne@69: jpayne@69: extern int IceRegisterForProtocolSetup ( jpayne@69: const char * /* protocolName */, jpayne@69: const char * /* vendor */, jpayne@69: const char * /* release */, jpayne@69: int /* versionCount */, jpayne@69: IcePoVersionRec * /* versionRecs */, jpayne@69: int /* authCount */, jpayne@69: const char ** /* authNames */, jpayne@69: IcePoAuthProc * /* authProcs */, jpayne@69: IceIOErrorProc /* IOErrorProc */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceRegisterForProtocolReply ( jpayne@69: const char * /* protocolName */, jpayne@69: const char * /* vendor */, jpayne@69: const char * /* release */, jpayne@69: int /* versionCount */, jpayne@69: IcePaVersionRec * /* versionRecs */, jpayne@69: int /* authCount */, jpayne@69: const char ** /* authNames */, jpayne@69: IcePaAuthProc * /* authProcs */, jpayne@69: IceHostBasedAuthProc /* hostBasedAuthProc */, jpayne@69: IceProtocolSetupProc /* protocolSetupProc */, jpayne@69: IceProtocolActivateProc /* protocolActivateProc */, jpayne@69: IceIOErrorProc /* IOErrorProc */ jpayne@69: ); jpayne@69: jpayne@69: extern IceConn IceOpenConnection ( jpayne@69: char * /* networkIdsList */, jpayne@69: IcePointer /* context */, jpayne@69: Bool /* mustAuthenticate */, jpayne@69: int /* majorOpcodeCheck */, jpayne@69: int /* errorLength */, jpayne@69: char * /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: extern IcePointer IceGetConnectionContext ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern Status IceListenForConnections ( jpayne@69: int * /* countRet */, jpayne@69: IceListenObj ** /* listenObjsRet */, jpayne@69: int /* errorLength */, jpayne@69: char * /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: extern Status IceListenForWellKnownConnections ( jpayne@69: char * /* port */, jpayne@69: int * /* countRet */, jpayne@69: IceListenObj ** /* listenObjsRet */, jpayne@69: int /* errorLength */, jpayne@69: char * /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceGetListenConnectionNumber ( jpayne@69: IceListenObj /* listenObj */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceGetListenConnectionString ( jpayne@69: IceListenObj /* listenObj */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceComposeNetworkIdList ( jpayne@69: int /* count */, jpayne@69: IceListenObj * /* listenObjs */ jpayne@69: ); jpayne@69: jpayne@69: extern void IceFreeListenObjs ( jpayne@69: int /* count */, jpayne@69: IceListenObj * /* listenObjs */ jpayne@69: ); jpayne@69: jpayne@69: extern void IceSetHostBasedAuthProc ( jpayne@69: IceListenObj /* listenObj */, jpayne@69: IceHostBasedAuthProc /* hostBasedAuthProc */ jpayne@69: ); jpayne@69: jpayne@69: extern IceConn IceAcceptConnection ( jpayne@69: IceListenObj /* listenObj */, jpayne@69: IceAcceptStatus * /* statusRet */ jpayne@69: ); jpayne@69: jpayne@69: extern void IceSetShutdownNegotiation ( jpayne@69: IceConn /* iceConn */, jpayne@69: Bool /* negotiate */ jpayne@69: ); jpayne@69: jpayne@69: extern Bool IceCheckShutdownNegotiation ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern IceCloseStatus IceCloseConnection ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern Status IceAddConnectionWatch ( jpayne@69: IceWatchProc /* watchProc */, jpayne@69: IcePointer /* clientData */ jpayne@69: ); jpayne@69: jpayne@69: extern void IceRemoveConnectionWatch ( jpayne@69: IceWatchProc /* watchProc */, jpayne@69: IcePointer /* clientData */ jpayne@69: ); jpayne@69: jpayne@69: extern IceProtocolSetupStatus IceProtocolSetup ( jpayne@69: IceConn /* iceConn */, jpayne@69: int /* myOpcode */, jpayne@69: IcePointer /* clientData */, jpayne@69: Bool /* mustAuthenticate */, jpayne@69: int * /* majorVersionRet */, jpayne@69: int * /* minorVersionRet */, jpayne@69: char ** /* vendorRet */, jpayne@69: char ** /* releaseRet */, jpayne@69: int /* errorLength */, jpayne@69: char * /* errorStringRet */ jpayne@69: ); jpayne@69: jpayne@69: extern Status IceProtocolShutdown ( jpayne@69: IceConn /* iceConn */, jpayne@69: int /* majorOpcode */ jpayne@69: ); jpayne@69: jpayne@69: extern IceProcessMessagesStatus IceProcessMessages ( jpayne@69: IceConn /* iceConn */, jpayne@69: IceReplyWaitInfo * /* replyWait */, jpayne@69: Bool * /* replyReadyRet */ jpayne@69: ); jpayne@69: jpayne@69: extern Status IcePing ( jpayne@69: IceConn /* iceConn */, jpayne@69: IcePingReplyProc /* pingReplyProc */, jpayne@69: IcePointer /* clientData */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceAllocScratch ( jpayne@69: IceConn /* iceConn */, jpayne@69: unsigned long /* size */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceFlush ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceGetOutBufSize ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceGetInBufSize ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern IceConnectStatus IceConnectionStatus ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceVendor ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceRelease ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceProtocolVersion ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceProtocolRevision ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern int IceConnectionNumber ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceConnectionString ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern unsigned long IceLastSentSequenceNumber ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern unsigned long IceLastReceivedSequenceNumber ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern Bool IceSwapping ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern IceErrorHandler IceSetErrorHandler ( jpayne@69: IceErrorHandler /* handler */ jpayne@69: ); jpayne@69: jpayne@69: extern IceIOErrorHandler IceSetIOErrorHandler ( jpayne@69: IceIOErrorHandler /* handler */ jpayne@69: ); jpayne@69: jpayne@69: extern char *IceGetPeerName ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: /* jpayne@69: * Multithread Routines jpayne@69: */ jpayne@69: jpayne@69: extern Status IceInitThreads ( jpayne@69: void jpayne@69: ); jpayne@69: jpayne@69: extern void IceAppLockConn ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: extern void IceAppUnlockConn ( jpayne@69: IceConn /* iceConn */ jpayne@69: ); jpayne@69: jpayne@69: _XFUNCPROTOEND jpayne@69: jpayne@69: #endif /* _ICELIB_H_ */