From: Arran Cudbard-Bell Date: Thu, 9 Feb 2023 16:55:08 +0000 (-0600) Subject: Add tmpl_attr_is_list_attr() to check if an ar refers to a list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=178a3d6010094e0e4c6e42b30852502bb86accee;p=thirdparty%2Ffreeradius-server.git Add tmpl_attr_is_list_attr() to check if an ar refers to a list --- diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index 4c44736e5a9..1f8a14994c2 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -665,6 +665,20 @@ static inline size_t tmpl_request_ref_count(tmpl_t const *vpt) return tmpl_request_list_num_elements(&vpt->data.attribute.rr); } +/** Return true if the tmpl_attr is one of the list types + * + * @hidecallergraph +*/ +static inline bool tmpl_attr_is_list_attr(tmpl_attr_t const *ar) +{ + if (!ar || !ar_is_normal(ar)) return false; + + return (ar->ar_da == request_attr_request) || + (ar->ar_da == request_attr_reply) || + (ar->ar_da == request_attr_control) || + (ar->ar_da == request_attr_state); +} + /** Return true if the last attribute reference is "normal" * * @hidecallergraph