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.

824 lines
28 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. rtm.h
  5. Abstract:
  6. Interface for Routing Table Manager DLL
  7. --*/
  8. #ifndef __ROUTING_RTM_H__
  9. #define __ROUTING_RTM_H__
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #if _MSC_VER >= 1200
  14. #pragma warning(push)
  15. #endif
  16. #pragma warning(disable:4201)
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. // Currently supported protocol families
  21. #define RTM_PROTOCOL_FAMILY_IPX 0
  22. #define RTM_PROTOCOL_FAMILY_IP 1
  23. // Error messages specific to Routing Table Manager
  24. #define ERROR_MORE_MESSAGES ERROR_MORE_DATA
  25. #define ERROR_CLIENT_ALREADY_EXISTS ERROR_ALREADY_EXISTS
  26. #define ERROR_NO_MESSAGES ERROR_NO_MORE_ITEMS
  27. #define ERROR_NO_MORE_ROUTES ERROR_NO_MORE_ITEMS
  28. #define ERROR_NO_ROUTES ERROR_NO_MORE_ITEMS
  29. #define ERROR_NO_SUCH_ROUTE ERROR_NO_MORE_ITEMS
  30. // Protocol family dependent network number structures
  31. typedef struct _IPX_NETWORK {
  32. DWORD N_NetNumber;
  33. } IPX_NETWORK, *PIPX_NETWORK;
  34. typedef struct _IP_NETWORK {
  35. DWORD N_NetNumber;
  36. DWORD N_NetMask;
  37. } IP_NETWORK, *PIP_NETWORK;
  38. // Protocol family dependent next hop router address structures
  39. typedef struct _IPX_NEXT_HOP_ADDRESS {
  40. BYTE NHA_Mac[6];
  41. } IPX_NEXT_HOP_ADDRESS, *PIPX_NEXT_HOP_ADDRESS;
  42. typedef IP_NETWORK IP_NEXT_HOP_ADDRESS, *PIP_NEXT_HOP_ADDRESS;
  43. // Protocol family dependent specific data structures
  44. typedef struct _IPX_SPECIFIC_DATA {
  45. DWORD FSD_Flags; // should be set to 0 if no flags are defined
  46. USHORT FSD_TickCount; // ticks to destination network
  47. USHORT FSD_HopCount; // hops to destination network
  48. } IPX_SPECIFIC_DATA, *PIPX_SPECIFIC_DATA;
  49. // The following flags are defined for the IPX family dependent Flags field
  50. #define IPX_GLOBAL_CLIENT_WAN_ROUTE 0x00000001
  51. typedef struct _IP_SPECIFIC_DATA
  52. {
  53. DWORD FSD_Type; // One of : other,invalid,local,remote (1-4)
  54. DWORD FSD_Policy; // See RFC 1354
  55. DWORD FSD_NextHopAS; // Autonomous System Number of Next Hop
  56. DWORD FSD_Priority; // For comparing Inter Protocol Metrics
  57. DWORD FSD_Metric; // For comparing Intra Protocol Metrics
  58. DWORD FSD_Metric1; // Protocol specific metrics for MIB II
  59. DWORD FSD_Metric2; // conformance. MIB II agents will not
  60. DWORD FSD_Metric3; // display FSD_Metric, they will only
  61. DWORD FSD_Metric4; // display Metrics1-5, so if you want your
  62. DWORD FSD_Metric5; // metric displayed, put it in one of these
  63. // fields ALSO (It has to be in the
  64. // FSD_Metric field always). It is up to the
  65. // implementor to keep the fields consistent
  66. DWORD FSD_Flags; // Flags defined below
  67. } IP_SPECIFIC_DATA, *PIP_SPECIFIC_DATA;
  68. //
  69. // All routing protocols MUST clear out the FSD_Flags field.
  70. // If RTM notifies a protocol of a route and that route is marked
  71. // invalid, the protocols MUST disregard this route. A protocol
  72. // may mark a route as invalid, if it does not want the route to
  73. // be indicated to other protocols or set to the stack. e.g. RIPv2
  74. // marks summarized routes as INVALID and uses the RTM purely as
  75. // a store for such routes. These routes are not considered when
  76. // comparing metrics etc to decide the "best" route
  77. //
  78. #define IP_VALID_ROUTE 0x00000001
  79. #define ClearRouteFlags(pRoute) \
  80. ((pRoute)->RR_FamilySpecificData.FSD_Flags = 0x00000000)
  81. #define IsRouteValid(pRoute) \
  82. ((pRoute)->RR_FamilySpecificData.FSD_Flags & IP_VALID_ROUTE)
  83. #define SetRouteValid(pRoute) \
  84. ((pRoute)->RR_FamilySpecificData.FSD_Flags |= IP_VALID_ROUTE)
  85. #define ClearRouteValid(pRoute) \
  86. ((pRoute)->RR_FamilySpecificData.FSD_Flags &= ~IP_VALID_ROUTE)
  87. #define IsRouteNonUnicast(pRoute) \
  88. (((DWORD)((pRoute)->RR_Network.N_NetNumber & 0x000000FF)) >= ((DWORD)0x000000E0))
  89. #define IsRouteLoopback(pRoute) \
  90. ((((pRoute)->RR_Network.N_NetNumber & 0x000000FF) == 0x0000007F) || \
  91. ((pRoute)->RR_NextHopAddress.N_NetNumber == 0x0100007F))
  92. // Protocol dependent specific data structure
  93. typedef struct _PROTOCOL_SPECIFIC_DATA {
  94. DWORD PSD_Data[4];
  95. } PROTOCOL_SPECIFIC_DATA, *PPROTOCOL_SPECIFIC_DATA;
  96. #define DWORD_ALIGN(type,field) \
  97. union { \
  98. type field; \
  99. DWORD field##Align; \
  100. }
  101. // Standard header associated with all types of routes
  102. #define ROUTE_HEADER \
  103. DWORD_ALIGN ( \
  104. FILETIME, RR_TimeStamp); \
  105. DWORD RR_RoutingProtocol; \
  106. DWORD RR_InterfaceID; \
  107. DWORD_ALIGN ( \
  108. PROTOCOL_SPECIFIC_DATA, RR_ProtocolSpecificData)
  109. // Ensure dword aligment of all fields
  110. // Protocol family dependent route entries
  111. // (intended for use by protocol handlers to pass paramerters
  112. // to and from RTM routines)
  113. typedef struct _RTM_IPX_ROUTE {
  114. ROUTE_HEADER;
  115. DWORD_ALIGN (
  116. IPX_NETWORK, RR_Network);
  117. DWORD_ALIGN (
  118. IPX_NEXT_HOP_ADDRESS, RR_NextHopAddress);
  119. DWORD_ALIGN (
  120. IPX_SPECIFIC_DATA, RR_FamilySpecificData);
  121. } RTM_IPX_ROUTE, *PRTM_IPX_ROUTE;
  122. typedef struct _RTM_IP_ROUTE {
  123. ROUTE_HEADER;
  124. DWORD_ALIGN (
  125. IP_NETWORK, RR_Network);
  126. DWORD_ALIGN (
  127. IP_NEXT_HOP_ADDRESS, RR_NextHopAddress);
  128. DWORD_ALIGN (
  129. IP_SPECIFIC_DATA, RR_FamilySpecificData);
  130. } RTM_IP_ROUTE, *PRTM_IP_ROUTE;
  131. // RTM route change message flags
  132. // Flags to test the presence of route change information
  133. // in the buffers filled by RTM routines
  134. #define RTM_CURRENT_BEST_ROUTE 0x00000001
  135. #define RTM_PREVIOUS_BEST_ROUTE 0x00000002
  136. // Flags that convey what acutally happened
  137. #define RTM_NO_CHANGE 0
  138. #define RTM_ROUTE_ADDED RTM_CURRENT_BEST_ROUTE
  139. #define RTM_ROUTE_DELETED RTM_PREVIOUS_BEST_ROUTE
  140. #define RTM_ROUTE_CHANGED (RTM_CURRENT_BEST_ROUTE|RTM_PREVIOUS_BEST_ROUTE)
  141. // Enumeration flags limit that enumerations of routes in the table
  142. // to only entries with the specified field(s)
  143. #define RTM_ONLY_THIS_NETWORK 0x00000001
  144. #define RTM_ONLY_THIS_INTERFACE 0x00000002
  145. #define RTM_ONLY_THIS_PROTOCOL 0x00000004
  146. #define RTM_ONLY_BEST_ROUTES 0x00000008
  147. #define RTM_PROTOCOL_SINGLE_ROUTE 0x00000001
  148. /*++
  149. *******************************************************************
  150. R t m R e g i s t e r C l i e n t
  151. Routine Description:
  152. Registers client as a handler of specified protocol.
  153. Establishes route change notification mechanism for the client
  154. Arguments:
  155. ProtocolFamily - protocol family of the routing protocol to register
  156. RoutingProtocol - which routing protocol is handled by the client
  157. ChangeEvent - this event will be signalled when best route to any
  158. network in the table changes
  159. Flags - flags that enable special features applied to routes maintained
  160. by the protocol:
  161. RTM_PROTOCOL_SINGLE_ROUTE - RTM will only keep
  162. one route per destination network for the protocol
  163. Return Value:
  164. Handle to be used to identify the client in calls made to Rtm
  165. NULL - operation failed, call GetLastError() to get reason of
  166. failure:
  167. ERROR_INVALID_PARAMETER - specified protocol family is not supported
  168. ERROR_CLIENT_ALREADY_EXISTS - another client already registered
  169. to handle specified protocol
  170. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the opertaion,
  171. try again later
  172. ERROR_NOT_ENOUGH_MEMORY - not enough memory to allocate client
  173. control block
  174. *******************************************************************
  175. --*/
  176. HANDLE WINAPI
  177. RtmRegisterClient (
  178. IN DWORD ProtocolFamily,
  179. IN DWORD RoutingProtocol,
  180. IN HANDLE ChangeEvent OPTIONAL,
  181. IN DWORD Flags
  182. );
  183. /*++
  184. *******************************************************************
  185. R t m D e r e g i s t e r C l i e n t
  186. Routine Description:
  187. Deregister client and frees associated resources (including all
  188. routes added by the client).
  189. Arguments:
  190. ClientHandle - handle that identifies the client to deregister from RTM
  191. Return Value:
  192. NO_ERROR - client was deregisterd and resources were disposed OK.
  193. ERROR_INVALID_HANDLE - client handle is not a valid RTM handle
  194. ERROR_NO_SYSTEM_RESOURCES - not enough resources to complete the operation,
  195. try again later
  196. *******************************************************************
  197. --*/
  198. DWORD WINAPI
  199. RtmDeregisterClient (
  200. IN HANDLE ClientHandle
  201. );
  202. /*++
  203. *******************************************************************
  204. R t m D e q u e u e R o u t e C h a n g e M e s s a g e
  205. Routine Description:
  206. Dequeues and returns first route change message from the queue
  207. associated with the client
  208. Arguments:
  209. ClientHandle - handle that identifies the client for which the opertation
  210. is performed
  211. Flags - identifies what kind of change the message is about and what
  212. information was palced into the provided buffers:
  213. RTM_ROUTE_ADDED - first route was added for a destination network,
  214. CurBestRoute is filled with added route info
  215. RTM_ROUTE_DELETED - the only route available for a destination
  216. network was deleted, PrevBestRoute is filled
  217. with deleted route info
  218. RTM_ROUTE_CHANGED - there was a change in any of the following
  219. parameters of the BEST route to a destination
  220. network:
  221. RoutingProtocol,
  222. InterfaceID,
  223. Metric,
  224. NextHopAddress,
  225. FamilySpecificData.
  226. PrevBestRoute contains the route info as it was
  227. before the change, CurBestRoute contains current
  228. best route info.
  229. Note that the route change message can be generated
  230. both as result of protocol adding/deleting the route
  231. that becomes/was the best and changing best route parameters
  232. such that route becomes/no longer is the best route.
  233. CurBestRoute - buffer to receive current best route info (if any)
  234. PrevBestRoute - buffer to receive previous best route info (if any)
  235. Return Value:
  236. NO_ERROR - this was the last (or only) message in the client's
  237. queue (event is reset)
  238. ERROR_MORE_MESSAGES - there are more messages awaiting client,
  239. this call should be made again as soon as possible
  240. to let RTM free resources associated with unprocessed
  241. messages
  242. ERROR_NO_MESSAGES - there are no messages in the clients queue,
  243. this was an unsolicited call (event is reset)
  244. ERROR_INVALID_HANDLE - client handle is not a valid RTM handle
  245. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  246. try again later
  247. *******************************************************************
  248. --*/
  249. DWORD WINAPI
  250. RtmDequeueRouteChangeMessage (
  251. IN HANDLE ClientHandle,
  252. OUT DWORD *Flags,
  253. OUT PVOID CurBestRoute OPTIONAL,
  254. OUT PVOID PrevBestRoute OPTIONAL
  255. );
  256. /*++
  257. *******************************************************************
  258. R t m A d d R o u t e
  259. Routine Description:
  260. Adds or updates existing route entry and generates route change
  261. message if best route to a destination network has changed as the
  262. result of this operation.
  263. Note that route change message is not sent to the client that
  264. makes this change, but rather relevant information is returned
  265. by this routine directly.
  266. Arguments:
  267. ClientHandle - handle that identifies the client for which the opertation
  268. is performed, it also supplies RoutingProtocol field
  269. of the new/updated route
  270. Route - route to be added/updated.
  271. The following fields of protocol family dependent
  272. RTM_??_ROUTE structure are used to construct/update
  273. route entry:
  274. RR_Network: destination network
  275. RR_InterfaceID: id of interface through which route was received
  276. RR_NextHopAddress: address of next hop router
  277. RR_FamilySpecificData: data specific to protocol's family
  278. RR_ProtocolSpecificData: data specific to protocol which supplies the
  279. route (subject to size limitation defined by
  280. PROTOCOL_SPECIFIC_DATA structure above)
  281. RR_TimeStamp: current time, which is actually read from system
  282. timer (need not be supplied)
  283. Note that combination of
  284. RoutingProtocol,
  285. Network,
  286. InterfaceID, and
  287. NextHopAddress
  288. uniquely identifies route entry in the table.
  289. New entry is created if one of these fields does not match those of
  290. an existing entry, otherwise existing entry is changed (see also
  291. ReplaceEntry flag below).
  292. Regardless of whether new entry is created or old one is updated,
  293. this operation will generate a route change message if affected
  294. route becomes/is/no longer is the best route to a destination network
  295. and at least one of the following parameters in the best route is
  296. changed as the result of this operation:
  297. RoutingProtocol,
  298. InterfaceID,
  299. NextHopAddress,
  300. FamilySpecificData.
  301. TimeToLive - how long route should be kept in the table in seconds.
  302. Pass INFINITE if route is to be kept until deleted explicitly
  303. Note the current limit for TimeToLive is 2147483 sec (24+ days).
  304. Flags - returns what change message (if any) will be generated by the
  305. RTM as the result of this addition/update and identifies what
  306. information was palced into the provided buffers:
  307. RTM_NO_CHANGE - this was an update that either did not change any of
  308. the significant route parameters (described above)
  309. or the route entry affected is not the best
  310. to the destination network
  311. RTM_ROUTE_ADDED - the route added is the first known route for a
  312. destination network,
  313. CurBestRoute is filled with added route info
  314. RTM_ROUTE_CHANGED - there was a change in any of the significant
  315. parameters of the BEST route to a destination
  316. network as the result if this operation.
  317. PrevBestRoute contains the route info as it was
  318. before the change, CurBestRoute contains current
  319. best route info.
  320. Note the the CurBestRoute does not neccessarily the same
  321. as added route, because if update causes route metric
  322. to change, another route entry may become the best for
  323. a given destination and its info will be returned in
  324. CurBestRoute buffer. PrevBestRoute buffer in the latter
  325. case will contain route entry as it was before this operation
  326. was performed.
  327. CurBestRoute - buffer to receive current best route info (if any)
  328. PrevBestRoute - buffer to receive previous best route info (if any)
  329. Return Value:
  330. NO_ERROR - route was added/updated OK
  331. ERROR_INVALID_PARAMETER - route contains invalid parameter
  332. ERROR_INVALID_HANDLE - client handle is not a valid RTM handle
  333. ERROR_NOT_ENOUGH_MEMORY - route could not be adeed because of memory
  334. allocation problem
  335. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  336. try again later
  337. *******************************************************************
  338. --*/
  339. DWORD WINAPI
  340. RtmAddRoute (
  341. IN HANDLE ClientHandle,
  342. IN PVOID Route,
  343. IN DWORD TimeToLive,
  344. OUT DWORD *Flags,
  345. OUT PVOID CurBestRoute OPTIONAL,
  346. OUT PVOID PrevBestRoute OPTIONAL
  347. );
  348. /*++
  349. *******************************************************************
  350. R t m D e l e t e R o u t e
  351. Routine Description:
  352. Deletes existing route entry and generates route change
  353. message if best route to a destination network has changed as the
  354. result of this operation.
  355. Note that route change message is not sent to the client that
  356. makes this change, but rather relevant information is returned
  357. by this routine directly.
  358. Arguments:
  359. ClientHandle - handle that identifies the client for which the opertation
  360. is performed, it also supplies RoutingProtocol field
  361. of the route to be deleted
  362. Route - route to be deleted.
  363. The following fields of protocol family dependent
  364. RTM_??_ROUTE structure are used to identify
  365. route entry to be deleted:
  366. RR_Network: destination network
  367. RR_InterfaceID: id of interface through which route was received
  368. RR_NextHopAddress: address of next hop router
  369. If the deleted entry represented the best route to a destination
  370. network, this operation will generate route change message
  371. Flags - returns what change message (if any) will be generated by the
  372. RTM as the result of this deletion and identifies what
  373. information was palced into the provided buffer:
  374. RTM_NO_CHANGE - the deleted route did not affect best route to
  375. any destination network (there is another entry that
  376. represents route to the same destination nework and
  377. it has better metric)
  378. RTM_ROUTE_DELETED - the deleted route was the only route avaliable
  379. for the destination network
  380. RTM_ROUTE_CHANGED - after this route was deleted another route
  381. became the best to the destination network,
  382. CurBestRoute will be filled with that route info
  383. CurBestRoute - buffer to receive current best route info (if any)
  384. Return Value:
  385. NO_ERROR - route was deleted OK
  386. ERROR_INVALID_PARAMETER - route contains invalid parameter
  387. ERROR_INVALID_HANDLE - client handle is not a valid RTM handle
  388. ERROR_NO_SUCH_ROUTE - there is no entry in the table that
  389. has specified parameters
  390. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  391. try again later
  392. *******************************************************************
  393. --*/
  394. DWORD WINAPI
  395. RtmDeleteRoute (
  396. IN HANDLE ClientHandle,
  397. IN PVOID Route,
  398. OUT DWORD *Flags,
  399. OUT PVOID CurBestRoute OPTIONAL
  400. );
  401. /*++
  402. *******************************************************************
  403. R t m I s R o u t e
  404. Routine Description:
  405. Checks if route exists to specified network and returns best
  406. route info
  407. Arguments:
  408. ProtocolFamily - identifies protocol family of route of interest
  409. Network - contains protocol family dependent network number data
  410. (as defined by ??_NETWORK structures above)
  411. BestRoute - buffer to receive current best route info (if any)
  412. Return Value:
  413. TRUE - route to network of interest exists
  414. FALSE - not route exist or operation failed, call GetLastError()
  415. to obtain reason of failure:
  416. NO_ERROR - operation succeded but not route exists
  417. ERROR_INVALID_PARAMETER - input parameter(s) is invalid (unsupported
  418. protocol family)
  419. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  420. try again later
  421. *******************************************************************
  422. --*/
  423. BOOL WINAPI
  424. RtmIsRoute (
  425. IN DWORD ProtocolFamily,
  426. IN PVOID Network,
  427. OUT PVOID BestRoute OPTIONAL
  428. );
  429. /*++
  430. *******************************************************************
  431. R t m G e t N e t w o r k C o u n t
  432. Routine Description:
  433. Returns number of networks that RTM has routes to.
  434. Arguments:
  435. ProtocolFamily - identifies protocol family of interest
  436. Return Value:
  437. Number of known networks
  438. 0 if no routes are availabel in the table or operation failed,
  439. call GetLastError () to get reason of failure:
  440. NO_ERROR - operation succeded but no routes available
  441. ERROR_INVALID_PARAMETER - input parameter is invalid (unsupported
  442. protocol family)
  443. *******************************************************************
  444. --*/
  445. ULONG WINAPI
  446. RtmGetNetworkCount (
  447. IN DWORD ProtocolFamily
  448. );
  449. /*++
  450. *******************************************************************
  451. R t m G e t R o u t e A g e
  452. Routine Description:
  453. Returns route age (time since it was created or updated) in seconds
  454. Route structure must have been recently filled by RTM for this to
  455. return valid results (route age is actually computed from
  456. RR_TimeStamp field)
  457. Arguments:
  458. Route - protocol family dependent route data (RTM_??_ROUTE data
  459. structure) that was obtained from RTM (returned by
  460. its routines)
  461. Return Value:
  462. Route age in seconds
  463. INFINITE - if content of route is invalid (GetLastError () returns
  464. ERROR_INVALID_PARAMETER)
  465. *******************************************************************
  466. --*/
  467. ULONG WINAPI
  468. RtmGetRouteAge (
  469. IN PVOID Route
  470. );
  471. /*++
  472. *******************************************************************
  473. R t m C r e a t e E n u m e r a t i o n H a n d l e
  474. Routine Description:
  475. Creates a handle that will allow the caller to use fast and change
  476. tolerant enumeration API to scan through all routes or a subset of them
  477. known to the RTM. Note that scans performed by this API do not return
  478. routes in any particular order.
  479. Arguments:
  480. ProtocolFamily - identifies protocol family of interest
  481. EnumerationFlags - limit routes returned by enumeration API to a subset
  482. members of which have same values in the fields
  483. specified by the flags as in CriteriaRoute
  484. (RTM_ONLY_BEST_ROUTES does not require a criterion)
  485. CriteriaRoute - protocol family dependent structure (RTM_??_ROUTE) with
  486. set values in fields that correspond to EnumerationFlags
  487. Return Value:
  488. Handle that can be used with enumeration API below
  489. NULL no routes exists with specified criteria or operation failed,
  490. call GetLastError () to get reason of failure:
  491. ERROR_NO_ROUTES - no routes exist with specified criteria
  492. ERROR_INVALID_PARAMETER - input parameter(s) is invalid (unsupported
  493. protocol family, invalid enumeration flag, etc)
  494. ERROR_NOT_ENOUGH_MEMORY - handle could not be created because of memory
  495. allocation problem
  496. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  497. try again later
  498. *******************************************************************
  499. --*/
  500. HANDLE WINAPI
  501. RtmCreateEnumerationHandle (
  502. IN DWORD ProtocolFamily,
  503. IN DWORD EnumerationFlags,
  504. IN PVOID CriteriaRoute
  505. );
  506. /*++
  507. *******************************************************************
  508. R t m E n u m e r a t e G e t N e x t R o u t e
  509. Routine Description:
  510. Returns next route entry in enumeration started by
  511. RtmCreateEnumerationHandle.
  512. Arguments:
  513. EnumerationHandle - handle that identifies enumeration
  514. Route - buffer (RTM_??_ROUTE structure) that receives next
  515. route in enumeration
  516. Return Value:
  517. NO_ERROR - next availbale route was placed in the buffer
  518. ERROR_NO_MORE_ROUTES - no more routes exist with soecified criteria
  519. ERROR_INVALID_HANDLE - enumeration handle is not a valid RTM handle
  520. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  521. try again later
  522. *******************************************************************
  523. --*/
  524. DWORD WINAPI
  525. RtmEnumerateGetNextRoute (
  526. IN HANDLE EnumerationHandle,
  527. OUT PVOID Route
  528. );
  529. /*++
  530. *******************************************************************
  531. R t m C l o s e E n u m e r a t i o n H a n d l e
  532. Routine Description:
  533. Terminates enumerationand frees associated resources
  534. Arguments:
  535. EnumerationHandle - handle that identifies enumeration
  536. Return Value:
  537. NO_ERROR - enumeration was termineted ok
  538. ERROR_INVALID_HANDLE - enumeration handle is not a valid RTM handle
  539. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  540. try again later
  541. *******************************************************************
  542. --*/
  543. DWORD WINAPI
  544. RtmCloseEnumerationHandle (
  545. IN HANDLE EnumerationHandle
  546. );
  547. /*++
  548. *******************************************************************
  549. R t m B l o c k D e l e t e R o u t e s
  550. Routine Description:
  551. Deletes all routes in subset specified by enumeration flags and
  552. corresponding criteria. This operation can only be performed by
  553. the registered client and applies only to routes added by this
  554. client.
  555. Route change messages will be generated for deleted routes that
  556. were the best
  557. Arguments:
  558. ClientHandle - handle that identifies the client and routing protocol
  559. of routes to be deleted
  560. EnumerationFlags - further limit subset of routes being deleted to only
  561. those that have same values in the fields
  562. specified by the flags as in CriteriaRoute
  563. Note that only RTM_ONLY_THIS_NETWORK and RTM_ONLY_THIS_INTERFACE
  564. can be used (RTM_ONLY_BEST_ROUTES does not apply because best
  565. route designation is adjusted as routes are deleted and
  566. all routes will be deleted anyway)
  567. CriteriaRoute - protocol family dependent structure (RTM_??_ROUTE) with
  568. set values in fields that correspond to EnumerationFlags
  569. Return Value:
  570. NO_ERROR - routes were deleted ok
  571. ERROR_NO_ROUTES - no routes exist that match specified criteria
  572. ERROR_INVALID_HANDLE - client handle is not a valid RTM handle
  573. ERROR_NOT_ENOUGH_MEMORY - could not allocate memory to perform
  574. the operation
  575. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  576. try again later
  577. *******************************************************************
  578. --*/
  579. DWORD WINAPI
  580. RtmBlockDeleteRoutes (
  581. IN HANDLE ClientHandle,
  582. IN DWORD EnumerationFlags,
  583. IN PVOID CriteriaRoute
  584. );
  585. /*++
  586. *******************************************************************
  587. R t m G e t F i r s t R o u t e
  588. Routine Description:
  589. Returns first route in the NetworkNumber.RoutingProtocol.InterfaceID.
  590. NextHopAddress order from the subset specifed by the enumeration flags.
  591. Note that this operation may consume significant processing time because
  592. first all recently changed routes will have to be merged into the
  593. ordered list, and this list will then have to be traversed to locate
  594. the route of interest.
  595. Arguments:
  596. ProtocolFamily - identifies protocol family of interest
  597. EnumerationFlags - limit routes returned by enumeration API to a subset
  598. members of which have same values in the fields
  599. specified by the flags as in CriteriaRoute
  600. (RTM_ONLY_BEST_ROUTES does not require a criterion)
  601. Route - protocol family dependent structure (RTM_??_ROUTE) with
  602. set values in fields that correspond to EnumerationFlags
  603. on INPUT and first route that matches specified
  604. criteria on OUTPUT
  605. Return Value:
  606. NO_ERROR - matching route was found
  607. ERROR_NO_ROUTES - no routes exist with specified criteria
  608. ERROR_INVALID_PARAMETER - input parameter(s) is invalid (unsupported
  609. protocol family, invalid enumeration flag, etc)
  610. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  611. try again later
  612. *******************************************************************
  613. --*/
  614. DWORD WINAPI
  615. RtmGetFirstRoute (
  616. IN DWORD ProtocolFamily,
  617. IN DWORD EnumerationFlags,
  618. IN OUT PVOID Route
  619. );
  620. #define RtmGetSpecificRoute(ProtocolFamily,Route) \
  621. RtmGetFirstRoute(ProtocolFamily, \
  622. RTM_ONLY_THIS_NETWORK \
  623. | RTM_ONLY_THIS_PROTOCOL \
  624. | RTM_ONLY_THIS_INTERFACE, \
  625. Route)
  626. /*++
  627. *******************************************************************
  628. R t m G e t N e x t R o u t e
  629. Routine Description:
  630. Returns route that follows specified route in the NetworkNumber.
  631. RoutingProtocol.InterfaceID.NextHopAddress order from the subset defined
  632. by the enumeration flags.
  633. Note that this operation may consume significant processing time because
  634. first all recently changed routes will have to be merged into the
  635. ordered list, and this list may then have to be traversed to locate
  636. the route of interest.
  637. Arguments:
  638. ProtocolFamily - identifies protocol family of interest
  639. EnumerationFlags - limit routes returned by enumeration API to a subset
  640. members of which have same values in the fields
  641. specified by the flags as in Route
  642. (RTM_ONLY_BEST_ROUTES does not require a criterion)
  643. Route - protocol family dependent structure (RTM_??_ROUTE) which both
  644. provides the route from which to start the search and
  645. set values in fields that correspond to EnumerationFlags
  646. on INPUT and route that both follows input route in
  647. NetworkNumber.RoutingProtocol.InterfaceID.NextHopAddress
  648. order and matches specified criteria on OUTPUT
  649. Return Value:
  650. NO_ERROR - matching route was found
  651. ERROR_NO_ROUTES - no routes exist with specified criteria
  652. ERROR_INVALID_PARAMETER - input parameter(s) is invalid (unsupported
  653. protocol family, invalid enumeration flag, etc)
  654. ERROR_NO_SYSTEM_RESOURCES - not enough resources to perform the operation,
  655. try again later
  656. *******************************************************************
  657. --*/
  658. DWORD WINAPI
  659. RtmGetNextRoute (
  660. IN DWORD ProtocolFamily,
  661. IN DWORD EnumerationFlags,
  662. IN OUT PVOID Route
  663. );
  664. BOOL WINAPI
  665. RtmLookupIPDestination(
  666. DWORD dwDestAddr,
  667. PRTM_IP_ROUTE prir
  668. );
  669. #ifdef __cplusplus
  670. }
  671. #endif
  672. #if _MSC_VER >= 1200
  673. #pragma warning(pop)
  674. #else
  675. #pragma warning(default:4201)
  676. #endif
  677. #endif //__ROUTING_RTM_H__