]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Config.h
Merged from parent (trunk r11240, circa 3.2.0.5+)
[thirdparty/squid.git] / src / adaptation / Config.h
1 #ifndef SQUID_ADAPTATION__CONFIG_H
2 #define SQUID_ADAPTATION__CONFIG_H
3
4 #include "event.h"
5 #include "base/AsyncCall.h"
6 #include "adaptation/forward.h"
7 #include "adaptation/Elements.h"
8
9 class acl_access;
10 class ConfigParser;
11
12 namespace Adaptation
13 {
14
15 class Config
16 {
17 public:
18 static void Finalize(bool enable);
19
20 static void ParseServiceSet(void);
21 static void ParseServiceChain(void);
22
23 static void ParseAccess(ConfigParser &parser);
24 static void FreeAccess(void);
25 static void DumpAccess(StoreEntry *, const char *);
26
27 friend class AccessCheck;
28
29 public:
30 static bool Enabled; // true if at least one adaptation mechanism is
31
32 // these are global squid.conf options, documented elsewhere
33 static char *masterx_shared_name; // global TODO: do we need TheConfig?
34 static int service_iteration_limit;
35 static int send_client_ip;
36 static int send_username;
37 static int use_indirect_client;
38
39 // Options below are accessed via Icap::TheConfig or Ecap::TheConfig
40 // TODO: move ICAP-specific options to Icap::Config and add TheConfig
41 int onoff;
42 int service_failure_limit;
43 time_t oldest_service_failure;
44 int service_revival_delay;
45
46 typedef Vector<ServiceConfigPointer> ServiceConfigs;
47 ServiceConfigs serviceConfigs;
48
49 Config();
50 virtual ~Config();
51
52 void parseService(void);
53 void freeService(void);
54 void dumpService(StoreEntry *, const char *) const;
55 ServicePointer findService(const String&);
56
57 virtual void finalize();
58
59 protected:
60 /// creates service configuration object that will parse and keep cfg info
61 virtual ServiceConfig *newServiceConfig() const;
62
63 private:
64 Config(const Config &); // unsupported
65 Config &operator =(const Config &); // unsupported
66
67 virtual ServicePointer createService(ServiceConfigPointer cfg) = 0;
68
69 static void ParseServiceGroup(ServiceGroupPointer group);
70 static void FreeServiceGroups(void);
71 static void DumpServiceGroups(StoreEntry *, const char *);
72 };
73
74 } // namespace Adaptation
75
76 #endif /* SQUID_ADAPTATION__CONFIG_H */