]>
Commit | Line | Data |
---|---|---|
bbc27441 AJ |
1 | /* |
2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors | |
3 | * | |
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. | |
7 | */ | |
8 | ||
64bdef96 AR |
9 | #ifndef SQUID_ADAPTATION__CONFIG_H |
10 | #define SQUID_ADAPTATION__CONFIG_H | |
11 | ||
6f58d7d7 | 12 | #include "acl/forward.h" |
64bdef96 | 13 | #include "adaptation/Elements.h" |
602d9612 A |
14 | #include "adaptation/forward.h" |
15 | #include "base/AsyncCall.h" | |
16 | #include "event.h" | |
d7f4a0b7 | 17 | #include "Notes.h" |
582c2af2 | 18 | #include "SquidString.h" |
64bdef96 | 19 | |
64bdef96 | 20 | class ConfigParser; |
582c2af2 FC |
21 | class HttpRequest; |
22 | class HttpReply; | |
64bdef96 | 23 | |
26ac0430 AJ |
24 | namespace Adaptation |
25 | { | |
64bdef96 | 26 | |
64bdef96 AR |
27 | class Config |
28 | { | |
29 | public: | |
8f361c50 | 30 | static void Finalize(bool enable); |
64bdef96 | 31 | |
62c7f90e | 32 | static void ParseServiceSet(void); |
a22e6cd3 | 33 | static void ParseServiceChain(void); |
62c7f90e AR |
34 | |
35 | static void ParseAccess(ConfigParser &parser); | |
36 | static void FreeAccess(void); | |
37 | static void DumpAccess(StoreEntry *, const char *); | |
38 | ||
b6b637eb | 39 | friend class AccessCheck; |
64bdef96 AR |
40 | |
41 | public: | |
8f361c50 | 42 | static bool Enabled; // true if at least one adaptation mechanism is |
64bdef96 | 43 | |
3ff65596 AR |
44 | // these are global squid.conf options, documented elsewhere |
45 | static char *masterx_shared_name; // global TODO: do we need TheConfig? | |
a22e6cd3 | 46 | static int service_iteration_limit; |
22fff3bf AR |
47 | static int send_client_ip; |
48 | static int send_username; | |
49 | static int use_indirect_client; | |
50 | ||
3ff65596 AR |
51 | // Options below are accessed via Icap::TheConfig or Ecap::TheConfig |
52 | // TODO: move ICAP-specific options to Icap::Config and add TheConfig | |
64bdef96 | 53 | int onoff; |
64bdef96 | 54 | int service_failure_limit; |
8277060a | 55 | time_t oldest_service_failure; |
64bdef96 AR |
56 | int service_revival_delay; |
57 | ||
d7f4a0b7 | 58 | static Notes metaHeaders; ///< The list of configured meta headers |
71be37e0 | 59 | |
c302ddb5 CT |
60 | static bool needHistory; ///< HttpRequest adaptation history should recorded |
61 | ||
c8ea3cc0 | 62 | typedef std::vector<ServiceConfigPointer> ServiceConfigs; |
e1e90d26 | 63 | ServiceConfigs serviceConfigs; |
64bdef96 AR |
64 | |
65 | Config(); | |
66 | virtual ~Config(); | |
67 | ||
68 | void parseService(void); | |
69 | void freeService(void); | |
70 | void dumpService(StoreEntry *, const char *) const; | |
c302ddb5 | 71 | ServiceConfigPointer findServiceConfig(const String&); |
64bdef96 | 72 | |
7e8c4ee9 CT |
73 | /** |
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 | |
78 | */ | |
79 | virtual bool finalize(); | |
64bdef96 | 80 | |
e1e90d26 | 81 | protected: |
7e8c4ee9 CT |
82 | /// Removes any reference to the services from configuration |
83 | virtual void clear(); | |
84 | ||
e1e90d26 AR |
85 | /// creates service configuration object that will parse and keep cfg info |
86 | virtual ServiceConfig *newServiceConfig() const; | |
87 | ||
7e8c4ee9 CT |
88 | /// Removes the given service from all service groups. |
89 | void removeService(const String& service); | |
90 | ||
91 | /// Removes access rules of the given service or group | |
92 | void removeRule(const String& id); | |
93 | ||
64bdef96 AR |
94 | private: |
95 | Config(const Config &); // unsupported | |
96 | Config &operator =(const Config &); // unsupported | |
97 | ||
6666da11 | 98 | virtual ServicePointer createService(const ServiceConfigPointer &cfg) = 0; |
a22e6cd3 AR |
99 | |
100 | static void ParseServiceGroup(ServiceGroupPointer group); | |
101 | static void FreeServiceGroups(void); | |
102 | static void DumpServiceGroups(StoreEntry *, const char *); | |
64bdef96 AR |
103 | }; |
104 | ||
105 | } // namespace Adaptation | |
106 | ||
107 | #endif /* SQUID_ADAPTATION__CONFIG_H */ |