1706f2543Smrg/*********************************************************** 2706f2543SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 3706f2543Smrg 4706f2543Smrg All Rights Reserved 5706f2543Smrg 6706f2543SmrgPermission to use, copy, modify, and distribute this software and its 7706f2543Smrgdocumentation for any purpose and without fee is hereby granted, 8706f2543Smrgprovided that the above copyright notice appear in all copies and that 9706f2543Smrgboth that copyright notice and this permission notice appear in 10706f2543Smrgsupporting documentation, and that the name of Digital not be 11706f2543Smrgused in advertising or publicity pertaining to distribution of the 12706f2543Smrgsoftware without specific, written prior permission. 13706f2543Smrg 14706f2543SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15706f2543SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16706f2543SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17706f2543SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18706f2543SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19706f2543SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20706f2543SmrgSOFTWARE. 21706f2543Smrg 22706f2543Smrg******************************************************************/ 23706f2543Smrg 24706f2543Smrg#ifndef DIXSTRUCT_H 25706f2543Smrg#define DIXSTRUCT_H 26706f2543Smrg 27706f2543Smrg#include "dix.h" 28706f2543Smrg#include "resource.h" 29706f2543Smrg#include "cursor.h" 30706f2543Smrg#include "gc.h" 31706f2543Smrg#include "pixmap.h" 32706f2543Smrg#include "privates.h" 33706f2543Smrg#include <X11/Xmd.h> 34706f2543Smrg 35706f2543Smrg/* 36706f2543Smrg * direct-mapped hash table, used by resource manager to store 37706f2543Smrg * translation from client ids to server addresses. 38706f2543Smrg */ 39706f2543Smrg 40706f2543Smrgextern _X_EXPORT CallbackListPtr ClientStateCallback; 41706f2543Smrg 42706f2543Smrgtypedef struct { 43706f2543Smrg ClientPtr client; 44706f2543Smrg xConnSetupPrefix *prefix; 45706f2543Smrg xConnSetup *setup; 46706f2543Smrg} NewClientInfoRec; 47706f2543Smrg 48706f2543Smrgtypedef void (*ReplySwapPtr) ( 49706f2543Smrg ClientPtr /* pClient */, 50706f2543Smrg int /* size */, 51706f2543Smrg void * /* pbuf */); 52706f2543Smrg 53706f2543Smrgextern _X_EXPORT void ReplyNotSwappd ( 54706f2543Smrg ClientPtr /* pClient */, 55706f2543Smrg int /* size */, 56706f2543Smrg void * /* pbuf */) _X_NORETURN; 57706f2543Smrg 58706f2543Smrgtypedef enum {ClientStateInitial, 59706f2543Smrg ClientStateAuthenticating, 60706f2543Smrg ClientStateRunning, 61706f2543Smrg ClientStateRetained, 62706f2543Smrg ClientStateGone, 63706f2543Smrg ClientStateCheckingSecurity, 64706f2543Smrg ClientStateCheckedSecurity} ClientState; 65706f2543Smrg 66706f2543Smrg#ifdef XFIXES 67706f2543Smrgtypedef struct _saveSet { 68706f2543Smrg struct _Window *windowPtr; 69706f2543Smrg Bool toRoot; 70706f2543Smrg Bool map; 71706f2543Smrg} SaveSetElt; 72706f2543Smrg#define SaveSetWindow(ss) ((ss).windowPtr) 73706f2543Smrg#define SaveSetToRoot(ss) ((ss).toRoot) 74706f2543Smrg#define SaveSetShouldMap(ss) ((ss).map) 75706f2543Smrg#define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) 76706f2543Smrg#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) 77706f2543Smrg#define SaveSetAssignMap(ss,m) ((ss).map = (m)) 78706f2543Smrg#else 79706f2543Smrgtypedef struct _Window *SaveSetElt; 80706f2543Smrg#define SaveSetWindow(ss) (ss) 81706f2543Smrg#define SaveSetToRoot(ss) FALSE 82706f2543Smrg#define SaveSetShouldMap(ss) TRUE 83706f2543Smrg#define SaveSetAssignWindow(ss,w) ((ss) = (w)) 84706f2543Smrg#define SaveSetAssignToRoot(ss,tr) 85706f2543Smrg#define SaveSetAssignMap(ss,m) 86706f2543Smrg#endif 87706f2543Smrg 88706f2543Smrgtypedef struct _Client { 89706f2543Smrg int index; 90706f2543Smrg Mask clientAsMask; 91706f2543Smrg pointer requestBuffer; 92706f2543Smrg pointer osPrivate; /* for OS layer, including scheduler */ 93706f2543Smrg Bool swapped; 94706f2543Smrg ReplySwapPtr pSwapReplyFunc; 95706f2543Smrg XID errorValue; 96706f2543Smrg int sequence; 97706f2543Smrg int closeDownMode; 98706f2543Smrg int clientGone; 99706f2543Smrg int noClientException; /* this client died or needs to be 100706f2543Smrg * killed */ 101706f2543Smrg int ignoreCount; /* count for Attend/IgnoreClient */ 102706f2543Smrg SaveSetElt *saveSet; 103706f2543Smrg int numSaved; 104706f2543Smrg int (**requestVector) ( 105706f2543Smrg ClientPtr /* pClient */); 106706f2543Smrg CARD32 req_len; /* length of current request */ 107706f2543Smrg Bool big_requests; /* supports large requests */ 108706f2543Smrg int priority; 109706f2543Smrg ClientState clientState; 110706f2543Smrg PrivateRec *devPrivates; 111706f2543Smrg unsigned short xkbClientFlags; 112706f2543Smrg unsigned short mapNotifyMask; 113706f2543Smrg unsigned short newKeyboardNotifyMask; 114706f2543Smrg unsigned short vMajor,vMinor; 115706f2543Smrg KeyCode minKC,maxKC; 116706f2543Smrg 117706f2543Smrg unsigned long replyBytesRemaining; 118706f2543Smrg int smart_priority; 119706f2543Smrg long smart_start_tick; 120706f2543Smrg long smart_stop_tick; 121706f2543Smrg long smart_check_tick; 122706f2543Smrg 123706f2543Smrg DeviceIntPtr clientPtr; 124706f2543Smrg} ClientRec; 125706f2543Smrg 126706f2543Smrg/* 127706f2543Smrg * Scheduling interface 128706f2543Smrg */ 129706f2543Smrgextern _X_EXPORT long SmartScheduleTime; 130706f2543Smrgextern _X_EXPORT long SmartScheduleInterval; 131706f2543Smrgextern _X_EXPORT long SmartScheduleSlice; 132706f2543Smrgextern _X_EXPORT long SmartScheduleMaxSlice; 133706f2543Smrgextern _X_EXPORT Bool SmartScheduleDisable; 134706f2543Smrgextern _X_EXPORT void SmartScheduleStartTimer(void); 135706f2543Smrgextern _X_EXPORT void SmartScheduleStopTimer(void); 136706f2543Smrg#define SMART_MAX_PRIORITY (20) 137706f2543Smrg#define SMART_MIN_PRIORITY (-20) 138706f2543Smrg 139706f2543Smrgextern _X_EXPORT void SmartScheduleInit(void); 140706f2543Smrg 141706f2543Smrg 142706f2543Smrg/* This prototype is used pervasively in Xext, dix */ 143706f2543Smrg#define DISPATCH_PROC(func) int func(ClientPtr /* client */) 144706f2543Smrg 145706f2543Smrgtypedef struct _WorkQueue { 146706f2543Smrg struct _WorkQueue *next; 147706f2543Smrg Bool (*function) ( 148706f2543Smrg ClientPtr /* pClient */, 149706f2543Smrg pointer /* closure */ 150706f2543Smrg); 151706f2543Smrg ClientPtr client; 152706f2543Smrg pointer closure; 153706f2543Smrg} WorkQueueRec; 154706f2543Smrg 155706f2543Smrgextern _X_EXPORT TimeStamp currentTime; 156706f2543Smrgextern _X_EXPORT TimeStamp lastDeviceEventTime; 157706f2543Smrg 158706f2543Smrgextern _X_EXPORT int CompareTimeStamps( 159706f2543Smrg TimeStamp /*a*/, 160706f2543Smrg TimeStamp /*b*/); 161706f2543Smrg 162706f2543Smrgextern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/); 163706f2543Smrg 164706f2543Smrgtypedef struct _CallbackRec { 165706f2543Smrg CallbackProcPtr proc; 166706f2543Smrg pointer data; 167706f2543Smrg Bool deleted; 168706f2543Smrg struct _CallbackRec *next; 169706f2543Smrg} CallbackRec, *CallbackPtr; 170706f2543Smrg 171706f2543Smrgtypedef struct _CallbackList { 172706f2543Smrg int inCallback; 173706f2543Smrg Bool deleted; 174706f2543Smrg int numDeleted; 175706f2543Smrg CallbackPtr list; 176706f2543Smrg} CallbackListRec; 177706f2543Smrg 178706f2543Smrg/* proc vectors */ 179706f2543Smrg 180706f2543Smrgextern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/); 181706f2543Smrg 182706f2543Smrgextern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/); 183706f2543Smrg 184706f2543Smrgextern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/); 185706f2543Smrg 186706f2543Smrgextern _X_EXPORT ReplySwapPtr ReplySwapVector[256]; 187706f2543Smrg 188706f2543Smrgextern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/); 189706f2543Smrg 190706f2543Smrg#endif /* DIXSTRUCT_H */ 191