⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospf_mib_wrn_helper.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
* This routine delete all area instances associated with the Type-10 Opaque LSA from * the wrnOspfAreaTable. All memory resources will be reclaimed and the appropriate* MIB API statistics will be updated if necessary.** RETURNS: N/A** NOMANUAL*/LOCAL void wrnOspf2Mapi_area_flush( void ){    mApiWrnOspfArea_t  *pType10Area;     mApiOspfAvlClass_t *pWrnAreaAvl;    /* get the avl tree root */    pWrnAreaAvl = &thisMapi->wrnOspfAreaAvl;    for (;;)     {        /* get the first instance from the lsdb avl tree */        pType10Area = (mApiWrnOspfArea_t *)avlMinimumGet(pWrnAreaAvl->pOspfAvlRoot );        if ( pType10Area == NULL )            break;        wrnOspf_mApi_areaDelete( pType10Area->wrnOspfAreaId );    }    return;}/*************************************************************************************** wrnOspf2Mapi_lsdb_flush - flush all lsdb instances from wrnOspfLsdbTable** This routine delete all lsdb instances from the wrnOspfLsdbTable. All memory resources* will be reclaimed and the appropriate MIB API statistics will be updated if necessary.** RETURNS: N/A** NOMANUAL*/LOCAL void wrnOspf2Mapi_lsdb_flush( void ){    mApiWrnOspfLsdb_t   *pLsdb;    mApiOspfAvlClass_t  *pLsdbAvl;     GENERIC_ARGUMENT    key;    ulong_t             mibIndex[OSPF_LSDB_INSTANCE_LEN];        /* get the avl tree root */    pLsdbAvl = &thisMapi->wrnOspfLsdbAvl;    for (;;)     {          /* get the first instance from the lsdb avl tree */        pLsdb = (mApiWrnOspfLsdb_t *)avlMinimumGet(pLsdbAvl->pOspfAvlRoot );        if ( pLsdb == NULL )            break;        memset( mibIndex, 0, sizeof(mibIndex) );        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLsdbAreaId, &mibIndex[0] );        mibIndex[4] = pLsdb->wrnOspfLsdbType;        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLsdbLsid, &mibIndex[5] );        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLsdbRouterId, &mibIndex[9] );        key.p = (void *)mibIndex;        /* delete the instance in the OSPF LSDB avl tree */          pLsdb = (mApiWrnOspfLsdb_t *)avlDelete( &pLsdbAvl->pOspfAvlRoot, key,                                                pLsdbAvl->ospfAvlCompareRtn );        /* avlDelete returns NULL if it can't find the node to delete. This is ok since         * deleting a row that does not exist is acceptable         */        if ( pLsdb == NULL )            continue;                /* return the memory pointed to by the ospfLsdbAdvertisement to the heap */        if ( pLsdb->wrnOspfLsdbAdvertisement != NULL )        {            free( (void *)pLsdb->wrnOspfLsdbAdvertisement );            pLsdb->wrnOspfLsdbAdvertisement = NULL;        }                /* reclaim the memory */        memset( (char *)pLsdb, 0, sizeof(mApiWrnOspfLsdb_t) );         lstAdd( &pLsdbAvl->ospfFreePoolList, (NODE *)pLsdb );        thisMapi->mApiWrnOspfCurrLsdbCnt--;    }    return;}/*************************************************************************************** wrnOspf2Mapi_localLsdb_flush - flush all Type-9 Opaque LSA instances from *                                wrnOspfLocalLsdbTable** This routine delete all Type-9 Opaque LSA instances from the wrnOspfLocalLsdbTable. * All memory resources will be reclaimed and the appropriate MIB API statistics will be * updated if necessary.** RETURNS: N/A** NOMANUAL*/LOCAL void wrnOspf2Mapi_localLsdb_flush( void ){    mApiWrnOspfLocalLsdb_t  *pLsdb;    mApiOspfAvlClass_t      *pLsdbAvl;     GENERIC_ARGUMENT        key;    ulong_t                 mibIndex[OSPF_LOCAL_LSDB_INSTANCE_LEN];        /* get the avl tree root */    pLsdbAvl = &thisMapi->wrnOspfLocalLsdbAvl;    for (;;)     {          /* get the first instance from the lsdb avl tree */        pLsdb = (mApiWrnOspfLocalLsdb_t *)avlMinimumGet(pLsdbAvl->pOspfAvlRoot );        if ( pLsdb == NULL )            break;        memset( mibIndex, 0, sizeof(mibIndex) );        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLocalLsdbAreaId, &mibIndex[0] );        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLocalLsdbIpAddress, &mibIndex[4] );        mibIndex[8] = pLsdb->wrnOspfLocalLsdbType;        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLocalLsdbLsid, &mibIndex[9] );        ospf_mApi_ipAddr2IpIndex( pLsdb->wrnOspfLocalLsdbRouterId, &mibIndex[13] );        key.p = (void *)mibIndex;        /* delete the instance in the OSPF LSDB avl tree */          pLsdb = (mApiWrnOspfLocalLsdb_t *)avlDelete( &pLsdbAvl->pOspfAvlRoot, key,                                                     pLsdbAvl->ospfAvlCompareRtn );        /* avlDelete returns NULL if it can't find the node to delete. This is ok since         * deleting a row that does not exist is acceptable         */        if ( pLsdb == NULL )            continue;                /* return the memory pointed to by the ospfLsdbAdvertisement to the heap */        if ( pLsdb->wrnOspfLocalLsdbAdvertisement != NULL )        {            free( (void *)pLsdb->wrnOspfLocalLsdbAdvertisement );            pLsdb->wrnOspfLocalLsdbAdvertisement = NULL;        }                /* reclaim the memory */        memset( (char *)pLsdb, 0, sizeof(mApiWrnOspfLocalLsdb_t) );         lstAdd( &pLsdbAvl->ospfFreePoolList, (NODE *)pLsdb );        thisMapi->mApiWrnOspfCurrLocalLsdbCnt--;    }    return;}/*************************************************************************************** wrnOspf2Mapi_extLsdb_flush - flush all Type-11 Opaque LSA instances from *                              wrnOspfExtLsdbTable** This routine delete all Type-11 Opaque LSA instances from the wrnOspfLsdbTable. All * memory resources will be reclaimed and the appropriate MIB API statistics will be * updated if necessary.** RETURNS: N/A** NOMANUAL*/LOCAL void wrnOspf2Mapi_extLsdb_flush( void ){    mApiWrnOspfExtLsdb_t  *pExtLsdb;    mApiOspfAvlClass_t    *pExtLsdbAvl;    GENERIC_ARGUMENT       key;    ulong_t                mibIndex[OSPF_EXT_LSDB_INSTANCE_LEN];        /* get the avl tree root */    pExtLsdbAvl = &thisMapi->wrnOspfExtLsdbAvl;    for (;;)     {          /* get the first instance from the lsdb avl tree */        pExtLsdb = (mApiWrnOspfExtLsdb_t *)avlMinimumGet(pExtLsdbAvl->pOspfAvlRoot );        if ( pExtLsdb == NULL )            break;        memset( mibIndex, 0, sizeof(mibIndex) );        mibIndex[0] = pExtLsdb->wrnOspfExtLsdbType;          ospf_mApi_ipAddr2IpIndex( pExtLsdb->wrnOspfExtLsdbLsid, &mibIndex[1] );        ospf_mApi_ipAddr2IpIndex( pExtLsdb->wrnOspfExtLsdbRouterId, &mibIndex[5] );        key.p = (void *)mibIndex;        /* delete the instance in the OSPF LSDB avl tree */          pExtLsdb = (mApiWrnOspfExtLsdb_t *)avlDelete( &pExtLsdbAvl->pOspfAvlRoot, key,                                                      pExtLsdbAvl->ospfAvlCompareRtn );        /* avlDelete returns NULL if it can't find the node to delete. This is ok since         * deleting a row that does not exist is acceptable         */        if ( pExtLsdb == NULL )            continue;                /* return the memory pointed to by the ospfLsdbAdvertisement to the heap */        if ( pExtLsdb->wrnOspfExtLsdbAdvertisement != NULL )        {            free( (void *)pExtLsdb->wrnOspfExtLsdbAdvertisement );            pExtLsdb->wrnOspfExtLsdbAdvertisement = NULL;        }                /* reclaim the memory */        memset( (char *)pExtLsdb, 0, sizeof(mApiWrnOspfExtLsdb_t) );         lstAdd( &pExtLsdbAvl->ospfFreePoolList, (NODE *)pExtLsdb );        thisMapi->mApiWrnOspfCurrExtLsdbCnt--;    }    return;}/********************************************************************************* wrnOspf_mApi_findExtRouteByProtoId - find external route matched the given*                                      protocol ID.* * This routine is invoked by the ospf_mApi_avlTreeWalk() AVL Tree walk routine.* It walks the ospfExtLsdbTable and lookup external route that matches the* given route protocol ID. If the route is found, it returns the status* EXTERNAL_ROUTE_FOUND. Caller must expect and process this return status. If* no external routes that matches the given route protocol ID, the status* OK is returned.** RETURNS: OK, ERROR or EXTERNAL_ROUTE_FOUND** NOMANUAL*/ LOCAL STATUS wrnOspf_mApi_findExtRouteByProtoId( void *pNode, void *arg ){    mApiOspfExtLsdb_t  *pExtLsdb;    mApiOspfGenGroup_t *pMapiOspfGenGroup;    ulong_t            routeProtoId;    pExtLsdb = (mApiOspfExtLsdb_t *)pNode;    if ( pExtLsdb == NULL )        return OK;    pMapiOspfGenGroup = (mApiOspfGenGroup_t *)thisMapi->pMapiOspfGenGroup;    if ( pMapiOspfGenGroup == NULL )        return ERROR;    routeProtoId = (ulong_t)arg;    /* if the given routeProtoId is M2_iprouteProto_default and if the     * external link state id is all 0s, tell 'em that the external     * route exists in the database     */    if ( (pExtLsdb->ospfExtLsdbLsid == 0x00000000) &&         (routeProtoId == M2_ipRouteProto_default) )        return EXTERNAL_ROUTE_FOUND;        if ( (pExtLsdb->ospfExtLsdbProtoId == routeProtoId) &&          (pExtLsdb->ospfExtLsdbRouterId == pMapiOspfGenGroup->ospfRouterId) )    {        return EXTERNAL_ROUTE_FOUND;    }    return OK;}/***** public management method routines used by MIB API to configure OSPF *****//***************************************************************************************** wrnOspf_mApi_flushAllLsas - flush all Opaque Lsas.** This routine flushes all the Opaque Lsas in the MIB API Management Database. All* counters associated with the Opaque Lsas will be reset.** RETURNS: N/A** NOMANUAL*/void wrnOspf_mApi_flushAllLsas( BOOL resetAllToDefault ){    /* flush all Type-9, 10 and 11 Opaque LSAs */    wrnOspf2Mapi_lsdb_flush();    wrnOspf2Mapi_localLsdb_flush();    wrnOspf2Mapi_extLsdb_flush();    /* reset all general group variables */    if ( resetAllToDefault == TRUE )    {           mApiWrnOspfGenGroup_t  *pGenGroup;        pGenGroup = thisMapi->pMapiWrnOspfGenGroup;        pGenGroup->wrnOspfOriginateNewOpaqueLsas = 0;        pGenGroup->wrnOspfRxNewOpaqueLsas = 0;        pGenGroup->wrnOspfType11LsaCksumSum = 0;        pGenGroup->wrnOspfType11LsaCount = 0;        pGenGroup->wrnOspfType9LsaCksumSum = 0;        pGenGroup->wrnOspfType9LsaCount = 0;    }    mApiOspfPrintf(("wrnOspf_mApi_flushAllLsas:completed\n"));    return;}/***************************************************************************************** mApi2Ospf_configRedistributeOpts - dynamic configure OSPF Redistribute Options** This routine dynamically configure OSPF protocol for any redistribution options* that have been configured in the WRN OSPF Enterprise MIB General Group parameters.** RETURNS: N/A** ERRNO: N/A*/void mApi2Ospf_configRedistributeOpts( void *pGenParams, BOOL asBdrStatusChanged ){    mApiOspfTrueValue_t    ospfRedistrbuteOption;    mApiOspfTrueValue_t    asStatus;    mApiWrnOspfGenGroup_t  *pWrnGenGroup;    ulong_t                routeProtoId;    BOOL                   readRtTable;  /* read the IP Routing Table is set */    STATUS                 rc;    pWrnGenGroup = (mApiWrnOspfGenGroup_t *)pGenParams;    if ( pWrnGenGroup == NULL )    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -