Kill LBX, too.

This commit is contained in:
Daniel Stone 2006-06-01 22:06:41 +00:00
parent df6da66525
commit a9ed5a8790
43 changed files with 64 additions and 9719 deletions

View File

@ -66,6 +66,34 @@
* xkb/xkbLEDs.c:
Simplify the 'unsupported' list.
* configure.ac:
* Makefile.am:
* Xext/security.c:
* dix/colormap.c:
* dix/devices.c:
* dix/dixfonts.c:
* dix/dispatch.c:
* dix/extension.c:
* dix/property.c:
* dix/swaprep.c:
* include/dix.h:
* include/dix-config.h:
* include/dixstruct.h:
* include/globals.h:
* include/os.h:
* include/propertyst.h:
* include/swaprep.h:
* lbx/*:
* mi/miinitext.c:
* os/Makefile.am:
* os/access.c:
* os/connection.c:
* os/io.c:
* os/lbxio.c:
* os/osdep.h:
* os/utils.c:
Remove LBX. Goodbye.
2006-05-30 Matthieu Herrb <matthieu.herrb@laas.fr>
* hw/xfree86/os-support/bsd/Makefile.am:

View File

@ -31,10 +31,6 @@ XPDDX_DIR=Xprint
XPCONFIG_DIR=XpConfig
endif
if LBX
LBX_DIR=lbx
endif
if XINPUT
XINPUT_DIR=Xi
endif
@ -67,7 +63,6 @@ SUBDIRS = \
$(XTRAP_DIR) \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
$(LBX_DIR) \
exa \
hw \
$(XPDDX_DIR) \
@ -108,8 +103,7 @@ DIST_SUBDIRS = \
exa \
hw \
Xprint \
XpConfig \
lbx
XpConfig
# gross hack
relink: all

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/Xext/security.c,v 1.5 2005/07/03 07:01:04 daniels Exp $ */
/* $XdotOrg: xserver/xorg/Xext/security.c,v 1.6 2006/03/28 01:20:59 ajax Exp $ */
/* $Xorg: security.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
/*
@ -43,11 +43,6 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/securstr.h>
#include <assert.h>
#include <stdarg.h>
#ifdef LBX
#define _XLBX_SERVER_
#include <X11/extensions/XLbx.h>
extern unsigned char LbxReqCode;
#endif
#ifdef XAPPGROUP
#include <X11/extensions/Xagsrv.h>
#endif
@ -1066,18 +1061,6 @@ SecurityCheckResourceIDAccess(
default:
{
#ifdef LBX
/* XXX really need per extension dispatching */
if (reqtype == LbxReqCode) {
switch (((xReq *)client->requestBuffer)->data) {
case X_LbxGetProperty:
case X_LbxChangeProperty:
return rval;
default:
break;
}
}
#endif
/* others not allowed */
return SecurityAuditResourceIDAccess(client, id);
}
@ -1178,22 +1161,6 @@ SecurityClientStateCallback(
}
} /* SecurityClientStateCallback */
#ifdef LBX
Bool
SecuritySameLevel(client, authId)
ClientPtr client;
XID authId;
{
SecurityAuthorizationPtr pAuth;
pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
SecurityAuthorizationResType);
if (pAuth)
return client->trustLevel == pAuth->trustLevel;
return client->trustLevel == XSecurityClientTrusted;
}
#endif
/* SecurityCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from

View File

@ -411,7 +411,6 @@ AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF8
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(lbx, AS_HELP_STRING([--disable-lbx], [Build LBX extension (default: no)]), [LBX=$enableval], [LBX=no])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
@ -598,24 +597,6 @@ if test "x$GLX_USE_TLS" = xyes -a "x$AIGLX" = xyes; then
fi
AC_SUBST([GLX_DEFINES])
PKG_CHECK_MODULES([LBXUTIL_TEST], [lbxutil], [have_lbxutil=yes], [have_lbxutil=no])
if test "x$LBX" = xauto; then
if test "x$have_lbxutil" = "xyes"; then
LBX="yes"
else
LBX="no"
fi
fi
AM_CONDITIONAL(LBX, [test "x$LBX" = xyes])
if test "x$LBX" = xyes; then
AC_DEFINE(LBX, 1, [Support LBX extension])
PKG_CHECK_MODULES([LBXUTIL], [lbxutil])
LBX_LIB='$(top_builddir)/lbx/liblbx.la'" $LBXUTIL_LIBS"
LBX_INC='-I$(top_srcdir)/lbx'" $LBXUTIL_CFLAGS"
fi
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
AC_DEFINE(XF86DRI, 1, [Build DRI extension])
@ -874,7 +855,7 @@ AC_EGREP_CPP([I_AM_SVR4],[
AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $LBX_INC"
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
dnl ---------------------------------------------------------------------------
@ -902,7 +883,7 @@ if test "x$DMX" = xyes; then
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $LBX_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
AC_SUBST([XDMX_LIBS])
dnl USB sources in DMX require <linux/input.h>
@ -941,7 +922,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XVFB_LIBS])
fi
@ -957,7 +938,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XNEST_LIBS])
fi
@ -986,7 +967,7 @@ AC_MSG_RESULT([$XGL])
AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
if test "x$XGL" = xyes; then
XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGL_LIBS])
AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
@ -1007,7 +988,7 @@ AC_MSG_RESULT([$XEGL])
AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
if test "x$XEGL" = xyes; then
XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XEGL_LIBS])
fi
@ -1023,7 +1004,7 @@ AC_MSG_RESULT([$XGLX])
AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
if test "x$XGLX" = xyes; then
XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGLX_LIBS])
fi
@ -1044,7 +1025,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl")
@ -1297,7 +1278,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $LBX_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@ -1636,7 +1617,6 @@ doc/Makefile
fb/Makefile
record/Makefile
XTrap/Makefile
lbx/Makefile
mfb/Makefile
cfb/Makefile
cfb32/Makefile

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/dix/colormap.c,v 1.12 2006/02/15 20:44:12 ajax Exp $ */
/* $XdotOrg: xserver/xorg/dix/colormap.c,v 1.13 2006/05/22 15:47:56 ajax Exp $ */
/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.11 2003/11/03 05:10:59 tsi Exp $ */
/***********************************************************
@ -63,9 +63,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include "resource.h"
#include "windowstr.h"
#ifdef LBX
#include "lbxserve.h"
#endif
extern XID clientErrorValue;
extern int colormapPrivateCount;
@ -1515,65 +1512,17 @@ FreePixels(register ColormapPtr pmap, register int client)
register Pixel *ppix, *ppixStart;
register int n;
int class;
#ifdef LBX
Bool grabbed;
Bool zeroRefCount;
Bool anyRefCountReachedZero = 0;
#endif
class = pmap->class;
ppixStart = pmap->clientPixelsRed[client];
if (class & DynamicClass)
{
n = pmap->numPixelsRed[client];
#ifdef LBX
grabbed = LbxCheckCmapGrabbed (pmap);
if (grabbed)
{
/*
* If the colormap is grabbed by a proxy, the server must
* notify the proxy of all cells that are freed (the refcount
* has reached zero on these cells).
*/
LbxBeginFreeCellsEvent (pmap);
LbxSortPixelList (ppixStart, n);
}
#endif
for (ppix = ppixStart; --n >= 0; )
{
FreeCell(pmap, *ppix, REDMAP);
#ifdef LBX
/*
* Only PSEUDO colormaps are grabbed by LBX proxies.
* Check if the ref count reached zero on this pixel.
*/
zeroRefCount = pmap->red[*ppix].refcnt == 0;
if (zeroRefCount)
anyRefCountReachedZero = 1;
if (grabbed && zeroRefCount)
LbxAddFreeCellToEvent (pmap, *ppix);
#endif
ppix++;
}
#ifdef LBX
if (grabbed)
LbxEndFreeCellsEvent (pmap);
else if (anyRefCountReachedZero)
{
/*
* We only send LbxFreeCell events to a proxy that has the colormap
* grabbed. If the colormap is not grabbed, the proxy that last
* had the colormap grabbed will not be able to do a smart grab
* in the future. A smart grab can only occur if the proxy is kept
* up to date on every alloc/free change in the colormap.
*/
LbxDisableSmartGrab (pmap);
}
#endif
}
xfree(ppixStart);
@ -2323,11 +2272,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
int n, zapped;
int errVal = Success;
int offset, numents;
#ifdef LBX
Bool grabbed;
Bool zeroRefCount;
Bool anyRefCountReachedZero = 0;
#endif
if (npixIn == 0)
return (errVal);
@ -2372,21 +2316,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
break;
}
#ifdef LBX
grabbed = LbxCheckCmapGrabbed (pmap);
if (grabbed)
{
/*
* If the colormap is grabbed by a proxy, the server must
* notify the proxy of all cells that are freed (the refcount
* has reached zero on these cells).
*/
LbxBeginFreeCellsEvent (pmap);
LbxSortPixelList (ppixIn, npixIn);
}
#endif
/* zap all pixels which match */
while (1)
@ -2412,19 +2341,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
if (pmap->class & DynamicClass)
{
FreeCell(pmap, pixTest, color);
#ifdef LBX
/*
* Only PSEUDO colormaps are grabbed by LBX proxies.
* Check if the ref count reached zero on this pixel.
*/
zeroRefCount = pmap->red[pixTest].refcnt == 0;
if (zeroRefCount)
anyRefCountReachedZero = 1;
if (grabbed && zeroRefCount)
LbxAddFreeCellToEvent (pmap, pixTest);
#endif
}
*cptr = ~((Pixel)0);
zapped++;
@ -2436,23 +2352,6 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
GetNextBitsOrBreak(bits, mask, base);
}
#ifdef LBX
if (grabbed)
LbxEndFreeCellsEvent (pmap);
else if (anyRefCountReachedZero)
{
/*
* We only send LbxFreeCell events to a proxy that has the colormap
* grabbed. If the colormap is not grabbed, the proxy that last
* had the colormap grabbed will not be able to do a smart grab
* in the future. A smart grab can only occur if the proxy is kept
* up to date on every alloc/free change in the colormap.
*/
LbxDisableSmartGrab (pmap);
}
#endif
/* delete freed pixels from client pixel list */
if (zapped)
{

View File

@ -48,7 +48,7 @@ SOFTWARE.
/* $Xorg: devices.c,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ */
/* $XdotOrg: xserver/xorg/dix/devices.c,v 1.10 2006/03/28 01:20:59 ajax Exp $ */
/* $XdotOrg: xserver/xorg/dix/devices.c,v 1.11 2006/06/01 19:22:37 daniels Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@ -74,9 +74,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#endif
#include "dispatch.h"
#include "swaprep.h"
@ -962,9 +959,6 @@ ProcSetModifierMapping(ClientPtr client)
return BadAccess;
#endif
#ifdef LBX
LbxFlushModifierMapTag();
#endif
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -1088,9 +1082,6 @@ ProcChangeKeyboardMapping(ClientPtr client)
keysyms.map = (KeySym *)&stuff[1];
if (!SetKeySymsMap(curKeySyms, &keysyms))
return BadAlloc;
#ifdef LBX
LbxFlushKeyboardMapTag();
#endif
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
client);
return client->noClientException;

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/dix/dispatch.c,v 1.13 2005/09/13 01:33:19 daniels Exp $ */
/* $XdotOrg: xserver/xorg/dix/dispatch.c,v 1.14 2006/02/15 20:44:12 ajax Exp $ */
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
/************************************************************
@ -119,9 +119,6 @@ int ProcInitialConnection();
#include "inputstr.h"
#include <X11/extensions/XKBsrv.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
@ -2602,15 +2599,6 @@ ProcAllocColor (register ClientPtr client)
RT_COLORMAP, SecurityWriteAccess);
if (pmap)
{
#ifdef LBX
/*
* If the colormap is grabbed by a proxy, the server will have
* to regain control over the colormap. This AllocColor request
* will be handled after the server gets back the colormap control.
*/
if (LbxCheckColorRequest (client, pmap, (xReq *) stuff))
return Success;
#endif
acr.type = X_Reply;
acr.length = 0;
acr.sequenceNumber = client->sequence;
@ -2655,15 +2643,6 @@ ProcAllocNamedColor (register ClientPtr client)
xAllocNamedColorReply ancr;
#ifdef LBX
/*
* If the colormap is grabbed by a proxy, the server will have
* to regain control over the colormap. This AllocNamedColor request
* will be handled after the server gets back the colormap control.
*/
if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
return Success;
#endif
ancr.type = X_Reply;
ancr.length = 0;
ancr.sequenceNumber = client->sequence;
@ -2717,15 +2696,6 @@ ProcAllocColorCells (register ClientPtr client)
long length;
Pixel *ppixels, *pmasks;
#ifdef LBX
/*
* If the colormap is grabbed by a proxy, the server will have
* to regain control over the colormap. This AllocColorCells request
* will be handled after the server gets back the colormap control.
*/
if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
return Success;
#endif
npixels = stuff->colors;
if (!npixels)
{
@ -2792,15 +2762,6 @@ ProcAllocColorPlanes(register ClientPtr client)
long length;
Pixel *ppixels;
#ifdef LBX
/*
* If the colormap is grabbed by a proxy, the server will have
* to regain control over the colormap. This AllocColorPlanes request
* will be handled after the server gets back the colormap control.
*/
if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
return Success;
#endif
npixels = stuff->colors;
if (!npixels)
{
@ -3570,9 +3531,6 @@ CloseDownClient(register ClientPtr client)
if (ClientIsAsleep(client))
ClientSignal (client);
ProcessWorkQueueZombies();
#ifdef LBX
ProcessQTagZombies();
#endif
CloseDownConnection(client);
/* If the client made it to the Running stage, nClients has
@ -3690,9 +3648,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
}
#endif
client->replyBytesRemaining = 0;
#ifdef LBX
client->readRequest = StandardReadRequestFromClient;
#endif
#ifdef XCSECURITY
client->trustLevel = XSecurityClientTrusted;
client->CheckAccess = NULL;
@ -3826,14 +3781,6 @@ ProcInitialConnection(register ClientPtr client)
return (client->noClientException);
}
#ifdef LBX
void
IncrementClientCount()
{
nClients++;
}
#endif
int
SendConnSetup(register ClientPtr client, char *reason)
{

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/dix/dixfonts.c,v 1.8 2005/07/03 08:53:38 daniels Exp $ */
/* $XdotOrg: xserver/xorg/dix/dixfonts.c,v 1.9 2006/02/15 20:44:12 ajax Exp $ */
/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.28 2003/11/08 02:02:03 dawes Exp $ */
/************************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@ -76,10 +76,6 @@ Equipment Corporation.
#include "panoramiX.h"
#endif
#ifdef LBX
#include "lbxserve.h"
#endif
#ifdef XF86BIGFONT
#define _XF86BIGFONT_SERVER_
#include <X11/extensions/xf86bigfont.h>
@ -491,9 +487,6 @@ CloseFont(pointer value, XID fid)
}
if (pfont == defaultFont)
defaultFont = NULL;
#ifdef LBX
LbxFreeFontTag(pfont);
#endif
#ifdef XF86BIGFONT
XF86BigfontFreeFontShm(pfont);
#endif

View File

@ -65,9 +65,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#endif
#define EXTENSION_BASE 128
#define EXTENSION_EVENT_BASE 64
@ -154,9 +151,6 @@ AddExtension(char *name, int NumEvents, int NumErrors,
ext->secure = FALSE;
#endif
#ifdef LBX
(void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase);
#endif
return(ext);
}
@ -176,11 +170,7 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
strcpy(name, alias);
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
#ifdef LBX
return LbxAddExtensionAlias(ext->index, alias);
#else
return TRUE;
#endif
}
static int
@ -241,9 +231,6 @@ DeclareExtensionSecurity(char *extname, Bool secure)
}
}
#endif
#ifdef LBX
LbxDeclareExtensionSecurity(extname, secure);
#endif
}
_X_EXPORT unsigned short
@ -271,10 +258,6 @@ CloseDownExtensions()
{
register int i,j;
#ifdef LBX
LbxCloseDownExtensions();
#endif
for (i = NumExtensions - 1; i >= 0; i--)
{
(* extensions[i]->CloseDown)(extensions[i]);

View File

@ -64,19 +64,6 @@ SOFTWARE.
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#include "lbxtags.h"
#endif
#if defined(LBX) || defined(LBX_COMPAT)
#if 0 /* no header in X11 environment, not used in X11 environment */
int fWriteToClient(ClientPtr client, int len, char *buf)
{
return WriteToClient(client, len, buf);
}
#endif
#endif
/*****************************************************************
* Property Stuff
@ -261,13 +248,8 @@ ProcChangeProperty(ClientPtr client)
}
#endif
#ifdef LBX
err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
(int)format, (int)mode, len, TRUE, (pointer)&stuff[1], TRUE, NULL);
#else
err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
(int)mode, len, (pointer)&stuff[1], TRUE);
#endif
if (err != Success)
return err;
else
@ -279,11 +261,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, pointer value,
Bool sendevent)
{
#ifdef LBX
return LbxChangeWindowProperty(NULL, pWin, property, type,
format, mode, len, TRUE, value,
sendevent, NULL);
#else
PropertyPtr pProp;
xEvent event;
int sizeInBytes;
@ -390,7 +367,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
}
return(Success);
#endif
}
int
@ -420,10 +396,6 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{
prevProp->next = pProp->next;
}
#ifdef LBX
if (pProp->tag_id)
TagDeleteTag(pProp->tag_id);
#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@ -445,10 +417,6 @@ DeleteAllWindowProperties(WindowPtr pWin)
pProp = wUserProps (pWin);
while (pProp)
{
#ifdef LBX
if (pProp->tag_id)
TagDeleteTag(pProp->tag_id);
#endif
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@ -569,13 +537,6 @@ ProcGetProperty(ClientPtr client)
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return(Success);
}
#ifdef LBX
/* make sure we have the current value */
if (pProp->tag_id && pProp->owner_pid) {
LbxStallPropRequest(client, pProp);
return client->noClientException;
}
#endif
/*
* Return type, format, value to client
@ -626,10 +587,6 @@ ProcGetProperty(ClientPtr client)
if (stuff->delete && (reply.bytesAfter == 0))
{ /* delete the Property */
#ifdef LBX
if (pProp->tag_id)
TagDeleteTag(pProp->tag_id);
#endif
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))

View File

@ -65,11 +65,9 @@ SOFTWARE.
static void SwapFontInfo(xQueryFontReply *pr);
#ifndef LBX
static void SwapCharInfo(xCharInfo *pInfo);
static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs);
#endif
/**
* Thanks to Jack Palevich for testing and subsequently rewriting all this
@ -391,10 +389,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
(void)WriteToClient(pClient, size, (char *) pRep);
}
#ifndef LBX
static
#endif
void
static void
SwapCharInfo(xCharInfo *pInfo)
{
register char n;
@ -423,10 +418,7 @@ SwapFontInfo(xQueryFontReply *pr)
swapl(&pr->nCharInfos, n);
}
#ifndef LBX
static
#endif
void
static void
SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
{
unsigned i;

View File

@ -374,9 +374,6 @@
/* Support Xv extension */
#undef XV
/* Build LBX extension */
#undef LBX
/* Build APPGROUP extension */
#undef XAPPGROUP

View File

@ -368,10 +368,6 @@ extern int DoGetImage(
Mask /*planemask*/,
xGetImageReply ** /*im_return*/);
#ifdef LBX
extern void IncrementClientCount(void);
#endif /* LBX */
#if defined(DDXBEFORERESET)
extern void ddxBeforeReset (void);
#endif

View File

@ -128,9 +128,6 @@ typedef struct _Client {
#ifdef DEBUG
unsigned char requestLog[MAX_REQUEST_LOG];
int requestLogIndex;
#endif
#ifdef LBX
int (*readRequest)(ClientPtr /*client*/);
#endif
unsigned long replyBytesRemaining;
#ifdef XCSECURITY

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/include/globals.h,v 1.10 2006/01/08 23:43:54 ajax Exp $ */
/* $XdotOrg: xserver/xorg/include/globals.h,v 1.11 2006/04/05 21:08:45 fredrik Exp $ */
/* $XFree86: xc/programs/Xserver/include/globals.h,v 1.3 1999/09/25 14:38:21 dawes Exp $ */
#ifndef _XSERV_GLOBAL_H_
@ -84,10 +84,6 @@ extern Bool noFontCacheExtension;
extern Bool noGlxExtension;
#endif
#ifdef LBX
extern Bool noLbxExtension;
#endif
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif

View File

@ -109,14 +109,7 @@ extern int WaitForSomething(
int* /*pClientsReady*/
);
#ifdef LBX
#define ReadRequestFromClient(client) ((client)->readRequest(client))
extern int StandardReadRequestFromClient(ClientPtr /*client*/);
extern int ClientConnectionNumber(ClientPtr /*client*/);
#else
extern int ReadRequestFromClient(ClientPtr /*client*/);
#endif /* LBX */
extern Bool InsertFakeRequest(
ClientPtr /*client*/,
@ -176,10 +169,6 @@ extern void MakeClientGrabImpervious(ClientPtr /*client*/);
extern void MakeClientGrabPervious(ClientPtr /*client*/);
#ifdef LBX
extern void CloseDownFileDescriptor(ClientPtr /* client */);
#endif
extern void AvailableClientInput(ClientPtr /* client */);
extern CARD32 GetTimeInMillis(void);

View File

@ -62,14 +62,6 @@ typedef struct _Property {
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
pointer data; /* private to client */
#if defined(LBX) || defined(LBX_COMPAT)
/* If space is at a premium and binary compatibility is not
* an issue, you may want to put the owner_pid next to format
* so that the two shorts pack together without padding.
*/
short owner_pid; /* proxy that has the data */
XID tag_id;
#endif
} PropertyRec;
#endif /* PROPERTYSTRUCT_H */

View File

@ -120,17 +120,6 @@ extern void SQueryKeymapReply(
int /* size */,
xQueryKeymapReply * /* pRep */);
#ifdef LBX
extern void SwapCharInfo(
xCharInfo * /* pInfo */);
#endif
#ifdef LBX
extern void SwapFont(
xQueryFontReply * /* pr */,
Bool /* hasGlyphs */);
#endif
extern void SQueryFontReply(
ClientPtr /* pClient */,
int /* size */,

View File

@ -1,21 +0,0 @@
noinst_LTLIBRARIES = liblbx.la
AM_CFLAGS = $(DIX_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@
liblbx_la_SOURCES = \
lbxcmap.c \
lbxdata.h \
lbxdix.c \
lbxexts.c \
lbxgfx.c \
lbxmain.c \
lbxopts.c \
lbxprop.c \
lbxserve.h \
lbxsquish.c \
lbxsrvopts.h \
lbxswap.c \
lbxtables.c \
lbxtags.c \
lbxtags.h \
lbxzerorep.c

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
/* $Xorg: lbxdata.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _LBXDATA_H_
#define _LBXDATA_H_
#define NEED_REPLIES
#include <X11/X.h>
#include <X11/Xproto.h>
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "dixfontstr.h"
extern int lbx_font_private;
typedef struct _fonttaginfo {
XID tid;
FontPtr pfont;
unsigned long size;
int compression;
xLbxFontInfo *fontinfo;
} FontTagInfoRec, *FontTagInfoPtr;
#endif /* _LBXDATA_H_ */

View File

@ -1,869 +0,0 @@
/* $Xorg: lbxdix.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
/*
Copyright 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.
*/
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.7 2001/08/23 14:46:57 alanh Exp $ */
/* various bits of DIX-level mangling */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "inputstr.h"
#include "servermd.h"
#include "dixfontstr.h"
#include "gcstruct.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "propertyst.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "lbxserve.h"
#include "lbxtags.h"
#include "lbxdata.h"
#include <X11/Xfuncproto.h>
#ifdef XAPPGROUP
#include <X11/extensions/Xagsrv.h>
#endif
#include "swaprep.h"
int lbx_font_private = -1;
void
LbxDixInit(void)
{
TagInit();
lbx_font_private = AllocateFontPrivateIndex();
}
/* ARGSUSED */
void
LbxAllowMotion(ClientPtr client,
int num)
{
LbxProxyPtr proxy = LbxProxy(client);
proxy->motion_allowed_events += num;
}
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
int
LbxSendConnSetup(ClientPtr client,
char *reason)
{
int dlength;
int i, ndex, lim, wndex;
CARD32 dataBuf[16];
xLbxConnSetupPrefix csp;
NewClientInfoRec nci;
LbxProxyPtr proxy = LbxProxy(client);
if (reason) {
SendConnSetup(client, reason);
LbxForceOutput(proxy); /* expedient to avoid another state variable */
return (client->noClientException);
}
IncrementClientCount();
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
dataBuf[0] = client->clientAsMask;
csp.success = TRUE;
csp.majorVersion = connSetupPrefix.majorVersion;
csp.minorVersion = connSetupPrefix.minorVersion;
csp.tag = 0;
#ifdef XAPPGROUP
if (!client->appgroup) {
#endif
csp.changeType = 1; /* LbxNormalDeltas */
csp.length = 2 + /* tag + resource-id-base */
screenInfo.numScreens; /* input-mask per screen */
wndex = 0; ndex = 1; lim = screenInfo.numScreens;
#ifdef XAPPGROUP
} else {
csp.changeType = 2; /* LbxAppGroupDeltas */
csp.length = 7 + /* tag, res-id-base, root, visual, colormap, b&w-pix */
1 + screenInfo.numScreens - screenInfo.numVideoScreens;
XagGetDeltaInfo (client, &dataBuf[1]);
for (i = 0; i < MAXSCREENS; i++) {
if ((CARD32) WindowTable[i]->drawable.id == dataBuf[1]) {
dataBuf[6] = WindowTable[i]->eventMask | wOtherEventMasks(WindowTable[i]);
break;
}
}
wndex = screenInfo.numVideoScreens;
ndex = 7;
lim = screenInfo.numScreens - screenInfo.numVideoScreens;
}
#endif
for (i = 0; i < lim; i++, ndex++, wndex++) {
dataBuf[ndex] =
WindowTable[wndex]->eventMask | wOtherEventMasks(WindowTable[wndex]);
}
dlength = (csp.length - 1) << 2;
if (LbxProxyClient(proxy)->swapped) {
swaps(&csp.length, i);
}
if (client->swapped) {
LbxWriteSConnSetupPrefix(client, &csp);
SwapLongs(dataBuf, (1 + screenInfo.numScreens));
WriteToClient(client, dlength, (pointer) dataBuf);
} else {
WriteToClient(client, sizeof(xLbxConnSetupPrefix), (char *) &csp);
WriteToClient(client, dlength, (pointer) dataBuf);
}
LbxForceOutput(proxy); /* expedient to avoid another state variable */
client->clientState = ClientStateRunning;
if (ClientStateCallback) {
if (LbxProxyClient(proxy)->swapped != client->swapped) {
swaps(&csp.length, i);
}
nci.client = client;
nci.prefix = (xConnSetupPrefix*) &csp;
nci.setup = (xConnSetup *) ConnectionInfo;
CallCallbacks(&ClientStateCallback, (pointer) &nci);
}
return client->noClientException;
}
static XID modifier_map_tag;
int
LbxGetModifierMapping(ClientPtr client)
{
TagData td;
pointer tagdata;
xLbxGetModifierMappingReply rep;
register KeyClassPtr keyc = inputInfo.keyboard->key;
int dlength = keyc->maxKeysPerModifier << 3;
Bool tag_known = FALSE,
send_data;
int n;
if (!modifier_map_tag) {
tagdata = (pointer) keyc->modifierKeyMap;
TagSaveTag(LbxTagTypeModmap, dlength, tagdata, &modifier_map_tag);
} else {
td = TagGetTag(modifier_map_tag);
tagdata = td->tdata;
tag_known = TagProxyMarked(modifier_map_tag, LbxProxyID(client));
}
if (modifier_map_tag)
TagMarkProxy(modifier_map_tag, LbxProxyID(client));
send_data = (!modifier_map_tag || !tag_known);
rep.type = X_Reply;
rep.keyspermod = keyc->maxKeysPerModifier;
rep.sequenceNumber = client->sequence;
rep.tag = modifier_map_tag;
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
if (send_data)
rep.length = dlength >> 2;
else
rep.length = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.tag, n);
}
WriteToClient(client, sizeof(xLbxGetModifierMappingReply), (char *)&rep);
if (send_data)
WriteToClient(client, dlength, (char *) tagdata);
return client->noClientException;
}
void
LbxFlushModifierMapTag(void)
{
if (modifier_map_tag)
TagDeleteTag(modifier_map_tag);
}
static XID keyboard_map_tag;
int
LbxGetKeyboardMapping(ClientPtr client)
{
TagData td;
pointer tagdata;
xLbxGetKeyboardMappingReply rep;
REQUEST(xLbxGetKeyboardMappingReq);
KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
int dlength;
Bool tag_known = FALSE,
send_data;
int n;
REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq);
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
(stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
}
if (stuff->firstKeyCode + stuff->count > curKeySyms->maxKeyCode + 1) {
client->errorValue = stuff->count;
return BadValue;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.keysperkeycode = curKeySyms->mapWidth;
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */
if (!keyboard_map_tag) {
tagdata = (pointer) &curKeySyms->map[(stuff->firstKeyCode -
curKeySyms->minKeyCode) * curKeySyms->mapWidth];
dlength = (curKeySyms->mapWidth * stuff->count);
TagSaveTag(LbxTagTypeKeymap, dlength, tagdata, &keyboard_map_tag);
} else {
td = TagGetTag(keyboard_map_tag);
tagdata = td->tdata;
tag_known = TagProxyMarked(keyboard_map_tag, LbxProxyID(client));
}
if (keyboard_map_tag)
TagMarkProxy(keyboard_map_tag, LbxProxyID(client));
send_data = (!keyboard_map_tag || !tag_known);
rep.type = X_Reply;
rep.keysperkeycode = curKeySyms->mapWidth;
rep.sequenceNumber = client->sequence;
rep.tag = keyboard_map_tag;
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
if (send_data)
rep.length = (curKeySyms->mapWidth * stuff->count);
else
rep.length = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.tag, n);
}
WriteToClient(client, sizeof(xLbxGetKeyboardMappingReply), (char *)&rep);
if (send_data) {
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(client,
curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
&curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) *
curKeySyms->mapWidth]);
}
return client->noClientException;
}
void
LbxFlushKeyboardMapTag(void)
{
if (keyboard_map_tag)
TagDeleteTag(keyboard_map_tag);
}
/* counts number of bits needed to hold value */
static int
_bitsize(int val)
{
int bits = 1; /* always need one for sign bit */
if (val == 0)
return (bits);
if (val < 0) {
val = -val;
}
while (val) {
bits++;
val >>= 1;
}
return bits;
}
/*
* squashes the font (if possible), returning the new length and
* a pointer to the new data (which has been allocated). if it can't
* squish, it just returns a 0 and the data is sent in raw form.
*/
int _lbx_fi_junklen = sizeof(BYTE) * 2 + sizeof(CARD16) + sizeof(CARD32);
static int
squish_font_info(xQueryFontReply *qfr,
int rlen,
xLbxFontInfo **sqrep)
{
int len,
hlen;
xLbxFontInfo *new;
xCharInfo *minb,
*maxb,
*ci,
bbox;
int i;
char *t;
xLbxCharInfo *chars;
int num_chars;
num_chars = qfr->nCharInfos;
if (num_chars == 0)
return 0;
minb = &qfr->minBounds;
maxb = &qfr->maxBounds;
/*
* first do the quick check -- if the attribute fields aren't all the
* same, punt
*/
if (minb->attributes != maxb->attributes)
return 0;
#define compute(field) \
bbox.field = max(_bitsize(minb->field), _bitsize(maxb->field))
compute(characterWidth);
compute(leftSideBearing);
compute(rightSideBearing);
compute(ascent);
compute(descent);
#undef compute
/* make sure it fits */
if (!((bbox.characterWidth <= LBX_WIDTH_BITS) &&
(bbox.leftSideBearing <= LBX_LEFT_BITS) &&
(bbox.rightSideBearing <= LBX_RIGHT_BITS) &&
(bbox.ascent <= LBX_ASCENT_BITS) &&
(bbox.descent <= LBX_DESCENT_BITS))) {
return 0;
}
hlen = sizeof(xLbxFontInfo) + qfr->nFontProps * sizeof(xFontProp);
len = hlen + (num_chars * sizeof(xLbxCharInfo));
new = (xLbxFontInfo *) xalloc(len);
if (!new)
return 0;
/* gross hack to avoid copying all the fields */
t = (char *) qfr;
t += _lbx_fi_junklen;
/* copy all but the char infos */
memcpy((char *) new, (char *) t, hlen);
t = (char *) new;
t += hlen;
chars = (xLbxCharInfo *) t;
t = (char *) qfr;
t += sizeof(xQueryFontReply) + qfr->nFontProps * sizeof(xFontProp);
ci = (xCharInfo *) t;
/* now copy & pack the charinfos */
for (i = 0; i < num_chars; i++, chars++, ci++) {
chars->metrics = 0;
chars->metrics |= (LBX_MASK_BITS(ci->characterWidth, LBX_WIDTH_BITS)
<< LBX_WIDTH_SHIFT);
chars->metrics |= (LBX_MASK_BITS(ci->leftSideBearing, LBX_LEFT_BITS)
<< LBX_LEFT_SHIFT);
chars->metrics |= (LBX_MASK_BITS(ci->rightSideBearing, LBX_RIGHT_BITS)
<< LBX_RIGHT_SHIFT);
chars->metrics |= (LBX_MASK_BITS(ci->ascent, LBX_ASCENT_BITS)
<< LBX_ASCENT_SHIFT);
chars->metrics |= (LBX_MASK_BITS(ci->descent, LBX_DESCENT_BITS)
<< LBX_DESCENT_SHIFT);
}
*sqrep = new;
return len;
}
int
LbxQueryFont(ClientPtr client)
{
xQueryFontReply *reply;
xLbxQueryFontReply lbxrep;
FontPtr pFont;
register GC *pGC;
Bool send_data = FALSE;
Bool free_data = FALSE;
int rlength = 0;
FontTagInfoPtr ftip;
int sqlen = 0;
xLbxFontInfo *sqrep,
*sreply = NULL;
REQUEST(xLbxQueryFontReq);
REQUEST_SIZE_MATCH(xLbxQueryFontReq);
client->errorValue = stuff->fid; /* EITHER font or gc */
pFont = (FontPtr) SecurityLookupIDByType(client, stuff->fid, RT_FONT,
SecurityReadAccess);
if (!pFont) {
/* can't use VERIFY_GC because it might return BadGC */
pGC = (GC *) SecurityLookupIDByType(client, stuff->fid, RT_GC,
SecurityReadAccess);
if (!pGC || !pGC->font) { /* catch a non-existent builtin font */
client->errorValue = stuff->fid;
return (BadFont); /* procotol spec says only error is BadFont */
}
pFont = pGC->font;
}
/* get tag (if any) */
ftip = (FontTagInfoPtr) FontGetPrivate(pFont, lbx_font_private);
if (!ftip) {
xCharInfo *pmax = FONTINKMAX(pFont);
xCharInfo *pmin = FONTINKMIN(pFont);
int nprotoxcistructs;
nprotoxcistructs = (
pmax->rightSideBearing == pmin->rightSideBearing &&
pmax->leftSideBearing == pmin->leftSideBearing &&
pmax->descent == pmin->descent &&
pmax->ascent == pmin->ascent &&
pmax->characterWidth == pmin->characterWidth) ?
0 : N2dChars(pFont);
rlength = sizeof(xQueryFontReply) +
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo);
reply = (xQueryFontReply *) xalloc(rlength);
if (!reply) {
return (BadAlloc);
}
free_data = TRUE;
send_data = TRUE;
QueryFont(pFont, reply, nprotoxcistructs);
sqlen = squish_font_info(reply, rlength, &sqrep);
if (!sqlen) { /* if it failed to squish, send it raw */
char *t;
lbxrep.compression = 0;
sqlen = rlength - _lbx_fi_junklen;
t = (char *) reply;
sqrep = (xLbxFontInfo *) (t + _lbx_fi_junklen);
} else {
lbxrep.compression = 1;
xfree(reply); /* no longer needed */
}
} else { /* just get data from tag */
sqrep = ftip->fontinfo;
sqlen = ftip->size;
lbxrep.compression = ftip->compression;
}
if (!ftip) {
/* data allocation is done when font is first queried */
ftip = (FontTagInfoPtr) xalloc(sizeof(FontTagInfoRec));
if (ftip &&
TagSaveTag(LbxTagTypeFont, sqlen, (pointer) ftip, &ftip->tid)) {
FontSetPrivate(pFont, lbx_font_private, (pointer) ftip);
ftip->pfont = pFont;
ftip->size = sqlen;
ftip->fontinfo = sqrep;
ftip->compression = lbxrep.compression;
free_data = FALSE;
} else {
xfree(ftip);
}
}
if (ftip) {
if (!TagProxyMarked(ftip->tid, LbxProxyID(client)))
send_data = TRUE;
TagMarkProxy(ftip->tid, LbxProxyID(client));
lbxrep.tag = ftip->tid;
} else {
lbxrep.tag = 0;
send_data = TRUE;
}
lbxrep.type = X_Reply;
lbxrep.sequenceNumber = client->sequence;
lbxrep.pad0 = lbxrep.pad1 = lbxrep.pad2 = lbxrep.pad3 = lbxrep.pad4 = 0;
if (send_data)
lbxrep.length = sqlen >> 2;
else
lbxrep.length = 0;
if (client->swapped) {
int n;
swaps(&lbxrep.sequenceNumber, n);
swapl(&lbxrep.length, n);
swapl(&lbxrep.tag, n);
sreply = (xLbxFontInfo *) ALLOCATE_LOCAL(sqlen);
if (!sreply)
return BadAlloc;
memcpy((char *) sreply, (char *) sqrep, sqlen);
LbxSwapFontInfo(sreply, lbxrep.compression);
sqrep = sreply;
}
WriteToClient(client, sizeof(xLbxQueryFontReply), (char *) &lbxrep);
if (send_data)
WriteToClient(client, sqlen, (char *)sqrep);
if (free_data)
xfree(sqrep);
if (sreply)
DEALLOCATE_LOCAL(sreply);
return (client->noClientException);
}
void
LbxFreeFontTag(FontPtr pfont)
{
FontTagInfoPtr ftip;
ftip = (FontTagInfoPtr) FontGetPrivate(pfont, lbx_font_private);
if (ftip)
TagDeleteTag(ftip->tid);
}
int
LbxInvalidateTag(ClientPtr client,
XID tag)
{
TagClearProxy(tag, LbxProxyID(client));
return client->noClientException;
}
void
LbxSendInvalidateTag(ClientPtr client,
XID tag,
int tagtype)
{
xLbxInvalidateTagEvent ev;
int n;
ev.type = LbxEventCode;
ev.lbxType = LbxInvalidateTagEvent;
ev.sequenceNumber = client->sequence;
ev.tag = tag;
ev.tagType = tagtype;
ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
if (client->swapped) {
swaps(&ev.sequenceNumber, n);
swapl(&ev.tag, n);
swapl(&ev.tagType, n);
}
DBG(DBG_CLIENT, (stderr, "Invalidating tag %d\n", tag));
WriteToClient(client, sizeof(xLbxInvalidateTagEvent), (char *) &ev);
LbxForceOutput(LbxProxy(client));
}
static void
LbxSendSendTagData(int pid,
XID tag,
int tagtype)
{
xLbxSendTagDataEvent ev;
int n;
LbxProxyPtr proxy;
ClientPtr client;
LbxClientPtr lbxcp;
proxy = LbxPidToProxy(pid);
lbxcp = (proxy != NULL) ? proxy->lbxClients[0] : NULL;
if (lbxcp && (client = lbxcp->client)) {
ev.type = LbxEventCode;
ev.lbxType = LbxSendTagDataEvent;
ev.sequenceNumber = client->sequence;
ev.tag = tag;
ev.tagType = tagtype;
ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
if (client->swapped) {
swaps(&ev.sequenceNumber, n);
swapl(&ev.tag, n);
swapl(&ev.tagType, n);
}
DBG(DBG_CLIENT, (stderr, "Requesting tag %d\n", tag));
WriteToClient(client, sizeof(xLbxSendTagDataEvent), (char *) &ev);
LbxForceOutput(proxy);
}
}
/*
* keep track of clients stalled waiting for tags to come back from
* a proxy. since multiple clinets can be waiting for the same tag,
* we have to keep a list of all of them.
*/
typedef struct _sendtagq {
XID tag;
int num_stalled;
ClientPtr *stalled_clients;
struct _sendtagq *next;
} SendTagQRec, *SendTagQPtr;
static SendTagQPtr queried_tags = NULL;
#define LbxSendTagFailed -1
#define LbxSendTagSendIt 0
#define LbxSendTagAlreadySent 1
static Bool
LbxQueueSendTag(ClientPtr client,
XID tag)
{
SendTagQPtr stqp, *prev, new;
ClientPtr *newlist;
/* see if we're asking for one already in the pipeline */
for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
if (stqp->tag == tag) {
/* add new client to list */
newlist = (ClientPtr *) xrealloc(stqp->stalled_clients,
(sizeof(ClientPtr) * (stqp->num_stalled + 1)));
if (!newlist)
return LbxSendTagFailed;
newlist[stqp->num_stalled++] = client;
stqp->stalled_clients = newlist;
DBG(DBG_CLIENT, (stderr, "Additional client requesting tag %d\n", tag));
return LbxSendTagAlreadySent;
}
}
/* make new one */
new = (SendTagQPtr) xalloc(sizeof(SendTagQRec));
newlist = (ClientPtr *) xalloc(sizeof(ClientPtr));
if (!new || !newlist) {
xfree(new);
xfree(newlist);
return LbxSendTagFailed;
}
*newlist = client;
new->stalled_clients = newlist;
new->num_stalled = 1;
new->tag = tag;
new->next = NULL;
/* stick on end of list */
*prev = new;
return LbxSendTagSendIt;
}
static SendTagQPtr
LbxFindQTag(XID tag)
{
SendTagQPtr stqp;
for (stqp = queried_tags; stqp; stqp = stqp->next) {
if (stqp->tag == tag)
return stqp;
}
return NULL;
}
static void
LbxFreeQTag(SendTagQPtr stqp)
{
xfree(stqp->stalled_clients);
xfree(stqp);
}
static void
LbxRemoveQTag(XID tag)
{
SendTagQPtr stqp, *prev;
for (prev = &queried_tags; (stqp = *prev); prev = &stqp->next) {
if (stqp->tag == tag) {
*prev = stqp->next;
LbxFreeQTag(stqp);
return;
}
}
}
Bool
LbxFlushQTag(XID tag)
{
SendTagQPtr stqp;
ClientPtr *cp;
stqp = LbxFindQTag(tag);
if (!stqp)
return FALSE;
for (cp = stqp->stalled_clients; --stqp->num_stalled >= 0; cp++)
AttendClient(*cp);
LbxRemoveQTag(tag);
return TRUE;
}
void
ProcessQTagZombies(void)
{
SendTagQPtr stqp;
ClientPtr *out, *in;
int i;
for (stqp = queried_tags; stqp; stqp = stqp->next) {
out = stqp->stalled_clients;
for (in = out, i = stqp->num_stalled; --i >= 0; in++) {
if ((*in)->clientGone)
--stqp->num_stalled;
else
*out++ = *in;
}
}
}
/*
* server sends this
*/
void
LbxQueryTagData(ClientPtr client,
int owner_pid,
XID tag,
int tagtype)
{
/* save the info and the client being stalled */
if (LbxQueueSendTag(client, tag) == LbxSendTagSendIt)
LbxSendSendTagData(owner_pid, tag, tagtype);
}
/*
* server recieves this
*/
int
LbxTagData(ClientPtr client,
XID tag,
unsigned long len,
pointer data)
{
TagData td;
PropertyPtr pProp;
td = TagGetTag(tag);
if (!td || td->data_type != LbxTagTypeProperty)
return Success;
if (!td->global) {
/* somebody changed contents while we were querying */
TagDeleteTag(tag);
return Success;
}
LbxFlushQTag(tag);
pProp = (PropertyPtr) td->tdata;
if (pProp->tag_id != tag || pProp->owner_pid != LbxProxyID(client))
return Success;
pProp->owner_pid = 0;
if (len != td->size)
pProp->size = len / (pProp->format >> 3);
pProp->data = xrealloc(pProp->data, len);
if (!pProp->data) {
pProp->size = 0;
return Success;
}
if (client->swapped) {
switch (pProp->format) {
case 32:
SwapLongs((CARD32 *) data, len >> 2);
break;
case 16:
SwapShorts((short *) data, len >> 1);
break;
default:
break;
}
}
memmove((char *) pProp->data, (char *) data, len);
return Success;
}
/* when server resets, need to reset global tags */
void
LbxResetTags(void)
{
SendTagQPtr stqp;
modifier_map_tag = 0;
keyboard_map_tag = 0;
/* clean out any pending tag requests */
while ((stqp = queried_tags)) {
queried_tags = stqp->next;
LbxFreeQTag(stqp);
}
}

View File

@ -1,275 +0,0 @@
/* $Xorg: lbxexts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxexts.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "colormapst.h"
#include "propertyst.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "lbxserve.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
typedef struct _lbxext {
char *name;
char **aliases;
int num_aliases;
int idx;
int opcode;
int ev_base;
int err_base;
int num_reqs;
CARD8 *rep_mask;
CARD8 *ev_mask;
#ifdef XCSECURITY
Bool secure;
#endif
} LbxExtensionEntry;
static LbxExtensionEntry **lbx_extensions = NULL;
static int num_exts = 0;
Bool
LbxAddExtension(char *name,
int opcode,
int ev_base,
int err_base)
{
int i;
LbxExtensionEntry *ext,
**newexts;
ext = (LbxExtensionEntry *) xalloc(sizeof(LbxExtensionEntry));
if (!ext)
return FALSE;
ext->name = (char *) xalloc(strlen(name) + 1);
ext->num_aliases = 0;
ext->aliases = (char **) NULL;
if (!ext->name) {
xfree(ext);
return FALSE;
}
strcpy(ext->name, name);
i = num_exts;
newexts = (LbxExtensionEntry **) xrealloc(lbx_extensions,
(i + 1) * sizeof(LbxExtensionEntry *));
if (!newexts) {
xfree(ext->name);
xfree(ext);
return FALSE;
}
num_exts++;
lbx_extensions = newexts;
lbx_extensions[i] = ext;
ext->idx = i;
ext->opcode = opcode;;
ext->ev_base = ev_base;;
ext->err_base = err_base;
ext->ev_mask = NULL;
ext->rep_mask = NULL;
ext->num_reqs = 0;
#ifdef XCSECURITY
ext->secure = FALSE;
#endif
return TRUE;
}
Bool
LbxAddExtensionAlias(int idx,
char *alias)
{
char *name;
char **aliases;
LbxExtensionEntry *ext = lbx_extensions[idx];
aliases = (char **) xrealloc(ext->aliases,
(ext->num_aliases + 1) * sizeof(char *));
if (!aliases)
return FALSE;
ext->aliases = aliases;
name = (char *) xalloc(strlen(alias) + 1);
if (!name)
return FALSE;
strcpy(name, alias);
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
return TRUE;
}
static int
LbxFindExtension(char *extname,
int len)
{
int i, j;
for (i = 0; i < num_exts; i++) {
if ((strlen(lbx_extensions[i]->name) == len) &&
(strncmp(lbx_extensions[i]->name, extname, len) == 0))
return i;
for (j = lbx_extensions[i]->num_aliases; --j >= 0;) {
if ((strlen(lbx_extensions[i]->aliases[j]) == len) &&
(strncmp(lbx_extensions[i]->aliases[j], extname, len) == 0))
return i;
}
}
return -1;
}
void
LbxDeclareExtensionSecurity(char *extname,
Bool secure)
{
#ifdef XCSECURITY
int i = LbxFindExtension(extname, strlen(extname));
if (i >= 0)
lbx_extensions[i]->secure = secure;
#endif
}
Bool
LbxRegisterExtensionGenerationMasks(int idx,
int num_reqs,
char *rep_mask,
char *ev_mask)
{
LbxExtensionEntry *ext = lbx_extensions[idx];
CARD8 *nrm,
*nem;
int mlen = mlen = num_reqs / (8 * sizeof(CARD8)) + 1;
nrm = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
nem = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
if (!nrm || !nem) {
xfree(nrm);
xfree(nem);
return FALSE;
}
memcpy((char *) nrm, (char *) rep_mask, mlen);
memcpy((char *) nem, (char *) ev_mask, mlen);
ext->rep_mask = nrm;
ext->ev_mask = nem;
ext->num_reqs = num_reqs;
return TRUE;
}
int
LbxQueryExtension(ClientPtr client,
char *ename,
int nlen)
{
xLbxQueryExtensionReply rep;
int i;
int mlen = 0;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.major_opcode = 0;
rep.present = FALSE;
rep.length = 0;
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
i = LbxFindExtension(ename, nlen);
if (i < 0
#ifdef XCSECURITY
/* don't show insecure extensions to untrusted clients */
|| (client->trustLevel == XSecurityClientUntrusted &&
!lbx_extensions[i]->secure)
#endif
)
rep.present = FALSE;
else {
rep.present = TRUE;
rep.major_opcode = lbx_extensions[i]->opcode;
rep.first_event = lbx_extensions[i]->ev_base;
rep.first_error = lbx_extensions[i]->err_base;
rep.numReqs = lbx_extensions[i]->num_reqs;
if (lbx_extensions[i]->rep_mask) {
mlen = (lbx_extensions[i]->num_reqs + 7) >> 3;
rep.length = ((mlen + 3) >> 2) * 2;
}
}
if (client->swapped) {
char n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client, sizeof(xLbxQueryExtensionReply), (char *)&rep);
if (mlen) {
WriteToClient(client, mlen, (char *)lbx_extensions[i]->rep_mask);
WriteToClient(client, mlen, (char *)lbx_extensions[i]->ev_mask);
}
return Success;
}
void
LbxCloseDownExtensions(void)
{
int i,j;
for (i = 0; i < num_exts; i++) {
xfree(lbx_extensions[i]->name);
for (j = 0; j < lbx_extensions[i]->num_aliases; j++)
xfree(lbx_extensions[i]->aliases[j]);
xfree(lbx_extensions[i]->aliases);
xfree(lbx_extensions[i]->rep_mask);
xfree(lbx_extensions[i]->ev_mask);
xfree(lbx_extensions[i]);
}
xfree(lbx_extensions);
lbx_extensions = NULL;
num_exts = 0;
}
void
LbxSetReqMask(CARD8 *mask,
int req,
Bool on)
{
int mword = req / (8 * sizeof(CARD8));
req = req % (8 * sizeof(CARD8));
if (on) {
mask[mword] |= (1 << req);
} else {
mask[mword] &= ~(1 << req);
}
}

View File

@ -1,854 +0,0 @@
/* $Xorg: lbxgfx.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.3 2001/01/17 22:36:59 dawes Exp $ */
/* various bits of DIX-level mangling */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "servermd.h"
#include "windowstr.h"
#include "scrnintstr.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "lbxserve.h"
#include "lbxtags.h"
#include <X11/Xfuncproto.h>
#include <X11/extensions/lbximage.h>
#include "lbxsrvopts.h"
#define DrawableCache(client) (LbxClient(client)->drawableCache)
#define GContextCache(client) (LbxClient(client)->gcontextCache)
static void
push (XID cache[GFX_CACHE_SIZE],
XID xid)
{
memmove (cache+1, cache, (GFX_CACHE_SIZE - 1) * sizeof (cache[0]));
cache[0] = xid;
}
static XID
use (XID cache[GFX_CACHE_SIZE],
int i)
{
XID tmp;
tmp = cache[i];
if (i != 0)
{
memmove (cache + 1, cache, i * sizeof (cache[0]));
cache[0] = tmp;
}
return tmp;
}
extern char *ConnectionInfo;
static int
LbxDecodeGFXCache(ClientPtr client,
CARD8 cacheEnts,
char *after,
Drawable *drawp,
GContext *gcp)
{
int skip;
int dcache, gcache;
dcache = GFXdCacheEnt (cacheEnts);
gcache = GFXgCacheEnt (cacheEnts);
skip = 0;
if (dcache == GFXCacheNone)
{
memcpy (drawp, after, sizeof (Drawable));
push (DrawableCache(client), *drawp);
after += sizeof (Drawable);
skip += sizeof (Drawable);
}
else
*drawp = use (DrawableCache(client), dcache);
if (gcache == GFXCacheNone)
{
memcpy (gcp, after, sizeof (GContext));
push (GContextCache(client), *gcp);
skip += sizeof (GContext);
}
else
*gcp = use (GContextCache(client), gcache);
return skip;
}
static int
LbxDecodeDrawableCache(ClientPtr client,
CARD8 cacheEnts,
char *after,
Drawable *drawp)
{
int skip;
int dcache;
dcache = GFXdCacheEnt (cacheEnts);
skip = 0;
if (dcache == GFXCacheNone)
{
memcpy (drawp, after, sizeof (Drawable));
push (DrawableCache(client), *drawp);
after += sizeof (Drawable);
skip += sizeof (Drawable);
}
else
*drawp = use (DrawableCache(client), dcache);
return skip;
}
#ifdef notyet
static int
LbxDecodeGCCache(ClientPtr client,
CARD8 cacheEnts,
char *after,
GContext *gcp)
{
int skip;
int gcache;
gcache = GFXgCacheEnt (cacheEnts);
skip = 0;
if (gcache == GFXCacheNone)
{
memcpy (gcp, after, sizeof (GContext));
push (GContextCache(client), *gcp);
after += sizeof (GContext);
skip += sizeof (GContext);
}
else
*gcp = use (GContextCache(client), gcache);
return skip;
}
#endif
#define GFX_GET_DRAWABLE_AND_GC(type,in,len) {\
int skip; \
len = (client->req_len << 2) - SIZEOF(type); \
in = ((char *) stuff) + SIZEOF(type);\
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
&drawable, &gc); \
in += skip; \
len -= skip; \
}
#define GFX_GET_DST_DRAWABLE_AND_GC(type,in,len) {\
int skip; \
len = (client->req_len << 2) - SIZEOF(type); \
in = ((char *) stuff) + SIZEOF(type);\
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
&dstDrawable, &gc); \
in += skip; \
len -= skip; \
}
#define GFX_GET_SRC_DST_DRAWABLE_AND_GC(type, in, len) { \
int skip; \
len = (client->req_len << 2) - SIZEOF(type); \
in = ((char *) stuff) + SIZEOF(type); \
skip = LbxDecodeDrawableCache(client, stuff->srcCache, in, \
&srcDrawable); \
in += skip; \
len -= skip; \
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
&dstDrawable, &gc); \
in += skip; \
len -= skip; \
}
#define GFX_GET_GC(type, in, len) { \
int skip; \
len = (client->req_len << 2) - SIZEOF(type); \
in = ((char *) stuff) + SIZEOF(type); \
skip = LbxDecodeGCCache(client, stuff->gcCache, in, &gc); \
in += skip; \
len -= skip; \
}
int
LbxDecodePoly(ClientPtr client,
CARD8 xreqtype,
int (*decode_rtn)(char *, char *, short *))
{
REQUEST(xLbxPolyPointReq);
char *in;
xPolyPointReq *xreq;
int len;
int retval;
Drawable drawable;
GContext gc;
GFX_GET_DRAWABLE_AND_GC(xLbxPolyPointReq, in, len);
if ((xreq = (xPolyPointReq *)
xalloc(sizeof(xPolyPointReq) + (len << 1))) == NULL)
return BadAlloc;
len = (*decode_rtn)(in, in + len - stuff->padBytes, (short *)(&xreq[1]));
xreq->reqType = xreqtype;
xreq->coordMode = 1;
xreq->drawable = drawable;
xreq->gc = gc;
xreq->length = client->req_len = (sizeof(xPolyPointReq) + len) >> 2;
client->requestBuffer = (pointer)xreq;
retval = (*ProcVector[xreqtype])(client);
xfree(xreq);
return retval;
}
int
LbxDecodeFillPoly(ClientPtr client)
{
REQUEST(xLbxFillPolyReq);
char *in;
xFillPolyReq *xreq;
int len;
int retval;
Drawable drawable;
GContext gc;
GFX_GET_DRAWABLE_AND_GC(xLbxFillPolyReq, in, len);
if ((xreq = (xFillPolyReq *)
xalloc(sizeof(xFillPolyReq) + (len << 1))) == NULL)
return BadAlloc;
len = LbxDecodePoints(in, in + len - stuff->padBytes, (short *) &xreq[1]);
xreq->reqType = X_FillPoly;
xreq->drawable = drawable;
xreq->gc = gc;
xreq->shape = stuff->shape;
xreq->coordMode = 1;
xreq->length = client->req_len = (sizeof(xFillPolyReq) + len) >> 2;
client->requestBuffer = (pointer)xreq;
retval = (*ProcVector[X_FillPoly])(client);
xfree(xreq);
return retval;
}
/*
* Routines for decoding line drawing requests
*/
#define DECODE_PSHORT(in, val) \
if ((*(in) & 0xf0) != 0xf0) \
(val) = *(CARD8 *)(in)++; \
else { \
(val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
if ((val) >= 0xe00) \
(val) -= 0x1000; \
else \
(val) += 0xf0; \
(in) += 2; \
}
#define DECODE_SHORT(in, val) \
if ((*(in) & 0xf0) != 0x80) \
(val) = *(INT8 *)(in)++; \
else { \
(val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
if ((val) & 0x0800) \
(val) = ((val) | 0xf000) - 0x70; \
else \
(val) += 0x80; \
(in) += 2; \
}
#define DECODE_USHORT(in, val) \
if ((*(in) & 0xf0) != 0xf0) \
(val) = *(CARD8 *)(in)++; \
else { \
(val) = (((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1)) + 0xf0; \
(in) += 2; \
}
#define DECODE_ANGLE(in, val) \
if (*(INT8 *)(in) >= 0x6e) \
(val) = (*(INT8 *)(in)++ - 0x67) * (15 << 6); \
else if (*(INT8 *)(in) >= 0x5a) \
(val) = (*(INT8 *)(in)++ - 0x5a) * (5 << 6); \
else if (*(INT8 *)(in) <= (INT8)0x91) \
(val) = (*(INT8 *)(in)++ - (INT8)0x98) * (15 << 6); \
else if (*(INT8 *)(in) <= (INT8)0xa5) \
(val) = (*(INT8 *)(in)++ - (INT8)0xa6) * (5 << 6); \
else { \
(val) = (*(CARD8 *)(in) << 8) | *(CARD8 *)((in) + 1); \
(in) += 2; \
}
int
LbxDecodePoints(char *in,
char *inend,
short *out)
{
char *start_out = (char *)out;
while (in < inend) {
DECODE_SHORT(in, *out);
out++;
DECODE_SHORT(in, *out);
out++;
}
return ((char *)out - start_out);
}
int
LbxDecodeSegment(char *in,
char *inend,
short *out)
{
short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
while (in < inend) {
DECODE_SHORT(in, diff);
*out = last_x + diff;
last_x += diff;
out++;
DECODE_SHORT(in, diff);
*out = last_y + diff;
last_y += diff;
out++;
DECODE_SHORT(in, diff);
*out = last_x + diff;
out++;
DECODE_SHORT(in, diff);
*out = last_y + diff;
out++;
}
return ((char *)out - start_out);
}
int
LbxDecodeRectangle(char *in,
char *inend,
short *out)
{
short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
while (in < inend) {
DECODE_SHORT(in, diff);
*out = last_x + diff;
last_x += diff;
out++;
DECODE_SHORT(in, diff);
*out = last_y + diff;
last_y += diff;
out++;
DECODE_USHORT(in, *(unsigned short *)out);
out++;
DECODE_USHORT(in, *(unsigned short *)out);
out++;
}
return ((char *)out - start_out);
}
int
LbxDecodeArc(char *in,
char *inend,
short *out)
{
short diff;
short last_x = 0;
short last_y = 0;
char *start_out = (char *)out;
while (in < inend) {
DECODE_SHORT(in, diff);
*out = last_x + diff;
last_x += diff;
out++;
DECODE_SHORT(in, diff);
*out = last_y + diff;
last_y += diff;
out++;
DECODE_USHORT(in, *(unsigned short *)out);
out++;
DECODE_USHORT(in, *(unsigned short *)out);
out++;
DECODE_ANGLE(in, *out);
out++;
DECODE_ANGLE(in, *out);
out++;
}
return ((char *)out - start_out);
}
int
LbxDecodeCopyArea (ClientPtr client)
{
REQUEST(xLbxCopyAreaReq);
char *in;
xCopyAreaReq req;
int len;
Drawable srcDrawable, dstDrawable;
GContext gc;
GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyAreaReq, in, len);
req.reqType = X_CopyArea;
req.length = client->req_len = SIZEOF(xCopyAreaReq) >> 2;
req.srcDrawable = srcDrawable;
req.dstDrawable = dstDrawable;
req.gc = gc;
DECODE_PSHORT (in, req.srcX);
DECODE_PSHORT (in, req.srcY);
DECODE_PSHORT (in, req.dstX);
DECODE_PSHORT (in, req.dstY);
DECODE_USHORT (in, req.width);
DECODE_USHORT (in, req.height);
client->requestBuffer = (pointer) &req;
return (*ProcVector[X_CopyArea])(client);
}
int
LbxDecodeCopyPlane (ClientPtr client)
{
REQUEST(xLbxCopyPlaneReq);
char *in;
xCopyPlaneReq req;
int len;
Drawable srcDrawable, dstDrawable;
GContext gc;
GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyPlaneReq, in, len);
req.reqType = X_CopyPlane;
req.length = client->req_len = SIZEOF(xCopyPlaneReq) >> 2;
req.srcDrawable = srcDrawable;
req.dstDrawable = dstDrawable;
req.gc = gc;
DECODE_PSHORT (in, req.srcX);
DECODE_PSHORT (in, req.srcY);
DECODE_PSHORT (in, req.dstX);
DECODE_PSHORT (in, req.dstY);
DECODE_USHORT (in, req.width);
DECODE_USHORT (in, req.height);
req.bitPlane = stuff->bitPlane;
client->requestBuffer = (pointer) &req;
return (*ProcVector[X_CopyPlane])(client);
}
static pointer
get_gfx_buffer(ClientPtr client,
int len)
{
LbxClientPtr lbxClient = LbxClient(client);
pointer tmp;
/* XXX should probably shrink this sucker too */
if (len > lbxClient->gb_size) {
tmp = (pointer) xrealloc(lbxClient->gfx_buffer, len);
if (!tmp)
return (pointer) NULL;
lbxClient->gfx_buffer = tmp;
lbxClient->gb_size = len;
}
return lbxClient->gfx_buffer;
}
int
LbxDecodePolyText (ClientPtr client)
{
REQUEST(xLbxPolyTextReq);
char *in, *pos;
xPolyTextReq *xreq;
int len;
Drawable drawable;
GContext gc;
GFX_GET_DRAWABLE_AND_GC(xLbxPolyTextReq, in, len);
xreq = (xPolyTextReq *) get_gfx_buffer(client, sizeof (xPolyTextReq) + len);
if (!xreq)
return BadAlloc;
xreq->reqType = stuff->lbxReqType == X_LbxPolyText8? X_PolyText8 : X_PolyText16;
xreq->drawable = drawable;
xreq->gc = gc;
pos = in;
DECODE_PSHORT(in, xreq->x);
DECODE_PSHORT(in, xreq->y);
len -= (in - pos);
memmove ((char *) (xreq + 1), in, len);
xreq->length = client->req_len = (sizeof (xPolyTextReq) + len) >> 2;
client->requestBuffer = (pointer) xreq;
return (*ProcVector[xreq->reqType])(client);
}
int
LbxDecodeImageText (ClientPtr client)
{
REQUEST(xLbxImageTextReq);
char *in, *pos;
xImageTextReq *xreq;
int len;
Drawable drawable;
GContext gc;
GFX_GET_DRAWABLE_AND_GC(xLbxImageTextReq, in, len);
xreq = (xImageTextReq *) get_gfx_buffer(client, sizeof (xImageTextReq) + len);
if (!xreq)
return BadAlloc;
xreq->reqType = stuff->lbxReqType == X_LbxImageText8? X_ImageText8 : X_ImageText16;
xreq->drawable = drawable;
xreq->gc = gc;
xreq->nChars = stuff->nChars;
pos = in;
DECODE_PSHORT(in, xreq->x);
DECODE_PSHORT(in, xreq->y);
len -= (in - pos);
memmove ((char *) (xreq + 1), in, len);
xreq->length = client->req_len = (sizeof (xImageTextReq) + len) >> 2;
client->requestBuffer = (pointer) xreq;
return (*ProcVector[xreq->reqType])(client);
}
int
LbxDecodePutImage (ClientPtr client)
{
REQUEST (xLbxPutImageReq);
char *in, *data;
xPutImageReq xreq;
int ppl, bpl, nbytes;
int retval;
int n;
xreq.reqType = X_PutImage;
in = (char *) stuff + sz_xLbxPutImageReq;
if (stuff->bitPacked & 0x80) {
xreq.format = (stuff->bitPacked >> 5) & 0x3;
xreq.depth = ((stuff->bitPacked >> 2) & 0x7) + 1;
xreq.leftPad = 0;
} else {
xreq.depth = (stuff->bitPacked >> 2) + 1;
xreq.format = (*in >> 5) & 0x3;
xreq.leftPad = *in++ & 0x1f;
}
DECODE_USHORT(in, xreq.width);
DECODE_USHORT(in, xreq.height);
DECODE_PSHORT(in, xreq.dstX);
DECODE_PSHORT(in, xreq.dstY);
if (client->swapped) {
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone ||
GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (in, n);
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone &&
GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (in + 4, n);
}
}
in += LbxDecodeGFXCache(client, stuff->cacheEnts, in,
&xreq.drawable, &xreq.gc);
ppl = xreq.width + xreq.leftPad;
if (xreq.format != ZPixmap ||
(xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1)) {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
bpl = BitmapBytePadProto(ppl);
#else
bpl = BitmapBytePad(ppl);
#endif
nbytes = bpl;
if (xreq.format == XYPixmap)
nbytes *= xreq.depth;
} else {
#ifdef INTERNAL_VS_EXTERNAL_PADDING
bpl = PixmapBytePadProto(ppl, xreq.depth);
#else
bpl = PixmapBytePad(ppl, xreq.depth);
#endif
nbytes = bpl;
}
nbytes *= xreq.height;
xreq.length = ((nbytes + 3) >> 2) + (sz_xPutImageReq >> 2);
/* +1 is because fillspan in DecodeFaxG42D seems to go 1 byte too far,
* and I don't want to mess with that code */
if ((data = (char *) xalloc ((xreq.length << 2) + 1)) == NULL)
return BadAlloc;
*((xPutImageReq *)data) = xreq;
if (!stuff->compressionMethod)
{
memcpy(data + sz_xPutImageReq, in, nbytes);
}
else if (xreq.format != ZPixmap ||
(xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1))
{
LbxBitmapCompMethod *compMethod;
compMethod = LbxSrvrLookupBitmapCompMethod (LbxProxy(client),
stuff->compressionMethod);
if (!compMethod)
{
xfree (data);
return (BadValue);
}
else
{
if (!compMethod->inited)
{
if (compMethod->compInit)
(*compMethod->compInit)();
compMethod->inited = 1;
}
(*compMethod->decompFunc) (
(unsigned char *) in, (unsigned char *) data + sz_xPutImageReq,
nbytes,
#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
(ppl + BITMAP_SCANLINE_UNIT - 1) & ~BITMAP_SCANLINE_UNIT,
#else
ppl,
#endif
bpl,
((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst);
}
}
else
{
LbxPixmapCompMethod *compMethod;
compMethod = LbxSrvrLookupPixmapCompMethod (LbxProxy(client),
stuff->compressionMethod);
if (!compMethod)
{
xfree (data);
return (BadValue);
}
else
{
if (!compMethod->inited)
{
if (compMethod->compInit)
(*compMethod->compInit)();
compMethod->inited = 1;
}
(*compMethod->decompFunc) (
in, (char *) data + sz_xPutImageReq,
(int) xreq.height, bpl);
}
}
client->req_len = xreq.length;
client->requestBuffer = (pointer) data;
retval = (*ProcVector[X_PutImage])(client);
xfree(data);
return retval;
}
int
LbxDecodeGetImage (ClientPtr client)
{
REQUEST (xLbxGetImageReq);
xLbxGetImageReply *reply = NULL;
int lbxLen, xLen, n;
int method = 0, bytes, status;
xGetImageReply *theImage;
REQUEST_SIZE_MATCH(xLbxGetImageReq);
status = DoGetImage(client, stuff->format, stuff->drawable,
stuff->x, stuff->y,
(int)stuff->width, (int)stuff->height,
stuff->planeMask, &theImage);
if (status != Success)
return (status);
if ((reply = (xLbxGetImageReply *) xalloc (
sz_xLbxGetImageReply + theImage->length)) == NULL)
{
xfree(theImage);
return (BadAlloc);
}
if (stuff->format != ZPixmap ||
(theImage->depth == 1 && screenInfo.formats->bitsPerPixel == 1))
{
LbxBitmapCompMethod *compMethod;
compMethod = LbxSrvrFindPreferredBitmapCompMethod (LbxProxy(client));
if (!compMethod)
status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
else
{
if (!compMethod->inited)
{
if (compMethod->compInit)
(*compMethod->compInit)();
compMethod->inited = 1;
}
status = (*compMethod->compFunc) (
(unsigned char *) &theImage[1],
(unsigned char *) &reply[1],
theImage->length,
theImage->length,
#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
(int) (stuff->width + BITMAP_SCANLINE_UNIT - 1) &
~BITMAP_SCANLINE_UNIT,
#else
(int) stuff->width,
#endif
#ifdef INTERNAL_VS_EXTERNAL_PADDING
BitmapBytePadProto(stuff->width),
#else
BitmapBytePad(stuff->width),
#endif
((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst,
&bytes);
method = compMethod->methodOpCode;
}
}
else
{
LbxPixmapCompMethod *compMethod;
compMethod = LbxSrvrFindPreferredPixmapCompMethod (
LbxProxy(client), (int) stuff->format, theImage->depth);
if (!compMethod)
status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
else
{
if (!compMethod->inited)
{
if (compMethod->compInit)
(*compMethod->compInit)();
compMethod->inited = 1;
}
status = (*compMethod->compFunc) (
(char *) &theImage[1],
(char *) &reply[1],
theImage->length,
(int) stuff->format,
theImage->depth,
(int) stuff->height,
#ifdef INTERNAL_VS_EXTERNAL_PADDING
PixmapBytePadProto(stuff->width, theImage->depth),
#else
PixmapBytePad(stuff->width, theImage->depth),
#endif
&bytes);
method = compMethod->methodOpCode;
}
}
reply->type = X_Reply;
reply->depth = theImage->depth;
reply->sequenceNumber = client->sequence;
reply->visual = theImage->visual;
reply->pad1 = reply->pad2 = reply->pad3 = reply->pad4 = reply->pad5 = 0;
if (status != LBX_IMAGE_COMPRESS_SUCCESS)
{
reply->compressionMethod = LbxImageCompressNone;
reply->lbxLength = reply->xLength = (theImage->length + 3) >> 2;
}
else
{
reply->compressionMethod = method;
reply->lbxLength = (bytes + 3) >> 2;
reply->xLength = (theImage->length + 3) >> 2;
}
lbxLen = reply->lbxLength;
xLen = reply->xLength;
if (client->swapped)
{
swaps (&reply->sequenceNumber, n);
swapl (&reply->lbxLength, n);
swapl (&reply->xLength, n);
swapl (&reply->visual, n);
}
if (reply->compressionMethod != LbxImageCompressNone)
{
/*
* If the compressed image is greater that 25% of the original
* image, run the GetImage reply through the regular stream
* compressor. Otherwise, just write the compressed image.
*/
if (lbxLen > (xLen / 4))
{
WriteToClient (client,
sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
}
else
{
UncompressedWriteToClient (client,
sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
}
}
else
{
/*
* Write back the original uncompressed image.
*/
WriteToClient (client, sz_xLbxGetImageReply, (char *)reply);
WriteToClient (client, lbxLen << 2, (char *)&theImage[1]);
}
xfree (theImage);
if (reply)
xfree ((char *) reply);
return (Success);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,806 +0,0 @@
/* $Xorg: lbxopts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.5 2001/01/17 22:37:00 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef OPTDEBUG
#include <stdio.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "colormapst.h"
#include "propertyst.h"
#include "lbxserve.h"
#include <X11/extensions/lbxstr.h>
#include <X11/extensions/lbximage.h>
#include <X11/extensions/lbxopts.h>
#include "lbxsrvopts.h"
#ifndef NO_ZLIB
#include <X11/extensions/lbxzlib.h>
#endif /* NO_ZLIB */
static int LbxProxyDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int LbxServerDeltaOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int LbxDeltaOpt ( unsigned char *popt, int optlen,
unsigned char *preply, short *pn, short *pmaxlen );
static int LbxStreamCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int ZlibParse ( LbxNegOptsPtr pno, unsigned char *popt, int optlen,
unsigned char *preply );
static int LbxMessageCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int LbxUseTagsOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int LbxBitmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int LbxPixmapCompOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
static int MergeDepths ( int *depths, LbxPixmapCompMethod *method );
static int LbxCmapAllOpt ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
/*
* List of LBX options we recognize and are willing to negotiate
*/
static struct _LbxOptionParser {
CARD8 optcode;
int (*parser)(LbxNegOptsPtr, unsigned char *,
int, unsigned char *);
} LbxOptions[] = {
{ LBX_OPT_DELTA_PROXY, LbxProxyDeltaOpt },
{ LBX_OPT_DELTA_SERVER, LbxServerDeltaOpt },
{ LBX_OPT_STREAM_COMP, LbxStreamCompOpt },
{ LBX_OPT_BITMAP_COMP, LbxBitmapCompOpt },
{ LBX_OPT_PIXMAP_COMP, LbxPixmapCompOpt },
{ LBX_OPT_MSG_COMP, LbxMessageCompOpt },
{ LBX_OPT_USE_TAGS, LbxUseTagsOpt },
{ LBX_OPT_CMAP_ALL, LbxCmapAllOpt }
};
#define LBX_N_OPTS (sizeof(LbxOptions) / sizeof(struct _LbxOptionParser))
/*
* Set option defaults
*/
void
LbxOptionInit(LbxNegOptsPtr pno)
{
bzero(pno, sizeof(LbxNegOptsRec));
pno->proxyDeltaN = pno->serverDeltaN = LBX_OPT_DELTA_NCACHE_DFLT;
pno->proxyDeltaMaxLen = pno->serverDeltaMaxLen = LBX_OPT_DELTA_MSGLEN_DFLT;
pno->squish = TRUE;
pno->numBitmapCompMethods = 0;
pno->bitmapCompMethods = NULL;
pno->numPixmapCompMethods = 0;
pno->pixmapCompMethods = NULL;
pno->pixmapCompDepths = NULL;
pno->useTags = TRUE;
}
int
LbxOptionParse(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
int i;
int nopts = *popt++;
unsigned char *pout = preply;
for (i = 0; i < nopts; i++) {
int j;
int len;
int hdrlen;
int replylen;
LBX_OPT_DECODE_LEN(popt + 1, len, hdrlen);
if (len < ++hdrlen || len > optlen) {
#ifdef OPTDEBUG
fprintf(stderr, "bad option length, len = %d, hdrlen = %d, optlen = %d\n", len, hdrlen, optlen);
#endif
return -1;
}
for (j = 0; j < LBX_N_OPTS; j++) {
if (popt[0] == LbxOptions[j].optcode) {
replylen = (*LbxOptions[j].parser)(pno,
popt + hdrlen,
len - hdrlen,
pout + LBX_OPT_SMALLHDR_LEN);
if (replylen < 0)
return -1;
else if (replylen > 0) {
/*
* None of the current options require big headers,
* so this works for now.
*/
*pout++ = i;
*pout++ = LBX_OPT_SMALLHDR_LEN + replylen;
pout += replylen;
pno->nopts++;
}
break;
}
}
optlen -= len;
popt += len;
}
return (pout - preply);
}
static int
LbxProxyDeltaOpt(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
return LbxDeltaOpt(popt, optlen, preply,
&pno->proxyDeltaN, &pno->proxyDeltaMaxLen);
}
static int
LbxServerDeltaOpt(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
return LbxDeltaOpt(popt, optlen, preply,
&pno->serverDeltaN, &pno->serverDeltaMaxLen);
}
static int
LbxDeltaOpt(unsigned char *popt,
int optlen,
unsigned char *preply,
short *pn,
short *pmaxlen)
{
short n;
short maxlen;
/*
* If there's more data than we expect, we just ignore it.
*/
if (optlen < LBX_OPT_DELTA_REQLEN) {
#ifdef OPTDEBUG
fprintf(stderr, "bad delta option length = %d\n", optlen);
#endif
return -1;
}
/*
* Accept whatever value the proxy prefers, so skip the
* min/max offerings. Note that the max message len value is
* encoded as the number of 4-byte values.
*/
popt += 2;
n = *popt++;
popt += 2;
maxlen = *popt++;
if ((maxlen <<= 2) == 0)
n = 0;
else if (maxlen < 32) {
#ifdef OPTDEBUG
fprintf(stderr, "bad delta max msg length %d\n", maxlen);
#endif
return -1;
}
/*
* Put the response in the reply buffer
*/
*preply++ = n;
*preply++ = maxlen >> 2;
*pn = n;
*pmaxlen = maxlen;
return LBX_OPT_DELTA_REPLYLEN;
}
static struct _LbxStreamCompParser {
int typelen;
char *type;
int (*parser)(LbxNegOptsPtr, unsigned char *,
int, unsigned char *);
} LbxStreamComp[] = {
#ifndef NO_ZLIB
{ ZLIB_STRCOMP_OPT_LEN, ZLIB_STRCOMP_OPT, ZlibParse },
#endif /* NO_ZLIB */
};
#define LBX_N_STRCOMP \
(sizeof(LbxStreamComp) / sizeof(struct _LbxStreamCompParser))
static int
LbxStreamCompOpt(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
int i;
int typelen;
int nopts = *popt++;
for (i = 0; i < nopts; i++) {
int j;
int len;
int lensize;
int replylen;
typelen = popt[0];
for (j = 0; j < LBX_N_STRCOMP; j++) {
if (typelen == LbxStreamComp[j].typelen &&
!strncmp((char *) popt + 1, LbxStreamComp[j].type, typelen))
break;
}
popt += 1 + typelen;
optlen -= 1 + typelen;
LBX_OPT_DECODE_LEN(popt, len, lensize);
if (j < LBX_N_STRCOMP) {
if (len > optlen)
return -1;
replylen = (*LbxStreamComp[j].parser)(pno,
popt + lensize,
len - lensize,
preply + 1);
if (replylen == -1)
return -1;
else if (replylen >= 0) {
*preply = i;
return replylen + 1;
}
}
optlen -= len;
popt += len;
}
return 0;
}
static int
ZlibParse(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
int level; /* compression level */
if (*popt++ != 1) /* length should be 1 */
return (-1);
level = *popt;
if (level < 1 || level > 9)
return (-1);
pno->streamOpts.streamCompInit =
(LbxStreamCompHandle (*)(int, pointer))ZlibInit;
pno->streamOpts.streamCompArg = (pointer)(long)level;
pno->streamOpts.streamCompStuffInput = ZlibStuffInput;
pno->streamOpts.streamCompInputAvail = ZlibInputAvail;
pno->streamOpts.streamCompFlush = ZlibFlush;
pno->streamOpts.streamCompRead = ZlibRead;
pno->streamOpts.streamCompWriteV = ZlibWriteV;
pno->streamOpts.streamCompOn = ZlibCompressOn;
pno->streamOpts.streamCompOff = ZlibCompressOff;
pno->streamOpts.streamCompFreeHandle =
(void (*)(LbxStreamCompHandle))ZlibFree;
return (0);
}
static int
LbxMessageCompOpt(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
if (optlen == 0) {
#ifdef OPTDEBUG
fprintf(stderr, "bad message-comp option length specified %d\n", optlen);
#endif
return -1;
}
pno->squish = *preply = *popt;
return 1;
}
static int
LbxUseTagsOpt(LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
if (optlen == 0) {
#ifdef OPTDEBUG
fprintf(stderr, "bad use-tags option length specified %d\n", optlen);
#endif
return -1;
}
pno->useTags = *preply = *popt;
return 1;
}
/*
* Option negotiation for image compression
*/
LbxBitmapCompMethod
LbxBitmapCompMethods [] = {
{
"XC-FaxG42D", /* compression method name */
0, /* inited */
2, /* method opcode */
NULL, /* init function */
LbxImageEncodeFaxG42D, /* encode function */
LbxImageDecodeFaxG42D /* decode function */
}
};
#define NUM_BITMAP_METHODS \
(sizeof (LbxBitmapCompMethods) / sizeof (LbxBitmapCompMethod))
#if 1
/*
* Currently, we don't support any pixmap compression algorithms
* because regular stream compression does much better than PackBits.
* If we want to plug in a better pixmap image compression algorithm,
* it would go here.
*/
#define NUM_PIXMAP_METHODS 0
LbxPixmapCompMethod LbxPixmapCompMethods [1]; /* dummy */
#else
LbxPixmapCompMethod
LbxPixmapCompMethods [] = {
{
"XC-PackBits", /* compression method name */
1 << ZPixmap, /* formats supported */
1, {8}, /* depths supported */
0, /* inited */
1, /* method opcode */
NULL, /* init function */
LbxImageEncodePackBits, /* encode function */
LbxImageDecodePackBits /* decode function */
}
};
#define NUM_PIXMAP_METHODS \
(sizeof (LbxPixmapCompMethods) / sizeof (LbxPixmapCompMethod))
#endif
static int
LbxImageCompOpt (Bool pixmap,
LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
unsigned char *preplyStart = preply;
int numMethods = *popt++;
unsigned char *myIndices, *hisIndices;
unsigned int *retFormats = NULL;
int **retDepths = NULL;
int replyCount = 0;
int status, i, j;
if (numMethods == 0)
{
if (pixmap)
pno->numPixmapCompMethods = 0;
else
pno->numBitmapCompMethods = 0;
*preply++ = 0;
return (1);
}
myIndices = (unsigned char *) xalloc (numMethods);
hisIndices = (unsigned char *) xalloc (numMethods);
if (!myIndices || !hisIndices)
{
if (myIndices)
xfree (myIndices);
if (hisIndices)
xfree (hisIndices);
return -1;
}
if (pixmap)
{
retFormats = (unsigned *) xalloc (numMethods);
retDepths = (int **) xalloc (numMethods * sizeof (int *));
if (!retFormats || !retDepths)
{
if (retFormats)
xfree (retFormats);
if (retDepths)
xfree (retDepths);
xfree (myIndices);
xfree (hisIndices);
return -1;
}
}
/*
* For each method in the list sent by the proxy, see if the server
* supports this method. If YES, update the following lists:
*
* myIndices[] is a list of indices into the server's
* LbxBit[Pix]mapCompMethods table.
*
* hisIndices[] is a list of indices into the list of
* method names sent by the proxy.
*
* retFormats[] indicates for each pixmap compression method,
* the pixmap formats supported.
*
* retDepths[] indicates for each pixmap compression method,
* the pixmap depths supported.
*/
for (i = 0; i < numMethods; i++)
{
unsigned int formatMask = 0, newFormatMask = 0;
int depthCount, *depths = NULL, len;
int freeDepths;
char *methodName;
freeDepths = 0;
len = *popt++;
methodName = (char *) popt;
popt += len;
if (pixmap)
{
formatMask = *popt++;
depthCount = *popt++;
depths = (int *) xalloc ((depthCount + 1) * sizeof (int));
freeDepths = 1;
depths[0] = depthCount;
for (j = 1; j <= depthCount; j++)
depths[j] = *popt++;
}
for (j = 0;
j < (pixmap ? NUM_PIXMAP_METHODS : NUM_BITMAP_METHODS); j++)
{
status = strncmp (methodName,
(pixmap ? LbxPixmapCompMethods[j].methodName :
LbxBitmapCompMethods[j].methodName),
len);
if (status == 0 && pixmap)
{
newFormatMask =
formatMask & LbxPixmapCompMethods[j].formatMask;
depthCount = MergeDepths (depths, &LbxPixmapCompMethods[j]);
if (newFormatMask == 0 || depthCount == 0)
status = 1;
}
if (status == 0)
{
myIndices[replyCount] = j;
hisIndices[replyCount] = i;
if (pixmap)
{
retFormats[replyCount] = newFormatMask;
retDepths[replyCount] = depths;
freeDepths = 0;
}
replyCount++;
break;
}
}
if (freeDepths)
xfree (depths);
}
*preply++ = replyCount;
/*
* Sort the lists by LBX server preference (increasing myIndices[] vals)
*/
for (i = 0; i <= replyCount - 2; i++)
for (j = replyCount - 1; j >= i; j--)
if (myIndices[j - 1] > myIndices[j])
{
char temp1 = myIndices[j - 1];
char temp2 = hisIndices[j - 1];
myIndices[j - 1] = myIndices[j];
myIndices[j] = temp1;
hisIndices[j - 1] = hisIndices[j];
hisIndices[j] = temp2;
if (pixmap)
{
unsigned temp3 = retFormats[j - 1];
int *temp4 = retDepths[j - 1];
retFormats[j - 1] = retFormats[j];
retFormats[j] = temp3;
retDepths[j - 1] = retDepths[j];
retDepths[j] = temp4;
}
}
/*
* For each method supported, return to the proxy an index into
* the list sent by the proxy, the opcode to be used for the method,
* the pixmap formats supported, and the list of depths supported.
*/
for (i = 0; i < replyCount; i++)
{
*preply++ = hisIndices[i];
if (pixmap)
{
int left;
*preply++ = LbxPixmapCompMethods[myIndices[i]].methodOpCode;
*preply++ = retFormats[i];
*preply++ = left = retDepths[i][0];
j = 1;
while (left > 0)
{
*preply++ = retDepths[i][j];
left--;
}
}
else
{
*preply++ = LbxBitmapCompMethods[myIndices[i]].methodOpCode;
}
}
if (pixmap)
{
pno->numPixmapCompMethods = replyCount;
pno->pixmapCompMethods = myIndices;
pno->pixmapCompDepths = retDepths;
}
else
{
pno->numBitmapCompMethods = replyCount;
pno->bitmapCompMethods = myIndices;
}
if (hisIndices)
xfree (hisIndices);
if (pixmap)
{
if (retFormats)
xfree (retFormats);
}
return (preply - preplyStart);
}
static int
LbxBitmapCompOpt (LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
return (LbxImageCompOpt (0 /* bitmap */, pno, popt, optlen, preply));
}
static int
LbxPixmapCompOpt (LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
return (LbxImageCompOpt (1 /* Pixmap */, pno, popt, optlen, preply));
}
LbxBitmapCompMethod *
LbxSrvrLookupBitmapCompMethod (LbxProxyPtr proxy,
int methodOpCode)
{
int i;
for (i = 0; i < proxy->numBitmapCompMethods; i++)
{
LbxBitmapCompMethod *method;
method = &LbxBitmapCompMethods[proxy->bitmapCompMethods[i]];
if (method->methodOpCode == methodOpCode)
return (method);
}
return (NULL);
}
LbxPixmapCompMethod *
LbxSrvrLookupPixmapCompMethod (LbxProxyPtr proxy,
int methodOpCode)
{
int i;
for (i = 0; i < proxy->numPixmapCompMethods; i++)
{
LbxPixmapCompMethod *method;
method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
if (method->methodOpCode == methodOpCode)
return (method);
}
return (NULL);
}
LbxBitmapCompMethod *
LbxSrvrFindPreferredBitmapCompMethod (LbxProxyPtr proxy)
{
if (proxy->numBitmapCompMethods == 0)
return NULL;
else
return (&LbxBitmapCompMethods[proxy->bitmapCompMethods[0]]);
}
LbxPixmapCompMethod *
LbxSrvrFindPreferredPixmapCompMethod (LbxProxyPtr proxy,
int format,
int depth)
{
if (proxy->numPixmapCompMethods == 0)
return NULL;
else
{
LbxPixmapCompMethod *method;
int i, j;
for (i = 0; i < proxy->numPixmapCompMethods; i++)
{
method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
if ((method->formatMask & (1 << format)))
{
int n = proxy->pixmapCompDepths[i][0];
j = 1;
while (n > 0)
{
if (depth == proxy->pixmapCompDepths[i][j])
return method;
else
n--;
}
}
}
return NULL;
}
}
static int
MergeDepths (int *depths,
LbxPixmapCompMethod *method)
{
int i, j, count;
int temp[LBX_MAX_DEPTHS + 1];
temp[0] = count = 0;
for (i = 1; i <= depths[0]; i++)
{
for (j = 0; j < method->depthCount; j++)
if (method->depths[j] == depths[i])
{
temp[0]++;
temp[++count] = depths[i];
break;
}
}
memcpy (depths, temp, (count + 1) * sizeof (int));
return (count);
}
#define LbxCmapAllMethod "XC-CMAP"
static int
LbxCmapAllOpt (LbxNegOptsPtr pno,
unsigned char *popt,
int optlen,
unsigned char *preply)
{
int numMethods = *popt++;
int i;
for (i = 0; i < numMethods; i++)
{
int len;
char *methodName;
len = *popt++;
methodName = (char *) popt;
popt += len;
if (!strncmp(methodName, LbxCmapAllMethod, len))
break;
}
if (i >= numMethods)
i = 0; /* assume first one is proxy's favorite */
*preply = i;
return 1;
}

View File

@ -1,549 +0,0 @@
/* $Xorg: lbxprop.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1986, 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.
*/
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.4 2001/05/15 10:19:43 eich Exp $ */
/* various bits of DIX-level mangling */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "servermd.h"
#include "propertyst.h"
#include "colormapst.h"
#include "windowstr.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "lbxserve.h"
#include "lbxtags.h"
#include <X11/Xfuncproto.h>
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
#include "swaprep.h"
void
LbxStallPropRequest(ClientPtr client,
PropertyPtr pProp)
{
xReq *req = (xReq *) client->requestBuffer;
register char n;
LbxQueryTagData(client, pProp->owner_pid,
pProp->tag_id, LbxTagTypeProperty);
/*
* Before we reset the request, we must make sure
* it is in the client's byte order.
*/
if (client->swapped) {
if (req->reqType == X_ChangeProperty) {
xChangePropertyReq *stuff = (xChangePropertyReq *) req;
swaps(&stuff->length, n);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->nUnits, n);
switch ( stuff->format ) {
case 16:
SwapRestS(stuff);
break;
case 32:
SwapRestL(stuff);
break;
}
} else if (req->reqType == X_GetProperty) {
xGetPropertyReq *stuff = (xGetPropertyReq *) req;
swaps(&stuff->length, n);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->longOffset, n);
swapl(&stuff->longLength, n);
} else if (req->data == X_LbxChangeProperty) {
xLbxChangePropertyReq *stuff = (xLbxChangePropertyReq *) req;
swaps(&stuff->length, n);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->nUnits, n);
} else if (req->data == X_LbxGetProperty) {
xLbxGetPropertyReq *stuff = (xLbxGetPropertyReq *) req;
swaps(&stuff->length, n);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->longOffset, n);
swapl(&stuff->longLength, n);
}
}
ResetCurrentRequest(client);
client->sequence--;
IgnoreClient(client);
}
int
LbxChangeWindowProperty(ClientPtr client,
WindowPtr pWin,
Atom property,
Atom type,
int format,
int mode,
unsigned long len,
Bool have_data,
pointer value,
Bool sendevent,
XID *tag)
{
PropertyPtr pProp;
xEvent event;
int sizeInBytes;
int totalSize;
pointer data;
sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
/* first see if property already exists */
pProp = wUserProps(pWin);
while (pProp) {
if (pProp->propertyName == property)
break;
pProp = pProp->next;
}
if (!pProp) { /* just add to list */
if (!pWin->optional && !MakeWindowOptional(pWin))
return (BadAlloc);
pProp = (PropertyPtr) xalloc(sizeof(PropertyRec));
if (!pProp)
return (BadAlloc);
data = (pointer) xalloc(totalSize);
if (!data && len) {
xfree(pProp);
return (BadAlloc);
}
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
pProp->data = data;
if (have_data) {
if (len)
memmove((char *) data, (char *) value, totalSize);
pProp->tag_id = 0;
pProp->owner_pid = 0;
} else {
if (!TagSaveTag(LbxTagTypeProperty, totalSize,
(pointer)pProp, &pProp->tag_id)) {
xfree(pProp);
xfree(pProp->data);
return BadAlloc;
}
pProp->owner_pid = LbxProxyID(client);
TagMarkProxy(pProp->tag_id, pProp->owner_pid);
}
pProp->size = len;
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
} else {
/*
* To append or prepend to a property the request format and type must
* match those of the already defined property. The existing format
* and type are irrelevant when using the mode "PropModeReplace" since
* they will be written over.
*/
if ((format != pProp->format) && (mode != PropModeReplace))
return (BadMatch);
if ((pProp->type != type) && (mode != PropModeReplace))
return (BadMatch);
/*
* if its a modify instead of replace, make sure we have the current
* value
*/
if ((mode != PropModeReplace) && pProp->tag_id && pProp->owner_pid) {
LbxStallPropRequest(client, pProp);
return (client->noClientException);
}
/* make sure any old tag is flushed first */
if (pProp->tag_id)
TagDeleteTag(pProp->tag_id);
if (mode == PropModeReplace) {
if (totalSize != pProp->size * (pProp->format >> 3)) {
data = (pointer) xrealloc(pProp->data, totalSize);
if (!data && len)
return (BadAlloc);
pProp->data = data;
}
if (have_data) {
if (len)
memmove((char *) pProp->data, (char *) value, totalSize);
} else {
if (!TagSaveTag(LbxTagTypeProperty, totalSize,
(pointer)pProp, &pProp->tag_id)) {
xfree(pProp);
xfree(pProp->data);
return BadAlloc;
}
pProp->owner_pid = LbxProxyID(client);
TagMarkProxy(pProp->tag_id, pProp->owner_pid);
}
pProp->size = len;
pProp->type = type;
pProp->format = format;
} else if (len == 0) {
/* do nothing */
} else if (mode == PropModeAppend) {
data = (pointer) xrealloc(pProp->data,
sizeInBytes * (len + pProp->size));
if (!data)
return (BadAlloc);
pProp->data = data;
memmove(&((char *) data)[pProp->size * sizeInBytes],
(char *) value,
totalSize);
pProp->size += len;
} else if (mode == PropModePrepend) {
data = (pointer) xalloc(sizeInBytes * (len + pProp->size));
if (!data)
return (BadAlloc);
memmove(&((char *) data)[totalSize], (char *) pProp->data,
(int) (pProp->size * sizeInBytes));
memmove((char *) data, (char *) value, totalSize);
xfree(pProp->data);
pProp->data = data;
pProp->size += len;
}
}
if (sendevent) {
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue;
event.u.property.atom = pProp->propertyName;
event.u.property.time = currentTime.milliseconds;
DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
}
if (pProp->tag_id)
*tag = pProp->tag_id;
return (Success);
}
int
LbxChangeProperty(ClientPtr client)
{
WindowPtr pWin;
char format,
mode;
unsigned long len;
int err;
int n;
XID newtag;
xLbxChangePropertyReply rep;
REQUEST(xLbxChangePropertyReq);
REQUEST_SIZE_MATCH(xLbxChangePropertyReq);
UpdateCurrentTime();
format = stuff->format;
mode = stuff->mode;
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
(mode != PropModePrepend)) {
client->errorValue = mode;
return BadValue;
}
if ((format != 8) && (format != 16) && (format != 32)) {
client->errorValue = format;
return BadValue;
}
len = stuff->nUnits;
if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
return BadLength;
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin)
return (BadWindow);
if (!ValidAtom(stuff->property)) {
client->errorValue = stuff->property;
return (BadAtom);
}
if (!ValidAtom(stuff->type)) {
client->errorValue = stuff->type;
return (BadAtom);
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.pad = rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
}
#ifdef XCSECURITY
switch (SecurityCheckPropertyAccess(client, pWin, stuff->property,
SecurityWriteAccess))
{
case SecurityErrorOperation:
client->errorValue = stuff->property;
return BadAtom;
case SecurityIgnoreOperation:
rep.tag = 0;
WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
return client->noClientException;
}
#endif
err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
(int) format, (int) mode, len, FALSE, (pointer) &stuff[1],
TRUE, &newtag);
if (err)
return err;
rep.tag = newtag;
if (client->swapped) {
swapl(&rep.tag, n);
}
WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
return client->noClientException;
}
static void
LbxWriteGetpropReply(ClientPtr client,
xLbxGetPropertyReply *rep)
{
int n;
if (client->swapped) {
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swapl(&rep->propertyType, n);
swapl(&rep->bytesAfter, n);
swapl(&rep->nItems, n);
swapl(&rep->tag, n);
}
WriteToClient(client, sizeof(xLbxGetPropertyReply), (char *)rep);
}
int
LbxGetProperty(ClientPtr client)
{
PropertyPtr pProp,
prevProp;
unsigned long n,
len,
ind;
WindowPtr pWin;
xLbxGetPropertyReply reply;
Bool send_data = FALSE;
REQUEST(xLbxGetPropertyReq);
REQUEST_SIZE_MATCH(xLbxGetPropertyReq);
reply.pad1 = 0;
reply.pad2 = 0;
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
SecurityReadAccess);
if (!pWin)
return (BadWindow);
if (!ValidAtom(stuff->property)) {
client->errorValue = stuff->property;
return (BadAtom);
}
if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
client->errorValue = stuff->delete;
return (BadValue);
}
if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
{
client->errorValue = stuff->type;
return(BadAtom);
}
pProp = wUserProps(pWin);
prevProp = (PropertyPtr) NULL;
while (pProp) {
if (pProp->propertyName == stuff->property)
break;
prevProp = pProp;
pProp = pProp->next;
}
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (!pProp) {
reply.nItems = 0;
reply.length = 0;
reply.bytesAfter = 0;
reply.propertyType = None;
reply.format = 0;
reply.tag = 0;
LbxWriteGetpropReply(client, &reply);
return client->noClientException;
}
/*
* If the request type and actual type don't match. Return the
* property information, but not the data.
*/
if ((stuff->type != pProp->type) &&
(stuff->type != AnyPropertyType)) {
reply.bytesAfter = pProp->size;
reply.format = pProp->format;
reply.length = 0;
reply.nItems = 0;
reply.propertyType = pProp->type;
reply.tag = 0;
LbxWriteGetpropReply(client, &reply);
return client->noClientException;
}
/*
* Return type, format, value to client
*/
n = (pProp->format >> 3) * pProp->size; /* size (bytes) of prop */
ind = stuff->longOffset << 2;
/*
* If longOffset is invalid such that it causes "len" to be
* negative, it's a value error.
*/
if (n < ind) {
client->errorValue = stuff->longOffset;
return BadValue;
}
/* make sure we have the current value */
if (pProp->tag_id && pProp->owner_pid) {
LbxStallPropRequest(client, pProp);
return client->noClientException;
}
len = min(n - ind, stuff->longLength << 2);
reply.bytesAfter = n - (ind + len);
reply.format = pProp->format;
reply.propertyType = pProp->type;
if (!pProp->tag_id) {
if (n && (!stuff->delete || reply.bytesAfter)) {
TagSaveTag(LbxTagTypeProperty, n, (pointer)pProp, &pProp->tag_id);
pProp->owner_pid = 0;
}
send_data = TRUE;
} else
send_data = !TagProxyMarked(pProp->tag_id, LbxProxyID(client));
if (pProp->tag_id && send_data)
TagMarkProxy(pProp->tag_id, LbxProxyID(client));
reply.tag = pProp->tag_id;
if (!send_data)
len = 0;
else if (reply.tag) {
len = n;
ind = 0;
}
reply.nItems = len / (pProp->format >> 3);
reply.length = (len + 3) >> 2;
if (stuff->delete && (reply.bytesAfter == 0)) {
xEvent event;
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
event.u.property.atom = pProp->propertyName;
event.u.property.time = currentTime.milliseconds;
DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
}
LbxWriteGetpropReply(client, &reply);
if (len) {
switch (reply.format) {
case 32:
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
break;
case 16:
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
break;
default:
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
break;
}
WriteSwappedDataToClient(client, len,
(char *) pProp->data + ind);
}
if (stuff->delete && (reply.bytesAfter == 0)) {
if (pProp->tag_id)
TagDeleteTag(pProp->tag_id);
if (prevProp == (PropertyPtr) NULL) {
if (!(pWin->optional->userProps = pProp->next))
CheckWindowOptionalNeed(pWin);
} else
prevProp->next = pProp->next;
xfree(pProp->data);
xfree(pProp);
}
return client->noClientException;
}

View File

@ -1,289 +0,0 @@
/* $Xorg: lbxserve.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/*
* Copyright 1992 Network Computing Devices
*
* 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, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.4 2001/08/01 00:44:58 tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _LBXSERVE_H_
#include "colormap.h"
#include "property.h"
#define _LBXSERVE_H_
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include <X11/extensions/lbxdeltastr.h>
#include <X11/extensions/lbxopts.h>
#define MAX_LBX_CLIENTS MAXCLIENTS
#define MAX_NUM_PROXIES (MAXCLIENTS >> 1)
typedef struct _LbxClient *LbxClientPtr;
typedef struct _LbxProxy *LbxProxyPtr;
typedef struct _LbxClient {
CARD32 id;
ClientPtr client;
LbxProxyPtr proxy;
Bool ignored;
Bool input_blocked;
int reqs_pending;
long bytes_in_reply;
long bytes_remaining;
Drawable drawableCache[GFX_CACHE_SIZE];
GContext gcontextCache[GFX_CACHE_SIZE];
pointer gfx_buffer; /* tmp buffer for unpacking gfx requests */
unsigned long gb_size;
} LbxClientRec;
typedef struct _connectionOutput *OSBufPtr;
typedef struct _LbxProxy {
LbxProxyPtr next;
/* this array is indexed by lbx proxy index */
LbxClientPtr lbxClients[MAX_LBX_CLIENTS];
LbxClientPtr curRecv,
curDix;
int fd;
int pid; /* proxy ID */
int uid;
int numClients;
int maxIndex;
Bool aborted;
int grabClient;
pointer compHandle;
Bool dosquishing;
Bool useTags;
LBXDeltasRec indeltas;
LBXDeltasRec outdeltas;
char *iDeltaBuf;
char *replyBuf;
char *oDeltaBuf;
OSBufPtr ofirst;
OSBufPtr olast;
CARD32 cur_send_id;
LbxStreamOpts streamOpts;
int numBitmapCompMethods;
unsigned char *bitmapCompMethods; /* array of indices */
int numPixmapCompMethods;
unsigned char *pixmapCompMethods; /* array of indices */
int **pixmapCompDepths; /* depths supported from each method */
struct _ColormapRec *grabbedCmaps; /* chained via lbx private */
int motion_allowed_events;
lbxMotionCache motionCache;
} LbxProxyRec;
/* This array is indexed by server client index, not lbx proxy index */
extern LbxClientPtr lbxClients[MAXCLIENTS];
#define LbxClient(client) (lbxClients[(client)->index])
#define LbxProxy(client) (LbxClient(client)->proxy)
#define LbxMaybeProxy(client) (LbxClient(client) ? LbxProxy(client) : 0)
#define LbxProxyID(client) (LbxProxy(client)->pid)
#define LbxProxyClient(proxy) ((proxy)->lbxClients[0]->client)
extern int LbxEventCode;
/* os/connection.c */
extern ClientPtr AllocLbxClientConnection ( ClientPtr client,
LbxProxyPtr proxy );
extern void LbxProxyConnection ( ClientPtr client, LbxProxyPtr proxy );
/* os/libxio.c */
extern int UncompressedWriteToClient ( ClientPtr who, int count, char *buf );
extern void LbxForceOutput ( LbxProxyPtr proxy );
extern void SwitchClientInput ( ClientPtr client, Bool pending );
extern int PrepareLargeReqBuffer ( ClientPtr client );
extern Bool AppendFakeRequest ( ClientPtr client, char *data, int count );
extern void LbxFreeOsBuffers ( LbxProxyPtr proxy );
extern Bool AllocateLargeReqBuffer ( ClientPtr client, int size );
extern Bool AddToLargeReqBuffer ( ClientPtr client, char *data, int size );
extern void LbxPrimeInput ( ClientPtr client, LbxProxyPtr proxy );
/* lbxcmap.c */
extern int LbxCmapInit ( void );
extern Bool LbxCheckColorRequest ( ClientPtr client, ColormapPtr pmap,
xReq *req );
extern int LbxCheckCmapGrabbed ( ColormapPtr pmap );
extern void LbxDisableSmartGrab ( ColormapPtr pmap );
extern void LbxBeginFreeCellsEvent ( ColormapPtr pmap );
extern void LbxAddFreeCellToEvent ( ColormapPtr pmap, Pixel pixel );
extern void LbxEndFreeCellsEvent ( ColormapPtr pmap );
extern void LbxSortPixelList ( Pixel *pixels, int count );
extern int ProcLbxGrabCmap ( ClientPtr client );
extern void LbxReleaseCmap ( ColormapPtr pmap, Bool smart );
extern int ProcLbxReleaseCmap ( ClientPtr client );
extern int ProcLbxAllocColor ( ClientPtr client );
extern int ProcLbxIncrementPixel ( ClientPtr client );
/* lbxdix.h */
extern void LbxDixInit ( void );
extern void LbxResetTags ( void );
extern int LbxSendConnSetup ( ClientPtr client, char *reason );
extern int LbxGetModifierMapping ( ClientPtr client );
extern int LbxGetKeyboardMapping ( ClientPtr client );
extern int LbxQueryFont ( ClientPtr client );
extern int LbxTagData ( ClientPtr client, XID tag, unsigned long len,
pointer data );
extern int LbxInvalidateTag ( ClientPtr client, XID tag );
extern void LbxAllowMotion ( ClientPtr client, int num );
extern void LbxFlushModifierMapTag ( void );
extern void LbxFlushKeyboardMapTag ( void );
extern void LbxFreeFontTag ( FontPtr pfont );
extern void LbxSendInvalidateTag ( ClientPtr client, XID tag, int tagtype );
extern Bool LbxFlushQTag ( XID tag );
extern void ProcessQTagZombies ( void );
extern void LbxQueryTagData ( ClientPtr client, int owner_pid, XID tag,
int tagtype );
/* lbxexts.c */
extern Bool LbxAddExtension ( char *name, int opcode, int ev_base,
int err_base );
extern Bool LbxAddExtensionAlias ( int idx, char *alias );
extern void LbxDeclareExtensionSecurity ( char *extname, Bool secure );
extern Bool LbxRegisterExtensionGenerationMasks ( int idx, int num_reqs,
char *rep_mask,
char *ev_mask );
extern int LbxQueryExtension ( ClientPtr client, char *ename, int nlen );
extern void LbxCloseDownExtensions ( void );
extern void LbxSetReqMask ( CARD8 *mask, int req, Bool on );
/* lbxgfx.c */
extern int LbxDecodePoly( ClientPtr client, CARD8 xreqtype,
int (*decode_rtn)(char *, char *, short *) );
extern int LbxDecodeFillPoly ( ClientPtr client );
extern int LbxDecodeCopyArea ( ClientPtr client );
extern int LbxDecodeCopyPlane ( ClientPtr client );
extern int LbxDecodePolyText ( ClientPtr client );
extern int LbxDecodeImageText ( ClientPtr client );
extern int LbxDecodePutImage ( ClientPtr client );
extern int LbxDecodeGetImage ( ClientPtr client );
extern int LbxDecodePoints ( char *in, char *inend, short *out );
extern int LbxDecodeSegment ( char *in, char *inend, short *out );
extern int LbxDecodeRectangle ( char *in, char *inend, short *out );
extern int LbxDecodeArc ( char *in, char *inend, short *out );
/* lbxmain.c */
extern LbxProxyPtr LbxPidToProxy ( int pid );
extern void LbxReencodeOutput ( ClientPtr client, char *pbuf, int *pcount,
char *cbuf, int *ccount );
extern void LbxExtensionInit ( void );
extern void LbxCloseClient ( ClientPtr client );
extern void LbxSetForBlock ( LbxClientPtr lbxClient );
extern int ProcLbxDispatch ( ClientPtr client );
extern int ProcLbxSwitch ( ClientPtr client );
extern int ProcLbxQueryVersion ( ClientPtr client );
extern int ProcLbxStartProxy ( ClientPtr client );
extern int ProcLbxStopProxy ( ClientPtr client );
extern int ProcLbxBeginLargeRequest ( ClientPtr client );
extern int ProcLbxLargeRequestData ( ClientPtr client );
extern int ProcLbxEndLargeRequest ( ClientPtr client );
extern int ProcLbxInternAtoms ( ClientPtr client );
extern int ProcLbxGetWinAttrAndGeom ( ClientPtr client );
extern int ProcLbxNewClient ( ClientPtr client );
extern int ProcLbxEstablishConnection ( ClientPtr client );
extern int ProcLbxCloseClient ( ClientPtr client );
extern int ProcLbxModifySequence ( ClientPtr client );
extern int ProcLbxAllowMotion ( ClientPtr client );
extern int ProcLbxGetModifierMapping ( ClientPtr client );
extern int ProcLbxGetKeyboardMapping ( ClientPtr client );
extern int ProcLbxQueryFont ( ClientPtr client );
extern int ProcLbxChangeProperty ( ClientPtr client );
extern int ProcLbxGetProperty ( ClientPtr client );
extern int ProcLbxTagData ( ClientPtr client );
extern int ProcLbxInvalidateTag ( ClientPtr client );
extern int ProcLbxPolyPoint ( ClientPtr client );
extern int ProcLbxPolyLine ( ClientPtr client );
extern int ProcLbxPolySegment ( ClientPtr client );
extern int ProcLbxPolyRectangle ( ClientPtr client );
extern int ProcLbxPolyArc ( ClientPtr client );
extern int ProcLbxFillPoly ( ClientPtr client );
extern int ProcLbxPolyFillRectangle ( ClientPtr client );
extern int ProcLbxPolyFillArc ( ClientPtr client );
extern int ProcLbxCopyArea ( ClientPtr client );
extern int ProcLbxCopyPlane ( ClientPtr client );
extern int ProcLbxPolyText ( ClientPtr client );
extern int ProcLbxImageText ( ClientPtr client );
extern int ProcLbxQueryExtension ( ClientPtr client );
extern int ProcLbxPutImage ( ClientPtr client );
extern int ProcLbxGetImage ( ClientPtr client );
extern int ProcLbxSync ( ClientPtr client );
/* lbxprop.c */
extern int LbxChangeProperty ( ClientPtr client );
extern int LbxGetProperty ( ClientPtr client );
extern void LbxStallPropRequest ( ClientPtr client, PropertyPtr pProp );
extern int LbxChangeWindowProperty ( ClientPtr client, WindowPtr pWin,
Atom property, Atom type, int format,
int mode, unsigned long len,
Bool have_data, pointer value,
Bool sendevent, XID *tag );
/* lbxsquish.c */
extern int LbxSquishEvent ( char *buf );
/* lbwswap.c */
extern int SProcLbxDispatch( ClientPtr client );
extern int SProcLbxSwitch ( ClientPtr client );
extern int SProcLbxBeginLargeRequest ( ClientPtr client );
extern int SProcLbxLargeRequestData ( ClientPtr client );
extern int SProcLbxEndLargeRequest ( ClientPtr client );
extern void LbxWriteSConnSetupPrefix ( ClientPtr pClient,
xLbxConnSetupPrefix *pcsp );
extern void LbxSwapFontInfo ( xLbxFontInfo *pr, Bool compressed );
/* lbxzerorep.c */
extern void ZeroReplyPadBytes ( char *buf, int reqType );
#endif /* _LBXSERVE_H_ */

View File

@ -1,158 +0,0 @@
/* $Xorg: lbxsquish.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xos.h>
#include "misc.h"
#include "colormapst.h"
#include "propertyst.h"
#include "lbxserve.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
/* handles server-side protocol squishing */
static char lbxevdelta[] = {
0,
0,
sz_xEvent - lbxsz_KeyButtonEvent,
sz_xEvent - lbxsz_KeyButtonEvent,
sz_xEvent - lbxsz_KeyButtonEvent,
sz_xEvent - lbxsz_KeyButtonEvent,
sz_xEvent - lbxsz_KeyButtonEvent,
sz_xEvent - lbxsz_EnterLeaveEvent,
sz_xEvent - lbxsz_EnterLeaveEvent,
sz_xEvent - lbxsz_FocusEvent,
sz_xEvent - lbxsz_FocusEvent,
sz_xEvent - lbxsz_KeymapEvent,
sz_xEvent - lbxsz_ExposeEvent,
sz_xEvent - lbxsz_GfxExposeEvent,
sz_xEvent - lbxsz_NoExposeEvent,
sz_xEvent - lbxsz_VisibilityEvent,
sz_xEvent - lbxsz_CreateNotifyEvent,
sz_xEvent - lbxsz_DestroyNotifyEvent,
sz_xEvent - lbxsz_UnmapNotifyEvent,
sz_xEvent - lbxsz_MapNotifyEvent,
sz_xEvent - lbxsz_MapRequestEvent,
sz_xEvent - lbxsz_ReparentEvent,
sz_xEvent - lbxsz_ConfigureNotifyEvent,
sz_xEvent - lbxsz_ConfigureRequestEvent,
sz_xEvent - lbxsz_GravityEvent,
sz_xEvent - lbxsz_ResizeRequestEvent,
sz_xEvent - lbxsz_CirculateEvent,
sz_xEvent - lbxsz_CirculateEvent,
sz_xEvent - lbxsz_PropertyEvent,
sz_xEvent - lbxsz_SelectionClearEvent,
sz_xEvent - lbxsz_SelectionRequestEvent,
sz_xEvent - lbxsz_SelectionNotifyEvent,
sz_xEvent - lbxsz_ColormapEvent,
sz_xEvent - lbxsz_ClientMessageEvent,
sz_xEvent - lbxsz_MappingNotifyEvent
};
static char lbxevpad[] = {
0,
0,
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
lbxsz_FocusEvent - lbxupsz_FocusEvent,
lbxsz_FocusEvent - lbxupsz_FocusEvent,
lbxsz_KeymapEvent - lbxupsz_KeymapEvent,
lbxsz_ExposeEvent - lbxupsz_ExposeEvent,
lbxsz_GfxExposeEvent - lbxupsz_GfxExposeEvent,
lbxsz_NoExposeEvent - lbxupsz_NoExposeEvent,
lbxsz_VisibilityEvent - lbxupsz_VisibilityEvent,
lbxsz_CreateNotifyEvent - lbxupsz_CreateNotifyEvent,
lbxsz_DestroyNotifyEvent - lbxupsz_DestroyNotifyEvent,
lbxsz_UnmapNotifyEvent - lbxupsz_UnmapNotifyEvent,
lbxsz_MapNotifyEvent - lbxupsz_MapNotifyEvent,
lbxsz_MapRequestEvent - lbxupsz_MapRequestEvent,
lbxsz_ReparentEvent - lbxupsz_ReparentEvent,
lbxsz_ConfigureNotifyEvent - lbxupsz_ConfigureNotifyEvent,
lbxsz_ConfigureRequestEvent - lbxupsz_ConfigureRequestEvent,
lbxsz_GravityEvent - lbxupsz_GravityEvent,
lbxsz_ResizeRequestEvent - lbxupsz_ResizeRequestEvent,
lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
lbxsz_PropertyEvent - lbxupsz_PropertyEvent,
lbxsz_SelectionClearEvent - lbxupsz_SelectionClearEvent,
lbxsz_SelectionRequestEvent - lbxupsz_SelectionRequestEvent,
lbxsz_SelectionNotifyEvent - lbxupsz_SelectionNotifyEvent,
lbxsz_ColormapEvent - lbxupsz_ColormapEvent,
lbxsz_ClientMessageEvent - lbxupsz_ClientMessageEvent,
lbxsz_MappingNotifyEvent - lbxupsz_MappingNotifyEvent
};
int
LbxSquishEvent(char *buf)
{
int delta = lbxevdelta[((xEvent *)buf)->u.u.type];
int pad = lbxevpad[((xEvent *)buf)->u.u.type];
if (delta)
memmove(buf + delta, buf, sz_xEvent - delta);
if (pad) {
buf += sz_xEvent;
while (--pad >= 0)
*--buf = 0;
}
return delta;
}

View File

@ -1,67 +0,0 @@
/* $Xorg: lbxsrvopts.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxsrvopts.h,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _LBX_SRVOPTS_H_
#define _LBX_SRVOPTS_H_
#include <X11/extensions/lbxopts.h>
typedef struct _LbxNegOpts {
int nopts;
short proxyDeltaN;
short proxyDeltaMaxLen;
short serverDeltaN;
short serverDeltaMaxLen;
LbxStreamOpts streamOpts;
int numBitmapCompMethods;
unsigned char *bitmapCompMethods; /* array of indices */
int numPixmapCompMethods;
unsigned char *pixmapCompMethods; /* array of indices */
int **pixmapCompDepths; /* depths supported from each method */
Bool squish;
Bool useTags;
} LbxNegOptsRec;
typedef LbxNegOptsRec *LbxNegOptsPtr;
extern void LbxOptionInit ( LbxNegOptsPtr pno );
extern int LbxOptionParse ( LbxNegOptsPtr pno, unsigned char *popt,
int optlen, unsigned char *preply );
extern LbxBitmapCompMethod *
LbxSrvrLookupBitmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
extern LbxPixmapCompMethod *
LbxSrvrLookupPixmapCompMethod ( LbxProxyPtr proxy, int methodOpCode );
extern LbxBitmapCompMethod *
LbxSrvrFindPreferredBitmapCompMethod ( LbxProxyPtr proxy );
extern LbxPixmapCompMethod *
LbxSrvrFindPreferredPixmapCompMethod ( LbxProxyPtr proxy, int format, int depth );
#endif /* _LBX_SRVOPTS_H_ */

View File

@ -1,828 +0,0 @@
/* $Xorg: lbxswap.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/*
* Copyright 1992 Network Computing Devices
*
* 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, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xos.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "swaprep.h"
#include "propertyst.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "lbxserve.h"
#include <X11/Xfuncproto.h>
#include <stdio.h>
static int
SProcLbxQueryVersion(ClientPtr client)
{
register int n;
REQUEST(xLbxQueryVersionReq);
swaps(&stuff->length, n);
return ProcLbxQueryVersion(client);
}
static int
SProcLbxStartProxy(ClientPtr client)
{
register int n;
REQUEST(xLbxStartProxyReq);
swaps(&stuff->length, n);
return ProcLbxStartProxy(client);
}
static int
SProcLbxStopProxy(ClientPtr client)
{
register int n;
REQUEST(xLbxStopProxyReq);
swaps(&stuff->length, n);
return ProcLbxStopProxy(client);
}
int
SProcLbxSwitch(ClientPtr client)
{
register int n;
REQUEST(xLbxSwitchReq);
swaps(&stuff->length, n);
swapl(&stuff->client, n);
return ProcLbxSwitch(client);
}
int
SProcLbxBeginLargeRequest (ClientPtr client)
{
register int n;
REQUEST(xLbxBeginLargeRequestReq);
swaps(&stuff->length, n);
swapl(&stuff->largeReqLength, n);
return ProcLbxBeginLargeRequest(client);
}
int
SProcLbxLargeRequestData (ClientPtr client)
{
register int n;
REQUEST(xLbxLargeRequestDataReq);
swaps(&stuff->length, n);
return ProcLbxLargeRequestData(client);
}
int
SProcLbxEndLargeRequest (ClientPtr client)
{
register int n;
REQUEST(xLbxEndLargeRequestReq);
swaps(&stuff->length, n);
return ProcLbxEndLargeRequest(client);
}
static int
SProcLbxNewClient(ClientPtr client)
{
register int n;
REQUEST(xLbxNewClientReq);
swaps(&stuff->length, n);
swapl(&stuff->client, n);
return ProcLbxNewClient(client);
}
static int
SProcLbxCloseClient(ClientPtr client)
{
register int n;
REQUEST(xLbxCloseClientReq);
swaps(&stuff->length, n);
swapl(&stuff->client, n);
return ProcLbxCloseClient(client);
}
static int
SProcLbxModifySequence(ClientPtr client)
{
register int n;
REQUEST(xLbxModifySequenceReq);
swaps(&stuff->length, n);
swapl(&stuff->adjust, n);
return ProcLbxModifySequence(client);
}
static int
SProcLbxAllowMotion(ClientPtr client)
{
register int n;
REQUEST(xLbxAllowMotionReq);
swaps(&stuff->length, n);
swapl(&stuff->num, n);
return ProcLbxAllowMotion(client);
}
static int
SProcLbxIncrementPixel(ClientPtr client)
{
register int n;
REQUEST(xLbxIncrementPixelReq);
swaps(&stuff->length, n);
swapl(&stuff->cmap, n);
swapl(&stuff->pixel, n);
return ProcLbxIncrementPixel(client);
}
static int
SProcLbxGrabCmap(ClientPtr client)
{
register int n;
REQUEST(xLbxGrabCmapReq);
swaps(&stuff->length, n);
swapl(&stuff->cmap, n);
return ProcLbxGrabCmap(client);
}
static int
SProcLbxReleaseCmap(ClientPtr client)
{
register int n;
REQUEST(xLbxReleaseCmapReq);
swaps(&stuff->length, n);
swapl(&stuff->cmap, n);
return ProcLbxReleaseCmap(client);
}
static int
SProcLbxAllocColor(ClientPtr client)
{
register int n;
REQUEST(xLbxAllocColorReq);
swaps(&stuff->length, n);
swapl(&stuff->cmap, n);
swapl(&stuff->pixel, n);
swaps(&stuff->red, n);
swaps(&stuff->green, n);
swaps(&stuff->blue, n);
return ProcLbxAllocColor(client);
}
static int
SProcLbxGetModifierMapping(ClientPtr client)
{
register int n;
REQUEST(xLbxGetModifierMappingReq);
swaps(&stuff->length, n);
return ProcLbxGetModifierMapping(client);
}
static int
SProcLbxGetKeyboardMapping(ClientPtr client)
{
register int n;
REQUEST(xLbxGetKeyboardMappingReq);
swaps(&stuff->length, n);
return ProcLbxGetKeyboardMapping(client);
}
static int
SProcLbxQueryFont(ClientPtr client)
{
register int n;
REQUEST(xLbxQueryFontReq);
swaps(&stuff->length, n);
swapl(&stuff->fid, n);
return ProcLbxQueryFont(client);
}
static int
SProcLbxChangeProperty(ClientPtr client)
{
register int n;
REQUEST(xLbxChangePropertyReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xLbxChangePropertyReq);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->nUnits, n);
switch (stuff->format) {
case 8:
break;
case 16:
SwapRestS(stuff);
break;
case 32:
SwapRestL(stuff);
break;
}
return ProcLbxChangeProperty(client);
}
static int
SProcLbxGetProperty(ClientPtr client)
{
register int n;
REQUEST(xLbxGetPropertyReq);
swaps(&stuff->length, n);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->longOffset, n);
swapl(&stuff->longLength, n);
return ProcLbxGetProperty(client);
}
static int
SProcLbxTagData(ClientPtr client)
{
register int n;
REQUEST(xLbxTagDataReq);
swaps(&stuff->length, n);
swapl(&stuff->tag, n);
swapl(&stuff->real_length, n);
return ProcLbxTagData(client);
}
static int
SProcLbxInvalidateTag(ClientPtr client)
{
register int n;
REQUEST(xLbxInvalidateTagReq);
swaps(&stuff->length, n);
swapl(&stuff->tag, n);
return ProcLbxInvalidateTag(client);
}
static int
SProcLbxPoly(ClientPtr client)
{
register int n;
REQUEST(xLbxPolyPointReq);
char *after;
swaps(&stuff->length, n);
after = ((char *) stuff) + SIZEOF(xLbxPolyPointReq);
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxDispatch(client);
}
static int
SProcLbxFillPoly(ClientPtr client)
{
register int n;
REQUEST(xLbxFillPolyReq);
char *after;
swaps(&stuff->length, n);
after = ((char *) stuff) + SIZEOF(xLbxFillPolyReq);
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxFillPoly(client);
}
static int
SProcLbxCopyArea(ClientPtr client)
{
int n;
REQUEST(xLbxCopyAreaReq);
char *after;
swaps(&stuff->length, n);
after = ((char *) stuff) + SIZEOF(xLbxCopyAreaReq);
if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxCopyArea(client);
}
static int
SProcLbxCopyPlane(ClientPtr client)
{
int n;
REQUEST(xLbxCopyPlaneReq);
char *after;
swaps(&stuff->length, n);
swapl(&stuff->bitPlane, n);
after = ((char *) stuff) + SIZEOF(xLbxCopyPlaneReq);
if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxCopyPlane(client);
}
static int
SProcLbxPolyText(ClientPtr client)
{
register int n;
REQUEST(xLbxPolyTextReq);
char *after;
swaps(&stuff->length, n);
after = ((char *) stuff) + SIZEOF(xLbxPolyTextReq);
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxDispatch(client);
}
static int
SProcLbxImageText(ClientPtr client)
{
register int n;
REQUEST(xLbxImageTextReq);
char *after;
swaps(&stuff->length, n);
after = ((char *) stuff) + SIZEOF(xLbxImageTextReq);
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
{
swapl (((Drawable *) after), n);
after += sizeof (Drawable);
}
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
swapl (((GContext *) after), n);
return ProcLbxDispatch(client);
}
static int
SProcLbxPutImage(ClientPtr client)
{
register int n;
REQUEST(xLbxPutImageReq);
swaps (&stuff->length, n);
return ProcLbxPutImage(client);
}
static int
SProcLbxGetImage(ClientPtr client)
{
register int n;
REQUEST(xLbxGetImageReq);
swaps (&stuff->length, n);
swapl (&stuff->drawable, n);
swaps (&stuff->x, n);
swaps (&stuff->y, n);
swaps (&stuff->width, n);
swaps (&stuff->height, n);
swapl (&stuff->planeMask, n);
return ProcLbxGetImage(client);
}
static int
SProcLbxInternAtoms(ClientPtr client)
{
register int n;
char *ptr;
char lenbuf[2];
CARD16 len;
int i;
REQUEST(xLbxInternAtomsReq);
swaps (&stuff->length, n);
swaps (&stuff->num, n);
ptr = (char *) stuff + sz_xLbxInternAtomsReq;
for (i = 0; i < stuff->num; i++)
{
swaps (ptr, n);
lenbuf[0] = ptr[0];
lenbuf[1] = ptr[1];
len = *((CARD16 *) lenbuf);
ptr += (len + 2);
}
return ProcLbxInternAtoms(client);
}
static int
SProcLbxGetWinAttrAndGeom(ClientPtr client)
{
int n;
REQUEST(xLbxGetWinAttrAndGeomReq);
swaps(&stuff->length, n);
swapl(&stuff->id, n);
return ProcLbxGetWinAttrAndGeom(client);
}
static int
SProcLbxQueryExtension(ClientPtr client)
{
int n;
REQUEST(xLbxQueryExtensionReq);
swaps(&stuff->length, n);
swapl(&stuff->nbytes, n);
return ProcLbxQueryExtension(client);
}
int
SProcLbxDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_LbxQueryVersion:
return SProcLbxQueryVersion(client);
case X_LbxStartProxy:
return SProcLbxStartProxy(client);
case X_LbxStopProxy:
return SProcLbxStopProxy(client);
case X_LbxNewClient:
return SProcLbxNewClient(client);
case X_LbxCloseClient:
return SProcLbxCloseClient(client);
case X_LbxModifySequence:
return SProcLbxModifySequence(client);
case X_LbxAllowMotion:
return SProcLbxAllowMotion(client);
case X_LbxIncrementPixel:
return SProcLbxIncrementPixel(client);
case X_LbxGrabCmap:
return SProcLbxGrabCmap(client);
case X_LbxReleaseCmap:
return SProcLbxReleaseCmap(client);
case X_LbxAllocColor:
return SProcLbxAllocColor(client);
case X_LbxGetModifierMapping:
return SProcLbxGetModifierMapping(client);
case X_LbxGetKeyboardMapping:
return SProcLbxGetKeyboardMapping(client);
case X_LbxInvalidateTag:
return SProcLbxInvalidateTag(client);
case X_LbxPolyPoint:
case X_LbxPolyLine:
case X_LbxPolySegment:
case X_LbxPolyRectangle:
case X_LbxPolyArc:
case X_LbxPolyFillRectangle:
case X_LbxPolyFillArc:
return SProcLbxPoly(client);
case X_LbxFillPoly:
return SProcLbxFillPoly(client);
case X_LbxQueryFont:
return SProcLbxQueryFont(client);
case X_LbxChangeProperty:
return SProcLbxChangeProperty(client);
case X_LbxGetProperty:
return SProcLbxGetProperty(client);
case X_LbxTagData:
return SProcLbxTagData(client);
case X_LbxCopyArea:
return SProcLbxCopyArea(client);
case X_LbxCopyPlane:
return SProcLbxCopyPlane(client);
case X_LbxPolyText8:
case X_LbxPolyText16:
return SProcLbxPolyText(client);
case X_LbxImageText8:
case X_LbxImageText16:
return SProcLbxImageText (client);
case X_LbxQueryExtension:
return SProcLbxQueryExtension(client);
case X_LbxPutImage:
return SProcLbxPutImage(client);
case X_LbxGetImage:
return SProcLbxGetImage(client);
case X_LbxInternAtoms:
return SProcLbxInternAtoms(client);
case X_LbxGetWinAttrAndGeom:
return SProcLbxGetWinAttrAndGeom(client);
case X_LbxSync:
return ProcLbxSync(client); /* nothing to swap */
case X_LbxBeginLargeRequest:
return SProcLbxBeginLargeRequest(client);
case X_LbxLargeRequestData:
return SProcLbxLargeRequestData(client);
default:
return BadRequest;
}
}
#ifdef notyet
void
LbxWriteSConnectionInfo(ClientPtr pClient,
unsigned long size,
char *pInfo)
{
int i, j, k;
ScreenPtr pScreen;
DepthPtr pDepth;
char *pInfoT, *pInfoTBase;
xConnSetup *pConnSetup = (xConnSetup *)pInfo;
pInfoT = pInfoTBase = (char *) ALLOCATE_LOCAL(size);
if (!pInfoTBase)
{
pClient->noClientException = -1;
return;
}
SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
pInfo += sizeof(xConnSetup);
pInfoT += sizeof(xConnSetup);
/* Copy the vendor string */
i = (pConnSetup->nbytesVendor + 3) & ~3;
memmove(pInfoT, pInfo, i);
pInfo += i;
pInfoT += i;
/* The Pixmap formats don't need to be swapped, just copied. */
i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
memmove(pInfoT, pInfo, i);
pInfo += i;
pInfoT += i;
for(i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
pInfo += sizeof(xWindowRoot);
pInfoT += sizeof(xWindowRoot);
pDepth = pScreen->allowedDepths;
for(j = 0; j < pScreen->numDepths; j++, pDepth++)
{
((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
pInfo += sizeof(xDepth);
pInfoT += sizeof(xDepth);
for(k = 0; k < pDepth->numVids; k++)
{
SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
pInfo += sizeof(xVisualType);
pInfoT += sizeof(xVisualType);
}
}
}
(void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
DEALLOCATE_LOCAL(pInfoTBase);
}
void
SwapConnSetup(xConnSetup *pConnSetup,
xConnSetup *pConnSetupT)
{
cpswapl(pConnSetup->release, pConnSetupT->release);
cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
pConnSetupT->numRoots = pConnSetup->numRoots;
pConnSetupT->numFormats = pConnSetup->numFormats;
pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
}
void
SwapWinRoot(xWindowRoot *pRoot,
xWindowRoot *pRootT)
{
cpswapl(pRoot->windowId, pRootT->windowId);
cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
cpswapl(pRoot->whitePixel, pRootT->whitePixel);
cpswapl(pRoot->blackPixel, pRootT->blackPixel);
cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
cpswaps(pRoot->pixWidth, pRootT->pixWidth);
cpswaps(pRoot->pixHeight, pRootT->pixHeight);
cpswaps(pRoot->mmWidth, pRootT->mmWidth);
cpswaps(pRoot->mmHeight, pRootT->mmHeight);
cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
pRootT->backingStore = pRoot->backingStore;
pRootT->saveUnders = pRoot->saveUnders;
pRootT->rootDepth = pRoot->rootDepth;
pRootT->nDepths = pRoot->nDepths;
}
void
SwapVisual(xVisualType *pVis,
xVisualType *pVisT;
{
cpswapl(pVis->visualID, pVisT->visualID);
pVisT->class = pVis->class;
pVisT->bitsPerRGB = pVis->bitsPerRGB;
cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
cpswapl(pVis->redMask, pVisT->redMask);
cpswapl(pVis->greenMask, pVisT->greenMask);
cpswapl(pVis->blueMask, pVisT->blueMask);
}
#endif
void
LbxWriteSConnSetupPrefix(ClientPtr pClient,
xLbxConnSetupPrefix *pcsp)
{
xLbxConnSetupPrefix cspT;
cspT.success = pcsp->success;
cspT.changeType = pcsp->changeType;
cspT.length = pcsp->length;
cpswaps(pcsp->majorVersion, cspT.majorVersion);
cpswaps(pcsp->minorVersion, cspT.minorVersion);
cpswapl(pcsp->tag, cspT.tag);
(void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
}
void
LbxSwapFontInfo(xLbxFontInfo *pr,
Bool compressed)
{
unsigned i;
xCharInfo *pxci;
unsigned nchars,
nprops;
char *pby;
register char n;
nchars = pr->nCharInfos;
nprops = pr->nFontProps;
swaps(&pr->minCharOrByte2, n);
swaps(&pr->maxCharOrByte2, n);
swaps(&pr->defaultChar, n);
swaps(&pr->nFontProps, n);
swaps(&pr->fontAscent, n);
swaps(&pr->fontDescent, n);
SwapCharInfo(&pr->minBounds);
SwapCharInfo(&pr->maxBounds);
swapl(&pr->nCharInfos, n);
pby = (char *) &pr[1];
/*
* Font properties are an atom and either an int32 or a CARD32, so they
* are always 2 4 byte values
*/
for (i = 0; i < nprops; i++) {
swapl(pby, n);
pby += 4;
swapl(pby, n);
pby += 4;
}
if (!compressed) {
pxci = (xCharInfo *) pby;
for (i = 0; i < nchars; i++, pxci++)
SwapCharInfo(pxci);
} else {
SwapLongs((CARD32 *) pby, nchars);
}
}

View File

@ -1,39 +0,0 @@
/* $Xorg: lbxtables.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxtables.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dix.h"
extern int ProcInitialConnection(ClientPtr client);
extern int ProcLbxEstablishConnection(ClientPtr client);
int (* LbxInitialVector[3]) (ClientPtr) =
{
0,
ProcInitialConnection,
ProcLbxEstablishConnection
};

View File

@ -1,237 +0,0 @@
/* $Xorg: lbxtags.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "misc.h"
#include "lbxdata.h"
#include "resource.h"
#include "colormapst.h"
#include "propertyst.h"
#include "lbxtags.h"
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#include "propertyst.h"
static RESTYPE TagResType;
extern int _lbx_fi_junklen;
/* ARGSUSED */
static int
tag_free(pointer data,
XID id)
{
TagData td = (TagData) data;
FontTagInfoPtr ftip;
char *t;
if (td->global)
*(td->global) = 0;
/* some types need to be freed, others are shared */
if (td->data_type == LbxTagTypeFont) {
/* remove any back links */
ftip = (FontTagInfoPtr) td->tdata;
FontSetPrivate(ftip->pfont, lbx_font_private, NULL);
t = (char *) ftip->fontinfo;
if (!ftip->compression) /* points to xQueryFont, so back up to it */
t -= _lbx_fi_junklen;
xfree(t);
xfree(ftip);
}
xfree(data);
return 0;
}
void
TagInit(void)
{
TagResType = CreateNewResourceType(tag_free);
}
XID
TagNewTag(void)
{
return FakeClientID(0);
}
void
TagClearProxy(XID tid,
int pid)
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
if (td)
td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
}
void
TagMarkProxy(XID tid,
int pid)
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
td->sent_to_proxy[pid >> 3] |= 1 << (pid & 7);
}
Bool
TagProxyMarked(XID tid,
int pid)
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
return (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) != 0;
}
XID
TagSaveTag(int dtype,
int size,
pointer data,
XID *global)
{
TagData td;
td = (TagData) xalloc(sizeof(TagDataRec));
if (!td) {
if (global)
*global = 0;
return 0;
}
bzero((char *) td->sent_to_proxy, (MAX_NUM_PROXIES + 7) / 8);
td->tid = TagNewTag();
td->data_type = dtype;
td->tdata = data;
td->size = size;
td->global = global;
if (!AddResource(td->tid, TagResType, (pointer) td))
return 0;
if (global)
*global = td->tid;
return td->tid;
}
void
TagDeleteTag(XID tid)
{
int pid;
TagData td;
LbxProxyPtr proxy;
ClientPtr client;
LbxClientPtr lbxcp;
td = (TagData) LookupIDByType(tid, TagResType);
if (!td) /* shouldn't happen, but play it safe */
return;
for (pid = 1; pid < MAX_NUM_PROXIES; pid++) {
if (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) {
proxy = LbxPidToProxy(pid);
lbxcp = (proxy != NULL) ? proxy->lbxClients[0] : NULL;
if (lbxcp && (client = lbxcp->client))
LbxSendInvalidateTag(client, tid, td->data_type);
td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
}
}
if (td->data_type != LbxTagTypeProperty || !LbxFlushQTag(tid))
FreeResource(tid, 0);
else if (td->global) {
*(td->global) = 0;
td->global = NULL;
}
}
TagData
TagGetTag(XID tid)
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
return td;
}
static void
LbxFlushTag(pointer value,
XID tid,
pointer cdata)
{
TagData td = (TagData)value;
LbxProxyPtr proxy = (LbxProxyPtr)cdata;
int i;
if ((td->data_type == LbxTagTypeProperty) && td->global) {
PropertyPtr pProp = (PropertyPtr)td->tdata;
if ((pProp->tag_id == tid) && (pProp->owner_pid == proxy->pid)) {
LbxFlushQTag(tid);
pProp->size = 0;
FreeResource(tid, 0);
return;
}
}
td->sent_to_proxy[proxy->pid >> 3] &= ~(1 << (proxy->pid & 7));
for (i = 0; i < (MAX_NUM_PROXIES + 7) / 8; i++) {
if (td->sent_to_proxy[i])
return;
}
FreeResource(tid, 0);
}
/*
* clear out markers for proxies
*/
void
LbxFlushTags(LbxProxyPtr proxy)
{
FindClientResourcesByType(NULL, TagResType, LbxFlushTag, (pointer)proxy);
}

View File

@ -1,86 +0,0 @@
/* $Xorg: lbxtags.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/*
* Copyright 1993 Network Computing Devices, Inc.
*
* 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, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _LBXTAGS_H_
#define _LBXTAGS_H_
#include "lbxserve.h"
#include "os.h"
#include "opaque.h"
#include "resource.h"
#include <X11/X.h>
#include <X11/Xproto.h>
typedef struct _tagdata {
XID tid;
short data_type;
unsigned char sent_to_proxy[(MAX_NUM_PROXIES + 7) / 8];
int size;
pointer tdata;
XID *global;
} TagDataRec;
typedef struct _tagdata *TagData;
extern void TagInit ( void );
extern XID TagNewTag ( void );
extern void TagClearProxy ( XID tid, int pid );
extern void TagMarkProxy ( XID tid, int pid );
extern Bool TagProxyMarked ( XID tid, int pid );
extern XID TagSaveTag ( int dtype, int size, pointer data, XID *global );
extern void TagDeleteTag ( XID tid );
extern TagData TagGetTag ( XID tid );
extern void LbxFlushTags ( LbxProxyPtr proxy );
#endif /* _LBXTAGS_H_ */

View File

@ -1,420 +0,0 @@
/* $Xorg: lbxzerorep.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
/*
Copyright 1996, 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.
*/
/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */
/*
* This module handles zeroing out unused pad bytes in core X replies.
* This will hopefully improve both stream and delta compression,
* since we are removing the random values in pad bytes.
*/
#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
void
ZeroReplyPadBytes (char *buf,
int reqType)
{
switch (reqType) {
case X_GetWindowAttributes:
{
xGetWindowAttributesReply *reply = (xGetWindowAttributesReply *) buf;
reply->pad = 0;
break;
}
case X_GetGeometry:
{
xGetGeometryReply *reply = (xGetGeometryReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
break;
}
case X_QueryTree:
{
xQueryTreeReply *reply = (xQueryTreeReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
break;
}
case X_InternAtom:
{
xInternAtomReply *reply = (xInternAtomReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_GetAtomName:
{
xGetAtomNameReply *reply = (xGetAtomNameReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetProperty:
{
xGetPropertyReply *reply = (xGetPropertyReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
break;
}
case X_ListProperties:
{
xListPropertiesReply *reply = (xListPropertiesReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetSelectionOwner:
{
xGetSelectionOwnerReply *reply = (xGetSelectionOwnerReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_GrabKeyboard:
case X_GrabPointer:
{
xGrabKeyboardReply *reply = (xGrabKeyboardReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_QueryPointer:
{
xQueryPointerReply *reply = (xQueryPointerReply *) buf;
reply->pad1 = 0;
reply->pad = 0;
break;
}
case X_GetMotionEvents:
{
xGetMotionEventsReply *reply = (xGetMotionEventsReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_TranslateCoords:
{
xTranslateCoordsReply *reply = (xTranslateCoordsReply *) buf;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
break;
}
case X_GetInputFocus:
{
xGetInputFocusReply *reply = (xGetInputFocusReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
break;
}
case X_QueryKeymap:
{
xQueryKeymapReply *reply = (xQueryKeymapReply *) buf;
reply->pad1 = 0;
break;
}
case X_QueryFont:
{
xQueryFontReply *reply = (xQueryFontReply *) buf;
reply->pad1 = 0;
break;
}
case X_QueryTextExtents:
{
xQueryTextExtentsReply *reply = (xQueryTextExtentsReply *) buf;
reply->pad = 0;
break;
}
case X_ListFonts:
{
xListFontsReply *reply = (xListFontsReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetFontPath:
{
xGetFontPathReply *reply = (xGetFontPathReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetImage:
{
xGetImageReply *reply = (xGetImageReply *) buf;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_ListInstalledColormaps:
{
xListInstalledColormapsReply *reply =
(xListInstalledColormapsReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_AllocColor:
{
xAllocColorReply *reply = (xAllocColorReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
break;
}
case X_AllocNamedColor:
{
xAllocNamedColorReply *reply = (xAllocNamedColorReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
break;
}
case X_AllocColorCells:
{
xAllocColorCellsReply *reply = (xAllocColorCellsReply *) buf;
reply->pad1 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_AllocColorPlanes:
{
xAllocColorPlanesReply *reply = (xAllocColorPlanesReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
break;
}
case X_QueryColors:
{
xQueryColorsReply *reply = (xQueryColorsReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_LookupColor:
{
xLookupColorReply *reply = (xLookupColorReply *) buf;
reply->pad1 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
break;
}
case X_QueryBestSize:
{
xQueryBestSizeReply *reply = (xQueryBestSizeReply *) buf;
reply->pad1 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_QueryExtension:
{
xQueryExtensionReply *reply = (xQueryExtensionReply *) buf;
reply->pad1 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_ListExtensions:
{
xListExtensionsReply *reply = (xListExtensionsReply *) buf;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_SetPointerMapping:
case X_SetModifierMapping:
{
xSetMappingReply *reply = (xSetMappingReply *) buf;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetPointerMapping:
{
xGetPointerMappingReply *reply = (xGetPointerMappingReply *) buf;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetKeyboardMapping:
{
xGetKeyboardMappingReply *reply = (xGetKeyboardMappingReply *) buf;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
case X_GetModifierMapping:
{
xGetModifierMappingReply *reply = (xGetModifierMappingReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_GetKeyboardControl:
{
xGetKeyboardControlReply *reply = (xGetKeyboardControlReply *) buf;
reply->pad = 0;
break;
}
case X_GetPointerControl:
{
xGetPointerControlReply *reply = (xGetPointerControlReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_GetScreenSaver:
{
xGetScreenSaverReply *reply = (xGetScreenSaverReply *) buf;
reply->pad1 = 0;
reply->pad2 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
break;
}
case X_ListHosts:
{
xListHostsReply *reply = (xListHostsReply *) buf;
reply->pad1 = 0;
reply->pad3 = 0;
reply->pad4 = 0;
reply->pad5 = 0;
reply->pad6 = 0;
reply->pad7 = 0;
break;
}
}
}

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.32 2006/03/12 00:11:34 krh Exp $ */
/* $XdotOrg: xserver/xorg/mi/miinitext.c,v 1.33 2006/06/01 18:47:01 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.67 2003/01/12 02:44:27 dawes Exp $ */
/***********************************************************
@ -143,9 +143,6 @@ extern Bool noFontCacheExtension;
#ifdef GLXEXT
extern Bool noGlxExtension;
#endif
#ifdef LBX
extern Bool noLbxExtension;
#endif
#ifdef SCREENSAVER
extern Bool noScreenSaverExtension;
#endif
@ -241,10 +238,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef XKB
#include <X11/extensions/XKB.h>
#endif
#ifdef LBX
#define _XLBX_SERVER_
#include <X11/extensions/lbxstr.h>
#endif
#ifdef XPRINT
#include <X11/extensions/Print.h>
#endif
@ -319,9 +312,6 @@ extern void XCMiscExtensionInit(INITARGS);
#ifdef XRECORD
extern void RecordExtensionInit(INITARGS);
#endif
#ifdef LBX
extern void LbxExtensionInit(INITARGS);
#endif
#ifdef DBE
extern void DbeExtensionInit(INITARGS);
#endif
@ -430,9 +420,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef GLXEXT
{ "GLX", &noGlxExtension },
#endif
#ifdef LBX
{ "LBX", &noLbxExtension },
#endif
#ifdef SCREENSAVER
{ "MIT-SCREEN-SAVER", &noScreenSaverExtension },
#endif
@ -598,9 +585,6 @@ InitExtensions(argc, argv)
#ifdef XRECORD
if (!noTestExtensions) RecordExtensionInit();
#endif
#ifdef LBX
if (!noLbxExtension) LbxExtensionInit();
#endif
#ifdef DBE
if (!noDbeExtension) DbeExtensionInit();
#endif
@ -706,9 +690,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef XKB
{ XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
#endif
#ifdef LBX
{ LbxExtensionInit, LBXNAME, &noLbxExtension, NULL, NULL },
#endif
#ifdef XAPPGROUP
{ XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
#endif

View File

@ -9,7 +9,6 @@ INTERNALMALLOC_SOURCES = xalloc.c
XCSECURITY_SOURCES = secauth.c
XDMCP_SOURCES = xdmcp.c
LBX_SOURCES = lbxio.c
STRLCAT_SOURCES = strlcat.c strlcpy.c
XORG_SOURCES = log.c
@ -38,10 +37,6 @@ if XDMCP
libos_la_SOURCES += $(XDMCP_SOURCES)
endif
if LBX
libos_la_SOURCES += $(LBX_SOURCES)
endif
if NEED_STRLCAT
libos_la_SOURCES += $(STRLCAT_SOURCES)
endif

View File

@ -1,5 +1,5 @@
/* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */
/* $XdotOrg: xserver/xorg/os/access.c,v 1.14 2006/01/07 00:45:17 ajax Exp $ */
/* $XdotOrg: xserver/xorg/os/access.c,v 1.15 2006/02/15 20:44:13 ajax Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@ -1391,10 +1391,6 @@ _X_EXPORT Bool LocalClient(ClientPtr client)
client->index);
return FALSE;
}
#endif
#ifdef LBX
if (!((OsCommPtr)client->osPrivate)->trans_conn)
return FALSE;
#endif
if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
&notused, &alen, &from))

View File

@ -154,12 +154,6 @@ extern __const__ int _nfiles;
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "colormapst.h"
#include "propertyst.h"
#include "lbxserve.h"
#include "osdep.h"
#endif
#ifdef X_NOT_POSIX
#define Pid_t int
@ -300,14 +294,6 @@ int ListenTransCount;
static void ErrorConnMax(XtransConnInfo /* trans_conn */);
#ifndef LBX
static
void CloseDownFileDescriptor(
OsCommPtr /*oc*/
);
#endif
static XtransConnInfo
lookup_trans_conn (int fd)
{
@ -564,10 +550,6 @@ AuthAudit (ClientPtr client, Bool letin,
char addr[128];
char *out = addr;
if (!((OsCommPtr)client->osPrivate)->trans_conn) {
strcpy(addr, "LBX proxy at ");
out += strlen(addr);
}
if (!len)
strcpy(out, "local host");
else
@ -654,67 +636,13 @@ ClientAuthorized(ClientPtr client,
XID auth_id;
char *reason = NULL;
XtransConnInfo trans_conn;
#ifdef LBX
int restore_trans_conn = 0;
ClientPtr lbxpc = NULL;
#endif
priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
#ifdef LBX
if (!trans_conn) {
/*
* Since trans_conn is NULL, this must be a proxy's client for
* which we have NO address. Therefore, we will temporarily
* set the client's trans_conn to the proxy's trans_conn and
* after CheckAuthorization the client's trans_conn will be
* restored.
*
* If XDM-AUTHORIZATION-1 is being used, CheckAuthorization
* will eventually call XdmAuthorizationValidate and this
* later function may use the client's trans_conn to get the
* client's address. Since a XDM-AUTH-1 auth string includes
* the client's address, this address is compared to the address
* in the client's trans_conn. If the proxy and client are
* on the same host, the comparison will fail; otherwise the
* comparison will fail and the client will not be authorized
* to connect to the server.
*
* The basis for this additional code is to prevent a
* NULL pointer dereference of the client's trans_conn.
* The fundamental problem - the fact that the client's
* trans_conn is NULL - is because the NewClient
* request in version 1.0 of the LBX protocol does not
* send the client's address to the server. When the
* spec is changed and the client's address is sent to
* server in the NewClient request, this additional code
* should be removed.
*
* See defect number XWSog08218 for more information.
*/
lbxpc = LbxProxyClient(priv->proxy);
trans_conn = ((OsCommPtr)lbxpc->osPrivate)->trans_conn;
priv->trans_conn = trans_conn;
restore_trans_conn = 1;
}
#endif
auth_id = CheckAuthorization (proto_n, auth_proto,
string_n, auth_string, client, &reason);
#ifdef LBX
if (! priv->trans_conn) {
if (auth_id == (XID) ~0L && !GetAccessControl())
auth_id = ((OsCommPtr)lbxpc->osPrivate)->auth_id;
#ifdef XCSECURITY
else if (auth_id != (XID) ~0L && !SecuritySameLevel(lbxpc, auth_id)) {
auth_id = (XID) ~0L;
reason = "Client trust level differs from that of LBX Proxy";
}
#endif
}
#endif
if (auth_id == (XID) ~0L)
{
if (
@ -725,11 +653,7 @@ ClientAuthorized(ClientPtr client,
_XSERVTransGetPeerAddr (trans_conn,
&family, &fromlen, &from) != -1)
{
if (
#ifdef LBX
!trans_conn ||
#endif
InvalidHost ((struct sockaddr *) from, fromlen, client))
if (InvalidHost ((struct sockaddr *) from, fromlen, client))
AuthAudit(client, FALSE, (struct sockaddr *) from,
fromlen, proto_n, auth_proto, auth_id);
else
@ -745,14 +669,6 @@ ClientAuthorized(ClientPtr client,
}
if (auth_id == (XID) ~0L) {
#ifdef LBX
/*
* Restore client's trans_conn state
*/
if (restore_trans_conn) {
priv->trans_conn = NULL;
}
#endif
if (reason)
return reason;
else
@ -787,34 +703,16 @@ ClientAuthorized(ClientPtr client,
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
#ifdef LBX
if (restore_trans_conn) {
priv->trans_conn = NULL;
}
#endif
return((char *)NULL);
}
static ClientPtr
#ifdef LBX
AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time,
int (*Flush)(
ClientPtr /*who*/, OsCommPtr /*oc*/,
char * /*extraBuf*/, int /*extraCount*/),
void (*Close)(
ClientPtr /*client*/),
LbxProxyPtr proxy)
#else
AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
#endif
{
OsCommPtr oc;
ClientPtr client;
if (
#ifdef LBX
trans_conn &&
#endif
#ifndef WIN32
fd >= lastfdesc
#else
@ -831,36 +729,25 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
oc->output = (ConnectionOutputPtr)NULL;
oc->auth_id = None;
oc->conn_time = conn_time;
#ifdef LBX
oc->proxy = proxy;
oc->Flush = Flush;
oc->Close = Close;
oc->largereq = (ConnectionInputPtr) NULL;
#endif
if (!(client = NextAvailableClient((pointer)oc)))
{
xfree (oc);
return NullClient;
}
#ifdef LBX
if (trans_conn)
#endif
{
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
ConnectionTranslation[fd] = client->index;
#else
SetConnectionTranslation(fd, client->index);
SetConnectionTranslation(fd, client->index);
#endif
if (GrabInProgress)
{
FD_SET(fd, &SavedAllClients);
FD_SET(fd, &SavedAllSockets);
}
else
{
FD_SET(fd, &AllClients);
FD_SET(fd, &AllSockets);
}
if (GrabInProgress)
{
FD_SET(fd, &SavedAllClients);
FD_SET(fd, &SavedAllSockets);
}
else
{
FD_SET(fd, &AllClients);
FD_SET(fd, &AllSockets);
}
#ifdef DEBUG
@ -871,39 +758,6 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
return client;
}
#ifdef LBX
int
ClientConnectionNumber (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr) client->osPrivate;
return oc->fd;
}
ClientPtr
AllocLbxClientConnection (ClientPtr client, LbxProxyPtr proxy)
{
OsCommPtr oc = (OsCommPtr) client->osPrivate;
return AllocNewConnection ((XtransConnInfo)NULL, oc->fd, GetTimeInMillis(),
LbxFlushClient, LbxCloseClient, proxy);
}
void
LbxProxyConnection (ClientPtr client, LbxProxyPtr proxy)
{
OsCommPtr oc = (OsCommPtr) client->osPrivate;
FlushClient(client, oc, (char *)NULL, 0);
oc->proxy = proxy;
oc->Flush = LbxFlushClient;
oc->Close = LbxCloseClient;
LbxPrimeInput(client, proxy);
}
#endif
/*****************
* EstablishNewConnections
* If anyone is waiting on listened sockets, accept them.
@ -982,12 +836,7 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
_XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
if (!AllocNewConnection (new_trans_conn, newconn, connect_time
#ifdef LBX
, StandardFlushClient,
CloseDownFileDescriptor, (LbxProxyPtr)NULL
#endif
))
if (!AllocNewConnection (new_trans_conn, newconn, connect_time))
{
ErrorConnMax(new_trans_conn);
_XSERVTransClose(new_trans_conn);
@ -1056,27 +905,15 @@ ErrorConnMax(XtransConnInfo trans_conn)
* Remove this file descriptor and it's I/O buffers, etc.
************/
#ifdef LBX
void
CloseDownFileDescriptor(ClientPtr client)
#else
static void
CloseDownFileDescriptor(OsCommPtr oc)
#endif
{
#ifdef LBX
OsCommPtr oc = (OsCommPtr) client->osPrivate;
#endif
int connection = oc->fd;
if (oc->trans_conn) {
_XSERVTransDisconnect(oc->trans_conn);
_XSERVTransClose(oc->trans_conn);
}
#ifndef LBX
FreeOsBuffers(oc);
xfree(oc);
#endif
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
@ -1171,13 +1008,7 @@ CloseDownConnection(ClientPtr client)
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
#ifndef LBX
CloseDownFileDescriptor(oc);
#else
(*oc->Close) (client);
FreeOsBuffers(oc);
xfree(oc);
#endif
client->osPrivate = (pointer)NULL;
if (auditTrailLevel > 1)
AuditF("client %d disconnected\n", client->index);
@ -1266,17 +1097,8 @@ IgnoreClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
#ifdef LBX
LbxClientPtr lbxClient = LbxClient(client);
#endif
isItTimeToYield = TRUE;
#ifdef LBX
if (lbxClient) {
lbxClient->ignored = TRUE;
return;
}
#endif
if (!GrabInProgress || FD_ISSET(connection, &AllClients))
{
if (FD_ISSET (connection, &ClientsWithInput))
@ -1310,14 +1132,6 @@ AttendClient (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
#ifdef LBX
LbxClientPtr lbxClient = LbxClient(client);
if (lbxClient) {
lbxClient->ignored = FALSE;
return;
}
#endif
if (!GrabInProgress || GrabInProgress == client->index ||
FD_ISSET(connection, &GrabImperviousClients))
{

86
os/io.c
View File

@ -85,11 +85,6 @@ SOFTWARE.
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
#ifdef LBX
#include "colormapst.h"
#include "propertyst.h"
#include "lbxserve.h"
#endif
_X_EXPORT CallbackListPtr ReplyCallback;
_X_EXPORT CallbackListPtr FlushCallback;
@ -200,25 +195,8 @@ OsCommPtr AvailableInput = (OsCommPtr)NULL;
#define YieldControlDeath() \
{ timesThisConnection = 0; }
#ifdef hpux_not_tog
#define LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
#endif
#ifdef LBX
#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
#undef ReadRequestFromClient
int
ReadRequestFromClient(ClientPtr client)
{
return (*client->readRequest)(client);
}
#endif
int
StandardReadRequestFromClient(ClientPtr client)
#else
int
ReadRequestFromClient(ClientPtr client)
#endif
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->input;
@ -368,13 +346,6 @@ ReadRequestFromClient(ClientPtr client)
YieldControlDeath();
return -1;
}
#ifdef LBX
if (oc->proxy && oc->proxy->compHandle)
result = (*oc->proxy->streamOpts.streamCompRead)(fd,
(unsigned char *)oci->buffer + oci->bufcnt,
oci->size - oci->bufcnt);
else
#endif
result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
oci->size - oci->bufcnt);
if (result <= 0)
@ -382,17 +353,7 @@ ReadRequestFromClient(ClientPtr client)
if ((result < 0) && ETEST(errno))
{
#if defined(SVR4) && defined(i386) && !defined(sun)
#if defined(LBX) && 0
/*
* For LBX connections, we can get a valid EWOULDBLOCK
* There is probably a better way of distinguishing LBX
* connections, but this works. (DHD)
*/
extern int LbxRead();
if (oc->Read == LbxRead)
#else
if (0)
#endif
#endif
{
YieldControlNoInput();
@ -610,18 +571,6 @@ ResetCurrentRequest(ClientPtr client)
int fd = oc->fd;
register xReq *request;
int gotnow, needed;
#ifdef LBX
LbxClientPtr lbxClient = LbxClient(client);
if (lbxClient) {
LbxSetForBlock(lbxClient);
if (!oci) {
AppendFakeRequest(client,
client->requestBuffer, client->req_len << 2);
return;
}
}
#endif
if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
oci->lenLastReq = 0;
@ -850,11 +799,7 @@ FlushAllOutput(void)
if (client->clientGone)
continue;
oc = (OsCommPtr)client->osPrivate;
if (
#ifdef LBX
!oc->proxy &&
#endif
FD_ISSET(oc->fd, &ClientsWithInput))
if (FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &OutputPending); /* set the bit again */
NewOutputPending = TRUE;
@ -874,11 +819,7 @@ FlushAllOutput(void)
if (client->clientGone)
continue;
oc = (OsCommPtr)client->osPrivate;
if (
#ifdef LBX
!oc->proxy &&
#endif
FD_ISSET(oc->fd, &ClientsWithInput))
if (FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &newOutputPending); /* set the bit again */
NewOutputPending = TRUE;
@ -1055,22 +996,8 @@ WriteToClient (ClientPtr who, int count, char *buf)
*
**********************/
#ifdef LBX
#ifdef LBX_NEED_OLD_SYMBOL_FOR_LOADABLES
#undef FlushClient
int
FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
{
return (*oc->Flush)(who, oc, extraBuf, extraCount);
}
#endif
int
StandardFlushClient(ClientPtr who, OsCommPtr oc,
char *extraBuf, int extraCount)
#else
int
FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
#endif
{
ConnectionOutputPtr oco = oc->output;
int connection = oc->fd;
@ -1274,9 +1201,6 @@ AllocateOutputBuffer(void)
}
oco->size = BUFSIZE;
oco->count = 0;
#ifdef LBX
oco->nocompress = FALSE;
#endif
return oco;
}
@ -1318,12 +1242,6 @@ FreeOsBuffers(OsCommPtr oc)
oco->count = 0;
}
}
#ifdef LBX
if ((oci = oc->largereq)) {
xfree(oci->buffer);
xfree(oci);
}
#endif
}
void

View File

@ -1,555 +0,0 @@
/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.17 2002/05/31 18:46:06 dawes Exp $ */
/*
Copyright 1996, 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.
*/
/***********************************************************
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
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 names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $Xorg: lbxio.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/Xtrans/Xtrans.h>
#include <X11/Xmd.h>
#include <errno.h>
#ifndef Lynx
#include <sys/param.h>
#ifndef __UNIXOS2__
#include <sys/uio.h>
#endif
#else
#include <uio.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os.h"
#include <X11/Xpoll.h>
#include "osdep.h"
#include "opaque.h"
#include "dixstruct.h"
#include "misc.h"
#include "colormapst.h"
#include "propertyst.h"
#include "lbxserve.h"
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
#ifdef EAGAIN
#define ETEST(err) (err == EAGAIN)
#else
#define ETEST(err) (err == EWOULDBLOCK)
#endif
#endif
#define get_req_len(req,cli) ((cli)->swapped ? \
lswaps((req)->length) : (req)->length)
#define YieldControl() \
{ isItTimeToYield = TRUE; \
timesThisConnection = 0; }
#define YieldControlNoInput() \
{ YieldControl(); \
FD_CLR(fd, &ClientsWithInput); }
void
SwitchClientInput (ClientPtr client, Bool pending)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
#ifndef WIN32
ConnectionTranslation[oc->fd] = client->index;
#else
SetConnectionTranslation(oc->fd, client->index);
#endif
if (pending)
FD_SET(oc->fd, &ClientsWithInput);
else
YieldControl();
}
void
LbxPrimeInput(ClientPtr client, LbxProxyPtr proxy)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->input;
if (oci && proxy->compHandle) {
char *extra = oci->bufptr + oci->lenLastReq;
int left = oci->bufcnt + oci->buffer - extra;
(*proxy->streamOpts.streamCompStuffInput)(oc->fd,
(unsigned char *)extra,
left);
oci->bufcnt -= left;
AvailableInput = oc;
}
}
void
AvailableClientInput (ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
if (FD_ISSET(oc->fd, &AllSockets))
FD_SET(oc->fd, &ClientsWithInput);
}
/*****************************************************************
* AppendFakeRequest
* Append a (possibly partial) request in as the last request.
*
**********************/
Bool
AppendFakeRequest (ClientPtr client, char *data, int count)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
int gotnow;
if (!oci)
{
if ((oci = FreeInputs))
FreeInputs = oci->next;
else if (!(oci = AllocateInputBuffer()))
return FALSE;
oc->input = oci;
} else if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
/* do not free AvailableInput here, it could be proxy's */
oci->bufptr += oci->lenLastReq;
oci->lenLastReq = 0;
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
if ((gotnow + count) > oci->size)
{
char *ibuf;
ibuf = (char *)xrealloc(oci->buffer, gotnow + count);
if (!ibuf)
return(FALSE);
oci->size = gotnow + count;
oci->buffer = ibuf;
oci->bufptr = ibuf + oci->bufcnt - gotnow;
}
if (oci->bufcnt + count > oci->size) {
memmove(oci->buffer, oci->bufptr, gotnow);
oci->bufcnt = gotnow;
oci->bufptr = oci->buffer;
}
memmove(oci->bufptr + gotnow, data, count);
oci->bufcnt += count;
gotnow += count;
if ((gotnow >= sizeof(xReq)) &&
(gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2)))
FD_SET(fd, &ClientsWithInput);
else
YieldControlNoInput();
return(TRUE);
}
static int
LbxWrite(XtransConnInfo trans_conn, LbxProxyPtr proxy,
char *buf, int len)
{
struct iovec iov;
int n;
int notWritten;
notWritten = len;
iov.iov_base = buf;
iov.iov_len = len;
while (notWritten) {
errno = 0;
if (proxy->compHandle)
n = (*proxy->streamOpts.streamCompWriteV)(proxy->fd, &iov, 1);
else
n = _XSERVTransWritev(trans_conn, &iov, 1);
if (n >= 0) {
iov.iov_base = (char *)iov.iov_base + n;
notWritten -= n;
iov.iov_len = notWritten;
}
else if (ETEST(errno)
#ifdef SUNSYSV /* check for another brain-damaged OS bug */
|| (errno == 0)
#endif
#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
|| ((errno == EMSGSIZE) && (iov.iov_len == 1))
#endif
)
break;
#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
else if (errno == EMSGSIZE)
iov.iov_len >>= 1;
#endif
else
return -1;
}
return len - notWritten;
}
static Bool
LbxAppendOutput(LbxProxyPtr proxy, ClientPtr client, ConnectionOutputPtr oco)
{
ConnectionOutputPtr noco = proxy->olast;
LbxClientPtr lbxClient = LbxClient(client);
if (!lbxClient) {
xfree(oco->buf);
xfree(oco);
return TRUE;
}
if (noco)
LbxReencodeOutput(client,
(char *)noco->buf, &noco->count,
(char *)oco->buf, &oco->count);
else
LbxReencodeOutput(client,
(char *)NULL, (int *)NULL,
(char *)oco->buf, &oco->count);
if (!oco->count) {
if (oco->size > BUFWATERMARK)
{
xfree(oco->buf);
xfree(oco);
}
else
{
oco->next = FreeOutputs;
FreeOutputs = oco;
}
return TRUE;
}
if ((lbxClient->id != proxy->cur_send_id) && proxy->lbxClients[0]) {
xLbxSwitchEvent *ev;
int n;
if (!noco || (noco->size - noco->count) < sz_xLbxSwitchEvent) {
if ((noco = FreeOutputs))
FreeOutputs = noco->next;
else
noco = AllocateOutputBuffer();
if (!noco) {
MarkClientException(client);
return FALSE;
}
noco->next = NULL;
if (proxy->olast)
proxy->olast->next = noco;
else
proxy->ofirst = noco;
proxy->olast = noco;
}
ev = (xLbxSwitchEvent *) (noco->buf + noco->count);
noco->count += sz_xLbxSwitchEvent;
proxy->cur_send_id = lbxClient->id;
ev->type = LbxEventCode;
ev->lbxType = LbxSwitchEvent;
ev->pad = 0;
ev->client = proxy->cur_send_id;
if (LbxProxyClient(proxy)->swapped) {
swapl(&ev->client, n);
}
}
oco->next = NULL;
if (proxy->olast)
proxy->olast->next = oco;
else
proxy->ofirst = oco;
proxy->olast = oco;
return TRUE;
}
static int
LbxClientOutput(ClientPtr client, OsCommPtr oc,
char *extraBuf, int extraCount, Bool nocompress)
{
ConnectionOutputPtr oco;
int len;
if ((oco = oc->output)) {
oc->output = NULL;
if (!LbxAppendOutput(oc->proxy, client, oco))
return -1;
}
if (extraCount) {
NewOutputPending = TRUE;
FD_SET(oc->fd, &OutputPending);
len = (extraCount + 3) & ~3;
if ((oco = FreeOutputs) && (oco->size >= len))
FreeOutputs = oco->next;
else {
oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput));
if (!oco) {
MarkClientException(client);
return -1;
}
oco->size = len;
if (oco->size < BUFSIZE)
oco->size = BUFSIZE;
oco->buf = (unsigned char *) xalloc(oco->size);
if (!oco->buf) {
xfree(oco);
MarkClientException(client);
return -1;
}
}
oco->count = len;
oco->nocompress = nocompress;
memmove((char *)oco->buf, extraBuf, extraCount);
if (!nocompress && oco->count < oco->size)
oc->output = oco;
else if (!LbxAppendOutput(oc->proxy, client, oco))
return -1;
}
return extraCount;
}
void
LbxForceOutput(LbxProxyPtr proxy)
{
int i;
LbxClientPtr lbxClient;
OsCommPtr coc;
ConnectionOutputPtr oco;
for (i = proxy->maxIndex; i >= 0; i--) { /* proxy must be last */
lbxClient = proxy->lbxClients[i];
if (!lbxClient)
continue;
coc = (OsCommPtr)lbxClient->client->osPrivate;
if ((oco = coc->output)) {
coc->output = NULL;
LbxAppendOutput(proxy, lbxClient->client, oco);
}
}
}
int
LbxFlushClient(ClientPtr who, OsCommPtr oc,
char *extraBuf, int extraCount)
{
LbxProxyPtr proxy;
ConnectionOutputPtr oco;
int n;
XtransConnInfo trans_conn = NULL;
if (extraBuf)
return LbxClientOutput(who, oc, extraBuf, extraCount, FALSE);
proxy = oc->proxy;
if (!proxy->lbxClients[0])
return 0;
LbxForceOutput(proxy);
if (!proxy->compHandle)
trans_conn = ((OsCommPtr)LbxProxyClient(proxy)->osPrivate)->trans_conn;
while ((oco = proxy->ofirst)) {
/* XXX bundle up into writev someday */
if (proxy->compHandle) {
if (oco->nocompress)
(*proxy->streamOpts.streamCompOff)(proxy->fd);
n = LbxWrite(NULL, proxy, (char *)oco->buf, oco->count);
if (oco->nocompress)
(*proxy->streamOpts.streamCompOn)(proxy->fd);
} else
n = LbxWrite(trans_conn, proxy, (char *)oco->buf, oco->count);
if (n < 0) {
ClientPtr pclient = LbxProxyClient(proxy);
if (proxy->compHandle)
trans_conn = ((OsCommPtr)pclient->osPrivate)->trans_conn;
_XSERVTransDisconnect(trans_conn);
_XSERVTransClose(trans_conn);
((OsCommPtr)pclient->osPrivate)->trans_conn = NULL;
MarkClientException(pclient);
return 0;
} else if (n == oco->count) {
proxy->ofirst = oco->next;
if (!proxy->ofirst)
proxy->olast = NULL;
if (oco->size > BUFWATERMARK)
{
xfree(oco->buf);
xfree(oco);
}
else
{
oco->next = FreeOutputs;
oco->count = 0;
FreeOutputs = oco;
}
} else {
if (n) {
oco->count -= n;
memmove((char *)oco->buf, (char *)oco->buf + n, oco->count);
}
break;
}
}
if ((proxy->compHandle &&
(*proxy->streamOpts.streamCompFlush)(proxy->fd)) ||
proxy->ofirst) {
FD_SET(proxy->fd, &ClientsWriteBlocked);
AnyClientsWriteBlocked = TRUE;
}
return 0;
}
int
UncompressedWriteToClient (ClientPtr who, int count, char *buf)
{
return LbxClientOutput(who, (OsCommPtr)who->osPrivate, buf, count, TRUE);
}
void
LbxFreeOsBuffers(LbxProxyPtr proxy)
{
ConnectionOutputPtr oco;
while ((oco = proxy->ofirst)) {
proxy->ofirst = oco->next;
xfree(oco->buf);
xfree(oco);
}
}
Bool
AllocateLargeReqBuffer(ClientPtr client, int size)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci;
if (!(oci = oc->largereq)) {
if ((oci = FreeInputs))
FreeInputs = oci->next;
else {
oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput));
if (!oci)
return FALSE;
oci->buffer = NULL;
oci->size = 0;
}
}
if (oci->size < size) {
char *ibuf;
oci->size = size;
if (size < BUFSIZE)
oci->size = BUFSIZE;
if (!(ibuf = (char *)xrealloc(oci->buffer, oci->size)))
{
xfree(oci->buffer);
xfree(oci);
oc->largereq = NULL;
return FALSE;
}
oci->buffer = ibuf;
}
oci->bufptr = oci->buffer;
oci->bufcnt = 0;
oci->lenLastReq = size;
oc->largereq = oci;
return TRUE;
}
Bool
AddToLargeReqBuffer(ClientPtr client, char *data, int size)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->largereq;
if (!oci || (oci->bufcnt + size > oci->lenLastReq))
return FALSE;
memcpy(oci->buffer + oci->bufcnt, data, size);
oci->bufcnt += size;
return TRUE;
}
static OsCommRec lbxAvailableInput;
int
PrepareLargeReqBuffer(ClientPtr client)
{
OsCommPtr oc = (OsCommPtr)client->osPrivate;
ConnectionInputPtr oci = oc->largereq;
if (!oci)
return client->req_len << 2;
oc->largereq = NULL;
if (oci->bufcnt != oci->lenLastReq) {
xfree(oci->buffer);
xfree(oci);
return client->req_len << 2;
}
client->requestBuffer = oci->buffer;
client->req_len = oci->lenLastReq >> 2;
oci->bufcnt = 0;
oci->lenLastReq = 0;
if (AvailableInput)
{
ConnectionInputPtr aci = AvailableInput->input;
if (aci->size > BUFWATERMARK)
{
xfree(aci->buffer);
xfree(aci);
}
else
{
aci->next = FreeInputs;
FreeInputs = aci;
}
AvailableInput->input = (ConnectionInputPtr)NULL;
}
lbxAvailableInput.input = oci;
AvailableInput = &lbxAvailableInput;
return client->req_len << 2;
}

View File

@ -145,9 +145,6 @@ typedef struct _connectionOutput {
int size;
unsigned char *buf;
int count;
#ifdef LBX
Bool nocompress;
#endif
} ConnectionOutput, *ConnectionOutputPtr;
#ifdef K5AUTH
@ -160,10 +157,6 @@ typedef struct _k5_state {
} k5_state;
#endif
#ifdef LBX
typedef struct _LbxProxy *OsProxyPtr;
#endif
struct _osComm;
#define AuthInitArgs void
@ -204,33 +197,14 @@ typedef struct _osComm {
#endif
CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
#ifdef LBX
OsProxyPtr proxy;
ConnectionInputPtr largereq;
OsCloseFunc Close;
OsFlushFunc Flush;
#endif
} OsCommRec, *OsCommPtr;
#ifdef LBX
#define FlushClient(who, oc, extraBuf, extraCount) \
(*(oc)->Flush)(who, oc, extraBuf, extraCount)
extern int StandardFlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
);
extern int LbxFlushClient(ClientPtr /*who*/, OsCommPtr /*oc*/,
char * /*extraBuf*/, int /*extraCount*/);
#else
extern int FlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
int /*extraCount*/
);
#endif
extern void FreeOsBuffers(
OsCommPtr /*oc*/

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xserver/xorg/os/utils.c,v 1.24 2006/02/16 07:17:31 keithp Exp $ */
/* $XdotOrg: xserver/xorg/os/utils.c,v 1.25 2006/03/25 19:52:05 ajax Exp $ */
/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */
/*
@ -164,9 +164,6 @@ _X_EXPORT Bool noFontCacheExtension = FALSE;
#ifdef GLXEXT
_X_EXPORT Bool noGlxExtension = FALSE;
#endif
#ifdef LBX
_X_EXPORT Bool noLbxExtension = FALSE;
#endif
#ifdef SCREENSAVER
_X_EXPORT Bool noScreenSaverExtension = FALSE;
#endif