]>
Commit | Line | Data |
---|---|---|
9cef6668 | 1 | /* |
2b6662ba | 2 | * SQUID Web Proxy Cache http://www.squid-cache.org/ |
9cef6668 | 3 | * ---------------------------------------------------------- |
4 | * | |
2b6662ba | 5 | * Squid is the result of efforts by numerous individuals from |
6 | * the Internet community; see the CONTRIBUTORS file for full | |
7 | * details. Many organizations have provided support for Squid's | |
8 | * development; see the SPONSORS file for full details. Squid is | |
9 | * Copyrighted (C) 2001 by the Regents of the University of | |
10 | * California; see the COPYRIGHT file for full details. Squid | |
11 | * incorporates software developed and/or copyrighted by other | |
12 | * sources; see the CREDITS file for full details. | |
9cef6668 | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License as published by | |
16 | * the Free Software Foundation; either version 2 of the License, or | |
17 | * (at your option) any later version. | |
26ac0430 | 18 | * |
9cef6668 | 19 | * This program is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | * GNU General Public License for more details. | |
26ac0430 | 23 | * |
9cef6668 | 24 | * You should have received a copy of the GNU General Public License |
25 | * along with this program; if not, write to the Free Software | |
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
27 | * | |
28 | */ | |
b5638623 | 29 | #ifndef SQUID_PROTOS_H |
30 | #define SQUID_PROTOS_H | |
31 | ||
25b6a907 | 32 | /* included for routines that have not moved out to their proper homes |
33 | * yet. | |
34 | */ | |
35 | #include "Packer.h" | |
62ee09ca | 36 | /* for routines still in this file that take CacheManager parameters */ |
96d89ea0 | 37 | #include "ip/Address.h" |
e1f7507e AJ |
38 | /* for parameters that still need these */ |
39 | #include "enums.h" | |
40 | /* some parameters stil need this */ | |
41 | #include "wordlist.h" | |
fc54b8d2 FC |
42 | #include "anyp/ProtocolType.h" |
43 | #include "Debug.h" | |
44 | #include "HttpHeader.h" | |
45 | #include "HttpStatusCode.h" | |
4b981814 AJ |
46 | #include "lookup_t.h" |
47 | ||
fc54b8d2 | 48 | |
75cb38cb | 49 | class HttpRequestMethod; |
9a0a18de | 50 | #if USE_DELAY_POOLS |
b4cd430a CT |
51 | class ClientInfo; |
52 | #endif | |
75cb38cb | 53 | |
e6ccf245 | 54 | |
b6b6f466 | 55 | class FwdState; |
63be0a78 | 56 | |
63be0a78 | 57 | |
e1f7507e | 58 | class HttpRequest; |
696a257c | 59 | class HttpReply; |
e1f7507e | 60 | |
fc54b8d2 | 61 | /* TODO: move to StrList.h */ |
30abd221 | 62 | SQUIDCEXTERN void strListAdd(String * str, const char *item, char del); |
63 | SQUIDCEXTERN int strListIsMember(const String * str, const char *item, char del); | |
64 | SQUIDCEXTERN int strListIsSubstr(const String * list, const char *s, char del); | |
65 | SQUIDCEXTERN int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos); | |
7faf2bdb | 66 | |
fc54b8d2 FC |
67 | extern const char *getStringPrefix(const char *str, const char *end); |
68 | ||
69 | ||
a9925b40 | 70 | |
4f087419 | 71 | /* store report about current header usage and other stats */ |
59a09b98 | 72 | void httpHeaderStoreReport(StoreEntry * e); |
8c01ada0 | 73 | SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *, int req_or_rep); |
a8258824 | 74 | |
59ad6d31 | 75 | #if SQUID_SNMP |
e6ccf245 | 76 | SQUIDCEXTERN PF snmpHandleUdp; |
77 | SQUIDCEXTERN void snmpInit(void); | |
65d448bc AJ |
78 | SQUIDCEXTERN void snmpOpenPorts(void); |
79 | SQUIDCEXTERN void snmpClosePorts(void); | |
6a644e75 | 80 | SQUIDCEXTERN const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf); |
62e76326 | 81 | |
b7ac5457 AJ |
82 | SQUIDCEXTERN void addr2oid(Ip::Address &addr, oid *Dest); |
83 | SQUIDCEXTERN void oid2addr(oid *Dest, Ip::Address &addr, u_int code); | |
62e76326 | 84 | |
b7ac5457 | 85 | SQUIDCEXTERN Ip::Address *client_entry(Ip::Address *current); |
daacd51f AJ |
86 | extern variable_list *snmp_basicFn(variable_list *, snint *); |
87 | extern variable_list *snmp_confFn(variable_list *, snint *); | |
88 | extern variable_list *snmp_sysFn(variable_list *, snint *); | |
89 | extern variable_list *snmp_prfSysFn(variable_list *, snint *); | |
90 | extern variable_list *snmp_prfProtoFn(variable_list *, snint *); | |
91 | extern variable_list *snmp_prfPeerFn(variable_list *, snint *); | |
92 | extern variable_list *snmp_netIpFn(variable_list *, snint *); | |
93 | extern variable_list *snmp_netFqdnFn(variable_list *, snint *); | |
daacd51f | 94 | extern variable_list *snmp_netDnsFn(variable_list *, snint *); |
daacd51f AJ |
95 | extern variable_list *snmp_meshPtblFn(variable_list *, snint *); |
96 | extern variable_list *snmp_meshCtblFn(variable_list *, snint *); | |
678c6099 | 97 | #endif /* SQUID_SNMP */ |
2bbd722b | 98 | |
582c2af2 FC |
99 | extern char *mime_get_header(const char *mime, const char *header); |
100 | extern char *mime_get_header_field(const char *mime, const char *name, const char *prefix); | |
101 | extern size_t headersEnd(const char *, size_t); | |
e6ccf245 | 102 | |
582c2af2 FC |
103 | extern void mimeInit(char *filename); |
104 | extern void mimeFreeMemory(void); | |
105 | extern char *mimeGetContentEncoding(const char *fn); | |
106 | extern char *mimeGetContentType(const char *fn); | |
107 | extern char const *mimeGetIcon(const char *fn); | |
108 | extern const char *mimeGetIconURL(const char *fn); | |
109 | extern char mimeGetTransferMode(const char *fn); | |
110 | extern int mimeGetDownloadOption(const char *fn); | |
111 | extern int mimeGetViewOption(const char *fn); | |
e6ccf245 | 112 | |
714e68b7 | 113 | #include "ipcache.h" |
582c2af2 FC |
114 | extern int mcastSetTtl(int, int); |
115 | extern IPH mcastJoinGroups; | |
a8258824 | 116 | |
f9b72e0c AJ |
117 | #include "comm/forward.h" |
118 | extern void getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn); | |
b7ac5457 | 119 | extern Ip::Address getOutgoingAddr(HttpRequest * request, struct peer *dst_peer); |
a8258824 | 120 | |
190154cf | 121 | SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *); |
e6ccf245 | 122 | |
e6ccf245 | 123 | SQUIDCEXTERN void redirectInit(void); |
124 | SQUIDCEXTERN void redirectShutdown(void); | |
125 | ||
9bea1d5b | 126 | |
9bea1d5b | 127 | extern void shut_down(int); |
b293c4d8 | 128 | extern void rotate_logs(int); |
129 | extern void reconfigure(int); | |
9bea1d5b | 130 | |
fc54b8d2 | 131 | |
9bea1d5b | 132 | extern void start_announce(void *unused); |
9bea1d5b | 133 | extern void waisStart(FwdState *); |
05832ae1 | 134 | |
a8258824 | 135 | /* ----------------------------------------------------------------- */ |
136 | ||
22d38e05 | 137 | /* repl_modules.c */ |
582c2af2 | 138 | extern void storeReplSetup(void); |
22d38e05 | 139 | |
e3ef2b09 | 140 | /* |
141 | * store_log.c | |
142 | */ | |
582c2af2 FC |
143 | extern void storeLog(int tag, const StoreEntry * e); |
144 | extern void storeLogRotate(void); | |
145 | extern void storeLogClose(void); | |
146 | extern void storeLogOpen(void); | |
e3ef2b09 | 147 | |
a8258824 | 148 | |
f09f5b26 | 149 | /* |
1ffc4484 | 150 | * store_digest.c |
f09f5b26 | 151 | */ |
582c2af2 FC |
152 | extern void storeDigestInit(void); |
153 | extern void storeDigestNoteStoreReady(void); | |
154 | extern void storeDigestScheduleRebuild(void); | |
155 | extern void storeDigestDel(const StoreEntry * entry); | |
daacd51f | 156 | extern void storeDigestReport(StoreEntry *); |
8638fc66 | 157 | |
f09f5b26 | 158 | /* |
159 | * store_rebuild.c | |
160 | */ | |
e6ccf245 | 161 | SQUIDCEXTERN void storeRebuildStart(void); |
62e76326 | 162 | |
e6ccf245 | 163 | SQUIDCEXTERN void storeRebuildComplete(struct _store_rebuild_data *); |
164 | SQUIDCEXTERN void storeRebuildProgress(int sd_index, int total, int sofar); | |
f09f5b26 | 165 | |
aa1a691e | 166 | /// loads entry from disk; fills supplied memory buffer on success |
582c2af2 | 167 | extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, struct _store_rebuild_data &counts); |
aa1a691e | 168 | /// parses entry buffer and validates entry metadata; fills e on success |
582c2af2 | 169 | extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, struct _store_rebuild_data &counts, uint64_t expectedSize); |
e2851fe7 | 170 | /// checks whether the loaded entry should be kept; updates counters |
582c2af2 | 171 | extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, struct _store_rebuild_data &counts); |
e2851fe7 | 172 | |
fc54b8d2 | 173 | |
f09f5b26 | 174 | /* |
175 | * store_swapin.c | |
176 | */ | |
e1f7507e | 177 | class store_client; |
582c2af2 | 178 | extern void storeSwapInStart(store_client *); |
f09f5b26 | 179 | |
f09f5b26 | 180 | /* |
181 | * store_client.c | |
182 | */ | |
e6ccf245 | 183 | SQUIDCEXTERN store_client *storeClientListAdd(StoreEntry * e, void *data); |
184 | SQUIDCEXTERN int storeClientCopyPending(store_client *, StoreEntry * e, void *data); | |
5f5e883f FC |
185 | SQUIDCEXTERN int storeUnregister(store_client * sc, StoreEntry * e, void *data) |
186 | ; | |
e6ccf245 | 187 | SQUIDCEXTERN int storePendingNClients(const StoreEntry * e); |
188 | SQUIDCEXTERN int storeClientIsThisAClient(store_client * sc, void *someClient); | |
189 | ||
fc54b8d2 | 190 | |
e6ccf245 | 191 | SQUIDCEXTERN const char *getMyHostname(void); |
192 | SQUIDCEXTERN const char *uniqueHostname(void); | |
193 | SQUIDCEXTERN void safeunlink(const char *path, int quiet); | |
daacd51f AJ |
194 | |
195 | #include "fatal.h" | |
582c2af2 FC |
196 | extern void death(int sig); |
197 | extern void sigusr2_handle(int sig); | |
198 | extern void sig_child(int sig); | |
199 | extern void sig_shutdown(int sig); ///< handles shutdown notifications from kids | |
e6ccf245 | 200 | SQUIDCEXTERN void leave_suid(void); |
201 | SQUIDCEXTERN void enter_suid(void); | |
202 | SQUIDCEXTERN void no_suid(void); | |
203 | SQUIDCEXTERN void writePidFile(void); | |
204 | SQUIDCEXTERN void setSocketShutdownLifetimes(int); | |
205 | SQUIDCEXTERN void setMaxFD(void); | |
f3f0f563 | 206 | SQUIDCEXTERN void setSystemLimits(void); |
daacd51f | 207 | extern void squid_signal(int sig, SIGHDLR *, int flags); |
e6ccf245 | 208 | SQUIDCEXTERN pid_t readPidFile(void); |
fc68f6b1 | 209 | SQUIDCEXTERN void keepCapabilities(void); |
a2c48c98 | 210 | SQUIDCEXTERN void BroadcastSignalIfAny(int& sig); |
7de94c8c AR |
211 | /// whether the current process is the parent of all other Squid processes |
212 | SQUIDCEXTERN bool IamMasterProcess(); | |
5667a628 | 213 | /** |
7de94c8c AR |
214 | whether the current process is dedicated to doing things that only |
215 | a single process should do, such as PID file maintenance and WCCP | |
216 | */ | |
217 | SQUIDCEXTERN bool IamPrimaryProcess(); | |
218 | /// whether the current process coordinates worker processes | |
219 | SQUIDCEXTERN bool IamCoordinatorProcess(); | |
220 | /// whether the current process handles HTTP transactions and such | |
221 | SQUIDCEXTERN bool IamWorkerProcess(); | |
095ec2b1 | 222 | /// whether the current process is dedicated to managing a cache_dir |
582c2af2 | 223 | extern bool IamDiskProcess(); |
96c2bb61 AR |
224 | /// Whether we are running in daemon mode |
225 | SQUIDCEXTERN bool InDaemonMode(); // try using specific Iam*() checks above first | |
7de94c8c AR |
226 | /// Whether there should be more than one worker process running |
227 | SQUIDCEXTERN bool UsingSmp(); // try using specific Iam*() checks above first | |
96c2bb61 AR |
228 | /// number of Kid processes as defined in src/ipc/Kid.h |
229 | SQUIDCEXTERN int NumberOfKids(); | |
095ec2b1 | 230 | /// a string describing this process roles such as worker or coordinator |
582c2af2 | 231 | extern String ProcessRoles(); |
a2c48c98 AR |
232 | SQUIDCEXTERN int DebugSignal; |
233 | ||
cc192b50 | 234 | /* AYJ debugs function to show locations being reset with memset() */ |
235 | SQUIDCEXTERN void *xmemset(void *dst, int, size_t); | |
236 | ||
e6ccf245 | 237 | SQUIDCEXTERN void debug_trap(const char *); |
238 | SQUIDCEXTERN void logsFlush(void); | |
239 | SQUIDCEXTERN const char *checkNullString(const char *p); | |
62e76326 | 240 | |
e6ccf245 | 241 | SQUIDCEXTERN void squid_getrusage(struct rusage *r); |
62e76326 | 242 | |
e6ccf245 | 243 | SQUIDCEXTERN double rusage_cputime(struct rusage *r); |
62e76326 | 244 | |
e6ccf245 | 245 | SQUIDCEXTERN int rusage_maxrss(struct rusage *r); |
62e76326 | 246 | |
e6ccf245 | 247 | SQUIDCEXTERN int rusage_pagefaults(struct rusage *r); |
248 | SQUIDCEXTERN void releaseServerSockets(void); | |
249 | SQUIDCEXTERN void PrintRusage(void); | |
250 | SQUIDCEXTERN void dumpMallocStats(void); | |
ba2d3770 | 251 | |
a3d0a19d | 252 | #if USE_UNLINKD |
c521ad17 | 253 | SQUIDCEXTERN bool unlinkdNeeded(void); |
e6ccf245 | 254 | SQUIDCEXTERN void unlinkdInit(void); |
255 | SQUIDCEXTERN void unlinkdClose(void); | |
256 | SQUIDCEXTERN void unlinkdUnlink(const char *); | |
a3d0a19d | 257 | #endif |
ba2d3770 | 258 | |
e6ccf245 | 259 | |
e6ccf245 | 260 | SQUIDCEXTERN peer_t parseNeighborType(const char *s); |
261 | ||
fc54b8d2 FC |
262 | SQUIDCEXTERN int stringHasWhitespace(const char *); //String.cc |
263 | SQUIDCEXTERN int stringHasCntl(const char *); //String.cc | |
264 | SQUIDCEXTERN void linklistPush(link_list **, void *); //list.cc | |
265 | SQUIDCEXTERN void *linklistShift(link_list **); //list.cc | |
266 | SQUIDCEXTERN int xrename(const char *from, const char *to); //disk.cc | |
267 | extern int isPowTen(int); //int.cc | |
268 | ||
269 | SQUIDCEXTERN char *strwordtok(char *buf, char **t); //String.cc | |
270 | ||
d860a1aa | 271 | |
66c75c41 | 272 | /* |
5a70d304 | 273 | * ipc.c |
66c75c41 | 274 | */ |
b5d712b5 | 275 | SQUIDCEXTERN pid_t ipcCreate(int type, |
276 | const char *prog, | |
277 | const char *const args[], | |
278 | const char *name, | |
b7ac5457 | 279 | Ip::Address &local_addr, |
b5d712b5 | 280 | int *rfd, |
281 | int *wfd, | |
282 | void **hIpc); | |
283 | ||
5d620373 | 284 | |
5a70d304 | 285 | /* |
286 | * prototypes for system functions missing from system includes | |
287 | */ | |
288 | ||
1191b93b | 289 | #if _SQUID_SOLARIS_ |
62e76326 | 290 | |
e6ccf245 | 291 | SQUIDCEXTERN int getrusage(int, struct rusage *); |
292 | SQUIDCEXTERN int getpagesize(void); | |
b8ef2a76 | 293 | #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \ |
26ac0430 | 294 | (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))) |
e6ccf245 | 295 | SQUIDCEXTERN int gethostname(char *, int); |
5a70d304 | 296 | #endif |
b8ef2a76 | 297 | #endif |
bc87dc25 | 298 | |
2d72d4fd | 299 | /* |
300 | * hack to allow snmp access to the statistics counters | |
301 | */ | |
e1656dc4 | 302 | class StatCounters; |
75fbab53 | 303 | SQUIDCEXTERN StatCounters *snmpStatGet(int); |
f66a9ef4 | 304 | |
0e6d05ef | 305 | |
75fbab53 A |
306 | /* CygWin & Windows NT Port */ |
307 | /* win32.c */ | |
be266cb2 | 308 | #if _SQUID_WINDOWS_ |
75fbab53 A |
309 | SQUIDCEXTERN int WIN32_Subsystem_Init(int *, char ***); |
310 | SQUIDCEXTERN void WIN32_sendSignal(int); | |
311 | SQUIDCEXTERN void WIN32_Abort(int); | |
312 | SQUIDCEXTERN void WIN32_Exit(void); | |
313 | SQUIDCEXTERN void WIN32_SetServiceCommandLine(void); | |
314 | SQUIDCEXTERN void WIN32_InstallService(void); | |
315 | SQUIDCEXTERN void WIN32_RemoveService(void); | |
316 | SQUIDCEXTERN int SquidMain(int, char **); | |
be266cb2 | 317 | #endif /* _SQUID_WINDOWS_ */ |
1191b93b | 318 | #if _SQUID_MSWIN_ |
a50bfe93 | 319 | |
75fbab53 | 320 | SQUIDCEXTERN int WIN32_pipe(int[2]); |
485a0d3f | 321 | |
75fbab53 A |
322 | SQUIDCEXTERN int WIN32_getrusage(int, struct rusage *); |
323 | SQUIDCEXTERN void WIN32_ExceptionHandlerInit(void); | |
485a0d3f | 324 | |
75fbab53 A |
325 | SQUIDCEXTERN int Win32__WSAFDIsSet(int fd, fd_set* set); |
326 | SQUIDCEXTERN DWORD WIN32_IpAddrChangeMonitorInit(); | |
485a0d3f | 327 | |
0e6d05ef | 328 | #endif |
b5638623 | 329 | |
fc54b8d2 | 330 | extern char *strtokFile(void); |
0b0cfcf2 | 331 | |
2f1431ea AJ |
332 | #if USE_AUTH |
333 | ||
334 | #if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI | |
75fbab53 A |
335 | /* upstream proxy authentication */ |
336 | SQUIDCEXTERN char *peer_proxy_negotiate_auth(char *principal_name, char *proxy); | |
9ca29d23 | 337 | #endif |
5817ee13 | 338 | |
75fbab53 A |
339 | namespace Auth { |
340 | /* call to ensure the auth component schemes exist. */ | |
341 | extern void Init(void); | |
342 | } // namespace Auth | |
ccd8a22a | 343 | |
2f1431ea | 344 | #endif /* USE_AUTH */ |
5817ee13 | 345 | |
b5638623 | 346 | #endif /* SQUID_PROTOS_H */ |