QosConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
16 #if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_H
17 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
18 #endif
19 #if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_TCP_H
20 #include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
21 #endif
22 #include <limits>
23 
24 class fde;
25 
26 // TODO: move to new ACL framework
27 class acl_tos
28 {
30 
31 public:
32  acl_tos() : next(NULL), aclList(NULL), tos(0) {}
33  ~acl_tos();
34 
38 };
39 
40 // TODO: move to new ACL framework
42 {
44 
45 public:
47  ~acl_nfmark();
48 
52 };
53 
54 namespace Ip
55 {
56 
61 namespace Qos
62 {
63 
71 void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde);
72 
80 void getNfmarkFromServer(const Comm::ConnectionPointer &server, const fde *clientFde);
81 
82 #if USE_LIBNETFILTERCONNTRACK
83 
92 int getNfMarkCallback(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *clientFde);
93 #endif
94 
103 int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
104 
113 int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode);
114 
122 int doTosLocalHit(const Comm::ConnectionPointer &conn);
123 
132 
138 int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos);
139 
146 int setSockTos(const int fd, tos_t tos, int type);
147 
153 int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark);
154 
161 int setSockNfmark(const int fd, nfmark_t mark);
162 
167 class Config
168 {
169 public:
170 
171  Config();
172  ~Config() {}
173 
174  void parseConfigLine();
175 
183  void dumpConfigLine(char *entry, const char *name) const;
184 
186  bool isHitTosActive() const {
188  }
189 
191  bool isHitNfmarkActive() const {
193  }
194 
201  bool isAclNfmarkActive() const;
202 
207  bool isAclTosActive() const;
208 
216 
224 
229 
230 };
231 
233 extern Config TheConfig;
234 
235 /* legacy parser access wrappers */
236 #define parse_QosConfig(X) (X)->parseConfigLine()
237 #define free_QosConfig(X)
238 #define dump_QosConfig(e,n,X) do { \
239  char temp[256]; /* random number. change as needed. max config line length. */ \
240  (X).dumpConfigLine(temp,n); \
241  storeAppendPrintf(e, "%s", temp); \
242  } while(0);
243 
244 } // namespace Qos
245 
246 } // namespace Ip
247 
248 #endif /* SQUID_QOSCONFIG_H */
249 
nfmark_t markLocalHit
Netfilter mark value to apply to local cache hits.
Definition: QosConfig.h:217
tos_t preserveMissTosMask
The mask to apply when preserving the TOS of misses. Applies to preserved value from upstream...
Definition: QosConfig.h:215
bool isAclNfmarkActive() const
Definition: QosConfig.cc:530
int type
Definition: errorpage.cc:79
acl_tos * tosToClient
The TOS that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:226
#define ACLList
Definition: forward.h:45
acl_tos * next
Definition: QosConfig.h:35
void dumpConfigLine(char *entry, const char *name) const
Definition: QosConfig.cc:392
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:218
tos_t tos
Definition: QosConfig.h:37
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:171
acl_nfmark * next
Definition: QosConfig.h:49
tos_t tosParentHit
TOS value to apply to hits from parent.
Definition: QosConfig.h:211
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:191
tos_t tosMiss
TOS value to apply to cache misses.
Definition: QosConfig.h:212
nfmark_t preserveMissMarkMask
The mask to apply when preserving the netfilter mark of misses. Applied to preserved value from upstr...
Definition: QosConfig.h:223
tos_t tosMissMask
Mask for TOS value to apply to cache misses. Applied to the tosMiss value.
Definition: QosConfig.h:213
nfmark_t markMiss
Netfilter mark value to apply to cache misses.
Definition: QosConfig.h:220
acl_nfmark * nfmarkToServer
The MARK that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:227
acl_nfmark()
Definition: QosConfig.h:46
CBDATA_CLASS(acl_tos)
Config TheConfig
Globally available instance of Qos::Config.
Definition: QosConfig.cc:207
tos_t tosLocalHit
TOS value to apply to local cache hits.
Definition: QosConfig.h:209
tos_t tosSiblingHit
TOS value to apply to hits from siblings.
Definition: QosConfig.h:210
bool isHitTosActive() const
Whether we should modify TOS flags based on cache hits and misses.
Definition: QosConfig.h:186
CBDATA_CLASS(acl_nfmark)
~acl_tos()
Definition: QosConfig.cc:26
hier_code
Definition: hier_code.h:12
void parseConfigLine()
Definition: QosConfig.cc:220
ACLList * aclList
Definition: QosConfig.h:50
static char server[MAXLINE]
nfmark_t markParentHit
Netfilter mark value to apply to hits from parent.
Definition: QosConfig.h:219
bool preserveMissMark
Whether to preserve netfilter mark value of inbound connection.
Definition: QosConfig.h:222
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:199
acl_tos * tosToServer
The TOS that packets to the web server should be marked with, based on ACL.
Definition: QosConfig.h:225
Definition: fde.h:49
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:522
nfmark_t markMissMask
Mask for netfilter mark value to apply to cache misses. Applied to the markMiss value.
Definition: QosConfig.h:221
acl_tos()
Definition: QosConfig.h:32
bool preserveMissTos
Whether to preserve the TOS value of the inbound packet for misses.
Definition: QosConfig.h:214
bool isAclTosActive() const
Definition: QosConfig.cc:547
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:192
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:494
acl_nfmark * nfmarkToClient
The MARK that packets to the client should be marked with, based on ACL.
Definition: QosConfig.h:228
void getNfmarkFromServer(const Comm::ConnectionPointer &server, const fde *clientFde)
Definition: QosConfig.cc:80
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition: QosConfig.cc:41
uint32_t nfmark_t
Definition: forward.h:25
nfmark_t nfmark
Definition: QosConfig.h:51
#define NULL
Definition: types.h:166
ACLList * aclList
Definition: QosConfig.h:36
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:150
Definition: Address.cc:190

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors