static BOOL mib2IpStatsQuery(BYTE bPduType, SnmpVarBind *pVarBind, AsnInteger32 *pErrorStatus) { AsnObjectIdentifier myOid = DEFINE_OID(mib2Ip); UINT item = 0; BOOL ret = TRUE; TRACE("(0x%02x, %s, %p)\n", bPduType, SnmpUtilOidToA(&pVarBind->name), pErrorStatus); switch (bPduType) { case SNMP_PDU_GET: case SNMP_PDU_GETNEXT: *pErrorStatus = getItemFromOid(&pVarBind->name, &myOid, bPduType, &item); if (!*pErrorStatus) { *pErrorStatus = mapStructEntryToValue(mib2IpMap, DEFINE_SIZEOF(mib2IpMap), &ipStats, item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItem(&pVarBind->name, &myOid, item); } 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 void setOidWithItemAndInteger(AsnObjectIdentifier *dst, AsnObjectIdentifier *base, UINT item, UINT instance) { AsnObjectIdentifier oid; setOidWithItem(dst, base, item); oid.idLength = 1; oid.ids = &instance; SnmpUtilOidAppend(dst, &oid); }
static INT setOidWithItemAndInteger(AsnObjectIdentifier *dst, AsnObjectIdentifier *base, UINT item, UINT instance) { AsnObjectIdentifier oid; INT ret; ret = setOidWithItem(dst, base, item); if (ret) { oid.idLength = 1; oid.ids = &instance; ret = SnmpUtilOidAppend(dst, &oid); } return ret; }
static void setOidWithItemAndIpAddr(AsnObjectIdentifier *dst, AsnObjectIdentifier *base, UINT item, DWORD addr) { UINT id; BYTE *ptr; AsnObjectIdentifier oid; setOidWithItem(dst, base, item); oid.idLength = 1; oid.ids = &id; for (ptr = (BYTE *)&addr; ptr < (BYTE *)&addr + sizeof(DWORD); ptr++) { id = *ptr; SnmpUtilOidAppend(dst, &oid); } }
static INT setOidWithItemAndIpAddr(AsnObjectIdentifier *dst, AsnObjectIdentifier *base, UINT item, DWORD addr) { UINT id; BYTE *ptr; AsnObjectIdentifier oid; INT ret; ret = setOidWithItem(dst, base, item); if (ret) { oid.idLength = 1; oid.ids = &id; for (ptr = (BYTE *)&addr; ret && ptr < (BYTE *)&addr + sizeof(DWORD); ptr++) { id = *ptr; ret = SnmpUtilOidAppend(dst, &oid); } } return ret; }