summaryrefslogtreecommitdiffstats
path: root/py/nftables.py
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-05-08 13:08:39 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-05-11 12:17:42 +0200
commit100d98577043f28bce96405a5fbcceafdc0138b0 (patch)
tree1d4eb23e4d8af837697b03a58a954e95c0c7fed6 /py/nftables.py
parent586ad210368b775c94acbad2b105483eaf4ca05a (diff)
py: Add getter/setter for echo output option
Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'py/nftables.py')
-rw-r--r--py/nftables.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/py/nftables.py b/py/nftables.py
index c1759750..eb81f5b2 100644
--- a/py/nftables.py
+++ b/py/nftables.py
@@ -47,6 +47,13 @@ class Nftables:
self.nft_ctx_output_set_handle = lib.nft_ctx_output_set_handle
self.nft_ctx_output_set_handle.argtypes = [c_void_p, c_bool]
+ self.nft_ctx_output_get_echo = lib.nft_ctx_output_get_echo
+ self.nft_ctx_output_get_echo.restype = c_bool
+ self.nft_ctx_output_get_echo.argtypes = [c_void_p]
+
+ self.nft_ctx_output_set_echo = lib.nft_ctx_output_set_echo
+ self.nft_ctx_output_set_echo.argtypes = [c_void_p, c_bool]
+
self.nft_ctx_output_get_numeric = lib.nft_ctx_output_get_numeric
self.nft_ctx_output_get_numeric.restype = c_int
self.nft_ctx_output_get_numeric.argtypes = [c_void_p]
@@ -114,6 +121,24 @@ class Nftables:
self.nft_ctx_output_set_handle(self.__ctx, val)
return old
+ def get_echo_output(self):
+ """Get the current state of echo output.
+
+ Returns a boolean indicating whether echo output is active or not.
+ """
+ return self.nft_ctx_output_get_echo(self.__ctx)
+
+ def set_echo_output(self, val):
+ """Enable or disable echo output.
+
+ Accepts a boolean turning echo output on or off.
+
+ Returns the previous value.
+ """
+ old = self.get_echo_output()
+ self.nft_ctx_output_set_echo(self.__ctx, val)
+ return old
+
def get_numeric_output(self):
"""Get the current state of numeric output.