summaryrefslogtreecommitdiff
path: root/lib/libICE/include/X11/ICE
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-25 16:45:59 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-25 16:45:59 +0000
commit4867c786a6a757d7ad51be6e56031ab3308e9f8b (patch)
tree8587206739522694bb004dcc9ef6a3b8d882a58c /lib/libICE/include/X11/ICE
parent9b7bb5b308fa44c4ec0d5f8fdb8ceb7155bde9c0 (diff)
import from X.Org 7.2RC2
Diffstat (limited to 'lib/libICE/include/X11/ICE')
-rw-r--r--lib/libICE/include/X11/ICE/ICE.h102
-rw-r--r--lib/libICE/include/X11/ICE/ICEconn.h251
-rw-r--r--lib/libICE/include/X11/ICE/ICElib.h433
-rw-r--r--lib/libICE/include/X11/ICE/ICEmsg.h295
-rw-r--r--lib/libICE/include/X11/ICE/ICEproto.h176
-rw-r--r--lib/libICE/include/X11/ICE/ICEutil.h126
6 files changed, 1383 insertions, 0 deletions
diff --git a/lib/libICE/include/X11/ICE/ICE.h b/lib/libICE/include/X11/ICE/ICE.h
new file mode 100644
index 000000000..e2924f1ab
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICE.h
@@ -0,0 +1,102 @@
+/* $Xorg: ICE.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+
+******************************************************************************/
+
+#ifndef _ICE_H_
+#define _ICE_H_
+
+/*
+ * Protocol Version
+ */
+
+#define IceProtoMajor 1
+#define IceProtoMinor 0
+
+
+/*
+ * Byte Order
+ */
+
+#define IceLSBfirst 0
+#define IceMSBfirst 1
+
+
+/*
+ * ICE minor opcodes
+ */
+
+#define ICE_Error 0
+#define ICE_ByteOrder 1
+#define ICE_ConnectionSetup 2
+#define ICE_AuthRequired 3
+#define ICE_AuthReply 4
+#define ICE_AuthNextPhase 5
+#define ICE_ConnectionReply 6
+#define ICE_ProtocolSetup 7
+#define ICE_ProtocolReply 8
+#define ICE_Ping 9
+#define ICE_PingReply 10
+#define ICE_WantToClose 11
+#define ICE_NoClose 12
+
+
+/*
+ * Error severity
+ */
+
+#define IceCanContinue 0
+#define IceFatalToProtocol 1
+#define IceFatalToConnection 2
+
+
+/*
+ * ICE error classes that are common to all protocols
+ */
+
+#define IceBadMinor 0x8000
+#define IceBadState 0x8001
+#define IceBadLength 0x8002
+#define IceBadValue 0x8003
+
+
+/*
+ * ICE error classes that are specific to the ICE protocol
+ */
+
+#define IceBadMajor 0
+#define IceNoAuth 1
+#define IceNoVersion 2
+#define IceSetupFailed 3
+#define IceAuthRejected 4
+#define IceAuthFailed 5
+#define IceProtocolDuplicate 6
+#define IceMajorOpcodeDuplicate 7
+#define IceUnknownProtocol 8
+
+#endif /* _ICE_H_ */
diff --git a/lib/libICE/include/X11/ICE/ICEconn.h b/lib/libICE/include/X11/ICE/ICEconn.h
new file mode 100644
index 000000000..cdfaccaea
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICEconn.h
@@ -0,0 +1,251 @@
+/* $Xorg: ICEconn.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICECONN_H_
+#define _ICECONN_H_
+
+#include <X11/ICE/ICElib.h>
+
+/*
+ * Data structures for ICE connection object
+ */
+
+typedef struct _IceSavedReplyWait {
+ IceReplyWaitInfo *reply_wait;
+ Bool reply_ready;
+ struct _IceSavedReplyWait *next;
+} _IceSavedReplyWait;
+
+typedef struct _IcePingWait {
+ IcePingReplyProc ping_reply_proc;
+ IcePointer client_data;
+ struct _IcePingWait *next;
+} _IcePingWait;
+
+typedef struct {
+ char *vendor;
+ char *release;
+ int version_count;
+ IcePoVersionRec *version_recs;
+ int auth_count;
+ char **auth_names;
+ IcePoAuthProc *auth_procs;
+ IceIOErrorProc io_error_proc;
+} _IcePoProtocol;
+
+typedef struct {
+ char *vendor;
+ char *release;
+ int version_count;
+ IcePaVersionRec *version_recs;
+ IceProtocolSetupProc protocol_setup_proc;
+ IceProtocolActivateProc protocol_activate_proc;
+ int auth_count;
+ char **auth_names;
+ IcePaAuthProc *auth_procs;
+ IceHostBasedAuthProc host_based_auth_proc;
+ IceIOErrorProc io_error_proc;
+} _IcePaProtocol;
+
+typedef struct {
+ char *protocol_name;
+ _IcePoProtocol *orig_client;
+ _IcePaProtocol *accept_client;
+} _IceProtocol;
+
+typedef struct {
+ Bool in_use;
+ int my_opcode;
+ _IceProtocol *protocol;
+ IcePointer client_data;
+ Bool accept_flag;
+ union {
+ IcePaProcessMsgProc accept_client;
+ IcePoProcessMsgProc orig_client;
+ } process_msg_proc;
+} _IceProcessMsgInfo;
+
+typedef struct {
+ int his_version_index;
+ int my_version_index;
+ char *his_vendor;
+ char *his_release;
+ char my_auth_index;
+ IcePointer my_auth_state;
+ Bool must_authenticate;
+} _IceConnectToMeInfo;
+
+typedef struct {
+ int his_opcode;
+ int my_opcode;
+ int his_version_index;
+ int my_version_index;
+ char *his_vendor;
+ char *his_release;
+ char my_auth_index;
+ IcePointer my_auth_state;
+ Bool must_authenticate;
+} _IceProtoSetupToMeInfo;
+
+typedef struct {
+ Bool auth_active;
+ char my_auth_index;
+ IcePointer my_auth_state;
+} _IceConnectToYouInfo;
+
+typedef struct {
+ int my_opcode;
+ int my_auth_count;
+ int *my_auth_indices;
+ Bool auth_active;
+ char my_auth_index;
+ IcePointer my_auth_state;
+} _IceProtoSetupToYouInfo;
+
+
+struct _IceConn {
+
+ unsigned int io_ok : 1; /* did an IO error occur? */
+ unsigned int swap : 1; /* do we need to swap on reads? */
+ unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */
+ unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */
+ unsigned int want_to_close : 1; /* did we send a WantToClose? */
+ unsigned int free_asap : 1; /* free as soon as possible */
+ unsigned int unused1 : 2; /* future use */
+ unsigned int unused2 : 8; /* future use */
+
+ IceConnectStatus connection_status; /* pending, accepted, rejected */
+
+ unsigned char my_ice_version_index; /* which version are we using? */
+
+ struct _XtransConnInfo *trans_conn; /* transport connection object */
+ unsigned long send_sequence; /* Sequence # of last msg sent */
+ unsigned long receive_sequence; /* Sequence # of last msg received */
+
+ char *connection_string; /* network connection string */
+ char *vendor; /* other client's vendor */
+ char *release; /* other client's release */
+
+ char *inbuf; /* Input buffer starting address */
+ char *inbufptr; /* Input buffer index pointer */
+ char *inbufmax; /* Input buffer maximum+1 address */
+
+ char *outbuf; /* Output buffer starting address */
+ char *outbufptr; /* Output buffer index pointer */
+ char *outbufmax; /* Output buffer maximum+1 address */
+
+ char *scratch; /* scratch buffer */
+ unsigned long scratch_size; /* scratch size */
+
+ int dispatch_level; /* IceProcessMessages dispatch level */
+
+ IcePointer context; /* context associated with caller
+ of IceOpenConnection */
+
+ /*
+ * Before we read a message, the major opcode of the message must be
+ * mapped to our corresponding major opcode (the two clients can use
+ * different opcodes for the same protocol). In order to save space,
+ * we keep track of the mininum and maximum major opcodes used by the
+ * other client. To get the information on how to process this message,
+ * we do the following...
+ *
+ * processMsgInfo = iceConn->process_msg_info[
+ * message->majorOpcode - iceConn->his_min_opcode]
+ *
+ * Note that the number of elements in the iceConn->process_msg_info
+ * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
+ * We check process_msg_info->in_use to see if the opcode is being used.
+ */
+
+ _IceProcessMsgInfo *process_msg_info;
+ char his_min_opcode; /* [1..255] */
+ char his_max_opcode; /* [1..255] */
+
+
+ /*
+ * Number of times this iceConn was returned in IceOpenConnection
+ * or IceAcceptConnection.
+ */
+
+ unsigned char open_ref_count;
+
+
+ /*
+ * Number of active protocols.
+ */
+
+ unsigned char proto_ref_count;
+
+
+ /*
+ * If this ICE connection was created with IceAcceptConnection,
+ * the listen_obj field is set to the listen object. Otherwise,
+ * the listen_obj field is NULL.
+ */
+
+ IceListenObj listen_obj;
+
+
+
+
+ /*
+ * We need to keep track of all the replies we're waiting for.
+ * Check the comments in process.c for how this works.
+ */
+
+ _IceSavedReplyWait *saved_reply_waits;
+
+
+ /*
+ * We keep track of all Pings sent from the client. When the Ping reply
+ * arrives, we remove it from the list.
+ */
+
+ _IcePingWait *ping_waits;
+
+
+ /*
+ * Some state for a client doing a Connection/Protocol Setup
+ */
+
+ _IceConnectToYouInfo *connect_to_you;
+ _IceProtoSetupToYouInfo *protosetup_to_you;
+
+
+ /*
+ * Some state for a client receiving a Connection/Protocol Setup
+ */
+
+ _IceConnectToMeInfo *connect_to_me;
+ _IceProtoSetupToMeInfo *protosetup_to_me;
+
+};
+
+#endif /* _ICECONN_H_ */
diff --git a/lib/libICE/include/X11/ICE/ICElib.h b/lib/libICE/include/X11/ICE/ICElib.h
new file mode 100644
index 000000000..eb7a3aa32
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICElib.h
@@ -0,0 +1,433 @@
+/* $Xorg: ICElib.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+/* $XFree86: xc/lib/ICE/ICElib.h,v 3.4 2001/12/14 19:53:35 dawes Exp $ */
+
+#ifndef _ICELIB_H_
+#define _ICELIB_H_
+
+#include <X11/ICE/ICE.h>
+#include <X11/Xfuncproto.h>
+
+#define Bool int
+#define Status int
+#define True 1
+#define False 0
+
+typedef void *IcePointer;
+
+typedef enum {
+ IcePoAuthHaveReply,
+ IcePoAuthRejected,
+ IcePoAuthFailed,
+ IcePoAuthDoneCleanup
+} IcePoAuthStatus;
+
+typedef enum {
+ IcePaAuthContinue,
+ IcePaAuthAccepted,
+ IcePaAuthRejected,
+ IcePaAuthFailed
+} IcePaAuthStatus;
+
+typedef enum {
+ IceConnectPending,
+ IceConnectAccepted,
+ IceConnectRejected,
+ IceConnectIOError
+} IceConnectStatus;
+
+typedef enum {
+ IceProtocolSetupSuccess,
+ IceProtocolSetupFailure,
+ IceProtocolSetupIOError,
+ IceProtocolAlreadyActive
+} IceProtocolSetupStatus;
+
+typedef enum {
+ IceAcceptSuccess,
+ IceAcceptFailure,
+ IceAcceptBadMalloc
+} IceAcceptStatus;
+
+typedef enum {
+ IceClosedNow,
+ IceClosedASAP,
+ IceConnectionInUse,
+ IceStartedShutdownNegotiation
+} IceCloseStatus;
+
+typedef enum {
+ IceProcessMessagesSuccess,
+ IceProcessMessagesIOError,
+ IceProcessMessagesConnectionClosed
+} IceProcessMessagesStatus;
+
+typedef struct {
+ unsigned long sequence_of_request;
+ int major_opcode_of_request;
+ int minor_opcode_of_request;
+ IcePointer reply;
+} IceReplyWaitInfo;
+
+typedef struct _IceConn *IceConn;
+typedef struct _IceListenObj *IceListenObj;
+
+typedef void (*IceWatchProc) (
+ IceConn /* iceConn */,
+ IcePointer /* clientData */,
+ Bool /* opening */,
+ IcePointer * /* watchData */
+);
+
+typedef void (*IcePoProcessMsgProc) (
+ IceConn /* iceConn */,
+ IcePointer /* clientData */,
+ int /* opcode */,
+ unsigned long /* length */,
+ Bool /* swap */,
+ IceReplyWaitInfo * /* replyWait */,
+ Bool * /* replyReadyRet */
+);
+
+typedef void (*IcePaProcessMsgProc) (
+ IceConn /* iceConn */,
+ IcePointer /* clientData */,
+ int /* opcode */,
+ unsigned long /* length */,
+ Bool /* swap */
+);
+
+typedef struct {
+ int major_version;
+ int minor_version;
+ IcePoProcessMsgProc process_msg_proc;
+} IcePoVersionRec;
+
+typedef struct {
+ int major_version;
+ int minor_version;
+ IcePaProcessMsgProc process_msg_proc;
+} IcePaVersionRec;
+
+typedef IcePoAuthStatus (*IcePoAuthProc) (
+ IceConn /* iceConn */,
+ IcePointer * /* authStatePtr */,
+ Bool /* cleanUp */,
+ Bool /* swap */,
+ int /* authDataLen */,
+ IcePointer /* authData */,
+ int * /* replyDataLenRet */,
+ IcePointer * /* replyDataRet */,
+ char ** /* errorStringRet */
+);
+
+typedef IcePaAuthStatus (*IcePaAuthProc) (
+ IceConn /* iceConn */,
+ IcePointer * /* authStatePtr */,
+ Bool /* swap */,
+ int /* authDataLen */,
+ IcePointer /* authData */,
+ int * /* replyDataLenRet */,
+ IcePointer * /* replyDataRet */,
+ char ** /* errorStringRet */
+);
+
+typedef Bool (*IceHostBasedAuthProc) (
+ char * /* hostName */
+);
+
+typedef Status (*IceProtocolSetupProc) (
+ IceConn /* iceConn */,
+ int /* majorVersion */,
+ int /* minorVersion */,
+ char * /* vendor */,
+ char * /* release */,
+ IcePointer * /* clientDataRet */,
+ char ** /* failureReasonRet */
+);
+
+typedef void (*IceProtocolActivateProc) (
+ IceConn /* iceConn */,
+ IcePointer /* clientData */
+);
+
+typedef void (*IceIOErrorProc) (
+ IceConn /* iceConn */
+);
+
+typedef void (*IcePingReplyProc) (
+ IceConn /* iceConn */,
+ IcePointer /* clientData */
+);
+
+typedef void (*IceErrorHandler) (
+ IceConn /* iceConn */,
+ Bool /* swap */,
+ int /* offendingMinorOpcode */,
+ unsigned long /* offendingSequence */,
+ int /* errorClass */,
+ int /* severity */,
+ IcePointer /* values */
+);
+
+typedef void (*IceIOErrorHandler) (
+ IceConn /* iceConn */
+);
+
+
+/*
+ * Function prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern int IceRegisterForProtocolSetup (
+ char * /* protocolName */,
+ char * /* vendor */,
+ char * /* release */,
+ int /* versionCount */,
+ IcePoVersionRec * /* versionRecs */,
+ int /* authCount */,
+ char ** /* authNames */,
+ IcePoAuthProc * /* authProcs */,
+ IceIOErrorProc /* IOErrorProc */
+);
+
+extern int IceRegisterForProtocolReply (
+ char * /* protocolName */,
+ char * /* vendor */,
+ char * /* release */,
+ int /* versionCount */,
+ IcePaVersionRec * /* versionRecs */,
+ int /* authCount */,
+ char ** /* authNames */,
+ IcePaAuthProc * /* authProcs */,
+ IceHostBasedAuthProc /* hostBasedAuthProc */,
+ IceProtocolSetupProc /* protocolSetupProc */,
+ IceProtocolActivateProc /* protocolActivateProc */,
+ IceIOErrorProc /* IOErrorProc */
+);
+
+extern IceConn IceOpenConnection (
+ char * /* networkIdsList */,
+ IcePointer /* context */,
+ Bool /* mustAuthenticate */,
+ int /* majorOpcodeCheck */,
+ int /* errorLength */,
+ char * /* errorStringRet */
+);
+
+extern IcePointer IceGetConnectionContext (
+ IceConn /* iceConn */
+);
+
+extern Status IceListenForConnections (
+ int * /* countRet */,
+ IceListenObj ** /* listenObjsRet */,
+ int /* errorLength */,
+ char * /* errorStringRet */
+);
+
+extern Status IceListenForWellKnownConnections (
+ char * /* port */,
+ int * /* countRet */,
+ IceListenObj ** /* listenObjsRet */,
+ int /* errorLength */,
+ char * /* errorStringRet */
+);
+
+extern int IceGetListenConnectionNumber (
+ IceListenObj /* listenObj */
+);
+
+extern char *IceGetListenConnectionString (
+ IceListenObj /* listenObj */
+);
+
+extern char *IceComposeNetworkIdList (
+ int /* count */,
+ IceListenObj * /* listenObjs */
+);
+
+extern void IceFreeListenObjs (
+ int /* count */,
+ IceListenObj * /* listenObjs */
+);
+
+extern void IceSetHostBasedAuthProc (
+ IceListenObj /* listenObj */,
+ IceHostBasedAuthProc /* hostBasedAuthProc */
+);
+
+extern IceConn IceAcceptConnection (
+ IceListenObj /* listenObj */,
+ IceAcceptStatus * /* statusRet */
+);
+
+extern void IceSetShutdownNegotiation (
+ IceConn /* iceConn */,
+ Bool /* negotiate */
+);
+
+extern Bool IceCheckShutdownNegotiation (
+ IceConn /* iceConn */
+);
+
+extern IceCloseStatus IceCloseConnection (
+ IceConn /* iceConn */
+);
+
+extern Status IceAddConnectionWatch (
+ IceWatchProc /* watchProc */,
+ IcePointer /* clientData */
+);
+
+extern void IceRemoveConnectionWatch (
+ IceWatchProc /* watchProc */,
+ IcePointer /* clientData */
+);
+
+extern IceProtocolSetupStatus IceProtocolSetup (
+ IceConn /* iceConn */,
+ int /* myOpcode */,
+ IcePointer /* clientData */,
+ Bool /* mustAuthenticate */,
+ int * /* majorVersionRet */,
+ int * /* minorVersionRet */,
+ char ** /* vendorRet */,
+ char ** /* releaseRet */,
+ int /* errorLength */,
+ char * /* errorStringRet */
+);
+
+extern Status IceProtocolShutdown (
+ IceConn /* iceConn */,
+ int /* majorOpcode */
+);
+
+extern IceProcessMessagesStatus IceProcessMessages (
+ IceConn /* iceConn */,
+ IceReplyWaitInfo * /* replyWait */,
+ Bool * /* replyReadyRet */
+);
+
+extern Status IcePing (
+ IceConn /* iceConn */,
+ IcePingReplyProc /* pingReplyProc */,
+ IcePointer /* clientData */
+);
+
+extern char *IceAllocScratch (
+ IceConn /* iceConn */,
+ unsigned long /* size */
+);
+
+extern int IceFlush (
+ IceConn /* iceConn */
+);
+
+extern int IceGetOutBufSize (
+ IceConn /* iceConn */
+);
+
+extern int IceGetInBufSize (
+ IceConn /* iceConn */
+);
+
+extern IceConnectStatus IceConnectionStatus (
+ IceConn /* iceConn */
+);
+
+extern char *IceVendor (
+ IceConn /* iceConn */
+);
+
+extern char *IceRelease (
+ IceConn /* iceConn */
+);
+
+extern int IceProtocolVersion (
+ IceConn /* iceConn */
+);
+
+extern int IceProtocolRevision (
+ IceConn /* iceConn */
+);
+
+extern int IceConnectionNumber (
+ IceConn /* iceConn */
+);
+
+extern char *IceConnectionString (
+ IceConn /* iceConn */
+);
+
+extern unsigned long IceLastSentSequenceNumber (
+ IceConn /* iceConn */
+);
+
+extern unsigned long IceLastReceivedSequenceNumber (
+ IceConn /* iceConn */
+);
+
+extern Bool IceSwapping (
+ IceConn /* iceConn */
+);
+
+extern IceErrorHandler IceSetErrorHandler (
+ IceErrorHandler /* handler */
+);
+
+extern IceIOErrorHandler IceSetIOErrorHandler (
+ IceIOErrorHandler /* handler */
+);
+
+extern char *IceGetPeerName (
+ IceConn /* iceConn */
+);
+
+/*
+ * Multithread Routines
+ */
+
+extern Status IceInitThreads (
+ void
+);
+
+extern void IceAppLockConn (
+ IceConn /* iceConn */
+);
+
+extern void IceAppUnlockConn (
+ IceConn /* iceConn */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _ICELIB_H_ */
diff --git a/lib/libICE/include/X11/ICE/ICEmsg.h b/lib/libICE/include/X11/ICE/ICEmsg.h
new file mode 100644
index 000000000..ddae02784
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICEmsg.h
@@ -0,0 +1,295 @@
+/* $Xorg: ICEmsg.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+/* $XFree86: xc/lib/ICE/ICEmsg.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */
+
+#ifndef _ICEMSG_H_
+#define _ICEMSG_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/ICE/ICEconn.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Function prototypes for internal ICElib functions
+ */
+
+extern Status _IceRead (
+ IceConn /* iceConn */,
+ unsigned long /* nbytes */,
+ char * /* ptr */
+);
+
+extern void _IceReadSkip (
+ IceConn /* iceConn */,
+ unsigned long /* nbytes */
+);
+
+extern void _IceWrite (
+ IceConn /* iceConn */,
+ unsigned long /* nbytes */,
+ char * /* ptr */
+);
+
+
+extern void _IceErrorBadMinor (
+ IceConn /* iceConn */,
+ int /* majorOpcode */,
+ int /* offendingMinor */,
+ int /* severity */
+);
+
+extern void _IceErrorBadState (
+ IceConn /* iceConn */,
+ int /* majorOpcode */,
+ int /* offendingMinor */,
+ int /* severity */
+);
+
+extern void _IceErrorBadLength (
+ IceConn /* iceConn */,
+ int /* majorOpcode */,
+ int /* offendingMinor */,
+ int /* severity */
+);
+
+extern void _IceErrorBadValue (
+ IceConn /* iceConn */,
+ int /* majorOpcode */,
+ int /* offendingMinor */,
+ int /* offset */,
+ int /* length */,
+ IcePointer /* value */
+);
+
+
+/*
+ * Macro to check if IO operations are valid on an ICE connection.
+ */
+
+#define IceValidIO(_iceConn) _iceConn->io_ok
+
+
+/*
+ * Macros for writing messages.
+ */
+
+#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \
+ if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \
+ IceFlush (_iceConn); \
+ _pMsg = (_msgType *) _iceConn->outbufptr; \
+ _pMsg->majorOpcode = _major; \
+ _pMsg->minorOpcode = _minor; \
+ _pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \
+ _iceConn->outbufptr += _headerSize; \
+ _iceConn->send_sequence++
+
+#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \
+ if ((_iceConn->outbufptr + \
+ _headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \
+ IceFlush (_iceConn); \
+ _pMsg = (_msgType *) _iceConn->outbufptr; \
+ if ((_iceConn->outbufptr + \
+ _headerSize + ((_extra) << 3)) <= _iceConn->outbufmax) \
+ _pData = (char *) _pMsg + _headerSize; \
+ else \
+ _pData = NULL; \
+ _pMsg->majorOpcode = _major; \
+ _pMsg->minorOpcode = _minor; \
+ _pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \
+ _iceConn->outbufptr += (_headerSize + ((_extra) << 3)); \
+ _iceConn->send_sequence++
+
+#define IceSimpleMessage(_iceConn, _major, _minor) \
+{ \
+ iceMsg *_pMsg; \
+ IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \
+}
+
+#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \
+{ \
+ iceErrorMsg *_pMsg; \
+\
+ IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \
+ SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \
+ _pMsg->length += (_dataLength); \
+ _pMsg->offendingMinorOpcode = _offendingMinorOpcode; \
+ _pMsg->severity = _severity; \
+ _pMsg->offendingSequenceNum = _offendingSequenceNum; \
+ _pMsg->errorClass = _errorClass; \
+}
+
+
+/*
+ * Write data into the ICE output buffer.
+ */
+
+#define IceWriteData(_iceConn, _bytes, _data) \
+{ \
+ if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
+ { \
+ IceFlush (_iceConn); \
+ _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
+ } \
+ else \
+ { \
+ memcpy (_iceConn->outbufptr, _data, _bytes); \
+ _iceConn->outbufptr += (_bytes); \
+ } \
+}
+
+#ifndef WORD64
+
+#define IceWriteData16(_iceConn, _bytes, _data) \
+ IceWriteData (_iceConn, _bytes, (char *) _data)
+
+#define IceWriteData32(_iceConn, _bytes, _data) \
+ IceWriteData (_iceConn, _bytes, (char *) _data)
+
+#else /* WORD64 */
+
+/* IceWriteData16 and IceWriteData32 defined in misc.c for WORD64 */
+
+#endif /* WORD64 */
+
+
+/*
+ * The IceSendData macro bypasses copying the data to the
+ * ICE connection buffer and sends the data directly. If necessary,
+ * the ICE connection buffer is first flushed.
+ */
+
+#define IceSendData(_iceConn, _bytes, _data) \
+{ \
+ if (_iceConn->outbufptr > _iceConn->outbuf) \
+ IceFlush (_iceConn); \
+ _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
+}
+
+
+/*
+ * Write pad bytes. Used to force 32 or 64 bit alignment.
+ * A maxium of 7 pad bytes can be specified.
+ */
+
+#define IceWritePad(_iceConn, _bytes) \
+{ \
+ if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
+ { \
+ char _dummy[7]; \
+ IceFlush (_iceConn); \
+ _IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \
+ } \
+ else \
+ { \
+ _iceConn->outbufptr += (_bytes); \
+ } \
+}
+
+
+/*
+ * Macros for reading messages.
+ */
+
+#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\
+{ \
+ unsigned long _bytes; \
+ IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \
+ _bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \
+ if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \
+ { \
+ _IceRead (_iceConn, _bytes, _iceConn->inbufptr); \
+ _pData = _iceConn->inbufptr; \
+ _iceConn->inbufptr += _bytes; \
+ } \
+ else \
+ { \
+ _pData = (char *) malloc ((unsigned) _bytes); \
+ if (_pData) \
+ _IceRead (_iceConn, _bytes, _pData); \
+ else \
+ _IceReadSkip (_iceConn, _bytes); \
+ } \
+}
+
+#define IceDisposeCompleteMessage(_iceConn, _pData) \
+ if ((char *) _pData < _iceConn->inbuf || \
+ (char *) _pData >= _iceConn->inbufmax) \
+ free ((char *) _pData);
+
+
+#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \
+ _pMsg = (_msgType *) (_iceConn->inbuf);
+
+#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \
+{ \
+ _IceRead (_iceConn, \
+ (unsigned long) (_headerSize - SIZEOF (iceMsg)), \
+ _iceConn->inbufptr); \
+ _pMsg = (_msgType *) (_iceConn->inbuf); \
+ _iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \
+}
+
+#define IceReadData(_iceConn, _bytes, _pData) \
+ _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+
+#ifndef WORD64
+
+#define IceReadData16(_iceConn, _swap, _bytes, _pData) \
+{ \
+ _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+}
+
+#define IceReadData32(_iceConn, _swap, _bytes, _pData) \
+{ \
+ _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
+}
+
+#else /* WORD64 */
+
+/* IceReadData16 and IceReadData32 defined in misc.c for WORD64 */
+
+#endif /* WORD64 */
+
+
+/*
+ * Read pad bytes (for 32 or 64 bit alignment).
+ * A maxium of 7 pad bytes can be specified.
+ */
+
+#define IceReadPad(_iceConn, _bytes) \
+{ \
+ char _dummy[7]; \
+ _IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \
+}
+
+_XFUNCPROTOEND
+
+#endif /* _ICEMSG_H_ */
diff --git a/lib/libICE/include/X11/ICE/ICEproto.h b/lib/libICE/include/X11/ICE/ICEproto.h
new file mode 100644
index 000000000..9ca7c44ce
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICEproto.h
@@ -0,0 +1,176 @@
+/* $Xorg: ICEproto.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+
+#ifndef _ICEPROTO_H_
+#define _ICEPROTO_H_
+
+#include <X11/Xmd.h>
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 data[2];
+ CARD32 length B32;
+} iceMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD16 errorClass B16;
+ CARD32 length B32;
+ CARD8 offendingMinorOpcode;
+ CARD8 severity;
+ CARD16 unused B16;
+ CARD32 offendingSequenceNum B32;
+ /* n varying values */
+ /* p p = pad (n, 8) */
+} iceErrorMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 byteOrder;
+ CARD8 unused;
+ CARD32 length B32;
+} iceByteOrderMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 versionCount;
+ CARD8 authCount;
+ CARD32 length B32;
+ CARD8 mustAuthenticate;
+ CARD8 unused[7];
+ /* i STRING vendor */
+ /* j STRING release */
+ /* k LIST of STRING authentication-protocol-names */
+ /* m LIST of VERSION version-list */
+ /* p p = pad (i+j+k+m, 8) */
+} iceConnectionSetupMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 authIndex;
+ CARD8 unused1;
+ CARD32 length B32;
+ CARD16 authDataLength B16;
+ CARD8 unused2[6];
+ /* n varying data */
+ /* p p = pad (n, 8) */
+} iceAuthRequiredMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 unused1[2];
+ CARD32 length B32;
+ CARD16 authDataLength B16;
+ CARD8 unused2[6];
+ /* n varying data */
+ /* p p = pad (n, 8) */
+} iceAuthReplyMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 unused1[2];
+ CARD32 length B32;
+ CARD16 authDataLength B16;
+ CARD8 unused2[6];
+ /* n varying data */
+ /* p p = pad (n, 8) */
+} iceAuthNextPhaseMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 versionIndex;
+ CARD8 unused;
+ CARD32 length B32;
+ /* i STRING vendor */
+ /* j STRING release */
+ /* p p = pad (i+j, 8) */
+} iceConnectionReplyMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 protocolOpcode;
+ CARD8 mustAuthenticate;
+ CARD32 length B32;
+ CARD8 versionCount;
+ CARD8 authCount;
+ CARD8 unused[6];
+ /* i STRING protocol-name */
+ /* j STRING vendor */
+ /* k STRING release */
+ /* m LIST of STRING authentication-protocol-names */
+ /* n LIST of VERSION version-list */
+ /* p p = pad (i+j+k+m+n, 8) */
+} iceProtocolSetupMsg;
+
+typedef struct {
+ CARD8 majorOpcode;
+ CARD8 minorOpcode;
+ CARD8 versionIndex;
+ CARD8 protocolOpcode;
+ CARD32 length B32;
+ /* i STRING vendor */
+ /* j STRING release */
+ /* p p = pad (i+j, 8) */
+} iceProtocolReplyMsg;
+
+typedef iceMsg icePingMsg;
+typedef iceMsg icePingReplyMsg;
+typedef iceMsg iceWantToCloseMsg;
+typedef iceMsg iceNoCloseMsg;
+
+
+/*
+ * SIZEOF values. These better be multiples of 8.
+ */
+
+#define sz_iceMsg 8
+#define sz_iceErrorMsg 16
+#define sz_iceByteOrderMsg 8
+#define sz_iceConnectionSetupMsg 16
+#define sz_iceAuthRequiredMsg 16
+#define sz_iceAuthReplyMsg 16
+#define sz_iceAuthNextPhaseMsg 16
+#define sz_iceConnectionReplyMsg 8
+#define sz_iceProtocolSetupMsg 16
+#define sz_iceProtocolReplyMsg 8
+#define sz_icePingMsg 8
+#define sz_icePingReplyMsg 8
+#define sz_iceWantToCloseMsg 8
+#define sz_iceNoCloseMsg 8
+
+#endif /* _ICEPROTO_H_ */
diff --git a/lib/libICE/include/X11/ICE/ICEutil.h b/lib/libICE/include/X11/ICE/ICEutil.h
new file mode 100644
index 000000000..8651d94eb
--- /dev/null
+++ b/lib/libICE/include/X11/ICE/ICEutil.h
@@ -0,0 +1,126 @@
+/* $Xorg: ICEutil.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
+/******************************************************************************
+
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Ralph Mor, X Consortium
+******************************************************************************/
+/* $XFree86: xc/lib/ICE/ICEutil.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */
+
+#ifndef _ICEUTIL_H_
+#define _ICEUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <stdio.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Data structure for entry in ICE authority file
+ */
+
+typedef struct {
+ char *protocol_name;
+ unsigned short protocol_data_length;
+ char *protocol_data;
+ char *network_id;
+ char *auth_name;
+ unsigned short auth_data_length;
+ char *auth_data;
+} IceAuthFileEntry;
+
+
+/*
+ * Authentication data maintained in memory.
+ */
+
+typedef struct {
+ char *protocol_name;
+ char *network_id;
+ char *auth_name;
+ unsigned short auth_data_length;
+ char *auth_data;
+} IceAuthDataEntry;
+
+
+/*
+ * Return values from IceLockAuthFile
+ */
+
+#define IceAuthLockSuccess 0 /* lock succeeded */
+#define IceAuthLockError 1 /* lock unexpectely failed, check errno */
+#define IceAuthLockTimeout 2 /* lock failed, timeouts expired */
+
+
+/*
+ * Function Prototypes
+ */
+
+extern char *IceAuthFileName (
+ void
+);
+
+extern int IceLockAuthFile (
+ char * /* file_name */,
+ int /* retries */,
+ int /* timeout */,
+ long /* dead */
+);
+
+extern void IceUnlockAuthFile (
+ char * /* file_name */
+);
+
+extern IceAuthFileEntry *IceReadAuthFileEntry (
+ FILE * /* auth_file */
+);
+
+extern void IceFreeAuthFileEntry (
+ IceAuthFileEntry * /* auth */
+);
+
+extern Status IceWriteAuthFileEntry (
+ FILE * /* auth_file */,
+ IceAuthFileEntry * /* auth */
+);
+
+extern IceAuthFileEntry *IceGetAuthFileEntry (
+ char * /* protocol_name */,
+ char * /* network_id */,
+ char * /* auth_name */
+);
+
+extern char *IceGenerateMagicCookie (
+ int /* len */
+);
+
+extern void IceSetPaAuthData (
+ int /* numEntries */,
+ IceAuthDataEntry * /* entries */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _ICEUTIL_H_ */