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.

295 lines
8.5 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. tdipnp.h
  5. Abstract:
  6. This module contains the definitions for the PnP related code
  7. in the TDI driver.
  8. Author:
  9. Henry Sanders (henrysa) 11 Oct 1995
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. --*/
  14. #ifndef _TDIPNP_
  15. #define _TDIPNP_
  16. // Define the types possible for a TDI_NOTIFY_ELEMENT structure.
  17. #define TDI_NOTIFY_DEVICE 0
  18. #define TDI_NOTIFY_NET_ADDRESS 1
  19. #define TDI_NOTIFY_PNP_HANDLERS 2
  20. // And the types possible for a TDI_PROVIDER_RESOURCE structure.
  21. #define TDI_RESOURCE_DEVICE 0
  22. #define TDI_RESOURCE_NET_ADDRESS 1
  23. #define TDI_RESOURCE_POWER 2
  24. #define TDI_RESOURCE_PROVIDER 3
  25. //
  26. // Define the types of bind requests possible.
  27. #define TDI_REGISTER_BIND_NOTIFY 0
  28. #define TDI_DEREGISTER_BIND_NOTIFY 1
  29. #define TDI_REGISTER_DEVICE 2
  30. #define TDI_DEREGISTER_DEVICE 3
  31. #define TDI_REGISTER_ADDRESS_NOTIFY 4
  32. #define TDI_DEREGISTER_ADDRESS_NOTIFY 5
  33. #define TDI_REGISTER_ADDRESS 6
  34. #define TDI_DEREGISTER_ADDRESS 7
  35. #define TDI_REGISTER_HANDLERS_PNP 8
  36. #define TDI_DEREGISTER_HANDLERS_PNP 9
  37. #define TDI_REGISTER_PNP_POWER_EVENT 10
  38. #define TDI_REGISTER_ADDRESS_PNP 11
  39. #define TDI_DEREGISTER_ADDRESS_PNP 12
  40. #define TDI_REGISTER_DEVICE_PNP 13
  41. #define TDI_DEREGISTER_DEVICE_PNP 14
  42. #define TDI_NDIS_IOCTL_HANDLER_PNP 15
  43. #define TDI_ENUMERATE_ADDRESSES 16
  44. #define TDI_REGISTER_PROVIDER_PNP 17
  45. #define TDI_DEREGISTER_PROVIDER_PNP 18
  46. #define TDI_PROVIDER_READY_PNP 19
  47. #define TDI_MAX_BIND_REQUEST TDI_DEREGISTER_DEVICE
  48. #define TDI_MAX_ADDRESS_REQUEST TDI_DEREGISTER_ADDRESS
  49. //
  50. // This is the definition of the common part of a TDI_NOTIFY_ELEMENT structure
  51. //
  52. typedef struct _TDI_NOTIFY_COMMON {
  53. LIST_ENTRY Linkage;
  54. UCHAR Type;
  55. } TDI_NOTIFY_COMMON, *PTDI_NOTIFY_COMMON;
  56. //
  57. // The definition of the TDI_NOTIFY_BIND structure.
  58. //
  59. typedef struct _TDI_NOTIFY_BIND {
  60. TDI_BIND_HANDLER BindHandler;
  61. TDI_UNBIND_HANDLER UnbindHandler;
  62. } TDI_NOTIFY_BIND, *PTDI_NOTIFY_BIND;
  63. //
  64. // The definition of a TDI_NOTIFY_ADDRESS structure,
  65. //
  66. typedef struct _TDI_NOTIFY_ADDRESS {
  67. union {
  68. struct {
  69. TDI_ADD_ADDRESS_HANDLER AddHandler;
  70. TDI_DEL_ADDRESS_HANDLER DeleteHandler;
  71. };
  72. struct {
  73. TDI_ADD_ADDRESS_HANDLER_V2 AddHandlerV2;
  74. TDI_DEL_ADDRESS_HANDLER_V2 DeleteHandlerV2;
  75. };
  76. };
  77. } TDI_NOTIFY_ADDRESS, *PTDI_NOTIFY_ADDRESS;
  78. //
  79. // This is the definition of a TDI_NOTIFY_ELEMENT stucture.
  80. //
  81. typedef struct _TDI_NOTIFY_ELEMENT {
  82. TDI_NOTIFY_COMMON Common;
  83. union {
  84. TDI_NOTIFY_BIND BindElement;
  85. TDI_NOTIFY_ADDRESS AddressElement;
  86. } Specific;
  87. } TDI_NOTIFY_ELEMENT, *PTDI_NOTIFY_ELEMENT;
  88. //
  89. // This is the definition of the common part of a TDI_PROVIDER_RESOURCE structure.
  90. //
  91. typedef struct _TDI_NOTIFY_PNP_ELEMENT TDI_NOTIFY_PNP_ELEMENT, *PTDI_NOTIFY_PNP_ELEMENT ;
  92. typedef struct _TDI_PROVIDER_COMMON {
  93. LIST_ENTRY Linkage;
  94. UCHAR Type;
  95. PTDI_NOTIFY_PNP_ELEMENT pNotifyElement;
  96. NTSTATUS ReturnStatus;
  97. } TDI_PROVIDER_COMMON, *PTDI_PROVIDER_COMMON;
  98. //
  99. // The definition of the TDI_PROVIDER_DEVICE structure.
  100. //
  101. typedef struct _TDI_PROVIDER_DEVICE {
  102. UNICODE_STRING DeviceName;
  103. } TDI_PROVIDER_DEVICE, *PTDI_PROVIDER_DEVICE;
  104. //
  105. // The definition of the TDI_PROVIDER_NET_ADDRESS structure.
  106. //
  107. typedef struct _TDI_PROVIDER_NET_ADDRESS {
  108. TA_ADDRESS Address;
  109. } TDI_PROVIDER_NET_ADDRESS, *PTDI_PROVIDER_NET_ADDRESS;
  110. //
  111. // This is the definition of a TDI_PROVIDER_RESOURCE stucture.
  112. //
  113. typedef struct _TDI_PROVIDER_RESOURCE {
  114. TDI_PROVIDER_COMMON Common;
  115. // defined in netpnp.h
  116. PNET_PNP_EVENT PnpPowerEvent;
  117. //
  118. // Now, we allow TDI to return PENDING and complete later
  119. // with this handler.
  120. //
  121. ProviderPnPPowerComplete PnPCompleteHandler;
  122. // Each TDI Client gets back and tells us what the status
  123. NTSTATUS Status;
  124. // These are mostly Address Specific.
  125. UNICODE_STRING DeviceName;
  126. PTDI_PNP_CONTEXT Context1;
  127. PTDI_PNP_CONTEXT Context2;
  128. ULONG PowerHandlers;
  129. //Indicates if the Provider has called TDIProviderReady
  130. //
  131. ULONG ProviderReady;
  132. PVOID PreviousContext;
  133. // Debugging Information
  134. PVOID pCallersAddress;
  135. union {
  136. TDI_PROVIDER_DEVICE Device;
  137. TDI_PROVIDER_NET_ADDRESS NetAddress;
  138. } Specific;
  139. } TDI_PROVIDER_RESOURCE, *PTDI_PROVIDER_RESOURCE;
  140. //
  141. // Structure of a bind list request.
  142. //
  143. typedef struct _TDI_SERIALIZED_REQUEST {
  144. LIST_ENTRY Linkage;
  145. PVOID Element;
  146. UINT Type;
  147. PKEVENT Event;
  148. BOOLEAN Pending;
  149. } TDI_SERIALIZED_REQUEST, *PTDI_SERIALIZED_REQUEST;
  150. //
  151. // Power Management and PnP related extensions
  152. //
  153. // This structure stores pointers to the handlers for Pnp/PM events
  154. // for the TDI clients
  155. typedef struct _TDI_EXEC_PARAMS TDI_EXEC_PARAMS, *PTDI_EXEC_PARAMS;
  156. typedef struct _TDI_NOTIFY_PNP_ELEMENT {
  157. TDI_NOTIFY_COMMON Common;
  158. USHORT TdiVersion;
  159. USHORT Unused;
  160. UNICODE_STRING ElementName;
  161. union {
  162. TDI_BINDING_HANDLER BindingHandler;
  163. TDI_NOTIFY_BIND Bind;
  164. };
  165. TDI_NOTIFY_ADDRESS AddressElement;
  166. TDI_PNP_POWER_HANDLER PnpPowerHandler;
  167. //
  168. // We need to maintain a list of providers in memory
  169. // for Power Mgmt. and Wake up on LAN.
  170. //
  171. PWSTR* ListofProviders;
  172. // The way we store stuff above is a MULTI_SZ string with pointers before
  173. // the MULTI_SZ starts to individual strings.
  174. //
  175. ULONG NumberofEntries;
  176. // This contains a list of bindings we should ignore when sending
  177. // notifications.
  178. PWSTR ListofBindingsToIgnore;
  179. // When we register a provider, we want to insure we have the
  180. // space to store the information to deregister it. This way
  181. // deregister will not fail under low memory conditions.
  182. PTDI_EXEC_PARAMS pTdiDeregisterExecParams;
  183. } TDI_NOTIFY_PNP_ELEMENT, *PTDI_NOTIFY_PNP_ELEMENT;
  184. //
  185. // Since the Remote Boot folks require that TDI not go to the
  186. // registry and also sometimes the disk might get powered down
  187. // before the netcards (bug in power management), lets store
  188. // the bindings in non-paged memory (what a waste).
  189. //
  190. typedef struct _TDI_OPEN_BLOCK {
  191. struct _TDI_OPEN_BLOCK *NextOpenBlock;
  192. PTDI_NOTIFY_PNP_ELEMENT pClient;
  193. PTDI_PROVIDER_RESOURCE pProvider;
  194. UNICODE_STRING ProviderName;
  195. } TDI_OPEN_BLOCK, *PTDI_OPEN_BLOCK;
  196. //
  197. // Detailed description of the usage of the above structure.
  198. //
  199. // _____________________ _____________________
  200. // | Linkage |-------------->| Linkage |
  201. // | pClient |--->TDI Client | pClient |
  202. // | pProvider |--->Transport | pProvider |
  203. // | pNextClient |-------------->| pNextClient |
  204. // | pNextProvider | | pNextProvider |
  205. // |___________________| |___________________|
  206. // External defintions for global variables.
  207. extern KSPIN_LOCK TDIListLock;
  208. extern LIST_ENTRY PnpHandlerProviderList;
  209. extern LIST_ENTRY PnpHandlerClientList;
  210. extern LIST_ENTRY PnpHandlerRequestList;
  211. NTSTATUS
  212. TdiPnPHandler(
  213. IN PUNICODE_STRING UpperComponent,
  214. IN PUNICODE_STRING LowerComponent,
  215. IN PUNICODE_STRING BindList,
  216. IN PVOID ReconfigBuffer,
  217. IN UINT ReconfigBufferSize,
  218. IN UINT Operation
  219. );
  220. #endif // _TDIPNP