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

📄 ospf_mib_wrn_helper.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
/* wrn_ospf_mApiHelper.c - Management Interface Helper routines for WRN-OSPF MIB *//* Copyright 1998-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------02t,04jun03,asr Changed back to use system memory instead of OSPF memory partition02s,02jun03,ram Changed native memory usage to OSPF memory partition02r,09may03,kc  Fixed SPR#88389 - added wrnOspf_mApi_findExtRouteByProtoId().                Modified mApi2Ospf_configRedistributeOpts() to walk the                ospfExtLsdbTable avl tree when a route redistribution option                is changed from 'true' to 'false'.02q,28may03,agi Changed type of mutexAcquired to STATUS02p,27may03,kc  Fixed SPR#88309 - modified mApi2Ospf_configRedistributeOpts()                to take into account if the ospfASBdrRtrStatus has changed                and to read routing table only if at least one of the route                redistribution is configured.02o,14may03,agi Changed RWOS semaphores to vxWorks semaphores02n,28feb03,kc  Fixed SPR#86505 - modified per new mibApi.h header file updates.                 Renamed MAPI_COMMIT_FORCE and MAPI_GET_NVM mApiReqType_t request type                to MAPI_COMMIT_FORCE and MAPI_GET_FORCE respectively.02m,25feb03,kc  Fixed SPR#86385 - modified all wrnOspf_mApi_xxxRowCreate(),                 wrnOspf_mApi_xxxRowAccess() and wrnOspf_mApi_xxxHelperSet() to                return proper SNMPv2 error code using OSPF_MIB_ERROR_SET() macro.02l,07feb03,kc  Fixed SPR#86144 - removed the mApiReqType_t argument from all the                wrnOspf_mApi_xxxHelperCreate() routines. Also modified all                wrnOspf2Mapi_xxx_create() routines by removing the mApi request type                parameter from the call to the wrnOspf_mApi_xxxHelperCreate().02k,31jan03,kc  Fixed SPR#86006 - modified all the ospf_mApi_xxxHelperSet() routines                 to invoke avlDelete() to remove the row created from the avl tree.02j,19nov02,mwv Merge TMS code SPR 8428402i,08oct02,agi Fixed compiler warnings02h,18aug02,kc  Fixed SPR#79496 - Modified wrnOspf2Mapi_area_update() to convert                 area checksumSum value to host order.02g,09aug02,kc  Fixed wrnOspf_mApi_ifRowCreate() and wrnOspf_mApi_ifHelperCreate()                to correctly handle unnumbered interface configuration.02f,30may02,kc  Fixed PR #2078 - Modified mApi2Ospf_configRedistributeOpts() to                invoke the routine ospf_sysctl_rtableWalk() if necessary.02e,21may02,kc  Fixed wrnOspf_mApi_ifHelperSet() to extract the object cookie data                from the request message. Added the isLastColObject parameter to                the rsRowStatusSet() function call.02d,18apr02,kc  Fixed SPR #74523 - Modified mApi2Ospf_configWrnGenGroup() to                reinitialize all the interfaces whenever the opaque capability                is changed.02c,18apr02,kc  Fixed SPR #74432 - Added mApi2Ospf_configRedistributeOpts().                Simplified mApi2Ospf_configWrnGenGroup() to invoke this function.                Removed ASBR status check for mApiWrnOspfOpaqueLsaSupport in                wrnOspf_mApi_globalParmSet().02b,15apr02,kc  Modified wrnOspf_mApi_globalParmSet() to set the dynamicConfig                flag for (all) route dsitribution option(s) if the router is                configured as ASBR. Modified wrnOspf_mApi_initGenGroup() to                set wrnOspfRedistributeDefaultRoutes to false (default value).02a,10apr02,kc  Changed wrnOspf_mApi_ifHelperSet() to explicitly delete the row                created if error encountered during the validation phase.01z,10apr02,kc  Merged fixes for wrnOspf_mApi_ifHelperCreate() - removed                wrnOspfIfDstIpAddress and wrnOspfIfIndex check.01x,10apr02,kc  Remerged changes for wrnOspfIfTable to support unnumbered interface.01w,02apr02,kc  Removed unnecessary semTake() and semGive() calls from                wrnOspf2Mapi_lsdb_flush(), wrnOspf2Mapi_localLsdb_flush() and                wrnOspf2Mapi_extLsdb_flush().01v,07feb02,kc  Modified wrnOspf_mApi_initGeneralGroup() to set the                ospfRFC1583Compatibility object to true (by default).01u,04feb02,kc  Added configuration for route redistribution capability to                mApi2Ospf_configWrnGenGroup().01t,04feb02,kc  Modified wrnOspf_mApi_globalParmGet(), wrnOspf_mApi_globalParmSet()                and wrnOspf_mApi_initGeneralGroup() to support the                wrnOspfRedistributeDefaultRoutes, wrnOspfRedistributeStaticRoutes,                wrnOspfRedistributeRIPRoutes and wrnOspfRedistributeBGPRoutes                scalar objects.01s,18jan02,kc  Fixed bug in wrnOspf2Mapi_extLsdb_create() - allow instance to be                created if not already existed.01r,16jan02,kc  Added wrnOspf2Mapi_lsdb_create(), wrnOspf2Mapi_localLsdb_create() and                wrnOspf2Mapi_extLsdb_create(). Modified wrnOspf2Mapi_lsdb_update(),                wrnOspf2Mapi_localLsdb_update() and wrnOspf2Mapi_extLsdb_update() to                drop the update request if instance not found.01q,17dec01,kc  Fixed wrnOspf_mApi_flushAllLsas(). Added wrnOspf2Mapi_area_flush(),                wrnOspf2Mapi_lsdb_flush(), wrnOspf2Mapi_localLsdb_flush() and                wrnOspf2Mapi_extLsdb_flush().01p,15dec01,kc  Fixed wrnOspf_mApi_globalParmSet() to set dynamicConfig boolean flag                only if ospf protocol is enabled.01o,14dec01,kc  Fixed wrnOspf_mApi_initGeneralGroup().01m,10dec01,kc  Added wrnOspfMapiAreaCompare(), wrnOspfMapiType11LsaCompare() and                wrnOspfMapiType11LsaCompare() AVL compare routines.01l,10dec01,kc  Fixed index values problems in wrnOspf2Mapi_localLsdb_update() and                wrnOspf2Mapi_localLsdb_delete().01k,07dec01,kc  Really fixed byte ordering problems.01j,06dec01,kc  Changed semTake for semMapiMutex mutex to use timeout (was wait                forever) so that the overrun receive queue can be recovered.01i,12nov01,kc  Fixed byte ordering problems.01h,24oct01,kc  Added explicit typecast when assigning value of valueBuf to                lsdbLen (defined as ushort_t).01g,21oct01,kc  Added mApi2Ospf_configWrnGenGroup() and wrnOspf_mApi_flushAllLsas()                routines.01f,18oct01,kc  Modified wrnOspfMapiType9LsaCompare() routine per changes made to                ospfMapiOidCompare() function.01e,16oct01,kc  Added refgen documentation for module description.01d,15oct01,kc  Modified wrnOspf2Mapi_xxx_update() to allow node to be allocated if                max capacity not reached. No longer preallocate memory pool at init.01c,13oct01,kc  Added various wrnOspf2Mapi_xxx_delete() routines.01b,13oct01,kc  Added various wrnOspf2Mapi_xxx_update() routines.01a,08oct01,kc  Initial file creation.*//*DESCRIPTIONThis module contains various helper routines used to support the ospf_mib_api. Thismodule is specific to WRN OSPF Enterprise MIB and it encapsulates the details for howto access the tabular/scalar objects in the WRN OSPF MIB.  All method routines in thismodules are private to the ospf_mib_api and shall not be used by any other applications.User shall not try to invoke routines in this module from the WindSh.This module assumes that all the tabular objects in the WRN OSPF MIB are stored in theAVL trees which are initialized and created by the ospf_mib_api. It uses the RowStatuslibrary that implements the row access logic to determine if a SET request is allowed.All routines in this module do not have any inherent locking requirements for accessingthe tabular objects in the AVL tree. It is assumed that the ospf_mib_api will providesuch locking mechanism.*//* This include is here to get rid of "empty file" compiler warning */#include <vxWorks.h>#if defined (__OSPF_MIB__)/* VxWorks standard includes */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <semLib.h>#include <lstLib.h>#include <avlLib.h>/* WindNet OSPF includes */#include "ospf.h"#include "ospf_enums.h"#if defined (__OSPF_VIRTUAL_STACK__)#include "ospf_vs_lib.h"#endif /* __OSPF_VIRTUAL_STACK__ *//* management interface includes */#include "mibApi.h"#include "rowStatusLib.h"#include "ospf_mib_helper_update.h"#include "ospf_mib_helper.h"#include "ospf_mib_api.h"#include "ospf_mib_wrn_helper.h"/* SPR#88389 - error code returned by wrnOspf_mApi_findExtRouteByProtoId() if * a self-originated external route matches the given route proto ID is found */#define EXTERNAL_ROUTE_FOUND  -2/* public data */IMPORT mApiOspfTrueValue_t ospf2Mapi_bool2TrueValueGet( BOOL flag );IMPORT void mApi2Ospf_forceIfInit( mApiOspfTrueValue_t lockMutex );IMPORT struct ifnet* dstaddr_to_ifp(struct in_addr addr);/* private data */LOCAL int wrnOspfMapiIfCompare( void * node, GENERIC_ARGUMENT key );/* SPR#88389 - this constant is only used locally and must not be used by  * any other application. */LOCAL const ulong_t M2_ipRouteProto_default = 0;/********** Callback functions invoked by AVL to compare two instances **********//***************************************************************************************** wrnOspfMapiAreaCompare - compare two area instances** This routine is invoked by AVL to compares two area instances index values.* Node is a node on the given AVL tree. Key is the search criteria provided by the* mib api when invoking the avl routines.** RETURNS: An integer greater than, equal to, or less than 0, according*          to whether <s1> is lexicographically greater than, equal to,*          or less than <s2>, respectively.** ERRNO: N/A** NOMANUAL*/LOCAL int wrnOspfMapiAreaCompare( void * node, GENERIC_ARGUMENT key ){    mApiWrnOspfArea_t  *pArea;    ulong_t            mibIndex[OSPF_AREA_INSTANCE_LEN];    int                oidLength;    pArea = (mApiWrnOspfArea_t *)node;    oidLength = OSPF_AREA_INSTANCE_LEN;    /* reconstruct the index values for ospfAreaTable. ospfAreaTable is indexed by     * ospfAreaId     */    memset( mibIndex, 0, sizeof(mibIndex) );    ospf_mApi_ipAddr2IpIndex( pArea->wrnOspfAreaId, &mibIndex[0] );    return ospfMapiOidCompare( oidLength, (ulong_t *)key.p, mibIndex );}/***************************************************************************************** wrnOspfMapiType9LsaCompare - compare two Type-9 Opaque lsa instances** This routine is invoked by AVL to compares two type-9 Opaque lsa instances index* values. Node is a node on the given AVL tree. Key is the search criteria provided by* the mib api when invoking the avl routines.** RETURNS: An integer greater than, equal to, or less than 0, according*          to whether <s1> is lexicographically greater than, equal to,*          or less than <s2>, respectively.** ERRNO: N/A** NOMANUAL*/LOCAL int wrnOspfMapiType9LsaCompare( void * node, GENERIC_ARGUMENT key ){    mApiWrnOspfLocalLsdb_t  *pLocalLsdb;    ulong_t                 mibIndex[OSPF_LOCAL_LSDB_INSTANCE_LEN];    int                     oidLength;    pLocalLsdb = (mApiWrnOspfLocalLsdb_t *)node;    oidLength = OSPF_LOCAL_LSDB_INSTANCE_LEN;    /* reconstruct the index values for wrnOspfLocalLsdbTable. wrnOspfLocalLsdbTable is      * indexed by wrnOspfLocalLsdbAreaId, wrnOspfLocalLsdbType, wrnOspfLocalLsdbLsid and      * wrnOspfLocalLsdbRouterId     */    memset( mibIndex, 0, sizeof(mibIndex) );    ospf_mApi_ipAddr2IpIndex( pLocalLsdb->wrnOspfLocalLsdbAreaId, &mibIndex[0] );    ospf_mApi_ipAddr2IpIndex( pLocalLsdb->wrnOspfLocalLsdbIpAddress, &mibIndex[4] );    mibIndex[8] = pLocalLsdb->wrnOspfLocalLsdbType;    ospf_mApi_ipAddr2IpIndex( pLocalLsdb->wrnOspfLocalLsdbLsid, &mibIndex[9] );    ospf_mApi_ipAddr2IpIndex( pLocalLsdb->wrnOspfLocalLsdbRouterId, &mibIndex[13] );    return ospfMapiOidCompare( oidLength, (ulong_t *)key.p, mibIndex );}/***************************************************************************************** wrnOspfMapiType10LsaCompare - compare two Type-10 Opaque lsa instances** This routine is invoked by AVL to compares two type-10 Opaque lsa instances index* values. Node is a node on the given AVL tree. Key is the search criteria provided by* the mib api when invoking the avl routines.** RETURNS: An integer greater than, equal to, or less than 0, according*          to whether <s1> is lexicographically greater than, equal to,*          or less than <s2>, respectively.** ERRNO: N/A** NOMANUAL*/LOCAL int wrnOspfMapiType10LsaCompare( void * node, GENERIC_ARGUMENT key ){     mApiWrnOspfLsdb_t  *pLsdb;    ulong_t            mibIndex[OSPF_LSDB_INSTANCE_LEN];    int                oidLength;    pLsdb = (mApiWrnOspfLsdb_t *)node;    oidLength = OSPF_LSDB_INSTANCE_LEN;    /* reconstruct the index values for wrnOspfLsdbTable. wrnOspfLsdbTable is indexed by     * wrnOspfLsdbAreaId, wrnOspfLsdbType, wrnOspfLsdbLsid and wrnOspfLsdbRouterId     */    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] );    return ospfMapiOidCompare( oidLength, (ulong_t *)key.p, mibIndex );}/***************************************************************************************** wrnOspfMapiType11LsaCompare - compare two Type-11 Opaque lsa instances** This routine is invoked by AVL to compares two type-10 Opaque lsa instances index* values. Node is a node on the given AVL tree. Key is the search criteria provided by* the mib api when invoking the avl routines.** RETURNS: An integer greater than, equal to, or less than 0, according*          to whether <s1> is lexicographically greater than, equal to,*          or less than <s2>, respectively.** ERRNO: N/A** NOMANUAL*/LOCAL int wrnOspfMapiType11LsaCompare( void * node, GENERIC_ARGUMENT key ){       mApiWrnOspfExtLsdb_t  *pExtLsdb;    ulong_t               mibIndex[OSPF_EXT_LSDB_INSTANCE_LEN];    int                   oidLength;    pExtLsdb = (mApiWrnOspfExtLsdb_t *)node;    oidLength = OSPF_EXT_LSDB_INSTANCE_LEN;    /* reconstruct the index values for wrnOspfExtLsdbTable. wrnOspfExtLsdbTable is indexed     * by wrnOspfExtLsdbType, wrnOspfExtLsdbLsid and wrnOspfExtLsdbRouterId     */    memset( mibIndex, 0, sizeof(mibIndex) );    mibIndex[0] = pExtLsdb->wrnOspfExtLsdbType;    ospf_mApi_ipAddr2IpIndex( pExtLsdb->wrnOspfExtLsdbLsid, &mibIndex[1] );    ospf_mApi_ipAddr2IpIndex( pExtLsdb->wrnOspfExtLsdbRouterId, &mibIndex[5] );    return ospfMapiOidCompare( oidLength, (ulong_t *)key.p, mibIndex );}/*************** Internal WRN-OSPF Enterprise MIB cleanup routines **************//*************************************************************************************** wrnOspf2Mapi_area_flush - flush all area instances from wrnOspfAreaTable*

⌨️ 快捷键说明

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