diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:11:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:11:16 +0000 |
commit | a68848db159cc1cafa82f9d383432fda459c8745 (patch) | |
tree | 5fd1cd2cd6f298bebbbb0ce5db29fa6de68a2acc /src/input/zero.lua | |
parent | Adding debian version 1.1.0+debian-1. (diff) | |
download | dnsjit-a68848db159cc1cafa82f9d383432fda459c8745.tar.xz dnsjit-a68848db159cc1cafa82f9d383432fda459c8745.zip |
Merging upstream version 1.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/input/zero.lua')
-rw-r--r-- | src/input/zero.lua | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/src/input/zero.lua b/src/input/zero.lua index 1907dce..c6bf5a4 100644 --- a/src/input/zero.lua +++ b/src/input/zero.lua @@ -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 }) -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) +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 Zero +return cls |