]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ClientDelayConfig.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ClientDelayConfig.h
1 /*
2 * Copyright (C) 1996-2017 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_CLIENTDELAYCONFIG_H
10 #define SQUID_CLIENTDELAYCONFIG_H
11
12 #include "acl/forward.h"
13
14 #include <vector>
15
16 class StoreEntry;
17 class ConfigParser;
18
19 /// \ingroup DelayPoolsAPI
20
21 /* represents one client write limiting delay 'pool' */
22 class ClientDelayPool
23 {
24 public:
25 ClientDelayPool()
26 : access(NULL), rate(0), highwatermark(0) {}
27 void dump (StoreEntry * entry, unsigned int poolNumberMinusOne) const;
28 acl_access *access;
29 int rate;
30 int64_t highwatermark;
31 };
32
33 typedef std::vector<ClientDelayPool> ClientDelayPools;
34
35 /* represents configuration of client write limiting delay pools */
36 class ClientDelayConfig
37 {
38 public:
39 ClientDelayConfig()
40 : initial(50) {}
41 void freePoolCount();
42 void dumpPoolCount(StoreEntry * entry, const char *name) const;
43 /* parsing of client_delay_pools - number of pools */
44 void parsePoolCount();
45 /* parsing of client_delay_parameters lines */
46 void parsePoolRates();
47 /* parsing client_delay_access lines */
48 void parsePoolAccess(ConfigParser &parser);
49
50 void finalize(); ///< checks pools configuration
51
52 /* initial bucket level, how fill bucket at startup */
53 unsigned short initial;
54 ClientDelayPools pools;
55 private:
56 void clean();
57 };
58
59 #endif // SQUID_CLIENTDELAYCONFIG_H
60