Config.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 
9 #ifndef SQUID_ADAPTATION__CONFIG_H
10 #define SQUID_ADAPTATION__CONFIG_H
11 
12 #include "acl/forward.h"
13 #include "adaptation/Elements.h"
14 #include "adaptation/forward.h"
15 #include "base/AsyncCall.h"
16 #include "event.h"
17 #include "Notes.h"
18 #include "SquidString.h"
19 
20 class ConfigParser;
21 class HttpRequest;
22 class HttpReply;
23 
24 namespace Adaptation
25 {
26 
27 class Config
28 {
29 public:
30  static void Finalize(bool enable);
31 
32  static void ParseServiceSet(void);
33  static void ParseServiceChain(void);
34 
35  static void ParseAccess(ConfigParser &parser);
36  static void FreeAccess(void);
37  static void DumpAccess(StoreEntry *, const char *);
38 
39  friend class AccessCheck;
40 
41 public:
42  static bool Enabled; // true if at least one adaptation mechanism is
43 
44  // these are global squid.conf options, documented elsewhere
45  static char *masterx_shared_name; // global TODO: do we need TheConfig?
47  static int send_client_ip;
48  static int send_username;
49  static int use_indirect_client;
50 
51  // Options below are accessed via Icap::TheConfig or Ecap::TheConfig
52  // TODO: move ICAP-specific options to Icap::Config and add TheConfig
53  int onoff;
57 
58  static Notes metaHeaders;
59 
60  static bool needHistory;
61 
62  typedef std::vector<ServiceConfigPointer> ServiceConfigs;
63  ServiceConfigs serviceConfigs;
64 
65  Config();
66  virtual ~Config();
67 
68  void parseService(void);
69  void freeService(void);
70  void dumpService(StoreEntry *, const char *) const;
72 
79  virtual bool finalize();
80 
81 protected:
83  virtual void clear();
84 
86  virtual ServiceConfig *newServiceConfig() const;
87 
89  void removeService(const String& service);
90 
92  void removeRule(const String& id);
93 
94 private:
95  Config(const Config &); // unsupported
96  Config &operator =(const Config &); // unsupported
97 
98  virtual ServicePointer createService(const ServiceConfigPointer &cfg) = 0;
99 
100  static void ParseServiceGroup(ServiceGroupPointer group);
101  static void FreeServiceGroups(void);
102  static void DumpServiceGroups(StoreEntry *, const char *);
103 };
104 
105 } // namespace Adaptation
106 
107 #endif /* SQUID_ADAPTATION__CONFIG_H */
108 
virtual ~Config()
Definition: Config.cc:315
static bool needHistory
HttpRequest adaptation history should recorded.
Definition: Config.h:60
static int use_indirect_client
Definition: Config.h:49
time_t oldest_service_failure
Definition: Config.h:55
ServiceConfigs serviceConfigs
Definition: Config.h:63
virtual bool finalize()
Definition: Config.cc:182
static void DumpServiceGroups(StoreEntry *, const char *)
Definition: Config.cc:268
virtual ServicePointer createService(const ServiceConfigPointer &cfg)=0
static void DumpAccess(StoreEntry *, const char *)
Definition: Config.cc:297
static int send_username
Definition: Config.h:48
static Notes metaHeaders
The list of configured meta headers.
Definition: Config.h:58
static void ParseServiceGroup(ServiceGroupPointer group)
Definition: Config.cc:251
std::vector< ServiceConfigPointer > ServiceConfigs
Definition: Config.h:62
int service_revival_delay
Definition: Config.h:56
static void FreeServiceGroups(void)
Definition: Config.cc:259
void freeService(void)
Definition: Config.cc:144
int service_failure_limit
Definition: Config.h:54
ServiceConfigPointer findServiceConfig(const String &)
Definition: Config.cc:89
void dumpService(StoreEntry *, const char *) const
Definition: Config.cc:155
static int send_client_ip
Definition: Config.h:47
static void ParseAccess(ConfigParser &parser)
Definition: Config.cc:276
Definition: Notes.h:108
static void ParseServiceSet(void)
Definition: Config.cc:239
void parseService(void)
Definition: Config.cc:133
Config & operator=(const Config &)
static char * masterx_shared_name
Definition: Config.h:45
static int service_iteration_limit
Definition: Config.h:46
virtual void clear()
Removes any reference to the services from configuration.
Definition: Config.cc:119
static bool Enabled
Definition: Config.h:42
static void ParseServiceChain(void)
Definition: Config.cc:245
static void FreeAccess(void)
Definition: Config.cc:288
virtual ServiceConfig * newServiceConfig() const
creates service configuration object that will parse and keep cfg info
Definition: Config.cc:52
static void Finalize(bool enable)
Definition: Config.cc:228
void removeService(const String &service)
Removes the given service from all service groups.
Definition: Config.cc:58
void removeRule(const String &id)
Removes access rules of the given service or group.
Definition: Config.cc:101

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors