[This is preliminary documentation and subject to change.]
The WinSNMP SnmpOidCompare function lexicographically compares two SNMP object identifiers, up to the length specified by the maxlen parameter.
SNMPAPI_STATUS SnmpOidCompare(
smiLPCOID xOID, // first object identifier to compare
smiLPCOID yOID, // second object identifier to compare
smiUINT32 maxlen, // maximum length to compare
smiLPINT result // result of comparison
);
Result | Meaning |
---|---|
Greater than 0 | xOID is greater than yOID |
Equal to 0 | xOID equals yOID |
Less than 0 | xOID is less than yOID |
For additional comparison conditions, see the following Remarks section.
If the function succeeds, the return value is SNMPAPI_SUCCESS.
If the function fails, the return value is SNMPAPI_FAILURE. To get extended error information, call SnmpGetLastError. The SnmpGetLastError function can return one of the following errors.
Error code | Description |
---|---|
SNMPAPI_NOT_INITIALIZED | The SnmpStartup function did not complete successfully. |
SNMPAPI_ALLOC_ERROR | An error occurred during memory allocation. |
SNMPAPI_OID_INVALID | One or both of the xOID and yOID parameters is invalid. |
SNMPAPI_SIZE_INVALID | The maxlen parameter is invalid. The parameter size is greater than MAXOBJIDSIZE. |
SNMPAPI_OTHER_ERROR | An unknown or undefined error occurred. |
A WinSNMP manager application can call the SnmpOidCompare function to determine whether two object identifiers have common prefixes.
If the maxlen parameter is not equal to zero, and not greater than MAXOBJIDSIZE, the value of maxlen sets the upper limit for the number of subidentifiers to compare. The maximum number of subidentifiers that the SnmpOidCompare function compares defaults to whichever is the smallest number — the maxlen parameter, or the len member of one of the smiOID structures pointed to by the xOID and yOID parameters.
If the maxlen parameter is equal to zero, the maximum number of subidentifiers that the SnmpOidCompare function compares defaults to the number that is the smaller of the len members of the two smiOID structures.
The value of the result parameter will indicate that xOID equals yOID if the two smiOID structures are lexicographically equal and one of the following occurs:
Windows NT: Requires version 5.0 or later. Available as a redistributable for Windows NT 4.0.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winsnmp.h.
Import Library: Use wsnmp32.lib.
WinSNMP Manager API Overview, WinSNMP Functions, smiOID