📄 snmp1473.c
字号:
/* snmp1473.c - snmp v1 RFC 1473 routines *//* Copyright 1984-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01a,13apr00,abd created*//*DESCRIPTIONMethod routines implementing RFC 1473:Method routines for the pppIpTable:pppIpOperStatus -- read-onlyThe operational status of the IP networkprotocol. If the value of this object is upthen the finite state machine for the IPnetwork protocol has reached the Opened state.Make1473pppIpLocalToRemoteCompressionProtocol -- read-onlyThe IP compression protocol that the localPPP-IP entity uses when sending packets to theremote PPP-IP entity. The value of this objectis meaningful only when the link has reachedthe open state (pppIpOperStatus is opened).pppIpRemoteToLocalCompressionProtocol -- read-onlyThe IP compression protocol that the remotePPP-IP entity uses when sending packets to thelocal PPP-IP entity. The value of this objectis meaningful only when the link has reachedthe open state (pppIpOperStatus is opened).pppIpRemoteMaxSlotId -- read-onlyThe Max-Slot-Id parameter that the remote nodehas advertised and that is in use on the link.If vj-tcp header compression is not in use onthe link then the value of this object shall be0. The value of this object is meaningful onlywhen the link has reached the open state(pppIpOperStatus is opened).pppIpLocalMaxSlotId -- read-onlyThe Max-Slot-Id parameter that the local nodehas advertised and that is in use on the link.If vj-tcp header compression is not in use onthe link then the value of this object shall be0. The value of this object is meaningful onlywhen the link has reached the open state(pppIpOperStatus is opened).Method routines for the pppIpConfigTable:pppIpConfigAdminStatus -- read-writeThe immediate desired status of the IP networkprotocol. Setting this object to open willinject an administrative open event into the IPnetwork protocol's finite state machine.Setting this object to close will inject anadministrative close event into the IP networkprotocol's finite state machine.pppIpConfigCompression -- read-writeIf none(1) then the local node will notattempt to negotiate any IP Compression option.Otherwise, the local node will attempt tonegotiate compression mode indicated by theenumerated value. Changing this object willhave effect when the link is next restarted.INCLUDE FILES: ppp/m2pppLib.h ppp/m2pppIpcpGroup.h ppp/interfaces/ipcpInterfaces.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 <leaf1473.h>#include <snmp1473.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/m2pppIpcpGroup.h"#include "ppp/interfaces/ipcpInterfaces.h"#include "ppp/pppInterfaces.h"#include "stdio.h"#include "vxWorks.h"/* typedefs */typedef struct pppIpConfigEntryPresetData { VB_T * pGroupHead; PPP_IPCP_ENTRY_DATA referenceData; UINT8 previousPppIpConfigAdminStatus; UINT8 previousPppIpConfigCompression; } PPP_IP_CONFIG_ENTRY_PRESET_DATA; /* defines */#define pppIpEntry_INSTANCE_LEN 1 /* Number of pppIpConfigEntry * oid components */#define pppIpConfigEntry_INSTANCE_LEN 1 /* Number of pppIpConfigEntry * oid components *//* locals *//* externs *//* forward declarations */LOCAL void pppIpEntryInfoGet ( OIDC_T lastmatch, SNMP_PKT_T * pktp, VB_T * vbp, PPP_IPCP_ENTRY_DATA * pData );LOCAL void pppIpConfigEntryInfoGet ( OIDC_T lastmatch, SNMP_PKT_T * pktp, VB_T * vbp, PPP_IPCP_ENTRY_DATA * pData );LOCAL void pppIpConfigEntrySetUndo ( OIDC_T lastmatch, int compc, OIDC_T * compl, SNMP_PKT_T * pktp, VB_T * vbp );/**************************************************************************** pppIpEntryInfoGet - populate packet pppIpTable varbinds** RETURNS N/A** NOMANUAL*/LOCAL void pppIpEntryInfoGet ( OIDC_T lastmatch, /* leaf subidentifier */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp, /* varbind pointer */ PPP_IPCP_ENTRY_DATA * pData /* internal data structure pointer */ ) { switch(lastmatch) { case LEAF_pppIpOperStatus: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpOperStatusGet)) (pData->state)); /* Values: * opened(1) * not-opened(2) */ return; case LEAF_pppIpLocalToRemoteCompressionProtocol: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpLocalToRemoteCompressionProtocolGet)) (pData->state)); /* Values: * none(1) * vj-tcp(2) */ return; case LEAF_pppIpRemoteToLocalCompressionProtocol: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpRemoteToLocalCompressionProtocolGet)) (pData->state)); /* Values: * none(1) * vj-tcp(2) */ return; case LEAF_pppIpRemoteMaxSlotId: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpRemoteMaxSlotIdGet)) (pData->state)); /* Values: * integer 0..255 */ return; case LEAF_pppIpLocalMaxSlotId: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpLocalMaxSlotIdGet)) (pData->state)); /* Values: * integer 0..255 */ return; default: getproc_error(pktp, vbp, GEN_ERR); return; } }/**************************************************************************** pppIpEntryGet - Get routine for pppIpEntry columnar objects** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppIpEntry) and the * leaf subindentifier. In our case the table pppIpTable is indexed by* only one index, the index being ifIndex which is not a leaf value.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left * and it is the index values array.** RETURNS N/A*/void pppIpEntryGet ( OIDC_T lastmatch, /* leaf subindentifier */ int compc, /* should be 1 */ OIDC_T * compl, /* pointer to ifIndex */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp /* varbind list head */ ) { PPP_IPCP_ENTRY_DATA data; UINT32 ifIndex; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); if ((compc != 1) || (NULL == compl)) { for ( ; vbp; vbp = vbp->vb_link) { getproc_nosuchins(pktp, vbp); } return; } ifIndex = *compl; /* so that *compl will be const i.e. unaltered after the call */ if (m2pppIpcpEntryLookup(compc, &ifIndex, &data, M2_PPP_ENTRY_EXACT_MATCH) /* use the instance (compc and compl) to look up the entry */ != OK) { for ( ; vbp; vbp = vbp->vb_link) { getproc_nosuchins(pktp, vbp); } } else { /* retrieve all the values from the same data structure */ for ( ; vbp; vbp = vbp->vb_link) { pppIpEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); } } return; }/**************************************************************************** pppIpEntryNext - GetNext routine for pppIpEntry columnar objects** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppIpEntry) and the * leaf subindentifier. In our case the table pppIpTable is indexed by* only one index, the index being ifIndex which is not a leaf value.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -