Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
6.0 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. idlrpc.idl
  5. Abstract:
  6. Contains the RPC interface specification for the idle task / idle detection APIs.
  7. Also contains the RPC specific data structures for these API.
  8. Author:
  9. Cenk Ergan (cenke) 07-August-2000
  10. Environment:
  11. User Mode - Win32 - MIDL
  12. Revision History:
  13. --*/
  14. //
  15. // Interface Attributes
  16. //
  17. [
  18. uuid(0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53),
  19. version(1.0)
  20. ]
  21. //
  22. // Interface Keyword
  23. //
  24. interface idletask
  25. //
  26. // Interface Body
  27. //
  28. {
  29. import "wtypes.idl";
  30. //
  31. // IT_IDLE_TASK_ID declaration.
  32. //
  33. #define MIDL_PASS
  34. #include <idletask.h>
  35. //
  36. // The prefered protocol sequence for connecting the server and the
  37. // client is LPC because of its low overhead. We'd like to bind to
  38. // dynamic endpoint, because a well known endpoint may require another
  39. // listener thread on the server side. Note that depending on the
  40. // other RPC servers in the process we end up in, other bindings may
  41. // also be used.
  42. //
  43. const WCHAR * IT_RPC_PROTSEQ = L"ncalrpc";
  44. //
  45. // This is the custom binding handle type. Specifying this allows us
  46. // to bind to the server when the interface functions are called via
  47. // the IT_RPC_bind and _unbind functions that are part of the client.
  48. // It is not used for any other purpose, although it has to be a
  49. // parameter to the interface functions.
  50. //
  51. typedef [handle] WCHAR * ITRPC_HANDLE;
  52. //
  53. // This is a custom context handle. This allows the server to get
  54. // notified when a client dies.
  55. //
  56. typedef [context_handle] VOID *IT_HANDLE;
  57. //
  58. // Status of an idle task.
  59. //
  60. // FUTURE-2002/03/26-ScottMa -- The following enumeration is not exposed
  61. // outside the server. Consider moving it to ..\server\idletsks.h instead
  62. // of leaving it here in the generated RPC headers.
  63. typedef enum _IT_IDLE_TASK_STATUS {
  64. ItIdleTaskInitializing,
  65. ItIdleTaskQueued,
  66. ItIdleTaskRunning,
  67. ItIdleTaskMaxStatus
  68. } IT_IDLE_TASK_STATUS, *PIT_IDLE_TASK_STATUS;
  69. //
  70. // This structure describes the idle task the client wants to register.
  71. //
  72. typedef struct _IT_IDLE_TASK_PROPERTIES {
  73. //
  74. // Size of the structure.
  75. //
  76. ULONG Size;
  77. //
  78. // Idle task identifier and which process it is in. These two
  79. // uniquely identify the idle task.
  80. //
  81. IT_IDLE_TASK_ID IdleTaskId;
  82. DWORD ProcessId;
  83. //
  84. // Local handle for the event to be notified when the task should
  85. // start running.
  86. //
  87. ULONG_PTR StartEventHandle;
  88. //
  89. // Local handle for the event to be notified when the task should
  90. // stop running.
  91. //
  92. ULONG_PTR StopEventHandle;
  93. } IT_IDLE_TASK_PROPERTIES, *PIT_IDLE_TASK_PROPERTIES;
  94. //
  95. // This structure contains parameters that control the behaviour of
  96. // idle detection.
  97. //
  98. typedef struct _IT_IDLE_DETECTION_PARAMETERS {
  99. //
  100. // This is how long in ms we will wait until each time we check
  101. // for system idleness.
  102. //
  103. ULONG IdleDetectionPeriod;
  104. //
  105. // After we detect that system was idle over a long period, we
  106. // will verify the system is still idle by checking idleness over
  107. // a smaller period. This way we won't miss recent activity that
  108. // seemed insignificant over a long IdleDetectionPeriod.
  109. //
  110. ULONG IdleVerificationPeriod;
  111. ULONG NumVerifications;
  112. //
  113. // We will be polling for user input when running idle tasks every
  114. // this many ms. We want to catch user input and notify the idle task
  115. // to stop running as soon as possible. Even though the system is
  116. // idle, we don't want to create too much overhead which may mislead
  117. // ourself.
  118. //
  119. ULONG IdleInputCheckPeriod;
  120. //
  121. // We check to see if the idle task we asked to run is really running
  122. // (i.e. it is using the disk and CPU) every this many ms. This is our
  123. // mechanism for cleaning up after unregistered/orphaned tasks. This
  124. // should be greater than IdleInputCheckPeriod.
  125. //
  126. // FUTURE-2002/03/26-ScottMa -- This field is never used as an R-value.
  127. ULONG IdleTaskRunningCheckPeriod;
  128. //
  129. // If the CPU is not idle more than this percent over a time interval,
  130. // the system is not considered idle.
  131. //
  132. ULONG MinCpuIdlePercentage;
  133. //
  134. // If a disk is not idle more than this percent over a time interval,
  135. // the system is not considered idle.
  136. //
  137. ULONG MinDiskIdlePercentage;
  138. //
  139. // This is the maximum number of registered idle tasks at one time.
  140. //
  141. ULONG MaxNumRegisteredTasks;
  142. } IT_IDLE_DETECTION_PARAMETERS, *PIT_IDLE_DETECTION_PARAMETERS;
  143. //
  144. // Idle task server registration/unregistration API. These are not
  145. // called from the user directly. They are called by the client side
  146. // implementation of the RegisterIdleTask/UnregisterIdleTask API.
  147. //
  148. // ISSUE-2002/03/26-ScottMa -- The context handle in the following two RPCs
  149. // should not be passed by ref. The UnregisterIdleTask function must
  150. // set the context handle to NULL prior to returning, and [ref] pointers
  151. // cannot be NULL. Modify the pointer specifier on IT_HANDLE to be of
  152. // type [unique].
  153. DWORD
  154. ItSrvRegisterIdleTask (
  155. [in,string,unique] ITRPC_HANDLE Reserved,
  156. [out,ref] IT_HANDLE *ItHandle,
  157. [in,ref] PIT_IDLE_TASK_PROPERTIES IdleTaskProperties
  158. );
  159. void
  160. ItSrvUnregisterIdleTask (
  161. [in,string,unique] ITRPC_HANDLE Reserved,
  162. [in,out,ref] IT_HANDLE *ItHandle
  163. );
  164. //
  165. // This function is called to process all registered tasks without
  166. // waiting for system to become idle.
  167. //
  168. DWORD
  169. ItSrvProcessIdleTasks (
  170. [in,string,unique] ITRPC_HANDLE Reserved
  171. );
  172. //
  173. // This function is implemented only in the debug builds so test
  174. // applications can set stress parameters. It returns
  175. // ERROR_NOT_IMPLEMENTED on free builds.
  176. //
  177. DWORD
  178. ItSrvSetDetectionParameters (
  179. [in,string,unique] ITRPC_HANDLE Reserved,
  180. [in,ref] PIT_IDLE_DETECTION_PARAMETERS Parameters
  181. );
  182. }