A general and extensible mechanism is provided so that any NP can monitor and have limited control over WNet operations being attempted by the MPR at the request of an application. This mechanism is currently provided for adding, canceling, and obtaining performance information about network connections. Notification for other services may be added in the future.
The NP can register a notification function for a specific type of WNet operation with MPR (by calling NPSNotifyRegister). Then, whenever the MPR is attempting the operation, it will call the notification function, both before and after attempting the operation (pre-notification and post-notification, respectively). The notification function can cancel the WNet operation, or, in the event of a failure, request the MPR to retry the operation. If the requesting application makes an invalid WNet request that is detected by MPR before attempting the operation (e.g. passing in bad parameters), then the notification is not performed.
Currently there is no mechanism for an NP to stop being notified once it has registered itself for notification. This is because currently the notification mechanism is only supported for use by network provider DLLs which are loaded and unloaded by MPR. In the future the notification mechanism may be extended for use by applications or other types of DLL, in which case a de-register function will also be provided.
When more than one NP wants notification for an operation, the pre-notification functions are called by MPR in the opposite order than that they were registered by the NP's and the post-notification functions are called in the reverse order to that of pre-notification.
Control of the operation is achieved by returning specific values from the notification function.
The pre-notification function must give the MPR a context to associate with a WNet operation if it is interested in post-notification, which the NP can use to track the progress of the operation (e.g. only retry failed operations once, or reverse some operation previously performed by the NP if the operation fails).
If an NP wants to communicate its notification context to its corresponding NP operation implementation (i.e. NPAddConnection, NPCancelConnection, or NPGetConnectionPerformance), then it can do so by calling NPSNotifyGetContext from within the NP operation implementation. |
The registration function is as follows: NPSNotifyRegister.