Next Topic

Previous Topic

Book Contents

Walk

TLuaSNMPResult TLuaSNMP::Walk()

Return values

Returns the identifier of the next OID in the member variable m_sOID in the TLuaSNMPResult structure. Does not return the complete OID string. When the end is reached the m_sOID member of the TLuaSNMPResult structure will be empty.

Remarks

Before the first call to the Walk function the program must call the BeginWalk function to set the start of the Walk. Walk will retrieve all the child and device identifiers of the start OID set by the BeginWalk functions.

Example

--KNM Lua API example (C) 2007 Kaseya AB
--Simple example of SNMP interface
SNMP = TLuaSNMP();
SNMP:Open("public");
sOID = "iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry";

--A repeat ... until loop
Result = TLuaSNMPResult();
SNMP:BeginWalk(sOID);
repeat
	Result = SNMP:Walk(sOID);
	sOID = Result.m_sOID;
	print("OID "..sOID);
	print("Data "..Result.m_sData);
	print("Syntax "..Result.m_iSyntax);
until Result.m_sOID == "";