mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Initial type and services information on the Mac objects
This commit is contained in:
parent
501def6492
commit
2b2ce80aa2
6 changed files with 87 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue