TransactionInitiator.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 /* DEBUG: section 28 Access Control */
10 
11 #include "squid.h"
12 #include "acl/FilledChecklist.h"
14 #include "cache_cf.h"
15 #include "debug/Stream.h"
16 #include "HttpRequest.h"
17 #include "MasterXaction.h"
18 #include "SquidConfig.h"
19 
20 Acl::TransactionInitiator::TransactionInitiator (const char *aClass) : class_ (aClass), initiators_(0)
21 {}
22 
23 char const *
25 {
26  return class_;
27 }
28 
29 bool
31 {
32  return false;
33 }
34 
35 void
37 {
38  while (const char *s = ConfigParser::strtokFile()) {
39  initiators_ |= XactionInitiator::ParseInitiators(s);
40  cfgWords.push_back(SBuf(s));
41  }
42 }
43 
44 int
46 {
47  ACLFilledChecklist *filled = Filled((ACLChecklist*)checklist);
48  assert(filled->request);
49  assert(filled->request->masterXaction);
50  const XactionInitiator requestInitiator = filled->request->masterXaction->initiator;
51  return requestInitiator.in(initiators_) ? 1 : 0;
52 }
53 
56 {
57  return cfgWords;
58 }
59 
static char * strtokFile()
Definition: ConfigParser.cc:65
SBufList dump() const override
std::list< SBuf > SBufList
Definition: forward.h:22
Definition: SBuf.h:93
bool empty() const override
identifies a protocol agent or Squid feature initiating transactions
XactionInitiator initiator
the initiator of this transaction
Definition: MasterXaction.h:69
void parse() override
parses node representation in squid.conf; dies on failures
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
HttpRequest::Pointer request
MasterXaction::Pointer masterXaction
the master transaction this request belongs to. Never nil.
Definition: HttpRequest.h:238
#define assert(EX)
Definition: assert.h:17
static Initiators ParseInitiators(const char *name)
const char * typeString() const override
int match(ACLChecklist *checklist) override
Matches the actual data in checklist against this Acl::Node.
bool in(Initiators setOfInitiators) const
whether this initiator belongs to the given set

 

Introduction

Documentation

Support

Miscellaneous