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.

253 lines
7.4 KiB

  1. /*++
  2. Copyright(c) 1999-2002 Microsoft Corporation
  3. Module Name:
  4. brdgtdi.h
  5. Abstract:
  6. Ethernet MAC level bridge.
  7. Gpo registration for address notifications.
  8. Author:
  9. Salahuddin J. Khan (sjkhan)
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. March 2002 - Original version
  14. --*/
  15. // ===========================================================================
  16. //
  17. // DEFINES
  18. //
  19. // ===========================================================================
  20. #define MAX_GUID_LEN 39
  21. #define MAX_IP4_STRING_LEN 17
  22. #define BRDG_ON_SAME_NETWORK TRUE
  23. #define BRDG_ON_DIFFERENT_NETWORK FALSE
  24. #define BRDG_STATUS_EMPTY_LIST ((NTSTATUS)(0x0000000F))
  25. // ===========================================================================
  26. //
  27. // TYPES
  28. //
  29. // ===========================================================================
  30. typedef struct _BRDG_GPO_NETWORKS BRDG_GPO_NETWORKS, *PBRDG_GPO_NETWORKS;
  31. typedef struct _BRDG_GPO_NETWORKS
  32. {
  33. LIST_ENTRY ListEntry;
  34. PUNICODE_STRING Identifier;
  35. PUNICODE_STRING NetworkName;
  36. } BRDG_GPO_NETWORKS, *PBRDG_GPO_NETWORKS;
  37. typedef struct _BRDG_GPO_THREAD_PARAMS
  38. {
  39. PLIST_ENTRY NotifyList;
  40. PNDIS_RW_LOCK NotifyListLock;
  41. PKEVENT NotifyEvent;
  42. PKEVENT KillEvent;
  43. } BRDG_GPO_THREAD_PARAMS, *PBRDG_GPO_THREAD_PARAMS;
  44. typedef struct _BRDG_GPO_GLOBALS
  45. {
  46. UNICODE_STRING GroupPolicyNetworkName;
  47. BOOLEAN RegisteredForGroupPolicyChanges;
  48. BOOLEAN RegisteredForGroupPolicyHistoryChanges;
  49. BOOLEAN RegisteredForNetworkConnectionsGroupPolicyChanges;
  50. BOOLEAN PolicyBridge;
  51. BOOLEAN WaitingOnSoftwareHive;
  52. BOOLEAN ProcessingNotifications;
  53. PNDIS_RW_LOCK NetworkListLock;
  54. BRIDGE_TIMER RegistrationTimer;
  55. PLIST_ENTRY ListHeadNetworks;
  56. PLIST_ENTRY ListHeadNotify;
  57. PNDIS_RW_LOCK NotifyListLock;
  58. HANDLE NotificationsThread;
  59. BRDG_GPO_THREAD_PARAMS QueueInfo;
  60. } BRDG_GPO_GLOBALS, *PBRDG_GPO_GLOBALS;
  61. // The joys of a multi-pass compiler allow us to not have
  62. // to forward declare this. If you need a single pass compile
  63. // you'll have to add a forward to the struct below.
  64. typedef VOID (*PBRDG_GPO_REG_CALLBACK)(PBRDG_GPO_NOTIFY_KEY);
  65. typedef NTSTATUS (*PBRDG_GPO_REGISTER)();
  66. typedef struct _BRDG_GPO_NOTIFY_KEY
  67. {
  68. LIST_ENTRY ListEntry;
  69. HANDLE RegKey;
  70. ULONG Buffer;
  71. ULONG BufferSize;
  72. IO_STATUS_BLOCK IoStatus;
  73. UNICODE_STRING RegValue;
  74. UNICODE_STRING RegKeyName;
  75. UNICODE_STRING Identifier;
  76. WORK_QUEUE_ITEM RegChangeWorkItem;
  77. PVOID WorkItemContext;
  78. BOOLEAN Recurring;
  79. PBRDG_GPO_REG_CALLBACK FunctionCallback;
  80. BOOLEAN WatchTree;
  81. ULONG CompletionFilter;
  82. BOOLEAN Modified;
  83. PBOOLEAN SuccessfulRegistration;
  84. WAIT_REFCOUNT RefCount;
  85. LONG PendingNotification;
  86. PBRDG_GPO_REGISTER FunctionRegister;
  87. } BRDG_GPO_NOTIFY_KEY, *PBRDG_GPO_NOTIFY_KEY;
  88. typedef struct _BRDG_GPO_QUEUED_NOTIFY
  89. {
  90. LIST_ENTRY ListEntry;
  91. PBRDG_GPO_NOTIFY_KEY Notify;
  92. } BRDG_GPO_QUEUED_NOTIFY, *PBRDG_GPO_QUEUED_NOTIFY;
  93. // ===========================================================================
  94. //
  95. // PROTOTYPES
  96. //
  97. // ===========================================================================
  98. NTSTATUS
  99. BrdgGpoDriverInit();
  100. VOID
  101. BrdgGpoCleanup();
  102. NTSTATUS
  103. BrdgGpoNewAddressNotification(
  104. IN PWSTR DeviceId
  105. );
  106. NTSTATUS
  107. BrdgGpoNotifyRegKeyChange(
  108. IN PBRDG_GPO_NOTIFY_KEY Notify,
  109. IN PIO_APC_ROUTINE ApcRoutine,
  110. IN PVOID ApcContext,
  111. IN ULONG CompletionFilter,
  112. IN BOOLEAN WatchTree);
  113. NTSTATUS
  114. BrdgGpoInitializeNetworkList();
  115. VOID
  116. BrdgGpoUninitializeNetworkList();
  117. VOID
  118. BrdgGpoAcquireNetworkListLock(
  119. IN PNDIS_RW_LOCK NetworkListLock,
  120. IN BOOLEAN fWrite,
  121. IN OUT PLOCK_STATE LockState);
  122. VOID
  123. BrdgGpoReleaseNetworkListLock(
  124. IN PNDIS_RW_LOCK NetworkListLock,
  125. IN OUT PLOCK_STATE LockState);
  126. NTSTATUS
  127. BrdgGpoAllocateAndInitializeNetwork(
  128. IN OUT PBRDG_GPO_NETWORKS* Network,
  129. IN PWCHAR Identifier,
  130. IN PWCHAR NetworkName);
  131. NTSTATUS
  132. BrdgGpoInsertNetwork(
  133. IN PLIST_ENTRY NetworkList,
  134. IN PLIST_ENTRY Network,
  135. IN PNDIS_RW_LOCK NetworkListLock);
  136. VOID
  137. BrdgGpoFreeNetworkAndData(
  138. IN PBRDG_GPO_NETWORKS Network);
  139. NTSTATUS
  140. BrdgGpoDeleteNetwork(
  141. IN PLIST_ENTRY NetworkList,
  142. IN PUNICODE_STRING NetworkIdentifier,
  143. IN PNDIS_RW_LOCK NetworkListLock);
  144. NTSTATUS
  145. BrdgGpoFindNetwork(
  146. IN PLIST_ENTRY NetworkList,
  147. IN PUNICODE_STRING NetworkIdentifier,
  148. IN PNDIS_RW_LOCK NetworkListLock,
  149. OUT PBRDG_GPO_NETWORKS* Network);
  150. NTSTATUS
  151. BrdgGpoMatchNetworkName(
  152. IN PLIST_ENTRY NetworkList,
  153. IN PUNICODE_STRING NetworkName,
  154. IN PNDIS_RW_LOCK NetworkListLock);
  155. NTSTATUS
  156. BrdgGpoUpdateNetworkName(
  157. IN PLIST_ENTRY NetworkList,
  158. IN PUNICODE_STRING Identifier,
  159. IN PWCHAR NetworkName,
  160. IN PNDIS_RW_LOCK NetworkListLock);
  161. NTSTATUS
  162. BrdgGpoEmptyNetworkList(
  163. IN OUT PLIST_ENTRY NetworkList,
  164. IN PNDIS_RW_LOCK NetworkListLock);
  165. NTSTATUS BrdgGpoGetCurrentNetwork(
  166. IN PUNICODE_STRING RegKeyName,
  167. OUT PWCHAR* NetworkName);
  168. //
  169. // Notify filter values
  170. //
  171. #define REG_NOTIFY_CHANGE_NAME (0x00000001L) // Create or delete (child)
  172. #define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L)
  173. #define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) // time stamp
  174. #define REG_NOTIFY_CHANGE_SECURITY (0x00000008L)
  175. #define REG_LEGAL_CHANGE_FILTER \
  176. (REG_NOTIFY_CHANGE_NAME |\
  177. REG_NOTIFY_CHANGE_ATTRIBUTES |\
  178. REG_NOTIFY_CHANGE_LAST_SET |\
  179. REG_NOTIFY_CHANGE_SECURITY)
  180. typedef enum _REG_ACTION {
  181. KeyAdded,
  182. KeyRemoved,
  183. KeyModified
  184. } REG_ACTION;
  185. typedef struct _REG_NOTIFY_INFORMATION {
  186. ULONG NextEntryOffset;
  187. REG_ACTION Action;
  188. ULONG KeyLength;
  189. WCHAR Key[1]; // Variable size
  190. } REG_NOTIFY_INFORMATION, *PREG_NOTIFY_INFORMATION;
  191. NTSTATUS
  192. ZwNotifyChangeKey(
  193. IN HANDLE KeyHandle,
  194. IN HANDLE Event,
  195. IN PIO_APC_ROUTINE ApcRoutine,
  196. IN PVOID ApcContext,
  197. OUT PIO_STATUS_BLOCK IoStatusBlock,
  198. IN ULONG CompletionFilter,
  199. IN BOOLEAN WatchTree,
  200. OUT PVOID Buffer,
  201. IN ULONG BufferSize,
  202. IN BOOLEAN Asynchronous
  203. );