SnmpExtensionInitEx

This API allows an extension DLL to indicate to the extendible agent that it wants to support multiple MIBs or multiple MIB views. This API returns a Boolean indicating to the extendible agent whether or not it has more views to support. The extendible agent will continue to call this API until False is returned.


BOOL SnmpExtensionInitEx(OUT AsnObjectIdentifier *supportedView)

Parameter

supportedView

Description

Points to an AsnObjectIdentifier specifying the MIB subtree supported by the extension agent.

Returns

TRUE if the extension agent has more MIB views that it wants to notify the extendible agent about.

FALSE if it has notified the extension agent of all supported views.

Comments

When the extendible agent detects that the extension agent supports this API, it will loop, calling this API as long as TRUE is returned. In this way an extension agent can indicate multiple subtree views supported by a single extension agent.

The toaster MIB DLL only supports a single view into its MIB, so included below is an example taken from the MIB-II MIB of the Windows NT extension agent. Note the use of the global variable whichView that keeps track of what views have been added. A case statement determines what view gets added on each call until all have been added, and then FALSE is returned.


int  whichView;
UINT MyView1[] = {1, 3, 6, 1, 2, 1, 1};
UINT MyView2[] = {1, 3, 6, 1, 2, 1, 2};
UINT MyView3[] = {1, 3, 6, 1, 2, 1, 3};
UINT MyView4[] = {1, 3, 6, 1, 2, 1, 4};
UINT MyView5[] = {1, 3, 6, 1, 2, 1, 5};
UINT MyView6[] = {1, 3, 6, 1, 2, 1, 6};
UINT MyView7[] = {1, 3, 6, 1, 2, 1, 7};

BOOL SnmpExtensionInitEx(
    View *supportedView)
{
    BOOL retVal;

    retVal = TRUE;
    switch (whichView) {
        case 0:
            supportedView->idLength = 7;
            supportedView->ids = MyView2;
            break;
        case 1:
            supportedView->idLength = 7;
            supportedView->ids = MyView3;
            break;
        case 2:
            supportedView->idLength = 7;
            supportedView->ids = MyView4;
            break;
        case 3:
            supportedView->idLength = 7;
            supportedView->ids = MyView5;
            break;
        case 4:
            supportedView->idLength = 7;
            supportedView->ids = MyView6;
            break;
        case 5:
            supportedView->idLength = 7;
            supportedView->ids = MyView7;
            break;
        default:
            retVal = FALSE;
            break;
    }
    whichView++;
    return(retVal);
}