HasComponentData.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#include "squid.h"
11#include "cache_cf.h"
12#include "ConfigParser.h"
13#include "sbuf/Algorithms.h"
14
18
20 : componentMethods(coEnd, nullptr)
21{ }
22
23void
25{
26 const auto tok = ConfigParser::strtokFile();
27 if (!tok) {
28 debugs(28, DBG_CRITICAL, "FATAL: \"has\" acl argument missing");
30 return;
31 }
32
34
36 debugs(28, DBG_CRITICAL, "FATAL: multiple components not supported for \"has\" acl");
38 return;
39 }
40}
41
42bool
44{
45 for (const auto method: componentMethods)
46 if (method && (checklist->*method)())
47 return true;
48 return false;
49}
50
53{
54 SBufList sl;
56 sl.push_back(RequestStr);
58 sl.push_back(ResponseStr);
59 if (componentMethods.at(coAle))
60 sl.push_back(AleStr);
61 return sl;
62}
63
64void
66{
67 if (RequestStr.cmp(token) == 0)
69 else if (ResponseStr.cmp(token) == 0)
71 else if (AleStr.cmp(token) == 0)
73 else {
74 debugs(28, DBG_CRITICAL, "FATAL: unsupported component '" << token << "' for 'has' acl");
76 }
77}
78
void self_destruct(void)
Definition: cache_cf.cc:277
virtual bool hasReply() const =0
virtual bool hasAle() const =0
virtual bool hasRequest() const =0
SBufList dump() const override
void parse() override
bool match(ACLChecklist *) override
static const SBuf AleStr
std::vector< ComponentCheck > componentMethods
component check callbacks, ordered by component kind ID
static const SBuf ResponseStr
void parseComponent(const char *token)
static const SBuf RequestStr
static char * strtokFile()
Definition: ConfigParser.cc:65
Definition: SBuf.h:94
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
#define DBG_CRITICAL
Definition: Stream.h:37
std::list< SBuf > SBufList
Definition: forward.h:23
Definition: parse.c:160

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors