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.

452 lines
8.4 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. routing\ip\rtrmgr\globals.h
  5. Abstract:
  6. Header for IP Router Manager globals
  7. Revision History:
  8. Gurdeep Singh Pall 6/8/95 Created
  9. --*/
  10. #ifndef __GLOBALS_H__
  11. #define __GLOBALS_H__
  12. //
  13. // Interface Control Block (ICB) list.
  14. //
  15. LIST_ENTRY ICBList ;
  16. //
  17. // Hash lookup for mapping interfaceids to picb
  18. //
  19. LIST_ENTRY ICBHashLookup[ICB_HASH_TABLE_SIZE];
  20. //
  21. // Hash lookup for mapping ICB sequence number to picb
  22. //
  23. LIST_ENTRY ICBSeqNumLookup[ICB_HASH_TABLE_SIZE];
  24. //
  25. // Hash lookup for bindings
  26. //
  27. LIST_ENTRY g_leBindingTable[BINDING_HASH_TABLE_SIZE];
  28. //
  29. // Hash table for interface to adapter mapping
  30. //
  31. //LIST_ENTRY g_rgleAdapterMapTable[ADAPTER_HASH_TABLE_SIZE];
  32. //
  33. // Routing Protocols list
  34. //
  35. LIST_ENTRY g_leProtoCbList;
  36. //
  37. // Timer Queue for Router Discovery advts
  38. //
  39. LIST_ENTRY g_leTimerQueueHead;
  40. //
  41. // Trace Handle used for traces/logging
  42. //
  43. DWORD TraceHandle ;
  44. //
  45. // Handle used for logging events
  46. //
  47. HANDLE g_hLogHandle;
  48. //
  49. // Level of logging
  50. //
  51. DWORD g_dwLoggingLevel;
  52. //
  53. // Flag indicating if the router is being started in LAN only or
  54. // LAN and WAN mode.
  55. //
  56. BOOL RouterRoleLanOnly ;
  57. //
  58. // Handle to the heap used for all allocations
  59. //
  60. HANDLE IPRouterHeap ;
  61. //
  62. // Info useful in making RTMv2 calls
  63. //
  64. RTM_REGN_PROFILE g_rtmProfile;
  65. //
  66. // RTM Handle for static/admin routes
  67. //
  68. HANDLE g_hLocalRoute;
  69. HANDLE g_hAutoStaticRoute;
  70. HANDLE g_hStaticRoute;
  71. HANDLE g_hNonDodRoute;
  72. HANDLE g_hNetMgmtRoute;
  73. // RTM handle for obtaining notifications
  74. HANDLE g_hNotification;
  75. //
  76. // RTM handle for obtaining default route notifications
  77. //
  78. HANDLE g_hDefaultRouteNotification;
  79. //
  80. // Handle to event used for stopping the IP Router
  81. //
  82. HANDLE g_hStopRouterEvent ;
  83. //
  84. // Handle to event used for demand dial
  85. //
  86. HANDLE g_hDemandDialEvent ;
  87. #ifdef KSL_IPINIP
  88. //
  89. // Handle to event used for demand dial
  90. //
  91. HANDLE g_hIpInIpEvent;
  92. #endif //KSL_IPINIP
  93. //
  94. // Handle to event used for stack change notifications
  95. //
  96. HANDLE g_hStackChangeEvent;
  97. //
  98. // Handle to event used request forwarding change from worker
  99. //
  100. HANDLE g_hSetForwardingEvent;
  101. //
  102. // Handle to event used to get notification about forwarding changes
  103. //
  104. HANDLE g_hForwardingChangeEvent;
  105. //
  106. // Handle to event used by Routing Protocols for notification
  107. //
  108. HANDLE g_hRoutingProtocolEvent ;
  109. //
  110. // Timer to handle Router discover advts
  111. //
  112. HANDLE g_hRtrDiscTimer;
  113. //
  114. // Timer to handle Ras Server advertisements
  115. //
  116. HANDLE g_hRasAdvTimer;
  117. //
  118. // Timer to handle MZAP advertisements
  119. //
  120. HANDLE g_hMzapTimer;
  121. //
  122. // Event for Winsock2
  123. //
  124. HANDLE g_hRtrDiscSocketEvent;
  125. //
  126. // Event for mrinfo/mtrace services
  127. //
  128. HANDLE g_hMcMiscSocketEvent;
  129. WSABUF g_wsaMcRcvBuf;
  130. BYTE g_byMcMiscBuffer[1500];
  131. HANDLE g_hMcastEvents[NUM_MCAST_IRPS];
  132. //
  133. // Events for Route Change notifications
  134. //
  135. HANDLE g_hRouteChangeEvents[NUM_ROUTE_CHANGE_IRPS];
  136. //
  137. // Handle to WANARP device
  138. //
  139. HANDLE g_hWanarpRead;
  140. HANDLE g_hWanarpWrite;
  141. //
  142. // Count of all routing protocols configured
  143. //
  144. DWORD TotalRoutingProtocols ;
  145. //
  146. // Lock for tracking router usage: this facilitates stop router functionality
  147. //
  148. CRITICAL_SECTION RouterStateLock ;
  149. //
  150. // Structure keeping the router state
  151. //
  152. IPRouterState RouterState ;
  153. //
  154. // used for WANARP demand dial mechanism
  155. //
  156. WANARP_NOTIFICATION wnWanarpMsg;
  157. OVERLAPPED WANARPOverlapped;
  158. //
  159. // Critical section for the forwarding state data
  160. //
  161. CRITICAL_SECTION g_csFwdState;
  162. //
  163. // The last request to the worker thread
  164. //
  165. BOOL g_bEnableFwdRequest;
  166. //
  167. // The last action by the worker
  168. //
  169. BOOL g_bFwdEnabled;
  170. //
  171. // Should we set routes to the stack?
  172. //
  173. BOOL g_bSetRoutesToStack;
  174. //
  175. // Flag indicating if NETBT proxy should be enabled
  176. //
  177. BOOL g_bEnableNetbtBcastFrowarding;
  178. //
  179. // The NETBT proxy mode prior to starting RRAS
  180. //
  181. DWORD g_dwOldNetbtProxyMode;
  182. //
  183. // copy of the support functions Routing Protocols need
  184. //
  185. extern SUPPORT_FUNCTIONS g_sfnDimFunctions;
  186. //
  187. // Router Discovery stuff
  188. //
  189. extern PICMP_ROUTER_ADVT_MSG g_pIcmpAdvt;
  190. extern SOCKADDR_IN g_sinAllSystemsAddr;
  191. extern WSABUF g_wsabufICMPAdvtBuffer;
  192. extern WSABUF g_wsaIpRcvBuf;
  193. //
  194. // Buffer to hold maximum length IP header and 8 bytes of the ICMP packet
  195. //
  196. DWORD g_pdwIpAndIcmpBuf[ICMP_RCV_BUFFER_LEN];
  197. PIP_HEADER g_pIpHeader;
  198. //
  199. // externs defined in exdeclar.h
  200. //
  201. //
  202. // The CB for the Internal Interface
  203. //
  204. extern PICB g_pInternalInterfaceCb;
  205. //
  206. // The CB for the Loopback Interface
  207. //
  208. extern PICB g_pLoopbackInterfaceCb;
  209. //
  210. // Counter for sequence numbers
  211. //
  212. extern DWORD g_dwNextICBSeqNumberCounter;
  213. //
  214. // Number of addresses in the system
  215. //
  216. extern ULONG g_ulNumBindings;
  217. extern ULONG g_ulNumInterfaces;
  218. extern ULONG g_ulNumNonClientInterfaces;
  219. extern HANDLE g_hIpDevice;
  220. extern HANDLE g_hMcastDevice;
  221. extern HANDLE g_hIpRouteChangeDevice;
  222. extern BOOL g_bUninitServer;
  223. extern IP_CACHE g_IpInfo;
  224. extern TCP_CACHE g_TcpInfo;
  225. extern UDP_CACHE g_UdpInfo;
  226. extern HANDLE g_hIfHeap;
  227. extern HANDLE g_hIpAddrHeap;
  228. extern HANDLE g_hIpForwardHeap;
  229. extern HANDLE g_hIpNetHeap;
  230. extern HANDLE g_hTcpHeap;
  231. extern HANDLE g_hUdpHeap;
  232. LIST_ENTRY g_leStackRoutesToRestore;
  233. ULONG g_ulGatewayCount;
  234. ULONG g_ulGatewayMaxCount;
  235. PGATEWAY_INFO g_pGateways;
  236. extern HANDLE g_hMibRtmHandle;
  237. extern DWORD g_TimeoutTable[NUM_CACHE];
  238. extern DWORD (*g_LoadFunctionTable[NUM_CACHE])();
  239. extern DWORD
  240. (*g_AccessFunctionTable[NUMBER_OF_EXPORTED_VARIABLES])(DWORD dwQueryType,
  241. DWORD dwInEntrySize,
  242. PMIB_OPAQUE_QUERY lpInEntry,
  243. LPDWORD lpOutEntrySize,
  244. PMIB_OPAQUE_INFO lpOutEntry,
  245. LPBOOL lpbCache);
  246. extern DWORD g_LastUpdateTable[NUM_CACHE];
  247. extern DWORD g_dwStartTime;
  248. extern RTL_RESOURCE g_LockTable[NUM_LOCKS];
  249. extern MCAST_OVERLAPPED g_rginMcastMsg[NUM_MCAST_IRPS];
  250. extern IPNotifyData g_IpNotifyData;
  251. extern ROUTE_CHANGE_INFO g_rgIpRouteNotifyOutput[NUM_ROUTE_CHANGE_IRPS];
  252. #ifdef KSL_IPINIP
  253. extern HKEY g_hIpIpIfKey;
  254. #endif //KSL_IPINIP
  255. extern HANDLE g_hMHbeatSocketEvent;
  256. extern HANDLE g_hMzapSocketEvent;
  257. //
  258. // Entrypoints into DIM
  259. //
  260. DWORD (*ConnectInterface)(IN HANDLE hDIMInterface, IN DWORD dwProtocolId);
  261. DWORD (*DisconnectInterface)(IN HANDLE hDIMInterface, IN DWORD dwProtocolId);
  262. DWORD
  263. (*SaveInterfaceInfo)(
  264. IN HANDLE hDIMInterface,
  265. IN DWORD dwProtocolId,
  266. IN LPVOID pInterfaceInfo,
  267. IN DWORD cBInterfaceInfoSize
  268. );
  269. DWORD
  270. (*RestoreInterfaceInfo)(
  271. IN HANDLE hDIMInterface,
  272. IN DWORD dwProtocolId,
  273. IN LPVOID lpInterfaceInfo,
  274. IN LPDWORD lpcbInterfaceInfoSize
  275. );
  276. VOID (*RouterStopped)(IN DWORD dwProtocolId, IN DWORD dwError);
  277. DWORD
  278. (APIENTRY *SaveGlobalInfo)(
  279. IN DWORD dwProtocolId,
  280. IN LPVOID pGlobalInfo,
  281. IN DWORD cbGlobalInfoSize );
  282. VOID
  283. (APIENTRY *EnableInterfaceWithDIM)(
  284. IN HANDLE hDIMInterface,
  285. IN DWORD dwProtocolId,
  286. IN BOOL fEnabled);
  287. //
  288. // Callbacks into MGM
  289. //
  290. PMGM_INDICATE_MFE_DELETION g_pfnMgmMfeDeleted;
  291. PMGM_NEW_PACKET_INDICATION g_pfnMgmNewPacket;
  292. PMGM_BLOCK_GROUPS g_pfnMgmBlockGroups;
  293. PMGM_UNBLOCK_GROUPS g_pfnMgmUnBlockGroups;
  294. PMGM_WRONG_IF_INDICATION g_pfnMgmWrongIf;
  295. INFO_CB g_rgicInfoCb[NUM_INFO_CBS];
  296. CHAR g_rgcLoopbackString[MAXLEN_IFDESCR + 1];
  297. CHAR g_rgcInternalString[MAXLEN_IFDESCR + 1];
  298. CHAR g_rgcWanString[MAXLEN_IFDESCR + 1];
  299. #ifdef KSL_IPINIP
  300. CHAR g_rgcIpIpString[MAXLEN_IFDESCR + 1];
  301. #endif //KSL_IPINIP
  302. HINSTANCE g_hOwnModule;
  303. HANDLE g_hMprConfig;
  304. #endif