]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/Config.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / adaptation / Config.h
index 2740f9808124a5a2965076970689ca224ab8df28..279cee7d4a8168237a4f2a28d69f0d2dfb5d8c7b 100644 (file)
@@ -1,13 +1,25 @@
+/*
+ * 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_ADAPTATION__CONFIG_H
 #define SQUID_ADAPTATION__CONFIG_H
 
-#include "event.h"
-#include "base/AsyncCall.h"
-#include "adaptation/forward.h"
+#include "acl/forward.h"
 #include "adaptation/Elements.h"
+#include "adaptation/forward.h"
+#include "base/AsyncCall.h"
+#include "event.h"
+#include "Notes.h"
+#include "SquidString.h"
 
-class acl_access;
 class ConfigParser;
+class HttpRequest;
+class HttpReply;
 
 namespace Adaptation
 {
@@ -43,7 +55,11 @@ public:
     time_t oldest_service_failure;
     int service_revival_delay;
 
-    typedef Vector<ServiceConfigPointer> ServiceConfigs;
+    static Notes metaHeaders; ///< The list of configured meta headers
+
+    static bool needHistory; ///< HttpRequest adaptation history should recorded
+
+    typedef std::vector<ServiceConfigPointer> ServiceConfigs;
     ServiceConfigs serviceConfigs;
 
     Config();
@@ -52,14 +68,29 @@ public:
     void parseService(void);
     void freeService(void);
     void dumpService(StoreEntry *, const char *) const;
-    ServicePointer findService(const String&);
+    ServiceConfigPointer findServiceConfig(const String&);
 
-    virtual void finalize();
+    /**
+     * Creates and starts the adaptation services. In the case the adaptation
+     * mechanism is disabled then removes any reference to the services from
+     * access rules and service groups, and returns false.
+     * \return true if the services are ready and running, false otherwise
+     */
+    virtual bool finalize();
 
 protected:
+    /// Removes any reference to the services  from configuration
+    virtual void clear();
+
     /// creates service configuration object that will parse and keep cfg info
     virtual ServiceConfig *newServiceConfig() const;
 
+    /// Removes the given service from all service groups.
+    void removeService(const String& service);
+
+    /// Removes access rules of the given service or group
+    void removeRule(const String& id);
+
 private:
     Config(const Config &); // unsupported
     Config &operator =(const Config &); // unsupported
@@ -74,3 +105,4 @@ private:
 } // namespace Adaptation
 
 #endif /* SQUID_ADAPTATION__CONFIG_H */
+