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

📄 ospf_mib_wrn_stub.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 4 页
字号:
void wrnOspf_envoy_destroy( void ){    wrnOspfEnvoyInitDone = FALSE;    if ( pWrnEnvoyReq != NULL )    {        /* when removing subtrees from the agent MIB-tree, do it in the reserve order.         * First remove the ospf-mib subtree, then the wrsRoutingProto subtree, and         * lastly the wrs subtree         */        ospf_envoy_snmpdTreeRemove( "1.3.6.1.4.1.731.100.1", pWrnEnvoyReq->envoyBSem );        ospf_envoy_snmpdTreeRemove( "1.3.6.1.4.1.731.100", pWrnEnvoyReq->envoyBSem );        ospf_envoy_mApiDestroy( pWrnEnvoyReq );    }    return;}/***************************************************************************************** ospfEnvoyWrnInit - initialize OSPF Envoy Management Facilities.** This routine initialize the facilities for managing the WRN OSPF Enterprise MIB. The* initial resources are allocated.** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS ospfEnvoyWrnInit( void ){    STATUS rc;    /* check if the wrnOspf-envoy facility has been initialized */    if ( wrnOspfEnvoyInitDone == TRUE )    {        ospfEnvoyPrintf(("ospfEnvoyWrnInit:already inited\n"));        return OK;    }    pWrnEnvoyReq = ospf_envoy_mApiInit( MAX_WRN_OSPF_MIB_OBJECTS );    if ( pWrnEnvoyReq == NULL )    {        ospfEnvoyPrintf(("ospfEnvoyWrnInit:resource unavailable\n"));        return ERROR;    }    /* first, dynamically add oid_wrnRoutingProto to the SNMP agenet MIB tree */    rc = ospf_envoy_snmpdTreeAdd( "1.3.6.1.4.1.731.100", &n_wrnRoutingProto,                                  pWrnEnvoyReq->envoyBSem );    /* then, dynamically add the ospf-mib subtree to the SNMP agent MIB tree */    rc = ospf_envoy_snmpdTreeAdd( "1.3.6.1.4.1.731.100.1", &n_wrnOspf,                                  pWrnEnvoyReq->envoyBSem );    /* tell 'em that we are ready */    wrnOspfEnvoyInitDone = TRUE;    ospfEnvoyPrintf(("ospfEnvoyWrnInit:completed\n"));    return OK;}/**************************************************************************************** wrnOspfGeneralGroup_get - get method routine for wrnOspfGeneralGroup scalar objects** This routine process the SNMP GET request for the WRN OSPF Enterprise MIB General* Group scalar objects. This routine is called to find the specified instance of the* object and, if the instance exists, to install the value into the vbr varbind.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfGeneralGroup_get( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                              SNMP_PKT_T *pktp, VB_T *vbp ){    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* check that the instance is exactly .0 */    if (!((tcount == 1) && (*tlist == 0)))    {        for ( ; vbp; vbp = vbp->vb_link)            getproc_nosuchins(pktp, vbp);        return;    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* look up the instance */    wrnOspfEnvoy_getGeneralGroup( tcount, tlist, pktp, vbp, MAPI_GET );    semGive( pWrnEnvoyReq->envoyBSem );}/**************************************************************************************** wrnOspfGeneralGroup_next - next method routine for wrnOspfGeneralGroup scalar objects** This routine process the SNMP GET_NEXT request for the WRN OSPF Enterprise MIB* General Group scalar objects.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfGeneralGroup_next( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                               SNMP_PKT_T *pktp, VB_T *vbp ){    /* the only time there's a next for a scalar is if we're given no instance at all */    if (tcount != 0)    {        nextproc_no_next(pktp, vbp);        return;    }    /* find all the varbinds in this group that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* use the instance (tcount and tlist) to look up the next smallest instance     * that is larger than tcount/tlist.     */    wrnOspfEnvoy_getGeneralGroup( tcount, tlist, pktp, vbp, MAPI_GET_NEXT );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfGeneralGroup_test - test method routine for wrnOspfGeneralGroup scalar objects** This routine is the fist phase of the SNMP SET request for WRN OSPF Enterprise MIB* General Group scalar objects. This routine is called to validate instances that need* to be set, which may or may not actually exist.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfGeneralGroup_test( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                               SNMP_PKT_T *pktp, VB_T *vbp ){    /* Only scalar variables here, check for .0 */    if (!((tcount == 1) && (*tlist == 0)))    {        testproc_error(pktp, vbp, NO_SUCH_NAME);        return;    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    wrnOspfEnvoy_setGeneralGroup( tcount, tlist, pktp, vbp, MAPI_TEST );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfGeneralGroup_set - set method routine for wrnOspfGeneralGroup scalar objects** This routine is the second phase of the SNMP SET request for OSPF Enterprise MIB* General Group scalar objects. This routine is called to set instances that have been* previously test.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfGeneralGroup_set( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                              SNMP_PKT_T *pktp, VB_T *vbp ){    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    wrnOspfEnvoy_setGeneralGroup( tcount, tlist, pktp, vbp, MAPI_COMMIT );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** ospfAreaEntry_get - get method routine for wrnOspfAreaTable** This routine process the SNMP GET request for the WRN OSPF Enterprise MIB Area Table.* This routine is called to find the specified instance of the object and, if the* instance exists, to install the value into the vbr varbind.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfAreaEntry_get( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                           SNMP_PKT_T *pktp, VB_T *vbp ){    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    if ( tcount != wrnOspfAreaEntry_INSTANCE_LEN )    {        for ( ; vbp; vbp = vbp->vb_link)            getproc_nosuchins (pktp, vbp);        return;    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* look up the instance */    wrnOspfEnvoy_getArea( tcount, tlist, pktp, vbp, MAPI_GET );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfAreaEntry_next - next method routine for wrnOspfAreaTable** This routine process the SNMP GET_NEXT request for the WRN OSPF Enterprise MIB Area* Table. This routine is called to locate a variable whose instance is the SNMP* lexicographic successor for the input object identifier, which may or may not actually* exist within this object.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfAreaEntry_next( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                            SNMP_PKT_T *pktp, VB_T *vbp ){    OIDC_T    best_inst[wrnOspfAreaEntry_INSTANCE_LEN];    unsigned  best_inst_len;    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* copy instance portion into a buffer. This buffer will be used to return     * the next instance by the mib api.     */    memset( (char *)best_inst, 0, sizeof(OIDC_T)*wrnOspfAreaEntry_INSTANCE_LEN );    best_inst_len = vbp->vb_ml.ml_remaining_objid.num_components;    if ( best_inst_len != 0 )    {        copy_oids( best_inst, vbp->vb_ml.ml_remaining_objid.component_list,                    best_inst_len );    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* use the instance (tcount and tlist) to look up the next smallest instance     * that is larger than tcount/tlist.     */    wrnOspfEnvoy_getArea( best_inst_len, best_inst, pktp, vbp, MAPI_GET_NEXT );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfLsdbEntry_get - get method routine for wrnOspfLsdbTable** This routine process the SNMP GET request for the WRN OSPF Enterprise MIB LSDB Table.* This routine is called to find the specified instance of the object and, if the* instance exists, to install the value into the vbr varbind.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfLsdbEntry_get( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                           SNMP_PKT_T *pktp, VB_T *vbp ){    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    if ( tcount != wrnOspfLsdbEntry_INSTANCE_LEN )    {        for ( ; vbp; vbp = vbp->vb_link)            getproc_nosuchins (pktp, vbp);        return;    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* look up the instance */    wrnOspfEnvoy_getLsdb( tcount, tlist, pktp, vbp, MAPI_GET );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfLsdbEntry_next - next method routine for wrnOspfLsdbTable** This routine process the SNMP GET_NEXT request for the WRN OSPF Enterprise MIB LSDB* Table. This routine is called to locate a variable whose instance is the SNMP* lexicographic successor for the input object identifier, which may or may not actually* exist within this object.** RETURNS: N/A** ERRNO: N/A**/void wrnOspfLsdbEntry_next( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                            SNMP_PKT_T *pktp, VB_T *vbp ){    OIDC_T    best_inst[wrnOspfLsdbEntry_INSTANCE_LEN];    unsigned  best_inst_len;    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* copy instance portion into a buffer. This buffer will be used to return     * the next instance by the mib api.     */    memset( (char *)best_inst, 0, sizeof(OIDC_T)*wrnOspfLsdbEntry_INSTANCE_LEN );    best_inst_len = vbp->vb_ml.ml_remaining_objid.num_components;    if ( best_inst_len != 0 )    {        copy_oids( best_inst, vbp->vb_ml.ml_remaining_objid.component_list,                    best_inst_len );    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* use the instance (tcount and tlist) to look up the next smallest instance     * that is larger than tcount/tlist.     */    wrnOspfEnvoy_getLsdb( best_inst_len, best_inst, pktp, vbp, MAPI_GET_NEXT );    semGive( pWrnEnvoyReq->envoyBSem );}/**************************************************************************************** wrnOspfLocalLsdbEntry_get - get method routine for wrnOspfLocalLsdbTable** This routine process the SNMP GET request for the WRN OSPF Enterprise MIB Local LSDB* Table. This routine is called to find the specified instance of the object and, if the* instance exists, to install the value into the vbr varbind.** RETURNS: N/A** ERRNO: N/A*/void wrnOspfLocalLsdbEntry_get( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                                SNMP_PKT_T *pktp, VB_T *vbp ){    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    if ( tcount != wrnOspfLocalLsdbEntry_INSTANCE_LEN )    {        for ( ; vbp; vbp = vbp->vb_link)            getproc_nosuchins (pktp, vbp);        return;    }    /* lock binary semaphore so that we can synchronization into envoy snmp */    semTake( pWrnEnvoyReq->envoyBSem, WAIT_FOREVER );    /* look up the instance */    wrnOspfEnvoy_getLocalLsdb( tcount, tlist, pktp, vbp, MAPI_GET );    semGive( pWrnEnvoyReq->envoyBSem );    return;}/**************************************************************************************** wrnOspfLocalLsdbEntry_next - next method routine for wrnOspfLocalLsdbTable** This routine process the SNMP GET_NEXT request for the WRN OSPF Enterprise MIB Local* LSDB Table. This routine is called to locate a variable whose instance is the SNMP* lexicographic successor for the input object identifier, which may or may not actually* exits within this object.** RETURNS: N/A** ERRNO: N/A**/void wrnOspfLocalLsdbEntry_next( OIDC_T lastmatch, int tcount, OIDC_T *tlist,                                 SNMP_PKT_T *pktp, VB_T *vbp ){

⌨️ 快捷键说明

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