2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_ADAPTATION__CONFIG_H
10 #define SQUID_ADAPTATION__CONFIG_H
12 #include "acl/forward.h"
13 #include "adaptation/Elements.h"
14 #include "adaptation/forward.h"
15 #include "base/AsyncCall.h"
18 #include "SquidString.h"
30 static void Finalize(bool enable
);
32 static void ParseServiceSet(void);
33 static void ParseServiceChain(void);
35 static void ParseAccess(ConfigParser
&parser
);
36 static void FreeAccess(void);
37 static void DumpAccess(StoreEntry
*, const char *);
39 friend class AccessCheck
;
42 static bool Enabled
; // true if at least one adaptation mechanism is
44 // these are global squid.conf options, documented elsewhere
45 static char *masterx_shared_name
; // global TODO: do we need TheConfig?
46 static int service_iteration_limit
;
47 static int send_client_ip
;
48 static int send_username
;
49 static int use_indirect_client
;
51 // Options below are accessed via Icap::TheConfig or Ecap::TheConfig
52 // TODO: move ICAP-specific options to Icap::Config and add TheConfig
54 int service_failure_limit
;
55 time_t oldest_service_failure
;
56 int service_revival_delay
;
58 static Notes metaHeaders
; ///< The list of configured meta headers
60 static bool needHistory
; ///< HttpRequest adaptation history should recorded
62 typedef std::vector
<ServiceConfigPointer
> ServiceConfigs
;
63 ServiceConfigs serviceConfigs
;
68 void parseService(void);
69 void freeService(void);
70 void dumpService(StoreEntry
*, const char *) const;
71 ServiceConfigPointer
findServiceConfig(const String
&);
74 * Creates and starts the adaptation services. In the case the adaptation
75 * mechanism is disabled then removes any reference to the services from
76 * access rules and service groups, and returns false.
77 * \return true if the services are ready and running, false otherwise
79 virtual bool finalize();
82 /// Removes any reference to the services from configuration
85 /// creates service configuration object that will parse and keep cfg info
86 virtual ServiceConfig
*newServiceConfig() const;
88 /// Removes the given service from all service groups.
89 void removeService(const String
& service
);
91 /// Removes access rules of the given service or group
92 void removeRule(const String
& id
);
95 Config(const Config
&); // unsupported
96 Config
&operator =(const Config
&); // unsupported
98 virtual ServicePointer
createService(const ServiceConfigPointer
&cfg
) = 0;
100 static void ParseServiceGroup(ServiceGroupPointer group
);
101 static void FreeServiceGroups(void);
102 static void DumpServiceGroups(StoreEntry
*, const char *);
105 } // namespace Adaptation
107 #endif /* SQUID_ADAPTATION__CONFIG_H */