-- Load modules
+local ffi = require("ffi")
local sqlite3 = require("lsqlite3")
+-- Get access to the C interface
+local C = ffi.C
+
local DB_PATH = "/var/lib/knot-resolver/leases.db"
local TTL = 60
local sql_fwd
local sql_rev
-local function log_error(s)
- print(s)
-end
-
-local function log_debug(s)
- print(s)
-end
-
-- Initializes the module
function M.init()
-- Open the database
-- Fail if we cannot open the database
if not db then
- log_error("leases: Failed to open " .. DB_PATH)
+ log_error(C.LOG_GRP_RESOLVER, "leases: Failed to open " .. DB_PATH)
return -1
end
-- Log action
log_debug(
- string.format("Called for %s (%d)", qname, qtype)
+ C.LOG_GRP_RESOLVER, string.format("Called for %s (%d)", qname, qtype)
)
local answer = {}