summaryrefslogtreecommitdiffstats
path: root/shorewall-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'shorewall-model.lua')
-rw-r--r--shorewall-model.lua30
1 files changed, 16 insertions, 14 deletions
diff --git a/shorewall-model.lua b/shorewall-model.lua
index 765157a..75fccb5 100644
--- a/shorewall-model.lua
+++ b/shorewall-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -41,7 +41,7 @@ local function addremove_config( addremove, file, value, orgvalue )
-- Check if we are about to change a valid filename
local isvalidfile
- for k,v in pairs(getfilelist()) do
+ for k,v in pairs(mymodule.getfilelist()) do
isvalidfile = true
if (v.value == filepath) then
break
@@ -170,29 +170,29 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "Shorewall Status")
end
-function getstatusdetails()
+function mymodule.getstatusdetails()
local programstate, errtxt = modelfunctions.run_executable({"shorewall", "status"}, true)
return cfe({ value=programstate, label="Shorewall status report", errtxt=errtxt })
end
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function getlogfile ()
+function mymodule.getlogfile ()
local logfilepath = format.parse_ini_file(fs.read_file(configfile) or "","","LOGFILE") or ""
return cfe({ value=logfilepath, label="Shorewall logfile" })
end
-function getfilelist ()
+function mymodule.getfilelist ()
local listed_files = {}
if fs.is_dir(baseurl) then
@@ -210,7 +210,7 @@ function getfilelist ()
end
local function is_valid_filename(filename)
- local available_files = getfilelist()
+ local available_files = mymodule.getfilelist()
for i,file in ipairs(available_files.value) do
if file.filename == filename then
return true
@@ -219,20 +219,20 @@ local function is_valid_filename(filename)
return false
end
-function getfiledetails(filename)
+function mymodule.getfiledetails(filename)
return modelfunctions.getfiledetails(filename, is_valid_filename)
end
-function updatefiledetails(self, filedetails)
+function mymodule.updatefiledetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, is_valid_filename)
end
--[[
-function modify_config(self, addremove, file, value, orgvalue )
+function mymodule.modify_config(self, addremove, file, value, orgvalue )
return addremove_config(addremove, file, value, orgvalue )
end
-function getconfig()
+function mymodule.getconfig()
local config = {}
config.params = cfe({
@@ -285,7 +285,7 @@ function getconfig()
end
-function get_defined_zones ()
+function mymodule.get_defined_zones ()
local output = {}
for k,v in pairs(read_config("zones")) do
table.insert(output, string.match(v, "^%s*(%S*)"))
@@ -293,3 +293,5 @@ function get_defined_zones ()
return output
end
--]]
+
+return mymodule