HierCodeData.cc
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#include "squid.h"
10#include "acl/Checklist.h"
11#include "acl/HierCodeData.h"
12#include "ConfigParser.h"
13#include "fatal.h"
14#include "hier_code.h"
15
17{
18 // initialize mask to NULL
19 memset(values, 0, sizeof(values));
20}
21
23{ }
24
25bool
27{
28 return values[toFind];
29}
30
33{
34 SBufList sl;
35
36 for (hier_code iter=HIER_NONE; iter<HIER_MAX; ++iter) {
37 if (!values[iter]) continue;
38 sl.push_back(SBuf(hier_code_str[iter]));
39 }
40
41 return sl;
42}
43
44void
46{
47 char *t = nullptr;
48
49 while ((t = ConfigParser::strtokFile())) {
50 for (hier_code iter = HIER_NONE; iter <= HIER_MAX; ++iter) {
51 if (iter == HIER_MAX) {
52 fatalf("ERROR: No such hier_code '%s'",t);
53 return;
54 }
55 if (strcmp(hier_code_str[iter],t) == 0) {
56 values[iter] = true;
57 break; // back to while-loop
58 }
59 }
60 }
61}
62
63bool
65{
66 for (hier_code iter = HIER_NONE; iter <= HIER_MAX; ++iter) {
67 if (values[iter]) return false; // not empty.
68 }
69 return true;
70}
71
virtual SBufList dump() const
Definition: HierCodeData.cc:32
bool values[HIER_MAX]
mask of codes this ACL might match.
Definition: HierCodeData.h:29
virtual ~ACLHierCodeData()
Definition: HierCodeData.cc:22
bool empty() const
Definition: HierCodeData.cc:64
bool match(hier_code)
Definition: HierCodeData.cc:26
static char * strtokFile()
Definition: ConfigParser.cc:64
Definition: SBuf.h:94
void fatalf(const char *fmt,...)
Definition: fatal.cc:68
const char * hier_code_str[]
hier_code
Definition: hier_code.h:12
@ HIER_MAX
Definition: hier_code.h:38
@ HIER_NONE
Definition: hier_code.h:13
std::list< SBuf > SBufList
Definition: forward.h:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors