snmpMIBBrowserGetHierarchyNames()

Returns subordinated OIDs and item names of a passed start OID.

Function is used in the SNMP driver.

Synopsis

int snmpMIBBrowserGetHierarchyNames(string mib_filename, string entry_point_oid, dyn_string &item_names, dyn_string &item_oids[, bool deep_search = false]);

Parameters

Parameter Description
mib_filename Absolute path to the MIB file to be browsed.
entry_point_oid

Start OID from which the OIDs and item names shall be returned. The following 3 values can be passed:

  • Empty string: browsing starts at node 1.3.6.1, it is not possible to pass a specific module name. Only one MIB file must be loaded to ensure that the method works correctly

  • "enterprise": browsing starts at node 1.3.6.1.4.1 (the "private" section of the MIB file).

  • specific OID: browsing starts at the specified node. The OID must be located in the "private" section of the MIB file.

item_names Return parameter. Returns the item (node) names.
item_oids Return parameter. Returns the associated OIDs.
deep_search

Optional.

Specifies whether the entire subordinated hierarchy shall be browsed (deep_search = true) or only the next level, i.e. only the child OIDs (deep_search = false - default).

Return value

This function returns 0 when it was executed successfully and in case of error -1.

Errors

MIB file does not exist, invalid format, etc.

Description

Returns subordinated OIDs and item names of a passed start OID.

For the iteration over all subordinated OIDs a "tree pre-order" (depth-first) algorithms is used, i.e. first always a complete path is run through before the next path is started.

For example:

The OID tree looks as follows:

" Tree pre-order" (depth-first) returns:

1 => 1.1 => 1.1.1 => 1.1.2 => 1.2 => 1.2.1

Example

#uses "CtrlMIBBrowser"
main()
{
  string mibfile = "C:\MIB_Files\mib_file.mib";
  dyn_string oids = makeDynString("1.3.6.1.4.1.12148.9.8.12",
  "1.3.6.1.4.1.12148.9.3.21.3.1.10");
  dyn_mapping addinfos;
  snmpMIBBrowserGetAdditionalInfos(mibfile, oids, addinfos);
  DebugN(addinfos);
  dyn_string itemnames, itemoids;
  snmpMIBBrowserGetHierarchyNames(mibfile, "1.3.6.1.4.1.12148.9",
  itemnames, 
  itemoids);
  DebugN(itemnames, itemoids);
  dynClear(itemnames);
  dynClear(itemoids);
  snmpMIBBrowserGetHierarchyNames(mibfile, "1.3.6.1.4.1.12148.9",
  itemnames, 
  itemoids, true);
  DebugN(itemnames, itemoids);
}

Assignment

Miscellaneous functions

Availability

CTRL