diff options
author | Phil Sutter <phil@nwl.cc> | 2025-04-10 16:42:42 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2025-05-13 10:48:53 +0200 |
commit | 3550dd69632f3a883ab6593daeffb514c67dfb8c (patch) | |
tree | 0574e76caf537d6ae72c6fca3b71a8a086b38126 /doc | |
parent | be737a1986bfee0ddea4bee7863dca0123a2bcbc (diff) |
parser_json: Introduce parse_flags_array()
Various objects support a 'flags' property with value usually being an
array of strings. There is a special case, when merely a single flag is
set: The value may be a string representing this flag.
Introduce a function assisting in parsing this polymorphic value. Have
callers pass a parser callback translating a single flag name into a
corresponding value. Luckily, these single flag parsers are very common
already.
As a side-effect, enable the single flag spec for set flags as well and
update the documentation accordingly.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/libnftables-json.adoc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/libnftables-json.adoc b/doc/libnftables-json.adoc index 244eb412..643884d5 100644 --- a/doc/libnftables-json.adoc +++ b/doc/libnftables-json.adoc @@ -317,7 +317,7 @@ ____ "handle":* 'NUMBER'*, "type":* 'SET_TYPE'*, "policy":* 'SET_POLICY'*, - "flags": [* 'SET_FLAG_LIST' *], + "flags":* 'SET_FLAGS'*, "elem":* 'SET_ELEMENTS'*, "timeout":* 'NUMBER'*, "gc-interval":* 'NUMBER'*, @@ -333,7 +333,7 @@ ____ "type":* 'SET_TYPE'*, "map":* 'STRING'*, "policy":* 'SET_POLICY'*, - "flags": [* 'SET_FLAG_LIST' *], + "flags":* 'SET_FLAGS'*, "elem":* 'SET_ELEMENTS'*, "timeout":* 'NUMBER'*, "gc-interval":* 'NUMBER'*, @@ -344,6 +344,7 @@ ____ 'SET_TYPE' := 'STRING' | *[* 'SET_TYPE_LIST' *]* | *{ "typeof":* 'EXPRESSION' *}* 'SET_TYPE_LIST' := 'STRING' [*,* 'SET_TYPE_LIST' ] 'SET_POLICY' := *"performance"* | *"memory"* +'SET_FLAGS' := 'SET_FLAG' | *[* 'SET_FLAG_LIST' *]* 'SET_FLAG_LIST' := 'SET_FLAG' [*,* 'SET_FLAG_LIST' ] 'SET_FLAG' := *"constant"* | *"interval"* | *"timeout"* 'SET_ELEMENTS' := 'EXPRESSION' | *[* 'EXPRESSION_LIST' *]* |