📄 snmp1473.c
字号:
* and it is the index values array.** RETURNS N/A*/void pppIpEntryNext ( 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; 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 (m2pppIpcpEntryLookup(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) { pppIpEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); nextIfIndex = pppLinkIdGet(data.stackObj); nextproc_next_instance(pktp, vbp, pppIpEntry_INSTANCE_LEN, &nextIfIndex); nextproc_good(pktp, vbp); } } return; }/**************************************************************************** pppIpConfigEntryInfoGet - populate packet pppIpConfigTable varbinds** RETURNS N/A** NOMANUAL*/LOCAL void pppIpConfigEntryInfoGet ( 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_pppIpConfigAdminStatus: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpConfigAdminStatusGet)) (pData->state)); /* Values: * open(1) * close(2) */ return; case LEAF_pppIpConfigCompression: getproc_got_int32(pktp, vbp, (*((pData->interface)-> ipcpConfigCompressionGet)) (pData->state)); /* Values: * none(1) * vj-tcp(2) */ return; default: getproc_error(pktp, vbp, GEN_ERR); return; } }/**************************************************************************** pppIpConfigEntryGet - Get routine for pppIpconfigEntry 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 pppIpConfigEntryGet ( 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) { pppIpConfigEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); } } return; }/**************************************************************************** pppIpConfigEntryNext - GetNext routine for pppIpconfigEntry 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 pppIpConfigEntryNext ( 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; 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 (m2pppIpcpEntryLookup(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) { pppIpConfigEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); nextIfIndex = pppLinkIdGet(data.stackObj); nextproc_next_instance(pktp, vbp, pppIpConfigEntry_INSTANCE_LEN, &nextIfIndex); nextproc_good(pktp, vbp); } } return; }/**************************************************************************** pppIpConfigEntryTest - Test routine for pppIpConfigEntry** RETURNS: N/A*/void pppIpConfigEntryTest ( 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_IP_CONFIG_ENTRY_PRESET_DATA * pPresetData; UINT32 ifIndex; pGroupRepVarBind = vbp; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); pPresetData = (PPP_IP_CONFIG_ENTRY_PRESET_DATA *) snmpdMemoryAlloc(sizeof(PPP_IP_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 (m2pppIpcpEntryLookup(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->previousPppIpConfigAdminStatus = (*((pPresetData->referenceData.interface)-> ipcpConfigAdminStatusGet)) (pPresetData->referenceData.state); pPresetData->previousPppIpConfigCompression = (*((pPresetData->referenceData.interface)-> ipcpConfigCompressionGet)) (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; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -