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.

446 lines
7.9 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. //
  88. // Handle to event used for demand dial
  89. //
  90. HANDLE g_hIpInIpEvent;
  91. //
  92. // Handle to event used for stack change notifications
  93. //
  94. HANDLE g_hStackChangeEvent;
  95. //
  96. // Handle to event used request forwarding change from worker
  97. //
  98. HANDLE g_hSetForwardingEvent;
  99. //
  100. // Handle to event used to get notification about forwarding changes
  101. //
  102. HANDLE g_hForwardingChangeEvent;
  103. //
  104. // Handle to event used by Routing Protocols for notification
  105. //
  106. HANDLE g_hRoutingProtocolEvent ;
  107. //
  108. // Timer to handle Router discover advts
  109. //
  110. HANDLE g_hRtrDiscTimer;
  111. //
  112. // Timer to handle Ras Server advertisements
  113. //
  114. HANDLE g_hRasAdvTimer;
  115. //
  116. // Timer to handle MZAP advertisements
  117. //
  118. HANDLE g_hMzapTimer;
  119. //
  120. // Event for Winsock2
  121. //
  122. HANDLE g_hRtrDiscSocketEvent;
  123. //
  124. // Event for mrinfo/mtrace services
  125. //
  126. HANDLE g_hMcMiscSocketEvent;
  127. WSABUF g_wsaMcRcvBuf;
  128. BYTE g_byMcMiscBuffer[1500];
  129. HANDLE g_hMcastEvents[NUM_MCAST_IRPS];
  130. //
  131. // Events for Route Change notifications
  132. //
  133. HANDLE g_hRouteChangeEvents[NUM_ROUTE_CHANGE_IRPS];
  134. //
  135. // Handle to WANARP device
  136. //
  137. HANDLE g_hWanarpRead;
  138. HANDLE g_hWanarpWrite;
  139. //
  140. // Count of all routing protocols configured
  141. //
  142. DWORD TotalRoutingProtocols ;
  143. //
  144. // Lock for tracking router usage: this facilitates stop router functionality
  145. //
  146. CRITICAL_SECTION RouterStateLock ;
  147. //
  148. // Structure keeping the router state
  149. //
  150. IPRouterState RouterState ;
  151. //
  152. // used for WANARP demand dial mechanism
  153. //
  154. WANARP_NOTIFICATION wnWanarpMsg;
  155. OVERLAPPED WANARPOverlapped;
  156. //
  157. // Critical section for the forwarding state data
  158. //
  159. CRITICAL_SECTION g_csFwdState;
  160. //
  161. // The last request to the worker thread
  162. //
  163. BOOL g_bEnableFwdRequest;
  164. //
  165. // The last action by the worker
  166. //
  167. BOOL g_bFwdEnabled;
  168. //
  169. // Should we set routes to the stack?
  170. //
  171. BOOL g_bSetRoutesToStack;
  172. //
  173. // Flag indicating if NETBT proxy should be enabled
  174. //
  175. BOOL g_bEnableNetbtBcastFrowarding;
  176. //
  177. // The NETBT proxy mode prior to starting RRAS
  178. //
  179. DWORD g_dwOldNetbtProxyMode;
  180. //
  181. // copy of the support functions Routing Protocols need
  182. //
  183. extern SUPPORT_FUNCTIONS g_sfnDimFunctions;
  184. //
  185. // Router Discovery stuff
  186. //
  187. extern PICMP_ROUTER_ADVT_MSG g_pIcmpAdvt;
  188. extern SOCKADDR_IN g_sinAllSystemsAddr;
  189. extern WSABUF g_wsabufICMPAdvtBuffer;
  190. extern WSABUF g_wsaIpRcvBuf;
  191. //
  192. // Buffer to hold maximum length IP header and 8 bytes of the ICMP packet
  193. //
  194. DWORD g_pdwIpAndIcmpBuf[ICMP_RCV_BUFFER_LEN];
  195. PIP_HEADER g_pIpHeader;
  196. //
  197. // externs defined in exdeclar.h
  198. //
  199. //
  200. // The CB for the Internal Interface
  201. //
  202. extern PICB g_pInternalInterfaceCb;
  203. //
  204. // The CB for the Loopback Interface
  205. //
  206. extern PICB g_pLoopbackInterfaceCb;
  207. //
  208. // Counter for sequence numbers
  209. //
  210. extern DWORD g_dwNextICBSeqNumberCounter;
  211. //
  212. // Number of addresses in the system
  213. //
  214. extern ULONG g_ulNumBindings;
  215. extern ULONG g_ulNumInterfaces;
  216. extern ULONG g_ulNumNonClientInterfaces;
  217. extern HANDLE g_hIpDevice;
  218. extern HANDLE g_hMcastDevice;
  219. extern HANDLE g_hIpRouteChangeDevice;
  220. extern BOOL g_bUninitServer;
  221. extern IP_CACHE g_IpInfo;
  222. extern TCP_CACHE g_TcpInfo;
  223. extern UDP_CACHE g_UdpInfo;
  224. extern HANDLE g_hIfHeap;
  225. extern HANDLE g_hIpAddrHeap;
  226. extern HANDLE g_hIpForwardHeap;
  227. extern HANDLE g_hIpNetHeap;
  228. extern HANDLE g_hTcpHeap;
  229. extern HANDLE g_hUdpHeap;
  230. LIST_ENTRY g_leStackRoutesToRestore;
  231. ULONG g_ulGatewayCount;
  232. ULONG g_ulGatewayMaxCount;
  233. PGATEWAY_INFO g_pGateways;
  234. extern HANDLE g_hMibRtmHandle;
  235. extern DWORD g_TimeoutTable[NUM_CACHE];
  236. extern DWORD (*g_LoadFunctionTable[NUM_CACHE])();
  237. extern DWORD
  238. (*g_AccessFunctionTable[NUMBER_OF_EXPORTED_VARIABLES])(DWORD dwQueryType,
  239. DWORD dwInEntrySize,
  240. PMIB_OPAQUE_QUERY lpInEntry,
  241. LPDWORD lpOutEntrySize,
  242. PMIB_OPAQUE_INFO lpOutEntry,
  243. LPBOOL lpbCache);
  244. extern DWORD g_LastUpdateTable[NUM_CACHE];
  245. extern DWORD g_dwStartTime;
  246. extern RTL_RESOURCE g_LockTable[NUM_LOCKS];
  247. extern MCAST_OVERLAPPED g_rginMcastMsg[NUM_MCAST_IRPS];
  248. extern IPNotifyData g_IpNotifyData;
  249. extern ROUTE_CHANGE_INFO g_rgIpRouteNotifyOutput[NUM_ROUTE_CHANGE_IRPS];
  250. extern HKEY g_hIpIpIfKey;
  251. extern HANDLE g_hMHbeatSocketEvent;
  252. extern HANDLE g_hMzapSocketEvent;
  253. //
  254. // Entrypoints into DIM
  255. //
  256. DWORD (*ConnectInterface)(IN HANDLE hDIMInterface, IN DWORD dwProtocolId);
  257. DWORD (*DisconnectInterface)(IN HANDLE hDIMInterface, IN DWORD dwProtocolId);
  258. DWORD
  259. (*SaveInterfaceInfo)(
  260. IN HANDLE hDIMInterface,
  261. IN DWORD dwProtocolId,
  262. IN LPVOID pInterfaceInfo,
  263. IN DWORD cBInterfaceInfoSize
  264. );
  265. DWORD
  266. (*RestoreInterfaceInfo)(
  267. IN HANDLE hDIMInterface,
  268. IN DWORD dwProtocolId,
  269. IN LPVOID lpInterfaceInfo,
  270. IN LPDWORD lpcbInterfaceInfoSize
  271. );
  272. VOID (*RouterStopped)(IN DWORD dwProtocolId, IN DWORD dwError);
  273. DWORD
  274. (APIENTRY *SaveGlobalInfo)(
  275. IN DWORD dwProtocolId,
  276. IN LPVOID pGlobalInfo,
  277. IN DWORD cbGlobalInfoSize );
  278. VOID
  279. (APIENTRY *EnableInterfaceWithDIM)(
  280. IN HANDLE hDIMInterface,
  281. IN DWORD dwProtocolId,
  282. IN BOOL fEnabled);
  283. //
  284. // Callbacks into MGM
  285. //
  286. PMGM_INDICATE_MFE_DELETION g_pfnMgmMfeDeleted;
  287. PMGM_NEW_PACKET_INDICATION g_pfnMgmNewPacket;
  288. PMGM_BLOCK_GROUPS g_pfnMgmBlockGroups;
  289. PMGM_UNBLOCK_GROUPS g_pfnMgmUnBlockGroups;
  290. PMGM_WRONG_IF_INDICATION g_pfnMgmWrongIf;
  291. INFO_CB g_rgicInfoCb[NUM_INFO_CBS];
  292. CHAR g_rgcLoopbackString[MAXLEN_IFDESCR + 1];
  293. CHAR g_rgcInternalString[MAXLEN_IFDESCR + 1];
  294. CHAR g_rgcWanString[MAXLEN_IFDESCR + 1];
  295. CHAR g_rgcIpIpString[MAXLEN_IFDESCR + 1];
  296. HINSTANCE g_hOwnModule;
  297. HANDLE g_hMprConfig;
  298. #endif