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.

193 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. rpcasync.h
  5. Abstract:
  6. This module contains the RPC runtime APIs needed to use
  7. [async] RPC features.
  8. --*/
  9. #ifndef __RPCASYNC_H__
  10. #define __RPCASYNC_H__
  11. #pragma message("rpcasync in snapins")
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define RPC_ASYNC_VERSION_1_0 sizeof(RPC_ASYNC_STATE)
  16. typedef
  17. enum _RPC_NOTIFICATION_TYPES
  18. {
  19. RpcNotificationTypeNone,
  20. RpcNotificationTypeEvent,
  21. RpcNotificationTypeApc,
  22. RpcNotificationTypeIoc,
  23. RpcNotificationTypeHwnd,
  24. RpcNotificationTypeCallback
  25. } RPC_NOTIFICATION_TYPES;
  26. typedef
  27. enum _RPC_ASYNC_EVENT {
  28. RpcCallComplete,
  29. RpcSendComplete,
  30. RpcReceiveComplete
  31. } RPC_ASYNC_EVENT;
  32. typedef void RPC_ENTRY
  33. RPCNOTIFICATION_ROUTINE (
  34. struct _RPC_ASYNC_STATE *pAsync,
  35. void *Context,
  36. RPC_ASYNC_EVENT Event);
  37. typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
  38. typedef struct _RPC_ASYNC_STATE {
  39. unsigned int Size; // size of this structure
  40. unsigned long Signature;
  41. long Lock;
  42. unsigned long Flags;
  43. void *StubInfo;
  44. void *UserInfo;
  45. void *RuntimeInfo;
  46. RPC_ASYNC_EVENT Event;
  47. RPC_NOTIFICATION_TYPES NotificationType;
  48. union {
  49. //
  50. // Notification by APC
  51. //
  52. struct {
  53. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  54. HANDLE hThread;
  55. } APC;
  56. //
  57. // Notification by IO completion port
  58. //
  59. struct {
  60. HANDLE hIOPort;
  61. DWORD dwNumberOfBytesTransferred;
  62. DWORD dwCompletionKey;
  63. LPOVERLAPPED lpOverlapped;
  64. } IOC;
  65. //
  66. // Notification by window message
  67. //
  68. struct {
  69. HWND hWnd;
  70. UINT Msg;
  71. } HWND;
  72. //
  73. // Notification by event
  74. //
  75. HANDLE hEvent;
  76. //
  77. // Notification by callback function
  78. //
  79. // This option is available only to OLE
  80. //
  81. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  82. } u;
  83. long Reserved[4];
  84. } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
  85. // Possible values for Flags
  86. #define RPC_C_NOTIFY_ON_SEND_COMPLETE 0x1
  87. #define RPC_C_INFINITE_TIMEOUT INFINITE
  88. #define RpcAsyncGetCallHandle(pAsync) (((PRPC_ASYNC_STATE) pAsync)->RuntimeInfo)
  89. RPCRTAPI
  90. RPC_STATUS
  91. RPC_ENTRY
  92. RpcAsyncInitializeHandle (
  93. PRPC_ASYNC_STATE pAsync,
  94. unsigned int Size
  95. );
  96. RPCRTAPI
  97. RPC_STATUS
  98. RPC_ENTRY
  99. RpcAsyncRegisterInfo (
  100. PRPC_ASYNC_STATE pAsync
  101. ) ;
  102. RPCRTAPI
  103. RPC_STATUS
  104. RPC_ENTRY
  105. RpcAsyncGetCallStatus (
  106. PRPC_ASYNC_STATE pAsync
  107. ) ;
  108. RPCRTAPI
  109. RPC_STATUS
  110. RPC_ENTRY
  111. RpcAsyncCompleteCall (
  112. PRPC_ASYNC_STATE pAsync,
  113. void *Reply
  114. ) ;
  115. RPCRTAPI
  116. RPC_STATUS
  117. RPC_ENTRY
  118. RpcAsyncAbortCall (
  119. PRPC_ASYNC_STATE pAsync,
  120. unsigned long ExceptionCode
  121. ) ;
  122. RPCRTAPI
  123. RPC_STATUS
  124. RPC_ENTRY
  125. RpcAsyncCancelCall (
  126. IN PRPC_ASYNC_STATE pAsync,
  127. IN BOOL fAbort
  128. ) ;
  129. //
  130. // Internal APIs
  131. //
  132. RPC_STATUS RPC_ENTRY
  133. I_RpcAsyncSetHandle (
  134. IN PRPC_MESSAGE Message,
  135. IN PRPC_ASYNC_STATE pAsync
  136. );
  137. RPC_STATUS RPC_ENTRY
  138. I_RpcAsyncAbortCall (
  139. IN PRPC_ASYNC_STATE pAsync,
  140. IN unsigned long ExceptionCode
  141. ) ;
  142. //
  143. // This stuff is in here so we don't break ole, stubs and the tests
  144. // remove before we ship
  145. //
  146. #define RpcInitializeAsyncHandle RpcAsyncInitializeHandle
  147. #define RpcRegisterAsyncInfo RpcAsyncRegisterInfo
  148. #define RpcGetAsyncCallStatus RpcAsyncGetCallStatus
  149. #define RpcCompleteAsyncCall RpcAsyncCompleteCall
  150. #define RpcAbortAsyncCall RpcAsyncAbortCall
  151. #define RpcCancelAsyncCall RpcAsyncCancelCall
  152. #define I_RpcSetAsyncHandle I_RpcAsyncSetHandle
  153. #define I_RpcAbortAsyncCall I_RpcAsyncAbortCall
  154. #ifdef __cplusplus
  155. }
  156. #endif
  157. #endif /* __RPCASYNC_H__ */