QosConfig.h
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 #ifndef SQUID_SRC_IP_QOSCONFIG_H
10 #define SQUID_SRC_IP_QOSCONFIG_H
11 
12 #include "acl/forward.h"
13 #include "cbdata.h"
14 #include "comm/forward.h"
15 #include "hier_code.h"
16 #include "ip/forward.h"
17 #include "ip/NfMarkConfig.h"
18 #include "store/forward.h"
19 
20 #if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_H
21 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
22 #endif
23 #if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_TCP_H
24 #include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
25 #endif
26 #include <iosfwd>
27 #include <limits>
28 
29 class fde;
30 
31 // TODO: move to new Acl::Node framework
32 class acl_tos
33 {
35 
36 public:
37  acl_tos() : next(nullptr), aclList(nullptr), tos(0) {}
38  ~acl_tos();
39 
43 };
44 
45 // TODO: move to new Acl::Node framework
47 {
49 
50 public:
51  acl_nfmark() : next(nullptr), aclList(nullptr) {}
52  ~acl_nfmark();
53 
57 };
58 
59 namespace Ip
60 {
61 
66 namespace Qos
67 {
68 
73 };
74 
82 void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
83 
93 
102 bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm);
103 
112 int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
113 
122 int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
123 
131 int doTosLocalHit(const Comm::ConnectionPointer &conn);
132 
141 
147 int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos);
148 
155 int setSockTos(const int fd, tos_t tos, int type);
156 
162 int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark);
163 
170 int setSockNfmark(const int fd, nfmark_t mark);
171 
176 class Config
177 {
178 public:
179 
180  Config();
181  ~Config() {}
182 
183  void parseConfigLine();
184 
192  void dumpConfigLine(std::ostream &, const char *) const;
193 
195  bool isHitTosActive() const {
197  }
198 
200  bool isHitNfmarkActive() const {
202  }
203 
210  bool isAclNfmarkActive() const;
211 
216  bool isAclTosActive() const;
217 
225 
233 
239 
240 };
241 
243 extern Config TheConfig;
244 
245 } // namespace Qos
246 
247 } // namespace Ip
248 
249 /* legacy parser access wrappers */
252 void dump_QosConfig(StoreEntry *, const char * directiveName, const Ip::Qos::Config &);
253 
254 #endif /* SQUID_SRC_IP_QOSCONFIG_H */
255 
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:237
acl_nfmark()
Definition: QosConfig.h:51
ACLList * aclList
Definition: QosConfig.h:41
tos_t tosLocalHit
TOS value to apply to local cache hits.
Definition: QosConfig.h:218
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition: QosConfig.h:231
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:589
ACLList * aclList
Definition: QosConfig.h:55
bool isHitNfmarkActive() const
Whether we should modify netfilter marks based on cache hits and misses.
Definition: QosConfig.h:200
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:230
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition: QosConfig.cc:47
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:230
acl_nfmark * nfConnmarkToClient
The CONNMARK that the client connection should be marked with, based on ACL.
Definition: QosConfig.h:238
tos_t tos
Definition: QosConfig.h:42
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition: QosConfig.h:227
unsigned char tos_t
Definition: forward.h:27
@ dirOpened
opened (by Squid to an origin server or peer)
Definition: QosConfig.h:72
void parse_QosConfig(Ip::Qos::Config *c)
Definition: QosConfig.h:250
CBDATA_CLASS(acl_nfmark)
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream.
Definition: QosConfig.h:224
Definition: fde.h:51
acl_tos()
Definition: QosConfig.h:37
void dumpConfigLine(std::ostream &, const char *) const
report configuration using qos_flows syntax
Definition: QosConfig.cc:458
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition: QosConfig.h:223
void dump_QosConfig(StoreEntry *, const char *directiveName, const Ip::Qos::Config &)
Definition: QosConfig.cc:631
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition: QosConfig.h:219
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:232
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:279
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:236
acl_tos * next
Definition: QosConfig.h:40
uint32_t nfmark_t
Definition: forward.h:26
CBDATA_CLASS(acl_tos)
void free_QosConfig(Ip::Qos::Config *)
Definition: QosConfig.h:251
Definition: Xaction.cc:137
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:235
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition: QosConfig.h:226
ConnectionDirection
Possible Squid roles in connection handling.
Definition: QosConfig.h:70
Config TheConfig
Globally available instance of Qos::Config.
Definition: QosConfig.cc:287
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:229
bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm)
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition: QosConfig.cc:150
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:251
a netfilter mark/mask pair
Definition: NfMarkConfig.h:22
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:234
static char server[MAXLINE]
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:222
acl_nfmark * next
Definition: QosConfig.h:54
hier_code
Definition: hier_code.h:12
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:557
@ dirAccepted
accepted (from a client by Squid)
Definition: QosConfig.h:71
Ip::NfMarkConfig markConfig
Definition: QosConfig.h:56
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:272
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:220
void parseConfigLine()
Definition: QosConfig.cc:300
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:228
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition: QosConfig.h:195
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:221
bool isAclTosActive() const
Definition: QosConfig.cc:614
~acl_tos()
Definition: QosConfig.cc:32
bool isAclNfmarkActive() const
Definition: QosConfig.cc:597

 

Introduction

Documentation

Support

Miscellaneous