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_QOSCONFIG_H
10#define SQUID_QOSCONFIG_H
11
12#include "acl/forward.h"
13#include "hier_code.h"
14#include "ip/forward.h"
15#include "ip/NfMarkConfig.h"
16
17#if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_H
18#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
19#endif
20#if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_TCP_H
21#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
22#endif
23#include <limits>
24
25class fde;
26
27// TODO: move to new ACL framework
29{
31
32public:
33 acl_tos() : next(nullptr), aclList(nullptr), tos(0) {}
34 ~acl_tos();
35
39};
40
41// TODO: move to new ACL framework
43{
45
46public:
47 acl_nfmark() : next(nullptr), aclList(nullptr) {}
49
53};
54
55namespace Ip
56{
57
62namespace Qos
63{
64
69};
70
78void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
79
89
99
108int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
109
118int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
119
128
137
144
151int setSockTos(const int fd, tos_t tos, int type);
152
159
166int setSockNfmark(const int fd, nfmark_t mark);
167
173{
174public:
175
176 Config();
178
179 void parseConfigLine();
180
188 void dumpConfigLine(char *entry, const char *name) const;
189
191 bool isHitTosActive() const {
193 }
194
196 bool isHitNfmarkActive() const {
198 }
199
206 bool isAclNfmarkActive() const;
207
212 bool isAclTosActive() const;
213
221
229
235
236};
237
239extern Config TheConfig;
240
241/* legacy parser access wrappers */
242#define parse_QosConfig(X) (X)->parseConfigLine()
243#define free_QosConfig(X)
244#define dump_QosConfig(e,n,X) do { \
245 char temp[256]; /* random number. change as needed. max config line length. */ \
246 (X).dumpConfigLine(temp,n); \
247 storeAppendPrintf(e, "%s", temp); \
248 } while(0);
249
250} // namespace Qos
251
252} // namespace Ip
253
254#endif /* SQUID_QOSCONFIG_H */
255
int conn
the current server connection FD
Definition: Transport.cc:26
#define ACLList
Definition: forward.h:46
static char server[MAXLINE]
a netfilter mark/mask pair
Definition: NfMarkConfig.h:21
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:224
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:217
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:233
bool isAclTosActive() const
Definition: QosConfig.cc:627
acl_nfmark * nfConnmarkToClient
The CONNMARK that the client connection should be marked with, based on ACL.
Definition: QosConfig.h:234
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:225
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream.
Definition: QosConfig.h:220
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:226
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition: QosConfig.h:191
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:228
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition: QosConfig.h:219
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:232
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:231
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:218
tos_t tosLocalHit
TOS value to apply to local cache hits.
Definition: QosConfig.h:214
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition: QosConfig.h:215
void parseConfigLine()
Definition: QosConfig.cc:296
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition: QosConfig.h:223
bool isHitNfmarkActive() const
Whether we should modify netfilter marks based on cache hits and misses.
Definition: QosConfig.h:196
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:230
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:216
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition: QosConfig.h:222
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition: QosConfig.h:227
void dumpConfigLine(char *entry, const char *name) const
Definition: QosConfig.cc:468
bool isAclNfmarkActive() const
Definition: QosConfig.cc:610
acl_nfmark * next
Definition: QosConfig.h:50
CBDATA_CLASS(acl_nfmark)
Ip::NfMarkConfig markConfig
Definition: QosConfig.h:52
ACLList * aclList
Definition: QosConfig.h:51
acl_nfmark()
Definition: QosConfig.h:47
tos_t tos
Definition: QosConfig.h:38
acl_tos * next
Definition: QosConfig.h:36
acl_tos()
Definition: QosConfig.h:33
ACLList * aclList
Definition: QosConfig.h:37
~acl_tos()
Definition: QosConfig.cc:28
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:43
bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm)
Definition: QosConfig.cc:181
ConnectionDirection
Possible Squid roles in connection handling.
Definition: QosConfig.h:66
@ dirAccepted
accepted (from a client by Squid)
Definition: QosConfig.h:67
@ dirOpened
opened (by Squid to an origin server or peer)
Definition: QosConfig.h:68
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:275
Config TheConfig
Globally available instance of Qos::Config.
Definition: QosConfig.cc:283
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:226
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:570
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:247
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:268
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:602
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition: QosConfig.cc:146
Definition: Xaction.cc:139

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors