DelayConfig.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 /* DEBUG: section 77 Delay Pools */
10 
11 #include "squid.h"
12 
13 #if USE_DELAY_POOLS
14 #include "acl/Acl.h"
15 #include "acl/Gadgets.h"
16 #include "ConfigParser.h"
17 #include "DelayConfig.h"
18 #include "DelayPool.h"
19 #include "DelayPools.h"
20 #include "Store.h"
21 
22 void
24 {
25  unsigned short pools_;
27  DelayPools::pools(pools_);
28 }
29 
30 void
32 {
33  unsigned short pool;
34 
36 
37  if (pool < 1 || pool > DelayPools::pools()) {
38  debugs(3, DBG_CRITICAL, "parse_delay_pool_class: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
39  return;
40  }
41 
42  unsigned short delay_class_;
43  ConfigParser::ParseUShort(&delay_class_);
44 
45  if (delay_class_ < 1 || delay_class_ > 5) {
46  debugs(3, DBG_CRITICAL, "parse_delay_pool_class: Ignoring pool " << pool << " class " << delay_class_ << " not in 1 .. 5");
47  return;
48  }
49 
50  --pool;
51 
52  DelayPools::delay_data[pool].createPool(delay_class_);
53 }
54 
55 void
57 {
58  unsigned short pool;
60 
61  if (pool < 1 || pool > DelayPools::pools()) {
62  debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
63  return;
64  }
65 
66  --pool;
67 
68  if (!DelayPools::delay_data[pool].theComposite().getRaw()) {
69  debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool + 1 << " attempt to set rates with class not set");
70  return;
71  }
72 
74 }
75 
76 void
78 {
79  unsigned short pool;
80 
82 
83  if (pool < 1 || pool > DelayPools::pools()) {
84  debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
85  return;
86  }
87 
88  --pool;
89  aclParseAccessLine("delay_access", parser, &DelayPools::delay_data[pool].access);
90 }
91 
92 void
94 {
96  initial = 50;
97 }
98 
99 void
100 DelayConfig::dumpPoolCount(StoreEntry * entry, const char *name) const
101 {
102  int i;
103 
104  if (!DelayPools::pools()) {
105  storeAppendPrintf(entry, "%s 0\n", name);
106  return;
107  }
108 
109  storeAppendPrintf(entry, "%s %d\n", name, DelayPools::pools());
110 
111  for (i = 0; i < DelayPools::pools(); ++i)
112  DelayPools::delay_data[i].dump (entry, i);
113 }
114 
115 #endif /* USE_DELAY_POOLS */
116 
#define DBG_CRITICAL
Definition: Stream.h:37
void parsePoolClass()
Definition: DelayConfig.cc:31
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:855
void parsePoolAccess(ConfigParser &parser)
Definition: DelayConfig.cc:77
static void FreePools()
Definition: delay_pools.cc:555
void freePoolCount()
Definition: DelayConfig.cc:93
void createPool(u_char delay_class)
Definition: DelayPool.cc:63
void dumpPoolCount(StoreEntry *entry, const char *name) const
Definition: DelayConfig.cc:100
void parse()
Definition: DelayPool.cc:35
static unsigned short pools()
Definition: delay_pools.cc:564
unsigned short initial
Definition: DelayConfig.h:28
static DelayPool * delay_data
Definition: DelayPools.h:46
void aclParseAccessLine(const char *directive, ConfigParser &, acl_access **config)
Parses a single line of a "action followed by acls" directive (e.g., http_access).
Definition: Gadgets.cc:132
static void ParseUShort(unsigned short *var)
Definition: cache_cf.cc:3100
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
void parsePoolRates()
Definition: DelayConfig.cc:56
void parsePoolCount()
Definition: DelayConfig.cc:23

 

Introduction

Documentation

Support

Miscellaneous