RtmCreateRouteEnum function (rtmv2.h)
The RtmCreateRouteEnum function creates an enumeration of the routes for a particular destination or range of destinations in the routing table. A client can enumerate routes for one or more views, or for all views.
Syntax
DWORD RtmCreateRouteEnum(
[in] RTM_ENTITY_HANDLE RtmRegHandle,
[in] RTM_DEST_HANDLE DestHandle,
[in] RTM_VIEW_SET TargetViews,
[in] RTM_ENUM_FLAGS EnumFlags,
[in] PRTM_NET_ADDRESS StartDest,
[in] RTM_MATCH_FLAGS MatchingFlags,
[in] PRTM_ROUTE_INFO CriteriaRoute,
[in] ULONG CriteriaInterface,
[out] PRTM_ENUM_HANDLE RtmEnumHandle
);
Parameters
[in] RtmRegHandle
Handle to the client obtained from a previous call to RtmRegisterEntity.
[in] DestHandle
Handle to the destination for which to enumerate routes. This parameter is optional, and can be set to NULL; specifying NULL enumerates all routes for all destinations. Specify NULL if EnumFlags contains RTM_ENUM_START.
[in] TargetViews
Specifies the set of views to use when creating the enumeration. The following flags are used.
[in] EnumFlags
Specifies which routes to include in the enumeration. Two sets of flags are used; use one flag from each set (such as RTM_ENUM_ALL_ROUTES and RTM_ENUM_START).
Constant | Meaning |
---|---|
|
Return all routes. |
|
Return only those routes that the client owns. |
[in] StartDest
Pointer to an RTM_NET_ADDRESS structure that contains the starting address of the enumeration. This parameter is ignored if EnumFlags contains RTM_ENUM_START.
[in] MatchingFlags
Specifies the elements of the route to match. Only routes that match the criteria specified in CriteriaRoute and CriteriaInterface are returned, unless otherwise noted. The following flags are used.
[in] CriteriaRoute
Specifies which routes to enumerate. This parameter is optional and can be set to NULL if MatchingFlags contains RTM_MATCH_INTERFACE or RTM_MATCH_NONE.
[in] CriteriaInterface
Pointer to a ULONG that specifies on which interfaces routes should be located. This parameter is ignored unless MatchingFlags contains RTM_MATCH_INTERFACE.
[out] RtmEnumHandle
On input, RtmEnumHandle is a pointer to NULL.
On output, RtmEnumHandle receives a pointer to a handle to the enumeration. Use this handle in all subsequent calls to RtmGetEnumRoutes, RtmReleaseRoutes, and RtmDeleteEnumHandle.
Return value
If the function succeeds, the return value is NO_ERROR.
If the function fails, the return value is one of the following error codes.
Value | Meaning |
---|---|
|
A parameter contains incorrect information. |
|
There is not enough memory to complete this operation. |
|
One or more of the specified views is not supported. |
Remarks
If EnumFlags contains RTM_ENUM_RANGE, use NetAddress to specify the range of the routing table to enumerate. For example, if a client sets NetAddress to 10/8, destinations in the range 10.0.0.0/8 to 10.255.255.255/32 are returned.
When the enumeration handle is no longer required, release it by calling RtmDeleteEnumHandle.
For sample code using this function, see Enumerate All Routes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | rtmv2.h |
Library | Rtm.lib |
DLL | Rtm.dll |