AnnotationData.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/AnnotationData.h"
12 #include "acl/Checklist.h"
13 #include "cache_cf.h"
14 #include "ConfigParser.h"
15 #include "debug/Stream.h"
16 #include "format/Format.h"
17 #include "sbuf/Algorithms.h"
18 #include "sbuf/Stream.h"
19 
21  : notes(new Notes("annotation_data")) {}
22 
25 {
26  if (notes->empty())
27  return SBufList();
28 
29  SBufStream os;
31  return SBufList{os.buf()};
32 }
33 
34 void
36 {
37  notes->parseKvPair();
38  if (char *t = ConfigParser::PeekAtToken()) {
39  debugs(29, DBG_CRITICAL, "FATAL: Unexpected argument '" << t << "' after annotation specification");
40  self_destruct();
41  return;
42  }
43 }
44 
45 void
47 {
48  notes->updateNotePairs(pairs, delimiters, al);
49 }
50 
void annotate(NotePairs::Pointer pairs, const CharacterSet *delimiters, const AccessLogEntry::Pointer &al)
Stores annotations into pairs.
void parseKvPair()
Parses an annotate line with "key=value" or "key+=value" formats.
Definition: Notes.cc:231
#define DBG_CRITICAL
Definition: Stream.h:37
Notes::Pointer notes
std::list< SBuf > SBufList
Definition: forward.h:22
static char * PeekAtToken()
void self_destruct(void)
Definition: cache_cf.cc:276
bool empty() const
Definition: Notes.h:144
Definition: Notes.h:112
void updateNotePairs(NotePairsPointer pairs, const CharacterSet *delimiters, const AccessLogEntryPointer &al)
Definition: Notes.cc:256
void printAsAnnotationAclParameters(std::ostream &) const
Definition: Notes.cc:270
SBuf buf()
bytes written so far
Definition: Stream.h:41
SBufList dump() const override
void parse() override
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:17
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192

 

Introduction

Documentation

Support

Miscellaneous