NfMarkConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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_NFMARKCONFIG_H
10 #define SQUID_NFMARKCONFIG_H
11 
12 #include "ip/forward.h"
13 
14 class SBuf;
15 
16 namespace Ip
17 {
18 
21 {
22 public:
26  NfMarkConfig(nfmark_t mark_val, nfmark_t mask_val): mark(mark_val), mask(mask_val) {}
27 
29  static NfMarkConfig Parse(const SBuf &token);
31  bool matches(const nfmark_t m) const { return (m & mask) == mark; }
33  bool isEmpty() const { return mark == 0; }
35  bool hasMask() const { return mask != 0xffffffff; }
39  nfmark_t applyToMark(nfmark_t m) const;
40 
42  nfmark_t mask = 0xffffffff;
43 };
44 
45 } // namespace Ip
46 
47 std::ostream &operator <<(std::ostream &os, const Ip::NfMarkConfig connmark);
48 
49 #endif // SQUID_NFMARKCONFIG_H
50 
bool isEmpty() const
whether the netfilter mark is unset
Definition: NfMarkConfig.h:33
Definition: client_db.h:22
Definition: SBuf.h:86
bool matches(const nfmark_t m) const
whether the &#39;m&#39; matches the configured mark/mask
Definition: NfMarkConfig.h:31
a netfilter mark/mask pair
Definition: NfMarkConfig.h:20
static NfMarkConfig Parse(const SBuf &token)
parses a token and returns an object, expects a "mark[/mask]" format
Definition: NfMarkConfig.cc:32
std::ostream & operator<<(std::ostream &os, const Address &ipa)
Definition: Address.h:352
NfMarkConfig(nfmark_t mark_val, nfmark_t mask_val)
creates an object with specified mark and mask
Definition: NfMarkConfig.h:26
nfmark_t applyToMark(nfmark_t m) const
Definition: NfMarkConfig.cc:46
bool hasMask() const
whether the mask is set
Definition: NfMarkConfig.h:35
NfMarkConfig()
creates an empty object
Definition: NfMarkConfig.h:24
uint32_t nfmark_t
Definition: forward.h:25

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors