source: squid-ssl/trunk/fuentes/src/adaptation/Answer.h @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 1.6 KB
Line 
1/*
2 * Copyright (C) 1996-2015 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_ADAPTATION__ANSWER_H
10#define SQUID_ADAPTATION__ANSWER_H
11
12#include "adaptation/forward.h"
13#include "HttpMsg.h"
14
15#include <iosfwd>
16
17namespace Adaptation
18{
19
20/// summarizes adaptation service answer for the noteAdaptationAnswer() API
21class Answer
22{
23public:
24    /// helps interpret other members without a class hierarchy
25    typedef enum {
26        akForward, ///< forward the supplied adapted HTTP message
27        akBlock, ///< block or deny the master xaction; see authority
28        akError, ///< no adapted message will come; see bypassable
29    } Kind;
30
31    static Answer Error(bool final); ///< create an akError answer
32    static Answer Forward(HttpMsg *aMsg); ///< create an akForward answer
33    static Answer Block(const String &aRule); ///< create an akBlock answer
34
35    std::ostream &print(std::ostream &os) const;
36
37public:
38    HttpMsg::Pointer message; ///< HTTP request or response to forward
39    String ruleId; ///< ACL (or similar rule) name that blocked forwarding
40    bool final; ///< whether the error, if any, cannot be bypassed
41    Kind kind; ///< the type of the answer
42
43private:
44    explicit Answer(Kind aKind); ///< use static creators instead
45};
46
47inline
48std::ostream &operator <<(std::ostream &os, const Answer &answer)
49{
50    return answer.print(os);
51}
52
53} // namespace Adaptation
54
55#endif /* SQUID_ADAPTATION__ANSWER_H */
56
Note: See TracBrowser for help on using the repository browser.