QosConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 
25 class fde;
26 
27 // TODO: move to new ACL framework
28 class acl_tos
29 {
31 
32 public:
33  acl_tos() : next(NULL), aclList(NULL), tos(0) {}
34  ~acl_tos();
35 
39 };
40 
41 // TODO: move to new ACL framework
43 {
45 
46 public:
48  ~acl_nfmark();
49 
53 };
54 
55 namespace Ip
56 {
57 
62 namespace Qos
63 {
64 
69 };
70 
78 void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
79 
89 
99 
108 int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
109 
118 int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
119 
128 
137 
144 
151 int setSockTos(const int fd, tos_t tos, int type);
152 
159 
166 int setSockNfmark(const int fd, nfmark_t mark);
167 
172 class Config
173 {
174 public:
175 
176  Config();
177  ~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 
239 extern 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 
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition: QosConfig.h:222
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream...
Definition: QosConfig.h:220
bool isAclNfmarkActive() const
Definition: QosConfig.cc:594
ConnectionDirection
Possible Squid roles in connection handling.
Definition: QosConfig.h:66
int type
Definition: errorpage.cc:78
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:231
#define ACLList
Definition: forward.h:45
acl_tos * next
Definition: QosConfig.h:36
void dumpConfigLine(char *entry, const char *name) const
Definition: QosConfig.cc:456
int conn
the current server connection FD
Definition: Transport.cc:26
nfmark_t markSiblingHit
Netfilter mark value to apply to hits from siblings.
Definition: QosConfig.h:223
tos_t tos
Definition: QosConfig.h:38
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:235
acl_nfmark * next
Definition: QosConfig.h:50
a netfilter mark/mask pair
Definition: NfMarkConfig.h:20
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:216
unsigned char tos_t
Definition: forward.h:26
bool isHitNfmarkActive() const
Whether we should modify netfilter marks based on cache hits and misses.
Definition: QosConfig.h:196
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:217
bool setNfConnmark(Comm::ConnectionPointer &conn, const ConnectionDirection connDir, const NfMarkConfig &cm)
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition: QosConfig.cc:141
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:228
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:218
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:225
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:232
acl_nfmark()
Definition: QosConfig.h:47
Ip::NfMarkConfig markConfig
Definition: QosConfig.h:52
CBDATA_CLASS(acl_tos)
Config TheConfig
Globally available instance of Qos::Config.
Definition: QosConfig.cc:271
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
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition: QosConfig.h:191
CBDATA_CLASS(acl_nfmark)
~acl_tos()
Definition: QosConfig.cc:26
hier_code
Definition: hier_code.h:12
void parseConfigLine()
Definition: QosConfig.cc:284
ACLList * aclList
Definition: QosConfig.h:51
static char server[MAXLINE]
acl_nfmark * nfConnmarkToClient
The CONNMARK that the client connection should be marked with, based on ACL.
Definition: QosConfig.h:234
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:224
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition: QosConfig.h:227
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:263
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:230
accepted (from a client by Squid)
Definition: QosConfig.h:67
Definition: fde.h:49
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:586
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:226
acl_tos()
Definition: QosConfig.h:33
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition: QosConfig.h:219
bool isAclTosActive() const
Definition: QosConfig.cc:611
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:256
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:558
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:233
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition: QosConfig.cc:41
uint32_t nfmark_t
Definition: forward.h:25
#define NULL
Definition: types.h:166
opened (by Squid to an origin server or peer)
Definition: QosConfig.h:68
ACLList * aclList
Definition: QosConfig.h:37
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:214
Definition: Address.cc:190

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors