| < Prev | Back to Table of Contents | Next > |
MIB Smithy SDK provide several forms for "lexicographically" comparing two object identifier values. By default, each OID value is fully compared to determine whether one OID is less than, equal to, or greater than the other. Additional options may be used to limit the number of subidentifiers compared to a specified prefix or to automatically determine if one OID represents a subtree of the other.
% dbcmd oidcmp ?options? oid1
oid2
..where dbcmd is the name of the database,
options are one or more optional parameters
for specifying the level of comparison to be performed, and
oid1 and oid2 are the
two object identifier values to be compared.
The OID values may be provided in any of the forms accepted elsewhere by the SDK (i.e., "absolute" dotted-number OID values, simple identifiers, or "relative" OID values with or without named subidentifiers). The SDK will first convert relative OIDs to absolute OIDs prior to comparison using the set of modules loaded into the named database.
-1 If the compared portion of
oid1 is less than that of
oid2.0 If the compared portion of
oid1 is equal to that of
oid2.1 If the compared portion of
oid1 is greater than that of
oid2.
| Option | Argument | Description |
|---|---|---|
-nocomplain |
N/A | Disables errors that may occur if one or both
OID values cannot be fully resolved to one of the three root
values and the two OID values do not resolve to the same unknown
parent. If both resolve the same parent (such as
mib-2.1.2.3 and mib-2.3.4.5 if
mib-2 were undefined), no error will occur
regardless of this option. However, if the two start at different
points then an error will occur unless this option is
specified, in which case the return value will either be a string
comparison of the first identifier (if neither could be resolved)
or, if one was fully resolved and the other was not, the
fully-resolved OID will always be considered "greater
than" the unresolved OID. |
-subtree |
N/A | Instructs the comparision function to do
"subtree" matching. This option is similar to
-limit, however the number of subidentifiers
compared is automatically the same as the number of
subidentifiers in the oid1 argument.
Thus, specifying this option instructs the function to return
0 if oid2 is a subtree of,
or equal to, oid1. |
-limit |
count |
Instructs the comparision function to do compare
at most count subidentifiers of the two
specified OIDs and is useful for prefix matching, similar to
subtree matching but with a fixed number of subidentifiers. Note
that the count is applied to the fully resolved OID
values, or as much can be resolved given the available loaded MIB
modules. |
% $db oidcmp 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0 -1 % $db oidcmp 1.3.6.1.2.1.1.2.0 1.3.6.1.2.1.1.1.0 1 % $db oidcmp -limit 2 1.3.6.1 1.3.10 0 % $db oidcmp -subtree system sysDescr 0 % $db oidcmp -subtree sysDescr system 1 % $db oidcmp -subtree 1.3.6.1 1.3.6 1 % $db oidcmp -subtree 1.3.6 1.3.6.1 0 % $db oidcmp -subtree 1.3.6 1.4.6.1 -1
| < Prev | Back to Table of Contents | Next > |