]>
Commit | Line | Data |
---|---|---|
8822ebee | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
8822ebee | 3 | * |
bbc27441 AJ |
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. | |
8822ebee AR |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 16 Cache Manager API */ |
10 | ||
8822ebee AR |
11 | #ifndef SQUID_MGR_FORWARDER_H |
12 | #define SQUID_MGR_FORWARDER_H | |
13 | ||
c3e8e4e9 | 14 | #include "comm/forward.h" |
51ea0904 | 15 | #include "ipc/Forwarder.h" |
8822ebee | 16 | #include "mgr/ActionParams.h" |
8822ebee | 17 | |
8822ebee AR |
18 | class CommCloseCbParams; |
19 | class HttpRequest; | |
20 | class StoreEntry; | |
21 | class ErrorState; | |
22 | ||
23 | namespace Mgr | |
24 | { | |
25 | ||
26 | /** Forwards a single client cache manager request to Coordinator. | |
27 | * Waits for an ACK from Coordinator while holding the Store entry. | |
28 | * Fills the store entry with an error response if forwarding fails. | |
29 | */ | |
51ea0904 | 30 | class Forwarder: public Ipc::Forwarder |
8822ebee | 31 | { |
5c2f68b7 AJ |
32 | CBDATA_CLASS(Forwarder); |
33 | ||
8822ebee | 34 | public: |
1b76e6c1 | 35 | Forwarder(const Comm::ConnectionPointer &aConn, const ActionParams &aParams, HttpRequest* aRequest, |
d9fc6862 | 36 | StoreEntry* anEntry); |
8822ebee AR |
37 | virtual ~Forwarder(); |
38 | ||
8822ebee | 39 | protected: |
51ea0904 CT |
40 | /* Ipc::Forwarder API */ |
41 | virtual void cleanup(); ///< perform cleanup actions | |
42 | virtual void handleError(); | |
43 | virtual void handleTimeout(); | |
44 | virtual void handleException(const std::exception& e); | |
8822ebee AR |
45 | |
46 | private: | |
8822ebee | 47 | void noteCommClosed(const CommCloseCbParams& params); |
51ea0904 | 48 | void sendError(ErrorState* error); |
8822ebee AR |
49 | |
50 | private: | |
51ea0904 | 51 | HttpRequest* httpRequest; ///< HTTP client request for detailing errors |
8822ebee | 52 | StoreEntry* entry; ///< Store entry expecting the response |
1b76e6c1 | 53 | Comm::ConnectionPointer conn; ///< HTTP client connection descriptor |
8822ebee | 54 | AsyncCall::Pointer closer; ///< comm_close handler for the HTTP connection |
8822ebee AR |
55 | }; |
56 | ||
57 | } // namespace Mgr | |
58 | ||
59 | #endif /* SQUID_MGR_FORWARDER_H */ | |
f53969cc | 60 |