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

📄 ospf_mib_api.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
            /* number of SNMP Undo must never greater than the Test request count.             * when performing undo, the mApiCommitReqCnt can be ignored             */            if ( thisMapi->mApiUndoReqCnt >= thisMapi->mApiTestReqCnt )            {                thisMapi->mApiBogusReqCnt++;                semGive( thisMapi->semMapiMutex );                mApiOspfError(("ospf_mApi_setReqCnt:too many undo request!\n"));                return ERROR;            }            thisMapi->mApiUndoReqCnt++;            break;        case MAPI_COMPLETE:            /* all requests for a transaction succeed */            if ( (thisMapi->mApiTestReqCnt == thisMapi->mApiCommitReqCnt) &&                 (thisMapi->mApiUndoReqCnt == 0 ) )            {                /* end of SNMP transaction, reset all state counters */                thisMapi->mApiTestReqCnt = 0;                thisMapi->mApiCommitReqCnt = 0;            }            /* undo takes place, mApiCommitReqCnt is ignored  */            else if ( thisMapi->mApiTestReqCnt == thisMapi->mApiUndoReqCnt )            {                /* reset all state counters */                thisMapi->mApiTestReqCnt = 0;                thisMapi->mApiCommitReqCnt = 0;                thisMapi->mApiUndoReqCnt = 0;            }            /* failed during the test requests, the set never take place at all */            else if ( (thisMapi->mApiCommitReqCnt == 0) && (thisMapi->mApiUndoReqCnt == 0) &&                      (thisMapi->mApiTestReqCnt > 0) )            {                /* reset all state counters */                thisMapi->mApiTestReqCnt = 0;                thisMapi->mApiCommitReqCnt = 0;                thisMapi->mApiUndoReqCnt = 0;            }            else            {                /* looks like the SNMP agent is out of sync with us. Reset all state                 * counters and return error so that agent can start over again.                 * If we don't reset all the counters, no MAPI_TEST and MAPI_COMMIT                 * requests will go through.                 */                thisMapi->mApiTestReqCnt = 0;                thisMapi->mApiCommitReqCnt = 0;                thisMapi->mApiUndoReqCnt = 0;                thisMapi->mApiBogusReqCnt++;                semGive( thisMapi->semMapiMutex );                mApiOspfPrintf(("ospf_mApi_setReqCnt:out-of-sync!\n"));                return ERROR;            }            thisMapi->mApiCompleteReqCnt++;  /* internal statistics, for debugging */            break;        /* MAPI_COMMIT_FORCE is a special request type that is used only at system started.         * Since this request type (in theory) is a combination of MAPI_TEST,          * MAPI_COMMIT and MAPI_COMPLETE requests, we don't need to maintain the          * transaction counters at all.         */        case MAPI_COMMIT_FORCE:            break;        case MAPI_GET:        case MAPI_GET_NEXT:        case MAPI_GET_FORCE:        default:            /* reject all other request types */            thisMapi->mApiBogusReqCnt++;            semGive( thisMapi->semMapiMutex );            mApiOspfError(("ospf_mApi_setReqCnt:bogus request!\n"));            return ERROR;    }    /* unlock the semaphore */    semGive( thisMapi->semMapiMutex );    return OK;}/**************************************************************************************** ospf_mApi_areaIndexSet - set the next index value for ospfAreaTable** This routine set the next index value for the request for the ospfAreaTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_areaIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfArea_t *pArea;    pArea = (mApiOspfArea_t *)pRow;    /* ospfAreaTable is indexed by ospfAreaId */    ospf_mApi_ipAddr2IpIndex( pArea->ospfAreaId, &pRequest->pInstance[0] );    pRequest->instanceLen = OSPF_AREA_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_stubIndexSet - set the next index value for ospfStubTable** This routine set the next index value for the request for the ospfStubTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_stubIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfStub_t *pStub;    pStub = (mApiOspfStub_t *)pRow;    /* ospfStubTable is indexed by ospfStubAreaId and ospfStubTOS */    ospf_mApi_ipAddr2IpIndex( pStub->ospfStubAreaId, &pRequest->pInstance[0] );    pRequest->pInstance[4] = pStub->ospfStubTOS;    pRequest->instanceLen = OSPF_STUB_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_lsdbIndexSet - set the index value for ospfLsdbTable** This routine set the next index value for the request for the ospfLsdbTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_lsdbIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfLsdb_t *pLsdb;    pLsdb = (mApiOspfLsdb_t *)pRow;    /* ospfLsdbTable is indexed by ospfLsdbAreaId, ospfLsdbType, ospfLsdbLsid and     * ospfLsdbRouterId     */    ospf_mApi_ipAddr2IpIndex( pLsdb->ospfLsdbAreaId, &pRequest->pInstance[0] );    pRequest->pInstance[4] = (int)pLsdb->ospfLsdbType;    ospf_mApi_ipAddr2IpIndex( pLsdb->ospfLsdbLsid, &pRequest->pInstance[5] );    ospf_mApi_ipAddr2IpIndex( pLsdb->ospfLsdbRouterId, &pRequest->pInstance[9] );    pRequest->instanceLen = OSPF_LSDB_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_hostIndexSet - set the next index value for ospfHostTable** This routine set the next index value for the request for the ospfHostTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_hostIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfHost_t *pHost;    pHost = (mApiOspfHost_t *)pRow;    /* ospfHostTable is indexed by ospfHostIpAddress and ospfHostTOS */    ospf_mApi_ipAddr2IpIndex( pHost->ospfHostIpAddress, &pRequest->pInstance[0] );    pRequest->pInstance[4] = pHost->ospfHostTOS;    pRequest->instanceLen = OSPF_HOST_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_ifIndexSet - set the next index value for ospfIfTable** This routine set the next index value for the request for the ospfIfTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_ifIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfIf_t *pIf;    pIf = (mApiOspfIf_t *)pRow;    /* ospfIfTable is indexed by ospfIfIpAddress and ospfAddressLessIf */    ospf_mApi_ipAddr2IpIndex( pIf->ospfIfIpAddress, &pRequest->pInstance[0] );    pRequest->pInstance[4] = pIf->ospfAddressLessIf;    pRequest->instanceLen = OSPF_INTF_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_ifMetricIndexSet - set the next index value for ospfIfMetricTable** This routine set the next index value for the request for the ospfIfMetricTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_ifMetricIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfIfMetric_t *pIfm;    pIfm = (mApiOspfIfMetric_t *)pRow;    /* ospfIfMetricTable is indexed by ospfIfMetricIpAddress, ospfIfMetricAddressLessIf     * and ospfIfMetricTOS     */    ospf_mApi_ipAddr2IpIndex( pIfm->ospfIfMetricIpAddress, &pRequest->pInstance[0] );    pRequest->pInstance[4] = pIfm->ospfIfMetricAddressLessIf;    pRequest->pInstance[5] = pIfm->ospfIfMetricTOS;    pRequest->instanceLen = OSPF_METRIC_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_virtIfIndexSet - set the next index value for ospfVirtIfTable** This routine set the next index value for the request for the ospfVirtIfTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_virtIfIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfVirtIf_t *pVirtIf;    pVirtIf = (mApiOspfVirtIf_t *)pRow;    /* ospfVirtIfTable is indexed by ospfVirtIfAreaId and ospfVirtIfNeighbor */    ospf_mApi_ipAddr2IpIndex( pVirtIf->ospfVirtIfAreaId, &pRequest->pInstance[0] );    ospf_mApi_ipAddr2IpIndex( pVirtIf->ospfVirtIfNeighbor, &pRequest->pInstance[4] );    pRequest->instanceLen = OSPF_VIRT_INTF_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_nbrIndexSet - set the next index value for ospfNbrTable** This routine set the next index value for the request for the ospfNbrTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_nbrIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfNbr_t *pNbr;    pNbr = (mApiOspfNbr_t *)pRow;    /* ospfNbrTable is indexed by ospfNbrIpAddr and ospfNbrAddressLessIndex */    ospf_mApi_ipAddr2IpIndex( pNbr->ospfNbrIpAddr, &pRequest->pInstance[0] );    pRequest->pInstance[4] = pNbr->ospfNbrAddressLessIndex;    pRequest->instanceLen = OSPF_NBR_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_virtNbrIndexSet - set the next index value for ospfVirtNbrTable** This routine set the next index value for the request for the ospfVirtNbrTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_virtNbrIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfVirtNbr_t *pVirtNbr;    pVirtNbr = (mApiOspfVirtNbr_t *)pRow;    /* ospfVirtNbrTable is indexed by */    ospf_mApi_ipAddr2IpIndex( pVirtNbr->ospfVirtNbrArea, &pRequest->pInstance[0] );    ospf_mApi_ipAddr2IpIndex( pVirtNbr->ospfVirtNbrRtrId, &pRequest->pInstance[4] );    pRequest->instanceLen = OSPF_VIRT_NBR_INSTANCE_LEN;    return;}/**************************************************************************************** ospf_mApi_extLsdbIndexSet - set the next index value for ospfExtLsdbTable** This routine set the next index value for the request for the ospfExtLsdbTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_extLsdbIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfExtLsdb_t *pExtLsdb;    pExtLsdb = (mApiOspfExtLsdb_t *)pRow;    /* wrnOspfExtLsdbTable is indexed by wrnOspfExtLsdbType, wrnOspfExtLsdbLsid and     * wrnOspfExtLsdbRouterId     */    pRequest->pInstance[0] = (int)pExtLsdb->ospfExtLsdbType;    ospf_mApi_ipAddr2IpIndex( pExtLsdb->ospfExtLsdbLsid, &pRequest->pInstance[1] );    ospf_mApi_ipAddr2IpIndex( pExtLsdb->ospfExtLsdbRouterId, &pRequest->pInstance[5] );    pRequest->instanceLen = OSPF_EXT_LSDB_INSTANCE_LEN;    return;}/****************************************************************************************  ospf_mApi_areaAggregateIndexSet- set the next index value for ospfAreaAggregateTable** This routine set the next index value for the request for the ospfAreaAggregateTable** RETURNS: OK or ERROR** NOMANUAL*/LOCAL void ospf_mApi_areaAggregateIndexSet( void *pRow, mApiRequest_t *pRequest ){    mApiOspfAreaAggregate_t  *pAreaAg;    pAreaAg = (mApiOspfAreaAggregate_t *)pRow;    /* ospfAreaAggregateTable is indexed by ospfAreaAggregateAreaID,     * ospfAreaAggregateLsdbType, ospfAreaAggregateNet, and ospfAreaAggregateMask     */    ospf_mApi_ipAddr2IpIndex( pAreaAg->ospfAreaAggregateAreaID, &pRequest->pInstance[0] );    pRequest->pInstance[4] = (int)pAreaAg->ospfAreaAggregateLsdbType;    ospf_mApi_ipAddr2IpIndex( pAreaAg->ospfAreaAggregateNet, &pRequest->pInstance[5] );    ospf_mApi_ipAddr2IpIndex( pAreaAg->ospfAreaAggregateMask, &pRequest->pInstance[9] );    pRequest->instanceLen = OSPF_AREA_AGGREGATE_INSTANCE_LEN;    return;}/**************************************************************************************** wrnOspf_mApi_areaIndexSet - set the next index value for wrnOspfAreaTable** This routine set the next index value for the request for the wrnOspfAreaTable** RETURNS: OK or ERROR*

⌨️ 快捷键说明

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