]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ip/Qos.cci
Cleanup: sync NTLM and Negotiate UserRequest code
[thirdparty/squid.git] / src / ip / Qos.cci
CommitLineData
425de4c8
AJ
1/* Inline QOS functions */
2
3int
4Ip::Qos::setSockTos(int fd, tos_t tos)
5{
6#ifdef IP_TOS
7 int x = setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos_t));
8 if (x < 0)
9 debugs(50, 2, "Ip::Qos::setSockTos: setsockopt(IP_TOS) on FD " << fd << ": " << xstrerror());
10 return x;
11#else
12 debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IP_TOS) not supported on this platform");
13 return -1;
14#endif
15}
16
17int
18Ip::Qos::setSockNfmark(int fd, nfmark_t mark)
19{
20#if SO_MARK
21 int x = setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(nfmark_t));
22 if (x < 0)
23 debugs(50, 2, "setSockNfmark: setsockopt(SO_MARK) on FD " << fd << ": " << xstrerror());
24 return x;
25#else
26 debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(SO_MARK) not supported on this platform");
27 return -1;
28#endif
29}
30
31bool
32Ip::Qos::Config::isHitTosActive() const
33{
34 return (tosLocalHit || tosSiblingHit || tosParentHit || tosMiss || preserveMissTos);
35}
36
37bool
38Ip::Qos::Config::isHitNfmarkActive() const
39{
40 return (markLocalHit || markSiblingHit || markParentHit || markMiss || preserveMissMark);
41}
42
43bool
44Ip::Qos::Config::isAclNfmarkActive() const
45{
46 acl_nfmark * nfmarkAcls [] = { nfmarkToServer, nfmarkToClient };
ab745b44 47
425de4c8
AJ
48 for (int i=0; i<2; i++) {
49 while (nfmarkAcls[i]) {
50 acl_nfmark *l = nfmarkAcls[i];
51 if (l->nfmark > 0)
ab745b44 52 return true;
425de4c8
AJ
53 nfmarkAcls[i] = l->next;
54 }
55 }
56
57 return false;
58}
59
60bool
61Ip::Qos::Config::isAclTosActive() const
62{
63 acl_tos * tosAcls [] = { tosToServer, tosToClient };
64
65 for (int i=0; i<2; i++) {
66 while (tosAcls[i]) {
67 acl_tos *l = tosAcls[i];
68 if (l->tos > 0)
69 return true;
70 tosAcls[i] = l->next;
71 }
72 }
73
74 return false;
75}