Merging upstream version 1.2.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 08:31:51 +01:00
parent 9ce9cc1418
commit cc381791fc
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
340 changed files with 71346 additions and 6734 deletions

View file

@ -17,59 +17,15 @@
-- along with dnsjit. If not, see <http://www.gnu.org/licenses/>.
-- dnsjit.input.zero
-- Generate empty objects (/dev/zero)
-- local input = require("dnsjit.input.zero").new()
-- input:receiver(filter_or_output)
-- input:run(1e6)
-- Dummy layer to example.input.zero
--
-- Input module for generating empty
-- .I core.object.null
-- objects, mostly used for testing.
-- This module has moved to example.input.zero, see examples/modules/input-example in
-- dnsjit source repository.
module(...,package.seeall)
require("dnsjit.input.zero_h")
local ffi = require("ffi")
local C = ffi.C
local t_name = "input_zero_t"
local input_zero_t = ffi.typeof(t_name)
local Zero = {}
-- Create a new Zero input.
function Zero.new()
local self = {
_receiver = nil,
obj = input_zero_t(),
}
C.input_zero_init(self.obj)
ffi.gc(self.obj, C.input_zero_destroy)
return setmetatable(self, { __index = Zero })
ok, cls = pcall(require, "example.input.zero")
if not ok then
error("You need to install the example module input-example\n" .. cls)
end
-- Return the Log object to control logging of this instance or module.
function Zero:log()
if self == nil then
return C.input_zero_log()
end
return self.obj._log
end
-- Set the receiver to pass objects to.
function Zero:receiver(o)
self.obj.recv, self.obj.ctx = o:receive()
self._receiver = o
end
-- Return the C functions and context for producing objects.
function Zero:produce()
return C.input_zero_producer(), self.obj
end
-- Generate
-- .I num
-- empty objects and send them to the receiver.
function Zero:run(num)
C.input_zero_run(self.obj, num)
end
return Zero
return cls