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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors