Squid Web Cache master
Loading...
Searching...
No Matches
QosConfig.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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
29class fde;
30
31// TODO: move to new Acl::Node framework
33{
35
36public:
37 acl_tos() : next(nullptr), aclList(nullptr), tos(0) {}
38 ~acl_tos();
39
43};
44
45// TODO: move to new Acl::Node framework
58
59namespace Ip
60{
61
66namespace Qos
67{
68
74
82void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
83
93
102bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm);
103
112int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
113
122int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
123
132
141
147int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos);
148
155int setSockTos(const int fd, tos_t tos, int type);
156
162int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark);
163
170int setSockNfmark(const int fd, nfmark_t mark);
171
241
243extern Config TheConfig;
244
245} // namespace Qos
246
247} // namespace Ip
248
249/* legacy parser access wrappers */
252void dump_QosConfig(StoreEntry *, const char * directiveName, const Ip::Qos::Config &);
253
254#endif /* SQUID_SRC_IP_QOSCONFIG_H */
255
void dump_QosConfig(StoreEntry *, const char *directiveName, const Ip::Qos::Config &)
Definition QosConfig.cc:632
void free_QosConfig(Ip::Qos::Config *)
Definition QosConfig.h:251
void parse_QosConfig(Ip::Qos::Config *c)
Definition QosConfig.h:250
static char server[MAXLINE]
a netfilter mark/mask pair
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition QosConfig.h:228
tos_t tosMiss
TOS value to apply to cache misses.
Definition QosConfig.h:221
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition QosConfig.h:237
bool isAclTosActive() const
Definition QosConfig.cc:615
acl_nfmark * nfConnmarkToClient
The CONNMARK that the client connection should be marked with, based on ACL.
Definition QosConfig.h:238
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition QosConfig.h:229
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream.
Definition QosConfig.h:224
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition QosConfig.h:230
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition QosConfig.h:195
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition QosConfig.h:232
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition QosConfig.h:223
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition QosConfig.h:236
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition QosConfig.h:235
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition QosConfig.h:222
tos_t tosLocalHit
TOS value to apply to local cache hits.
Definition QosConfig.h:218
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition QosConfig.h:219
void parseConfigLine()
Definition QosConfig.cc:301
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition QosConfig.h:227
bool isHitNfmarkActive() const
Whether we should modify netfilter marks based on cache hits and misses.
Definition QosConfig.h:200
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition QosConfig.h:234
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition QosConfig.h:220
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition QosConfig.h:226
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition QosConfig.h:231
bool isAclNfmarkActive() const
Definition QosConfig.cc:598
void dumpConfigLine(std::ostream &, const char *) const
report configuration using qos_flows syntax
Definition QosConfig.cc:459
acl_nfmark * next
Definition QosConfig.h:54
CBDATA_CLASS(acl_nfmark)
Ip::NfMarkConfig markConfig
Definition QosConfig.h:56
ACLList * aclList
Definition QosConfig.h:55
tos_t tos
Definition QosConfig.h:42
acl_tos * next
Definition QosConfig.h:40
acl_tos()
Definition QosConfig.h:37
ACLList * aclList
Definition QosConfig.h:41
CBDATA_CLASS(acl_tos)
Definition fde.h:52
hier_code
Definition hier_code.h:12
unsigned char tos_t
Definition forward.h:27
uint32_t nfmark_t
Definition forward.h:26
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition QosConfig.cc:48
bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm)
Definition QosConfig.cc:186
ConnectionDirection
Possible Squid roles in connection handling.
Definition QosConfig.h:70
@ dirAccepted
accepted (from a client by Squid)
Definition QosConfig.h:71
@ dirOpened
opened (by Squid to an origin server or peer)
Definition QosConfig.h:72
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition QosConfig.cc:280
Config TheConfig
Globally available instance of Qos::Config.
Definition QosConfig.cc:288
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition QosConfig.cc:231
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition QosConfig.cc:558
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition QosConfig.cc:252
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition QosConfig.cc:273
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition QosConfig.cc:590
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition QosConfig.cc:151
Definition Xaction.cc:137