-- -- (C) 2014-19 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path local alerts_api = require "alerts_api" local CALLBACK_EVENTS = { application_detected = { cb = "protocolDetected", i18n = "flow_callbacks.application_detected"}, status_changed = { cb = "statusChanged", i18n = "flow_callbacks.status_changed",}, periodic_update = { cb = "periodicUpdate", i18n = "flow_callbacks.periodic_update"}, idle = { cb = "idle", i18n = "flow_callbacks.idle"} } local flow_callbacks_utils = {} -- ################################# local function print_callbacks_config_tab(tab, tab_contents, selected_tab) if tab == selected_tab then print("\t
  • ") else print("\t
  • ") end print(""..i18n(tab_contents.i18n).."
  • \n") end -- ################################# function flow_callbacks_utils.print_callbacks_config() local tab = _GET["tab"] or "application_detected" local descr = alerts_api.load_flow_check_modules(entity_type) print('') print [[
    ]] print[[]] print[[]] print('\n') local has_modules = false for _, check_module in pairsByKeys(descr, asc) do if check_module[CALLBACK_EVENTS[tab]["cb"]] and check_module.gui then if not has_modules then has_modules = true end print("") end end if not has_modules then print("") end print[[]] print[[
    ]] print(i18n("flow_callbacks.callback")) print[[]] print(i18n("flow_callbacks.callback_config")) print[[
    ".. i18n(check_module.gui.i18n_title) .."
    ") print(""..i18n(check_module.gui.i18n_description)..".\n") print("
    ") print(check_module.gui.input_builder(check_module.gui, nil --[[ current key --]], nil --[[ current val for key --]])) print("
    "..i18n("flow_callbacks.no_callbacks_defined", {cb = CALLBACK_EVENTS[tab]["cb"]})..".
    ]] end return flow_callbacks_utils