]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/ServiceConfig.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / ServiceConfig.h
1 #ifndef SQUID_ADAPTATION__SERVICE_CONFIG_H
2 #define SQUID_ADAPTATION__SERVICE_CONFIG_H
3
4 #include "adaptation/Elements.h"
5 #include "base/RefCount.h"
6 #include "SquidString.h"
7
8 namespace Adaptation
9 {
10
11 // manages adaptation service configuration in squid.conf
12 class ServiceConfig: public RefCountable
13 {
14 public:
15 ServiceConfig();
16
17 const char *methodStr() const;
18 const char *vectPointStr() const;
19
20 bool parse();
21
22 public:
23 String key; // service_configConfig name in the configuration file
24 String uri; // service_configConfig URI
25
26 // service_configConfig URI components
27 String protocol;
28 String host;
29 String resource;
30 int port;
31
32 Method method; // what is being adapted (REQMOD vs RESPMOD)
33 VectPoint point; // where the adaptation happens (pre- or post-cache)
34 bool bypass;
35
36 // options
37 long maxConn; ///< maximum number of concurrent service transactions
38 SrvBehaviour onOverload; ///< how to handle Max-Connections feature
39 bool routing; ///< whether this service may determine the next service(s)
40 bool ipv6; ///< whether this service uses IPv6 transport (default IPv4)
41
42 protected:
43 Method parseMethod(const char *buf) const;
44 VectPoint parseVectPoint(const char *buf) const;
45
46 /// interpret parsed values
47 bool grokBool(bool &var, const char *name, const char *value);
48 bool grokUri(const char *value);
49 bool grokLong(long &var, const char *name, const char *value);
50 /// handle on-overload configuration option
51 bool grokOnOverload(SrvBehaviour &var, const char *value);
52 /// handle name=value configuration option with name unknown to Squid
53 virtual bool grokExtension(const char *name, const char *value);
54 };
55
56 } // namespace Adaptation
57
58 #endif /* SQUID_ADAPTATION__SERVICE_CONFIG_H */