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.

338 lines
8.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. brcommon.h
  5. Abstract:
  6. Header for utility routines for the browser service.
  7. Author:
  8. Larry Osterman (LarryO) 23-Mar-1992
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #ifndef _BRCOMMON_
  14. #define _BRCOMMON_
  15. #include <winsvc.h>
  16. #include <svcs.h> // PSVCS_NET_BIOS_RESET
  17. #if DEVL
  18. //
  19. // Codes for I_BrowserDebugCall
  20. //
  21. #define BROWSER_DEBUG_BREAK_POINT 0
  22. #define BROWSER_DEBUG_DUMP_NETWORKS 1
  23. #define BROWSER_DEBUG_DUMP_SERVERS 2
  24. #define BROWSER_DEBUG_ENABLE_BROWSER 3
  25. #define BROWSER_DEBUG_SET_DEBUG 4
  26. #define BROWSER_DEBUG_CLEAR_DEBUG 5
  27. #define BROWSER_DEBUG_TICKLE 6
  28. #define BROWSER_DEBUG_ELECT 7
  29. #define BROWSER_DEBUG_GET_MASTER 8
  30. #define BROWSER_DEBUG_FIND_MASTER 9
  31. #define BROWSER_DEBUG_GET_BACKUP_LIST 10
  32. #define BROWSER_DEBUG_ANNOUNCE_MASTER 11
  33. #define BROWSER_DEBUG_ILLEGAL_DGRAM 12
  34. #define BROWSER_DEBUG_GET_OTHLIST 13
  35. #define BROWSER_DEBUG_ADD_MASTERNAME 14
  36. #define BROWSER_DEBUG_VIEW 15
  37. #define BROWSER_DEBUG_FORCE_ANNOUNCE 16
  38. #define BROWSER_DEBUG_LOCAL_BRLIST 17
  39. #define BROWSER_DEBUG_ANNOUNCE 18
  40. #define BROWSER_DEBUG_RPCLIST 19
  41. #define BROWSER_DEBUG_RPCCMP 20
  42. #define BROWSER_DEBUG_TRUNCATE_LOG 21
  43. #define BROWSER_DEBUG_STATISTICS 22
  44. #define BROWSER_DEBUG_BOWSERDEBUG 23
  45. #define BROWSER_DEBUG_POPULATE_SERVER 24
  46. #define BROWSER_DEBUG_POPULATE_DOMAIN 25
  47. #define BROWSER_DEBUG_LIST_WFW 26
  48. #define BROWSER_DEBUG_STATUS 27
  49. #define BROWSER_DEBUG_GETPDC 28
  50. #define BROWSER_DEBUG_ADD_DOMAINNAME 29
  51. #define BROWSER_DEBUG_GET_WINSSERVER 30
  52. #define BROWSER_DEBUG_GET_DOMAINLIST 31
  53. #define BROWSER_DEBUG_GET_NETBIOSNAMES 32
  54. #define BROWSER_DEBUG_SET_EMULATEDDOMAIN 33
  55. #define BROWSER_DEBUG_SET_EMULATEDDOMAINENUM 34
  56. #define BROWSER_DEBUG_ADD_ALTERNATE 35
  57. #define BROWSER_DEBUG_BIND_TRANSPORT 36
  58. #define BROWSER_DEBUG_UNBIND_TRANSPORT 37
  59. #define BROWSER_DEBUG_RENAME_DOMAIN 38
  60. //
  61. // Debug trace level bits for turning on/off trace statements in the
  62. // browser service
  63. //
  64. #define BR_CRITICAL 0x00000001
  65. #define BR_INIT 0x00000002
  66. #define BR_UTIL 0x00000020
  67. #define BR_CONFIG 0x00000040
  68. #define BR_MAIN 0x00000080
  69. #define BR_BACKUP 0x00000400
  70. #define BR_MASTER 0x00000800
  71. #define BR_DOMAIN 0x00001000
  72. #define BR_NETWORK 0x00002000
  73. #define BR_CLIENT_OP 0x00004000
  74. #define BR_COMMON 0x0000FFFF
  75. #define BR_TIMER 0x00010000
  76. #define BR_QUEUE 0x00020000
  77. #define BR_LOCKS 0x00040000
  78. #define BR_SERVER_ENUM 0x00100000
  79. #define BR_ALL 0xFFFFFFFF
  80. NET_API_STATUS
  81. I_BrowserDebugCall (
  82. IN LPWSTR servername OPTIONAL,
  83. IN DWORD DebugCode,
  84. IN DWORD OptionalValue
  85. );
  86. #endif
  87. typedef struct _INTERIM_ELEMENT {
  88. LIST_ENTRY NextElement;
  89. ULONG Periodicity;
  90. ULONG TimeLastSeen;
  91. ULONG PlatformId;
  92. ULONG MajorVersionNumber;
  93. ULONG MinorVersionNumber;
  94. ULONG Type;
  95. WCHAR Name[CNLEN+1];
  96. WCHAR Comment[LM20_MAXCOMMENTSZ+1];
  97. } INTERIM_ELEMENT, *PINTERIM_ELEMENT;
  98. struct _INTERIM_SERVER_LIST;
  99. typedef
  100. VOID
  101. (*PINTERIM_NEW_CALLBACK)(
  102. IN struct _INTERIM_SERVER_LIST *InterimList,
  103. IN PINTERIM_ELEMENT Element
  104. );
  105. typedef
  106. VOID
  107. (*PINTERIM_EXISTING_CALLBACK)(
  108. IN struct _INTERIM_SERVER_LIST *InterimList,
  109. IN PINTERIM_ELEMENT Element
  110. );
  111. typedef
  112. VOID
  113. (*PINTERIM_DELETE_CALLBACK)(
  114. IN struct _INTERIM_SERVER_LIST *InterimList,
  115. IN PINTERIM_ELEMENT Element
  116. );
  117. typedef
  118. BOOLEAN
  119. (*PINTERIM_AGE_CALLBACK)(
  120. IN struct _INTERIM_SERVER_LIST *InterimList,
  121. IN PINTERIM_ELEMENT Element
  122. );
  123. typedef struct _INTERIM_SERVER_LIST {
  124. // RTL_GENERIC_TABLE ServerTable;
  125. LIST_ENTRY ServerList;
  126. ULONG TotalBytesNeeded;
  127. ULONG TotalEntries;
  128. ULONG EntriesRead;
  129. PINTERIM_NEW_CALLBACK NewElementCallback;
  130. PINTERIM_EXISTING_CALLBACK ExistingElementCallback;
  131. PINTERIM_DELETE_CALLBACK DeleteElementCallback;
  132. PINTERIM_AGE_CALLBACK AgeElementCallback;
  133. } INTERIM_SERVER_LIST, *PINTERIM_SERVER_LIST;
  134. NET_API_STATUS
  135. DeviceControlGetInfo(
  136. IN HANDLE FileHandle,
  137. IN ULONG DeviceControlCode,
  138. IN PVOID RequestPacket,
  139. IN ULONG RequestPacketLength,
  140. OUT LPVOID *OutputBuffer,
  141. IN ULONG PreferedMaximumLength,
  142. IN ULONG BufferHintSize,
  143. OUT PULONG Information OPTIONAL
  144. );
  145. NET_API_STATUS
  146. BrDgReceiverIoControl(
  147. IN HANDLE FileHandle,
  148. IN ULONG DgReceiverControlCode,
  149. IN PLMDR_REQUEST_PACKET Drp,
  150. IN ULONG DrpSize,
  151. IN PVOID SecondBuffer OPTIONAL,
  152. IN ULONG SecondBufferLength,
  153. OUT PULONG Information OPTIONAL
  154. );
  155. NET_API_STATUS
  156. OpenBrowser(
  157. OUT PHANDLE BrowserHandle
  158. );
  159. NET_API_STATUS
  160. GetBrowserServerList(
  161. IN PUNICODE_STRING TransportName,
  162. IN LPCWSTR domain,
  163. OUT LPWSTR *BrowserList[],
  164. OUT PULONG BrowserListLength,
  165. IN BOOLEAN ForceRescan
  166. );
  167. NET_API_STATUS
  168. InitializeInterimServerList(
  169. IN PINTERIM_SERVER_LIST InterimServerList,
  170. IN PINTERIM_NEW_CALLBACK NewCallback,
  171. IN PINTERIM_EXISTING_CALLBACK ExistingCallback,
  172. IN PINTERIM_DELETE_CALLBACK DeleteElementCallback,
  173. IN PINTERIM_AGE_CALLBACK AgeElementCallback
  174. );
  175. NET_API_STATUS
  176. CopyInterimServerList(
  177. IN PINTERIM_SERVER_LIST NewInterimServerList,
  178. IN PINTERIM_SERVER_LIST OldInterimServerList
  179. );
  180. NET_API_STATUS
  181. UninitializeInterimServerList(
  182. IN PINTERIM_SERVER_LIST InterimServerList
  183. );
  184. NET_API_STATUS
  185. InsertElementInterimServerList (
  186. IN PINTERIM_SERVER_LIST InterimServerList,
  187. IN PINTERIM_ELEMENT InterimElement,
  188. IN ULONG Level,
  189. IN PBOOLEAN NewElement OPTIONAL,
  190. IN PINTERIM_ELEMENT *ActualElement OPTIONAL
  191. );
  192. ULONG
  193. NumberInterimServerListElements(
  194. IN PINTERIM_SERVER_LIST InterimServerList
  195. );
  196. NET_API_STATUS
  197. AgeInterimServerList(
  198. IN PINTERIM_SERVER_LIST InterimServerList
  199. );
  200. NET_API_STATUS
  201. MergeServerList(
  202. IN PINTERIM_SERVER_LIST InterimServerList,
  203. IN ULONG level,
  204. IN PVOID NewServerList,
  205. IN ULONG NewEntriesRead,
  206. IN ULONG NewTotalEntries
  207. );
  208. PINTERIM_ELEMENT
  209. LookupInterimServerList(
  210. IN PINTERIM_SERVER_LIST InterimServerList,
  211. IN LPWSTR ServerNameToLookUp
  212. );
  213. NET_API_STATUS
  214. PackServerList(
  215. IN PINTERIM_SERVER_LIST InterimServerList,
  216. IN ULONG Level,
  217. IN ULONG ServerType,
  218. IN ULONG PreferedDataLength,
  219. OUT PVOID *bufptr,
  220. OUT PULONG entriesread,
  221. OUT PULONG totalentries,
  222. IN LPCWSTR FirstNameToReturn
  223. );
  224. VOID
  225. PrepareServerListForMerge(
  226. IN PVOID ServerInfoList,
  227. IN ULONG Level,
  228. IN ULONG EntriesInList
  229. );
  230. NET_API_STATUS
  231. CheckForService(
  232. IN LPWSTR ServiceName,
  233. OUT LPSERVICE_STATUS ServiceStatus OPTIONAL
  234. );
  235. NET_API_STATUS
  236. BrGetLanaNumFromNetworkName(
  237. IN LPWSTR TransportName,
  238. OUT CCHAR *LanaNum
  239. );
  240. NET_API_STATUS
  241. GetNetBiosMasterName(
  242. IN LPWSTR NetworkName,
  243. IN LPWSTR PrimaryDomain,
  244. OUT LPWSTR MasterName,
  245. IN PSVCS_NET_BIOS_RESET SvcsNetBiosReset OPTIONAL
  246. );
  247. NET_API_STATUS
  248. SendDatagram(
  249. IN HANDLE DgReceiverHandle,
  250. IN PUNICODE_STRING Network,
  251. IN PUNICODE_STRING EmulatedDomainName,
  252. IN PWSTR ResponseName,
  253. IN DGRECEIVER_NAME_TYPE NameType,
  254. IN PVOID Buffer,
  255. IN ULONG BufferLength
  256. );
  257. NET_API_STATUS
  258. SendDatagramAsync(
  259. IN HANDLE DgReceiverHandle,
  260. IN PUNICODE_STRING Network,
  261. IN PUNICODE_STRING EmulatedDomainName,
  262. IN PWSTR ResponseName,
  263. IN DGRECEIVER_NAME_TYPE NameType,
  264. IN PVOID Buffer,
  265. IN ULONG BufferLength
  266. );
  267. #ifdef ENABLE_PSEUDO_BROWSER
  268. BOOL
  269. IsEnumServerEnabled(
  270. VOID
  271. );
  272. DWORD
  273. GetBrowserPseudoServerLevel(
  274. VOID
  275. );
  276. #endif
  277. #endif // _BRCOMMON_