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.

379 lines
12 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. hostannc.h
  5. Abstract:
  6. This module defines the data structures related to host announcements.
  7. Author:
  8. Larry Osterman (LarryO) 22-Oct-1990
  9. Revision History:
  10. 22-Oct-1991 LarryO
  11. Created
  12. --*/
  13. #ifndef _HOSTANNC_
  14. #define _HOSTANNC_
  15. typedef enum _MailslotType {
  16. MailslotTransaction = -2,
  17. OtherTransaction = -1,
  18. Illegal = 0,
  19. HostAnnouncement = 1,
  20. AnnouncementRequest = 2,
  21. InterrogateInfoRequest = 3,
  22. RelogonRequest = 4,
  23. Election = 8,
  24. GetBackupListReq = 9,
  25. GetBackupListResp = 10,
  26. BecomeBackupServer = 11,
  27. WkGroupAnnouncement = 12,
  28. MasterAnnouncement = 13,
  29. ResetBrowserState = 14,
  30. LocalMasterAnnouncement = 15,
  31. MaximumMailslotType
  32. } MAILSLOTTYPE, *PMAILSLOTTYPE;
  33. #define WORKSTATION_SIGNATURE '\0'
  34. #define SERVER_SIGNATURE ' '
  35. #define PRIMARY_DOMAIN_SIGNATURE '\0'
  36. #define PRIMARY_CONTROLLER_SIGNATURE '\x1B'
  37. #define DOMAIN_CONTROLLER_SIGNATURE '\x1C'
  38. #define MASTER_BROWSER_SIGNATURE '\x1D'
  39. #define BROWSER_ELECTION_SIGNATURE '\x1E'
  40. #define DOMAIN_ANNOUNCEMENT_NAME "\x01\x02__MSBROWSE__\x02\x01"
  41. //
  42. // The following values should be the minimum and maximum of the
  43. // mailslot transaction opcodes defined above.
  44. //
  45. #define MIN_TRANSACT_MS_OPCODE MailslotTransaction
  46. #define MAX_TRANSACT_MS_OPCODE RelogonRequest
  47. //
  48. // Common name for reserved, `internal' transactions
  49. //
  50. #define MAILSLOT_LANMAN_NAME SMB_MAILSLOT_PREFIX "\\LANMAN"
  51. #define MAILSLOT_BROWSER_NAME SMB_MAILSLOT_PREFIX "\\BROWSE"
  52. #define ANNOUNCEMENT_MAILSLOT_NAME "\\\\*" ITRANS_MS_NAME
  53. #include <packon.h>
  54. //
  55. // Each visible server on the net periodically emits a host announcement.
  56. // This is a SMB TRANSACTION REQUEST on a reserved, "internal" name.
  57. //
  58. //
  59. // There are two versions of each of these structures defined. The first,
  60. // is the actual "meat" of the structure, the second includes the announcement
  61. // type.
  62. //
  63. //
  64. // Lan Manager announcement message. This is used for opcodes:
  65. //
  66. // HostAnnouncement to \MAILSLOT\LANMAN on the LANMAN domain name.
  67. //
  68. typedef struct _HOST_ANNOUNCE_PACKET_1 {
  69. UCHAR CompatibilityPad;
  70. ULONG Type;
  71. UCHAR VersionMajor; /* version of LM running on host */
  72. UCHAR VersionMinor; /* " " " " " " " */
  73. USHORT Periodicity; /* announcement cycle in secs */
  74. CHAR NameComment[LM20_CNLEN+1+LM20_MAXCOMMENTSZ+1];
  75. } HOST_ANNOUNCE_PACKET_1, *PHOST_ANNOUNCE_PACKET_1;
  76. typedef struct _HOST_ANNOUNCE_PACKET {
  77. UCHAR AnnounceType;
  78. HOST_ANNOUNCE_PACKET_1 HostAnnouncement;
  79. } HOST_ANNOUNCE_PACKET, *PHOST_ANNOUNCE_PACKET;
  80. //
  81. // General announcement message. This is used for opcodes:
  82. //
  83. // HostAnnouncement, WkGroupAnnouncement, and LocalMasterAnnouncement
  84. //
  85. typedef struct _BROWSE_ANNOUNCE_PACKET_1 {
  86. UCHAR UpdateCount; // Inc'ed when announce data changed.
  87. ULONG Periodicity; // announcement cycle in milliseconds
  88. UCHAR ServerName[LM20_CNLEN+1];
  89. UCHAR VersionMajor;
  90. UCHAR VersionMinor; /* " " " " " " " */
  91. ULONG Type; // Server type.
  92. DWORD CommentPointer; // Not really a pointer, its a 32 bit number
  93. CHAR Comment[LM20_MAXCOMMENTSZ+1];
  94. } BROWSE_ANNOUNCE_PACKET_1, *PBROWSE_ANNOUNCE_PACKET_1;
  95. typedef struct _BROWSE_ANNOUNCE_PACKET {
  96. UCHAR BrowseType;
  97. BROWSE_ANNOUNCE_PACKET_1 BrowseAnnouncement;
  98. } BROWSE_ANNOUNCE_PACKET, *PBROWSE_ANNOUNCE_PACKET;
  99. //
  100. // The request announcement packet is sent by clients to request that
  101. // remote servers announce themselves.
  102. //
  103. typedef struct _REQUEST_ANNOUNCE_PACKET_1 { // Contents of request announcement
  104. UCHAR Flags; // Unused Flags
  105. CHAR Reply[LM20_CNLEN+1];
  106. } REQUEST_ANNOUNCE_PACKET_1, *PREQUEST_ANNOUNCE_PACKET_1;
  107. typedef struct _REQUEST_ANNOUNCE_PACKET { /* Request announcement struct */
  108. UCHAR Type;
  109. REQUEST_ANNOUNCE_PACKET_1 RequestAnnouncement;
  110. } REQUEST_ANNOUNCE_PACKET, *PREQUEST_ANNOUNCE_PACKET;
  111. #define HOST_ANNC_NAME(xx) ((xx)->NameComment)
  112. #define HOST_ANNC_COMMENT(xx) ((xx)->NameComment + (strlen(HOST_ANNC_NAME(xx))+1))
  113. #define BROWSE_ANNC_NAME(xx) ((xx)->ServerName)
  114. #define BROWSE_ANNC_COMMENT(xx) ((xx)->Comment)
  115. //
  116. // Definitions for Windows Browser
  117. //
  118. //
  119. // Request to retrieve a backup server list.
  120. //
  121. typedef struct _BACKUP_LIST_REQUEST_1 {
  122. UCHAR RequestedCount;
  123. ULONG Token;
  124. } BACKUP_LIST_REQUEST_1, *PBACKUP_LIST_REQUEST_1;
  125. typedef struct _BACKUP_LIST_REQUEST {
  126. UCHAR Type;
  127. BACKUP_LIST_REQUEST_1 BackupListRequest;
  128. } BACKUP_LIST_REQUEST, *PBACKUP_LIST_REQUEST;
  129. //
  130. // Response containing a backup server list.
  131. //
  132. typedef struct _BACKUP_LIST_RESPONSE_1 {
  133. UCHAR BackupServerCount;
  134. ULONG Token;
  135. UCHAR BackupServerList[1];
  136. } BACKUP_LIST_RESPONSE_1, *PBACKUP_LIST_RESPONSE_1;
  137. typedef struct _BACKUP_LIST_RESPONSE {
  138. UCHAR Type;
  139. BACKUP_LIST_RESPONSE_1 BackupListResponse;
  140. } BACKUP_LIST_RESPONSE, *PBACKUP_LIST_RESPONSE;
  141. //
  142. // Message indicating that a potential browser server should become a backup
  143. // server.
  144. //
  145. typedef struct _BECOME_BACKUP_1 {
  146. UCHAR BrowserToPromote[1];
  147. } BECOME_BACKUP_1, *PBECOME_BACKUP_1;
  148. typedef struct _BECOME_BACKUP {
  149. UCHAR Type;
  150. BECOME_BACKUP_1 BecomeBackup;
  151. } BECOME_BACKUP, *PBECOME_BACKUP;
  152. //
  153. // Sent during the election process.
  154. //
  155. typedef struct _REQUEST_ELECTION_1 {
  156. UCHAR Version;
  157. ULONG Criteria;
  158. ULONG TimeUp;
  159. ULONG MustBeZero;
  160. UCHAR ServerName[1];
  161. } REQUEST_ELECTION_1, *PREQUEST_ELECTION_1;
  162. typedef struct _REQUEST_ELECTION {
  163. UCHAR Type;
  164. REQUEST_ELECTION_1 ElectionRequest;
  165. } REQUEST_ELECTION, *PREQUEST_ELECTION;
  166. #define ELECTION_CR_OSTYPE 0xFF000000L // Native OS running on server
  167. #define ELECTION_CR_OSWFW 0x01000000L // Windows for workgroups server
  168. #define ELECTION_CR_WIN_NT 0x10000000L // Windows/NT Server
  169. #define ELECTION_CR_LM_NT 0x20000000L // Lan Manager for Windows/NT
  170. #define ELECTION_CR_REVISION 0x00FFFF00L // Browser software revision
  171. #define ELECTION_MAKE_REV(major, minor) (((major)&0xffL)<<16|((minor)&0xFFL)<<8)
  172. #define ELECTION_CR_DESIRE 0x000000FFL // Desirability of becoming master.
  173. //
  174. // Election desirability within criteria.
  175. //
  176. // Most important is a running PDC, next is a configured domain master.
  177. //
  178. // After that come running masters, then configured backups, then existing
  179. // running backups.
  180. //
  181. // Machines running WINS client are important because they are more capable
  182. // of connecting to a PDC who's address was configured via DHCP.
  183. //
  184. #define ELECTION_DESIRE_AM_BACKUP 0x00000001L // Currently is backup
  185. #define ELECTION_DESIRE_AM_CFG_BKP 0x00000002L // Always want to be
  186. // master - set if backup &&
  187. // MaintainServerList==YES
  188. #define ELECTION_DESIRE_AM_MASTER 0x00000004L // Currently is master
  189. #define ELECTION_DESIRE_AM_DOMMSTR 0x00000008L // Configured as domain master
  190. #define ELECTION_DESIRE_WINS_CLIENT 0x00000020L // Transport running WINS client
  191. #ifdef ENABLE_PSEUDO_BROWSER
  192. #define ELECTION_DESIRE_AM_PSEUDO 0x00000040L // Machine is a Pseudo Server
  193. #endif
  194. #define ELECTION_DESIRE_AM_PDC 0x00000080L // Machine is a lanman NT server.
  195. //
  196. // "Tickle" packet - sent to change state of browser.
  197. //
  198. typedef struct _RESET_STATE_1 {
  199. UCHAR Options;
  200. } RESET_STATE_1, *PRESET_STATE_1;
  201. typedef struct _RESET_STATE {
  202. UCHAR Type;
  203. RESET_STATE_1 ResetStateRequest;
  204. } RESET_STATE, *PRESET_STATE;
  205. #define RESET_STATE_STOP_MASTER 0x01 // Stop being master
  206. #define RESET_STATE_CLEAR_ALL 0x02 // Clear all browser state.
  207. #define RESET_STATE_STOP 0x04 // Stop the browser service.
  208. //
  209. // Master Announcement - Send from master to domain master.
  210. //
  211. typedef struct _MASTER_ANNOUNCEMENT_1 {
  212. UCHAR MasterName[1];
  213. } MASTER_ANNOUNCEMENT_1, *PMASTER_ANNOUNCEMENT_1;
  214. typedef struct _MASTER_ANNOUNCEMENT {
  215. UCHAR Type;
  216. MASTER_ANNOUNCEMENT_1 MasterAnnouncement;
  217. } MASTER_ANNOUNCEMENT, *PMASTER_ANNOUNCEMENT;
  218. //
  219. // Definitions for Workstation interrogation and revalidation transactions
  220. //
  221. typedef struct _WKSTA_INFO_INTERROGATE_PACKET {
  222. UCHAR CompatibilityPad;
  223. ULONG Delay ; // Number of milliseconds to wait before replying
  224. CHAR ReturnMailslot[1] ; // Mailslot to reply to.
  225. } WKSTA_INFO_INTERROGATE_PACKET, *PWKSTA_INFO_INTERROGATE_PACKET;
  226. typedef struct _WKSTA_INFO_RESPONSE_PACKET {
  227. UCHAR CompatibilityPad;
  228. UCHAR VersionMajor;
  229. UCHAR VersionMinor;
  230. USHORT OsVersion ;
  231. CHAR ComputerName[1] ; // var-length ASCIIZ string */
  232. #if 0
  233. //
  234. // The following two ASCIIZ strings are not defined in the structure
  235. // but are concatenated to the end of the structure.
  236. //
  237. CHAR UserName[] ;
  238. CHAR LogonDomain[] ;
  239. #endif
  240. } WKSTA_INFO_RESPONSE_PACKET, *PWKSTA_INFO_RESPONSE_PACKET;
  241. typedef struct _WKSTA_RELOGON_REQUEST_PACKET {
  242. UCHAR CompatibilityPad;
  243. ULONG Delay ;
  244. ULONG Flags ;
  245. CHAR ReturnMailslot[1] ; // var-length ASCIIZ string
  246. #if 0
  247. //
  248. // The following ASCIIZ string is not defined in the structure
  249. // but is concatenated to the end of the structure.
  250. //
  251. CHAR DC_Name[] ;
  252. #endif
  253. } WKSTA_RELOGON_REQUEST_PACKET, *PWKSTA_RELOGON_REQUEST_PACKET;
  254. //
  255. // Values for <wkrrq_flags> field */
  256. //
  257. #define WKRRQ_FLAG_LOGON_SERVER 0x1 // I'm your official logon server;
  258. // do a relogon to me.
  259. //
  260. typedef struct _WKSTA_RELOGON_RESPONSE_PACKET {
  261. UCHAR CompatibilityPad;
  262. USHORT Status ;
  263. CHAR ComputerName[1] ; // var-length ASCIIZ string
  264. } WKSTA_RELOGON_RESPONSE_PACKET, *PWKSTA_RELOGON_RESPONSE_PACKET;
  265. //
  266. // Values for <wkrrs_status> field
  267. //
  268. #define WKRRS_STATUS_SUCCEEDED 0 // Operation succeeded
  269. #define WKRRS_STATUS_DENIED 1 // Operation denied to caller
  270. #define WKRRS_STATUS_FAILED 2 // Operation tried but failed
  271. #define EXCESS_NAME_LEN (sizeof(ITRANS_MS_NAME) - \
  272. FIELD_OFFSET(SMB_TRANSACTION_MAILSLOT, Buffer) )
  273. //
  274. // This structure defines all of the types of requests that appear in messages
  275. // to the internal mailslot.
  276. //
  277. typedef struct _INTERNAL_TRANSACTION {
  278. UCHAR Type; // Type of request.
  279. union {
  280. HOST_ANNOUNCE_PACKET_1 Announcement ;
  281. BROWSE_ANNOUNCE_PACKET_1 BrowseAnnouncement ;
  282. REQUEST_ANNOUNCE_PACKET_1 RequestAnnounce ;
  283. BACKUP_LIST_RESPONSE_1 GetBackupListResp ;
  284. BACKUP_LIST_REQUEST_1 GetBackupListRequest ;
  285. BECOME_BACKUP_1 BecomeBackup ;
  286. REQUEST_ELECTION_1 RequestElection ;
  287. MASTER_ANNOUNCEMENT_1 MasterAnnouncement ;
  288. RESET_STATE_1 ResetState ;
  289. WKSTA_INFO_INTERROGATE_PACKET InterrogateRequest ;
  290. WKSTA_INFO_RESPONSE_PACKET InterrogateResponse ;
  291. WKSTA_RELOGON_REQUEST_PACKET RelogonRequest ;
  292. WKSTA_RELOGON_RESPONSE_PACKET RelogonResponse ;
  293. } Union;
  294. } INTERNAL_TRANSACTION, *PINTERNAL_TRANSACTION ;
  295. #include <packoff.h>
  296. #endif // _HOSTANNC_