Platform SDK: Network Management |
Several options are available when a WinSNMP application registers a WinSNMP session for traps or notifications. Because of this, an application can call the SnmpRegister function multiple times, in effect defining a custom filter for the reception of traps and notifications. For example, you can register for one type of trap or notification, or for all traps and notifications, depending on the value of the notification parameter. Additionally, the application can specify values in other parameters to the SnmpRegister function to further define the traps and notifications that should reach an application. For more information, see Managing Traps and Notifications.
Following are instances in which multiple calls to SnmpRegister are redundant. In these instances SnmpRegister returns SNMPAPI_SUCCESS if the function completes successfully, but the redundant registration is ineffective.
To unregister the session, you must match each unique registration call to the SnmpRegister function. Call SnmpRegister to unregister the session, and ensure that the first five parameters to SnmpRegister are identical to those in the initial registration call. The only difference between the initial call and the unregistering call is that when registering you must specify the value SNMPAPI_ON in the status parameter, and when you call the function to unregister, you must specify SNMPAPI_OFF. You do not need to match redundant registration calls to the SnmpRegister function. You need only match the first unique registration call.
To change filtering criteria, it may be necessary for an application to first unregister and disable delivery of certain traps or notifications. Then the application can create a new filter by calling SnmpRegister, passing appropriate values.