LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lp.GetNetworkHostList

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

number = lp.GetNetworkHostList('net','mask','array');

number = lp.GetNetworkHostList('net','mask','array',index); 

Description

The lp.GetNetworkHostList LUA function gets an array of host IP adresses pertaining to an IP network defined by the ‘net’ and ‘mask’value.

Warning  ! Retrieve only hosts registered in the directory that follow the rule:

If ((IP_equipement and mask) == ) net then OK

The function supports VLSM or subnetting.

 

Parameters

array - an array that will contain the returned value

net - an IP network of subnetwork (ex: 10.0.0.0)

mask - the subnet mask of the IP network (ex: 255.0.0.0)

index - equal 1 if the table index should start with 1 to support the LUA function ipairs(array) and be conform to the LUA tables.

Return Values

array : a list of host IP addresses

number : the number of entry in the array

Return nil if an error occurs

Example

net,mask=lp.GetFirstNetwork();

 

if net ~=nil then

a=1;

while a==1 do

if net==nil then break end;

       lp.Print("Network/mask  : ",net,"/",mask,"\n");

u=lp.GetNetworkHostList(net,mask,"array",1);

if u then

for key,value in pairs(array) do lp.Print("[",key,"] [",value,"]\n") end

end

 

       net,mask=lp.GetNextNetwork(net,mask);

       end

end

list of networks

 


www.loriotpro.com