diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/assert.h | 34 | ||||
-rw-r--r-- | include/atomcache.h | 104 | ||||
-rw-r--r-- | include/cache.h | 128 | ||||
-rw-r--r-- | include/colormap.h | 310 | ||||
-rw-r--r-- | include/init.h | 79 | ||||
-rw-r--r-- | include/lbx.h | 736 | ||||
-rw-r--r-- | include/lbxext.h | 167 | ||||
-rw-r--r-- | include/misc.h | 120 | ||||
-rw-r--r-- | include/os.h | 278 | ||||
-rw-r--r-- | include/pm.h | 60 | ||||
-rw-r--r-- | include/pmP.h | 117 | ||||
-rw-r--r-- | include/proxyopts.h | 144 | ||||
-rw-r--r-- | include/reqtype.h | 71 | ||||
-rw-r--r-- | include/resource.h | 137 | ||||
-rw-r--r-- | include/swap.h | 254 | ||||
-rw-r--r-- | include/tags.h | 134 | ||||
-rw-r--r-- | include/util.h | 227 | ||||
-rw-r--r-- | include/wire.h | 419 |
18 files changed, 3519 insertions, 0 deletions
diff --git a/include/assert.h b/include/assert.h new file mode 100644 index 0000000..3e0b8c2 --- /dev/null +++ b/include/assert.h @@ -0,0 +1,34 @@ +/* $Xorg: assert.h,v 1.3 2000/08/17 19:53:57 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. + * + * $NCDId$ + */ +#ifdef DEBUG +#include <stdio.h> +#ifdef SABER +#define assert(ex) {if (!(ex)){(void)fprintf(stderr,"Assertion \"ex\" failed: file \"%s\", line %d\n", __FILE__, __LINE__);saber_stop();}} +#else +#define assert(ex) {if (!(ex)){(void)fprintf(stderr,"Assertion \"ex\" failed: file \"%s\", line %d\n", __FILE__, __LINE__);abort();}} +#endif +#else +#define assert(ex) +#endif diff --git a/include/atomcache.h b/include/atomcache.h new file mode 100644 index 0000000..d94228d --- /dev/null +++ b/include/atomcache.h @@ -0,0 +1,104 @@ +/* $Xorg: atomcache.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ +#ifndef _ATOMCACHE_H_ +#define _ATOMCACHE_H_ + +#define AtomPreInternFlag 0x1 +#define AtomWMCacheFlag 0x2 +#define AtomNoCacheFlag 0x4 + +typedef struct { + unsigned char flags; + int len; + char *name; +} AtomControlRec, *AtomControlPtr; + +typedef struct _AtomList { + char *name; + unsigned char flags; + int len; + int hash; + Atom atom; +} AtomListRec, *AtomListPtr; + +#define DEF_KEEP_PROP_SIZE 8 + +extern int min_keep_prop_size; + +extern Atom LbxMakeAtom( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + char * /*string*/, + unsigned /*len*/, + Atom /*atom*/, + int /*makeit*/ +#endif +); + +extern char *NameForAtom( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Atom /*atom*/ +#endif +); + +extern unsigned FlagsForAtom( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Atom /*atom*/ +#endif +); + +extern void FreeAtoms( +#if NeedFunctionPrototypes + void +#endif +); + +#endif /* _ATOMCACHE_H_ */ diff --git a/include/cache.h b/include/cache.h new file mode 100644 index 0000000..3637a09 --- /dev/null +++ b/include/cache.h @@ -0,0 +1,128 @@ +/* $Xorg: cache.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ +/* + +Copyright 1994, 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 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * 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 names of Network Computing Devices + * or Digital not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Network Computing Devices and Digital + * make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES OR 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. + * + */ + +#ifndef _CACHE_H_ +#define _CACHE_H_ + +#define CacheWasReset 1 +#define CacheEntryFreed 2 +#define CacheEntryOld 3 + +#define MAX_NUM_CACHES 2 + +typedef unsigned long CacheID; +typedef unsigned long Cache; +typedef void (*CacheFree) (); + +typedef struct _cache *CachePtr; + +extern Cache CacheInit( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + unsigned long /*maxsize*/ +#endif +); + +extern void CacheFreeCache( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cid*/ +#endif +); + +extern Bool CacheTrimNeeded( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cid*/ +#endif +); + +extern void CacheTrim( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cid*/ +#endif +); + +extern Bool CacheStoreMemory( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cid*/, + CacheID /*id*/, + pointer /*data*/, + unsigned long /*size*/, + CacheFree /*free_func*/, + Bool /*can_flush*/ +#endif +); + +extern pointer CacheFetchMemory( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cid*/, + CacheID /*id*/, + Bool /*update*/ +#endif +); + +extern void CacheFreeMemory( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cacheid*/, + CacheID /*cid*/, + Bool /*notify*/ +#endif +); + +#endif /* _CACHE_H_ */ diff --git a/include/colormap.h b/include/colormap.h new file mode 100644 index 0000000..39fdf3a --- /dev/null +++ b/include/colormap.h @@ -0,0 +1,310 @@ +/* $Xorg: colormap.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ + +#ifndef COLORMAP_H_ +#define COLORMAP_H_ + +typedef struct _rgbentry { + char *name; + int namelen; + VisualID visual; + CARD16 xred, + xblue, + xgreen; /* exact */ + CARD16 vred, + vblue, + vgreen; /* visual */ +} RGBEntryRec, *RGBEntryPtr; + +typedef struct _RGBEntry { + struct _RGBEntry *next; + RGBEntryRec color; +} RGBCacheEntryRec, *RGBCacheEntryPtr; + +#define NBUCKETS 16 + +typedef CARD32 Pixel; + +#define PIXEL_FREE 0 +#define PIXEL_PRIVATE 1 +#define PIXEL_SHARED 2 + +typedef struct _entry { + CARD16 red, + green, + blue; + char status; + char server_ref; + int refcnt; + Pixel pixel; +} Entry; + + +#define CMAP_NOT_GRABBED 0 +#define CMAP_GRAB_REQUESTED 1 +#define CMAP_GRABBED 2 + +#define DynamicClass 1 + +typedef struct _visual { + int class; + VisualID id; + int depth; + int bitsPerRGB; + int colormapEntries; + CARD32 redMask, greenMask, blueMask; + int offsetRed, offsetGreen, offsetBlue; +} LbxVisualRec, *LbxVisualPtr; + +#define NUMRED(pv) (((pv)->redMask >> (pv)->offsetRed) + 1) +#define NUMGREEN(pv) (((pv)->greenMask >> (pv)->offsetGreen) + 1) +#define NUMBLUE(pv) (((pv)->blueMask >> (pv)->offsetBlue) + 1) +#define REDPART(pv,pix) (((pix) & (pv)->redMask) >> (pv)->offsetRed) +#define GREENPART(pv,pix) (((pix) & (pv)->greenMask) >> (pv)->offsetGreen) +#define BLUEPART(pv,pix) (((pix) & (pv)->blueMask) >> (pv)->offsetBlue) + +typedef struct _cmap { + Colormap id; + LbxVisualPtr pVisual; + Bool grab_status; + Entry *red; + Entry *green; + Entry *blue; + int *numPixelsRed; + int *numPixelsGreen; + int *numPixelsBlue; + Pixel **clientPixelsRed; + Pixel **clientPixelsGreen; + Pixel **clientPixelsBlue; +} ColormapRec, *ColormapPtr; + + +extern void (* LbxResolveColor)( +#if NeedNestedPrototypes + LbxVisualPtr /* pVisual */, + CARD16* /* red */, + CARD16* /* green */, + CARD16* /* blue */ +#endif +); + +extern void ResolveColor( +#if NeedFunctionPrototypes + LbxVisualPtr /* pVisual */, + CARD16* /* red */, + CARD16* /* green */, + CARD16* /* blue */ +#endif +); + +extern Pixel (* LbxFindFreePixel)( +#if NeedFunctionPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */ +#endif +); + +extern Pixel FindFreePixel( +#if NeedFunctionPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */ +#endif +); + +extern Entry * (* LbxFindBestPixel)( +#if NeedNestedPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */, + int /* channels */ +#endif +); + +extern Entry * FindBestPixel( +#if NeedNestedPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */, + int /* channels */ +#endif +); + +extern RGBEntryPtr FindColorName( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + char * /*name*/, + int /*len*/, + LbxVisualPtr /*pVisual*/ +#endif +); + +extern Bool AddColorName( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + char * /*name*/, + int /*len*/, + RGBEntryRec * /*rgbe*/ +#endif +); + +extern int CreateVisual( +#if NeedFunctionPrototypes + int /*depth*/, + xVisualType * /*vis*/ +#endif +); + +extern LbxVisualPtr GetVisual( +#if NeedFunctionPrototypes + VisualID /*vid*/ +#endif +); + +extern int FindPixel( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + ColormapPtr /*pmap*/, + CARD32 /*red*/, + CARD32 /*green*/, + CARD32 /*blue*/, + Entry ** /*pent*/ +#endif +); + +extern int StorePixel( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + ColormapPtr /*pmap*/, + CARD32 /*red*/, + CARD32 /*green*/, + CARD32 /*blue*/, + Pixel /*pixel*/, + Bool /*from_server*/ +#endif +); + +extern int FreeClientPixels( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + pointer /*pcr*/, + XID /*id*/ +#endif +); + +extern int IncrementPixel( +#if NeedFunctionPrototypes + ClientPtr /*pclient*/, + ColormapPtr /*pmap*/, + Entry * /*pent*/, + Bool /*from_server*/ +#endif +); + +extern int AllocCell( +#if NeedFunctionPrototypes + ClientPtr /*pclient*/, + ColormapPtr /*pmap*/, + Pixel /*pixel*/ +#endif +); + +extern int FreePixels( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + ColormapPtr /*pmap*/, + int /*num*/, + Pixel * /*pixels*/, + Pixel /*mask*/ +#endif +); + +extern int CreateColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Colormap /*cmap*/, + VisualID /*visual*/ +#endif +); + +extern int DestroyColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + pointer /*pmap*/, + XID /*id*/ +#endif +); + +extern int FreeColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Colormap /*cmap*/ +#endif +); + +extern int CopyAndFreeColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Colormap /*new*/, + Colormap /*old*/ +#endif +); + +extern void FreeColors( +#if NeedFunctionPrototypes + void +#endif +); + +#endif /* COLORMAP_H_ */ diff --git a/include/init.h b/include/init.h new file mode 100644 index 0000000..3de79fc --- /dev/null +++ b/include/init.h @@ -0,0 +1,79 @@ +/* $Xorg: init.h,v 1.4 2001/02/09 02:05:32 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. + * + */ + +#ifndef _INIT_H_ +#define _INIT_H_ + +extern struct _XDisplay* DisplayOpen( +#if NeedFunctionPrototypes + char * /*dpy_name*/, + int * /*request*/, + int * /*event*/, + int * /*error*/, + int * /*sequencep*/ +#endif +); + +extern int DisplayConnectionNumber( +#if NeedFunctionPrototypes + struct _XDisplay* /* dpy */ +#endif +); + +extern void DisplayGetConnSetup ( +#if NeedFunctionPrototypes + struct _XDisplay* /* dpy */, + xConnSetup** /* tag_data */, + int* /* len */, + int /* change_type */, + CARD32* /* changes */, + int /* change_len */ +#endif +); + +#endif diff --git a/include/lbx.h b/include/lbx.h new file mode 100644 index 0000000..04e46af --- /dev/null +++ b/include/lbx.h @@ -0,0 +1,736 @@ +/* $Xorg: lbx.h,v 1.4 2001/02/09 02:05:32 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. + * + */ + +#ifndef _LBX_H_ +#define _LBX_H_ +#include "misc.h" +#include "os.h" +#include "util.h" +#define _XLBX_SERVER_ +#include "lbxstr.h" + +/* we keep the ifdefs in the code as a guide to what's going on */ +/* but we want the proxy to work with all possible servers */ +#ifndef BIGREQS +#define BIGREQS +#endif + +/* cache stuff */ +#define MAX_ATOM_LENGTH 256 /* screw any large ones */ +#define MAX_COLORNAME_LENGTH 256 /* screw any large ones */ + + +typedef struct proptagdata { + Atom type; + int format; + int length; /* in bytes */ + pointer data; +} PropertyTagDataRec, *PropertyTagDataPtr; + +typedef struct _replystuff *ReplyStuffPtr; + +typedef Bool (*ReplyFunc)( +#if NeedNestedPrototypes + ClientPtr /*client*/, + ReplyStuffPtr /*nr*/, + char * /*data*/ +#endif +); + +typedef struct _replystuff { + int sequenceNumber; /* expected sequence number */ + int major; /* major opcode */ + int minor; /* minor opcode */ + ReplyFunc reply_func; /* function to handle reply */ + union { /* reply data */ + struct intern_data { + int len; + char str[MAX_ATOM_LENGTH]; + } xintern; + struct get_atom { + Atom atom; + } xgetatom; + struct colorname { + char name[MAX_COLORNAME_LENGTH]; + int namelen; + VisualID visual; + } xlookupcolor; + struct allocnamedcolor { + char name[MAX_COLORNAME_LENGTH]; + int namelen; + struct _cmap *pmap; + } xallocnamedcolor; + struct alloccolorcells { + struct _cmap *pmap; + } xalloccolorcells; + struct alloccolorplanes { + struct _cmap *pmap; + } xalloccolorplanes; + struct grabcmap { + struct _cmap *pmap; + Bool alloc_named; + CARD16 vred, + vgreen, + vblue; + CARD16 xred, + xgreen, + xblue; + } lbxgrabcmap; + struct getkeymap { + int count; + int first; + } lbxgetkeymap; + struct getprop { + CARD32 offset; + CARD32 length; + } lbxgetprop; + struct changeprop { + PropertyTagDataRec ptd; + } lbxchangeprop; + struct wingeom { + char got_geom_request; + char got_geom_reply; + CARD8 depth; + Window root B32; + INT16 x B16, y B16; + CARD16 width B16, height B16; + CARD16 borderWidth B16; + } lbxWinGeom; + struct queryextension { + char *name; + } lbxqueryextension; + struct getimage { +#ifdef LBX_STATS + Drawable drawable; + INT16 x; + INT16 y; +#endif + CARD16 width; + CARD16 height; + CARD8 format; + } lbxgetimage; + pointer lbxextensiondata; + } request_info; + ReplyStuffPtr next; +} ReplyStuffRec; + +typedef struct _replydata { + int dlen; + xReply reply; + pointer data; + int delay_seq_no; /* what seq i'm waiting for */ + struct _replydata *next; +} ReplyDataRec, *ReplyDataPtr; + + +#define LBX_LARGE_REQUEST_MIN_SIZE 1024 +#define LBX_LARGE_REQUEST_CHUNK_SIZE 512 + +#define LARGE_REQUEST_QUEUE_LEN 16 + +typedef struct { + ClientPtr client; + Bool compressed; + char *buf; + unsigned totalBytes; + unsigned bytesRead; + unsigned bytesWritten; +} LbxLargeRequestRec; + + +typedef struct _ClientPublic { + int (*writeToClient) (); + int (*uncompressedWriteToClient) (); + unsigned long (*requestLength) (); + int (*readRequest)(); +} ClientPublicRec, *ClientPublicPtr; + +typedef struct _Client { + int index; + XID ridBase; + XID ridMask; + pointer requestBuffer; + pointer osPrivate; /* for OS layer, including scheduler */ + Bool swapped; + void (*pSwapReplyFunc) ( +#if NeedNestedPrototypes + ClientPtr /* pClient */, + int /* size */, + void * /* pbuf */ +#endif +); + XID errorValue; + int sequence; + int closeDownMode; + int clientGone; + int noClientException; /* this client died or needs to be + * killed */ + XServerPtr server; + Drawable serverID; + GContext lastGCID; + pointer *saveSet; + int awaitingSetup; + int (**requestVector) ( +#if NeedNestedPrototypes + ClientPtr /* pClient */ +#endif +); + CARD32 req_len; /* length of current request */ + Bool big_requests; /* supports large requests */ + +#ifdef DEBUG +#define MAX_REQUEST_LOG 100 + unsigned char requestLog[MAX_REQUEST_LOG]; + int requestLogIndex; +#endif + + ClientPublicRec public; + int lbxIndex; + + Bool cache_safe; /* safe to short circuit request? */ + Bool can_delay_reply;/* safe to delay short-circuit request? */ + + int sequenceNumber; /* what we've seen */ + int sequence_lost; /* requests short-circuited */ + int lastForReply; /* last request with reply known coming */ + int lastForResponse;/* last request sent with event or reply */ + int lastResponse; /* last sequence number seen from server */ + + int yanked; /* total requests short-circuited */ + + KeyCode minKeyCode, + maxKeyCode; + + CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ + CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ + CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ + bitmapScanlinePad; /* 8, 16, 32 */ + CARD8 ZbitsPerPixel1; /* for ZPixmap depth 1 */ + Window rootWindow; /* root window of screen 0 */ + + ReplyStuffPtr replylist; /* list of pending replies */ + ReplyDataPtr replydata; /* list of delayed short-circuited replies */ + Drawable drawableCache[GFX_CACHE_SIZE]; + GContext gcontextCache[GFX_CACHE_SIZE]; + + LbxLargeRequestRec *largeRequest; + +} ClientRec; + + +#define WriteToClient(client,len,buf) (((client)->public.writeToClient)(client,len,buf)) +#define ReadRequestFromClient(client) ((client)->public.readRequest(client)) +#define RequestLength(r,client,g,p) (*(client)->public.requestLength) (r,client,g,p) + +#define LBXSequenceNumber(client) ((client->sequenceNumber) & 0xffff) +#define LBXCacheSafe(client) (client->cache_safe) +#define LBXCanDelayReply(client) (client->can_delay_reply) +#define LBXSequenceLost(client) (client->sequence_lost) +#define LBXYanked(client) (client->yanked) +#define LBXLastForReply(client) (client->lastForReply) +#define LBXLastForResponse(client) (client->lastForResponse) +#define LBXLastResponse(client) (client->lastResponse) +#define LBXReplyList(client) (client->replylist) +#define LBXReplyData(client) (client->replydata) +#define LBXMinKeyCode(client) (client->minKeyCode) +#define LBXMaxKeyCode(client) (client->maxKeyCode) +#define LBXImageByteOrder(client) (client->imageByteOrder) +#define LBXBitmapBitOrder(client) (client->bitmapBitOrder) +#define LBXBitmapScanlineUnit(client) (client->bitmapScanlineUnit) +#define LBXBitmapScanlinePad(client) (client->bitmapScanlinePad) +#define LBXZBitsPerPixel1(client) (client->ZbitsPerPixel1) +#define LBXRootWindow(client) (client->rootWindow) +#define LBXDrawableCache(client)(client->drawableCache) +#define LBXGContextCache(client)(client->gcontextCache) + +extern ClientPtr *clients; +#define MAXCLIENTS 128 +#define NullClient ((ClientPtr) 0) +extern int currentMaxClients; + +extern LbxLargeRequestRec *largeRequestQueue[]; +extern int numLargeRequestsInQueue; + +/* + * Notes on request short-circuiting + * + * X guarentees that any replies, events or errors generated by a + * previous request will be sent before those of a later request. + * this means that any requests that can be handled by the proxy + * must have their reply sent after any previous events or errors. + * + * there are 3 possible stages implemented here: + * + * - fully correct protocol, where nothing can be out of order + * - mostly correct protocol, where only errors can be out of order + * - poor protocol, where events & errors can be out of order + * + * for most applications, poor is 'good enough', because they don't + * depend on events coming in order, and instead let Xlib do + * the work. + * + * depending on the type of protocol being used, the cache_safe + * flag in the ClientRec will be set appropriately, and if TRUE, + * the proxy is cleared to short-circuit a request. + * + * for full correct protocol, the flag is set if the previous request + * was a round trip and the reply has come back. + * + * for a mostly correct protocol, the flag is set for the above + * case, and for requests that can generate only errors (mostly + * graphics) + * + * for a 'good enough' protocol, the flag is always on, and we let + * the client sort things out. + * + * (note than in no case do we allow replies to come out of order.) + * + * + * Note on Xlib's handling of sequences: + * + * Xlib usually waits for the reply to sync request before + * issuing another -- its archetecture depends on it. However, + * this is not required. Xlib itself misses this in at least one + * case (XGetWindowAttributes, which uses both the GetWindowAttributes + * and GetGeometry requests). + * + * The upshot is that the proxy has to be able to handle seeing + * another request before it receives an expected reply. + * + * this means we can't assume a single pending reply, but many. + * currently these get tacked onto a list. + * + * + * Notes on how the proxy attempts to solve all of this: + * + * There are 4 request that it will attempt to short-circuit: + * InternAtom, GetAtomName, LookupColor, AllocColor, and AllocNamedColor. + * All the code to do this is in lbxfuncs.c, and all of it works in + * essentially the same way -- whenever possible, it will try to respond + * to the client without sending the request all the way to the X server. + * The goal is to remove a roudn-trip entirely -- even though not a lot of data + * is involved, remving the roundtrip can make this useful. + + * Unfortunately, figuring out *when* its safe is very nasty. First + * there are all the possibile stages outlined above. If the proxy + * isn't waiting, thinking there might be pending data, it can always + * short-circuit the request. However, this is the rare case. When + * the proxy can't immediately respond, it attempts to short-circuit anyways, + * delaying the reply until whatever it was waiting on arrives. Often + * it can't -- if the most paranoid type of checking is turned on, it'll + * never work. The complex part occurs with loose checking. If it knows + * a reply is coming back, it can delay the short-circuit until it gets + * the reply. This works fine for the core protocol, but breaks down + * again for extensions -- to be safe, any unknown extensions are assumed + * to have replies -- but since they may never arrive, the delayed + * short-circuit can never be flushed. To avoid this, whether a reply + * has been guessed at is tracked, and this info is used to decide + * whether a short-circuit can be delayed -- if not, it always needs + * to do the full round-trip. + * + * The complexity really makes me wonder if this stuff is worth the effort... + */ + + +/* short-circuiting protocol */ + +#define PROTOCOL_FULL 0 /* DEFAULT - best w/ accuracy */ +#define PROTOCOL_MOST 1 /* cheat on errors */ +#define PROTOCOL_POOR 2 /* cheat on errors & events */ + +#undef DEBUG + +#undef TRACE + +/* possible states of request handlers. some requests are short-circuited + * (yanked), some are replaced with LBX requests, and some are let through + * unchanged + * + * any replaced request expecting a reply needs to be sure the sequence + * number isn't lagging before its sends its data + */ +#define REQ_PASSTHROUGH 0 /* pass through */ +#define REQ_YANK 1 /* completely remove, reply sent */ +#define REQ_YANKLATE 2 /* completely remove, reply not sent yet */ +#define REQ_REPLACE 3 /* replaced with 1way, reply sent */ +#define REQ_REPLACELATE 4 /* replaced with 1way, reply not sent yet */ + +/* + * size of motion event queue + * + * this specifies the maximum number of motion events that the server + * can spew out at once. the proxy will send it NUM_MOTION_EVENTS + * AllowMotion requests at startup, and then send a new one each time it + * processes a Motion event. this will prevent the wire from being + * swamped by MotionNotify. + */ + +/* XXX this should be a calculation based on the wire latency */ + +#define NUM_MOTION_EVENTS 8 + + +#ifdef LBX_STATS +extern int intern_good, + intern_miss; +extern int getatom_good, + getatom_miss; +extern int luc_good, + luc_miss; +extern int ac_good, + ac_miss; +extern int anc_good, + anc_miss; + +extern int getmodmap_tag, /* tag only */ + getmodmap_full; +extern int getkeymap_tag, /* tag only */ + getkeymap_full; +extern int queryfont_tag, /* tag only */ + queryfont_full; +extern int getsetup_tag, /* tag only */ + getsetup_full; + +extern int getprop_tag, + getprop_full; + +extern int tag_bytes_unsent; /* approx data kept off wire by tags */ + + +extern void DumpOtherStats(); +extern void ZeroOtherStats(); + +#endif /* LBX_STATS */ + +extern void DumpCompressionStats(); +extern void ZeroCompressionStats(); + +/* tables.c */ +extern int ProcLBXInternAtom( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXGetAtomName( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXCreateColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXAllocColor( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXAllocNamedColor( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXFreeColormap( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXCopyColormapAndFree( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXFreeColors( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXLookupColor( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXGetModifierMapping( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXGetKeyboardMapping( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXQueryFont( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void FinishLBXRequest( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*yank*/ +#endif +); + +extern void DoLBXReply( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + char * /*data*/, + int /*len*/ +#endif +); + +extern void WriteError( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + unsigned /*int majorCode*/, + unsigned /*int minorCode*/, + XID /*resId*/, + int /*errorCode*/ +#endif +); + +extern void SendLbxSync( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +/* dispatch.c */ + +extern int Dispatch( +#if NeedFunctionPrototypes + void +#endif +); + +extern void SendErrorToClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + unsigned int /*majorCode*/, + unsigned int /*minorCode*/, + XID /*resId*/, + int /*errorCode*/ +#endif +); + +extern ClientPtr NextAvailableClient( +#if NeedFunctionPrototypes + pointer /*ospriv*/, + int /* connect_fd */ /* the fd the client connected on */ +#endif +); + +extern int ProcInitialConnection( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcEstablishConnection( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void CloseDownClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcStandardRequest( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcBadRequest( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void AdjustProcVector( +#if NeedFunctionPrototypes + void +#endif +); + +/* lbxutil.c */ + +extern ReplyStuffPtr NewReply( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*major*/, + int /*minor*/, + ReplyFunc /*reply_func*/ +#endif +); + +extern void RemoveReply( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + ReplyStuffPtr /*rp*/ +#endif +); + +extern ReplyStuffPtr GetMatchingReply( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*seqno*/, + Bool /*flush_older*/ +#endif +); + +extern Bool AnyReplies( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern Bool SaveReplyData( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReply * /*rep*/, + int /*len*/, + pointer /*data*/ +#endif +); + +extern Bool FlushDelayedReplies( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void BumpSequence( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void ForceSequenceUpdate( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void LbxFreeTag( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + XID /*tag*/, + int /*tagtype*/ +#endif +); + +extern void LbxSendTagData( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*tag*/, + int /*tagtype*/ +#endif +); + +extern void SendInitLBXPackets( +#if NeedFunctionPrototypes + XServerPtr /*server*/ +#endif +); + +extern void LbxCleanupSession( +#if NeedFunctionPrototypes + void +#endif +); + +/* unsquish.c */ + +extern int EventLength( +#if NeedFunctionPrototypes + xEvent * /*ev*/, + Bool /* squish */ +#endif +); + +extern Bool UnsquishEvent( +#if NeedFunctionPrototypes + xReply * /*rep*/, + xEvent * /*ev*/, + int * /*lenp*/ +#endif +); + +/* props.c */ + +extern int ProcLBXChangeProperty( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int ProcLBXGetProperty( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +#endif diff --git a/include/lbxext.h b/include/lbxext.h new file mode 100644 index 0000000..daefe78 --- /dev/null +++ b/include/lbxext.h @@ -0,0 +1,167 @@ +/* $Xorg: lbxext.h,v 1.4 2001/02/09 02:05:32 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. + * + */ + +#ifndef _LBXEXT_H_ +#define _LBXEXT_H_ + +typedef int (*ExtensionRequests) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*ExtensionReplies) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*ExtensionEvents) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*ExtensionErrors) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*SExtensionRequests) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*SExtensionReplies) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*SExtensionEvents) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +typedef int (*SExtensionErrors) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +typedef struct _vectors { + char *name; + ExtensionRequests req_vector; + ExtensionReplies rep_vector; + ExtensionEvents ev_vector; + ExtensionErrors err_vector; + SExtensionRequests sreq_vector; +} ExtensionVectors; + +extern int (*ProcVector[256]) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); +extern int (*SwappedProcVector[256]) ( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +typedef struct _LbxQueryExtensionReply *xLbxQueryExtensionReplyPtr; + +extern void DeleteExtensions( +#if NeedFunctionPrototypes + XServerPtr /*server*/ +#endif +); + +typedef struct _replystuff *_ReplyStuffPtr; + +extern void HandleExtensionError( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xError * /*err*/, + _ReplyStuffPtr /*nr*/ +#endif +); + +extern void HandleExtensionEvent( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xEvent * /*ev*/ +#endif +); + +extern Bool HandleExtensionReply( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReply * /*reply*/, + _ReplyStuffPtr * /*nr*/ +#endif +); + +extern Bool CheckExtensionForEvents( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReq * /*req*/ +#endif +); + +extern Bool CheckExtensionForReplies( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReq * /*req*/ +#endif +); + +extern int ProcLBXQueryExtension( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +#endif /* _LBXEXT_H_ */ diff --git a/include/misc.h b/include/misc.h new file mode 100644 index 0000000..8d2d8a0 --- /dev/null +++ b/include/misc.h @@ -0,0 +1,120 @@ +/* $Xorg: misc.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ + +/* + +Copyright 1995, 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. + +*/ + +#ifndef MISC_H +#define MISC_H 1 + +#define NEED_EVENTS +#define NEED_REPLIES +#define _XLBX_SERVER_ +#include <X11/X.h> +#include <X11/Xproto.h> +#include <X11/Xmd.h> +#include "Xos.h" +#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc(_size) +#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree(_ptr) +#include "Xalloca.h" +#include "Xfuncs.h" +#include "Xfuncproto.h" + +typedef void *pointer; +#ifndef _BOOL_ALREADY_DEFINED_ +typedef int Bool; +#endif +#ifndef TRUE +#define FALSE 0 +#define TRUE 1 +#endif +typedef struct _Client *ClientPtr; +typedef struct _XServer *XServerPtr; + +#ifndef NULL +#define NULL 0 +#endif +#define DE_RESET 1 +#define DE_TERMINATE 2 +#define MILLI_PER_SECOND (1000) + +/* XXX globals.h? */ +extern int nextFreeClientID; +extern int nClients; +extern char *display_name; +extern char dispatchException; +extern char isItTimeToYield; +extern int MaxClients; + +/* The following byte swapping tools are duplicated in several places. + * Do they deserve their own header file? What else would logically go in + * such a header? + */ + +/* byte swap a 32-bit literal */ +#define lswapl(x) ((((x) & 0xff) << 24) |\ + (((x) & 0xff00) << 8) |\ + (((x) & 0xff0000) >> 8) |\ + (((x) >> 24) & 0xff)) + +/* byte swap a short literal */ +#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) + +/* byte swap a 32-bit value */ +#define swapl(x, n) { \ + n = ((char *) (x))[0];\ + ((char *) (x))[0] = ((char *) (x))[3];\ + ((char *) (x))[3] = n;\ + n = ((char *) (x))[1];\ + ((char *) (x))[1] = ((char *) (x))[2];\ + ((char *) (x))[2] = n; } + +/* byte swap a short */ +#define swaps(x, n) { \ + n = ((char *) (x))[0];\ + ((char *) (x))[0] = ((char *) (x))[1];\ + ((char *) (x))[1] = n; } + +/* copy 32-bit value from src to dst byteswapping on the way */ +#define cpswapl(src, dst) { \ + ((char *)&(dst))[0] = ((char *) &(src))[3];\ + ((char *)&(dst))[1] = ((char *) &(src))[2];\ + ((char *)&(dst))[2] = ((char *) &(src))[1];\ + ((char *)&(dst))[3] = ((char *) &(src))[0]; } + +/* copy short from src to dst byteswapping on the way */ +#define cpswaps(src, dst) { \ + ((char *) &(dst))[0] = ((char *) &(src))[1];\ + ((char *) &(dst))[1] = ((char *) &(src))[0]; } + +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define lowbit(x) ((x) & (~(x) + 1)) + +#define REQUEST(type) \ + register type *stuff = (type *)client->requestBuffer + +#endif diff --git a/include/os.h b/include/os.h new file mode 100644 index 0000000..0ad6c0b --- /dev/null +++ b/include/os.h @@ -0,0 +1,278 @@ +/* $Xorg: os.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ + +/* + +Copyright 1995, 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. + +*/ +#ifndef OS_H +#define OS_H + +#include <X11/Xtrans.h> + +extern fd_set AllSockets; +extern fd_set AllClients; +extern fd_set LastSelectMask; +extern fd_set WellKnownConnections; +extern fd_set ClientsWithInput; +extern fd_set ClientsWriteBlocked; +extern fd_set OutputPending; + +/* WaitFor.c */ + +extern int WaitForSomething( +#if NeedFunctionPrototypes + int * /*pClientsReady*/, + Bool /* poll */ +#endif +); + +/* connection.c */ + +extern Bool NewOutputPending; +extern Bool AnyClientsWriteBlocked; +extern int GrabInProgress; + +extern void CreateServerSockets( +#if NeedFunctionPrototypes + int * /*listen_fds[]*/ +#endif +); + +extern void CreateWellKnownSockets( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ListenToProxyManager ( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ListenWellKnownSockets ( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ResetWellKnownSockets( +#if NeedFunctionPrototypes + void +#endif +); + +extern void AvailableClientInput( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern ClientPtr AllocNewConnection( +#if NeedFunctionPrototypes + int /*fd*/, /* the fd to the display */ + int /*connect_fd*/, /* the fd the client connected on */ + Bool /*to_server*/, + XtransConnInfo /*trans_conn*/ +#endif +); + +extern void SwitchConnectionFuncs( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int (* /*Read*/)(), + int (* /*Writev*/)() +#endif +); + +extern void StartOutputCompression( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + void (* /*CompressOn*/)(), + void (* /*CompressOff*/)() +#endif +); + +extern Bool EstablishNewConnections( +#if NeedFunctionPrototypes + ClientPtr /*clientUnused*/, + pointer /*closure*/ +#endif +); + +extern void CloseDownFileDescriptor( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void CheckConnections( +#if NeedFunctionPrototypes + void +#endif +); + +extern void CloseDownConnection( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void OnlyListenToOneClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void ListenToAllClients( +#if NeedFunctionPrototypes + void +#endif +); + +extern void IgnoreClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void AttendClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void MakeClientGrabImpervious( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void MakeClientGrabPervious( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +/* io.c */ + +extern unsigned long StandardRequestLength( +#if NeedFunctionPrototypes + xReq * /*req*/, + ClientPtr /*client*/, + int /*got*/, + Bool * /*partp*/ +#endif +); + +extern int StandardReadRequestFromClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int PendingClientOutput( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int CheckPendingClientInput( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void MarkConnectionWriteBlocked( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern int BytesInClientBuffer( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void SkipInClientBuffer( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*nbytes*/, + int /*lenLastReq*/ +#endif +); + +extern Bool InsertFakeRequest( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + char * /*data*/, + int /*count*/ +#endif +); + +extern void ResetCurrentRequest( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void FlushAllOutput( +#if NeedFunctionPrototypes + void +#endif +); +extern int StandardWriteToClient( +#if NeedFunctionPrototypes + ClientPtr /*who*/, + int /*count*/, + char * /*buf*/ +#endif +); + +extern int UncompressWriteToClient( +#if NeedFunctionPrototypes + ClientPtr /*who*/, + int /*count*/, + char * /*buf*/ +#endif +); + +extern void ResetOsBuffers( +#if NeedFunctionPrototypes + void +#endif +); + +/* osinit.c */ + +extern void OsInit( +#if NeedFunctionPrototypes + void +#endif +); + +#endif diff --git a/include/pm.h b/include/pm.h new file mode 100644 index 0000000..313c2e2 --- /dev/null +++ b/include/pm.h @@ -0,0 +1,60 @@ +/* $Xorg: pm.h,v 1.4 2001/02/09 02:05:32 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. +*/ + +#include <X11/ICE/ICElib.h> + +extern IceConn PM_iceConn; +extern int proxy_manager_fd; +extern Bool proxyMngr; + +extern Bool CheckForProxyManager ( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ConnectToProxyManager ( +#if NeedFunctionPrototypes + void +#endif +); + +extern void SendGetProxyAddrReply ( +#if NeedFunctionPrototypes + IceConn /*requestor_iceConn*/, + int /*status*/, + char * /*addr*/, + char * /*error*/ +#endif +); + +extern void HandleProxyManagerConnection ( +#if NeedFunctionPrototypes + void +#endif +); diff --git a/include/pmP.h b/include/pmP.h new file mode 100644 index 0000000..6b9b3ba --- /dev/null +++ b/include/pmP.h @@ -0,0 +1,117 @@ +/* $Xorg: pmP.h,v 1.4 2001/02/09 02:05:32 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. +*/ + +/* Useful ICE message parsing macros */ + +/* + * Pad to a 64 bit boundary + */ +#define PAD64(_bytes) ((8 - ((unsigned int) (_bytes) % 8)) % 8) + +#define PADDED_BYTES64(_bytes) (_bytes + PAD64 (_bytes)) + +/* + * Number of 8 byte units in _bytes. + */ +#define WORD64COUNT(_bytes) (((unsigned int) ((_bytes) + 7)) >> 3) + +/* + * Compute the number of bytes for a STRING representation + */ +#define STRING_BYTES(_str) (2 + (_str ? strlen (_str) : 0) + \ + PAD64 (2 + (_str ? strlen (_str) : 0))) + +#define SKIP_STRING(_pBuf, _swap) \ +{ \ + CARD16 _len; \ + EXTRACT_CARD16 (_pBuf, _swap, _len); \ + _pBuf += _len; \ + if (PAD64 (2 + _len)) \ + _pBuf += PAD64 (2 + _len); \ +} + +/* + * STORE macros + */ +#define STORE_CARD16(_pBuf, _val) \ +{ \ + *((CARD16 *) _pBuf) = _val; \ + _pBuf += 2; \ +} + +#define STORE_STRING(_pBuf, _string) \ +{ \ + int _len = _string ? strlen (_string) : 0; \ + STORE_CARD16 (_pBuf, _len); \ + if (_len) { \ + memcpy (_pBuf, _string, _len); \ + _pBuf += _len; \ + } \ + if (PAD64 (2 + _len)) \ + _pBuf += PAD64 (2 + _len); \ +} + +/* + * EXTRACT macros + */ +#define EXTRACT_CARD16(_pBuf, _swap, _val) \ +{ \ + _val = *((CARD16 *) _pBuf); \ + _pBuf += 2; \ + if (_swap) \ + _val = lswaps (_val); \ +} + +#define EXTRACT_STRING(_pBuf, _swap, _string) \ +{ \ + CARD16 _len; \ + EXTRACT_CARD16 (_pBuf, _swap, _len); \ + _string = (char *) malloc (_len + 1); \ + memcpy (_string, _pBuf, _len); \ + _string[_len] = '\0'; \ + _pBuf += _len; \ + if (PAD64 (2 + _len)) \ + _pBuf += PAD64 (2 + _len); \ +} + +#define CHECK_AT_LEAST_SIZE(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _severity) \ + if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) > _expected_len) \ + { \ + _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \ + return; \ + } + + +#define CHECK_COMPLETE_SIZE(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _pStart, _severity) \ + if (((PADDED_BYTES64((_actual_len)) - SIZEOF (iceMsg)) >> 3) \ + != _expected_len) \ + { \ + _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \ + IceDisposeCompleteMessage (iceConn, _pStart); \ + return; \ + } diff --git a/include/proxyopts.h b/include/proxyopts.h new file mode 100644 index 0000000..fe22a68 --- /dev/null +++ b/include/proxyopts.h @@ -0,0 +1,144 @@ +/* $Xorg: proxyopts.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ + +#ifndef _LBX_PROXYOPTS_H_ +#define _LBX_PROXYOPTS_H_ + +#include "lbximage.h" +#include "lbxopts.h" + +typedef struct _LbxNegOpts { + short proxyDeltaN; + short proxyDeltaMaxLen; + short serverDeltaN; + short serverDeltaMaxLen; + LbxStreamOpts streamOpts; + int numBitmapCompMethods; + char *bitmapCompMethods; /* array of indices returned by server*/ + int numPixmapCompMethods; + char *pixmapCompMethods; /* array of indices returned by server*/ + Bool squish; + Bool useTags; +} LbxNegOptsRec; + +typedef LbxNegOptsRec *LbxNegOptsPtr; + +extern LbxNegOptsRec lbxNegOpt; + +/* options.c */ + +extern void LbxOptInit( +#if NeedFunctionPrototypes + XServerPtr /*server*/ +#endif +); + +extern int LbxOptBuildReq( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + char * /*buf*/ +#endif +); + +extern int LbxOptParseReply( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + int /*nopts*/, + unsigned char * /*preply*/, + int /*replylen*/ +#endif +); + +extern void LbxNoDelta( +#if NeedFunctionPrototypes + void +#endif +); + +extern void LbxNoComp( +#if NeedFunctionPrototypes + void +#endif +); + +extern void LbxNoSquish( +#if NeedFunctionPrototypes + void +#endif +); + +extern LbxBitmapCompMethod *LbxLookupBitmapCompMethod ( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + int /* methodOpCode */ +#endif +); + +extern LbxPixmapCompMethod *LbxLookupPixmapCompMethod ( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + int /* methodOpCode */ +#endif +); + +extern LbxBitmapCompMethod *LbxFindPreferredBitmapCompMethod ( +#if NeedFunctionPrototypes + XServerPtr /*server*/ +#endif +); + +extern LbxPixmapCompMethod *LbxFindPreferredPixmapCompMethod ( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + int /* format */, + int /* depth */ +#endif +); + +#endif /* _LBX_PROXYOPTS_H_ */ diff --git a/include/reqtype.h b/include/reqtype.h new file mode 100644 index 0000000..bfed83a --- /dev/null +++ b/include/reqtype.h @@ -0,0 +1,71 @@ +/* $Xorg: reqtype.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ + +#ifndef _REQTYPE_H_ +#define _REQTYPE_H_ + +#define REQ_TYPE_NO 0 +#define REQ_TYPE_YES 1 +#define REQ_TYPE_MAYBE 2 + +extern Bool GeneratesEvents( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReq * /*req*/ +#endif +); + +extern int GeneratesReplies( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + xReq * /*req*/ +#endif +); + +#endif /* _REQTYPE_H_ */ diff --git a/include/resource.h b/include/resource.h new file mode 100644 index 0000000..2fc494e --- /dev/null +++ b/include/resource.h @@ -0,0 +1,137 @@ +/* $Xorg: resource.h,v 1.4 2001/02/09 02:05:32 xorgcvs Exp $ */ + +/* + +Copyright 1995, 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. + +*/ + +#ifndef RESOURCE_H +#define RESOURCE_H 1 + +#define RT_COLORMAP ((RESTYPE)1) +#define RT_CMAPENTRY ((RESTYPE)2) +#define RT_LASTPREDEF ((RESTYPE)2) +#define RT_NONE ((RESTYPE)0) + +#define RC_NEVERRETAIN ((RESTYPE)1<<29) +#define RC_LASTPREDEF RC_NEVERRETAIN +#define RC_ANY (~(RESTYPE)0) + +typedef unsigned long RESTYPE; + +typedef struct _Resource { + struct _Resource *next; + XID id; + RESTYPE type; + pointer value; +} ResourceRec, *ResourcePtr; +#define NullResource ((ResourcePtr)NULL) + +typedef struct _ClientResource { + ResourcePtr *resources; + int elements; + int buckets; + int hashsize; /* log(2)(buckets) */ + XID fakeID; + XID endFakeID; +} ClientResourceRec; + + +/* bits and fields within a resource id */ +#define PROXY_BIT 0x40000000 /* use illegal bit */ + +typedef int (*DeleteType)( +#if NeedNestedPrototypes + ClientPtr /*client*/, + pointer /*value*/, + XID /*id*/ +#endif +); + +extern Bool InitDeleteFuncs( +#if NeedFunctionPrototypes + void +#endif +); + +extern Bool InitClientResources( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void FinishInitClientResources( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*ridBase*/, + XID /*ridMask*/ +#endif +); + +extern XID FakeClientID( +#if NeedFunctionPrototypes + int /*client*/ +#endif +); + +extern Bool AddResource( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*id*/, + RESTYPE /*type*/, + pointer /*value*/ +#endif +); + +extern void FreeResource( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*id*/, + RESTYPE /*skipDeleteFuncType*/ +#endif +); + +extern void FreeClientResources( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void FreeAllResources( +#if NeedFunctionPrototypes + void +#endif +); + +extern pointer LookupIDByType( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*id*/, + RESTYPE /*rtype*/ +#endif +); + +#endif diff --git a/include/swap.h b/include/swap.h new file mode 100644 index 0000000..d94d29d --- /dev/null +++ b/include/swap.h @@ -0,0 +1,254 @@ +/* + * $Xorg: swap.h,v 1.3 2000/08/17 19:53:58 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. + * + */ + +#ifndef _SWAP_H_ +#define _SWAP_H_ + +extern void SwapConnSetup( +#if NeedFunctionPrototypes + xConnSetup * /*pConnSetup*/, + xConnSetup * /*pConnSetupT*/ +#endif +); + +extern void SwapWinRoot( +#if NeedFunctionPrototypes + xWindowRoot * /*pRoot*/, + xWindowRoot * /*pRootT*/ +#endif +); + +extern void SwapVisual( +#if NeedFunctionPrototypes + xVisualType * /*pVis*/, + xVisualType * /*pVisT*/ +#endif +); + +extern void SwapConnectionInfo( +#if NeedFunctionPrototypes + xConnSetup * /*pConnSetup*/ +#endif +); + +extern void WriteSConnectionInfo( +#if NeedFunctionPrototypes + ClientPtr /*pClient*/, + unsigned long /*size*/, + char * /*pInfo*/ +#endif +); + +extern void SwapGetPropertyReply( +#if NeedFunctionPrototypes + xGetPropertyReply * /*rep*/ +#endif +); + +extern void SwapInternAtomReply( +#if NeedFunctionPrototypes + xInternAtomReply * /*rep*/ +#endif +); + +extern void SwapGetAtomNameReply( +#if NeedFunctionPrototypes + xGetAtomNameReply * /*rep*/ +#endif +); + +extern void SwapLookupColorReply( +#if NeedFunctionPrototypes + xLookupColorReply * /*rep*/ +#endif +); + +extern void SwapAllocColorReply( +#if NeedFunctionPrototypes + xAllocColorReply * /*rep*/ +#endif +); + +extern void SwapAllocNamedColorReply( +#if NeedFunctionPrototypes + xAllocNamedColorReply * /*rep*/ +#endif +); + +extern void SwapModmapReply( +#if NeedFunctionPrototypes + xGetModifierMappingReply * /*rep*/ +#endif +); + +extern void SwapKeymapReply( +#if NeedFunctionPrototypes + xGetKeyboardMappingReply * /*rep*/ +#endif +); + +extern void SwapGetImageReply( +#if NeedFunctionPrototypes + xGetImageReply * /*rep*/ +#endif +); + +extern void SwapQueryExtensionReply( +#if NeedFunctionPrototypes + xQueryExtensionReply * /*rep*/ +#endif +); + +extern void SwapFont( +#if NeedFunctionPrototypes + xQueryFontReply * /*pr*/, + Bool /*native*/ +#endif +); + +extern void LbxSwapFontInfo( +#if NeedFunctionPrototypes + xLbxFontInfo * /*pr*/, + Bool /*compressed*/ +#endif +); + +extern void SwapLongs( +#if NeedFunctionPrototypes + CARD32 * /*list*/, + unsigned long /*count*/ +#endif +); + +extern void SwapShorts( +#if NeedFunctionPrototypes + short * /*list*/, + unsigned long /*count*/ +#endif +); + +extern void SwapConnClientPrefix( +#if NeedFunctionPrototypes + xConnClientPrefix * /*pCCP*/ +#endif +); + +extern void SwapNewClient( +#if NeedFunctionPrototypes + xLbxNewClientReq * /*r*/ +#endif +); + +extern void SwapCloseClient( +#if NeedFunctionPrototypes + xLbxCloseClientReq * /*r*/ +#endif +); + +extern void SwapModifySequence( +#if NeedFunctionPrototypes + xLbxModifySequenceReq * /*r*/ +#endif +); + +extern void SwapIncrementPixel( +#if NeedFunctionPrototypes + xLbxIncrementPixelReq * /*r*/ +#endif +); + +extern void SwapGetModifierMapping( +#if NeedFunctionPrototypes + xLbxGetModifierMappingReq * /*r*/ +#endif +); + +extern void SwapGetKeyboardMapping( +#if NeedFunctionPrototypes + xLbxGetKeyboardMappingReq * /*r*/ +#endif +); + +extern void SwapQueryFont( +#if NeedFunctionPrototypes + xLbxQueryFontReq * /*r*/ +#endif +); + +extern void SwapChangeProperty( +#if NeedFunctionPrototypes + xLbxChangePropertyReq * /*r*/ +#endif +); + +extern void SwapGetProperty( +#if NeedFunctionPrototypes + xLbxGetPropertyReq * /*r*/ +#endif +); + +extern void SwapPutImage( +#if NeedFunctionPrototypes + xLbxPutImageReq * /*r*/ +#endif +); + +extern void SwapGetImage( +#if NeedFunctionPrototypes + xLbxGetImageReq * /*r*/ +#endif +); + +extern void SwapInvalidateTag( +#if NeedFunctionPrototypes + xLbxInvalidateTagReq * /*r*/ +#endif +); + +extern void SwapTagData( +#if NeedFunctionPrototypes + xLbxTagDataReq * /*r*/ +#endif +); + +extern void SwapQueryExtension( +#if NeedFunctionPrototypes + xLbxQueryExtensionReq * /*r*/ +#endif +); + +extern void SwapLbxConnSetupPrefix( +#if NeedFunctionPrototypes + xLbxConnSetupPrefix * /*csp*/ +#endif +); + +extern void SwapConnSetupPrefix( +#if NeedFunctionPrototypes + xConnSetupPrefix * /*csp*/ +#endif +); + +#endif /* _SWAP_H_ */ diff --git a/include/tags.h b/include/tags.h new file mode 100644 index 0000000..d48be5f --- /dev/null +++ b/include/tags.h @@ -0,0 +1,134 @@ +/* $Xorg: tags.h,v 1.4 2001/02/09 02:05:32 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. + * + */ + +#ifndef _TAGS_H_ +#define _TAGS_H_ + +#include "cache.h" + +typedef struct _tagdata { + XID tid; + int data_type; + unsigned long size; + pointer tdata; +} TagDataRec; + +typedef struct _tagdata *TagData; + +extern void TagsInit( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Bool /*useTags*/ +#endif +); + +extern void FreeTags( +#if NeedFunctionPrototypes + void +#endif +); + +extern Bool TagStoreData( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/, + CacheID /*id*/, + int /*size*/, + int /*dtype*/, + pointer /*data*/ +#endif +); + +extern Bool TagStoreDataNC( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/, + CacheID /*id*/, + int /*size*/, + int /*dtype*/, + pointer /*data*/ +#endif +); + +extern TagData TagGetTag( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/, + CacheID /*id*/ +#endif +); + +extern pointer TagGetData( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/, + CacheID /*id*/ +#endif +); + +extern void TagFreeData( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/, + CacheID /*id*/, + Bool /*notify*/ +#endif +); + +extern Bool AnyTagBearingReplies( +#if NeedFunctionPrototypes + XServerPtr /*server*/, + Cache /*cache*/ +#endif +); + +extern Cache global_cache; +extern Cache prop_cache; + +#endif /* _TAGS_H_ */ diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..a4ad597 --- /dev/null +++ b/include/util.h @@ -0,0 +1,227 @@ +/* $Xorg: util.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#ifdef SIGNALRETURNSINT +#define SIGVAL int +#else +#define SIGVAL void +#endif + +typedef SIGVAL (*OsSigHandlerPtr)( +#if NeedFunctionPrototypes + int /* sig */ +#endif +); + +extern OsSigHandlerPtr OsSignal( +#if NeedFunctionPrototypes + int /*sig*/, + OsSigHandlerPtr /*handler*/ +#endif +); + +extern void AutoResetServer( +#if NeedFunctionPrototypes + int /*sig*/ +#endif +); + +extern void GiveUp( +#if NeedFunctionPrototypes + int /*sig*/ +#endif +); + +extern void Error( +#if NeedFunctionPrototypes + char * /*str*/ +#endif +); + +extern CARD32 GetTimeInMillis( +#if NeedFunctionPrototypes + void +#endif +); + +extern int AdjustWaitForDelay( +#if NeedFunctionPrototypes + pointer /*waitTime*/, + unsigned long /*newdelay*/ +#endif +); + +extern void UseMsg( +#if NeedFunctionPrototypes + void +#endif +); + +extern void ProcessCommandLine( +#if NeedFunctionPrototypes + int /*argc*/, + char * /*argv*/[] +#endif +); + +#define xalloc(size) Xalloc((unsigned long)(size)) +#define xcalloc(size) Xcalloc((unsigned long)(size)) +#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) +#define xfree(ptr) Xfree((pointer)(ptr)) + +extern unsigned long *Xalloc( +#if NeedFunctionPrototypes + unsigned long /*amount*/ +#endif +); + +extern unsigned long *Xcalloc( +#if NeedFunctionPrototypes + unsigned long /*amount*/ +#endif +); + +extern unsigned long *Xrealloc( +#if NeedFunctionPrototypes + pointer /*ptr*/, + unsigned long /*amount*/ +#endif +); + +extern void Xfree( +#if NeedFunctionPrototypes + pointer /*ptr*/ +#endif +); + +extern void OsInitAllocator( +#if NeedFunctionPrototypes + void +#endif +); + +extern void AuditF( +#if NeedVarargsPrototypes + char * /*f*/, + ... +#endif +); + +extern void FatalError( +#if NeedVarargsPrototypes + char * /*f*/, + ... +#endif +); + +extern void ErrorF( +#if NeedVarargsPrototypes + char * /*f*/, + ... +#endif +); + +extern char *strnalloc( +#if NeedFunctionPrototypes + char * /*str*/, + int /*len*/ +#endif +); + +typedef struct _WorkQueue *WorkQueuePtr; + +extern void ProcessWorkQueue( +#if NeedFunctionPrototypes + void +#endif +); + +extern Bool QueueWorkProc( +#if NeedFunctionPrototypes + Bool (* /*function*/)(), + ClientPtr /*client*/, + pointer /*closure*/ +#endif +); + +extern Bool ClientSleep( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Bool (* /*function*/)(), + pointer /*closure*/ +#endif +); + +extern Bool ClientSignal( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void ClientWakeup( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern Bool ClientIsAsleep( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void LBXReadAtomsFile( +#if NeedFunctionPrototypes + XServerPtr /*server*/ +#endif +); + +#endif /* _UTIL_H_ */ diff --git a/include/wire.h b/include/wire.h new file mode 100644 index 0000000..14e9761 --- /dev/null +++ b/include/wire.h @@ -0,0 +1,419 @@ +/* $Xorg: wire.h,v 1.4 2001/02/09 02:05:32 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 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. + * + */ + +#ifdef DEBUG /* Need this here because lbx.h undef's DEBUG */ +extern int lbxDebug; +#endif + +#include "misc.h" +#include "lbx.h" +#include "lbxdeltastr.h" +#include "lbximage.h" +#include "proxyopts.h" +#include "colormap.h" +#include "atomcache.h" +#include "cache.h" +#include "resource.h" + +typedef struct _extinfo *ExtensionInfoPtr; + +/* + * NOTES on the implementation of the multi-display lbxproxy. + * + * o Each display has its own listen port(s). + * + * o Depending on how the proxy is compiled, it may support multiple + * transports thus more than one fd may be associated with a display. + * + * o When a new client connects, the proxy must be able to determine + * which display the client is interested in. To facilitate this, when + * a display's listen port(s) are created, a list of the display's + * fd's is cached in the field listen_fds. + * + * o When accept is called, the listen_fds in the servers array is + * searched to find the client's display. + */ + +/* + * MAXTRANSPORTS is the maximum number of transports or listen + * ports that a proxy can support. The number is determine at compile + * by the xtrans library but there is no public interface to this + * number. See lib/xtrans/Xtrans.c for more information. + */ +#define MAXTRANSPORTS 13 + +/* + * The maximum number of options that is negotiable. + */ +#define MAX_NEG_OPTS 8 + +typedef struct _LbxOptionsListRec { + CARD8 optcode; + Bool negotiate; + int (*req)(); + int (*reply)(); +} LbxOptionsListRec; + +typedef struct _LbxDeltaOptionsRec { + CARD8 minN; /* min cache size */ + CARD8 maxN; /* max cache size */ + CARD8 prefN; /* preferred cache size */ + CARD8 minMaxMsgLen; /* min max-message-len / 4 */ + CARD8 maxMaxMsgLen; /* max max-message-len / 4 */ + CARD8 prefMaxMsgLen; /* preferred max-message-len / 4 */ +} LbxDeltaOptionsRec; + +typedef struct _LbxStreamComp { + int typelen; + char *type; + int (*req)(); + int (*reply)(); +} LbxStreamCompRec; + +typedef struct _LbxCmapAllMethod { + char *methodName; + void (*resolver)( +#if NeedFunctionPrototypes + LbxVisualPtr /* pVisual */, + CARD16* /* red */, + CARD16* /* green */, + CARD16* /* blue */ +#endif + ); + Pixel (*findfree)( +#if NeedFunctionPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */ +#endif + ); + Entry * (* findbest)( +#if NeedFunctionPrototypes + ColormapPtr /* pmap */, + CARD32 /* red */, + CARD32 /* green */, + CARD32 /* blue */, + int /* channels */ +#endif + ); + +} LbxCmapAllMethod; + +typedef struct _XServer { + int index; + int fd; + int lbxReq; + int lbxEvent; + int lbxError; + Bool initialized; + char *display_name; /* The name as requested by the client*/ + char *proxy_name; /* The actual name used by the proxy */ + int listen_fds[MAXTRANSPORTS]; + ClientPtr prev_exec; + ClientPtr send, recv; + ClientPtr serverClient; + int recv_expect; + int motion_allowed; + Bool wm_running; + pointer compHandle; + lbxMotionCache motionCache; + ExtensionInfoPtr extensions; + LBXDeltasRec indeltas; + LBXDeltasRec outdeltas; + + /* + * The following fields are needed to handle the option + * negotiation for a multi-display proxy. + */ + LbxOptionsListRec LbxOptions[MAX_NEG_OPTS]; + int optcount; /* Number of options actually negotiated */ + int optlist[MAX_NEG_OPTS]; + LbxNegOptsRec lbxNegOpt; + LbxDeltaOptionsRec proxyDeltaOpt; + LbxDeltaOptionsRec serverDeltaOpt; + LbxStreamCompRec LbxStreamComp[1]; + LbxBitmapCompMethod LbxBitmapCompMethods[1]; + LbxPixmapCompMethod LbxPixmapCompMethods[1]; + LbxCmapAllMethod LbxCmapAllMethods[1]; + + /* + * requestVector is the function table to be used by the + * "real" clients associated with this server. + */ + int (**requestVector) ( +#if NeedNestedPrototypes + ClientPtr /* pClient */ +#endif + ); + + /* + * The following fields are needed to handle the atom + * cache for a multi-display proxy. + */ + AtomControlPtr atom_control; + int atom_control_count; + AtomListPtr *hashTable; + int hashSize; + int hashUsed; + int hashMask; + int rehash; + AtomListPtr *reverseMap; + int reverseMapSize; + Atom lastAtom; + + /* + * The following fields are needed for each server's + * global and property caches. + */ + Cache global_cache; + Cache prop_cache; + CachePtr caches[MAX_NUM_CACHES + 1]; + int num_caches; + unsigned long seed; + + /* + * The following fields are needed for each server's + * colormap caches. + */ + RGBCacheEntryPtr rgb_cache[NBUCKETS]; + RGBEntryRec rgb_buf; + Entry rgb_ent; + + /* + * Server-specific temporary delta buffer + */ + unsigned char tempdeltabuf[256]; + + /* + * The following fields are used to mange a server's resources + */ + ClientResourceRec clientTable[MAXCLIENTS]; + ClientPtr lastLbxClientIndexLookup; + + /* + * The following fields maintain a server's state for grab's + */ + int lbxIgnoringAll; + int lbxGrabInProgress; + + struct _XDisplay* dpy; + +} XServerRec; + + +/* + * External declarations for global variables defined in main.c + */ +extern XServerPtr * servers; +extern char * display; +extern int lbxMaxServers; + +extern void WriteReqToServer( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*len*/, + char * /*buf*/, + Bool /*checkLargeRequest*/ +#endif +); + +extern void WriteToServer( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*len*/, + char * /*buf*/, + Bool /*startOfRequest*/, + Bool /*checkLargeRequest*/ +#endif +); + +extern void _write_to_server( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Bool /*compressed*/, + int /*len*/, + char* /*buf*/, + Bool /*checkLarge*/, + Bool /*startOfRequest*/ +#endif +); + +extern void WriteToServerUncompressed( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*len*/, + char * /*buf*/, + Bool /* startOfRequest */ +#endif +); + +extern Bool NewClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*setuplen*/ +#endif +); + +extern void CloseClient( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void ModifySequence( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*num*/ +#endif +); + +extern void AllowMotion( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + int /*num*/ +#endif +); + +extern void SendIncrementPixel( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*cmap*/, + unsigned long /*pixel*/ +#endif +); + +extern void SendGetModifierMapping( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void SendGetKeyboardMapping( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern void SendQueryFont( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*fid*/ +#endif +); + +extern void SendChangeProperty( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Window /*win*/, + Atom /*prop*/, + Atom /*type*/, + int /*format*/, + int /*mode*/, + unsigned long /*num*/ +#endif +); + +extern void SendGetProperty( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Window /*win*/, + Atom /*prop*/, + Atom /*type*/, + Bool /*delete*/, + unsigned long /*off*/, + unsigned long /*len*/ +#endif +); + +extern void SendInvalidateTag( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*tag*/ +#endif +); + +extern void SendTagData( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + XID /*tag*/, + unsigned long /*len*/, + pointer /*data*/ +#endif +); + +extern void SendGetImage( +#if NeedFunctionPrototypes + ClientPtr /*client*/, + Drawable /*drawable*/, + int /*x*/, + int /*y*/, + unsigned int /*width*/, + unsigned int /*height*/, + unsigned long /*planeMask*/, + int /*format*/ +#endif +); + +extern int ServerProcStandardEvent( +#if NeedFunctionPrototypes + ClientPtr /*sc*/ +#endif +); + +extern void CloseServer( +#if NeedFunctionPrototypes + ClientPtr /*client*/ +#endif +); + +extern Bool ConnectToServer( +#if NeedFunctionPrototypes + char * /*dpy_name*/ +#endif +); |