]>
Commit | Line | Data |
---|---|---|
774c051c | 1 | |
2 | /* | |
30abd221 | 3 | * $Id: ICAPConfig.h,v 1.13 2007/05/29 13:31:44 amosjeffries Exp $ |
774c051c | 4 | * |
5 | * | |
6 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
7 | * ---------------------------------------------------------- | |
8 | * | |
9 | * Squid is the result of efforts by numerous individuals from | |
10 | * the Internet community; see the CONTRIBUTORS file for full | |
11 | * details. Many organizations have provided support for Squid's | |
12 | * development; see the SPONSORS file for full details. Squid is | |
13 | * Copyrighted (C) 2001 by the Regents of the University of | |
14 | * California; see the COPYRIGHT file for full details. Squid | |
15 | * incorporates software developed and/or copyrighted by other | |
16 | * sources; see the CREDITS file for full details. | |
17 | * | |
18 | * This program is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation; either version 2 of the License, or | |
21 | * (at your option) any later version. | |
22 | * | |
23 | * This program is distributed in the hope that it will be useful, | |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 | * GNU General Public License for more details. | |
27 | * | |
28 | * You should have received a copy of the GNU General Public License | |
29 | * along with this program; if not, write to the Free Software | |
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
31 | * | |
32 | * | |
33 | * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> | |
34 | */ | |
35 | ||
36 | #ifndef SQUID_ICAPCONFIG_H | |
37 | #define SQUID_ICAPCONFIG_H | |
38 | ||
a553a5a3 | 39 | #include "event.h" |
774c051c | 40 | #include "ICAPServiceRep.h" |
41 | ||
42 | class acl_access; | |
43 | ||
a385afc3 | 44 | class ConfigParser; |
45 | ||
774c051c | 46 | class ICAPClass |
47 | { | |
48 | ||
49 | public: | |
30abd221 | 50 | String key; |
774c051c | 51 | acl_access *accessList; |
52 | ||
53 | Vector<ICAPServiceRep::Pointer> services; | |
54 | ||
ff12ed15 | 55 | ICAPClass() : key(NULL), accessList(NULL) {}; |
774c051c | 56 | |
57 | int prepare(); | |
58 | }; | |
59 | ||
60 | class ICAPAccessCheck | |
61 | { | |
62 | ||
63 | public: | |
64 | typedef void ICAPAccessCheckCallback(ICAPServiceRep::Pointer match, void *data); | |
65 | ICAPAccessCheck(ICAP::Method, ICAP::VectPoint, HttpRequest *, HttpReply *, ICAPAccessCheckCallback *, void *); | |
66 | ~ICAPAccessCheck(); | |
67 | ||
68 | private: | |
69 | ICAP::Method method; | |
70 | ICAP::VectPoint point; | |
71 | HttpRequest *req; | |
72 | HttpReply *rep; | |
73 | ICAPAccessCheckCallback *callback; | |
74 | void *callback_data; | |
75 | ACLChecklist *acl_checklist; | |
30abd221 | 76 | Vector<String> candidateClasses; |
77 | String matchedClass; | |
774c051c | 78 | void do_callback(); |
c99de607 | 79 | ICAPServiceRep::Pointer findBestService(ICAPClass *c, bool preferUp); |
774c051c | 80 | |
81 | public: | |
82 | void check(); | |
83 | void checkCandidates(); | |
84 | static void ICAPAccessCheckCallbackWrapper(int, void*); | |
85 | static EVH ICAPAccessCheckCallbackEvent; | |
86 | ||
87 | private: | |
88 | CBDATA_CLASS2(ICAPAccessCheck); | |
89 | }; | |
90 | ||
91 | class ICAPConfig | |
92 | { | |
93 | ||
94 | public: | |
95 | ||
96 | int onoff; | |
97 | int preview_enable; | |
98 | int preview_size; | |
78e8cfc4 | 99 | int default_options_ttl; |
774c051c | 100 | int send_client_ip; |
12b91c99 | 101 | int send_client_username; |
102 | int reuse_connections; | |
5f8252d2 | 103 | int service_failure_limit; |
104 | int service_revival_delay; | |
105 | char* client_username_header; | |
106 | int client_username_encode; | |
774c051c | 107 | |
108 | Vector<ICAPServiceRep::Pointer> services; | |
109 | Vector<ICAPClass*> classes; | |
110 | ||
111 | ICAPConfig() {}; | |
112 | ||
113 | ~ICAPConfig(); | |
114 | ||
115 | void parseICAPService(void); | |
116 | void freeICAPService(void); | |
117 | void dumpICAPService(StoreEntry *, const char *); | |
30abd221 | 118 | ICAPServiceRep::Pointer findService(const String&); |
119 | ICAPClass * findClass(const String& key); | |
774c051c | 120 | |
121 | void parseICAPClass(void); | |
122 | void freeICAPClass(void); | |
123 | void dumpICAPClass(StoreEntry *, const char *); | |
124 | ||
a385afc3 | 125 | void parseICAPAccess(ConfigParser &parser); |
774c051c | 126 | void freeICAPAccess(void); |
127 | void dumpICAPAccess(StoreEntry *, const char *); | |
128 | ||
129 | }; | |
130 | ||
5f8252d2 | 131 | extern ICAPConfig TheICAPConfig; |
132 | ||
774c051c | 133 | #endif /* SQUID_ICAPCONFIG_H */ |