📄 snmp1472.c
字号:
switch (VB_GET_INT32(group_vbp)) { case VAL_pppSecurityConfigStatus_invalid: if (entryDoesNotExist) { testproc_error(pktp, group_vbp, WRONG_VALUE); return; } else { (pPresetData->referenceData).status = PPP_SECURITY_SECRETS_STATUS_INVALID; break; } case VAL_pppSecurityConfigStatus_valid: (pPresetData->referenceData).status = PPP_SECURITY_SECRETS_STATUS_VALID; break; default: testproc_error(pktp, group_vbp, WRONG_VALUE); return; } testproc_good(pktp, group_vbp); break; default: testproc_error(pktp, group_vbp, GEN_ERR); return; } } if (entryDoesNotExist && (PPP_SECURITY_UNDEFINED_PROTOCOL == (pPresetData->referenceData).protocol)) { for (group_vbp = pGroupRepVarBind; group_vbp != NULL; group_vbp = group_vbp->vb_link) { testproc_error(pktp, group_vbp, WRONG_VALUE); } return; } return; }/**************************************************************************** pppSecurityConfigEntrySet - Set routine for pppSecurityconfigEntry ** 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 pppSecurityConfigEntry) and * the leaf subindentifier. In our case the table pppSecurityConfigTable* is indexed by pppSecurityConfigLink and pppSecurityConfigPreference.* 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.** We support implicit promotion so that a link has a pppSecurityConfigEntry* with preference zero at all times or no pppSecurityConfigEntry at all. ** RETURNS N/A*/void pppSecurityConfigEntrySet ( OIDC_T lastmatch, /* leaf subindentifier */ int compc, /* number of instance OID_T components */ OIDC_T * compl, /* pointer to OID_T variable array */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp /* varbind list head */ ) { PPP_SECURITY_CONFIG_ENTRY_DATA * pData; PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA * pPresetData; VB_T * pGroupRepVarBind; PFW_STACK_STATUS stackStatus; BOOL error; error = FALSE; /* Part of the input for the set operation is pointed by vbp->vb_priv; * It is expected (and we have implemented it above) that in testproc * we entered the same pointer in all varbinds of the same group. */ pPresetData = (PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA *)(vbp->vb_priv); pData = &(pPresetData->referenceData); /* vbp->vb_priv points to a PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA structure * with member a PPP_SECURITY_CONFIG_ENTRY_DATA structure */ /* It is our understanding that the Group Representative would * be the same for both calls of test and set and it would be the head * of the list of varbinds sharing procedure and instance and no clean * up will occur (i.e. vb_free_priv will not be called) before or while * undoproc is executed. BUT following defensive programming guidelines * we save the group representative pointer and we make certain that * we always start from the head of the list. */ pGroupRepVarBind = vbp = pPresetData->pGroupHead; /* snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl) was executed * in testproc. */ if ((pfwStackStatusGet(((pPresetData->referenceData).state)->stackObj, &stackStatus) != OK) || (stackStatus != PFW_STACK_READY)) { error = TRUE; goto returnPoint; } if (m2pppSecurityConfigEntrySet(pData) != OK) { error = TRUE; goto returnPoint; } else { error = FALSE; goto returnPoint; } returnPoint: /* we place the function pointer necessary to undo the set only on one * member of the group of the same SetPDU varbinds that share the same * pppSecurityConfigEntry instance. */ pGroupRepVarBind->undoproc = (UNDOPROC_T *) pppSecurityConfigEntrySetUndo; if (error) { /* we will mark ALL varbinds that share procedure and instance */ for (vbp = pGroupRepVarBind; vbp != NULL; vbp = vbp->vb_link) { setproc_error(pktp, vbp, COMMIT_FAILED); } } else { /* we will mark ALL varbinds that share procedure and instance */ for (vbp = pGroupRepVarBind; vbp != NULL; vbp = vbp->vb_link) { setproc_good(pktp, vbp); } } return; }/**************************************************************************** pppSecurityConfigEntrySetUndo - Undo for pppSecurityConfigEntry ** This function will be executed only ONCE for every group of varbinds * within the same SetPDU that refer to the same pppLinkConfigEntry instance. ** We support implicit promotion so that a link has a pppSecurityConfigEntry* with preference zero at all times or no pppSecurityConfigEntry at all. * However, no deletion occurs and we can support pppSecurityConfigEntrySetUndo.** RETURNS N/A** NOMANUAL*/LOCAL void pppSecurityConfigEntrySetUndo ( OIDC_T lastmatch, /* leaf subindentifier */ int compc, /* number of instance OID_T components */ OIDC_T * compl, /* pointer to OID_T variable array */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp /* varbind list head */ ) { PPP_SECURITY_CONFIG_ENTRY_DATA * pData; PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA * pPresetData; VB_T * pGroupRepVarBind; PFW_STACK_STATUS stackStatus; BOOL error; error = FALSE; /* Part of the input for the undo operation is pointed by vbp->vb_priv; * It is expected (and we have implemented it above) that in testproc * we entered the same pointer in all varbinds of the same group. */ pPresetData = (PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA *)(vbp->vb_priv); pData = &(pPresetData->referenceData); /* vbp->vb_priv points to a PPP_SECURITY_CONFIG_ENTRY_PRESET_DATA structure * with member a PPP_SECURITY_CONFIG_ENTRY_DATA structure */ /* It is our understanding that the Group Representative would * be the same for both calls of test and set and it would be the head * of the list of varbinds sharing procedure and instance and no clean * up will occur (i.e. vb_free_priv will not be called) before or while * undoproc is executed. BUT following defensive programming guidelines * we save the group representative pointer and we make certain that * we always start from the head of the list. */ pGroupRepVarBind = vbp = pPresetData->pGroupHead; /* snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl) was executed * in testproc. */ if ((pfwStackStatusGet((pData->state)->stackObj, &stackStatus) != OK) || (stackStatus != PFW_STACK_READY)) { error = TRUE; goto returnPoint; } pData->link = pPresetData-> previousPppSecurityConfigLink; pData->preference = pPresetData-> previousPppSecurityConfigPreference; pData->protocol = pPresetData-> previousPppSecurityConfigProtocol; pData->status = pPresetData-> previousPppSecurityConfigStatus; if (m2pppSecurityConfigEntrySet(pData) != OK) { error = TRUE; goto returnPoint; } else { error = FALSE; goto returnPoint; } returnPoint: /* we place the function pointer necessary to undo the set only on one * member of the group of the same SetPDU varbinds that share the same * pppSecurityConfigEntry instance. */ pGroupRepVarBind->undoproc = (UNDOPROC_T *) pppSecurityConfigEntrySetUndo; if (error) { /* we will mark ALL varbinds that share procedure and instance */ for (vbp = pGroupRepVarBind; vbp != NULL; vbp = vbp->vb_link) { undoproc_error(pktp, vbp, UNDO_FAILED); } } else { /* we will mark ALL varbinds that share procedure and instance */ for (vbp = pGroupRepVarBind; vbp != NULL; vbp = vbp->vb_link) { undoproc_good(pktp, vbp); } } return; }/**************************************************************************** pppSecuritySecretsEntryInfoGet - populate pppSecuritySecretsTable varbinds** RETURNS N/A** NOMANUAL*/void pppSecuritySecretsEntryInfoGet ( OIDC_T lastmatch, /* leaf subidentifier */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp, /* varbind pointer */ PPP_SECURITY_SECRETS_ENTRY_DATA * pData /* internal data pointer */ ) { int length; char * pChar; switch(lastmatch) { case LEAF_pppSecuritySecretsLink: getproc_got_int32(pktp, vbp, pData->link); return; case LEAF_pppSecuritySecretsIdIndex: getproc_got_int32(pktp, vbp, pData->idIndex); return; case LEAF_pppSecuritySecretsDirection: /* Values: * local-to-remote(1) * remote-to-local(2) */ getproc_got_int32(pktp, vbp, pData->direction); return; case LEAF_pppSecuritySecretsProtocol: /* 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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -