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.

1215 lines
34 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. rtmv2.h
  5. Abstract:
  6. Interface for Routing Table Manager v2 DLL
  7. Author:
  8. Chaitanya Kodeboyina (chaitk) 01-Jun-1998
  9. Revision History:
  10. --*/
  11. #ifndef __ROUTING_RTMv2_H__
  12. #define __ROUTING_RTMv2_H__
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. //
  18. // General Constants defined by the API
  19. //
  20. // Max addr size for an address family
  21. #define RTM_MAX_ADDRESS_SIZE 16
  22. //
  23. // Supported Route Table Views
  24. //
  25. #define RTM_MAX_VIEWS 32
  26. #define RTM_VIEW_ID_UCAST 0
  27. #define RTM_VIEW_ID_MCAST 1
  28. #define RTM_VIEW_MASK_SIZE 0x20
  29. #define RTM_VIEW_MASK_NONE 0x00000000
  30. #define RTM_VIEW_MASK_ANY 0x00000000
  31. #define RTM_VIEW_MASK_UCAST 0x00000001
  32. #define RTM_VIEW_MASK_MCAST 0x00000002
  33. #define RTM_VIEW_MASK_ALL 0xFFFFFFFF
  34. // Identifies a particular view
  35. typedef INT RTM_VIEW_ID, *PRTM_VIEW_ID;
  36. // Set of views expressed as a mask
  37. typedef DWORD RTM_VIEW_SET, *PRTM_VIEW_SET;
  38. //
  39. // Profile returned during registration
  40. //
  41. typedef struct _RTM_REGN_PROFILE
  42. {
  43. UINT MaxNextHopsInRoute; // Max. number of equal cost nexthops
  44. // in a route, & Max. number of local
  45. // nexthops in any one remote nexthop
  46. UINT MaxHandlesInEnum; // Max. handles returned in one call to
  47. // RtmGetEnumDests, RtmGetChangedDests,
  48. // RtmGetEnumRoutes,RtmGetRoutesInElist
  49. RTM_VIEW_SET ViewsSupported; // Views supported by this addr family
  50. UINT NumberOfViews; // Number of views (# 1s in above mask)
  51. }
  52. RTM_REGN_PROFILE, *PRTM_REGN_PROFILE;
  53. //
  54. // Handles pointing to RTMv2 blocks
  55. //
  56. typedef HANDLE RTM_ENTITY_HANDLE,
  57. *PRTM_ENTITY_HANDLE,
  58. RTM_DEST_HANDLE,
  59. *PRTM_DEST_HANDLE,
  60. RTM_ROUTE_HANDLE,
  61. *PRTM_ROUTE_HANDLE,
  62. RTM_NEXTHOP_HANDLE,
  63. *PRTM_NEXTHOP_HANDLE,
  64. RTM_ENUM_HANDLE,
  65. *PRTM_ENUM_HANDLE,
  66. RTM_ROUTE_LIST_HANDLE,
  67. *PRTM_ROUTE_LIST_HANDLE,
  68. RTM_NOTIFY_HANDLE,
  69. *PRTM_NOTIFY_HANDLE;
  70. //
  71. // Network Address struct for any
  72. // address family that works with
  73. // only contiguous address masks
  74. //
  75. typedef struct _RTM_NET_ADDRESS
  76. {
  77. USHORT AddressFamily; // Type of this net address (IPv4..)
  78. USHORT NumBits; // Number of leading bits in prefix
  79. UCHAR AddrBits[RTM_MAX_ADDRESS_SIZE]; // Array of bits that form prefix
  80. }
  81. RTM_NET_ADDRESS, *PRTM_NET_ADDRESS;
  82. //
  83. // IPv4 macros to work on addresses
  84. //
  85. #define RTM_IPV4_MAKE_NET_ADDRESS(NetAddress, Addr, Len) \
  86. RTM_IPV4_SET_ADDR_AND_LEN(NetAddress, Addr, Len)
  87. #define RTM_CHECK_NTH_BIT(Value, N, Len) \
  88. if ((Value) & (1 << (N))) \
  89. { \
  90. (Len) += (N); (Value) <<= (N); \
  91. } \
  92. #define RTM_IPV4_LEN_FROM_MASK(Len, Mask) \
  93. { \
  94. ULONG _Temp_ = ntohl(Mask); \
  95. \
  96. (Len) = 0; \
  97. \
  98. RTM_CHECK_NTH_BIT(_Temp_, 16, (Len)); \
  99. RTM_CHECK_NTH_BIT(_Temp_, 8, (Len)); \
  100. RTM_CHECK_NTH_BIT(_Temp_, 4, (Len)); \
  101. \
  102. while (_Temp_) \
  103. { \
  104. (Len) += 1; _Temp_ <<= 1; \
  105. } \
  106. } \
  107. #define RTM_IPV4_MASK_FROM_LEN(Len) \
  108. ((Len) ? htonl(~0 << (32 - (Len))): 0); \
  109. #define RTM_IPV4_SET_ADDR_AND_LEN(NetAddress, Addr, Len) \
  110. (NetAddress)->AddressFamily = AF_INET; \
  111. (NetAddress)->NumBits = (USHORT) (Len); \
  112. (* (ULONG *) ((NetAddress)->AddrBits)) = (Addr); \
  113. #define RTM_IPV4_GET_ADDR_AND_LEN(Addr, Len, NetAddress) \
  114. (Len) = (NetAddress)->NumBits; \
  115. (Addr) = (* (ULONG *) ((NetAddress)->AddrBits)); \
  116. #define RTM_IPV4_SET_ADDR_AND_MASK(NetAddress, Addr, Mask) \
  117. (NetAddress)->AddressFamily = AF_INET; \
  118. (* (ULONG *) ((NetAddress)->AddrBits)) = (Addr); \
  119. RTM_IPV4_LEN_FROM_MASK((NetAddress)->NumBits, Mask)
  120. #define RTM_IPV4_GET_ADDR_AND_MASK(Addr, Mask, NetAddress) \
  121. (Addr) = (* (ULONG *) ((NetAddress)->AddrBits)); \
  122. (Mask) = RTM_IPV4_MASK_FROM_LEN((NetAddress)->NumBits); \
  123. //
  124. // This structure encapsulates info
  125. // used in comparing any two routes
  126. // [Preference is impt than metric]
  127. //
  128. typedef struct _RTM_PREF_INFO
  129. {
  130. ULONG Metric; // Routing protocol specific metric
  131. ULONG Preference; // Determined by the router policy
  132. }
  133. RTM_PREF_INFO, *PRTM_PREF_INFO;
  134. //
  135. // List of nexthops used for equal
  136. // cost path in a route or nexthop
  137. //
  138. typedef struct _RTM_NEXTHOP_LIST
  139. {
  140. USHORT NumNextHops; // Num of equal cost next hops in list
  141. RTM_NEXTHOP_HANDLE NextHops[1]; // NumNextHops num of next hop handles
  142. }
  143. RTM_NEXTHOP_LIST, *PRTM_NEXTHOP_LIST;
  144. //
  145. // Structure used to exchange dest
  146. // information with RTM entities
  147. //
  148. typedef struct _RTM_DEST_INFO
  149. {
  150. RTM_DEST_HANDLE DestHandle; // Handle to the destination
  151. RTM_NET_ADDRESS DestAddress; // Destination network Address
  152. FILETIME LastChanged; // Last time dest was modified
  153. RTM_VIEW_SET BelongsToViews; // View that dest belongs too
  154. UINT NumberOfViews; // Number of view info slots
  155. struct
  156. {
  157. RTM_VIEW_ID ViewId; // View ID for this view info block
  158. UINT NumRoutes; // Number of routes,
  159. RTM_ROUTE_HANDLE Route; // Best route with matching criteria
  160. RTM_ENTITY_HANDLE Owner; // Best Route's Owner,
  161. DWORD DestFlags; // Best Route's Flags, and
  162. RTM_ROUTE_HANDLE HoldRoute; // Holddown route,
  163. } ViewInfo[1]; // in each one of the supported views
  164. }
  165. RTM_DEST_INFO, *PRTM_DEST_INFO;
  166. //
  167. // Macros useful in working on dests
  168. //
  169. #define RTM_BASIC_DEST_INFO_SIZE \
  170. FIELD_OFFSET(RTM_DEST_INFO, ViewInfo)
  171. #define RTM_DEST_VIEW_INFO_SIZE \
  172. (sizeof(RTM_DEST_INFO) - RTM_BASIC_DEST_INFO_SIZE)
  173. #define RTM_SIZE_OF_DEST_INFO(NumViews) \
  174. (RTM_BASIC_DEST_INFO_SIZE + (NumViews) * RTM_DEST_VIEW_INFO_SIZE)
  175. //
  176. // Destination Flags
  177. //
  178. #define RTM_DEST_FLAG_NATURAL_NET 0x01
  179. #define RTM_DEST_FLAG_FWD_ENGIN_ADD 0x02
  180. #define RTM_DEST_FLAG_DONT_FORWARD 0x04
  181. //
  182. // Structure used to exchange route
  183. // information with RTM entities
  184. //
  185. typedef struct _RTM_ROUTE_INFO
  186. {
  187. //
  188. // Information that the owner can
  189. // directly access for read only
  190. //
  191. RTM_DEST_HANDLE DestHandle; // Handle to owning destination
  192. RTM_ENTITY_HANDLE RouteOwner; // Entity the owns this route
  193. RTM_NEXTHOP_HANDLE Neighbour; // Neighbour we learnt route from
  194. UCHAR State; // See RTM_ROUTE_STATE_* below
  195. //
  196. // Information that the owner can
  197. // directly access for read/write
  198. //
  199. UCHAR Flags1; // RTM v1 compatibility flags (temp)
  200. USHORT Flags; // See RTM_ROUTE_FLAGS_* below
  201. RTM_PREF_INFO PrefInfo; // Preference and metric for route
  202. RTM_VIEW_SET BelongsToViews; // Views that route belongs to
  203. PVOID EntitySpecificInfo; // Owning Entity's private info
  204. RTM_NEXTHOP_LIST NextHopsList; // List of equal cost next-hops
  205. }
  206. RTM_ROUTE_INFO, *PRTM_ROUTE_INFO;
  207. //
  208. // Macros useful in working on routes
  209. //
  210. #define RTM_BASIC_ROUTE_INFO_SIZE \
  211. FIELD_OFFSET(RTM_ROUTE_INFO, NextHopsList.NumNextHops)
  212. #define RTM_SIZE_OF_ROUTE_INFO(NumHops) \
  213. (RTM_BASIC_ROUTE_INFO_SIZE + (NumHops) * sizeof(RTM_NEXTHOP_HANDLE))
  214. //
  215. // State of the Route
  216. //
  217. #define RTM_ROUTE_STATE_CREATED 0
  218. #define RTM_ROUTE_STATE_DELETING 1
  219. #define RTM_ROUTE_STATE_DELETED 2
  220. //
  221. // Route Information Flags
  222. //
  223. // Forwarding Flags
  224. #define RTM_ROUTE_FLAGS_MARTIAN 0x0001
  225. #define RTM_ROUTE_FLAGS_BLACKHOLE 0x0002
  226. #define RTM_ROUTE_FLAGS_DISCARD 0x0004
  227. #define RTM_ROUTE_FLAGS_INACTIVE 0x0008
  228. // Unicast Flags
  229. #define RTM_ROUTE_FLAGS_LOCAL 0x0010
  230. #define RTM_ROUTE_FLAGS_REMOTE 0x0020
  231. #define RTM_ROUTE_FLAGS_MYSELF 0x0040
  232. #define RTM_ROUTE_FLAGS_LOOPBACK 0x0080
  233. // Bcast, Mcast Flags
  234. #define RTM_ROUTE_FLAGS_MCAST 0x0100
  235. #define RTM_ROUTE_FLAGS_LOCAL_MCAST 0x0200
  236. #define RTM_ROUTE_FLAGS_LIMITED_BC 0x0400
  237. #define RTM_ROUTE_FLAGS_ZEROS_NETBC 0x1000
  238. #define RTM_ROUTE_FLAGS_ZEROS_SUBNETBC 0x2000
  239. #define RTM_ROUTE_FLAGS_ONES_NETBC 0x4000
  240. #define RTM_ROUTE_FLAGS_ONES_SUBNETBC 0x8000
  241. // Grouping of Flags
  242. #define RTM_ROUTE_FLAGS_FORWARDING \
  243. (RTM_ROUTE_FLAGS_MARTIAN | \
  244. RTM_ROUTE_FLAGS_BLACKHOLE | \
  245. RTM_ROUTE_FLAGS_DISCARD | \
  246. RTM_ROUTE_FLAGS_INACTIVE)
  247. #define RTM_ROUTE_FLAGS_ANY_UNICAST \
  248. (RTM_ROUTE_FLAGS_LOCAL | \
  249. RTM_ROUTE_FLAGS_REMOTE | \
  250. RTM_ROUTE_FLAGS_MYSELF)
  251. #define RTM_ROUTE_FLAGS_ANY_MCAST \
  252. (RTM_ROUTE_FLAGS_MCAST | \
  253. RTM_ROUTE_FLAGS_LOCAL_MCAST)
  254. #define RTM_ROUTE_FLAGS_SUBNET_BCAST \
  255. (RTM_ROUTE_FLAGS_ONES_SUBNET_BC | \
  256. RTM_ROUTE_FLAGS_ZEROS_SUBNETBC)
  257. #define RTM_ROUTE_FLAGS_NET_BCAST \
  258. (RTM_ROUTE_FLAGS_ONES_NETBC | \
  259. RTM_ROUTE_FLAGS_ZEROS_NETBC)
  260. #define RTM_ROUTE_FLAGS_ANY_BCAST \
  261. (RTM_ROUTE_FLAGS_LIMITED_BC | \
  262. RTM_ROUTE_FLAGS_ONES_NETBC | \
  263. RTM_ROUTE_FLAGS_ONES_SUBNET_BC | \
  264. RTM_ROUTE_FLAGS_ZEROS_NETBC | \
  265. RTM_ROUTE_FLAGS_ZEROS_SUBNETBC)
  266. //
  267. // Structure used to exchange next-hop
  268. // information with RTM entities
  269. //
  270. typedef struct _RTM_NEXTHOP_INFO
  271. {
  272. //
  273. // Information that the owner can
  274. // directly access for read only
  275. //
  276. RTM_NET_ADDRESS NextHopAddress; // Net Address for this next hop
  277. RTM_ENTITY_HANDLE NextHopOwner; // Entity that owns this next hop
  278. ULONG InterfaceIndex; // Outgoing interface index
  279. // '0' for a remote nexthop
  280. USHORT State; // See RTM_NEXTHOP_STATE_* below
  281. //
  282. // Information that the owner can
  283. // directly access for read/write
  284. //
  285. USHORT Flags; // See RTM_NEXTHOP_FLAGS_* below
  286. PVOID EntitySpecificInfo; // Owning Entity's private info
  287. RTM_DEST_HANDLE RemoteNextHop; // Handle to dest with nexthop addr
  288. // [ Not used for a local nexthop ]
  289. }
  290. RTM_NEXTHOP_INFO, *PRTM_NEXTHOP_INFO;
  291. //
  292. // Next Hop State
  293. //
  294. #define RTM_NEXTHOP_STATE_CREATED 0
  295. #define RTM_NEXTHOP_STATE_DELETED 1
  296. //
  297. // Next Hop Flags
  298. //
  299. #define RTM_NEXTHOP_FLAGS_REMOTE 0x0001
  300. #define RTM_NEXTHOP_FLAGS_DOWN 0x0002
  301. //
  302. // Entity Registration Related Defns
  303. //
  304. //
  305. // Info that uniquely identifies an entity
  306. //
  307. // Disable warnings for unnamed structs
  308. #if _MSC_VER >= 1200
  309. #pragma warning(push)
  310. #endif
  311. #pragma warning(disable : 4201)
  312. typedef struct _RTM_ENTITY_ID
  313. {
  314. union
  315. {
  316. struct
  317. {
  318. ULONG EntityProtocolId; // Entity's Protocol ID (RIP,OSPF...)
  319. ULONG EntityInstanceId; // Entity's Protocol Instance
  320. };
  321. ULONGLONG EntityId; // Protocol ID and Instance
  322. };
  323. }
  324. RTM_ENTITY_ID, *PRTM_ENTITY_ID;
  325. #if _MSC_VER >= 1200
  326. #pragma warning(pop)
  327. #else
  328. #pragma warning(default : 4201)
  329. #endif
  330. //
  331. // Structure used to exchange entity
  332. // information with RTM entities
  333. //
  334. typedef struct _RTM_ENTITY_INFO
  335. {
  336. USHORT RtmInstanceId; // RTM Instance that it registered with
  337. USHORT AddressFamily; // Entity's Address Family
  338. RTM_ENTITY_ID EntityId; // Uniquely identifies an entity
  339. }
  340. RTM_ENTITY_INFO, *PRTM_ENTITY_INFO;
  341. //
  342. // Event in the RTM involving an entity
  343. //
  344. typedef enum _RTM_EVENT_TYPE
  345. {
  346. RTM_ENTITY_REGISTERED,
  347. RTM_ENTITY_DEREGISTERED,
  348. RTM_ROUTE_EXPIRED,
  349. RTM_CHANGE_NOTIFICATION
  350. }
  351. RTM_EVENT_TYPE, *PRTM_EVENT_TYPE;
  352. //
  353. // Entity event inform callback
  354. //
  355. // Used to inform entities of
  356. // new entities registering,
  357. // or entities deregistering
  358. //
  359. typedef
  360. DWORD
  361. (WINAPI * _EVENT_CALLBACK) (
  362. IN RTM_ENTITY_HANDLE RtmRegHandle, // Callee's Registration Handle
  363. IN RTM_EVENT_TYPE EventType,
  364. IN PVOID Context1,
  365. IN PVOID Context2
  366. );
  367. typedef _EVENT_CALLBACK RTM_EVENT_CALLBACK,
  368. *PRTM_EVENT_CALLBACK;
  369. //
  370. // Methods exported by a registered entity
  371. //
  372. #define METHOD_TYPE_ALL_METHODS 0xFFFFFFFF
  373. #define METHOD_RIP2_NEIGHBOUR_ADDR 0x00000001
  374. #define METHOD_RIP2_OUTBOUND_INTF 0x00000002
  375. #define METHOD_RIP2_ROUTE_TAG 0x00000004
  376. #define METHOD_RIP2_ROUTE_TIMESTAMP 0x00000008
  377. #define METHOD_OSPF_ROUTE_TYPE 0x00000001
  378. #define METHOD_OSPF_ROUTE_METRIC 0x00000002
  379. #define METHOD_OSPF_LSDB_TYPE 0x00000004
  380. #define METHOD_OSPF_ROUTE_TAG 0x00000008
  381. #define METHOD_OSPF_ROUTE_AREA 0x00000010
  382. #define METHOD_OSPF_FWD_ADDRESS 0x00000020
  383. #define METHOD_BGP4_AS_PATH 0x00000001
  384. #define METHOD_BGP4_PEER_ID 0x00000002
  385. #define METHOD_BGP4_PA_ORIGIN 0x00000004
  386. #define METHOD_BGP4_NEXTHOP_ATTR 0x00000008
  387. typedef DWORD RTM_ENTITY_METHOD_TYPE,
  388. *PRTM_ENTITY_METHOD_TYPE;
  389. //
  390. // Generic Input Structure for entity methods
  391. //
  392. typedef struct _RTM_ENTITY_METHOD_INPUT
  393. {
  394. RTM_ENTITY_METHOD_TYPE MethodType; // Type identifying the method
  395. UINT InputSize; // Input Data Size
  396. UCHAR InputData[1]; // Input Data Buffer
  397. }
  398. RTM_ENTITY_METHOD_INPUT, *PRTM_ENTITY_METHOD_INPUT;
  399. //
  400. // Generic Output Structure for entity methods
  401. //
  402. typedef struct _RTM_ENTITY_METHOD_OUTPUT
  403. {
  404. RTM_ENTITY_METHOD_TYPE MethodType; // Type identifying the method
  405. DWORD MethodStatus; // Return Status of method
  406. UINT OutputSize; // Output Data Size
  407. UCHAR OutputData[1]; // Output Data Buffer
  408. }
  409. RTM_ENTITY_METHOD_OUTPUT, *PRTM_ENTITY_METHOD_OUTPUT;
  410. //
  411. // Common prototype for entity methods
  412. //
  413. typedef
  414. VOID
  415. (WINAPI * _ENTITY_METHOD) (
  416. IN RTM_ENTITY_HANDLE CallerHandle,
  417. IN RTM_ENTITY_HANDLE CalleeHandle,
  418. IN RTM_ENTITY_METHOD_INPUT *Input,
  419. OUT RTM_ENTITY_METHOD_OUTPUT *Output
  420. );
  421. typedef _ENTITY_METHOD RTM_ENTITY_EXPORT_METHOD,
  422. *PRTM_ENTITY_EXPORT_METHOD;
  423. //
  424. // Set of exported entity methods
  425. //
  426. typedef struct _RTM_ENTITY_EXPORT_METHODS
  427. {
  428. UINT NumMethods;
  429. RTM_ENTITY_EXPORT_METHOD Methods[1];
  430. }
  431. RTM_ENTITY_EXPORT_METHODS, *PRTM_ENTITY_EXPORT_METHODS;
  432. //
  433. // To toggle method blocking on dests, routes and nexthops
  434. //
  435. #define RTM_RESUME_METHODS 0
  436. #define RTM_BLOCK_METHODS 1
  437. //
  438. // I/O Flags when route is added/updated
  439. //
  440. typedef DWORD RTM_ROUTE_CHANGE_FLAGS,
  441. *PRTM_ROUTE_CHANGE_FLAGS;
  442. #define RTM_ROUTE_CHANGE_FIRST 0x01
  443. #define RTM_ROUTE_CHANGE_NEW 0x02
  444. #define RTM_ROUTE_CHANGE_BEST 0x00010000
  445. //
  446. // Output flags when nexthop is added
  447. //
  448. typedef DWORD RTM_NEXTHOP_CHANGE_FLAGS,
  449. *PRTM_NEXTHOP_CHANGE_FLAGS;
  450. #define RTM_NEXTHOP_CHANGE_NEW 0x01
  451. //
  452. // Definitions relating to RIB queries
  453. //
  454. //
  455. // Flags used to matching routes in RIB
  456. //
  457. typedef DWORD RTM_MATCH_FLAGS,
  458. *PRTM_MATCH_FLAGS;
  459. #define RTM_MATCH_NONE 0x00000000
  460. #define RTM_MATCH_OWNER 0x00000001
  461. #define RTM_MATCH_NEIGHBOUR 0x00000002
  462. #define RTM_MATCH_PREF 0x00000004
  463. #define RTM_MATCH_NEXTHOP 0x00000008
  464. #define RTM_MATCH_INTERFACE 0x00000010
  465. #define RTM_MATCH_FULL 0x0000FFFF
  466. //
  467. // Flags to specify route being queried
  468. //
  469. #define RTM_BEST_PROTOCOL (ULONG) 0
  470. #define RTM_THIS_PROTOCOL (ULONG) ~0
  471. //
  472. // Definitions relating to enumerations
  473. //
  474. typedef DWORD RTM_ENUM_FLAGS,
  475. *PRTM_ENUM_FLAGS;
  476. // Enumeration Flags
  477. #define RTM_ENUM_START 0x00000000
  478. #define RTM_ENUM_NEXT 0x00000001
  479. #define RTM_ENUM_RANGE 0x00000002
  480. #define RTM_ENUM_ALL_DESTS 0x00000000
  481. #define RTM_ENUM_OWN_DESTS 0x01000000
  482. #define RTM_ENUM_ALL_ROUTES 0x00000000
  483. #define RTM_ENUM_OWN_ROUTES 0x00010000
  484. //
  485. // Definitions relating to notifications
  486. //
  487. // Notify Flags is composed as follows -
  488. // (Change Types | Dests) interested in.
  489. typedef DWORD RTM_NOTIFY_FLAGS,
  490. *PRTM_NOTIFY_FLAGS;
  491. // Change Types to notify about
  492. #define RTM_NUM_CHANGE_TYPES 3
  493. #define RTM_CHANGE_TYPE_ALL 0x0001
  494. #define RTM_CHANGE_TYPE_BEST 0x0002
  495. #define RTM_CHANGE_TYPE_FORWARDING 0x0004
  496. // Dests whose changes to notify
  497. #define RTM_NOTIFY_ONLY_MARKED_DESTS 0x00010000
  498. //
  499. // Registration API Prototypes
  500. //
  501. DWORD
  502. WINAPI
  503. RtmRegisterEntity (
  504. IN PRTM_ENTITY_INFO RtmEntityInfo,
  505. IN PRTM_ENTITY_EXPORT_METHODS ExportMethods OPTIONAL,
  506. IN RTM_EVENT_CALLBACK EventCallback,
  507. IN BOOL ReserveOpaquePointer,
  508. OUT PRTM_REGN_PROFILE RtmRegProfile,
  509. OUT PRTM_ENTITY_HANDLE RtmRegHandle
  510. );
  511. DWORD
  512. WINAPI
  513. RtmDeregisterEntity (
  514. IN RTM_ENTITY_HANDLE RtmRegHandle
  515. );
  516. DWORD
  517. WINAPI
  518. RtmGetRegisteredEntities (
  519. IN RTM_ENTITY_HANDLE RtmRegHandle,
  520. IN OUT PUINT NumEntities,
  521. OUT PRTM_ENTITY_HANDLE EntityHandles,
  522. OUT PRTM_ENTITY_INFO EntityInfos OPTIONAL
  523. );
  524. DWORD
  525. WINAPI
  526. RtmReleaseEntities (
  527. IN RTM_ENTITY_HANDLE RtmRegHandle,
  528. IN UINT NumEntities,
  529. IN PRTM_ENTITY_HANDLE EntityHandles
  530. );
  531. //
  532. // Opaque Ptr APIs
  533. //
  534. DWORD
  535. WINAPI
  536. RtmLockDestination(
  537. IN RTM_ENTITY_HANDLE RtmRegHandle,
  538. IN RTM_DEST_HANDLE DestHandle,
  539. IN BOOL Exclusive,
  540. IN BOOL LockDest
  541. );
  542. DWORD
  543. WINAPI
  544. RtmGetOpaqueInformationPointer (
  545. IN RTM_ENTITY_HANDLE RtmRegHandle,
  546. IN RTM_DEST_HANDLE DestHandle,
  547. OUT PVOID *OpaqueInfoPointer
  548. );
  549. //
  550. // Export Method API Prototypes
  551. //
  552. DWORD
  553. WINAPI
  554. RtmGetEntityMethods (
  555. IN RTM_ENTITY_HANDLE RtmRegHandle,
  556. IN RTM_ENTITY_HANDLE EntityHandle,
  557. IN OUT PUINT NumMethods,
  558. OUT PRTM_ENTITY_EXPORT_METHOD ExptMethods
  559. );
  560. DWORD
  561. WINAPI
  562. RtmInvokeMethod (
  563. IN RTM_ENTITY_HANDLE RtmRegHandle,
  564. IN RTM_ENTITY_HANDLE EntityHandle,
  565. IN PRTM_ENTITY_METHOD_INPUT Input,
  566. IN OUT PUINT OutputSize,
  567. OUT PRTM_ENTITY_METHOD_OUTPUT Output
  568. );
  569. DWORD
  570. WINAPI
  571. RtmBlockMethods (
  572. IN RTM_ENTITY_HANDLE RtmRegHandle,
  573. IN HANDLE TargetHandle OPTIONAL,
  574. IN UCHAR TargetType OPTIONAL,
  575. IN DWORD BlockingFlag
  576. );
  577. //
  578. // Handle to Info Structures
  579. //
  580. DWORD
  581. WINAPI
  582. RtmGetEntityInfo (
  583. IN RTM_ENTITY_HANDLE RtmRegHandle,
  584. IN RTM_ENTITY_HANDLE EntityHandle,
  585. OUT PRTM_ENTITY_INFO EntityInfo
  586. );
  587. DWORD
  588. WINAPI
  589. RtmGetDestInfo (
  590. IN RTM_ENTITY_HANDLE RtmRegHandle,
  591. IN RTM_DEST_HANDLE DestHandle,
  592. IN ULONG ProtocolId,
  593. IN RTM_VIEW_SET TargetViews,
  594. OUT PRTM_DEST_INFO DestInfo
  595. );
  596. DWORD
  597. WINAPI
  598. RtmGetRouteInfo (
  599. IN RTM_ENTITY_HANDLE RtmRegHandle,
  600. IN RTM_ROUTE_HANDLE RouteHandle,
  601. OUT PRTM_ROUTE_INFO RouteInfo OPTIONAL,
  602. OUT PRTM_NET_ADDRESS DestAddress OPTIONAL
  603. );
  604. DWORD
  605. WINAPI
  606. RtmGetNextHopInfo (
  607. IN RTM_ENTITY_HANDLE RtmRegHandle,
  608. IN RTM_NEXTHOP_HANDLE NextHopHandle,
  609. OUT PRTM_NEXTHOP_INFO NextHopInfo
  610. );
  611. DWORD
  612. WINAPI
  613. RtmReleaseEntityInfo (
  614. IN RTM_ENTITY_HANDLE RtmRegHandle,
  615. IN PRTM_ENTITY_INFO EntityInfo
  616. );
  617. DWORD
  618. WINAPI
  619. RtmReleaseDestInfo (
  620. IN RTM_ENTITY_HANDLE RtmRegHandle,
  621. IN PRTM_DEST_INFO DestInfo
  622. );
  623. DWORD
  624. WINAPI
  625. RtmReleaseRouteInfo (
  626. IN RTM_ENTITY_HANDLE RtmRegHandle,
  627. IN PRTM_ROUTE_INFO RouteInfo
  628. );
  629. DWORD
  630. WINAPI
  631. RtmReleaseNextHopInfo (
  632. IN RTM_ENTITY_HANDLE RtmRegHandle,
  633. IN PRTM_NEXTHOP_INFO NextHopInfo
  634. );
  635. //
  636. // RIB Insert/Delete API Prototypes
  637. //
  638. DWORD
  639. WINAPI
  640. RtmAddRouteToDest (
  641. IN RTM_ENTITY_HANDLE RtmRegHandle,
  642. IN OUT PRTM_ROUTE_HANDLE RouteHandle OPTIONAL,
  643. IN PRTM_NET_ADDRESS DestAddress,
  644. IN PRTM_ROUTE_INFO RouteInfo,
  645. IN ULONG TimeToLive,
  646. IN RTM_ROUTE_LIST_HANDLE RouteListHandle OPTIONAL,
  647. IN RTM_NOTIFY_FLAGS NotifyType,
  648. IN RTM_NOTIFY_HANDLE NotifyHandle OPTIONAL,
  649. IN OUT PRTM_ROUTE_CHANGE_FLAGS ChangeFlags
  650. );
  651. DWORD
  652. WINAPI
  653. RtmDeleteRouteToDest (
  654. IN RTM_ENTITY_HANDLE RtmRegHandle,
  655. IN RTM_ROUTE_HANDLE RouteHandle,
  656. OUT PRTM_ROUTE_CHANGE_FLAGS ChangeFlags
  657. );
  658. DWORD
  659. WINAPI
  660. RtmHoldDestination (
  661. IN RTM_ENTITY_HANDLE RtmRegHandle,
  662. IN RTM_DEST_HANDLE DestHandle,
  663. IN RTM_VIEW_SET TargetViews,
  664. IN ULONG HoldTime
  665. );
  666. DWORD
  667. WINAPI
  668. RtmGetRoutePointer (
  669. IN RTM_ENTITY_HANDLE RtmRegHandle,
  670. IN RTM_ROUTE_HANDLE RouteHandle,
  671. OUT PRTM_ROUTE_INFO *RoutePointer
  672. );
  673. DWORD
  674. WINAPI
  675. RtmLockRoute(
  676. IN RTM_ENTITY_HANDLE RtmRegHandle,
  677. IN RTM_ROUTE_HANDLE RouteHandle,
  678. IN BOOL Exclusive,
  679. IN BOOL LockRoute,
  680. OUT PRTM_ROUTE_INFO *RoutePointer OPTIONAL
  681. );
  682. DWORD
  683. WINAPI
  684. RtmUpdateAndUnlockRoute(
  685. IN RTM_ENTITY_HANDLE RtmRegHandle,
  686. IN RTM_ROUTE_HANDLE RouteHandle,
  687. IN ULONG TimeToLive,
  688. IN RTM_ROUTE_LIST_HANDLE RouteListHandle OPTIONAL,
  689. IN RTM_NOTIFY_FLAGS NotifyType,
  690. IN RTM_NOTIFY_HANDLE NotifyHandle OPTIONAL,
  691. OUT PRTM_ROUTE_CHANGE_FLAGS ChangeFlags
  692. );
  693. //
  694. // RIB Query API Prototypes
  695. //
  696. DWORD
  697. WINAPI
  698. RtmGetExactMatchDestination (
  699. IN RTM_ENTITY_HANDLE RtmRegHandle,
  700. IN PRTM_NET_ADDRESS DestAddress,
  701. IN ULONG ProtocolId,
  702. IN RTM_VIEW_SET TargetViews,
  703. OUT PRTM_DEST_INFO DestInfo
  704. );
  705. DWORD
  706. WINAPI
  707. RtmGetMostSpecificDestination (
  708. IN RTM_ENTITY_HANDLE RtmRegHandle,
  709. IN PRTM_NET_ADDRESS DestAddress,
  710. IN ULONG ProtocolId,
  711. IN RTM_VIEW_SET TargetViews,
  712. OUT PRTM_DEST_INFO DestInfo
  713. );
  714. DWORD
  715. WINAPI
  716. RtmGetLessSpecificDestination (
  717. IN RTM_ENTITY_HANDLE RtmRegHandle,
  718. IN RTM_DEST_HANDLE DestHandle,
  719. IN ULONG ProtocolId,
  720. IN RTM_VIEW_SET TargetViews,
  721. OUT PRTM_DEST_INFO DestInfo
  722. );
  723. DWORD
  724. WINAPI
  725. RtmGetExactMatchRoute (
  726. IN RTM_ENTITY_HANDLE RtmRegHandle,
  727. IN PRTM_NET_ADDRESS DestAddress,
  728. IN RTM_MATCH_FLAGS MatchingFlags,
  729. IN OUT PRTM_ROUTE_INFO RouteInfo,
  730. IN ULONG InterfaceIndex,
  731. IN RTM_VIEW_SET TargetViews,
  732. OUT PRTM_ROUTE_HANDLE RouteHandle
  733. );
  734. DWORD
  735. WINAPI
  736. RtmIsBestRoute (
  737. IN RTM_ENTITY_HANDLE RtmRegHandle,
  738. IN RTM_ROUTE_HANDLE RouteHandle,
  739. OUT PRTM_VIEW_SET BestInViews
  740. );
  741. //
  742. // NextHop Object API Prototypes
  743. //
  744. DWORD
  745. WINAPI
  746. RtmAddNextHop (
  747. IN RTM_ENTITY_HANDLE RtmRegHandle,
  748. IN PRTM_NEXTHOP_INFO NextHopInfo,
  749. IN OUT PRTM_NEXTHOP_HANDLE NextHopHandle OPTIONAL,
  750. OUT PRTM_NEXTHOP_CHANGE_FLAGS ChangeFlags
  751. );
  752. DWORD
  753. WINAPI
  754. RtmFindNextHop (
  755. IN RTM_ENTITY_HANDLE RtmRegHandle,
  756. IN PRTM_NEXTHOP_INFO NextHopInfo,
  757. OUT PRTM_NEXTHOP_HANDLE NextHopHandle,
  758. OUT PRTM_NEXTHOP_INFO *NextHopPointer OPTIONAL
  759. );
  760. DWORD
  761. WINAPI
  762. RtmDeleteNextHop (
  763. IN RTM_ENTITY_HANDLE RtmRegHandle,
  764. IN RTM_NEXTHOP_HANDLE NextHopHandle OPTIONAL,
  765. IN PRTM_NEXTHOP_INFO NextHopInfo
  766. );
  767. DWORD
  768. WINAPI
  769. RtmGetNextHopPointer (
  770. IN RTM_ENTITY_HANDLE RtmRegHandle,
  771. IN RTM_NEXTHOP_HANDLE NextHopHandle,
  772. OUT PRTM_NEXTHOP_INFO *NextHopPointer
  773. );
  774. DWORD
  775. WINAPI
  776. RtmLockNextHop(
  777. IN RTM_ENTITY_HANDLE RtmRegHandle,
  778. IN RTM_NEXTHOP_HANDLE NextHopHandle,
  779. IN BOOL Exclusive,
  780. IN BOOL LockNextHop,
  781. OUT PRTM_NEXTHOP_INFO *NextHopPointer OPTIONAL
  782. );
  783. //
  784. // Enumeration API Prototypes
  785. //
  786. DWORD
  787. WINAPI
  788. RtmCreateDestEnum (
  789. IN RTM_ENTITY_HANDLE RtmRegHandle,
  790. IN RTM_VIEW_SET TargetViews,
  791. IN RTM_ENUM_FLAGS EnumFlags,
  792. IN PRTM_NET_ADDRESS NetAddress,
  793. IN ULONG ProtocolId,
  794. OUT PRTM_ENUM_HANDLE RtmEnumHandle
  795. );
  796. DWORD
  797. WINAPI
  798. RtmGetEnumDests (
  799. IN RTM_ENTITY_HANDLE RtmRegHandle,
  800. IN RTM_ENUM_HANDLE EnumHandle,
  801. IN OUT PUINT NumDests,
  802. OUT PRTM_DEST_INFO DestInfos
  803. );
  804. DWORD
  805. WINAPI
  806. RtmReleaseDests (
  807. IN RTM_ENTITY_HANDLE RtmRegHandle,
  808. IN UINT NumDests,
  809. IN PRTM_DEST_INFO DestInfos
  810. );
  811. DWORD
  812. WINAPI
  813. RtmCreateRouteEnum (
  814. IN RTM_ENTITY_HANDLE RtmRegHandle,
  815. IN RTM_DEST_HANDLE DestHandle OPTIONAL,
  816. IN RTM_VIEW_SET TargetViews,
  817. IN RTM_ENUM_FLAGS EnumFlags,
  818. IN PRTM_NET_ADDRESS StartDest OPTIONAL,
  819. IN RTM_MATCH_FLAGS MatchingFlags,
  820. IN PRTM_ROUTE_INFO CriteriaRoute OPTIONAL,
  821. IN ULONG CriteriaInterface OPTIONAL,
  822. OUT PRTM_ENUM_HANDLE RtmEnumHandle
  823. );
  824. DWORD
  825. WINAPI
  826. RtmGetEnumRoutes (
  827. IN RTM_ENTITY_HANDLE RtmRegHandle,
  828. IN RTM_ENUM_HANDLE EnumHandle,
  829. IN OUT PUINT NumRoutes,
  830. OUT PRTM_ROUTE_HANDLE RouteHandles
  831. );
  832. DWORD
  833. WINAPI
  834. RtmReleaseRoutes (
  835. IN RTM_ENTITY_HANDLE RtmRegHandle,
  836. IN UINT NumRoutes,
  837. IN PRTM_ROUTE_HANDLE RouteHandles
  838. );
  839. DWORD
  840. WINAPI
  841. RtmCreateNextHopEnum (
  842. IN RTM_ENTITY_HANDLE RtmRegHandle,
  843. IN RTM_ENUM_FLAGS EnumFlags,
  844. IN PRTM_NET_ADDRESS NetAddress,
  845. OUT PRTM_ENUM_HANDLE RtmEnumHandle
  846. );
  847. DWORD
  848. WINAPI
  849. RtmGetEnumNextHops (
  850. IN RTM_ENTITY_HANDLE RtmRegHandle,
  851. IN RTM_ENUM_HANDLE EnumHandle,
  852. IN OUT PUINT NumNextHops,
  853. OUT PRTM_NEXTHOP_HANDLE NextHopHandles
  854. );
  855. DWORD
  856. WINAPI
  857. RtmReleaseNextHops (
  858. IN RTM_ENTITY_HANDLE RtmRegHandle,
  859. IN UINT NumNextHops,
  860. IN PRTM_NEXTHOP_HANDLE NextHopHandles
  861. );
  862. DWORD
  863. WINAPI
  864. RtmDeleteEnumHandle (
  865. IN RTM_ENTITY_HANDLE RtmRegHandle,
  866. IN RTM_ENUM_HANDLE EnumHandle
  867. );
  868. //
  869. // Change Notification APIs
  870. //
  871. DWORD
  872. WINAPI
  873. RtmRegisterForChangeNotification (
  874. IN RTM_ENTITY_HANDLE RtmRegHandle,
  875. IN RTM_VIEW_SET TargetViews,
  876. IN RTM_NOTIFY_FLAGS NotifyFlags,
  877. IN PVOID NotifyContext,
  878. OUT PRTM_NOTIFY_HANDLE NotifyHandle
  879. );
  880. DWORD
  881. WINAPI
  882. RtmGetChangedDests (
  883. IN RTM_ENTITY_HANDLE RtmRegHandle,
  884. IN RTM_NOTIFY_HANDLE NotifyHandle,
  885. IN OUT PUINT NumDests,
  886. OUT PRTM_DEST_INFO ChangedDests
  887. );
  888. DWORD
  889. WINAPI
  890. RtmReleaseChangedDests (
  891. IN RTM_ENTITY_HANDLE RtmRegHandle,
  892. IN RTM_NOTIFY_HANDLE NotifyHandle,
  893. IN UINT NumDests,
  894. IN PRTM_DEST_INFO ChangedDests
  895. );
  896. DWORD
  897. WINAPI
  898. RtmIgnoreChangedDests (
  899. IN RTM_ENTITY_HANDLE RtmRegHandle,
  900. IN RTM_NOTIFY_HANDLE NotifyHandle,
  901. IN UINT NumDests,
  902. IN PRTM_DEST_HANDLE ChangedDests
  903. );
  904. DWORD
  905. WINAPI
  906. RtmGetChangeStatus (
  907. IN RTM_ENTITY_HANDLE RtmRegHandle,
  908. IN RTM_NOTIFY_HANDLE NotifyHandle,
  909. IN RTM_DEST_HANDLE DestHandle,
  910. OUT PBOOL ChangeStatus
  911. );
  912. DWORD
  913. WINAPI
  914. RtmMarkDestForChangeNotification (
  915. IN RTM_ENTITY_HANDLE RtmRegHandle,
  916. IN RTM_NOTIFY_HANDLE NotifyHandle,
  917. IN RTM_DEST_HANDLE DestHandle,
  918. IN BOOL MarkDest
  919. );
  920. DWORD
  921. WINAPI
  922. RtmIsMarkedForChangeNotification (
  923. IN RTM_ENTITY_HANDLE RtmRegHandle,
  924. IN RTM_NOTIFY_HANDLE NotifyHandle,
  925. IN RTM_DEST_HANDLE DestHandle,
  926. OUT PBOOL DestMarked
  927. );
  928. DWORD
  929. WINAPI
  930. RtmDeregisterFromChangeNotification (
  931. IN RTM_ENTITY_HANDLE RtmRegHandle,
  932. IN RTM_NOTIFY_HANDLE NotifyHandle
  933. );
  934. //
  935. // Entity Specific List APIs
  936. //
  937. DWORD
  938. WINAPI
  939. RtmCreateRouteList (
  940. IN RTM_ENTITY_HANDLE RtmRegHandle,
  941. OUT PRTM_ROUTE_LIST_HANDLE RouteListHandle
  942. );
  943. DWORD
  944. WINAPI
  945. RtmInsertInRouteList (
  946. IN RTM_ENTITY_HANDLE RtmRegHandle,
  947. IN RTM_ROUTE_LIST_HANDLE RouteListHandle OPTIONAL,
  948. IN UINT NumRoutes,
  949. IN PRTM_ROUTE_HANDLE RouteHandles
  950. );
  951. DWORD
  952. WINAPI
  953. RtmCreateRouteListEnum (
  954. IN RTM_ENTITY_HANDLE RtmRegHandle,
  955. IN RTM_ROUTE_LIST_HANDLE RouteListHandle,
  956. OUT PRTM_ENUM_HANDLE RtmEnumHandle
  957. );
  958. DWORD
  959. WINAPI
  960. RtmGetListEnumRoutes (
  961. IN RTM_ENTITY_HANDLE RtmRegHandle,
  962. IN RTM_ENUM_HANDLE EnumHandle,
  963. IN OUT PUINT NumRoutes,
  964. OUT PRTM_ROUTE_HANDLE RouteHandles
  965. );
  966. DWORD
  967. WINAPI
  968. RtmDeleteRouteList (
  969. IN RTM_ENTITY_HANDLE RtmRegHandle,
  970. IN RTM_ROUTE_LIST_HANDLE RouteListHandle
  971. );
  972. //
  973. // Handle Management APIs
  974. //
  975. DWORD
  976. WINAPI
  977. RtmReferenceHandles (
  978. IN RTM_ENTITY_HANDLE RtmRegHandle,
  979. IN UINT NumHandles,
  980. IN HANDLE *RtmHandles
  981. );
  982. #ifdef __cplusplus
  983. }
  984. #endif
  985. #endif //__ROUTING_RTMv2_H__