📄 ospf_mib_utilities.c
字号:
/* ospf_mib_utilities.c - utilities for OSPF version 2.0 Management Interface *//* Copyright 1998-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*Modification history--------------------01o,06may03,mwv Fixed SPR#88210 - replaced all import statements for mib display strings with ospf_mib_helper_show.h include statement.01p,28feb03,kc Fixed SPR#86505 - modified per new mibApi.h header file updates. Renamed MAPI_COMMIT_FORCE and MAPI_GET_FORCE mApiReqType_t request type to MAPI_COMMIT_FORCE and MAPI_GET_FORCE respectively.01o,28feb03,kc Fixed SPR#86502 - renamed INCLUDE_OSPF_SHOW_ROUTINES to INCLUDE_OSPF_MIB_SHOW_ROUTINES.01n,19nov02,mwv Merge TMS code SPR 8428401m,12nov02,kc Redefine MAPI_UTILS_INIT_CHECK macro to also check if the ospf mApi management facility is initialized.01l,09aug02,kc Added support for wrnOspfIfTable from WRN-OSPF Enterprise MIB.01k,17jun02,kc Added pObjCookie argument to ospf_mApi_buildRequest().01j,08may02,kc Fixed doc for refgen.01i,17apr02,kc Renamed ospf_mApi_utilsInit() to ospfMapiUtilitiesInit(); ospf_mApi_utilsDestroy() to ospfMapiUtilitiesDestroy(); ospf_mApi_set() to ospfMapiSet(); ospf_mApi_get() to ospfMapiGet(); ospf_mApi_getNext() to ospfMapiGetNext(); wrnOspf_mApi_get() to wrnOspfMapiGet(); wrnOspf_mApi_getNext() to wrnOspfMapiGetNext(); wrnOspf_mApi_set() to wrnOspfMapiSet()01h,15apr02,kc Added ospf_mApi_requestHelper() routine, thus, simplify the wrnOspf_mApi_sendRequest() and ospf_mApi_sendRequest() routines.01g,22feb02,kc Fixed callout to OSPF MIB API as a result of function name changes.01f,04feb02,kc Added support for wrnOspfRedistributeDefaultRoutes, wrnOspfRedistributeStaticRoutes, wrnOspfRedistributeRIPRoutes, and wrnOspfRedistributeBGPRoutes objects to the wrnOspfMibTableList lookup table.01e,12dec01,kc Modified ospf_mApi_sendRequest() and wrnOspf_mApi_sendRequest() to display the MIB API return error.01d,10dec01,kc Added ospf_mApi_objInfoGetNext() function.01c,10dec01,kc Added WRN-OSPF Enterprise MIB support.01b,06dec01,kc Fixed ospf_mApi_processSetRequest() - send IP Address in network byte order.01a,30nov01,kc Initial file creation.*//*DESCRIPTIONThis module provides various SNMP equivalent GET, GET NEXT and SET routines for theRFC1850 OSPF MIB and WRN OSPF Enterprise MIB. To use the facility provided by thismodule, this module must first be installed using ospfMapiUtilitiesInit(), which needs to be called after the OSPF MIB API facilities have been initialized. This facilitycan only be used if the OSPF MIB API facilities are also initialized.Currently, the following routines are provided:\csRFC1850 OSPF MIB: ospfMapiGet, ospfMapiGetNext, ospfMapiSetWRN OSPF Enterprise MIB: wrnOspfMapiGet, wrnOspfMapiGetNext, wrnOspfMapiSet\ce*//* This include is here to get rid of the "empty file" compiler warning */#include <vxWorks.h>#if defined(__OSPF_MIB__)/* VxWorks standard includes */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <semLib.h>#include <inetLib.h>#include <lstLib.h>#include <avlLib.h>/* management interface includes */#include "rowStatusLib.h"#include "mibApi.h"#include "ospf_mib_helper.h"#include "ospf_mib_helper_update.h"#include "ospf_mib_api.h"#include "ospf_mib_wrn_helper.h"#if defined(INCLUDE_OSPF_MIB_UTILITIES)/* all the display strings are defined in ospf_mib_helper_show.h. */#include "ospf_mib_helper_show.h"/* private data */#define OBJECT_NAME_LENGTH_MAX 32 /* max ospf-mib and wrn-ospf-mib object name */ #define OSPF_INSTANCE_LEN_MAX 17 /* max number of sub-ids in instance *//* internal error codes */#define MAPI_WRONG_OID_LEN 100/* pointer to the MIB API GET/SET request function */typedef STATUS (* OSPF_MAPI_FUNCPTR)( mApiRequest_t *pRequest, mApiReqType_t reqType );/* the following access type is defined in the mib */typedef enum{ read_only = 1, /* object is read-only */ read_write = 2, /* object is read-write */ read_create = 3, /* object is read-create */ obsolete /* object has obsolete */} ospfMibAccessType_t;/* the following object tag determines the length of the data */typedef enum { ospfMibTag_ipaddress, ospfMibTag_integer, ospfMibTag_counter, ospfMibTag_counter32, ospfMibTag_gauge, ospfMibTag_gauge32, ospfMibTag_octetString} ospfMibTag_t;/* the following alternate object tag is mainly for formatting the output */typedef enum{ ospfMibAltTag_none, /* no alternate tag */ ospfMibAltTag_rowStatus, /* rowStatus tag */ ospfMibAltTag_trueValue, /* true value tag */ ospfMibAltTag_status, /* status tag */ ospfMibAltTag_authType, /* authentication type tag */ ospfMibAltTag_ifState, /* interface state tag */ ospfMibAltTag_ifType, /* interface type tag */ ospfMibAltTag_lsdbType, /* link state database type tag */ ospfMibAltTag_octetString, /* link state advertisement octet strig */ ospfMibAltTag_nbrState, /* neighbor state tag */ ospfMibAltTag_asType, /* AS External type tag */ ospfMibAltTag_summaryType, /* area summary type tag */ ospfMibAltTag_stubMetricType, /* stub metric type tag */ ospfMibAltTag_mcastType, /* multicast type tag */ ospfMibAltTag_permanence, /* neighbor permanence tag */ ospfMibAltTag_extLsdbType, /* external lsdb type tag */ ospfMibAltTag_agType, /* area aggregation type tag */ ospfMibAltTag_agEffect, /* area aggregation effect type tag */ ospfMibAltTag_opaqueType /* opaque lsa type tag */} ospfMibAltTag_t;char *mApiRequestType[] = { "UNKNOWN", "GET", "GET NEXT", "TEST", "COMMIT", "UNDO", "COMPLETE", "TEST FORCE", "COMMIT NVM", "GET NVM" };char *ospfMibTagStr[] = { "ipaddress", "integer", "couter", "counter32", "gauge", "gauge32", "octetString"};typedef struct ospfMibList{ /* object name as specified in the MIB */ char objectName[OBJECT_NAME_LENGTH_MAX]; int objectPrefixEnum; /* object prefix enumeration value */ ospfMibTag_t objectTag; /* object tag */ ospfMibAltTag_t objectAltTag; /* object alternate tag */ ospfMibAccessType_t objectAccessType; /* object access type */ } ospfMibList_t;/* RFC1850 OSPF-MIB lookup table */LOCAL ospfMibList_t ospfMibTableList[] ={ /* ospfGeneralGroup */ {"ospfRouterId", (int)mApiOspfRouterId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_write}, {"ospfAdminStat", (int)mApiOspfAdminStat, ospfMibTag_integer, ospfMibAltTag_status, read_write}, {"ospfVersionNumber", (int)mApiOspfVersionNumber, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfAreaBdrRtrStatus", (int)mApiOspfAreaBdrRtrStatus, ospfMibTag_integer, ospfMibAltTag_trueValue, read_only}, {"ospfASBdrRtrStatus", (int)mApiOspfASBdrRtrStatus, ospfMibTag_integer, ospfMibAltTag_trueValue, read_write}, {"ospfExternLsaCount", (int)mApiOspfExternLsaCount, ospfMibTag_gauge, ospfMibAltTag_none, read_only}, {"ospfExternLsaCksumSum", (int)mApiOspfExternLsaCksumSum, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfTOSSupport", (int)mApiOspfTOSSupport, ospfMibTag_integer, ospfMibAltTag_trueValue, read_write}, {"ospfOriginateNewLsas", (int)mApiOspfOriginateNewLsas, ospfMibTag_counter, ospfMibAltTag_none, read_only}, {"ospfRxNewLsas", (int)mApiOspfRxNewLsas, ospfMibTag_counter, ospfMibAltTag_none, read_only}, {"ospfExtLsdbLimit", (int)mApiOspfExtLsdbLimit, ospfMibTag_integer, ospfMibAltTag_none, read_write}, {"ospfMulticastExtensions", (int)mApiOspfMulticastExtensions, ospfMibTag_integer, ospfMibAltTag_none, read_write}, {"ospfExitOverflowInterval", (int)mApiOspfExitOverflowInterval, ospfMibTag_integer, ospfMibAltTag_none, read_write}, {"ospfDemandExtensions", (int)mApiOspfDemandExtensions, ospfMibTag_integer, ospfMibAltTag_trueValue, read_write}, /* ospfAreaTable */ {"ospfAreaId", (int)mApiOspfAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfAuthType", (int)mApiOspfAuthType, ospfMibTag_integer, ospfMibAltTag_authType, obsolete}, {"ospfImportAsExtern", (int)mApiOspfImportAsExtern, ospfMibTag_integer, ospfMibAltTag_asType, read_create}, {"ospfSpfRuns", (int)mApiOspfSpfRuns, ospfMibTag_counter32, ospfMibAltTag_none, read_only}, {"ospfAreaBdrRtrCount", (int)mApiOspfAreaBdrRtrCount, ospfMibTag_gauge32, ospfMibAltTag_none, read_only}, {"ospfAsBdrRtrCount", (int)mApiOspfAsBdrRtrCount, ospfMibTag_gauge32, ospfMibAltTag_none, read_only}, {"ospfAreaLsaCount", (int)mApiOspfAreaLsaCount, ospfMibTag_gauge32, ospfMibAltTag_none, read_only}, {"ospfAreaLsaCksumSum", (int)mApiOspfAreaLsaCksumSum, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfAreaSummary", (int)mApiOspfAreaSummary, ospfMibTag_integer, ospfMibAltTag_summaryType, read_create}, {"ospfAreaStatus", (int)mApiOspfAreaStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, read_create}, /* ospfStubAtable */ {"ospfStubAreaId", (int)mApiOspfStubAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfStubTOS", (int)mApiOspfStubTOS, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfStubMetric", (int)mApiOspfStubMetric, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfStubStatus", (int)mApiOspfStubStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, read_create}, {"ospfStubMetricType", (int)mApiOspfStubMetricType, ospfMibTag_integer, ospfMibAltTag_stubMetricType, read_create}, /* ospfLsdbTable */ {"ospfLsdbAreaId", (int)mApiOspfLsdbAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfLsdbType", (int)mApiOspfLsdbType, ospfMibTag_integer, ospfMibAltTag_lsdbType, read_only}, {"ospfLsdbLsid", (int)mApiOspfLsdbLsid, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfLsdbRouterId", (int)mApiOspfLsdbRouterId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfLsdbSequence", (int)mApiOspfLsdbSequence, ospfMibTag_integer, ospfMibAltTag_none, read_only }, {"ospfLsdbAge", (int)mApiOspfLsdbAge, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfLsdbChecksum", (int)mApiOspfLsdbChecksum, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfLsdbAdvertisement", (int)mApiOspfLsdbAdvertisement, ospfMibTag_integer, ospfMibAltTag_octetString, read_only}, /* ospfAreaRangeTable (obsolete ) */ {"ospfAreaRangeAreaId", (int)mApiOspfAreaRangeAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, obsolete}, {"ospfAreaRangeNet", (int)mApiOspfAreaRangeNet, ospfMibTag_ipaddress, ospfMibAltTag_none, obsolete}, {"ospfAreaRangeMask", (int)mApiOspfAreaRangeMask, ospfMibTag_ipaddress, ospfMibAltTag_none, obsolete}, {"ospfAreaRangeStatus", (int)mApiOspfAreaRangeStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, obsolete}, {"ospfAreaRangeEffect", (int)mApiOspfAreaRangeEffect, ospfMibTag_integer, ospfMibAltTag_agEffect, obsolete}, /* ospfHostTable */ {"ospfHostIpAddress", (int)mApiOspfHostIpAddress, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfHostTOS", (int)mApiOspfHostTOS, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfHostMetric", (int)mApiOspfHostMetric, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfHostStatus", (int)mApiOspfHostStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, read_create}, {"ospfHostAreaID", (int)mApiOspfHostAreaID, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, /* ospfIfTable */ {"ospfIfIpAddress", (int)mApiOspfIfIpAddress, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfAddressLessIf", (int)mApiOspfAddressLessIf, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfIfAreaId", (int)mApiOspfIfAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_create}, {"ospfIfType", (int)mApiOspfIfType, ospfMibTag_integer, ospfMibAltTag_ifType, read_create}, {"ospfIfAdminStat", (int)mApiOspfIfAdminStat, ospfMibTag_integer, ospfMibAltTag_status, read_create}, {"ospfIfRtrPriority", (int)mApiOspfIfRtrPriority, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfTransitDelay", (int)mApiOspfIfTransitDelay, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfRetransInterval", (int)mApiOspfIfRetransInterval, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfHelloInterval", (int)mApiOspfIfHelloInterval, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfRtrDeadInterval", (int)mApiOspfIfRtrDeadInterval, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfPollInterval", (int)mApiOspfIfPollInterval, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfState", (int)mApiOspfIfState, ospfMibTag_integer, ospfMibAltTag_ifState, read_only}, {"ospfIfDesignatedRouter", (int)mApiOspfIfDesignatedRouter, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfIfBackupDesignatedRouter", (int)mApiOspfIfBackupDesignatedRouter, ospfMibAltTag_none, ospfMibTag_ipaddress, read_only}, {"ospfIfEvents", (int)mApiOspfIfEvents, ospfMibTag_counter, ospfMibAltTag_none, read_only}, {"ospfIfAuthKey", (int)mApiOspfIfAuthKey, ospfMibTag_octetString, ospfMibAltTag_none, read_create}, {"ospfIfStatus", (int)mApiOspfIfStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, read_create}, {"ospfIfMulticastForwarding", (int)mApiOspfIfMulticastForwarding, ospfMibTag_integer, ospfMibAltTag_mcastType, read_create}, {"ospfIfDemand", (int)mApiOspfIfDemand, ospfMibTag_integer, ospfMibAltTag_trueValue, read_create}, {"ospfIfAuthType", (int)mApiOspfIfAuthType, ospfMibTag_integer, ospfMibAltTag_authType, read_create}, /* ospfIfMetricTable */ {"ospfIfMetricIpAddress", (int)mApiOspfIfMetricIpAddress, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfIfMetricAddressLessIf", (int)mApiOspfIfMetricAddressLessIf, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfIfMetricTOS", (int)mApiOspfIfMetricTOS, ospfMibTag_integer, ospfMibAltTag_none, read_only}, {"ospfIfMetricValue", (int)mApiOspfIfMetricValue, ospfMibTag_integer, ospfMibAltTag_none, read_create}, {"ospfIfMetricStatus", (int)mApiOspfIfMetricStatus, ospfMibTag_integer, ospfMibAltTag_rowStatus, read_create}, /* ospfVirtIfTable */ {"ospfVirtIfAreaId", (int)mApiOspfVirtIfAreaId, ospfMibTag_ipaddress, ospfMibAltTag_none, read_only}, {"ospfVirtIfNeighbor", (int)mApiOspfVirtIfNeighbor, ospfMibTag_ipaddress,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -