1/* 2 3Copyright 1991, 1993, 1994, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25*/ 26 27/*********************************************************** 28Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, 29and Olivetti Research Limited, Cambridge, England. 30 31 All Rights Reserved 32 33Permission to use, copy, modify, and distribute this software and its 34documentation for any purpose and without fee is hereby granted, 35provided that the above copyright notice appear in all copies and that 36both that copyright notice and this permission notice appear in 37supporting documentation, and that the names of Digital or Olivetti 38not be used in advertising or publicity pertaining to distribution of the 39software without specific, written prior permission. 40 41DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 42SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 43FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR 44CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 45USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 46OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 47PERFORMANCE OF THIS SOFTWARE. 48 49******************************************************************/ 50 51#ifndef _SYNCSTR_H_ 52#define _SYNCSTR_H_ 53 54#include <X11/extensions/syncproto.h> 55 56#ifdef _SYNC_SERVER 57 58#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ 59 60typedef struct _SyncCounter { 61 ClientPtr client; /* Owning client. 0 for system counters */ 62 XSyncCounter id; /* resource ID */ 63 CARD64 value; /* counter value */ 64 struct _SyncTriggerList *pTriglist; /* list of triggers */ 65 Bool beingDestroyed; /* in process of going away */ 66 struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ 67} SyncCounter; 68 69/* 70 * The System Counter interface 71 */ 72 73typedef enum { 74 XSyncCounterNeverChanges, 75 XSyncCounterNeverIncreases, 76 XSyncCounterNeverDecreases, 77 XSyncCounterUnrestricted 78} SyncCounterType; 79 80typedef struct _SysCounterInfo { 81 char *name; 82 CARD64 resolution; 83 CARD64 bracket_greater; 84 CARD64 bracket_less; 85 SyncCounterType counterType; /* how can this counter change */ 86 void (*QueryValue)( 87 pointer /*pCounter*/, 88 CARD64 * /*freshvalue*/ 89); 90 void (*BracketValues)( 91 pointer /*pCounter*/, 92 CARD64 * /*lessthan*/, 93 CARD64 * /*greaterthan*/ 94); 95} SysCounterInfo; 96 97 98 99typedef struct _SyncTrigger { 100 SyncCounter *pCounter; 101 CARD64 wait_value; /* wait value */ 102 unsigned int value_type; /* Absolute or Relative */ 103 unsigned int test_type; /* transition or Comparison type */ 104 CARD64 test_value; /* trigger event threshold value */ 105 Bool (*CheckTrigger)( 106 struct _SyncTrigger * /*pTrigger*/, 107 CARD64 /*newval*/ 108 ); 109 void (*TriggerFired)( 110 struct _SyncTrigger * /*pTrigger*/ 111 ); 112 void (*CounterDestroyed)( 113 struct _SyncTrigger * /*pTrigger*/ 114 ); 115} SyncTrigger; 116 117typedef struct _SyncTriggerList { 118 SyncTrigger *pTrigger; 119 struct _SyncTriggerList *next; 120} SyncTriggerList; 121 122typedef struct _SyncAlarmClientList { 123 ClientPtr client; 124 XID delete_id; 125 struct _SyncAlarmClientList *next; 126} SyncAlarmClientList; 127 128typedef struct _SyncAlarm { 129 SyncTrigger trigger; 130 ClientPtr client; 131 XSyncAlarm alarm_id; 132 CARD64 delta; 133 int events; 134 int state; 135 SyncAlarmClientList *pEventClients; 136} SyncAlarm; 137 138typedef struct { 139 ClientPtr client; 140 CARD32 delete_id; 141 int num_waitconditions; 142} SyncAwaitHeader; 143 144typedef struct { 145 SyncTrigger trigger; 146 CARD64 event_threshold; 147 SyncAwaitHeader *pHeader; 148} SyncAwait; 149 150typedef union { 151 SyncAwaitHeader header; 152 SyncAwait await; 153} SyncAwaitUnion; 154 155 156extern pointer SyncCreateSystemCounter( 157 char * /* name */, 158 CARD64 /* initial_value */, 159 CARD64 /* resolution */, 160 SyncCounterType /* change characterization */, 161 void (* /*QueryValue*/ ) ( 162 pointer /* pCounter */, 163 CARD64 * /* pValue_return */), /* XXX prototype */ 164 void (* /*BracketValues*/) ( 165 pointer /* pCounter */, 166 CARD64 * /* pbracket_less */, 167 CARD64 * /* pbracket_greater */) 168); 169 170extern void SyncChangeCounter( 171 SyncCounter * /* pCounter*/, 172 CARD64 /* new_value */ 173); 174 175extern void SyncDestroySystemCounter( 176 pointer pCounter 177); 178extern void InitServertime(void); 179 180#endif /* _SYNC_SERVER */ 181 182#endif /* _SYNCSTR_H_ */ 183