]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/HierCodeData.cc
2 * Copyright (C) 1996-2014 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"
14 #include "hier_code.h"
16 ACLHierCodeData::ACLHierCodeData()
18 // initialize mask to NULL
19 memset(values
, 0, sizeof(values
));
22 ACLHierCodeData::ACLHierCodeData(ACLHierCodeData
const &old
)
24 memcpy(values
, old
.values
, sizeof(values
) );
27 ACLHierCodeData::~ACLHierCodeData()
31 ACLHierCodeData::match(hier_code toFind
)
33 return values
[toFind
];
37 ACLHierCodeData::dump() const
41 for (hier_code iter
=HIER_NONE
; iter
<HIER_MAX
; ++iter
) {
42 if (!values
[iter
]) continue;
43 sl
.push_back(SBuf(hier_code_str
[iter
]));
50 ACLHierCodeData::parse()
54 while ((t
= strtokFile())) {
55 for (hier_code iter
= HIER_NONE
; iter
<= HIER_MAX
; ++iter
) {
56 if (iter
== HIER_MAX
) {
57 fatalf("ERROR: No such hier_code '%s'",t
);
60 if (strcmp(hier_code_str
[iter
],t
) == 0) {
62 break; // back to while-loop
69 ACLHierCodeData::empty() const
71 for (hier_code iter
= HIER_NONE
; iter
<= HIER_MAX
; ++iter
) {
72 if (values
[iter
]) return false; // not empty.
78 ACLHierCodeData::clone() const
80 return new ACLHierCodeData(*this);