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

📄 snmp1471.c

📁 这是全套的PPP协议的源码
💻 C
📖 第 1 页 / 共 4 页
字号:
/* snmp1471.c - snmp v1 RFC 1471 routines *//* Copyright 1984-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01b,09sep02,rp  fix compilation warnings01a,19apr00,abd created*//*DESCRIPTIONMethod routines implementing RFC 1471:Method routines for the pppLinkStatusTable:pppLinkStatusPhysicalIndex -- read-onlyThe value of ifIndex that identifies thelower-level interface over which this PPP Linkis operating. This interface would usually bean HDLC or RS-232 type of interface. If thereis no lower-layer interface element, or thereis no ifEntry for the element, or the elementcan not be identified, then the value of thisobject is 0.  For example, suppose that PPP isoperating over a serial port. This would usetwo entries in the ifTable. The PPP could berunning over `interface' number 123 and theserial port could be running over `interface'number 987.  Therefore, ifSpecific.123 wouldcontain the OBJECT IDENTIFIER ppppppLinkStatusPhysicalIndex.123 would contain987, and ifSpecific.987 would contain theOBJECT IDENTIFIER for the serial-port's media-specific MIB.pppLinkStatusBadAddresses -- read-onlyThe number of packets received with anincorrect Address Field. This counter is acomponent of the ifInErrors variable that isassociated with the interface that representsthis PPP Link.pppLinkStatusBadControls -- read-onlyThe number of packets received on this linkwith an incorrect Control Field. This counteris a component of the ifInErrors variable thatis associated with the interface thatrepresents this PPP Link.pppLinkStatusPacketTooLongs -- read-onlyThe number of received packets that have beendiscarded because their length exceeded theMRU. This counter is a component of theifInErrors variable that is associated with theinterface that represents this PPP Link. NOTE,packets which are longer than the MRU but whichare successfully received and processed are NOTincluded in this count.pppLinkStatusBadFCSs -- read-onlyThe number of received packets that have beendiscarded due to having an incorrect FCS. Thiscounter is a component of the ifInErrorsvariable that is associated with the interfacethat represents this PPP Link.pppLinkStatusLocalMRU -- read-onlyThe current value of the MRU for the local PPPEntity. This value is the MRU that the remoteentity is using when sending packets to thelocal PPP entity. The value of this object ismeaningful only when the link has reached theopen state (ifOperStatus is up).pppLinkStatusRemoteMRU -- read-onlyThe current value of the MRU for the remotePPP Entity. This value is the MRU that thelocal entity is using when sending packets tothe remote PPP entity. The value of this objectis meaningful only when the link has reachedthe open state (ifOperStatus is up).pppLinkStatusLocalToPeerACCMap -- read-onlyThe current value of the ACC Map used forsending packets from the local PPP entity tothe remote PPP entity. The value of this objectis meaningful only when the link has reachedthe open state (ifOperStatus is up).pppLinkStatusPeerToLocalACCMap -- read-onlyThe ACC Map used by the remote PPP entity whentransmitting packets to the local PPP entity.The value of this object is meaningful onlywhen the link has reached the open state(ifOperStatus is up).pppLinkStatusLocalToRemoteProtocolCompression -- read-onlyIndicates whether the local PPP entity willuse Protocol Compression when transmittingpackets to the remote PPP entity. The value ofthis object is meaningful only when the linkhas reached the open state (ifOperStatus isup).pppLinkStatusRemoteToLocalProtocolCompression -- read-onlyIndicates whether the remote PPP entity willuse Protocol Compression when transmittingpackets to the local PPP entity. The value ofthis object is meaningful only when the linkhas reached the open state (ifOperStatus isup).pppLinkStatusLocalToRemoteACCompression -- read-onlyIndicates whether the local PPP entity willuse Address and Control Compression whentransmitting packets to the remote PPP entity.The value of this object is meaningful onlywhen the link has reached the open state(ifOperStatus is up).pppLinkStatusRemoteToLocalACCompression -- read-onlyIndicates whether the remote PPP entity willuse Address and Control Compression whentransmitting packets to the local PPP entity.The value of this object is meaningful onlywhen the link has reached the open state(ifOperStatus is up).pppLinkStatusTransmitFcsSize -- read-onlyThe size of the Frame Check Sequence (FCS) inbits that the local node will generate whensending packets to the remote node. The valueof this object is meaningful only when the linkhas reached the open state (ifOperStatus isup).pppLinkStatusReceiveFcsSize -- read-onlyThe size of the Frame Check Sequence (FCS) inbits that the remote node will generate whensending packets to the local node. The value ofthis object is meaningful only when the linkhas reached the open state (ifOperStatus isup).Method routines for the pppLinkConfigTable:pppLinkConfigInitialMRU -- read-writeThe initial Maximum Receive Unit (MRU) thatthe local PPP entity will advertise to theremote entity. If the value of this variable is0 then the local PPP entity will not advertiseany MRU to the remote entity and the defaultMRU will be assumed. Changing this object willhave effect when the link is next restarted.pppLinkConfigReceiveACCMap -- read-writeThe Asynchronous-Control-Character-Map (ACC)that the local PPP entity requires for use onits receive side. In effect, this is the ACCMap that is required in order to ensure thatthe local modem will successfully receive allcharacters. The actual ACC map used on thereceive side of the link will be a combinationof the local node's pppLinkConfigReceiveACCMapand the remote node'spppLinkConfigTransmitACCMap. Changing thisobject will have effect when the link is nextrestarted.pppLinkConfigTransmitACCMap -- read-writeThe Asynchronous-Control-Character-Map (ACC)that the local PPP entity requires for use onits transmit side. In effect, this is the ACCMap that is required in order to ensure thatall characters can be successfully transmittedthrough the local modem.  The actual ACC mapused on the transmit side of the link will be acombination of the local node'spppLinkConfigTransmitACCMap and the remotenode's pppLinkConfigReceiveACCMap. Changingthis object will have effect when the link isnext restarted.pppLinkConfigMagicNumber -- read-writeIf true(2) then the local node will attempt toperform Magic Number negotiation with theremote node. If false(1) then this negotiationis not performed. In any event, the local nodewill comply with any magic number negotiationsattempted by the remote node, per the PPPspecification. Changing this object will haveeffect when the link is next restarted.pppLinkConfigFcsSize -- read-writeThe size of the FCS, in bits, the local nodewill attempt to negotiate for use with theremote node. Regardless of the value of thisobject, the local node will comply with any FCSsize negotiations initiated by the remote node,per the PPP specification. Changing this objectwill have effect when the link is nextrestarted.INCLUDE FILES: ppp/m2pppLib.h ppp/m2pppLcpGroup.h ppp/interfaces/lcpInterfaces.h ppp/pppInterfaces.h*//* includes */#include <asn1conf.h>#include <asn1.h>#include <buffer.h>#include <mib.h>#include <snmpdefs.h>#include <snmp.h>#include <auxfuncs.h>#include <leaf1471.h>#include <snmp1471.h>#include <wrn/wm/snmp/vxagent/snmpdLib.h>#include "pfw/pfw.h"#include "pfw/pfwStack.h"#include "pfw/pfwTable.h"#include "pfw/pfwMemory.h"#include "ppp/m2pppLib.h"#include "ppp/m2pppLinkGroup.h"#include "ppp/interfaces/lcpInterfaces.h"#include "ppp/pppInterfaces.h"#include "stdio.h"#include "vxWorks.h"/* typedefs */typedef struct pppLinkConfigEntryPresetData    {    PPP_LINK_CONFIG_ENTRY_DATA      referenceData;    VB_T *                          pGroupHead;    /* all those implemented as 4 bytes integers */    ULONG                           previousPppLinkConfigInitialMRU;    ULONG                           previousPppLinkConfigReceiveACCMap;    ULONG                           previousPppLinkConfigTransmitACCMap;    ULONG                           previousPppLinkConfigMagicNumber;    ULONG                           previousPppLinkConfigFcsSize;    }   PPP_LINK_CONFIG_ENTRY_PRESET_DATA;/* defines */#define pppLinkStatusEntry_INSTANCE_LEN 1   /* Number of pppLinkConfigEntry                                              * oid components                                              */#define pppLinkConfigEntry_INSTANCE_LEN 1   /* Number of pppLinkConfigEntry                                              * oid components                                              *//* locals *//* externs *//* forward declarations */LOCAL void pppLinkStatusEntryInfoGet        (    OIDC_T                   lastmatch,    SNMP_PKT_T *             pktp,    VB_T *                   vbp,    PPP_LINK_STATUS_ENTRY_DATA *    pData    );LOCAL void pppLinkConfigEntryInfoGet        (    OIDC_T                   lastmatch,    SNMP_PKT_T *             pktp,    VB_T *                   vbp,    PPP_LINK_CONFIG_ENTRY_DATA *    pData    );LOCAL void pppLinkConfigEntrySetUndo    (    OIDC_T          lastmatch,     int             compc,    OIDC_T *        compl,    SNMP_PKT_T *    pktp,     VB_T *          vbp       );/**************************************************************************** pppLinkStatusEntryInfoGet - populate packet pppLinkStatusTable varbinds** RETURNS N/A** NOMANUAL*/LOCAL void pppLinkStatusEntryInfoGet    (    OIDC_T                       lastmatch, /* leaf subidentifier         */    SNMP_PKT_T *                 pktp,      /* packet pointer             */    VB_T *                       vbp,       /* varbind pointer            */    PPP_LINK_STATUS_ENTRY_DATA * pData      /* internal structure pointer */    )     {    /* compare types specified in RFC, with SNMP agent implementation input     * output types, and backend routines input output types.     */    OCTET_T * pOctet;   /* to be used for dynamic memory management */    UINT32 auxUINT32;   /* we will use this auxiliary UINT32 to translate to and                         * from external and internal ACCMap representations.                         */     int i;                  switch(lastmatch)         {        case LEAF_pppLinkStatusPhysicalIndex:            /* expected value: 0..2^(31)-1 */            getproc_got_int32(pktp,                               vbp,                               /* casting from UINT32 to INT_32_T */                              (INT_32_T)                              (*((pData->interface)->                                 pppLinkStatusPhysicalIndexGet))                              (pData->state));            break;        case LEAF_pppLinkStatusBadAddresses:            getproc_got_uint32(pktp,                                vbp,                               /* casting from UINT32 to UINT_32_T */                              (UINT_32_T)                              (*((pData->interface)->                                 pppLinkStatusBadAddressesGet))                              (pData->state),                              VT_COUNTER);            break;        case LEAF_pppLinkStatusBadControls:            getproc_got_uint32(pktp,                                vbp,                               /* casting from UINT32 to UINT_32_T */                              (UINT_32_T)                              (*((pData->interface)->                                 pppLinkStatusBadControlsGet))                              (pData->state),                              VT_COUNTER);            break;        case LEAF_pppLinkStatusPacketTooLongs:            getproc_got_uint32(pktp,                                vbp,                               /* casting from UINT32 to UINT_32_T */                              (UINT_32_T)                              (*((pData->interface)->                                 pppLinkStatusPacketTooLongsGet))                              (pData->state),                              VT_COUNTER);            break;        case LEAF_pppLinkStatusBadFCSs:            getproc_got_uint32(pktp,                                vbp,                               /* casting from UINT32 to UINT_32_T */                              (UINT_32_T)                              (*((pData->interface)->                                 pppLinkStatusBadFCSsGet))                              (pData->state),                              VT_COUNTER);            break;        case LEAF_pppLinkStatusLocalMRU:            /* expected value: 1..2^(31)-1 */            getproc_got_int32(pktp, 

⌨️ 快捷键说明

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