1 #ifndef SQUID_ADAPTATION__CONFIG_H
2 #define SQUID_ADAPTATION__CONFIG_H
5 #include "acl/forward.h"
6 #include "acl/Gadgets.h"
7 #include "base/AsyncCall.h"
8 #include "adaptation/forward.h"
9 #include "adaptation/Elements.h"
11 #include "SquidString.h"
23 static void Finalize(bool enable
);
25 static void ParseServiceSet(void);
26 static void ParseServiceChain(void);
28 static void ParseAccess(ConfigParser
&parser
);
29 static void FreeAccess(void);
30 static void DumpAccess(StoreEntry
*, const char *);
32 friend class AccessCheck
;
35 static bool Enabled
; // true if at least one adaptation mechanism is
37 // these are global squid.conf options, documented elsewhere
38 static char *masterx_shared_name
; // global TODO: do we need TheConfig?
39 static int service_iteration_limit
;
40 static int send_client_ip
;
41 static int send_username
;
42 static int use_indirect_client
;
44 // Options below are accessed via Icap::TheConfig or Ecap::TheConfig
45 // TODO: move ICAP-specific options to Icap::Config and add TheConfig
47 int service_failure_limit
;
48 time_t oldest_service_failure
;
49 int service_revival_delay
;
51 static Notes metaHeaders
; ///< The list of configured meta headers
53 typedef Vector
<ServiceConfigPointer
> ServiceConfigs
;
54 ServiceConfigs serviceConfigs
;
59 void parseService(void);
60 void freeService(void);
61 void dumpService(StoreEntry
*, const char *) const;
62 ServicePointer
findService(const String
&);
65 * Creates and starts the adaptation services. In the case the adaptation
66 * mechanism is disabled then removes any reference to the services from
67 * access rules and service groups, and returns false.
68 * \return true if the services are ready and running, false otherwise
70 virtual bool finalize();
73 /// Removes any reference to the services from configuration
76 /// creates service configuration object that will parse and keep cfg info
77 virtual ServiceConfig
*newServiceConfig() const;
79 /// Removes the given service from all service groups.
80 void removeService(const String
& service
);
82 /// Removes access rules of the given service or group
83 void removeRule(const String
& id
);
86 Config(const Config
&); // unsupported
87 Config
&operator =(const Config
&); // unsupported
89 virtual ServicePointer
createService(const ServiceConfigPointer
&cfg
) = 0;
91 static void ParseServiceGroup(ServiceGroupPointer group
);
92 static void FreeServiceGroups(void);
93 static void DumpServiceGroups(StoreEntry
*, const char *);
96 } // namespace Adaptation
98 #endif /* SQUID_ADAPTATION__CONFIG_H */