diff options
author | Alexander Zubkov <green@qrator.net> | 2021-12-28 04:05:05 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2021-12-28 04:07:09 +0100 |
commit | 0e1fd7ea6af8aaeb68a23e320c2a0a0a8480d6de (patch) | |
tree | b95846c505ae8b4d7ae72988a9d48f23be811a1b /filter/data.c | |
parent | e15e465720c428e765ab88fd587afb4f4f5d70ae (diff) |
Filter: Add operators to find minimum and maximum element of sets
Add operators .min and .max to find minumum or maximum element in sets
of types: clist, eclist, lclist. Example usage:
bgp_community.min
bgp_ext_community.max
filter(bgp_large_community, [(as1, as2, *)]).min
Signed-off-by: Alexander Zubkov <green@qrator.net>
Diffstat (limited to 'filter/data.c')
-rw-r--r-- | filter/data.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/filter/data.c b/filter/data.c index 7c33d2cb..56c1fb17 100644 --- a/filter/data.c +++ b/filter/data.c @@ -68,6 +68,17 @@ f_type_name(enum f_type t) return "?"; } +enum f_type +f_type_element_type(enum f_type t) +{ + switch(t) { + case T_CLIST: return T_PAIR; + case T_ECLIST: return T_EC; + case T_LCLIST: return T_LC; + default: return T_VOID; + }; +} + const struct f_val f_const_empty_path = { .type = T_PATH, .val.ad = &null_adata, |