get-next Request
The get-next request deserves special consideration. It is designed to navigate the entire Internet-standard MIB subtree. Because all instance IDs are sequences of numbers, they can be ordered.
The first eight instance IDs are:
Item | Description |
---|---|
sysDescr.0 | 1.3.6.1.2.1.1.1.0 |
sysObjectId.0 | 1.3.6.1.2.1.1.2.0 |
sysUpTime.0 | 1.3.6.1.2.1.1.3.0 |
sysContact.0 | 1.3.6.1.2.1.1.4.0 |
sysName.0 | 1.3.6.1.2.1.1.5.0 |
sysLocation.0 | 1.3.6.1.2.1.1.6.0 |
sysServices.0 | 1.3.6.1.2.1.1.7.0 |
ifNumber.0 | 1.3.6.1.2.1.2.1.0 |
A get-next request for a MIB variable instance returns a binding list containing the next MIB variable instance in sequence and its associated value. For example, a get-next request for the sysDescr.0 variable returns a binding list containing the pair (sysObjectId.0, Value). A get-next request for the sysObjectId.0 variable returns a binding list containing the pair (sysUpTime.0, Value), and so forth.
A get-next request for the sysServices.0 variable in the previous list does not look for the next instance ID in sequence (1.3.6.1.2.1.1.8.0) because no such instance ID is defined in the Internet-standard MIB subtree. The next MIB variable instance in the Internet-standard MIB subtree is the first instance ID in the next MIB group in sequence, the interfaces group. The first instance ID in the interfaces group is the ifNumber.0 variable.
Thus, a get-next request for the sysServices.0 variable returns a binding list containing the pair (ifNumber.0, Value). Instance IDs are similar to decimal number representations, with the digits to the right increasing more rapidly than the digits on the left. Unlike decimal numbers, the digits have no real base. The possible values for each digit are determined by the RFCs and the instances that are appended to the variable names. The get-next request allows traversal of the whole tree, even though instances are not known.
struct binding {
char instance[length1];
char value[length2];
}bindlist[maxlistsize];
bindlist[0] = get(sysDescr.0);
for (i = 1; i < maxlistsize && bindlist[i-1].instance != NULL; i++) {
bindlist[i] = get_next(bindlist[i-1].instance);
}
The fictitious get and get-next functions in this example return a single binding pair, which is stored in an array of bindings. Each get-next request uses the instance returned by the previous request. By daisy-chaining in this way, the entire MIB database is traversed.