]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ProtocolData.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.
9 /* DEBUG: section 28 Access Control */
12 #include "acl/Checklist.h"
13 #include "acl/ProtocolData.h"
18 ACLProtocolData::ACLProtocolData(ACLProtocolData
const &old
)
20 assert(old
.values
.empty());
23 ACLProtocolData::~ACLProtocolData()
29 ACLProtocolData::match(AnyP::ProtocolType toFind
)
31 for (auto itr
= values
.begin(); itr
!= values
.end(); ++itr
) {
33 // tune the list for LRU ordering
35 values
.push_front(toFind
);
43 ACLProtocolData::dump() const
46 for (std::list
<AnyP::ProtocolType
>::const_iterator itr
= values
.begin(); itr
!= values
.end(); ++itr
) {
47 sl
.push_back(SBuf(AnyP::ProtocolType_str
[*itr
]));
54 ACLProtocolData::parse()
56 while (char *t
= strtokFile()) {
57 int p
= AnyP::PROTO_NONE
;
58 for (; p
< AnyP::PROTO_UNKNOWN
; ++p
) {
59 if (strcasecmp(t
, AnyP::ProtocolType_str
[p
]) == 0) {
60 values
.push_back(static_cast<AnyP::ProtocolType
>(p
));
64 if (p
== AnyP::PROTO_UNKNOWN
) {
65 debugs(28, DBG_IMPORTANT
, "WARNING: Ignoring unknown protocol '" << t
<< "' in the ACL named '" << AclMatchedName
<< "'");
66 // XXX: store the text pattern of this protocol name for live comparisons
71 ACLData
<AnyP::ProtocolType
> *
72 ACLProtocolData::clone() const
74 /* Splay trees don't clone yet. */
75 assert(values
.empty());
76 return new ACLProtocolData(*this);