]>
Commit | Line | Data |
---|---|---|
2087dca6 | 1 | #ifndef SQUID_FORWARD_H |
2 | #define SQUID_FORWARD_H | |
3cd1350a | 3 | |
62ee09ca | 4 | /* forward decls */ |
5 | ||
aa839030 | 6 | class ErrorState; |
06093389 | 7 | class HttpRequest; |
62ee09ca | 8 | |
a553a5a3 | 9 | #include "comm.h" |
cfd66529 | 10 | #include "comm/Connection.h" |
8d71285d | 11 | #include "fde.h" |
96d89ea0 | 12 | #include "ip/Address.h" |
cfd66529 | 13 | #include "Array.h" |
a553a5a3 | 14 | |
3cd1350a | 15 | class FwdState : public RefCountable |
16 | { | |
3cd1350a | 17 | public: |
18 | typedef RefCount<FwdState> Pointer; | |
3cd1350a | 19 | ~FwdState(); |
20 | static void initModule(); | |
21 | ||
5c336a3b | 22 | static void fwdStart(Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *); |
6b679a01 | 23 | void startConnectionOrFail(); |
3cd1350a | 24 | void fail(ErrorState *err); |
00ae51e4 | 25 | void unregister(Comm::ConnectionPointer &conn); |
3cd1350a | 26 | void unregister(int fd); |
27 | void complete(); | |
3e8c047e | 28 | void handleUnregisteredServerEnd(); |
3cd1350a | 29 | int reforward(); |
30 | bool reforwardableStatus(http_status s); | |
31 | void serverClosed(int fd); | |
32 | void connectStart(); | |
f01d4b80 | 33 | void connectDone(const Comm::ConnectionPointer & conn, comm_err_t status, int xerrno); |
3cd1350a | 34 | void connectTimeout(int fd); |
35 | void initiateSSL(); | |
36 | void negotiateSSL(int fd); | |
37 | bool checkRetry(); | |
38 | bool checkRetriable(); | |
39 | void dispatch(); | |
00ae51e4 | 40 | void pconnPush(Comm::ConnectionPointer & conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr); |
3cd1350a | 41 | |
42 | bool dontRetry() { return flags.dont_retry; } | |
43 | ||
44 | void dontRetry(bool val) { flags.dont_retry = val; } | |
45 | ||
5229395c | 46 | /** return a ConnectionPointer to the current server connection (may or may not be open) */ |
00ae51e4 | 47 | Comm::ConnectionPointer const & serverConnection() const { return serverConn; }; |
5229395c | 48 | |
3cd1350a | 49 | private: |
7a0fb323 | 50 | // hidden for safer management of self; use static fwdStart |
5c336a3b | 51 | FwdState(Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *); |
7a0fb323 | 52 | void start(Pointer aSelf); |
53 | ||
3cd1350a | 54 | static void logReplyStatus(int tries, http_status status); |
74780d33 | 55 | void updateHierarchyInfo(); |
9d2760b6 | 56 | void doneWithRetries(); |
802a8c1d | 57 | void completed(); |
3e8c047e | 58 | void retryOrBail(); |
6852be71 | 59 | static void RegisterWithCacheManager(void); |
3cd1350a | 60 | |
61 | #if WIP_FWD_LOG | |
62 | ||
63be0a78 | 63 | void uninit /**DOCS_NOSEMI*/ |
64 | static void logRotate /**DOCS_NOSEMI*/ | |
65 | void status() /**DOCS_NOSEMI*/ | |
3cd1350a | 66 | #endif |
67 | ||
68 | public: | |
69 | StoreEntry *entry; | |
70 | HttpRequest *request; | |
429871db | 71 | static void abort(void*); |
3cd1350a | 72 | |
73 | private: | |
3cd1350a | 74 | Pointer self; |
75 | ErrorState *err; | |
5c336a3b | 76 | Comm::ConnectionPointer clientConn; ///< a possibly open connection to the client. |
3cd1350a | 77 | time_t start_t; |
78 | int n_tries; | |
79 | int origin_tries; | |
80 | #if WIP_FWD_LOG | |
81 | ||
82 | http_status last_status; | |
83 | #endif | |
84 | ||
26ac0430 | 85 | struct { |
3d0ac046 | 86 | unsigned int dont_retry:1; |
3d0ac046 | 87 | unsigned int forward_completed:1; |
2fadd50d | 88 | } flags; |
3cd1350a | 89 | |
5229395c | 90 | /** connections to open, in order, until successful */ |
00ae51e4 AJ |
91 | Comm::ConnectionList serverDestinations; |
92 | ||
93 | Comm::ConnectionPointer serverConn; ///< a successfully opened connection to a server. | |
d2bf2f90 AJ |
94 | |
95 | // NP: keep this last. It plays with private/public | |
96 | CBDATA_CLASS2(FwdState); | |
3cd1350a | 97 | }; |
2087dca6 | 98 | |
d85b8894 | 99 | #endif /* SQUID_FORWARD_H */ |