]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Answer.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / adaptation / Answer.cc
1 /*
2 * Copyright (C) 1996-2020 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
16 Adaptation::Answer
17 Adaptation::Answer::Error(bool final)
18 {
19 Answer answer(akError);
20 answer.final = final;
21 debugs(93, 4, HERE << "error: " << final);
22 return answer;
23 }
24
25 Adaptation::Answer
26 Adaptation::Answer::Forward(Http::Message *aMsg)
27 {
28 Answer answer(akForward);
29 answer.message = aMsg;
30 debugs(93, 4, HERE << "forwarding: " << (void*)aMsg);
31 return answer;
32 }
33
34 Adaptation::Answer
35 Adaptation::Answer::Block(const String &aRule)
36 {
37 Answer answer(akBlock);
38 answer.ruleId = aRule;
39 debugs(93, 4, HERE << "blocking rule: " << aRule);
40 return answer;
41 }
42
43 std::ostream &
44 Adaptation::Answer::print(std::ostream &os) const
45 {
46 return os << kind; // TODO: add more details
47 }
48
49 Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
50 {
51 }
52