]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/acl/Gadgets.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / acl / Gadgets.h
index 49786b5e54bb30084ee5060a916e14a99b1e9e98..ca1cb8695741016ddc5536674f8b126cc466d4ab 100644 (file)
@@ -1,27 +1,50 @@
+/*
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef SQUID_ACL_GADGETS_H
 #define SQUID_ACL_GADGETS_H
 
-#include "err_type.h"
+#include "acl/forward.h"
+#include "error/forward.h"
+
+#include <sstream>
 
-struct dlink_list;
-class acl_access;
-class ACL;
-class AclDenyInfoList;
-class ACLList;
 class ConfigParser;
+class dlink_list;
 class StoreEntry;
 class wordlist;
 
+/// Register an ACL object for future deletion. Repeated registrations are OK.
+/// \ingroup ACLAPI
+void aclRegister(ACL *acl);
 /// \ingroup ACLAPI
 void aclDestroyAccessList(acl_access **list);
 /// \ingroup ACLAPI
 void aclDestroyAcls(ACL **);
 /// \ingroup ACLAPI
 void aclDestroyAclList(ACLList **);
+/// Parses a single line of a "action followed by acls" directive (e.g., http_access).
 /// \ingroup ACLAPI
-void aclParseAccessLine(ConfigParser &parser, acl_access **);
-/// \ingroup ACLAPI
-void aclParseAclList(ConfigParser &parser, ACLList **);
+void aclParseAccessLine(const char *directive, ConfigParser &parser, Acl::Tree **);
+/// Parses a single line of a "some context followed by acls" directive (e.g., note n v).
+/// The label parameter identifies the context (for debugging).
+/// \returns the number of parsed ACL names
+size_t aclParseAclList(ConfigParser &parser, Acl::Tree **, const char *label);
+/// Template to convert various context labels to strings. \ingroup ACLAPI
+template <class Any>
+inline size_t
+aclParseAclList(ConfigParser &parser, Acl::Tree **tree, const Any any)
+{
+    std::ostringstream buf;
+    buf << any;
+    return aclParseAclList(parser, tree, buf.str().c_str());
+}
+
 /// \ingroup ACLAPI
 int aclIsProxyAuth(const char *name);
 /// \ingroup ACLAPI
@@ -40,3 +63,4 @@ void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head);
 void dump_acl_list(StoreEntry * entry, ACLList * head);
 
 #endif /* SQUID_ACL_GADGETS_H */
+