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

📄 ospf_mib_utilities.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
    return rc;}/***************************************************************************************** ospf_mApi_sendRequest - Invoke the proper MIB API function based on the reqType** This routine invokes the proper MIB API function based on the reqType. The value * pointed to by pObjInfo->objectPrefixEnum is the unique enumeration value for the* objects in the RFC1850 OSPF-MIB defined by the MIB API.** RETURNS: OK or ERROR** NOMANUAL*/LOCAL STATUS ospf_mApi_sendRequest(  mApiRequest_t *pRequest, mApiReqType_t reqType,                                     ospfMibList_t *pObjInfo ) {    mApiObject_t  *pReqObj;    ulong_t       *pInstance;    char          oidIndex[OSPF_INSTANCE_LEN_MAX*4];    STATUS rc;    rc = OK;    pReqObj = pRequest->pObjectList;    pInstance = pRequest->pInstance;    memset( oidIndex, 0, sizeof(oidIndex) );    /* figure out what to do... */    if ( (pReqObj->oidPrefixEnum >= mApiOspfRouterId) &&          (pReqObj->oidPrefixEnum <= mApiOspfDemandExtensions) )    {        /* validate the given OID length. Scalar object is equivalent to a table with          * one column and one row. Thus, the expected oidLen will be one         */        /* rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType, 1 ); */        /* invoke the ospf_mApi_xxxGenGroup() routine for ospfGeneralGroup objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetGenGroup,                                      ospfMapiSetGenGroup );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%i", 0 );            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {             /* format the display string */            sprintf( oidIndex, "%i", 0 );            /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfAreaId) &&               (pReqObj->oidPrefixEnum <= mApiOspfAreaStatus) )    {           /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_AREA_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxArea() routine for ospfAreaTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetArea,                                       ospfMapiSetArea );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfStubAreaId) &&              (pReqObj->oidPrefixEnum <= mApiOspfStubMetricType) )    {          /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_STUB_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxStub() routine for ospfStubTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetStub,                                       ospfMapiSetStub );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfLsdbAreaId) &&              (pReqObj->oidPrefixEnum <= mApiOspfLsdbAdvertisement) )     {          /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_LSDB_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxLsdb() routine for ospfLsdbTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetLsdb, NULL );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld:%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld",                      pInstance[0], pInstance[1], pInstance[2], pInstance[3],                      pInstance[4], pInstance[5], pInstance[6], pInstance[7],                      pInstance[8], pInstance[9], pInstance[10], pInstance[11],                      pInstance[12]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld:%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld",                      pInstance[0], pInstance[1], pInstance[2], pInstance[3],                      pInstance[4], pInstance[5], pInstance[6], pInstance[7],                      pInstance[8], pInstance[9], pInstance[10], pInstance[11],                      pInstance[12]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfHostIpAddress) &&              (pReqObj->oidPrefixEnum <= mApiOspfHostAreaID) )    {        /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_HOST_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxHost() routine for ospfHostTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetHost,                                       ospfMapiSetHost );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfIfIpAddress) &&              (pReqObj->oidPrefixEnum <= mApiOspfIfAuthType) )    {           /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_INTF_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxIf() routine for ospfIfTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetIf, ospfMapiSetIf );        if ( (rc == ERROR)&& (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfIfMetricIpAddress) &&              (pReqObj->oidPrefixEnum <= mApiOspfIfMetricStatus) )    {           /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_METRIC_INSTANCE_LEN );                if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxIfMetric() routine for ospfIfMetricTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetIfMetric,                                      ospfMapiSetIfMetric );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4], pInstance[5]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld.%ld", pInstance[0], pInstance[1],                      pInstance[2], pInstance[3], pInstance[4], pInstance[5]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex, pReqObj->pValueBuf );            }            else            {                ospf_mApi_printException( pObjInfo, oidIndex, pReqObj->exception );            }        }    }    else if ( (pReqObj->oidPrefixEnum >= mApiOspfVirtIfAreaId) &&              (pReqObj->oidPrefixEnum <= mApiOspfVirtIfAuthType) )     {           /* validate the given OID length */        rc = ospf_mApi_oidValidate( pRequest->instanceLen, reqType,                                     OSPF_VIRT_INTF_INSTANCE_LEN );        if ( rc == MAPI_WRONG_OID_LEN )            return rc;        /* invoke the ospf_mApi_xxxVirtIf() routine for ospfVirtIfTable objects */        rc = ospf_mApi_requestHelper( pRequest, reqType, ospfMapiGetVirtIf,                                      ospfMapiSetVirtIf );        if ( (rc == ERROR) && (pRequest->error != MAPI_NO_ERROR) )        {            /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld",                      pInstance[0], pInstance[1], pInstance[2], pInstance[3],                      pInstance[4], pInstance[5], pInstance[6], pInstance[7]);            /* diplay the error */            ospf_mApi_printError( pObjInfo, oidIndex, pRequest->error );        }        else if ( (reqType != MAPI_COMPLETE) && (reqType != MAPI_TEST) )        {                       /* format the display string */            sprintf( oidIndex, "%ld.%ld.%ld.%ld.%ld.%ld.%ld.%ld",                      pInstance[0], pInstance[1], pInstance[2], pInstance[3],                      pInstance[4], pInstance[5], pInstance[6], pInstance[7]);                        /* display the result */            if ( pReqObj->exception == MAPI_NO_EXCEPTION )             {                ospf_mApi_printResult( pObjInfo, oidIndex,

⌨️ 快捷键说明

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