Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Poniższe procedury przedstawiają kroki korzystania z list tras specyficznych dla klienta. Poniższy przykładowy kod pokazuje, jak zaimplementować procedurę.
Aby użyć tej funkcji, klient powinien wykonać następujące kroki
- Wywołaj RtmCreateRouteList, aby uzyskać dojście od menedżera tabel routingu.
- Wywołaj RtmInsertInRouteList za każdym razem, gdy klient musi dodać trasę do tej listy.
- Gdy klient nie wymaga już listy, powinien wywołać RtmDeleteRouteList, aby usunąć listę.
Jeśli klient musi wyliczyć trasy na liście, klient powinien wykonać następujące kroki
- Wywołaj RtmCreateRouteListEnum, aby uzyskać uchwyt enumeracji z menedżera tablicy routingu.
- Wywołaj RtmGetListEnumRoutes, aby uzyskać dojścia do tras na liście.
- Wywołaj RtmReleaseRoutes, aby zwolnić uchwyty, gdy nie są już wymagane.
Poniższy przykładowy kod przedstawia sposób tworzenia i używania listy tras specyficznych dla klienta.
HANDLE RouteListHandle1;
HANDLE RouteListHandle2;
// Create two entity-specific lists to add routes to
Status = RtmCreateRouteList(RtmRegHandle,
&RouteListHandle1);
// Check Status
//...
Status = RtmCreateRouteList(RtmRegHandle,
&RouteListHandle2);
// Check Status
//...
// Assume you have added a bunch of routes
// by calling RtmAddRouteToDest many times
// with 'RouteListHandle1' specified similar to
// Status = RtmAddRouteToDest(RtmRegHandle,
// ...
// RouteListHandle1,
// ...
// &ChangeFlags);
// Enumerate routes in RouteListHandle1 list
// Create an enumeration on the route list
Status = RtmCreateRouteListEnum(RtmRegHandle,
RouteListHandle1,
&EnumHandle);
if (Status == NO_ERROR)
{
// Allocate space on the top of the stack
MaxHandles = RegnProfile.MaxHandlesInEnum;
RouteHandles = _alloca(MaxHandles * sizeof(HANDLE));
// Note how the termination condition is different
// from other enumerations - the call to the function
// RtmGetListEnumRoutes always returns NO_ERROR
// Quit when you get fewer handles than requested
do
{
// Get next set of routes from the list enumeration
NumHandles = MaxHandles;
Status = RtmGetListEnumRoutes(RtmRegHandle,
EnumHandle,
&NumHandles,
RouteHandles);
for (i = 0; i < NumHandles; i++)
{
Print("Route Handle %5lu: %p\n", i, RouteHandles[i]);
}
// Move all these routes to another route list
// They are automatically removed from the old one
Status = RtmInsertInRouteList(RtmRegHandle,
RouteListHandle2,
NumHandles,
RouteHandles);
// Check Status...
// Release the routes that have been enumerated
RtmReleaseRoutes(RtmRegHandle, NumHandles, RouteHandles);
}
while (NumHandles == MaxHandles);
RtmDeleteEnumHandle(RtmRegHandle, EnumHandle);
}
// Destroy all the entity-specific route lists
// after removing all routes from these lists;
// the routes themselves are not deleted
Status = RtmDeleteRouteList(RtmRegHandle, RouteListHandle1);
ASSERT(Status == NO_ERROR);
Status = RtmDeleteRouteList(RtmRegHandle, RouteListHandle2);
ASSERT(Status == NO_ERROR);