Remove AlertType typedef from C

This commit is contained in:
emanuele-f 2019-10-22 14:43:21 +02:00
parent 79157cc65d
commit ab0875155e
6 changed files with 25 additions and 64 deletions

View file

@ -19,7 +19,7 @@ local alert_endpoints = require "alert_endpoints_utils"
local flow_consts = require "flow_consts"
local user_scripts = require "user_scripts"
local store_alerts_queue = "ntopng.alert_store_queue"
local store_alerts_queue = "ntopng.push_alerts_queue"
local inactive_hosts_hash_key = "ntopng.prefs.alerts.ifid_%d.inactive_hosts_alerts"
local shaper_utils = nil
@ -2678,31 +2678,31 @@ local function processStoreAlertFromQueue(alert)
interface.select(tostring(alert.ifid))
if(alert.alert_type == alertType("alert_ip_outsite_dhcp_range")) then
if(alert.alert_type == "ip_outsite_dhcp_range") then
local router_info = {host = alert.router_ip, vlan = alert.vlan_id}
entity_info = alerts_api.hostAlertEntity(alert.client_ip, alert.vlan_id)
type_info = alerts_api.ipOutsideDHCPRangeType(router_info, alert.mac_address, alert.client_mac, alert.sender_mac)
elseif(alert.alert_type == alertType("alert_slow_periodic_activity")) then
elseif(alert.alert_type == "slow_periodic_activity") then
entity_info = alerts_api.periodicActivityEntity(alert.path)
type_info = alerts_api.slowPeriodicActivityType(alert.duration_ms, alert.max_duration_ms)
elseif(alert.alert_type == alertType("alert_mac_ip_association_change")) then
elseif(alert.alert_type == "mac_ip_association_change") then
local name = getSavedDeviceName(alert.new_mac)
entity_info = alerts_api.macEntity(alert.new_mac)
type_info = alerts_api.macIpAssociationChangeType(name, alert.ip, alert.old_mac, alert.new_mac)
elseif(alert.alert_type == alertType("alert_login_failed")) then
elseif(alert.alert_type == "login_failed") then
entity_info = alerts_api.userEntity(alert.user)
type_info = alerts_api.loginFailedType()
elseif(alert.alert_type == alertType("alert_broadcast_domain_too_large")) then
elseif(alert.alert_type == "broadcast_domain_too_large") then
entity_info = alerts_api.macEntity(alert.src_mac)
type_info = alerts_api.broadcastDomainTooLargeType(alert.src_mac, alert.dst_mac, alert.vlan_id, alert.spa, alert.tpa)
elseif(alert.alert_type == alertType("alert_remote_to_remote")) then
elseif(alert.alert_type == "remote_to_remote") then
local host_info = {host = alert.host, vlan = alert.vlan}
entity_info = alerts_api.hostAlertEntity(alert.host, alert.vlan)
type_info = alerts_api.remoteToRemoteType(host_info, alert.mac_address)
elseif((alert.alert_type == alertType("alert_user_activity")) and (alert.scope == "login")) then
elseif((alert.alert_type == "user_activity") and (alert.scope == "login")) then
entity_info = alerts_api.userEntity(alert.user)
type_info = alerts_api.userActivityType("login", nil, nil, nil, "authorized")
elseif(alert.alert_type == alertType("alert_nfq_flushed")) then
elseif(alert.alert_type == "nfq_flushed") then
entity_info = alerts_api.interfaceAlertEntity(alert.ifid)
type_info = alerts_api.nfqFlushedType(getInterfaceName(alert.ifid), alert.pct, alert.tot, alert.dropped)
else