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.

331 lines
9.4 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. rtrmgr.h
  5. Abstract:
  6. This module contains the definitions of the internal control structures
  7. used by the router manager
  8. Author:
  9. Stefan Solomon 03/03/1995
  10. Revision History:
  11. --*/
  12. #ifndef _RTRMGR_
  13. #define _RTRMGR_
  14. //************************************************************************
  15. // *
  16. // MAIN DATA STRUCTURES *
  17. // *
  18. //************************************************************************
  19. //*** Interface Control Block ***
  20. typedef struct _ACB * PACB;
  21. typedef struct _UPDATEREQCB {
  22. ULONG RoutesReqStatus;
  23. ULONG ServicesReqStatus;
  24. } UPDATEREQCB, *PUPDATEREQCB;
  25. // status definitions for the routes and services req update
  26. #define NO_UPDATE 0
  27. #define UPDATE_PENDING 1
  28. #define UPDATE_SUCCESSFULL 2
  29. #define UPDATE_FAILURE 3
  30. #define DIAL_REQUEST_BUFFER_SIZE 128
  31. typedef struct _ICB {
  32. LIST_ENTRY IndexHtLinkage;
  33. UCHAR Signature[4];
  34. ULONG InterfaceIndex;
  35. LIST_ENTRY IndexListLinkage; // list of if ordered by index
  36. ULONG AdminState;
  37. ULONG OperState;
  38. BOOL InterfaceReachable;
  39. ROUTER_INTERFACE_TYPE DIMInterfaceType; // interface type for Dim & Co.
  40. ULONG MIBInterfaceType; // interface type for the IPX MIB
  41. LPWSTR InterfaceNamep;
  42. LPWSTR AdapterNamep;
  43. PACB acbp; // ptr to adapter control block
  44. ULONG PacketType; // used to identify a corresponding adapter
  45. ULONG EnableIpxWanNegotiation;
  46. UPDATEREQCB UpdateReq; // controls update request on this if
  47. HANDLE hDIMInterface; // if handle used by DIM
  48. HANDLE DIMUpdateEvent;
  49. DWORD UpdateResult;
  50. BOOL ConnectionRequestPending;
  51. } ICB, *PICB;
  52. //*** Adapter Control Block ***
  53. typedef struct _ACB {
  54. LIST_ENTRY IndexHtLinkage;
  55. UCHAR Signature[4];
  56. ULONG AdapterIndex;
  57. PICB icbp; // ptr to interface control block
  58. LPWSTR AdapterNamep;
  59. ULONG AdapterNameLen;
  60. ADAPTER_INFO AdapterInfo;
  61. } ACB, *PACB;
  62. //
  63. // Macros used by update functions
  64. //
  65. #define ResetUpdateRequest(icbp) {\
  66. (icbp)->UpdateReq.RoutesReqStatus = NO_UPDATE;\
  67. (icbp)->UpdateReq.ServicesReqStatus = NO_UPDATE;\
  68. }
  69. #define SetUpdateRequestPending(icbp) {\
  70. (icbp)->UpdateReq.RoutesReqStatus = UPDATE_PENDING;\
  71. (icbp)->UpdateReq.ServicesReqStatus = UPDATE_PENDING;\
  72. }
  73. #define IsUpdateRequestPending(icbp) \
  74. (((icbp)->UpdateReq.RoutesReqStatus == UPDATE_PENDING) || \
  75. ((icbp)->UpdateReq.ServicesReqStatus == UPDATE_PENDING))
  76. //
  77. // Control Block for each Routing Protocol
  78. //
  79. typedef struct _RPCB {
  80. LIST_ENTRY RP_Linkage ; // Linkage in Routing Prot CBs List
  81. PWSTR RP_DllName; // ptr to string for the dll name
  82. HINSTANCE RP_DllHandle; // DLL module handle
  83. DWORD RP_ProtocolId; // E.g. IPX_PROTOCOL_RIP, etc.
  84. PREGISTER_PROTOCOL RP_RegisterProtocol; // function pointer
  85. PSTART_PROTOCOL RP_StartProtocol ; // function pointer
  86. PSTOP_PROTOCOL RP_StopProtocol ; // function pointer
  87. PADD_INTERFACE RP_AddInterface ; // function pointer
  88. PDELETE_INTERFACE RP_DeleteInterface ; // function pointer
  89. PGET_EVENT_MESSAGE RP_GetEventMessage ; // function pointer
  90. PSET_INTERFACE_INFO RP_SetIfConfigInfo ; // function pointer
  91. PGET_INTERFACE_INFO RP_GetIfConfigInfo ; // function pointer
  92. PBIND_INTERFACE RP_BindInterface ; // function pointer
  93. PUNBIND_INTERFACE RP_UnBindInterface ; // function pointer
  94. PENABLE_INTERFACE RP_EnableInterface ; // function pointer
  95. PDISABLE_INTERFACE RP_DisableInterface ; // function pointer
  96. PGET_GLOBAL_INFO RP_GetGlobalInfo ; // function pointer
  97. PSET_GLOBAL_INFO RP_SetGlobalInfo ; // function pointer
  98. PMIB_CREATE RP_MibCreate ; // function pointer
  99. PMIB_DELETE RP_MibDelete ; // function pointer
  100. PMIB_SET RP_MibSet ; // function pointer
  101. PMIB_GET RP_MibGet ; // function pointer
  102. PMIB_GET_FIRST RP_MibGetFirst ; // function pointer
  103. PMIB_GET_NEXT RP_MibGetNext ; // function pointer
  104. } RPCB, *PRPCB;
  105. //************************************************************************
  106. // *
  107. // MAIN CONSTANTS DEFS *
  108. // *
  109. //************************************************************************
  110. //
  111. // Database Lock Operations
  112. //
  113. #define ACQUIRE_DATABASE_LOCK EnterCriticalSection (&DatabaseLock)
  114. #define RELEASE_DATABASE_LOCK LeaveCriticalSection (&DatabaseLock)
  115. //
  116. // Interface Hash Table Size
  117. //
  118. #define IF_HASH_TABLE_SIZE 32
  119. //
  120. // Adapter Hash Table Size
  121. //
  122. #define ADAPTER_HASH_TABLE_SIZE 16
  123. //
  124. // DEFAULT WAIT FOR CONNECTION REQUEST TO TIME OUT
  125. //
  126. #define CONNECTION_REQUEST_TIME 120000 // 2 minutes in milliseconds
  127. //
  128. // Events for the router manager worker thread to pend on
  129. //
  130. #define ADAPTER_NOTIFICATION_EVENT 0
  131. #define FORWARDER_NOTIFICATION_EVENT 1
  132. #define ROUTING_PROTOCOLS_NOTIFICATION_EVENT 2
  133. #define STOP_NOTIFICATION_EVENT 3
  134. #define MAX_EVENTS 4
  135. //
  136. // Define the mode in which WAN net numbers are allocated to incoming WAN links
  137. //
  138. // NO_WAN_NET_MODE - in this mode we have a LAN/LAN only router.
  139. //
  140. // NUMBERED_WAN_NET_MODE - in this mode, the WAN net numbers are allocated from
  141. // a manually defined pool of net numbers.
  142. //
  143. // UNNUMBERED_WAN_NET_MODE - in this mode there are no net numbers for the WAN
  144. // lines connecting routers and there is a global WAN
  145. // net number for all the client lines.
  146. // The global client WAN net can be manually defined or
  147. // allocated automatically by the router.
  148. #define UNNUMBERED_WAN_NET_MODE 0
  149. #define NUMBERED_WAN_NET_MODE 1
  150. #define NO_WAN_NET_MODE 2
  151. //
  152. // Update Information Type defs
  153. //
  154. #define ROUTES_UPDATE 1
  155. #define SERVICES_UPDATE 2
  156. // Default max routing table size (bytes)
  157. #define IPX_MAX_ROUTING_TABLE_SIZE 100000 * sizeof(RTM_IPX_ROUTE)
  158. // IPXCP DLL Name
  159. #define IPXCPDLLNAME "rasppp"
  160. //************************************************************************
  161. // *
  162. // MAIN GLOBALS DEFS *
  163. // *
  164. //************************************************************************
  165. extern CRITICAL_SECTION DatabaseLock;
  166. extern ULONG InterfaceCount;
  167. extern BOOL RouterAdminStart;
  168. extern ULONG RouterOperState;
  169. extern HANDLE RtmStaticHandle;
  170. extern HANDLE RtmLocalHandle;
  171. extern PICB InternalInterfacep;
  172. extern PACB InternalAdapterp;
  173. extern ULONG NextInterfaceIndex;
  174. extern UCHAR InterfaceSignature[];
  175. extern UCHAR AdapterSignature[];
  176. extern HANDLE g_hEvents[MAX_EVENTS];
  177. extern ULONG ConnReqTimeout;
  178. extern LIST_ENTRY IndexIfHt[IF_HASH_TABLE_SIZE];
  179. extern LIST_ENTRY IndexIfList;
  180. extern UCHAR GlobalWanNet[4];
  181. extern ULONG GlobalInterfaceIndex;
  182. extern LIST_ENTRY RoutingProtocolCBList;
  183. extern ULONG RoutingProtocolActiveCount;
  184. extern ULONG WorkItemsPendingCounter;
  185. extern DWORD
  186. (APIENTRY *ConnectInterface)(IN HANDLE InterfaceName,
  187. IN DWORD ProtocolId);
  188. extern DWORD
  189. (APIENTRY *DisconnectInterface)(IN HANDLE InterfaceName,
  190. IN DWORD ProtocolId);
  191. extern DWORD
  192. (APIENTRY *SaveInterfaceInfo)(
  193. IN HANDLE hDIMInterface,
  194. IN DWORD dwProtocolId,
  195. IN LPVOID pInterfaceInfo,
  196. IN DWORD cbInterfaceInfoSize);
  197. extern DWORD
  198. (APIENTRY *RestoreInterfaceInfo)(
  199. IN HANDLE hDIMInterface,
  200. IN DWORD dwProtocolId,
  201. IN LPVOID lpInterfaceInfo,
  202. IN LPDWORD lpcbInterfaceInfoSize);
  203. extern VOID
  204. (APIENTRY *RouterStarted)(
  205. IN DWORD dwProtocolId );
  206. extern VOID
  207. (APIENTRY *RouterStopped)(
  208. IN DWORD dwProtocolId,
  209. IN DWORD dwError );
  210. extern VOID
  211. (APIENTRY *InterfaceEnabled)(
  212. IN HANDLE hDIMInterface,
  213. IN DWORD dwProtocolId,
  214. IN BOOL fEnabled );
  215. extern BOOL RouterAdminStart;
  216. extern BOOL RipAdminStart;
  217. extern BOOL SapAdminStart;
  218. extern ULONG RouterOperState;
  219. extern ULONG FwOperState;
  220. extern ULONG AdptMgrOperState;
  221. extern ULONG RipOperState;
  222. extern ULONG SapOperState;
  223. extern HANDLE RtmStaticHandle;
  224. extern HANDLE RtmLocalHandle;
  225. extern ULONG RouterStartCount;
  226. extern ULONG RouterStopCount;
  227. extern ULONG RouterStartProtocols;
  228. extern LIST_ENTRY IndexAdptHt[ADAPTER_HASH_TABLE_SIZE];
  229. extern LIST_ENTRY IndexIfHt[IF_HASH_TABLE_SIZE];
  230. extern ULONG MibRefCounter;
  231. extern ULONG UpdateRoutesProtId;
  232. extern UCHAR nullnet[4];
  233. extern BOOL LanOnlyMode;
  234. extern BOOL WanNetDatabaseInitialized;
  235. extern BOOL EnableGlobalWanNet;
  236. extern ULONG RoutingTableHashSize;
  237. extern ULONG MaxRoutingTableSize;
  238. extern PFW_DIAL_REQUEST ConnRequest;
  239. extern OVERLAPPED ConnReqOverlapped;
  240. extern DWORD (*IpxcpBind)(PIPXCP_INTERFACE IpxcpInterface);
  241. extern VOID (*IpxcpRouterStarted)(VOID);
  242. extern VOID (*IpxcpRouterStopped)(VOID);
  243. // NOTE: For the IPX Routing Protocols, the "routing protocol id" is the info
  244. // type used to associate the respective config info with the protocol.
  245. // For instance, IPX_PROTOCOL_RIP as the InfoType field in an IPX_TOC_ENTRY
  246. // passed in AddInterface or SetInterface calls represents the RIP interface info.
  247. // The same in a SetGlobalInfo call represents the RIP Global Info.
  248. // actual structures moved to rtinfo.h to be common with other protocol
  249. // families
  250. typedef RTR_INFO_BLOCK_HEADER IPX_INFO_BLOCK_HEADER, *PIPX_INFO_BLOCK_HEADER;
  251. typedef RTR_TOC_ENTRY IPX_TOC_ENTRY, *PIPX_TOC_ENTRY;
  252. #endif