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

📄 ospf_mib_helper.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
                            pArea->numActiveIf++;                            /* the numActiveIf should never greater than the number of                             * interfaces that have been registered to this area. In                             * case that happens, reset the numActiveIf to the                             * appropriate value                             */                            if ( pArea->numActiveIf > pArea->numIfAttached )                                pArea->numActiveIf = pArea->numIfAttached;                            /* update the area attributes if necessary */                            ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                        initialActiveHost );                        }                        return OK;                    }                    /* the numActiveIf counter is only incremented if the row status                     * for this interface is active and the adminstrative status is                     * enabled. Therefore, even if the interface row status remains                     * active, as long as the administrative status has changed, we                     * need to update the counter                     */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              (oldStatus == EmApiOspfRowStatus_active) )                    {                        if ( pIf->ospfIfAdminStat == EmApiOspf_enabled )                        {                            pArea->numActiveIf++;                            /* the numActiveIf should never greater than the number of                             * interfaces that have been registered to this area. In                             * case that happens, reset the numActiveIf to the                             * appropriate value                             */                            if ( pArea->numActiveIf > pArea->numIfAttached )                                pArea->numActiveIf = pArea->numIfAttached;                            /* update the area attributes if necessary */                            ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                        initialActiveHost );                        }                        else                        {                            /* make sure we don't go negative */                            if ( pArea->numActiveIf > 0 )                                pArea->numActiveIf--;                            /* update the area attributes if necessary */                            ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                        initialActiveHost );                        }                        return OK;                    }                    /* special case for handling nvm commit request that configures                     * the interface using saved configuration from non-volatile                     * memory. If the row is initially created and the rowStatus value                     * is now active, update the numActiveIf counter                     */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              ((int)oldStatus == RS_undefined) &&                              (thisMapi->currMapiReqType == MAPI_COMMIT_FORCE) )                    {                        if ( pIf->ospfIfAdminStat == EmApiOspf_enabled )                        {                            pArea->numActiveIf++;                            /* the numActiveIf should never greater than the number of                             * interfaces that have been registered to this area. In                             * case that happens, reset the numActiveIf to the                             * appropriate value                             */                            if ( pArea->numActiveIf > pArea->numIfAttached )                                pArea->numActiveIf = pArea->numIfAttached;                            /* update the area attributes if necessary */                            ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                        initialActiveHost );                        }                        else                        {                            /* make sure we don't go negative */                            if ( pArea->numActiveIf > 0 )                                pArea->numActiveIf--;                            /* update the area attributes if necessary */                            ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                        initialActiveHost );                        }                        return OK;                    }                    else                    {                        /* no meaningful state transition made by existing client,                         * nothing to do                         */                        return OK;                    }                }            }            break;            case EmApiOspfClientType_vintf:            {                mApiOspfVirtIf_t *pVirtIf;                mApiOspfVirtIf_t *pClient;                pVirtIf = (mApiOspfVirtIf_t *)pAttachedClient->pClient;                pClient = (mApiOspfVirtIf_t *)pNewClient;                if ( (pVirtIf->ospfVirtIfAreaId == pClient->ospfVirtIfAreaId) &&                     (pVirtIf->ospfVirtIfNeighbor == pClient->ospfVirtIfNeighbor) )                {                    mApiOspfPrintf(("ospf_mApi_areaRegisterIf:Client exist\n"));                    /* get the current client state information */                    currStatus = pClient->ospfVirtIfStatus;                    /* remember its previous state */                    pAttachedClient->oldStatus = oldStatus;                    /* interface transition from active to notReady or notInService? */                    if ( (oldStatus == (int)EmApiOspfRowStatus_active) &&                         ( (currStatus == EmApiOspfRowStatus_notInService) ||                           (currStatus == EmApiOspfRowStatus_notReady) ) )                    {                        /* make sure we don't go negative */                        if ( pArea->numActiveVirtIf > 0 )                            pArea->numActiveVirtIf--;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    /* interface transition from notInService or notReady to active? */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              ( (oldStatus == (int)EmApiOspfRowStatus_notInService) ||                                (oldStatus == (int)EmApiOspfRowStatus_notReady) ) )                    {                        pArea->numActiveVirtIf++;                        /* the numActiveIf should never greater than the number of                         * virtual interfaces that have been registered to this area. In                         * case that happens, reset the numActiveVirIf to the                         * appropriate value                         */                        if ( pArea->numActiveVirtIf > pArea->numVirtIfAttached )                            pArea->numActiveIf = pArea->numVirtIfAttached;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    /* special case for handling nvm commit request that configures                     * the interface using saved configuration from non-volatile                     * memory. If the row is initially created and the rowStatus value                     * is now active, update the numActiveIf counter                     */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              ((int)oldStatus == RS_undefined) &&                              (thisMapi->currMapiReqType == MAPI_COMMIT_FORCE) )                    {                        pArea->numActiveVirtIf++;                        /* the numActiveIf should never greater than the number of                         * virtual interfaces that have been registered to this area. In                         * case that happens, reset the numActiveVirIf to the                         * appropriate value                         */                        if ( pArea->numActiveVirtIf > pArea->numVirtIfAttached )                            pArea->numActiveIf = pArea->numVirtIfAttached;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    else                    {                        /* no meaningful state transition made by existing client,                         * nothing to do                         */                        return OK;                    }                }            }            break;            case EmApiOspfClientType_host:            {                mApiOspfHost_t *pHostIf;                mApiOspfHost_t *pClient;                pHostIf = (mApiOspfHost_t *)pAttachedClient->pClient;                pClient = (mApiOspfHost_t *)pNewClient;                if ( (pHostIf->ospfHostIpAddress == pClient->ospfHostIpAddress) &&                     (pHostIf->ospfHostTOS == pClient->ospfHostTOS) )                {                    mApiOspfPrintf(("ospf_mApi_areaRegisterIf:Client exist\n"));                    /* get the current client state information */                    currStatus = pClient->ospfHostStatus;                    /* remember its previous state */                    pAttachedClient->oldStatus = oldStatus;                    /* interface transition from active to notReady or notInService? */                    if ( (oldStatus == (int)EmApiOspfRowStatus_active) &&                         ( (currStatus == EmApiOspfRowStatus_notInService) ||                           (currStatus == EmApiOspfRowStatus_notReady) ) )                    {                        /* make sure we don't go negative */                        if ( pArea->numActiveHost > 0 )                            pArea->numActiveHost--;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    /* interface transition from notInService or notReady to active? */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              ( (oldStatus == (int)EmApiOspfRowStatus_notInService) ||                                (oldStatus == (int)EmApiOspfRowStatus_notReady) ) )                    {                        pArea->numActiveHost++;                        /* the numActiveIf should never greater than the number of                         * virtual interfaces that have been registered to this area. In                         * case that happens, reset the numActiveHostIf to the                         * appropriate value                         */                        if ( pArea->numActiveHost > pArea->numHostAttached )                            pArea->numActiveHost = pArea->numHostAttached;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    /* special case for handling nvm commit request that configures                     * the interface using saved configuration from non-volatile                     * memory. If the row is initially created and the rowStatus value                     * is now active, update the numActiveIf counter                     */                    else if ( (currStatus == EmApiOspfRowStatus_active) &&                              ((int)oldStatus == RS_undefined) &&                              (thisMapi->currMapiReqType == MAPI_COMMIT_FORCE) )                    {                        pArea->numActiveHost++;                        /* the numActiveIf should never greater than the number of                         * virtual interfaces that have been registered to this area. In                         * case that happens, reset the numActiveHostIf to the                         * appropriate value                         */                        if ( pArea->numActiveHost > pArea->numHostAttached )                            pArea->numActiveHost = pArea->numHostAttached;                        /* update the area attributes if necessary */                        ospf_mApi_areaStatusUpdate( pArea, initialActiveIf,                                                    initialActiveHost );                        return OK;                    }                    else                    {                        /* no state transition made by existing client, nothing to do */                        return OK;                    }                }            }            break;            case EmApiOspfClientType_nbr:            case EmApiOspfClientType_ag:                mApiOspfPrintf(("ospf_mApi_areaRegisterIf:Incorrect client type\n"));                break; /* ignore it, should not happen anyway */

⌨️ 快捷键说明

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