static BOOL mib2IfEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind, AsnInteger32 *pErrorStatus) { AsnObjectIdentifier entryOid = DEFINE_OID(mib2IfEntry); BOOL ret = TRUE; TRACE("(0x%02x, %s, %p)\n", bPduType, SnmpUtilOidToA(&pVarBind->name), pErrorStatus); switch (bPduType) { case SNMP_PDU_GET: case SNMP_PDU_GETNEXT: if (!ifTable) { /* There is no interface present, so let the caller deal * with finding the successor. */ *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; } else { UINT tableIndex = 0, item = 0; *pErrorStatus = getItemAndIntegerInstanceFromOid(&pVarBind->name, &entryOid, bPduType, &item, &tableIndex); if (!*pErrorStatus) { assert(tableIndex); assert(item); if (tableIndex > ifTable->dwNumEntries) *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; else { *pErrorStatus = mapStructEntryToValue(mib2IfEntryMap, DEFINE_SIZEOF(mib2IfEntryMap), &ifTable->table[tableIndex - 1], item, pVarBind); if (bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItemAndInteger(&pVarBind->name, &entryOid, item, tableIndex); } } } break; case SNMP_PDU_SET: *pErrorStatus = SNMP_ERRORSTATUS_READONLY; ret = FALSE; break; default: FIXME("0x%02x: unsupported PDU type\n", bPduType); *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; } return ret; }
static BOOL mib2IpNetQuery(BYTE bPduType, SnmpVarBind *pVarBind, AsnInteger32 *pErrorStatus) { AsnObjectIdentifier myOid = DEFINE_OID(mib2IpNet); TRACE("(0x%02x, %s, %p)\n", bPduType, SnmpUtilOidToA(&pVarBind->name), pErrorStatus); switch (bPduType) { case SNMP_PDU_GET: case SNMP_PDU_GETNEXT: if (!ipNetTable) *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; else { UINT tableIndex = 0, item = 0; *pErrorStatus = getItemAndIntegerInstanceFromOid(&pVarBind->name, &myOid, bPduType, &item, &tableIndex); if (!*pErrorStatus) { assert(tableIndex); assert(item); if (tableIndex > ipNetTable->dwNumEntries) *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; else { *pErrorStatus = mapStructEntryToValue(mib2IpNetMap, DEFINE_SIZEOF(mib2IpNetMap), &ipNetTable[tableIndex - 1], item, bPduType, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) setOidWithItemAndInteger(&pVarBind->name, &myOid, item, tableIndex); } } } break; case SNMP_PDU_SET: *pErrorStatus = SNMP_ERRORSTATUS_READONLY; break; default: FIXME("0x%02x: unsupported PDU type\n", bPduType); *pErrorStatus = SNMP_ERRORSTATUS_NOSUCHNAME; } return TRUE; }