大网数据广告活动
网络与域名解析

Receiving Notification of Changes

· 52CE 我爱测

Many clients can simultaneously update the routing table, and clients must be notified when changes to routing information occur.

Many clients can simultaneously update the routing table, and clients must be notified when changes to routing information occur. For example, a client that is not notified of another client's changes to the routing table could advertise outdated route information. This can be prevented by programming clients to register with the routing table manager to be notified of changes in the routing table. The routing table manager sends notifications of changes to all clients that register to receive them.

Change notification applies only to destinations. There is no way to query the routing table manager for changes to a particular route.

When a change is made to one of the routes to a destination, the routing table manager sends out a notification that a change has occurred. This notification goes only to those clients that have registered with the routing table manager for the type of change that has occurred. All changes to routing information in the routing table manager occur in one or more views, and change notification messages can be requested in any subset of supported views.

There are currently three types of change notifications for which a client can register:

  • Notification of any change to the routes for the destination. This request is made using the RTM_CHANGE_TYPE_ALL flag.

  • Notification if the best route to the destination changes, or any of the following information for the current best route changes:

    • Preference
    • Next hops
    • Route flags

    This request is made using the RTM_CHANGE_TYPE_BEST flag.

  • Notification of all changes of the type RTM_CHANGE_TYPE_BEST, except changes in non-forwarding flags in the best route. For example, the router manager waits for changes of this type in the unicast view, and updates information in the unicast forwarder. This request is made using the RTM_CHANGE_TYPE_FORWARDING flag.

Requests for notifications of changes can also be restricted to a subset of destinations by registering for notifications of changes only to "marked" destinations. The client can mark a destination for change notification by calling RtmMarkDestForChangeNotification.

When a change occurs, the routing table manager checks to see if there are any clients that must be notified of this change. A client must be notified of a change if all of the following conditions are met:

  • The type of change that occurred is a type for which the client has registered for notification
  • Changes to a destination that the client has marked have occurred or any destination, if the client has requested changes for all destinations
  • The client requested change notification for the view in which this change occurred

If the change meets all of the above criteria, the change is cached and the client is notified.

The notification does not specify what the actual changes are, only that they have occurred. The client must retrieve the changes by calling RtmGetChangedDests using the notification handle that was obtained from a previous call to RtmRegisterForChangeNotification.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。