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 "cbdata.h"
14#include "comm/forward.h"
15#include "hier_code.h"
16#include "ip/forward.h"
17#include "ip/NfMarkConfig.h"
18
19#if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_H
20#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
21#endif
22#if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_TCP_H
23#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
24#endif
25#include <limits>
26
27class fde;
28
29// TODO: move to new ACL framework
31{
33
34public:
35 acl_tos() : next(nullptr), aclList(nullptr), tos(0) {}
36 ~acl_tos();
37
41};
42
43// TODO: move to new ACL framework
45{
47
48public:
49 acl_nfmark() : next(nullptr), aclList(nullptr) {}
51
55};
56
57namespace Ip
58{
59
64namespace Qos
65{
66
71};
72
80void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
81
91
101
110int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
111
120int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
121
130
139
146
153int setSockTos(const int fd, tos_t tos, int type);
154
161
168int setSockNfmark(const int fd, nfmark_t mark);
169
175{
176public:
177
178 Config();
180
181 void parseConfigLine();
182
190 void dumpConfigLine(char *entry, const char *name) const;
191
193 bool isHitTosActive() const {
195 }
196
198 bool isHitNfmarkActive() const {
200 }
201
208 bool isAclNfmarkActive() const;
209
214 bool isAclTosActive() const;
215
223
231
237
238};
239
241extern Config TheConfig;
242
243/* legacy parser access wrappers */
244#define parse_QosConfig(X) (X)->parseConfigLine()
245#define free_QosConfig(X)
246#define dump_QosConfig(e,n,X) do { \
247 char temp[256]; /* random number. change as needed. max config line length. */ \
248 (X).dumpConfigLine(temp,n); \
249 storeAppendPrintf(e, "%s", temp); \
250 } while(0);
251
252} // namespace Qos
253
254} // namespace Ip
255
256#endif /* SQUID_QOSCONFIG_H */
257
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:23
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:226
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:219
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:235
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:236
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:227
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream.
Definition: QosConfig.h:222
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:228
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition: QosConfig.h:193
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:230
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition: QosConfig.h:221
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:234
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:233
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:220
tos_t tosLocalHit
TOS value to apply to local cache hits.
Definition: QosConfig.h:216
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition: QosConfig.h:217
void parseConfigLine()
Definition: QosConfig.cc:296
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition: QosConfig.h:225
bool isHitNfmarkActive() const
Whether we should modify netfilter marks based on cache hits and misses.
Definition: QosConfig.h:198
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:232
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:218
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition: QosConfig.h:224
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition: QosConfig.h:229
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:52
CBDATA_CLASS(acl_nfmark)
Ip::NfMarkConfig markConfig
Definition: QosConfig.h:54
ACLList * aclList
Definition: QosConfig.h:53
acl_nfmark()
Definition: QosConfig.h:49
tos_t tos
Definition: QosConfig.h:40
acl_tos * next
Definition: QosConfig.h:38
acl_tos()
Definition: QosConfig.h:35
ACLList * aclList
Definition: QosConfig.h:39
~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:68
@ dirAccepted
accepted (from a client by Squid)
Definition: QosConfig.h:69
@ dirOpened
opened (by Squid to an origin server or peer)
Definition: QosConfig.h:70
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