]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add tmpl_attr_is_list_attr() to check if an ar refers to a list
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Feb 2023 16:55:08 +0000 (10:55 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Feb 2023 16:55:08 +0000 (10:55 -0600)
src/lib/server/tmpl.h

index 4c44736e5a959c20d5f23308a1c7b22092666afd..1f8a14994c2748b404983b56ff47b8dc0e46068e 100644 (file)
@@ -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