syncsrv.h revision 706f2543
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 _SYNCSRV_H_
52#define _SYNCSRV_H_
53
54#include "misync.h"
55#include "misyncstr.h"
56
57/*
58 * The System Counter interface
59 */
60
61typedef enum {
62    XSyncCounterNeverChanges,
63    XSyncCounterNeverIncreases,
64    XSyncCounterNeverDecreases,
65    XSyncCounterUnrestricted
66} SyncCounterType;
67
68typedef struct _SysCounterInfo {
69    char	*name;
70    CARD64	resolution;
71    CARD64	bracket_greater;
72    CARD64	bracket_less;
73    SyncCounterType counterType;  /* how can this counter change */
74    void        (*QueryValue)(
75			      pointer /*pCounter*/,
76			      CARD64 * /*freshvalue*/
77);
78    void	(*BracketValues)(
79				 pointer /*pCounter*/,
80				 CARD64 * /*lessthan*/,
81				 CARD64 * /*greaterthan*/
82);
83} SysCounterInfo;
84
85
86
87typedef struct _SyncAlarmClientList {
88    ClientPtr	client;
89    XID		delete_id;
90    struct _SyncAlarmClientList *next;
91} SyncAlarmClientList;
92
93typedef struct _SyncAlarm {
94    SyncTrigger trigger;
95    ClientPtr	client;
96    XSyncAlarm 	alarm_id;
97    CARD64	delta;
98    int		events;
99    int		state;
100    SyncAlarmClientList *pEventClients;
101} SyncAlarm;
102
103typedef struct {
104    ClientPtr	client;
105    CARD32 	delete_id;
106    int		num_waitconditions;
107} SyncAwaitHeader;
108
109typedef struct {
110    SyncTrigger trigger;
111    CARD64	event_threshold;
112    SyncAwaitHeader *pHeader;
113} SyncAwait;
114
115typedef union {
116    SyncAwaitHeader header;
117    SyncAwait	    await;
118} SyncAwaitUnion;
119
120extern pointer SyncCreateSystemCounter(
121    char *	/* name */,
122    CARD64  	/* inital_value */,
123    CARD64  	/* resolution */,
124    SyncCounterType /* change characterization */,
125    void        (* /*QueryValue*/ ) (
126        pointer /* pCounter */,
127        CARD64 * /* pValue_return */), /* XXX prototype */
128    void        (* /*BracketValues*/) (
129        pointer /* pCounter */,
130        CARD64 * /* pbracket_less */,
131        CARD64 * /* pbracket_greater */)
132);
133
134extern void SyncChangeCounter(
135    SyncCounter *	/* pCounter*/,
136    CARD64  		/* new_value */
137);
138
139extern void SyncDestroySystemCounter(
140    pointer pCounter
141);
142
143extern void InitServertime(void);
144
145extern void SyncExtensionInit(void);
146#endif /* _SYNCSRV_H_ */
147