Note.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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/FilledChecklist.h"
11 #include "acl/HttpHeaderData.h"
12 #include "acl/Note.h"
13 #include "acl/NoteData.h"
14 #include "HttpRequest.h"
15 
16 /* Acl::AnnotationStrategy */
17 
18 const Acl::Options &
20 {
21  static const Acl::CharacterSetOption Delimiters;
22  static const Acl::Options MyOptions = {
23  { "-m", &Delimiters }
24  };
25  Delimiters.linkWith(&delimiters);
26  return MyOptions;
27 }
28 
29 /* ACLNoteStrategy */
30 
31 int
33 {
34  if (const auto request = checklist->request) {
35  if (request->hasNotes() && matchNotes(data, request->notes().getRaw()))
36  return 1;
37 #if USE_ADAPTATION
38  const Adaptation::History::Pointer ah = request->adaptLogHistory();
39  if (ah != NULL && ah->metaHeaders != NULL && matchNotes(data, ah->metaHeaders.getRaw()))
40  return 1;
41 #endif
42  }
43  return 0;
44 }
45 
46 bool
48 {
49  const NotePairs::Entries &entries = note->expandListEntries(&delimiters.value);
50  for (auto e: entries)
51  if (noteData->match(e.getRaw()))
52  return true;
53  return false;
54 }
55 
virtual const Acl::Options & options() override
Definition: Note.cc:19
virtual bool match(M)=0
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
virtual int match(ACLData< MatchType > *&, ACLFilledChecklist *)
Definition: Note.cc:32
const Entries & expandListEntries(const CharacterSet *delimiters) const
Definition: Notes.cc:312
option value to configure one or more characters (e.g., -m=",;")
NotePairs::Pointer metaHeaders
Definition: History.h:65
void const char HLPCB void * data
Definition: stub_helper.cc:16
std::vector< Entry::Pointer > Entries
The key/value pair entries.
Definition: Notes.h:193
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
Definition: Options.h:90
HttpRequest * request
bool matchNotes(ACLData< MatchType > *, const NotePairs *) const
Definition: Note.cc:47
std::map< OptionName, const Option *, OptionNameCmp > Options
name:option map
Definition: Options.h:159
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition: Note.h:27
C * getRaw() const
Definition: RefCount.h:74
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors