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.

326 lines
7.4 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_COMMON 0x0000FFFF
  74. #define BR_TIMER 0x00010000
  75. #define BR_QUEUE 0x00020000
  76. #define BR_LOCKS 0x00040000
  77. #define BR_SERVER_ENUM 0x00100000
  78. #define BR_ALL 0xFFFFFFFF
  79. NET_API_STATUS
  80. I_BrowserDebugCall (
  81. IN LPWSTR servername OPTIONAL,
  82. IN DWORD DebugCode,
  83. IN DWORD OptionalValue
  84. );
  85. #endif
  86. typedef struct _INTERIM_ELEMENT {
  87. LIST_ENTRY NextElement;
  88. ULONG Periodicity;
  89. ULONG TimeLastSeen;
  90. ULONG PlatformId;
  91. ULONG MajorVersionNumber;
  92. ULONG MinorVersionNumber;
  93. ULONG Type;
  94. WCHAR Name[CNLEN+1];
  95. WCHAR Comment[LM20_MAXCOMMENTSZ+1];
  96. } INTERIM_ELEMENT, *PINTERIM_ELEMENT;
  97. struct _INTERIM_SERVER_LIST;
  98. typedef
  99. VOID
  100. (*PINTERIM_NEW_CALLBACK)(
  101. IN struct _INTERIM_SERVER_LIST *InterimList,
  102. IN PINTERIM_ELEMENT Element
  103. );
  104. typedef
  105. VOID
  106. (*PINTERIM_EXISTING_CALLBACK)(
  107. IN struct _INTERIM_SERVER_LIST *InterimList,
  108. IN PINTERIM_ELEMENT Element
  109. );
  110. typedef
  111. VOID
  112. (*PINTERIM_DELETE_CALLBACK)(
  113. IN struct _INTERIM_SERVER_LIST *InterimList,
  114. IN PINTERIM_ELEMENT Element
  115. );
  116. typedef
  117. BOOLEAN
  118. (*PINTERIM_AGE_CALLBACK)(
  119. IN struct _INTERIM_SERVER_LIST *InterimList,
  120. IN PINTERIM_ELEMENT Element
  121. );
  122. typedef struct _INTERIM_SERVER_LIST {
  123. // RTL_GENERIC_TABLE ServerTable;
  124. LIST_ENTRY ServerList;
  125. ULONG TotalBytesNeeded;
  126. ULONG TotalEntries;
  127. ULONG EntriesRead;
  128. PINTERIM_NEW_CALLBACK NewElementCallback;
  129. PINTERIM_EXISTING_CALLBACK ExistingElementCallback;
  130. PINTERIM_DELETE_CALLBACK DeleteElementCallback;
  131. PINTERIM_AGE_CALLBACK AgeElementCallback;
  132. } INTERIM_SERVER_LIST, *PINTERIM_SERVER_LIST;
  133. NET_API_STATUS
  134. DeviceControlGetInfo(
  135. IN HANDLE FileHandle,
  136. IN ULONG DeviceControlCode,
  137. IN PVOID RequestPacket,
  138. IN ULONG RequestPacketLength,
  139. OUT LPVOID *OutputBuffer,
  140. IN ULONG PreferedMaximumLength,
  141. IN ULONG BufferHintSize,
  142. OUT PULONG Information OPTIONAL
  143. );
  144. NET_API_STATUS
  145. BrDgReceiverIoControl(
  146. IN HANDLE FileHandle,
  147. IN ULONG DgReceiverControlCode,
  148. IN PLMDR_REQUEST_PACKET Drp,
  149. IN ULONG DrpSize,
  150. IN PVOID SecondBuffer OPTIONAL,
  151. IN ULONG SecondBufferLength,
  152. OUT PULONG Information OPTIONAL
  153. );
  154. NET_API_STATUS
  155. OpenBrowser(
  156. OUT PHANDLE BrowserHandle
  157. );
  158. NET_API_STATUS
  159. GetBrowserServerList(
  160. IN PUNICODE_STRING TransportName,
  161. IN LPCWSTR domain,
  162. OUT LPWSTR *BrowserList[],
  163. OUT PULONG BrowserListLength,
  164. IN BOOLEAN ForceRescan
  165. );
  166. NET_API_STATUS
  167. InitializeInterimServerList(
  168. IN PINTERIM_SERVER_LIST InterimServerList,
  169. IN PINTERIM_NEW_CALLBACK NewCallback,
  170. IN PINTERIM_EXISTING_CALLBACK ExistingCallback,
  171. IN PINTERIM_DELETE_CALLBACK DeleteElementCallback,
  172. IN PINTERIM_AGE_CALLBACK AgeElementCallback
  173. );
  174. NET_API_STATUS
  175. CopyInterimServerList(
  176. IN PINTERIM_SERVER_LIST NewInterimServerList,
  177. IN PINTERIM_SERVER_LIST OldInterimServerList
  178. );
  179. NET_API_STATUS
  180. UninitializeInterimServerList(
  181. IN PINTERIM_SERVER_LIST InterimServerList
  182. );
  183. NET_API_STATUS
  184. InsertElementInterimServerList (
  185. IN PINTERIM_SERVER_LIST InterimServerList,
  186. IN PINTERIM_ELEMENT InterimElement,
  187. IN ULONG Level,
  188. IN PBOOLEAN NewElement OPTIONAL,
  189. IN PINTERIM_ELEMENT *ActualElement OPTIONAL
  190. );
  191. ULONG
  192. NumberInterimServerListElements(
  193. IN PINTERIM_SERVER_LIST InterimServerList
  194. );
  195. NET_API_STATUS
  196. AgeInterimServerList(
  197. IN PINTERIM_SERVER_LIST InterimServerList
  198. );
  199. NET_API_STATUS
  200. MergeServerList(
  201. IN PINTERIM_SERVER_LIST InterimServerList,
  202. IN ULONG level,
  203. IN PVOID NewServerList,
  204. IN ULONG NewEntriesRead,
  205. IN ULONG NewTotalEntries
  206. );
  207. PINTERIM_ELEMENT
  208. LookupInterimServerList(
  209. IN PINTERIM_SERVER_LIST InterimServerList,
  210. IN LPWSTR ServerNameToLookUp
  211. );
  212. NET_API_STATUS
  213. PackServerList(
  214. IN PINTERIM_SERVER_LIST InterimServerList,
  215. IN ULONG Level,
  216. IN ULONG ServerType,
  217. IN ULONG PreferedDataLength,
  218. OUT PVOID *bufptr,
  219. OUT PULONG entriesread,
  220. OUT PULONG totalentries,
  221. IN LPCWSTR FirstNameToReturn
  222. );
  223. VOID
  224. PrepareServerListForMerge(
  225. IN PVOID ServerInfoList,
  226. IN ULONG Level,
  227. IN ULONG EntriesInList
  228. );
  229. NET_API_STATUS
  230. CheckForService(
  231. IN LPWSTR ServiceName,
  232. OUT LPSERVICE_STATUS ServiceStatus OPTIONAL
  233. );
  234. NET_API_STATUS
  235. BrGetLanaNumFromNetworkName(
  236. IN LPWSTR TransportName,
  237. OUT CCHAR *LanaNum
  238. );
  239. NET_API_STATUS
  240. GetNetBiosMasterName(
  241. IN LPWSTR NetworkName,
  242. IN LPWSTR PrimaryDomain,
  243. OUT LPWSTR MasterName,
  244. IN PSVCS_NET_BIOS_RESET SvcsNetBiosReset OPTIONAL
  245. );
  246. NET_API_STATUS
  247. SendDatagram(
  248. IN HANDLE DgReceiverHandle,
  249. IN PUNICODE_STRING Network,
  250. IN PUNICODE_STRING EmulatedDomainName,
  251. IN PWSTR ResponseName,
  252. IN DGRECEIVER_NAME_TYPE NameType,
  253. IN PVOID Buffer,
  254. IN ULONG BufferLength
  255. );
  256. #ifdef ENABLE_PSEUDO_BROWSER
  257. BOOL
  258. IsEnumServerEnabled(
  259. VOID
  260. );
  261. DWORD
  262. GetBrowserPseudoServerLevel(
  263. VOID
  264. );
  265. #endif
  266. #endif // _BRCOMMON_