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.

536 lines
13 KiB

  1. /*++
  2. Copyright (c) 1995-1999 Microsoft Corporation
  3. Module Name:
  4. routprot.h
  5. Abstract:
  6. Include file for Routing Protocol inteface to Router Managers
  7. --*/
  8. #ifndef __ROUTING_ROUTPROT_H__
  9. #define __ROUTING_ROUTPROT_H__
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #include "stm.h"
  14. #pragma warning(disable:4201)
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // Supported functionality flags //
  21. // //
  22. // ROUTING Imports Routing Table Manager APIs //
  23. // SERVICES Exports Service Table Manager APIs //
  24. // DEMAND_UPDATE_ROUTES IP and IPX RIP support for Autostatic //
  25. // DEMAND_UPDATE_SERVICES IPX SAP, NLSP support for Autostatic //
  26. // PROMISCUOUS_ADD_IF Adds all interfaces, even if no info is present //
  27. // MULTICAST Supports multicast //
  28. // //
  29. //////////////////////////////////////////////////////////////////////////////
  30. #define ROUTING 0x00000001
  31. #define DEMAND_UPDATE_ROUTES 0x00000004
  32. #if MPR40
  33. #define MS_ROUTER_VERSION 0x00000400
  34. #else
  35. #if MPR50
  36. #define MS_ROUTER_VERSION 0x00000500
  37. #else
  38. #error Router version not defined
  39. #endif
  40. #endif
  41. typedef enum _ROUTING_PROTOCOL_EVENTS
  42. {
  43. ROUTER_STOPPED, // Result is empty
  44. SAVE_GLOBAL_CONFIG_INFO, // Result is empty
  45. SAVE_INTERFACE_CONFIG_INFO, // Result is interface index
  46. // for which config info is to be saved.
  47. UPDATE_COMPLETE, // Result is UPDATE_COMPLETE_MESSAGE structure
  48. }ROUTING_PROTOCOL_EVENTS;
  49. typedef enum _NET_INTERFACE_TYPE
  50. {
  51. PERMANENT,
  52. DEMAND_DIAL,
  53. LOCAL_WORKSTATION_DIAL,
  54. REMOTE_WORKSTATION_DIAL
  55. } NET_INTERFACE_TYPE;
  56. typedef struct _SUPPORT_FUNCTIONS
  57. {
  58. //
  59. // Function called by routing protocol to initiate demand dial connection
  60. //
  61. OUT DWORD
  62. (WINAPI *DemandDialRequest)(
  63. IN DWORD ProtocolId,
  64. IN DWORD InterfaceIndex
  65. ) ;
  66. //
  67. // The following entrypoints are provided as a way for getting
  68. // information that spans components
  69. //
  70. OUT DWORD
  71. (WINAPI *MIBEntryCreate)(
  72. IN DWORD dwRoutingPid,
  73. IN DWORD dwEntrySize,
  74. IN LPVOID lpEntry
  75. );
  76. OUT DWORD
  77. (WINAPI *MIBEntryDelete)(
  78. IN DWORD dwRoutingPid,
  79. IN DWORD dwEntrySize,
  80. IN LPVOID lpEntry
  81. );
  82. OUT DWORD
  83. (WINAPI *MIBEntrySet)(
  84. IN DWORD dwRoutingPid,
  85. IN DWORD dwEntrySize,
  86. IN LPVOID lpEntry
  87. );
  88. OUT DWORD
  89. (WINAPI *MIBEntryGet)(
  90. IN DWORD dwRoutingPid,
  91. IN DWORD dwInEntrySize,
  92. IN LPVOID lpInEntry,
  93. IN OUT LPDWORD lpOutEntrySize,
  94. OUT LPVOID lpOutEntry );
  95. OUT DWORD
  96. (WINAPI *MIBEntryGetFirst)(
  97. IN DWORD dwRoutingPid,
  98. IN DWORD dwInEntrySize,
  99. IN LPVOID lpInEntry,
  100. IN OUT LPDWORD lpOutEntrySize,
  101. OUT LPVOID lpOutEntry
  102. );
  103. OUT DWORD
  104. (WINAPI *MIBEntryGetNext)(
  105. IN DWORD dwRoutingPid,
  106. IN DWORD dwInEntrySize,
  107. IN LPVOID lpInEntry,
  108. IN OUT LPDWORD lpOutEntrySize,
  109. OUT LPVOID lpOutEntry
  110. );
  111. } SUPPORT_FUNCTIONS, *PSUPPORT_FUNCTIONS ;
  112. //
  113. // All IPX Protocols must use the protocol ids defined in the range below.
  114. // Protocols not identified below can use any unassigned number greater than
  115. // IPX_PROTOCOL_BASE.
  116. //
  117. #define IPX_PROTOCOL_BASE 0x0001ffff
  118. #define IPX_PROTOCOL_RIP IPX_PROTOCOL_BASE + 1
  119. #define IPX_PROTOCOL_SAP IPX_PROTOCOL_BASE + 2
  120. #define IPX_PROTOCOL_NLSP IPX_PROTOCOL_BASE + 3
  121. typedef struct _UPDATE_COMPLETE_MESSAGE
  122. {
  123. ULONG InterfaceIndex;
  124. ULONG UpdateType; // DEMAND_UPDATE_ROUTES, DEMAND_UPDATE_SERVICES
  125. ULONG UpdateStatus; // NO_ERROR if successfull
  126. } UPDATE_COMPLETE_MESSAGE, *PUPDATE_COMPLETE_MESSAGE;
  127. //
  128. // Message returned in Result parameter to GET_EVENT_MESSAGE api call.
  129. // UpdateCompleteMessage returned for UPDATE_COMPLETE message
  130. // InterfaceIndex returned for SAVE_INTERFACE_CONFIG_INFO message
  131. //
  132. typedef union _MESSAGE
  133. {
  134. UPDATE_COMPLETE_MESSAGE UpdateCompleteMessage;
  135. DWORD InterfaceIndex;
  136. } MESSAGE, *PMESSAGE;
  137. //
  138. // IPX Adapter Binding Info - Used in ActivateInterface
  139. //
  140. typedef struct IPX_ADAPTER_BINDING_INFO
  141. {
  142. ULONG AdapterIndex;
  143. UCHAR Network[4];
  144. UCHAR LocalNode[6];
  145. UCHAR RemoteNode[6];
  146. ULONG MaxPacketSize;
  147. ULONG LinkSpeed;
  148. }IPX_ADAPTER_BINDING_INFO, *PIPX_ADAPTER_BINDING_INFO;
  149. //
  150. // Protocol Start/Stop Entry Points
  151. //
  152. typedef
  153. DWORD
  154. (WINAPI * PSTART_PROTOCOL) (
  155. IN HANDLE NotificationEvent,
  156. IN PSUPPORT_FUNCTIONS SupportFunctions,
  157. IN LPVOID GlobalInfo
  158. );
  159. typedef
  160. DWORD
  161. (WINAPI * PSTOP_PROTOCOL) (
  162. VOID
  163. );
  164. typedef
  165. DWORD
  166. (WINAPI * PADD_INTERFACE) (
  167. IN LPWSTR InterfaceName,
  168. IN ULONG InterfaceIndex,
  169. IN NET_INTERFACE_TYPE InterfaceType,
  170. IN PVOID InterfaceInfo
  171. );
  172. typedef
  173. DWORD
  174. (WINAPI * PDELETE_INTERFACE) (
  175. IN ULONG InterfaceIndex
  176. );
  177. typedef
  178. DWORD
  179. (WINAPI * PGET_EVENT_MESSAGE) (
  180. OUT ROUTING_PROTOCOL_EVENTS *Event,
  181. OUT MESSAGE *Result
  182. );
  183. typedef
  184. DWORD
  185. (WINAPI * PGET_INTERFACE_INFO) (
  186. IN ULONG InterfaceIndex,
  187. IN PVOID InterfaceInfo,
  188. IN OUT PULONG InterfaceInfoSize
  189. );
  190. typedef
  191. DWORD
  192. (WINAPI * PSET_INTERFACE_INFO) (
  193. IN ULONG InterfaceIndex,
  194. IN PVOID InterfaceInfo
  195. );
  196. typedef
  197. DWORD
  198. (WINAPI * PBIND_INTERFACE) (
  199. IN ULONG InterfaceIndex,
  200. IN PVOID BindingInfo
  201. ) ;
  202. typedef
  203. DWORD
  204. (WINAPI * PUNBIND_INTERFACE) (
  205. IN ULONG InterfaceIndex
  206. );
  207. typedef
  208. DWORD
  209. (WINAPI * PENABLE_INTERFACE) (
  210. IN ULONG InterfaceIndex
  211. ) ;
  212. typedef
  213. DWORD
  214. (WINAPI * PDISABLE_INTERFACE) (
  215. IN ULONG InterfaceIndex
  216. );
  217. typedef
  218. DWORD
  219. (WINAPI * PGET_GLOBAL_INFO) (
  220. IN PVOID GlobalInfo,
  221. IN OUT PULONG GlobalInfoSize
  222. );
  223. typedef
  224. DWORD
  225. (WINAPI * PSET_GLOBAL_INFO) (
  226. IN PVOID GlobalInfo
  227. );
  228. typedef
  229. DWORD
  230. (WINAPI * PDO_UPDATE_ROUTES) (
  231. IN ULONG InterfaceIndex
  232. );
  233. typedef
  234. DWORD
  235. (WINAPI * PMIB_CREATE) (
  236. IN ULONG InputDataSize,
  237. IN PVOID InputData
  238. );
  239. typedef
  240. DWORD
  241. (WINAPI * PMIB_DELETE) (
  242. IN ULONG InputDataSize,
  243. IN PVOID InputData
  244. );
  245. typedef
  246. DWORD
  247. (WINAPI * PMIB_GET) (
  248. IN ULONG InputDataSize,
  249. IN PVOID InputData,
  250. OUT PULONG OutputDataSize,
  251. OUT PVOID OutputData
  252. );
  253. typedef
  254. DWORD
  255. (WINAPI * PMIB_SET) (
  256. IN ULONG InputDataSize,
  257. IN PVOID InputData
  258. );
  259. typedef
  260. DWORD
  261. (WINAPI * PMIB_GET_FIRST) (
  262. IN ULONG InputDataSize,
  263. IN PVOID InputData,
  264. OUT PULONG OutputDataSize,
  265. OUT PVOID OutputData
  266. );
  267. typedef
  268. DWORD
  269. (WINAPI * PMIB_GET_NEXT) (
  270. IN ULONG InputDataSize,
  271. IN PVOID InputData,
  272. OUT PULONG OutputDataSize,
  273. OUT PVOID OutputData
  274. );
  275. typedef
  276. DWORD
  277. (WINAPI * PMIB_SET_TRAP_INFO) (
  278. IN HANDLE Event,
  279. IN ULONG InputDataSize,
  280. IN PVOID InputData,
  281. OUT PULONG OutputDataSize,
  282. OUT PVOID OutputData
  283. );
  284. typedef
  285. DWORD
  286. (WINAPI * PMIB_GET_TRAP_INFO) (
  287. IN ULONG InputDataSize,
  288. IN PVOID InputData,
  289. OUT PULONG OutputDataSize,
  290. OUT PVOID OutputData
  291. );
  292. //
  293. // NT5.0 additions
  294. //
  295. typedef
  296. DWORD
  297. (WINAPI *PCONNECT_CLIENT) (
  298. IN ULONG InterfaceIndex,
  299. IN PVOID ClientAddress
  300. );
  301. typedef
  302. DWORD
  303. (WINAPI *PDISCONNECT_CLIENT) (
  304. IN ULONG InterfaceIndex,
  305. IN PVOID ClientAddress
  306. );
  307. //
  308. // InterfaceFlags used with the GetNeighbors() call below
  309. //
  310. #define MRINFO_TUNNEL_FLAG 0x01
  311. #define MRINFO_PIM_FLAG 0x04
  312. #define MRINFO_DOWN_FLAG 0x10
  313. #define MRINFO_DISABLED_FLAG 0x20
  314. #define MRINFO_QUERIER_FLAG 0x40
  315. #define MRINFO_LEAF_FLAG 0x80
  316. typedef
  317. DWORD
  318. (WINAPI *PGET_NEIGHBORS) (
  319. IN DWORD InterfaceIndex,
  320. IN PDWORD NeighborList,
  321. IN OUT PDWORD NeighborListSize,
  322. OUT PBYTE InterfaceFlags
  323. );
  324. //
  325. // StatusCode values used with the GetMfeStatus() call below.
  326. // The protocol should return the highest-valued one that applies.
  327. //
  328. #define MFE_NO_ERROR 0 // none of the below events
  329. #define MFE_REACHED_CORE 1 // this router is an RP/core for the group
  330. //
  331. // StatusCode values set by oif owner only
  332. //
  333. #define MFE_OIF_PRUNED 5 // no downstream receivers exist on oif
  334. //
  335. // StatusCode values set by iif owner only
  336. //
  337. #define MFE_PRUNED_UPSTREAM 4 // a prune was send upstream
  338. #define MFE_OLD_ROUTER 11 // upstream nbr doesn't support mtrace
  339. //
  340. // StatusCode values which are used only by the Router Manager itself:
  341. //
  342. #define MFE_NOT_FORWARDING 2 // not fwding for an unspecified reason
  343. #define MFE_WRONG_IF 3 // mtrace received on iif
  344. #define MFE_BOUNDARY_REACHED 6 // iif or oif is admin scope boundary
  345. #define MFE_NO_MULTICAST 7 // oif is not multicast-enabled
  346. #define MFE_IIF 8 // mtrace arrived on iif
  347. #define MFE_NO_ROUTE 9 // router has no route that matches
  348. #define MFE_NOT_LAST_HOP 10 // router is not the proper last-hop router
  349. #define MFE_PROHIBITED 12 // mtrace is administratively prohibited
  350. #define MFE_NO_SPACE 13 // not enough room in packet
  351. typedef
  352. DWORD
  353. (WINAPI *PGET_MFE_STATUS) (
  354. IN DWORD InterfaceIndex,
  355. IN DWORD GroupAddress,
  356. IN DWORD SourceAddress,
  357. OUT PBYTE StatusCode
  358. );
  359. //
  360. // This is the structure passed between the router manager
  361. // and a registering protocol.
  362. //
  363. // IN OUT DWORD dwVersion
  364. // This is filled by the router manager to indicate the version it supports.
  365. // The DLL MUST set this to the version that the protocol will support.
  366. //
  367. // IN DWORD dwProtocolId
  368. // This the protocol the router manager is expecting the DLL to register.
  369. // If the DLL does not support this protocol, it MUST return
  370. // ERROR_NOT_SUPPORTED
  371. // A DLL will be called once for every protocol it supports
  372. //
  373. // IN OUT DWORD fSupportedFunctionality
  374. // These are the flags denoting the functionality the router manager
  375. // supports. The DLL MUST reset this to the functionality that it
  376. // supports
  377. //
  378. typedef struct _MPR40_ROUTING_CHARACTERISTICS
  379. {
  380. DWORD dwVersion;
  381. DWORD dwProtocolId;
  382. DWORD fSupportedFunctionality;
  383. PSTART_PROTOCOL pfnStartProtocol;
  384. PSTOP_PROTOCOL pfnStopProtocol;
  385. PADD_INTERFACE pfnAddInterface;
  386. PDELETE_INTERFACE pfnDeleteInterface;
  387. PGET_EVENT_MESSAGE pfnGetEventMessage;
  388. PGET_INTERFACE_INFO pfnGetInterfaceInfo;
  389. PSET_INTERFACE_INFO pfnSetInterfaceInfo;
  390. PBIND_INTERFACE pfnBindInterface;
  391. PUNBIND_INTERFACE pfnUnbindInterface;
  392. PENABLE_INTERFACE pfnEnableInterface;
  393. PDISABLE_INTERFACE pfnDisableInterface;
  394. PGET_GLOBAL_INFO pfnGetGlobalInfo;
  395. PSET_GLOBAL_INFO pfnSetGlobalInfo;
  396. PDO_UPDATE_ROUTES pfnUpdateRoutes;
  397. PMIB_CREATE pfnMibCreateEntry;
  398. PMIB_DELETE pfnMibDeleteEntry;
  399. PMIB_GET pfnMibGetEntry;
  400. PMIB_SET pfnMibSetEntry;
  401. PMIB_GET_FIRST pfnMibGetFirstEntry;
  402. PMIB_GET_NEXT pfnMibGetNextEntry;
  403. PMIB_SET_TRAP_INFO pfnMibSetTrapInfo;
  404. PMIB_GET_TRAP_INFO pfnMibGetTrapInfo;
  405. }MPR40_ROUTING_CHARACTERISTICS;
  406. typedef struct _MPR50_ROUTING_CHARACTERISTICS
  407. {
  408. #ifdef __cplusplus
  409. MPR40_ROUTING_CHARACTERISTICS mrcMpr40Chars;
  410. #else
  411. MPR40_ROUTING_CHARACTERISTICS;
  412. #endif
  413. PCONNECT_CLIENT pfnConnectClient;
  414. PDISCONNECT_CLIENT pfnDisconnectClient;
  415. PGET_NEIGHBORS pfnGetNeighbors;
  416. PGET_MFE_STATUS pfnGetMfeStatus;
  417. }MPR50_ROUTING_CHARACTERISTICS;
  418. #if MPR50
  419. typedef MPR50_ROUTING_CHARACTERISTICS MPR_ROUTING_CHARACTERISTICS;
  420. #else
  421. #if MPR40
  422. typedef MPR40_ROUTING_CHARACTERISTICS MPR_ROUTING_CHARACTERISTICS;
  423. #endif
  424. #endif
  425. typedef MPR_ROUTING_CHARACTERISTICS *PMPR_ROUTING_CHARACTERISTICS;
  426. //
  427. // All routing protocols must export the following entry point.
  428. // The router manager calls this function to allow the routing
  429. // protocol to register
  430. //
  431. #define REGISTER_PROTOCOL_ENTRY_POINT RegisterProtocol
  432. #define REGISTER_PROTOCOL_ENTRY_POINT_STRING "RegisterProtocol"
  433. typedef
  434. DWORD
  435. (WINAPI * PREGISTER_PROTOCOL) (
  436. IN OUT PMPR_ROUTING_CHARACTERISTICS pRoutingChar,
  437. IN OUT PMPR_SERVICE_CHARACTERISTICS pServiceChar
  438. );
  439. #ifdef __cplusplus
  440. }
  441. #endif
  442. #pragma warning(default:4201)
  443. #endif //__ROUTING_ROUTPROT_H__