SquidErrorData.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"
10#include "acl/Data.h"
11#include "acl/SquidErrorData.h"
12#include "cache_cf.h"
13#include "ConfigParser.h"
14#include "debug/Stream.h"
15#include "error/Error.h"
16#include "fatal.h"
17#include "wordlist.h"
18
19bool
21{
23 while (!iter.end()) {
24 err_type localErr = iter.next();
25 debugs(28, 4, "check (" << err << "):" << errorTypeName(err) << " against " << errorTypeName(localErr));
26 if (err == localErr)
27 return true;
28 }
29
30 return false;
31}
32
35{
36 SBufList sl;
38 while (!iter.end()) {
39 err_type err = iter.next();
40 const char *errName = errorTypeName(err);
41 sl.push_back(SBuf(errName));
42 }
43
44 return sl;
45}
46
47void
49{
50 while (const auto token = ConfigParser::strtokFile()) {
51 err_type err = errorTypeByName(token);
52
53 if (err < ERR_MAX)
54 errors.push_back(err);
55 else {
56 debugs(28, DBG_CRITICAL, "FATAL: Invalid squid error name");
59 }
60 }
61}
62
63bool
65{
66 return errors.empty();
67}
68
err_type errorTypeByName(const char *name)
Definition: Error.h:67
const char * errorTypeName(err_type err)
Definition: Error.h:77
void self_destruct(void)
Definition: cache_cf.cc:277
bool empty() const override
bool match(err_type err) override
void parse() override
CbDataListContainer< err_type > errors
SBufList dump() const override
bool empty() const
Definition: CbDataList.h:193
CbDataList< C > * push_back(C const &)
Definition: CbDataList.h:160
const C & next()
Definition: CbDataList.h:55
static char * strtokFile()
Definition: ConfigParser.cc:65
Definition: SBuf.h:94
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
#define DBG_CRITICAL
Definition: Stream.h:37
err_type
Definition: forward.h:14
@ ERR_MAX
Definition: forward.h:88
int opt_parse_cfg_only
std::list< SBuf > SBufList
Definition: forward.h:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors