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.

311 lines
6.6 KiB

  1. #ifndef _NMS_
  2. #define _NMS_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*++
  7. Copyright (c) 1989 Microsoft Corporation
  8. Module Name:
  9. nms.h
  10. Abstract:
  11. This is the header file for the name space manager component of the
  12. Name Server.
  13. Author:
  14. Pradeep Bahl (PradeepB) Dec-1992
  15. Revision History:
  16. --*/
  17. /*
  18. includes
  19. */
  20. #include "wins.h"
  21. #include "comm.h"
  22. /*
  23. defines
  24. */
  25. #ifdef WINSDBG
  26. FUTURES("Put all in a structure")
  27. extern DWORD NmsGenHeapAlloc;
  28. extern DWORD NmsDlgHeapAlloc;
  29. extern DWORD NmsUdpDlgHeapAlloc;
  30. extern DWORD NmsTcpMsgHeapAlloc;
  31. extern DWORD NmsUdpHeapAlloc;
  32. extern DWORD NmsQueHeapAlloc;
  33. extern DWORD NmsAssocHeapAlloc;
  34. extern DWORD NmsRpcHeapAlloc;
  35. extern DWORD NmsRplWrkItmHeapAlloc;
  36. extern DWORD NmsChlHeapAlloc;
  37. extern DWORD NmsTmmHeapAlloc;
  38. extern DWORD NmsCatchAllHeapAlloc;
  39. extern DWORD NmsHeapAllocForList;
  40. extern DWORD NmsGenHeapFree;
  41. extern DWORD NmsDlgHeapFree;
  42. extern DWORD NmsUdpDlgHeapFree;
  43. extern DWORD NmsTcpMsgHeapFree;
  44. extern DWORD NmsUdpHeapFree;
  45. extern DWORD NmsQueHeapFree;
  46. extern DWORD NmsAssocHeapFree;
  47. extern DWORD NmsRpcHeapFree;
  48. extern DWORD NmsRplWrkItmHeapFree;
  49. extern DWORD NmsChlHeapFree;
  50. extern DWORD NmsTmmHeapFree;
  51. extern DWORD NmsCatchAllHeapFree;
  52. extern DWORD NmsHeapCreate;
  53. extern DWORD NmsHeapDestroy;
  54. //
  55. // Count of updates (to version number) made by WINS.
  56. //
  57. extern DWORD NmsRplUpd;
  58. extern DWORD NmsRplGUpd;
  59. extern DWORD NmsNmhUpd;
  60. extern DWORD NmsNmhGUpd;
  61. extern DWORD NmsNmhRelUpd;
  62. extern DWORD NmsNmhRelGUpd;
  63. extern DWORD NmsScvUpd;
  64. extern DWORD NmsScvGUpd;
  65. extern DWORD NmsChlUpd;
  66. extern DWORD NmsChlGUpd;
  67. extern DWORD NmsRpcUpd;
  68. extern DWORD NmsRpcGUpd;
  69. extern DWORD NmsOthUpd;
  70. extern DWORD NmsOthGUpd;
  71. #if DBG
  72. //
  73. // No of reg/ref/rel requests dropped because of WINS hitting the threshold
  74. // of max. requets on its queue. Used by InsertOtherNbtWorkItem
  75. //
  76. extern volatile DWORD NmsRegReqQDropped;
  77. #endif
  78. //
  79. // NmsUpdCtrs[Client][TypeOfUpd][TypeOfRec][StateOfNewRec][VersNoInc]
  80. //
  81. extern DWORD NmsUpdCtrs[WINS_NO_OF_CLIENTS][2][4][3][2];
  82. extern CRITICAL_SECTION NmsHeapCrtSec;
  83. #endif
  84. #define NMS_OPCODE_MASK 0x78 /*to weed out the 4 bits of the 3rd byte
  85. * of the name packet
  86. */
  87. #define NMS_RESPONSE_MASK 0x80 /*to weed out the bit that indicates
  88. * whether the datagram is a request or
  89. * a response
  90. */
  91. /*
  92. macros
  93. */
  94. /*
  95. * NMSISNBT_M -- Is this an nbt request message
  96. *
  97. * Examines the third byte of the message to determine this
  98. */
  99. #define NMSISNBT_M(pMsg) \
  100. (((*(pMsg + 2) & NMS_OPCODE_MASK) >> 3) != WINS_IS_NOT_NBT)
  101. /*
  102. * NMSISRPL_M -- Is this a replicator message
  103. *
  104. * Examines the third byte of the message to determine this
  105. */
  106. #define NMSISRPL_MSG_M(pMsg ) \
  107. (((*(pMsg + 2) & NMS_OPCODE_MASK) >> 3) == WINS_IS_NOT_NBT)
  108. /*
  109. GEN_INIT_BUFF_HEAP_SIZE -- This is the initial size of the heap
  110. for allocating queue items for the various
  111. queues, TLS storage, for reading in a file,etc.
  112. Keep it 1000
  113. */
  114. #define GEN_INIT_BUFF_HEAP_SIZE 1000
  115. //
  116. // RPC_INIT_BUFF_HEAP_SIZE -- This is the initial size of the heap for
  117. // use by rpc
  118. //
  119. #define RPC_INIT_BUFF_HEAP_SIZE 1000
  120. #define RPL_WRKITM_BUFF_HEAP_SIZE 1000 //1000 bytes
  121. //
  122. // Initial heap size for timer work items
  123. //
  124. #define TMM_INIT_HEAP_SIZE 1000
  125. //
  126. // The maximum number of concurrent RPC calls allowed
  127. //
  128. FUTURES("Move these defines to winsthd.h")
  129. #define NMS_MAX_RPC_CALLS 15
  130. #define NMS_MAX_BROWSER_RPC_CALLS (NMS_MAX_RPC_CALLS - 4)
  131. //
  132. // Minimum number of RPC call threads
  133. //
  134. #define NMS_MIN_RPC_CALL_THDS 2
  135. //
  136. // This is the amount of time the service controller is asked to wait
  137. //
  138. #define MSECS_WAIT_WHEN_DEL_WINS 120000 //from ReadOwnAddTbl
  139. /*
  140. structure definitions
  141. */
  142. /*
  143. QUERY_RSP -- structure used to hold the information that needs to be sent
  144. in a positive name query response message
  145. */
  146. typedef struct
  147. {
  148. DWORD CountOfIPAdd; //it is a DWORD for alignment
  149. DWORD IPAdd[1]; //one or more IP addresses start here.
  150. } QUERY_RSP;
  151. #ifdef WINSDBG
  152. typedef struct _PUSH_CTRS_T {
  153. DWORD NoUpdNtfAcc;
  154. DWORD NoUpdNtfRej;
  155. DWORD NoSndEntReq;
  156. DWORD NoAddVersReq;
  157. DWORD NoUpdNtfReq;
  158. DWORD NoUpdVersReq;
  159. DWORD NoInvReq;
  160. } PUSH_CTRS_T, *PPUSH_CTRS_T;
  161. typedef struct _PULL_CTRS_T {
  162. DWORD PH;
  163. } PULL_CTRS_T, *PPULL_CTRS_T;
  164. typedef struct _NMS_CTRS_T {
  165. PUSH_CTRS_T RplPushCtrs;
  166. PULL_CTRS_T RplPullCtrs;
  167. } NMS_CTRS_T, *PNMS_CTRS_T;
  168. #endif
  169. /*
  170. externs
  171. */
  172. #ifdef WINSDBG
  173. extern NMS_CTRS_T NmsCtrs;
  174. #endif
  175. extern HANDLE NmsMainTermEvt;
  176. extern HANDLE NmsTermEvt;
  177. extern CRITICAL_SECTION NmsTermCrtSec;
  178. extern HANDLE NmsCrDelNbtThdEvt;
  179. extern DWORD NmsNoOfNbtThds;
  180. extern DWORD NmsTotalTrmThdCnt;
  181. extern BOOL fNmsThdOutOfReck;
  182. extern VERS_NO_T NmsRangeSize;
  183. extern VERS_NO_T NmsHalfRangeSize;
  184. extern VERS_NO_T NmsVersNoToStartFromNextTime;
  185. extern VERS_NO_T NmsHighWaterMarkVersNo;
  186. extern DWORD NmsNoOfRpcCallsToDb;
  187. //
  188. // required for security checking. The types are defined in ntseapi.h
  189. //
  190. extern GENERIC_MAPPING NmsInfoMapping;
  191. extern PSECURITY_DESCRIPTOR pNmsSecurityDescriptor;
  192. FUTURES("move to winsque.h")
  193. extern HANDLE GenBuffHeapHdl; //handle to heap for use for general
  194. //allocation
  195. extern HANDLE NmsRpcHeapHdl; //handle to heap for use for allocation
  196. //by rpc
  197. extern COMM_ADD_T NmsLocalAdd; //WINS's Address
  198. extern BOOL fNmsAbruptTerm;
  199. extern BOOL fNmsMainSessionActive;
  200. #ifdef TEST_DATA
  201. extern HANDLE NmsFileHdl;
  202. #endif
  203. #ifdef DBGSVC
  204. extern HANDLE NmsDbgFileHdl;
  205. //extern FILE *pNmsDbgFile;
  206. #endif
  207. extern CRITICAL_SECTION WinsIntfNoOfUsersCrtSec;
  208. /*
  209. function definitions
  210. */
  211. //
  212. // Handler used for interfacing with the service controller
  213. //
  214. extern
  215. VOID
  216. NmsServiceControlHandler(
  217. IN DWORD Opcode
  218. );
  219. extern
  220. VOID
  221. ENmsHandleMsg(
  222. PCOMM_HDL_T pDlgHdl,
  223. MSG_T pMsg,
  224. MSG_LEN_T MsgLen
  225. );
  226. extern
  227. VOID
  228. ENmsWinsUpdateStatus(
  229. DWORD MSecsToWait
  230. );
  231. #ifdef WINSDBG
  232. extern
  233. VOID
  234. NmsPrintCtrs(
  235. VOID
  236. );
  237. #endif
  238. #ifndef WINS_INTERACTIVE
  239. extern
  240. VOID
  241. NmsChkDbgFileSz(
  242. VOID
  243. );
  244. #endif
  245. #ifdef __cplusplus
  246. }
  247. #endif
  248. #endif //_NMS_