📄 snmp1471.c
字号:
case LEAF_pppLinkConfigMagicNumber: /* Values: * false(1) = VAL_pppLinkConfigMagicNumber_false * true(2) = VAL_pppLinkConfigMagicNumber_true */ getproc_got_int32 ( pktp, vbp, /* casting from ULONG to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkConfigMagicNumberGet)) (pData->state) ); break; case LEAF_pppLinkConfigFcsSize: /* expected value 1..128 */ getproc_got_int32(pktp, vbp, /* casting from ULONG to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkConfigFcsSizeGet)) (pData->state)); break; default: getproc_error(pktp, vbp, GEN_ERR); return; } }/**************************************************************************** pppLinkConfigEntryGet - Get routine for pppLinkConfigEntry 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 pppLinkConfigEntry) and the * leaf subindentifier. In our case the table pppLinkConfigTable 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 pppLinkConfigEntryGet ( 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_LINK_CONFIG_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 (m2pppLinkConfigEntryLookup(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) { pppLinkConfigEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); } } return; }/**************************************************************************** pppLinkConfigEntryNext - GetNext for pppLinkConfigEntry 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 pppLinkConfigEntry) and the * leaf subindentifier. In our case the table pppLinkConfigTable 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 pppLinkConfigEntryNext ( 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_LINK_CONFIG_ENTRY_DATA data; UINT32 ifIndex; OIDC_T nextIfIndex; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); ifIndex = (compl != NULL) ? *compl : 0; /* we accept compl == NULL; note that *compl will be const */ if (m2pppLinkConfigEntryLookup(compc, &ifIndex, &data, M2_PPP_ENTRY_NEXT_MATCH) /* use the instance (compc and compl) to look up the entry */ != OK) { for ( ; vbp; vbp = vbp->vb_link) { nextproc_no_next(pktp, vbp); } } else { /* retrieve all the values from the same data structure */ for ( ; vbp; vbp = vbp->vb_link) { pppLinkConfigEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); nextIfIndex = pppLinkIdGet(data.stackObj); nextproc_next_instance(pktp, vbp, pppLinkConfigEntry_INSTANCE_LEN, &nextIfIndex); nextproc_good(pktp, vbp); } } return; }/**************************************************************************** pppppLinkConfigEntryTest - Test routine for pppLinkConfigEntry** RETURNS: N/A*/void pppLinkConfigEntryTest ( 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 */ ) { VB_T * group_vbp; /* introduced by mibcomp */ VB_T * pGroupRepVarBind; /* introduced by programmer */ PPP_LINK_CONFIG_ENTRY_PRESET_DATA * pPresetData; UINT32 ifIndex; INT_32_T value; ALENGTH_T length; pGroupRepVarBind = vbp; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); pPresetData = (PPP_LINK_CONFIG_ENTRY_PRESET_DATA *) snmpdMemoryAlloc(sizeof(PPP_LINK_CONFIG_ENTRY_PRESET_DATA)); pPresetData->pGroupHead = pGroupRepVarBind = vbp; if ((compc != 1) || (NULL == compl)) { for (group_vbp = vbp; group_vbp != NULL; group_vbp = group_vbp->vb_link) { testproc_error(pktp, group_vbp, NO_SUCH_NAME); } return; } ifIndex = *compl; /* so that *compl will be const i.e. unaltered after the call */ if (m2pppLinkConfigEntryLookup(compc, &ifIndex, /* use the instance (compc and compl) * to look up the entry */ &(pPresetData->referenceData), M2_PPP_ENTRY_EXACT_MATCH) != OK) { for (group_vbp = vbp; group_vbp != NULL; group_vbp = group_vbp->vb_link) { testproc_error(pktp, group_vbp, NO_SUCH_NAME); } return; } else { pPresetData->previousPppLinkConfigInitialMRU = (*((pPresetData->referenceData.interface)-> pppLinkConfigInitialMRUGet)) (pPresetData->referenceData.state); pPresetData->previousPppLinkConfigReceiveACCMap = (*((pPresetData->referenceData.interface)-> pppLinkConfigReceiveACCMapGet)) (pPresetData->referenceData.state); pPresetData->previousPppLinkConfigTransmitACCMap = (*((pPresetData->referenceData.interface)-> pppLinkConfigTransmitACCMapGet)) (pPresetData->referenceData.state); pPresetData->previousPppLinkConfigMagicNumber = (*((pPresetData->referenceData.interface)-> pppLinkConfigMagicNumberGet)) (pPresetData->referenceData.state); pPresetData->previousPppLinkConfigFcsSize = (*((pPresetData->referenceData.interface)-> pppLinkConfigFcsSizeGet)) (pPresetData->referenceData.state); /* assign to all relative varbinds the same private data */ for (group_vbp = vbp; group_vbp != NULL; group_vbp = group_vbp->vb_link) { group_vbp->vb_priv = (PTR_T) pPresetData; } /* but only to one assign memory management */ pGroupRepVarBind->vb_free_priv = (VBPRIVPROC_T *) snmpVbPrivFree; } /* now check validity of the value fields of each varbind */ for (group_vbp = vbp; group_vbp != NULL; group_vbp = group_vbp->vb_link) { switch (group_vbp->vb_ml.ml_last_match) { case LEAF_pppLinkConfigInitialMRU: value = (ULONG)VB_GET_INT32(group_vbp); /* These are the ranges from the MIB. * Modify if your implementation differs. */ if (!((value >= MIN_pppLinkConfigInitialMRU) && (value <= MAX_pppLinkConfigInitialMRU))) { testproc_error(pktp, group_vbp, WRONG_VALUE); } else { testproc_good(pktp, group_vbp); } break; case LEAF_pppLinkConfigReceiveACCMap: length = EBufferUsed(VB_GET_STRING(group_vbp)); /* These are the lengths from the MIB. * Modify if your implementation differs. */ if (length != SIZE_pppLinkConfigReceiveACCMap) { testproc_error(pktp, group_vbp, WRONG_VALUE); } else { testproc_good(pktp, group_vbp); } break; case LEAF_pppLinkConfigTransmitACCMap: length = EBufferUsed(VB_GET_STRING(group_vbp)); /* These are the lengths from the MIB. * Modify if your implementation differs. */ if (length != SIZE_pppLinkConfigTransmitACCMap) { testproc_error(pktp, group_vbp, WRONG_VALUE); } else { testproc_good(pktp, group_vbp); } break; case LEAF_pppLinkConfigMagicNumber: switch (VB_GET_INT32(group_vbp)) { case VAL_pppLinkConfigMagicNumber_false: case VAL_pppLinkConfigMagicNumber_true: break; default: testproc_error(pktp, group_vbp, WRONG_VALUE); continue; } testproc_good(pktp, group_vbp); break; case LEAF_pppLinkConfigFcsSize: value = VB_GET_INT32(group_vbp); /* These are the ranges from the MIB. * Modify if your implementation differs. */ if (!((value >= MIN_pppLinkConfigFcsSize) && (value <= MAX_pppLinkConfigFcsSize))) { testproc_error(pktp, group_vbp, WRONG_VALUE); } else { testproc_good(pktp, group_vbp); } break; default: testproc_error(pktp, group_vbp, GEN_ERR); return; } } return; }/**************************************************************************** pppLinkConfigEntrySet - Set routine for pppLinkconfigEntry 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 pppLinkEntry) and the * leaf subindentifier. In our case the table pppLinkTable 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.*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -