]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Answer.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_ADAPTATION__ANSWER_H
10 #define SQUID_ADAPTATION__ANSWER_H
12 #include "adaptation/forward.h"
13 #include "http/forward.h"
14 #include "SquidString.h"
21 /// summarizes adaptation service answer for the noteAdaptationAnswer() API
25 /// helps interpret other members without a class hierarchy
27 akForward
, ///< forward the supplied adapted HTTP message
28 akBlock
, ///< block or deny the master xaction; see authority
29 akError
, ///< no adapted message will come; see bypassable
32 static Answer
Error(bool final
); ///< create an akError answer
33 static Answer
Forward(Http::Message
*aMsg
); ///< create an akForward answer
34 static Answer
Block(const String
&aRule
); ///< create an akBlock answer
36 std::ostream
&print(std::ostream
&os
) const;
39 Http::MessagePointer message
; ///< HTTP request or response to forward
40 String ruleId
; ///< ACL (or similar rule) name that blocked forwarding
41 bool final
; ///< whether the error, if any, cannot be bypassed
42 Kind kind
; ///< the type of the answer
45 explicit Answer(Kind aKind
); ///< use static creators instead
49 std::ostream
&operator <<(std::ostream
&os
, const Answer
&answer
)
51 return answer
.print(os
);
54 } // namespace Adaptation
56 #endif /* SQUID_ADAPTATION__ANSWER_H */