]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ClientDelayConfig.cc
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
11 #include "acl/Gadgets.h"
12 #include "ClientDelayConfig.h"
13 #include "ConfigParser.h"
17 void ClientDelayPool::dump(StoreEntry
* entry
, unsigned int poolNumberMinusOne
) const
19 LOCAL_ARRAY(char, nom
, 32);
20 snprintf(nom
, 32, "client_delay_access %d", poolNumberMinusOne
+ 1);
21 dump_acl_access(entry
, nom
, access
);
22 storeAppendPrintf(entry
, "client_delay_parameters %d %d %" PRId64
"\n", poolNumberMinusOne
+ 1, rate
,highwatermark
);
23 storeAppendPrintf(entry
, "\n");
27 ClientDelayConfig::finalize()
29 for (unsigned int i
= 0; i
< pools
.size(); ++i
) {
30 /* pools require explicit 'allow' to assign a client into them */
31 if (!pools
[i
].access
) {
32 debugs(77, DBG_IMPORTANT
, "client_delay_pool #" << (i
+1) <<
33 " has no client_delay_access configured. " <<
34 "No client will ever use it.");
39 void ClientDelayConfig::freePoolCount()
44 void ClientDelayConfig::dumpPoolCount(StoreEntry
* entry
, const char *name
) const
47 storeAppendPrintf(entry
, "%s %d\n", name
, (int)pools
.size());
48 for (unsigned int i
= 0; i
< pools
.size(); ++i
)
49 pools
[i
].dump(entry
, i
);
53 void ClientDelayConfig::parsePoolCount()
56 debugs(3, DBG_CRITICAL
, "parse_client_delay_pool_count: multiple client_delay_pools lines, aborting all previous client_delay_pools config");
59 unsigned short pools_
;
60 ConfigParser::ParseUShort(&pools_
);
61 for (int i
= 0; i
< pools_
; ++i
) {
62 pools
.push_back(ClientDelayPool());
66 void ClientDelayConfig::parsePoolRates()
69 ConfigParser::ParseUShort(&pool
);
71 if (pool
< 1 || pool
> pools
.size()) {
72 debugs(3, DBG_CRITICAL
, "parse_client_delay_pool_rates: Ignoring pool " << pool
<< " not in 1 .. " << pools
.size());
78 pools
[pool
].rate
= GetInteger();
79 pools
[pool
].highwatermark
= GetInteger64();
82 void ClientDelayConfig::parsePoolAccess(ConfigParser
&parser
)
86 ConfigParser::ParseUShort(&pool
);
88 if (pool
< 1 || pool
> pools
.size()) {
89 debugs(3, DBG_CRITICAL
, "parse_client_delay_pool_rates: Ignoring pool " << pool
<< " not in 1 .. " << pools
.size());
94 aclParseAccessLine("client_delay_access", parser
, &pools
[pool
].access
);
97 void ClientDelayConfig::clean()
99 for (unsigned int i
= 0; i
< pools
.size(); ++i
) {
100 aclDestroyAccessList(&pools
[i
].access
);