📄 snmp1472.c
字号:
/* snmp1472.c - snmp v1 RFC 1472 routines *//* Copyright 1984-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01b,09sep02,rp fixing compilation warnings01a,25apr00,abd created*//*DESCRIPTIONMethod routines implementing RFC 1473:Method routines for the pppSecurityConfigTable:pppSecurityConfigLink -- read-writeThe value of ifIndex that identifies the entryin the interface table that is associated withthe local PPP entity's link for which thisparticular security algorithm shall beattempted. A value of 0 indicates the defaultalgorithm - i.e., this entry applies to alllinks for which explicit entries in the tabledo not exist.pppSecurityConfigPreference -- read-writeThe relative preference of the securityprotocol identified bypppSecurityConfigProtocol. Security protocolswith lower values ofpppSecurityConfigPreference are tried beforeprotocols with higher values ofpppSecurityConfigPreference.pppSecurityConfigProtocol -- read-writeIdentifies the security protocol to beattempted on the link identified bypppSecurityConfigLink at the preference levelidentified by pppSecurityConfigPreference.pppSecurityConfigStatus -- read-writeSetting this object to the value invalid(1)has the effect of invalidating thecorresponding entry in thepppSecurityConfigTable. It is animplementation-specific matter as to whetherthe agent removes an invalidated entry from thetable. Accordingly, management stations mustbe prepared to receive tabular information fromagents that corresponds to entries notcurrently in use. Proper interpretation ofsuch entries requires examination of therelevant pppSecurityConfigStatus object.Method routines for the pppSecuritySecretsTable:pppSecuritySecretsLink -- read-onlyThe link to which this ID/Secret pair applies.By convention, if the value of this object is 0then the ID/Secret pair applies to all links.pppSecuritySecretsIdIndex -- read-onlya unique value for each ID/Secret pair thathas been defined for use on this link. Thisallows multiple ID/Secret pairs to be definedfor each link. How the local entity selectswhich pair to use is a local implementationdecision.pppSecuritySecretsDirection -- read-writeThis object defines the direction in which aparticular ID/Secret pair is valid. If thisobject is local-to-remote then the local PPPientity will use the ID/Secret pair whenattempting to authenticate the local PPP entityto the remote PPP entity. If this object isremote-to-local then the local PPP entity willexpect the ID/Secret pair to be used by theremote PPP entity when the remote PPP entityattempts to authenticate itself to the localPPP entity.pppSecuritySecretsProtocol -- read-writeThe security protocol (e.g. CHAP or PAP) towhich this ID/Secret pair applies.pppSecuritySecretsIdentity -- read-writeThe Identity of the ID/Secret pair. Theactual format, semantics, and use ofpppSecuritySecretsIdentity depends on theactual security protocol used. For example, ifpppSecuritySecretsProtocol ispppSecurityPapProtocol then this object willcontain a PAP Peer-ID. IfpppSecuritySecretsProtocol ispppSecurityChapMD5Protocol then this objectwould contain the CHAP NAME parameter.pppSecuritySecretsSecret -- read-writeThe secret of the ID/Secret pair. The actualformat, semantics, and use ofpppSecuritySecretsSecret depends on the actualsecurity protocol used. For example, ifpppSecuritySecretsProtocol ispppSecurityPapProtocol then this object willcontain a PAP Password. IfpppSecuritySecretsProtocol ispppSecurityChapMD5Protocol then this objectwould contain the CHAP MD5 Secret.pppSecuritySecretsStatus -- read-writeSetting this object to the value invalid(1)has the effect of invalidating thecorresponding entry in thepppSecuritySecretsTable. It is animplementation-specific matter as to whetherthe agent removes an invalidated entry from thetable. Accordingly, management stations mustbe prepared to receive tabular information fromagents that corresponds to entries notcurrently in use. Proper interpretation ofsuch entries requires examination of therelevant pppSecuritySecretsStatus object.INCLUDE FILES: ppp/m2pppLib.h ppp/m2pppSecurityConfig.h ppp/m2pppSecuritySecretsLib.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 <leaf1472.h>#include <snmp1472.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/m2pppSecurityConfig.h"#include "ppp/m2pppSecuritySecretsLib.h"#include "ppp/interfaces/lcpInterfaces.h"#include "ppp/pppInterfaces.h"#include "stdio.h"#include "vxWorks.h"/* typedefs */typedef struct pppSecurityConfigEntryPresetData { VB_T * pGroupHead; PPP_SECURITY_CONFIG_ENTRY_DATA referenceData; UINT32 previousPppSecurityConfigLink; UINT32 previousPppSecurityConfigPreference; PPP_SECURITY_PROTOCOL previousPppSecurityConfigProtocol; PPP_SECURITY_SECRETS_STATUS previousPppSecurityConfigStatus; } PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA;typedef struct pppSecuritySecretsEntryData { UINT32 link; UINT32 idIndex; PPP_SECURITY_SECRETS_DIRECTION direction; PPP_SECURITY_PROTOCOL protocol; char identity[256]; char secret[256]; PPP_SECURITY_SECRETS_STATUS status; } PPP_SECURITY_SECRETS_ENTRY_DATA; typedef struct pppSecuritySecretsEntryPresetData { VB_T * pGroupHead; BOOL entryPreExisted; UINT32 previousPppSecuritySecretsLink; UINT32 previousPppSecuritySecretsIdIndex; PPP_SECURITY_SECRETS_DIRECTION previousPppSecuritySecretsDirection; PPP_SECURITY_PROTOCOL previousPppSecuritySecretsProtocol; char previousPppSecuritySecretsIdentity[256]; char previousPppSecuritySecretsSecret[256]; PPP_SECURITY_SECRETS_DIRECTION * pPreviousTransferDirection; PPP_SECURITY_PROTOCOL * pPreviousTransferProtocol; char * pPreviousTransferIdentity; char * pPreviousTransferSecret; PPP_SECURITY_SECRETS_STATUS previousPppSecuritySecretsStatus; UINT32 newPppSecuritySecretsLink; UINT32 newPppSecuritySecretsIdIndex; PPP_SECURITY_SECRETS_DIRECTION newPppSecuritySecretsDirection; PPP_SECURITY_PROTOCOL newPppSecuritySecretsProtocol; char newPppSecuritySecretsIdentity[256]; char newPppSecuritySecretsSecret[256]; PPP_SECURITY_SECRETS_DIRECTION * pNewTransferDirection; PPP_SECURITY_PROTOCOL * pNewTransferProtocol; char * pNewTransferIdentity; char * pNewTransferSecret; PPP_SECURITY_SECRETS_STATUS newPppSecuritySecretsStatus; BOOL implicitRemoval; UINT32 removedPppSecuritySecretsLink; UINT32 removedPppSecuritySecretsIdIndex; PPP_SECURITY_SECRETS_DIRECTION removedPppSecuritySecretsDirection; PPP_SECURITY_PROTOCOL removedPppSecuritySecretsProtocol; char removedPppSecuritySecretsIdentity[256]; char removedPppSecuritySecretsSecret[256]; PPP_SECURITY_SECRETS_DIRECTION * pRemovedTransferDirection; PPP_SECURITY_PROTOCOL * pRemovedTransferProtocol; char * pRemovedTransferIdentity; char * pRemovedTransferSecret; PPP_SECURITY_SECRETS_STATUS removedPppSecuritySecretsStatus; } PPP_SECURITY_SECRETS_ENTRY_PRESET_DATA;/* defines */#define pppSecurityConfigEntry_INSTANCE_LEN 2 /* Number of pppIpConfigEntry * oid components */#define pppSecuritySecretsEntry_INSTANCE_LEN 2 /* Number of pppIpConfigEntry * oid components *//* locals *//* externs */OIDC_T pppSecurityPapProtocol_OID[11] = {1, 3, 6, 1, 2, 1, 10, 23, 2, 1, 1};OIDC_T pppSecurityChapMD5Protocol_OID[11] = {1, 3, 6, 1, 2, 1, 10, 23, 2, 1, 2};/* forward declarations */LOCAL void pppSecurityConfigEntryInfoGet ( OIDC_T lastmatch, SNMP_PKT_T * pktp, VB_T * vbp, PPP_SECURITY_CONFIG_ENTRY_DATA * pData );LOCAL void pppSecurityConfigEntrySetUndo ( OIDC_T lastmatch, int compc, OIDC_T * compl, SNMP_PKT_T * pktp, VB_T * vbp );LOCAL void pppSecuritySecretsEntrySetUndo ( OIDC_T lastmatch, int compc, OIDC_T * compl, SNMP_PKT_T * pktp, VB_T * vbp );/**************************************************************************** pppSecurityConfigEntryInfoGet - populate pppSecurityConfigTable varbinds** RETURNS N/A** NOMANUAL*/LOCAL void pppSecurityConfigEntryInfoGet ( OIDC_T lastmatch, /* leaf subidentifier */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp, /* varbind pointer */ PPP_SECURITY_CONFIG_ENTRY_DATA * pData /* internal data pointer */ ) { switch(lastmatch) { case LEAF_pppSecurityConfigLink: getproc_got_int32(pktp, vbp, pData->link); return; case LEAF_pppSecurityConfigPreference: getproc_got_int32(pktp, vbp, pData->preference); return; case LEAF_pppSecurityConfigProtocol: /* internally PAP == 1 and CHAP == 2 * PPP_SECURITY_PAP_PROTOCOL == 1 * PPP_SECURITY_CHAP_MD5_PROTOCOL == 2 * however the corresponding object identifiers are: * 1.3.6.1.2.1.10.23.2.1.1 == pppSecurityPapProtocol and * 1.3.6.1.2.1.10.23.2.1.2 == pppSecurityChapMD5Protocol */ /* if the data being returned is in dynamic storage and needs * to be free'd, change the 0 argument to a 1. */ if (PPP_SECURITY_PAP_PROTOCOL == pData->protocol) { getproc_got_object_id(pktp, vbp, 11, pppSecurityPapProtocol_OID, 0); } else if (PPP_SECURITY_CHAP_MD5_PROTOCOL == pData->protocol) { getproc_got_object_id(pktp, vbp, 11, pppSecurityChapMD5Protocol_OID, 0); } else { getproc_error(pktp, vbp, INCONSISTENT_VALUE); } return; case LEAF_pppSecurityConfigStatus: /* Values: * invalid(1) = VAL_pppSecurityConfigStatus_invalid * valid(2) = VAL_pppSecurityConfigStatus_valid */ getproc_got_int32(pktp, vbp, pData->status); return; default: getproc_error(pktp, vbp, GEN_ERR); return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -