Initial type and services information on the Mac objects

This commit is contained in:
emanuele-f 2017-08-04 00:40:46 +02:00
parent 501def6492
commit 2b2ce80aa2
6 changed files with 87 additions and 0 deletions

View file

@ -2851,10 +2851,26 @@ function getHostIcons()
return pairsByKeys(icon_keys, asc)
end
-- Get the device icon from the C side
-- NOTE: this can be optimized by reading the device directly from the mac lua data
function getDeviceIcon(mac)
local info = interface.getMacInfo(mac)
if (info ~= nil) and (info.device_type ~= "Unknown") then
return icon_keys[info.device_type]
end
return nil
end
function getHostIconName(key)
local hash_key = "ntopng.host_icons"
local icon = ntop.getHashCache(hash_key, key)
if isEmptyString(icon) and isMacAddress(key) then
icon = getDeviceIcon(key)
end
if (icon == nil) then
icon = ""
end
@ -3498,6 +3514,17 @@ function page_url(path)
return ntop.getHttpPrefix().."/lua/"..path
end
-- extracts a page url from the path
function path_get_page(path)
local prefix = ntop.getHttpPrefix() .. "/lua/"
if string.find(path, prefix) == 1 then
return string.sub(path, string.len(prefix) + 1)
end
return path
end
-- ###########################################
--
-- IMPORTANT