]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/AnnotationData.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / acl / AnnotationData.cc
CommitLineData
63e82d8d 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
63e82d8d
EB
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.h"
16#include "format/Format.h"
17#include "sbuf/Algorithms.h"
18
19const char *AnnotationBlackList[] = {
20 "user",
21 "group",
22 "password",
23 "status",
24 "message",
25 "log",
26 "tag",
27 "ttl",
28 "ha1",
29 "rewrite-url",
30 "url",
31 nullptr
32};
33
34ACLAnnotationData::ACLAnnotationData()
35 : notes(new Notes("annotation_data", AnnotationBlackList)) {}
36
37SBufList
38ACLAnnotationData::dump() const
39{
40 SBufList sl;
41 if (const char *strNotes = notes->toString())
42 sl.push_back(SBuf(strNotes));
43 return sl;
44}
45
46void
47ACLAnnotationData::parse()
48{
49 notes->parseKvPair();
50 if (char *t = ConfigParser::PeekAtToken()) {
51 debugs(29, DBG_CRITICAL, "FATAL: Unexpected argument '" << t << "' after annotation specification");
52 self_destruct();
53 return;
54 }
55}
56
57void
58ACLAnnotationData::annotate(NotePairs::Pointer pairs, const CharacterSet *delimiters, const AccessLogEntry::Pointer &al)
59{
60 notes->updateNotePairs(pairs, delimiters, al);
61}
62
63ACLData<NotePairs::Entry *> *
64ACLAnnotationData::clone() const
65{
66 return new ACLAnnotationData;
67}
68