NfMarkConfig.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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#include <iosfwd>
15
16class SBuf;
17
18namespace Ip
19{
20
23{
24public:
28 NfMarkConfig(nfmark_t mark_val, nfmark_t mask_val): mark(mark_val), mask(mask_val) {}
29
31 static NfMarkConfig Parse(const SBuf &token);
33 bool matches(const nfmark_t m) const { return (m & mask) == mark; }
35 bool isEmpty() const { return mark == 0; }
37 bool hasMask() const { return mask != 0xffffffff; }
42
44 nfmark_t mask = 0xffffffff;
45};
46
47std::ostream &operator <<(std::ostream &, NfMarkConfig);
48
49} // namespace Ip
50
51#endif // SQUID_NFMARKCONFIG_H
52
a netfilter mark/mask pair
Definition: NfMarkConfig.h:23
NfMarkConfig()
creates an empty object
Definition: NfMarkConfig.h:26
bool hasMask() const
whether the mask is set
Definition: NfMarkConfig.h:37
NfMarkConfig(nfmark_t mark_val, nfmark_t mask_val)
creates an object with specified mark and mask
Definition: NfMarkConfig.h:28
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:33
bool isEmpty() const
whether the netfilter mark is unset
Definition: NfMarkConfig.h:35
Definition: SBuf.h:94
uint32_t nfmark_t
Definition: forward.h:26
Definition: Xaction.cc:139
std::ostream & operator<<(std::ostream &os, const std::optional< Address > &optional)
Definition: Xaction.cc:142

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors