Source code of Windows XP (NT5)
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.

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