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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors