netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: [PATCH nft 2/4] py: add missing output flags.
Date: Tue, 22 Oct 2019 21:58:53 +0100	[thread overview]
Message-ID: <20191022205855.22507-3-jeremy@azazel.net> (raw)
In-Reply-To: <20191022205855.22507-1-jeremy@azazel.net>

`terse` and `numeric_time` are missing from the `output_flags` dict.
Add them and getters and setters for them.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 py/nftables.py | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/py/nftables.py b/py/nftables.py
index 81e57567c802..48eb54fe232d 100644
--- a/py/nftables.py
+++ b/py/nftables.py
@@ -58,6 +58,8 @@ class Nftables:
         "numeric_proto":  (1 << 7),
         "numeric_prio":   (1 << 8),
         "numeric_symbol": (1 << 9),
+        "numeric_time":   (1 << 10),
+        "terse":          (1 << 11),
     }
 
     validator = None
@@ -305,6 +307,39 @@ class Nftables:
         """
         return self.__set_output_flag("numeric_symbol", val)
 
+    def get_numeric_time_output(self):
+        """Get current status of numeric times output flag.
+
+        Returns a boolean value indicating the status.
+        """
+        return self.__get_output_flag("numeric_time")
+
+    def set_numeric_time_output(self, val):
+        """Set numeric times output flag.
+
+        Accepts a boolean turning numeric representation of time values
+        in output either on or off.
+
+        Returns the previous value.
+        """
+        return self.__set_output_flag("numeric_time", val)
+
+    def get_terse_output(self):
+        """Get the current state of terse output.
+
+        Returns a boolean indicating whether terse output is active or not.
+        """
+        return self.__get_output_flag("terse")
+
+    def set_terse_output(self, val):
+        """Enable or disable terse output.
+
+        Accepts a boolean turning terse output either on or off.
+
+        Returns the previous value.
+        """
+        return self.__set_output_flag("terse", val)
+
     def get_debug(self):
         """Get currently active debug flags.
 
-- 
2.23.0


  parent reply	other threads:[~2019-10-22 20:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 20:58 [PATCH nft 0/4] Output Flag Fixes Jeremy Sowden
2019-10-22 20:58 ` [PATCH nft 1/4] doc: add missing output flag documentation Jeremy Sowden
2019-10-23 20:36   ` Pablo Neira Ayuso
2019-10-22 20:58 ` Jeremy Sowden [this message]
2019-10-23 20:38   ` [PATCH nft 2/4] py: add missing output flags Pablo Neira Ayuso
2019-10-24  9:20     ` Phil Sutter
2019-10-24  9:35       ` Pablo Neira Ayuso
2019-10-24 15:56         ` Phil Sutter
2019-10-24 16:23           ` Pablo Neira Ayuso
2019-10-24  9:14   ` Phil Sutter
2019-10-22 20:58 ` [PATCH nft 3/4] main: add missing `OPT_NUMERIC_PROTO` long option Jeremy Sowden
2019-10-23 20:42   ` Pablo Neira Ayuso
2019-10-22 20:58 ` [PATCH nft 4/4] main: remove duplicate output flag assignment Jeremy Sowden
2019-10-23 20:42   ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191022205855.22507-3-jeremy@azazel.net \
    --to=jeremy@azazel.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).