summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 15:54:38 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 15:54:38 +0000
commitd1eb0ee78fbb0c109f9fa8e1bc05907608fc4299 (patch)
tree0c5074aceb601091d42e095e30ddd2b6cf48c0ba
R6.6 is the Xorg base-lineXORG-MAINXORG-STABLE
-rw-r--r--A8Eq.c47
-rw-r--r--AA16.c48
-rw-r--r--AA32.c48
-rw-r--r--AA8.c48
-rw-r--r--Alloc.c61
-rw-r--r--AofA8.c48
-rw-r--r--CA8.c46
-rw-r--r--CmpKey.c44
-rw-r--r--DA16.c42
-rw-r--r--DA32.c42
-rw-r--r--DA8.c42
-rw-r--r--DAofA8.c46
-rw-r--r--DecKey.c45
-rw-r--r--Fill.c93
-rw-r--r--Flush.c75
-rw-r--r--GenKey.c70
-rw-r--r--IncKey.c45
-rw-r--r--RA16.c69
-rw-r--r--RA32.c69
-rw-r--r--RA8.c69
-rw-r--r--RAofA8.c72
-rw-r--r--RC16.c49
-rw-r--r--RC32.c53
-rw-r--r--RC8.c44
-rw-r--r--RHead.c45
-rw-r--r--RR.c40
-rw-r--r--RaA16.c48
-rw-r--r--RaA32.c48
-rw-r--r--RaA8.c48
-rw-r--r--RaAoA8.c48
-rw-r--r--Unwrap.c89
-rw-r--r--WA16.c48
-rw-r--r--WA32.c48
-rw-r--r--WA8.c48
-rw-r--r--WAofA8.c48
-rw-r--r--WC16.c45
-rw-r--r--WC32.c49
-rw-r--r--WC8.c44
-rw-r--r--Whead.c59
-rw-r--r--Wrap.c127
-rw-r--r--Wrap.h10
-rw-r--r--include/X11/Xdmcp.h141
42 files changed, 2348 insertions, 0 deletions
diff --git a/A8Eq.c b/A8Eq.c
new file mode 100644
index 0000000..dbb33c8
--- /dev/null
+++ b/A8Eq.c
@@ -0,0 +1,47 @@
+/*
+ * $Xorg: A8Eq.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpARRAY8Equal (array1, array2)
+ ARRAY8Ptr array1, array2;
+{
+ int i;
+
+ if (array1->length != array2->length)
+ return FALSE;
+ for (i = 0; i < (int)array1->length; i++)
+ if (array1->data[i] != array2->data[i])
+ return FALSE;
+ return TRUE;
+}
diff --git a/AA16.c b/AA16.c
new file mode 100644
index 0000000..3558985
--- /dev/null
+++ b/AA16.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: AA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpAllocARRAY16 (array, length)
+ ARRAY16Ptr array;
+ int length;
+{
+ CARD16Ptr newData;
+
+ newData = (CARD16Ptr) Xalloc (length * sizeof (CARD16));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/AA32.c b/AA32.c
new file mode 100644
index 0000000..5ed7087
--- /dev/null
+++ b/AA32.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: AA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpAllocARRAY32 (array, length)
+ ARRAY32Ptr array;
+ int length;
+{
+ CARD32Ptr newData;
+
+ newData = (CARD32Ptr) Xalloc (length * sizeof (CARD32));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/AA8.c b/AA8.c
new file mode 100644
index 0000000..1292dd5
--- /dev/null
+++ b/AA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: AA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpAllocARRAY8 (array, length)
+ ARRAY8Ptr array;
+ int length;
+{
+ CARD8Ptr newData;
+
+ newData = (CARD8Ptr) Xalloc (length * sizeof (CARD8));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/Alloc.c b/Alloc.c
new file mode 100644
index 0000000..761efc5
--- /dev/null
+++ b/Alloc.c
@@ -0,0 +1,61 @@
+/*
+ * $Xorg: Alloc.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+/* stubs for use when Xalloc, Xrealloc and Xfree are not defined */
+
+extern char *malloc (), *realloc ();
+
+long *
+Xalloc (amount)
+ unsigned amount;
+{
+ if (amount == 0)
+ amount = 1;
+ return (long *) malloc (amount);
+}
+
+long *
+Xrealloc (old, amount)
+ long *old;
+ unsigned amount;
+{
+ if (amount == 0)
+ amount = 1;
+ if (!old)
+ return (long *) malloc (amount);
+ return (long *) realloc ((char *) old, amount);
+}
+
+void
+Xfree (old)
+ long *old;
+{
+ if (old)
+ free ((char *) old);
+}
diff --git a/AofA8.c b/AofA8.c
new file mode 100644
index 0000000..e02029c
--- /dev/null
+++ b/AofA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: AofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpAllocARRAYofARRAY8 (array, length)
+ ARRAYofARRAY8Ptr array;
+ int length;
+{
+ ARRAY8Ptr newData;
+
+ newData = (ARRAY8Ptr) Xalloc (length * sizeof (ARRAY8));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/CA8.c b/CA8.c
new file mode 100644
index 0000000..627e824
--- /dev/null
+++ b/CA8.c
@@ -0,0 +1,46 @@
+/*
+ * $Xorg: CA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+#include <X11/Xfuncs.h>
+
+int
+XdmcpCopyARRAY8 (src, dst)
+ ARRAY8Ptr src, dst;
+{
+ dst->length = src->length;
+ dst->data = (CARD8 *) Xalloc (dst->length * sizeof (CARD8));
+ if (!dst->data)
+ return FALSE;
+ memmove (dst->data, src->data, src->length * sizeof (CARD8));
+ return TRUE;
+}
diff --git a/CmpKey.c b/CmpKey.c
new file mode 100644
index 0000000..6d7692b
--- /dev/null
+++ b/CmpKey.c
@@ -0,0 +1,44 @@
+/*
+ * $Xorg: CmpKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+XdmcpCompareKeys (a, b)
+ XdmAuthKeyPtr a, b;
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ if (a->data[i] != b->data[i])
+ return FALSE;
+ return TRUE;
+}
diff --git a/DA16.c b/DA16.c
new file mode 100644
index 0000000..0124393
--- /dev/null
+++ b/DA16.c
@@ -0,0 +1,42 @@
+/*
+ * $Xorg: DA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpDisposeARRAY16 (array)
+ ARRAY16Ptr array;
+{
+ if (array->data != NULL) Xfree (array->data);
+ array->length = 0;
+ array->data = NULL;
+}
diff --git a/DA32.c b/DA32.c
new file mode 100644
index 0000000..e27842b
--- /dev/null
+++ b/DA32.c
@@ -0,0 +1,42 @@
+/*
+ * $Xorg: DA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpDisposeARRAY32 (array)
+ ARRAY32Ptr array;
+{
+ if (array->data != NULL) Xfree (array->data);
+ array->length = 0;
+ array->data = NULL;
+}
diff --git a/DA8.c b/DA8.c
new file mode 100644
index 0000000..a808d9a
--- /dev/null
+++ b/DA8.c
@@ -0,0 +1,42 @@
+/*
+ * $Xorg: DA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpDisposeARRAY8 (array)
+ ARRAY8Ptr array;
+{
+ if (array->data != NULL) Xfree (array->data);
+ array->length = 0;
+ array->data = NULL;
+}
diff --git a/DAofA8.c b/DAofA8.c
new file mode 100644
index 0000000..0e818a3
--- /dev/null
+++ b/DAofA8.c
@@ -0,0 +1,46 @@
+/*
+ * $Xorg: DAofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpDisposeARRAYofARRAY8 (array)
+ ARRAYofARRAY8Ptr array;
+{
+ int i;
+
+ for (i = 0; i < (int)array->length; i++)
+ XdmcpDisposeARRAY8 (&array->data[i]);
+ if (array->data != NULL) Xfree (array->data);
+ array->length = 0;
+ array->data = NULL;
+}
diff --git a/DecKey.c b/DecKey.c
new file mode 100644
index 0000000..781df51
--- /dev/null
+++ b/DecKey.c
@@ -0,0 +1,45 @@
+/*
+ * $Xorg: DecKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpDecrementKey (key)
+ XdmAuthKeyPtr key;
+{
+ int i;
+
+ i = 7;
+ while (key->data[i]-- == 0)
+ if (--i < 0)
+ break;
+}
diff --git a/Fill.c b/Fill.c
new file mode 100644
index 0000000..b41cdf5
--- /dev/null
+++ b/Fill.c
@@ -0,0 +1,93 @@
+/*
+ * $Xorg: Fill.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#ifdef WIN32
+#define _WILLWINSOCK_
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+#ifdef STREAMSCONN
+#include <tiuser.h>
+#else
+#ifdef WIN32
+#include <X11/Xwinsock.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
+
+int
+XdmcpFill (fd, buffer, from, fromlen)
+ int fd;
+ XdmcpBufferPtr buffer;
+ XdmcpNetaddr from; /* return */
+ int *fromlen; /* return */
+{
+ BYTE *newBuf;
+#ifdef STREAMSCONN
+ struct t_unitdata dataunit;
+ int gotallflag, result;
+#endif
+
+ if (buffer->size < XDM_MAX_MSGLEN)
+ {
+ newBuf = (BYTE *) Xalloc (XDM_MAX_MSGLEN);
+ if (newBuf)
+ {
+ Xfree (buffer->data);
+ buffer->data = newBuf;
+ buffer->size = XDM_MAX_MSGLEN;
+ }
+ }
+ buffer->pointer = 0;
+#ifdef STREAMSCONN
+ dataunit.addr.buf = from;
+ dataunit.addr.maxlen = *fromlen;
+ dataunit.opt.maxlen = 0; /* don't care to know about options */
+ dataunit.udata.buf = (char *)buffer->data;
+ dataunit.udata.maxlen = buffer->size;
+ result = t_rcvudata (fd, &dataunit, &gotallflag);
+ if (result < 0) {
+ return FALSE;
+ }
+ buffer->count = dataunit.udata.len;
+ *fromlen = dataunit.addr.len;
+#else
+ buffer->count = recvfrom (fd, (char*)buffer->data, buffer->size, 0,
+ (struct sockaddr *)from, fromlen);
+#endif
+ if (buffer->count < 6) {
+ buffer->count = 0;
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/Flush.c b/Flush.c
new file mode 100644
index 0000000..fac3255
--- /dev/null
+++ b/Flush.c
@@ -0,0 +1,75 @@
+/*
+ * $Xorg: Flush.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#ifdef WIN32
+#define _WILLWINSOCK_
+#endif
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+#ifdef STREAMSCONN
+#include <tiuser.h>
+#else
+#ifdef WIN32
+#include <X11/Xwinsock.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
+
+int
+XdmcpFlush (fd, buffer, to, tolen)
+ int fd;
+ XdmcpBufferPtr buffer;
+ XdmcpNetaddr to;
+ int tolen;
+{
+ int result;
+
+#ifdef STREAMSCONN
+ struct t_unitdata dataunit;
+
+ dataunit.addr.buf = to;
+ dataunit.addr.len = tolen;
+ dataunit.opt.len = 0; /* default options */
+ dataunit.udata.buf = (char *)buffer->data;
+ dataunit.udata.len = buffer->pointer;
+ result = t_sndudata(fd, &dataunit);
+ if (result < 0)
+ return FALSE;
+#else
+ result = sendto (fd, (char *)buffer->data, buffer->pointer, 0,
+ (struct sockaddr *)to, tolen);
+ if (result != buffer->pointer)
+ return FALSE;
+#endif
+ return TRUE;
+}
diff --git a/GenKey.c b/GenKey.c
new file mode 100644
index 0000000..783ed92
--- /dev/null
+++ b/GenKey.c
@@ -0,0 +1,70 @@
+/*
+ * $Xorg: GenKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+static getbits (data, dst)
+ long data;
+ unsigned char *dst;
+{
+ dst[0] = (data ) & 0xff;
+ dst[1] = (data >> 8) & 0xff;
+ dst[2] = (data >> 16) & 0xff;
+ dst[3] = (data >> 24) & 0xff;
+}
+
+#ifdef X_NOT_STDC_ENV
+#define Time_t long
+extern Time_t time ();
+#else
+#define Time_t time_t
+#endif
+
+#if defined(SYSV) || defined(SVR4)
+#define srandom srand48
+#define random lrand48
+#endif
+
+long random();
+
+void
+XdmcpGenerateKey (key)
+ XdmAuthKeyPtr key;
+{
+ long lowbits, highbits;
+
+ srandom ((int)getpid() ^ time((Time_t *)0));
+ lowbits = random ();
+ highbits = random ();
+ getbits (lowbits, key->data);
+ getbits (highbits, key->data + 4);
+}
diff --git a/IncKey.c b/IncKey.c
new file mode 100644
index 0000000..c4382d9
--- /dev/null
+++ b/IncKey.c
@@ -0,0 +1,45 @@
+/*
+ * $Xorg: IncKey.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+void
+XdmcpIncrementKey (key)
+ XdmAuthKeyPtr key;
+{
+ int i;
+
+ i = 7;
+ while (++key->data[i] == 0)
+ if (--i < 0)
+ break;
+}
diff --git a/RA16.c b/RA16.c
new file mode 100644
index 0000000..3453ce4
--- /dev/null
+++ b/RA16.c
@@ -0,0 +1,69 @@
+/*
+ * $Xorg: RA16.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadARRAY16 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY16Ptr array;
+{
+ int i;
+
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+
+ /* Must set array->data to NULL to guarantee safe call of
+ * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data));
+ * see defect 7329 */
+ array->data = 0;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD16 *) Xalloc (array->length * sizeof (CARD16));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD16 (buffer, &array->data[i]))
+ {
+ Xfree (array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/RA32.c b/RA32.c
new file mode 100644
index 0000000..21c078c
--- /dev/null
+++ b/RA32.c
@@ -0,0 +1,69 @@
+/*
+ * $Xorg: RA32.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadARRAY32 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY32Ptr array;
+{
+ int i;
+
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+
+ /* Must set array->data to NULL to guarantee safe call of
+ * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data));
+ * see defect 7329 */
+ array->data = 0;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD32 *) Xalloc (array->length * sizeof (CARD32));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD32 (buffer, &array->data[i]))
+ {
+ Xfree (array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/RA8.c b/RA8.c
new file mode 100644
index 0000000..50a6d23
--- /dev/null
+++ b/RA8.c
@@ -0,0 +1,69 @@
+/*
+ * $Xorg: RA8.c,v 1.5 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadARRAY8 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY8Ptr array;
+{
+ int i;
+
+ if (!XdmcpReadCARD16 (buffer, &array->length)) {
+
+ /* Must set array->data to NULL to guarantee safe call of
+ * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data));
+ * see defect 7329 */
+ array->data = 0;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (CARD8 *) Xalloc (array->length * sizeof (CARD8));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadCARD8 (buffer, &array->data[i]))
+ {
+ Xfree (array->data);
+ array->data = NULL;
+ array->length = 0;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/RAofA8.c b/RAofA8.c
new file mode 100644
index 0000000..b4b2cea
--- /dev/null
+++ b/RAofA8.c
@@ -0,0 +1,72 @@
+/*
+ * $Xorg: RAofA8.c,v 1.6 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadARRAYofARRAY8 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAYofARRAY8Ptr array;
+{
+ int i;
+
+ if (!XdmcpReadCARD8 (buffer, &array->length)) {
+
+ /* Must set array->data to NULL to guarantee safe call of
+ * XdmcpDisposeARRAY*(array) (which calls Xfree(array->data));
+ * see defect 7329 */
+ array->data = 0;
+ return FALSE;
+ }
+ if (!array->length)
+ {
+ array->data = NULL;
+ return TRUE;
+ }
+ array->data = (ARRAY8 *) Xalloc (array->length * sizeof (ARRAY8));
+ if (!array->data)
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ {
+ if (!XdmcpReadARRAY8 (buffer, &array->data[i]))
+ {
+
+ /* All arrays allocated thus far in the loop must be freed
+ * if there is an error in the read.
+ * See Defect 7328 */
+ array->length = i;
+ XdmcpDisposeARRAYofARRAY8(array);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/RC16.c b/RC16.c
new file mode 100644
index 0000000..ff2604d
--- /dev/null
+++ b/RC16.c
@@ -0,0 +1,49 @@
+/*
+ * $Xorg: RC16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadCARD16 (buffer, valuep)
+ XdmcpBufferPtr buffer;
+ CARD16Ptr valuep;
+{
+ CARD8 high, low;
+
+ if (XdmcpReadCARD8 (buffer, &high) &&
+ XdmcpReadCARD8 (buffer, &low))
+ {
+ *valuep = (((CARD16) high) << 8) | ((CARD16) low);
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/RC32.c b/RC32.c
new file mode 100644
index 0000000..a865563
--- /dev/null
+++ b/RC32.c
@@ -0,0 +1,53 @@
+/*
+ * $Xorg: RC32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadCARD32 (buffer, valuep)
+ XdmcpBufferPtr buffer;
+ CARD32Ptr valuep;
+{
+ CARD8 byte0, byte1, byte2, byte3;
+ if (XdmcpReadCARD8 (buffer, &byte0) &&
+ XdmcpReadCARD8 (buffer, &byte1) &&
+ XdmcpReadCARD8 (buffer, &byte2) &&
+ XdmcpReadCARD8 (buffer, &byte3))
+ {
+ *valuep = (((CARD32) byte0) << 24) |
+ (((CARD32) byte1) << 16) |
+ (((CARD32) byte2) << 8) |
+ (((CARD32) byte3));
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/RC8.c b/RC8.c
new file mode 100644
index 0000000..7c3d11a
--- /dev/null
+++ b/RC8.c
@@ -0,0 +1,44 @@
+/*
+ * $Xorg: RC8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadCARD8 (buffer, valuep)
+ XdmcpBufferPtr buffer;
+ CARD8Ptr valuep;
+{
+ if (buffer->pointer >= buffer->count)
+ return FALSE;
+ *valuep = (CARD8) buffer->data[buffer->pointer++];
+ return TRUE;
+}
diff --git a/RHead.c b/RHead.c
new file mode 100644
index 0000000..b0af982
--- /dev/null
+++ b/RHead.c
@@ -0,0 +1,45 @@
+/*
+ * $Xorg: RHead.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadHeader (buffer, header)
+ XdmcpBufferPtr buffer;
+ XdmcpHeaderPtr header;
+{
+ if (XdmcpReadCARD16 (buffer, &header->version) &&
+ XdmcpReadCARD16 (buffer, &header->opcode) &&
+ XdmcpReadCARD16 (buffer, &header->length))
+ return TRUE;
+ return FALSE;
+}
diff --git a/RR.c b/RR.c
new file mode 100644
index 0000000..1fa1dca
--- /dev/null
+++ b/RR.c
@@ -0,0 +1,40 @@
+/*
+ * $Xorg: RR.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReadRemaining (buffer)
+ XdmcpBufferPtr buffer;
+{
+ return buffer->count - buffer->pointer;
+}
diff --git a/RaA16.c b/RaA16.c
new file mode 100644
index 0000000..a7191da
--- /dev/null
+++ b/RaA16.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: RaA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReallocARRAY16 (array, length)
+ ARRAY16Ptr array;
+ int length;
+{
+ CARD16Ptr newData;
+
+ newData = (CARD16Ptr) Xrealloc (array->data, length * sizeof (CARD16));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/RaA32.c b/RaA32.c
new file mode 100644
index 0000000..39b5c12
--- /dev/null
+++ b/RaA32.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: RaA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReallocARRAY32 (array, length)
+ ARRAY32Ptr array;
+ int length;
+{
+ CARD32Ptr newData;
+
+ newData = (CARD32Ptr) Xrealloc (array->data, length * sizeof (CARD32));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/RaA8.c b/RaA8.c
new file mode 100644
index 0000000..237a8f5
--- /dev/null
+++ b/RaA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: RaA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReallocARRAY8 (array, length)
+ ARRAY8Ptr array;
+ int length;
+{
+ CARD8Ptr newData;
+
+ newData = (CARD8Ptr) Xrealloc (array->data, length * sizeof (CARD8));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/RaAoA8.c b/RaAoA8.c
new file mode 100644
index 0000000..e1378ec
--- /dev/null
+++ b/RaAoA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: RaAoA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpReallocARRAYofARRAY8 (array, length)
+ ARRAYofARRAY8Ptr array;
+ int length;
+{
+ ARRAY8Ptr newData;
+
+ newData = (ARRAY8Ptr) Xrealloc (array->data, length * sizeof (ARRAY8));
+ if (!newData)
+ return FALSE;
+ array->length = length;
+ array->data = newData;
+ return TRUE;
+}
diff --git a/Unwrap.c b/Unwrap.c
new file mode 100644
index 0000000..c839788
--- /dev/null
+++ b/Unwrap.c
@@ -0,0 +1,89 @@
+/*
+ * $Xorg: Unwrap.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+#ifdef HASXDMAUTH
+
+/*
+ * The following function exists only to demonstrate the
+ * desired functional interface for this routine. You will
+ * need to add the appropriate algorithm if you wish to
+ * use XDM-AUTHENTICATION-1/XDM-AUTHORIZATION-1.
+ *
+ * The interface for this routine is quite simple. All three
+ * arguments are arrays of 8 unsigned characters, the first two
+ * are 64 bits of useful data, the last is 56 bits of useful
+ * data packed into 8 bytes, using the low 7 bits of each
+ * byte, filling the high bit with odd parity.
+ *
+ * Examine the XDMCP specification for the correct algorithm
+ */
+
+#include "Wrap.h"
+
+void
+XdmcpUnwrap (input, wrapper, output, bytes)
+ unsigned char *input, *output;
+ unsigned char *wrapper;
+ int bytes;
+{
+ int i, j, k;
+ unsigned char tmp[8];
+ unsigned char blocks[2][8];
+ unsigned char expand_wrapper[8];
+ auth_wrapper_schedule schedule;
+
+ _XdmcpWrapperToOddParity (wrapper, expand_wrapper);
+ _XdmcpAuthSetup (expand_wrapper, schedule);
+
+ k = 0;
+ for (j = 0; j < bytes; j += 8)
+ {
+ if (bytes - j < 8)
+ return; /* bad input length */
+ for (i = 0; i < 8; i++)
+ blocks[k][i] = input[j + i];
+ _XdmcpAuthDoIt ((unsigned char *) (input + j), (unsigned char *) tmp, schedule, 0);
+ /* block chaining */
+ k = (k == 0) ? 1 : 0;
+ for (i = 0; i < 8; i++)
+ {
+ if (j == 0)
+ output[j + i] = tmp[i];
+ else
+ output[j + i] = tmp[i] ^ blocks[k][i];
+ }
+ }
+}
+
+#endif /* HASXDMAUTH */
diff --git a/WA16.c b/WA16.c
new file mode 100644
index 0000000..4f625b7
--- /dev/null
+++ b/WA16.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: WA16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteARRAY16 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY16Ptr array;
+{
+ int i;
+
+ if (!XdmcpWriteCARD8 (buffer, array->length))
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ if (!XdmcpWriteCARD16 (buffer, array->data[i]))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WA32.c b/WA32.c
new file mode 100644
index 0000000..140c750
--- /dev/null
+++ b/WA32.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: WA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteARRAY32 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY32Ptr array;
+{
+ int i;
+
+ if (!XdmcpWriteCARD8 (buffer, array->length))
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ if (!XdmcpWriteCARD32 (buffer, array->data[i]))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WA8.c b/WA8.c
new file mode 100644
index 0000000..3bd738a
--- /dev/null
+++ b/WA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: WA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteARRAY8 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAY8Ptr array;
+{
+ int i;
+
+ if (!XdmcpWriteCARD16 (buffer, array->length))
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ if (!XdmcpWriteCARD8 (buffer, array->data[i]))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WAofA8.c b/WAofA8.c
new file mode 100644
index 0000000..84ba454
--- /dev/null
+++ b/WAofA8.c
@@ -0,0 +1,48 @@
+/*
+ * $Xorg: WAofA8.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteARRAYofARRAY8 (buffer, array)
+ XdmcpBufferPtr buffer;
+ ARRAYofARRAY8Ptr array;
+{
+ int i;
+
+ if (!XdmcpWriteCARD8 (buffer, array->length))
+ return FALSE;
+ for (i = 0; i < (int)array->length; i++)
+ if (!XdmcpWriteARRAY8 (buffer, &array->data[i]))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WC16.c b/WC16.c
new file mode 100644
index 0000000..2c806ad
--- /dev/null
+++ b/WC16.c
@@ -0,0 +1,45 @@
+/*
+ * $Xorg: WC16.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteCARD16 (buffer, value)
+ XdmcpBufferPtr buffer;
+ CARD16 value;
+{
+ if (!XdmcpWriteCARD8 (buffer, value >> 8))
+ return FALSE;
+ if (!XdmcpWriteCARD8 (buffer, value & 0xff))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WC32.c b/WC32.c
new file mode 100644
index 0000000..c1ec4f8
--- /dev/null
+++ b/WC32.c
@@ -0,0 +1,49 @@
+/*
+ * $Xorg: WC32.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteCARD32 (buffer, value)
+ XdmcpBufferPtr buffer;
+ CARD32 value;
+{
+ if (!XdmcpWriteCARD8 (buffer, value >> 24))
+ return FALSE;
+ if (!XdmcpWriteCARD8 (buffer, (value >> 16) & 0xff))
+ return FALSE;
+ if (!XdmcpWriteCARD8 (buffer, (value >> 8) & 0xff))
+ return FALSE;
+ if (!XdmcpWriteCARD8 (buffer, value & 0xff))
+ return FALSE;
+ return TRUE;
+}
diff --git a/WC8.c b/WC8.c
new file mode 100644
index 0000000..9ab6994
--- /dev/null
+++ b/WC8.c
@@ -0,0 +1,44 @@
+/*
+ * $Xorg: WC8.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteCARD8 (buffer, value)
+ XdmcpBufferPtr buffer;
+ CARD8 value;
+{
+ if (buffer->pointer >= buffer->size)
+ return FALSE;
+ buffer->data[buffer->pointer++] = (BYTE) value;
+ return TRUE;
+}
diff --git a/Whead.c b/Whead.c
new file mode 100644
index 0000000..68fa1a5
--- /dev/null
+++ b/Whead.c
@@ -0,0 +1,59 @@
+/*
+ * $Xorg: Whead.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+int
+XdmcpWriteHeader (buffer, header)
+ XdmcpBufferPtr buffer;
+ XdmcpHeaderPtr header;
+{
+ BYTE *newData;
+
+ if ((int)buffer->size < 6 + (int)header->length)
+ {
+ newData = (BYTE *) Xalloc (XDM_MAX_MSGLEN * sizeof (BYTE));
+ if (!newData)
+ return FALSE;
+ Xfree (buffer->data);
+ buffer->data = newData;
+ buffer->size = XDM_MAX_MSGLEN;
+ }
+ buffer->pointer = 0;
+ if (!XdmcpWriteCARD16 (buffer, header->version))
+ return FALSE;
+ if (!XdmcpWriteCARD16 (buffer, header->opcode))
+ return FALSE;
+ if (!XdmcpWriteCARD16 (buffer, header->length))
+ return FALSE;
+ return TRUE;
+}
diff --git a/Wrap.c b/Wrap.c
new file mode 100644
index 0000000..5b62b0f
--- /dev/null
+++ b/Wrap.c
@@ -0,0 +1,127 @@
+/*
+ * $Xorg: Wrap.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
+ *
+ *
+Copyright 1989, 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: Keith Packard, MIT X Consortium
+ */
+
+#include <X11/Xos.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xdmcp.h>
+
+#ifdef HASXDMAUTH
+
+/*
+ * The following function exists only to demonstrate the
+ * desired functional interface for this routine. You will
+ * need to add the appropriate algorithm if you wish to
+ * use XDM-AUTHENTICATION-1/XDM-AUTHORIZATION-1.
+ *
+ * Examine the XDMCP specification for the correct algorithm
+ */
+
+#include "Wrap.h"
+
+void
+XdmcpWrap (input, wrapper, output, bytes)
+ unsigned char *input, *output;
+ unsigned char *wrapper;
+ int bytes;
+{
+ int i, j;
+ int len;
+ unsigned char tmp[8];
+ unsigned char expand_wrapper[8];
+ auth_wrapper_schedule schedule;
+
+ _XdmcpWrapperToOddParity (wrapper, expand_wrapper);
+ _XdmcpAuthSetup (expand_wrapper, schedule);
+ for (j = 0; j < bytes; j += 8)
+ {
+ len = 8;
+ if (bytes - j < len)
+ len = bytes - j;
+ /* block chaining */
+ for (i = 0; i < len; i++)
+ {
+ if (j == 0)
+ tmp[i] = input[i];
+ else
+ tmp[i] = input[j + i] ^ output[j - 8 + i];
+ }
+ for (; i < 8; i++)
+ {
+ if (j == 0)
+ tmp[i] = 0;
+ else
+ tmp[i] = 0 ^ output[j - 8 + i];
+ }
+ _XdmcpAuthDoIt (tmp, (output + j), schedule, 1);
+ }
+}
+
+/*
+ * Given a 56 bit wrapper in XDMCP format, create a 56
+ * bit wrapper in 7-bits + odd parity format
+ */
+
+static int
+OddParity (c)
+ unsigned char c;
+{
+ c = c ^ (c >> 4);
+ c = c ^ (c >> 2);
+ c = c ^ (c >> 1);
+ return ~c & 0x1;
+}
+
+/*
+ * Spread the 56 bit wrapper among 8 bytes, using the upper 7 bits
+ * of each byte, and storing an odd parity bit in the low bit
+ */
+
+void
+_XdmcpWrapperToOddParity (in, out)
+ unsigned char *in, *out;
+{
+ int ashift, bshift;
+ int i;
+ unsigned char c;
+
+ ashift = 7;
+ bshift = 1;
+ for (i = 0; i < 7; i++)
+ {
+ c = ((in[i] << ashift) | (in[i+1] >> bshift)) & 0x7f;
+ out[i] = (c << 1) | OddParity (c);
+ ashift--;
+ bshift++;
+ }
+ c = in[i];
+ out[i] = (c << 1) | OddParity(c);
+}
+
+#endif
diff --git a/Wrap.h b/Wrap.h
new file mode 100644
index 0000000..9826b53
--- /dev/null
+++ b/Wrap.h
@@ -0,0 +1,10 @@
+/* $Xorg: Wrap.h,v 1.3 2000/08/17 19:45:50 cpqbld Exp $ */
+/*
+ * header file for compatibility with something useful
+ */
+
+typedef unsigned char auth_cblock[8]; /* block size */
+
+typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16];
+
+extern void _XdmcpWrapperToOddParity();
diff --git a/include/X11/Xdmcp.h b/include/X11/Xdmcp.h
new file mode 100644
index 0000000..b37ba28
--- /dev/null
+++ b/include/X11/Xdmcp.h
@@ -0,0 +1,141 @@
+/* $Xorg: Xdmcp.h,v 1.6 2000/08/17 19:45:50 cpqbld Exp $ */
+/*
+ * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of N.C.D. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. N.C.D. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ */
+#include <X11/Xmd.h>
+
+#ifndef _XDMCP_H_
+#define _XDMCP_H_
+#define XDM_PROTOCOL_VERSION 1
+#define XDM_UDP_PORT 177
+#define XDM_MAX_MSGLEN 8192
+#define XDM_MIN_RTX 2
+#define XDM_MAX_RTX 32
+#define XDM_RTX_LIMIT 7
+#define XDM_KA_RTX_LIMIT 4
+#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */
+#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */
+
+typedef enum {
+ BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
+ WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
+ FAILED, KEEPALIVE, ALIVE
+} xdmOpCode;
+
+typedef enum {
+ XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
+ XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
+ XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
+ XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
+ XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE
+} xdmcp_states;
+
+#ifdef NOTDEF
+/* table of hosts */
+
+#define XDM_MAX_STR_LEN 21
+#define XDM_MAX_HOSTS 20
+struct xdm_host_table {
+ struct sockaddr_in sockaddr;
+ char name[XDM_MAX_STR_LEN];
+ char status[XDM_MAX_STR_LEN];
+};
+#endif /* NOTDEF */
+
+typedef CARD8 *CARD8Ptr;
+typedef CARD16 *CARD16Ptr;
+typedef CARD32 *CARD32Ptr;
+
+typedef struct _ARRAY8 {
+ CARD16 length;
+ CARD8Ptr data;
+} ARRAY8, *ARRAY8Ptr;
+
+typedef struct _ARRAY16 {
+ CARD8 length;
+ CARD16Ptr data;
+} ARRAY16, *ARRAY16Ptr;
+
+typedef struct _ARRAY32 {
+ CARD8 length;
+ CARD32Ptr data;
+} ARRAY32, *ARRAY32Ptr;
+
+typedef struct _ARRAYofARRAY8 {
+ CARD8 length;
+ ARRAY8Ptr data;
+} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
+
+typedef struct _XdmcpHeader {
+ CARD16 version, opcode, length;
+} XdmcpHeader, *XdmcpHeaderPtr;
+
+typedef struct _XdmcpBuffer {
+ BYTE *data;
+ int size; /* size of buffer pointed by to data */
+ int pointer; /* current index into data */
+ int count; /* bytes read from network into data */
+} XdmcpBuffer, *XdmcpBufferPtr;
+
+typedef struct _XdmAuthKey {
+ BYTE data[8];
+} XdmAuthKeyRec, *XdmAuthKeyPtr;
+
+
+/* implementation-independent network address structure.
+ Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
+
+typedef char *XdmcpNetaddr;
+
+
+extern int XdmcpWriteCARD8(), XdmcpWriteCARD16();
+extern int XdmcpWriteCARD32();
+extern int XdmcpWriteARRAY8(), XdmcpWriteARRAY16();
+extern int XdmcpWriteARRAY32(), XdmcpWriteARRAYofARRAY8();
+extern int XdmcpWriteHeader(), XdmcpFlush();
+
+extern int XdmcpReadCARD8(), XdmcpReadCARD16();
+extern int XdmcpReadCARD32();
+extern int XdmcpReadARRAY8(), XdmcpReadARRAY16();
+extern int XdmcpReadARRAY32(), XdmcpReadARRAYofARRAY8();
+extern int XdmcpReadHeader(), XdmcpFill();
+
+extern int XdmcpReadRemaining();
+
+extern void XdmcpDisposeARRAY8(), XdmcpDisposeARRAY16();
+extern void XdmcpDisposeARRAY32(), XdmcpDisposeARRAYofARRAY8();
+
+extern int XdmcpCopyARRAY8();
+
+extern int XdmcpARRAY8Equal();
+
+#ifdef HASXDMAUTH
+extern void XdmcpGenerateKey();
+extern void XdmcpIncrementKey();
+extern void XdmcpDecrementKey();
+extern void XdmcpWrap();
+extern void XdmcpUnwrap();
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+#if !defined(Xalloc) && !defined(xalloc) && !defined(Xrealloc)
+extern long *Xalloc (), *Xrealloc ();
+extern void Xfree();
+#endif
+
+#endif /* _XDMCP_H_ */