ProtocolData.cc
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/* DEBUG: section 28 Access Control */
10
11#include "squid.h"
12#include "acl/Checklist.h"
13#include "acl/ProtocolData.h"
14#include "ConfigParser.h"
15#include "debug/Stream.h"
16#include "wordlist.h"
17
19{
20 values.clear();
21}
22
23bool
25{
26 for (auto itr = values.begin(); itr != values.end(); ++itr) {
27 if (*itr == toFind) {
28 // tune the list for LRU ordering
29 values.erase(itr);
30 values.push_front(toFind);
31 return true;
32 }
33 }
34 return false;
35}
36
39{
40 SBufList sl;
41 for (std::list<AnyP::ProtocolType>::const_iterator itr = values.begin(); itr != values.end(); ++itr) {
42 sl.push_back(SBuf(AnyP::ProtocolType_str[*itr]));
43 }
44
45 return sl;
46}
47
48void
50{
51 while (char *t = ConfigParser::strtokFile()) {
52 int p = AnyP::PROTO_NONE;
53 for (; p < AnyP::PROTO_UNKNOWN; ++p) {
54 if (strcasecmp(t, AnyP::ProtocolType_str[p]) == 0) {
55 values.push_back(static_cast<AnyP::ProtocolType>(p));
56 break;
57 }
58 }
59 if (p == AnyP::PROTO_UNKNOWN) {
60 debugs(28, DBG_IMPORTANT, "WARNING: Ignoring unknown protocol '" << t << "' in the ACL named '" << AclMatchedName << "'");
61 // XXX: store the text pattern of this protocol name for live comparisons
62 }
63 }
64}
65
SBufList dump() const override
Definition: ProtocolData.cc:38
~ACLProtocolData() override
Definition: ProtocolData.cc:18
std::list< AnyP::ProtocolType > values
Definition: ProtocolData.h:30
void parse() override
Definition: ProtocolData.cc:49
bool match(AnyP::ProtocolType) override
Definition: ProtocolData.cc:24
static char * strtokFile()
Definition: ConfigParser.cc:65
Definition: SBuf.h:94
#define DBG_IMPORTANT
Definition: Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
const char * AclMatchedName
Definition: Acl.cc:29
const char * ProtocolType_str[]
ProtocolType
Definition: ProtocolType.h:23
@ PROTO_NONE
Definition: ProtocolType.h:24
@ PROTO_UNKNOWN
Definition: ProtocolType.h:41
std::list< SBuf > SBufList
Definition: forward.h:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors