]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/HierCodeData.cc
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
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.
10 #include "acl/Checklist.h"
11 #include "acl/HierCodeData.h"
12 #include "ConfigParser.h"
14 #include "hier_code.h"
16 ACLHierCodeData::ACLHierCodeData()
18 // initialize mask to NULL
19 memset(values
, 0, sizeof(values
));
22 ACLHierCodeData::~ACLHierCodeData()
26 ACLHierCodeData::match(hier_code toFind
)
28 return values
[toFind
];
32 ACLHierCodeData::dump() const
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
]));
45 ACLHierCodeData::parse()
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
);
55 if (strcmp(hier_code_str
[iter
],t
) == 0) {
57 break; // back to while-loop
64 ACLHierCodeData::empty() const
66 for (hier_code iter
= HIER_NONE
; iter
<= HIER_MAX
; ++iter
) {
67 if (values
[iter
]) return false; // not empty.