NoteData.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/Acl.h"
11 #include "acl/Checklist.h"
12 #include "acl/NoteData.h"
13 #include "acl/StringData.h"
14 #include "ConfigParser.h"
15 #include "debug/Stream.h"
16 #include "sbuf/StringConvert.h"
17 #include "wordlist.h"
18 
20 {}
21 
23 {
24  delete values;
25 }
26 
27 bool
29 {
30  if (entry->name().cmp(name) != 0)
31  return false; // name mismatch
32 
33  // a name-only note ACL matches any value; others require a values match
34  return values->empty() ||
35  values->match(entry->value());
36 }
37 
40 {
41  SBufList sl;
42  sl.push_back(name);
43  sl.splice(sl.end(), values->dump());
44  return sl;
45 }
46 
47 void
49 {
50  Acl::SetKey(name, "annotation name", ConfigParser::strtokFile());
51  values->parse();
52 }
53 
54 bool
56 {
57  return name.isEmpty();
58 }
59 
const SBuf & name() const
Definition: Notes.h:198
static char * strtokFile()
Definition: ConfigParser.cc:65
SBufList dump() const override
Definition: NoteData.cc:39
bool isEmpty() const
Definition: SBuf.h:435
std::list< SBuf > SBufList
Definition: forward.h:22
void SetKey(SBuf &keyStorage, const char *keyParameterName, const char *newKey)
Definition: Acl.cc:100
bool match(NotePairs::Entry *) override
Definition: NoteData.cc:28
Used to store a note key/value pair.
Definition: Notes.h:185
bool empty() const override
Definition: NoteData.cc:55
bool match(char const *) override
Definition: StringData.cc:39
void parse() override
Definition: StringData.cc:58
SBufList dump() const override
Definition: StringData.cc:50
~ACLNoteData() override
Definition: NoteData.cc:22
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:279
const SBuf & value() const
Definition: Notes.h:199
SBuf name
Note name to check. It is always set.
Definition: NoteData.h:32
void parse() override
Definition: NoteData.cc:48
ACLStringData * values
if set, at least one value must match
Definition: NoteData.h:33
bool empty() const override
Definition: StringData.cc:65

 

Introduction

Documentation

Support

Miscellaneous