Squid Web Cache master
Loading...
Searching...
No Matches
Answer.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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 93 ICAP (RFC 3507) Client */
10
11#include "squid.h"
12#include "adaptation/Answer.h"
13#include "base/AsyncJobCalls.h"
14#include "http/Message.h"
15
18{
19 Answer answer(akError);
20 answer.final = final;
21 debugs(93, 4, "error: " << final);
22 return answer;
23}
24
27{
28 Answer answer(akForward);
29 answer.message = aMsg;
30 debugs(93, 4, "forwarding: " << (void*)aMsg);
31 return answer;
32}
33
36{
37 Answer answer(akBlock);
38 answer.ruleId = aRule;
39 debugs(93, 4, "blocking rule: " << aRule);
40 return answer;
41}
42
45{
46 assert(kind == akBlock);
48 answer.lastCheckedName = ruleId;
49 return answer;
50}
51
52std::ostream &
53Adaptation::Answer::print(std::ostream &os) const
54{
55 return os << kind; // TODO: add more details
56}
57
58Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
59{
60}
61
#define assert(EX)
Definition assert.h:17
std::optional< SBuf > lastCheckedName
the name of the ACL (if any) that was evaluated last while obtaining this answer
Definition Acl.h:105
summarizes adaptation service answer for the noteAdaptationAnswer() API
Definition Answer.h:25
std::optional< SBuf > ruleId
ACL (or similar rule) name that blocked forwarding.
Definition Answer.h:45
static Answer Block(const SBuf &aRule)
create an akBlock answer
Definition Answer.cc:35
static Answer Forward(Http::Message *aMsg)
create an akForward answer
Definition Answer.cc:26
static Answer Error(bool final)
create an akError answer
Definition Answer.cc:17
Acl::Answer blockedToChecklistAnswer() const
creates an Acl::Answer from akBlock answer
Definition Answer.cc:44
std::ostream & print(std::ostream &os) const
Definition Answer.cc:53
Http::MessagePointer message
HTTP request or response to forward.
Definition Answer.h:44
Answer(Kind aKind)
use static creators instead
Definition Answer.cc:58
bool final
whether the error, if any, cannot be bypassed
Definition Answer.h:46
Kind
helps interpret other members without a class hierarchy
Definition Answer.h:28
@ akError
no adapted message will come; see bypassable
Definition Answer.h:31
common parts of HttpRequest and HttpReply
Definition Message.h:26
Definition SBuf.h:94
#define debugs(SECTION, LEVEL, CONTENT)
Definition Stream.h:192
@ ACCESS_DENIED
Definition Acl.h:41