X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=dll%2Fwin32%2Finetmib1%2Fmain.c;h=59d738959de3ed85b9ff8bdf1b9502bf4f2d8a51;hp=9aef4d5c5dc98497f9041def755d6879f21d4bad;hb=3d2c0a805bad287bfdbb625577f95a7a14455552;hpb=1b3dfd946f73f2de8fdf569f7c047c4725d12a76 diff --git a/dll/win32/inetmib1/main.c b/dll/win32/inetmib1/main.c index 9aef4d5c5dc..59d738959de 100644 --- a/dll/win32/inetmib1/main.c +++ b/dll/win32/inetmib1/main.c @@ -21,6 +21,9 @@ #include #include #include + +#define NONAMELESSUNION + #include "windef.h" #include "winbase.h" #include "snmp.h" @@ -59,7 +62,7 @@ struct structToAsnValue }; static AsnInteger32 mapStructEntryToValue(struct structToAsnValue *map, - UINT mapLen, void *record, UINT id, BYTE bPduType, SnmpVarBind *pVarBind) + UINT mapLen, void *record, UINT id, SnmpVarBind *pVarBind) { /* OIDs are 1-based */ if (!id) @@ -640,7 +643,7 @@ static BOOL mib2IfEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind, { *pErrorStatus = mapStructEntryToValue(mib2IfEntryMap, DEFINE_SIZEOF(mib2IfEntryMap), - &ifTable->table[tableIndex - 1], item, bPduType, + &ifTable->table[tableIndex - 1], item, pVarBind); if (bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItemAndInteger(&pVarBind->name, @@ -713,7 +716,7 @@ static BOOL mib2IpStatsQuery(BYTE bPduType, SnmpVarBind *pVarBind, if (!*pErrorStatus) { *pErrorStatus = mapStructEntryToValue(mib2IpMap, - DEFINE_SIZEOF(mib2IpMap), &ipStats, item, bPduType, pVarBind); + DEFINE_SIZEOF(mib2IpMap), &ipStats, item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItem(&pVarBind->name, &myOid, item); } @@ -798,7 +801,7 @@ static BOOL mib2IpAddrQuery(BYTE bPduType, SnmpVarBind *pVarBind, assert(item); *pErrorStatus = mapStructEntryToValue(mib2IpAddrMap, DEFINE_SIZEOF(mib2IpAddrMap), - &ipAddrTable->table[tableIndex - 1], item, bPduType, pVarBind); + &ipAddrTable->table[tableIndex - 1], item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItemAndIpAddr(&pVarBind->name, &myOid, item, ipAddrTable->table[tableIndex - 1].dwAddr); @@ -891,7 +894,7 @@ static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind, assert(item); *pErrorStatus = mapStructEntryToValue(mib2IpRouteMap, DEFINE_SIZEOF(mib2IpRouteMap), - &ipRouteTable->table[tableIndex - 1], item, bPduType, pVarBind); + &ipRouteTable->table[tableIndex - 1], item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItemAndIpAddr(&pVarBind->name, &myOid, item, ipRouteTable->table[tableIndex - 1].dwForwardDest); @@ -978,7 +981,7 @@ static BOOL mib2IpNetQuery(BYTE bPduType, SnmpVarBind *pVarBind, { *pErrorStatus = mapStructEntryToValue(mib2IpNetMap, DEFINE_SIZEOF(mib2IpNetMap), - &ipNetTable[tableIndex - 1], item, bPduType, pVarBind); + &ipNetTable[tableIndex - 1], item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItemAndInteger(&pVarBind->name, &myOid, item, tableIndex); @@ -1053,7 +1056,7 @@ static BOOL mib2IcmpQuery(BYTE bPduType, SnmpVarBind *pVarBind, if (!*pErrorStatus) { *pErrorStatus = mapStructEntryToValue(mib2IcmpMap, - DEFINE_SIZEOF(mib2IcmpMap), &icmpStats, item, bPduType, + DEFINE_SIZEOF(mib2IcmpMap), &icmpStats, item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItem(&pVarBind->name, &myOid, item); @@ -1115,7 +1118,7 @@ static BOOL mib2TcpQuery(BYTE bPduType, SnmpVarBind *pVarBind, if (!*pErrorStatus) { *pErrorStatus = mapStructEntryToValue(mib2TcpMap, - DEFINE_SIZEOF(mib2TcpMap), &tcpStats, item, bPduType, pVarBind); + DEFINE_SIZEOF(mib2TcpMap), &tcpStats, item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItem(&pVarBind->name, &myOid, item); } @@ -1165,7 +1168,7 @@ static BOOL mib2UdpQuery(BYTE bPduType, SnmpVarBind *pVarBind, if (!*pErrorStatus) { *pErrorStatus = mapStructEntryToValue(mib2UdpMap, - DEFINE_SIZEOF(mib2UdpMap), &udpStats, item, bPduType, pVarBind); + DEFINE_SIZEOF(mib2UdpMap), &udpStats, item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) ret = setOidWithItem(&pVarBind->name, &myOid, item); } @@ -1258,7 +1261,7 @@ static BOOL mib2UdpEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind, assert(item); *pErrorStatus = mapStructEntryToValue(mib2UdpEntryMap, DEFINE_SIZEOF(mib2UdpEntryMap), - &udpTable->table[tableIndex - 1], item, bPduType, pVarBind); + &udpTable->table[tableIndex - 1], item, pVarBind); if (!*pErrorStatus && bPduType == SNMP_PDU_GETNEXT) { AsnObjectIdentifier oid; @@ -1342,29 +1345,26 @@ static void cleanup(void) static struct mibImplementation *findSupportedQuery(UINT *ids, UINT idLength, UINT *matchingIndex) { - int indexHigh = DEFINE_SIZEOF(supportedIDs) - 1, indexLow = 0, i; - struct mibImplementation *impl = NULL; + int indexHigh = DEFINE_SIZEOF(supportedIDs) - 1, indexLow = 0; AsnObjectIdentifier oid1 = { idLength, ids}; if (!idLength) return NULL; - for (i = (indexLow + indexHigh) / 2; !impl && indexLow <= indexHigh; - i = (indexLow + indexHigh) / 2) - { - INT cmp; - cmp = SnmpUtilOidNCmp(&oid1, &supportedIDs[i].name, idLength); - if (!cmp) + while (indexLow <= indexHigh) + { + INT cmp, i = (indexLow + indexHigh) / 2; + if (!(cmp = SnmpUtilOidNCmp(&oid1, &supportedIDs[i].name, idLength))) { - impl = &supportedIDs[i]; *matchingIndex = i; + return &supportedIDs[i]; } - else if (cmp > 0) + if (cmp > 0) indexLow = i + 1; else indexHigh = i - 1; } - return impl; + return NULL; } /*****************************************************************************