/Xext/syncsrv.h

https://github.com/rpavlik/Xserver · C Header · 146 lines · 77 code · 18 blank · 51 comment · 0 complexity · 7f9b0c7fe74e33cbeffca6326e9f931d MD5 · raw file

  1. /*
  2. Copyright 1991, 1993, 1994, 1998 The Open Group
  3. Permission to use, copy, modify, distribute, and sell this software and its
  4. documentation for any purpose is hereby granted without fee, provided that
  5. the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation.
  8. The above copyright notice and this permission notice shall be included in
  9. all copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  14. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. Except as contained in this notice, the name of The Open Group shall not be
  17. used in advertising or otherwise to promote the sale, use or other dealings
  18. in this Software without prior written authorization from The Open Group.
  19. */
  20. /***********************************************************
  21. Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
  22. and Olivetti Research Limited, Cambridge, England.
  23. All Rights Reserved
  24. Permission to use, copy, modify, and distribute this software and its
  25. documentation for any purpose and without fee is hereby granted,
  26. provided that the above copyright notice appear in all copies and that
  27. both that copyright notice and this permission notice appear in
  28. supporting documentation, and that the names of Digital or Olivetti
  29. not be used in advertising or publicity pertaining to distribution of the
  30. software without specific, written prior permission.
  31. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  32. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  33. FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  34. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  35. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  36. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  37. PERFORMANCE OF THIS SOFTWARE.
  38. ******************************************************************/
  39. #ifndef _SYNCSRV_H_
  40. #define _SYNCSRV_H_
  41. #include "misync.h"
  42. #include "misyncstr.h"
  43. /*
  44. * The System Counter interface
  45. */
  46. typedef enum {
  47. XSyncCounterNeverChanges,
  48. XSyncCounterNeverIncreases,
  49. XSyncCounterNeverDecreases,
  50. XSyncCounterUnrestricted
  51. } SyncCounterType;
  52. typedef struct _SysCounterInfo {
  53. char *name;
  54. CARD64 resolution;
  55. CARD64 bracket_greater;
  56. CARD64 bracket_less;
  57. SyncCounterType counterType; /* how can this counter change */
  58. void (*QueryValue)(
  59. pointer /*pCounter*/,
  60. CARD64 * /*freshvalue*/
  61. );
  62. void (*BracketValues)(
  63. pointer /*pCounter*/,
  64. CARD64 * /*lessthan*/,
  65. CARD64 * /*greaterthan*/
  66. );
  67. } SysCounterInfo;
  68. typedef struct _SyncAlarmClientList {
  69. ClientPtr client;
  70. XID delete_id;
  71. struct _SyncAlarmClientList *next;
  72. } SyncAlarmClientList;
  73. typedef struct _SyncAlarm {
  74. SyncTrigger trigger;
  75. ClientPtr client;
  76. XSyncAlarm alarm_id;
  77. CARD64 delta;
  78. int events;
  79. int state;
  80. SyncAlarmClientList *pEventClients;
  81. } SyncAlarm;
  82. typedef struct {
  83. ClientPtr client;
  84. CARD32 delete_id;
  85. int num_waitconditions;
  86. } SyncAwaitHeader;
  87. typedef struct {
  88. SyncTrigger trigger;
  89. CARD64 event_threshold;
  90. SyncAwaitHeader *pHeader;
  91. } SyncAwait;
  92. typedef union {
  93. SyncAwaitHeader header;
  94. SyncAwait await;
  95. } SyncAwaitUnion;
  96. extern pointer SyncCreateSystemCounter(
  97. char * /* name */,
  98. CARD64 /* inital_value */,
  99. CARD64 /* resolution */,
  100. SyncCounterType /* change characterization */,
  101. void (* /*QueryValue*/ ) (
  102. pointer /* pCounter */,
  103. CARD64 * /* pValue_return */), /* XXX prototype */
  104. void (* /*BracketValues*/) (
  105. pointer /* pCounter */,
  106. CARD64 * /* pbracket_less */,
  107. CARD64 * /* pbracket_greater */)
  108. );
  109. extern void SyncChangeCounter(
  110. SyncCounter * /* pCounter*/,
  111. CARD64 /* new_value */
  112. );
  113. extern void SyncDestroySystemCounter(
  114. pointer pCounter
  115. );
  116. extern void InitServertime(void);
  117. extern void SyncExtensionInit(void);
  118. #endif /* _SYNCSRV_H_ */