1 /* $XConsortium: syncstr.h,v 1.4 94/04/17 20:11:27 rws Exp $ */
4 Copyright (c) 1991, 1993, 1994 X Consortium
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 Except as contained in this notice, the name of the X Consortium shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from the X Consortium.
29 /***********************************************************
30 Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
31 and Olivetti Research Limited, Cambridge, England.
35 Permission to use, copy, modify, and distribute this software and its
36 documentation for any purpose and without fee is hereby granted,
37 provided that the above copyright notice appear in all copies and that
38 both that copyright notice and this permission notice appear in
39 supporting documentation, and that the names of Digital or Olivetti
40 not be used in advertising or publicity pertaining to distribution of the
41 software without specific, written prior permission.
43 DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
44 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
45 FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
46 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
47 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49 PERFORMANCE OF THIS SOFTWARE.
51 ******************************************************************/
57 /* cover up types from sync.h to make sure they're the right size for
58 * protocol packaging. These will be undef'ed after all the protocol
59 * structures are defined.
61 #define XSyncCounter CARD32
62 #define XSyncAlarm CARD32
67 typedef struct _xSyncInitialize {
75 #define sz_xSyncInitializeReq 8
80 CARD16 sequenceNumber B16;
90 } xSyncInitializeReply;
91 #define sz_xSyncInitializeReply 32
96 typedef struct _xSyncListSystemCounters
101 } xSyncListSystemCountersReq;
102 #define sz_xSyncListSystemCountersReq 4
107 CARD16 sequenceNumber B16;
115 } xSyncListSystemCountersReply;
116 #define sz_xSyncListSystemCountersReply 32
119 XSyncCounter counter B32;
120 INT32 resolution_hi B32;
121 CARD32 resolution_lo B32;
122 CARD16 name_length B16;
123 } xSyncSystemCounter;
124 #define sz_xSyncSystemCounter 14
129 typedef struct _xSyncCreateCounterReq {
133 XSyncCounter cid B32;
134 INT32 initial_value_hi B32;
135 CARD32 initial_value_lo B32;
136 } xSyncCreateCounterReq;
137 #define sz_xSyncCreateCounterReq 16
142 typedef struct _xSyncChangeCounterReq {
146 XSyncCounter cid B32;
149 } xSyncChangeCounterReq;
150 #define sz_xSyncChangeCounterReq 16
155 typedef struct _xSyncSetCounterReq {
159 XSyncCounter cid B32;
162 } xSyncSetCounterReq;
163 #define sz_xSyncSetCounterReq 16
168 typedef struct _xSyncDestroyCounterReq {
172 XSyncCounter counter B32;
173 } xSyncDestroyCounterReq;
174 #define sz_xSyncDestroyCounterReq 8
179 typedef struct _xSyncQueryCounterReq {
183 XSyncCounter counter B32;
184 } xSyncQueryCounterReq;
185 #define sz_xSyncQueryCounterReq 8
191 CARD16 sequenceNumber B16;
199 } xSyncQueryCounterReply;
200 #define sz_xSyncQueryCounterReply 32
205 typedef struct _xSyncAwaitReq {
210 #define sz_xSyncAwaitReq 4
212 typedef struct _xSyncWaitCondition {
213 XSyncCounter counter B32;
214 CARD32 value_type B32;
215 INT32 wait_value_hi B32;
216 CARD32 wait_value_lo B32;
217 CARD32 test_type B32;
218 INT32 event_threshold_hi B32;
219 CARD32 event_threshold_lo B32;
220 } xSyncWaitCondition;
221 #define sz_xSyncWaitCondition 28
226 typedef struct _xSyncCreateAlarmReq {
231 CARD32 valueMask B32;
232 } xSyncCreateAlarmReq;
233 #define sz_xSyncCreateAlarmReq 12
238 typedef struct _xSyncDestroyAlarmReq {
242 XSyncAlarm alarm B32;
243 } xSyncDestroyAlarmReq;
244 #define sz_xSyncDestroyAlarmReq 8
249 typedef struct _xSyncQueryAlarmReq {
253 XSyncAlarm alarm B32;
254 } xSyncQueryAlarmReq;
255 #define sz_xSyncQueryAlarmReq 8
260 CARD16 sequenceNumber B16;
262 XSyncCounter counter B32;
263 CARD32 value_type B32;
264 INT32 wait_value_hi B32;
265 CARD32 wait_value_lo B32;
266 CARD32 test_type B32;
273 } xSyncQueryAlarmReply;
274 #define sz_xSyncQueryAlarmReply 40
279 typedef struct _xSyncChangeAlarmReq {
283 XSyncAlarm alarm B32;
284 CARD32 valueMask B32;
285 } xSyncChangeAlarmReq;
286 #define sz_xSyncChangeAlarmReq 12
291 typedef struct _xSyncSetPriority{
297 } xSyncSetPriorityReq;
298 #define sz_xSyncSetPriorityReq 12
303 typedef struct _xSyncGetPriority{
307 CARD32 id B32; /*XXX XID? */
308 } xSyncGetPriorityReq;
309 #define sz_xSyncGetPriorityReq 8
314 CARD16 sequenceNumber B16;
322 } xSyncGetPriorityReply;
323 #define sz_xSyncGetPriorityReply 32
329 typedef struct _xSyncCounterNotifyEvent {
332 CARD16 sequenceNumber B16;
333 XSyncCounter counter B32;
334 INT32 wait_value_hi B32;
335 CARD32 wait_value_lo B32;
336 INT32 counter_value_hi B32;
337 CARD32 counter_value_lo B32;
342 } xSyncCounterNotifyEvent;
344 typedef struct _xSyncAlarmNotifyEvent {
347 CARD16 sequenceNumber B16;
348 XSyncAlarm alarm B32;
349 INT32 counter_value_hi B32;
350 CARD32 counter_value_lo B32;
351 INT32 alarm_value_hi B32;
352 CARD32 alarm_value_lo B32;
358 } xSyncAlarmNotifyEvent;
363 #endif /* _SYNC_OS */
367 #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
369 typedef struct _SyncCounter {
370 ClientPtr client; /* Owning client. 0 for system counters */
371 XSyncCounter id; /* resource ID */
372 CARD64 value; /* counter value */
373 struct _SyncTriggerList *pTriglist; /* list of triggers */
374 Bool beingDestroyed; /* in process of going away */
375 struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
379 * The System Counter interface
383 XSyncCounterNeverChanges,
384 XSyncCounterNeverIncreases,
385 XSyncCounterNeverDecreases,
386 XSyncCounterUnrestricted
389 typedef struct _SysCounterInfo {
392 CARD64 bracket_greater;
394 SyncCounterType counterType; /* how can this counter change */
396 #if NeedNestedPrototypes
397 pointer /*pCounter*/,
398 CARD64 * /*freshvalue*/
401 void (*BracketValues)(
402 #if NeedNestedPrototypes
403 pointer /*pCounter*/,
404 CARD64 * /*lessthan*/,
405 CARD64 * /*greaterthan*/
412 typedef struct _SyncTrigger {
413 SyncCounter *pCounter;
414 CARD64 wait_value; /* wait value */
415 unsigned int value_type; /* Absolute or Relative */
416 unsigned int test_type; /* transition or Comparision type */
417 CARD64 test_value; /* trigger event threshold value */
418 Bool (*CheckTrigger)(
419 #if NeedNestedPrototypes
420 struct _SyncTrigger * /*pTrigger*/,
424 void (*TriggerFired)(
425 #if NeedNestedPrototypes
426 struct _SyncTrigger * /*pTrigger*/
429 void (*CounterDestroyed)(
430 #if NeedNestedPrototypes
431 struct _SyncTrigger * /*pTrigger*/
436 typedef struct _SyncTriggerList {
437 SyncTrigger *pTrigger;
438 struct _SyncTriggerList *next;
441 typedef struct _SyncAlarmClientList {
444 struct _SyncAlarmClientList *next;
445 } SyncAlarmClientList;
447 typedef struct _SyncAlarm {
454 SyncAlarmClientList *pEventClients;
460 int num_waitconditions;
465 CARD64 event_threshold;
466 SyncAwaitHeader *pHeader;
470 SyncAwaitHeader header;
475 extern pointer SyncCreateSystemCounter(
476 #if NeedFunctionPrototypes
478 CARD64 /* inital_value */,
479 CARD64 /* resolution */,
480 SyncCounterType /* change characterization */,
481 void (* /*QueryValue*/ ) (), /* XXX prototype */
482 void (* /*BracketValues*/) ()
486 extern void SyncChangeCounter(
487 #if NeedFunctionPrototypes
488 SyncCounter * /* pCounter*/,
489 CARD64 /* new_value */
493 extern void SyncDestroySystemCounter(
494 #if NeedFunctionPrototypes
498 extern void InitServertime();
500 #endif /* _SYNC_SERVER */