]> git.ipfire.org Git - thirdparty/squid.git/blob - src/forward.h
Import IPv6 support from squid3-ipv6 branch to 3-HEAD.
[thirdparty/squid.git] / src / forward.h
1 #ifndef SQUID_FORWARD_H
2 #define SQUID_FORWARD_H
3
4 /* forward decls */
5
6 class CacheManager;
7 class ErrorState;
8
9 #include "comm.h"
10 #include "IPAddress.h"
11
12 class FwdServer
13 {
14
15 public:
16 peer *_peer; /* NULL --> origin server */
17 hier_code code;
18 FwdServer *next;
19 };
20
21 class FwdState : public RefCountable
22 {
23
24 public:
25 typedef RefCount<FwdState> Pointer;
26 ~FwdState();
27 static void initModule();
28 static void RegisterWithCacheManager(CacheManager & manager);
29
30 static void fwdStart(int fd, StoreEntry *, HttpRequest *);
31 void startComplete(FwdServer *);
32 void startFail();
33 void fail(ErrorState *err);
34 void unregister(int fd);
35 void complete();
36 void handleUnregisteredServerEnd();
37 int reforward();
38 bool reforwardableStatus(http_status s);
39 void serverClosed(int fd);
40 void connectStart();
41 void connectDone(int server_fd, comm_err_t status, int xerrno);
42 void connectTimeout(int fd);
43 void initiateSSL();
44 void negotiateSSL(int fd);
45 bool checkRetry();
46 bool checkRetriable();
47 void dispatch();
48 void pconnPush(int fd, const char *host, int port, const char *domain, IPAddress &client_addr);
49
50 bool dontRetry() { return flags.dont_retry; }
51
52 void dontRetry(bool val) { flags.dont_retry = val; }
53
54 bool ftpPasvFailed() { return flags.ftp_pasv_failed; }
55
56 void ftpPasvFailed(bool val) { flags.ftp_pasv_failed = val; }
57
58 static void serversFree(FwdServer **);
59
60 private:
61 // hidden for safer management of self; use static fwdStart
62 FwdState(int fd, StoreEntry *, HttpRequest *);
63 void start(Pointer aSelf);
64
65 static void logReplyStatus(int tries, http_status status);
66 void completed();
67 void retryOrBail();
68
69 #if WIP_FWD_LOG
70
71 void uninit
72 static void logRotate
73 void status()
74 #endif
75
76 public:
77 StoreEntry *entry;
78 HttpRequest *request;
79 int server_fd;
80 FwdServer *servers;
81 static void abort(void*);
82
83 private:
84 CBDATA_CLASS2(FwdState);
85 Pointer self;
86 ErrorState *err;
87 int client_fd;
88 time_t start_t;
89 int n_tries;
90 int origin_tries;
91 #if WIP_FWD_LOG
92
93 http_status last_status;
94 #endif
95
96 struct
97 {
98
99 unsigned int dont_retry:
100 1;
101
102 unsigned int ftp_pasv_failed:
103 1;
104
105 unsigned int forward_completed:1;
106 }
107
108 flags;
109 #if LINUX_NETFILTER
110 IPAddress src;
111 #endif
112
113 };
114
115 #endif