Squid Web Cache master
Loading...
Searching...
No Matches
Answer.h
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#ifndef SQUID_SRC_ADAPTATION_ANSWER_H
10#define SQUID_SRC_ADAPTATION_ANSWER_H
11
12#include "acl/Acl.h"
13#include "adaptation/forward.h"
14#include "http/forward.h"
15#include "sbuf/SBuf.h"
16
17#include <iosfwd>
18#include <optional>
19
20namespace Adaptation
21{
22
24class Answer
25{
26public:
28 typedef enum {
32 } Kind;
33
34 static Answer Error(bool final);
35 static Answer Forward(Http::Message *aMsg);
36 static Answer Block(const SBuf &aRule);
37
40
41 std::ostream &print(std::ostream &os) const;
42
43public:
45 std::optional<SBuf> ruleId;
46 bool final;
48
49private:
50 explicit Answer(Kind aKind);
51};
52
53inline
54std::ostream &operator <<(std::ostream &os, const Answer &answer)
55{
56 return answer.print(os);
57}
58
59} // namespace Adaptation
60
61#endif /* SQUID_SRC_ADAPTATION_ANSWER_H */
62
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
Acl::Answer blockedToChecklistAnswer() const
creates an Acl::Answer from akBlock answer
Definition Answer.cc:44
Kind kind
the type of the answer
Definition Answer.h:47
std::ostream & print(std::ostream &os) const
Definition Answer.cc:53
Http::MessagePointer message
HTTP request or response to forward.
Definition Answer.h:44
Kind
helps interpret other members without a class hierarchy
Definition Answer.h:28
@ akForward
forward the supplied adapted HTTP message
Definition Answer.h:29
@ akBlock
block or deny the master xaction; see authority
Definition Answer.h:30
@ akError
no adapted message will come; see bypassable
Definition Answer.h:31
a transaction problem
Definition Error.h:27
common parts of HttpRequest and HttpReply
Definition Message.h:26
Definition SBuf.h:94
std::ostream & operator<<(std::ostream &os, const Answer &answer)
Definition Answer.h:54