1 #ifndef SQUID_ADAPTATION__CONFIG_H
2 #define SQUID_ADAPTATION__CONFIG_H
4 #include "acl/forward.h"
5 #include "adaptation/Elements.h"
6 #include "adaptation/forward.h"
7 #include "base/AsyncCall.h"
10 #include "SquidString.h"
22 static void Finalize(bool enable
);
24 static void ParseServiceSet(void);
25 static void ParseServiceChain(void);
27 static void ParseAccess(ConfigParser
&parser
);
28 static void FreeAccess(void);
29 static void DumpAccess(StoreEntry
*, const char *);
31 friend class AccessCheck
;
34 static bool Enabled
; // true if at least one adaptation mechanism is
36 // these are global squid.conf options, documented elsewhere
37 static char *masterx_shared_name
; // global TODO: do we need TheConfig?
38 static int service_iteration_limit
;
39 static int send_client_ip
;
40 static int send_username
;
41 static int use_indirect_client
;
43 // Options below are accessed via Icap::TheConfig or Ecap::TheConfig
44 // TODO: move ICAP-specific options to Icap::Config and add TheConfig
46 int service_failure_limit
;
47 time_t oldest_service_failure
;
48 int service_revival_delay
;
50 static Notes metaHeaders
; ///< The list of configured meta headers
52 static bool needHistory
; ///< HttpRequest adaptation history should recorded
54 typedef std::vector
<ServiceConfigPointer
> ServiceConfigs
;
55 ServiceConfigs serviceConfigs
;
60 void parseService(void);
61 void freeService(void);
62 void dumpService(StoreEntry
*, const char *) const;
63 ServiceConfigPointer
findServiceConfig(const String
&);
66 * Creates and starts the adaptation services. In the case the adaptation
67 * mechanism is disabled then removes any reference to the services from
68 * access rules and service groups, and returns false.
69 * \return true if the services are ready and running, false otherwise
71 virtual bool finalize();
74 /// Removes any reference to the services from configuration
77 /// creates service configuration object that will parse and keep cfg info
78 virtual ServiceConfig
*newServiceConfig() const;
80 /// Removes the given service from all service groups.
81 void removeService(const String
& service
);
83 /// Removes access rules of the given service or group
84 void removeRule(const String
& id
);
87 Config(const Config
&); // unsupported
88 Config
&operator =(const Config
&); // unsupported
90 virtual ServicePointer
createService(const ServiceConfigPointer
&cfg
) = 0;
92 static void ParseServiceGroup(ServiceGroupPointer group
);
93 static void FreeServiceGroups(void);
94 static void DumpServiceGroups(StoreEntry
*, const char *);
97 } // namespace Adaptation
99 #endif /* SQUID_ADAPTATION__CONFIG_H */