]> git.ipfire.org Git - thirdparty/squid.git/blob - src/protos.h
Moved mime.cc-related prototypes to newly-created mime.h
[thirdparty/squid.git] / src / protos.h
1 /*
2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
4 *
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.
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.
18 *
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.
23 *
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 */
29 #ifndef SQUID_PROTOS_H
30 #define SQUID_PROTOS_H
31
32 /* included for routines that have not moved out to their proper homes
33 * yet.
34 */
35 #include "Packer.h"
36 /* for routines still in this file that take CacheManager parameters */
37 #include "ip/Address.h"
38 /* for parameters that still need these */
39 #include "enums.h"
40 /* some parameters stil need this */
41 #include "wordlist.h"
42 #include "anyp/ProtocolType.h"
43 #include "Debug.h"
44 #include "HttpHeader.h"
45 #include "HttpStatusCode.h"
46 #include "lookup_t.h"
47
48 class HttpRequestMethod;
49 #if USE_DELAY_POOLS
50 class ClientInfo;
51 #endif
52
53 class FwdState;
54
55 class HttpRequest;
56 class HttpReply;
57
58
59 #if SQUID_SNMP
60 SQUIDCEXTERN PF snmpHandleUdp;
61 SQUIDCEXTERN void snmpInit(void);
62 SQUIDCEXTERN void snmpOpenPorts(void);
63 SQUIDCEXTERN void snmpClosePorts(void);
64 SQUIDCEXTERN const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf);
65
66 SQUIDCEXTERN void addr2oid(Ip::Address &addr, oid *Dest);
67 SQUIDCEXTERN void oid2addr(oid *Dest, Ip::Address &addr, u_int code);
68
69 SQUIDCEXTERN Ip::Address *client_entry(Ip::Address *current);
70 extern variable_list *snmp_basicFn(variable_list *, snint *);
71 extern variable_list *snmp_confFn(variable_list *, snint *);
72 extern variable_list *snmp_sysFn(variable_list *, snint *);
73 extern variable_list *snmp_prfSysFn(variable_list *, snint *);
74 extern variable_list *snmp_prfProtoFn(variable_list *, snint *);
75 extern variable_list *snmp_prfPeerFn(variable_list *, snint *);
76 extern variable_list *snmp_netIpFn(variable_list *, snint *);
77 extern variable_list *snmp_netFqdnFn(variable_list *, snint *);
78 extern variable_list *snmp_netDnsFn(variable_list *, snint *);
79 extern variable_list *snmp_meshPtblFn(variable_list *, snint *);
80 extern variable_list *snmp_meshCtblFn(variable_list *, snint *);
81 #endif /* SQUID_SNMP */
82
83
84 #include "ipcache.h"
85 extern int mcastSetTtl(int, int);
86 extern IPH mcastJoinGroups;
87
88 #include "comm/forward.h"
89 extern void getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn);
90 extern Ip::Address getOutgoingAddr(HttpRequest * request, struct peer *dst_peer);
91
92 SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *);
93
94 SQUIDCEXTERN void redirectInit(void);
95 SQUIDCEXTERN void redirectShutdown(void);
96
97 extern void shut_down(int);
98 extern void rotate_logs(int);
99 extern void reconfigure(int);
100
101 extern void start_announce(void *unused);
102 extern void waisStart(FwdState *);
103
104 /* ----------------------------------------------------------------- */
105
106 /* repl_modules.c */
107 extern void storeReplSetup(void);
108
109 /*
110 * store_log.c
111 */
112 extern void storeLog(int tag, const StoreEntry * e);
113 extern void storeLogRotate(void);
114 extern void storeLogClose(void);
115 extern void storeLogOpen(void);
116
117 /*
118 * store_digest.c
119 */
120 extern void storeDigestInit(void);
121 extern void storeDigestNoteStoreReady(void);
122 extern void storeDigestScheduleRebuild(void);
123 extern void storeDigestDel(const StoreEntry * entry);
124 extern void storeDigestReport(StoreEntry *);
125
126 /*
127 * store_rebuild.c
128 */
129 SQUIDCEXTERN void storeRebuildStart(void);
130
131 SQUIDCEXTERN void storeRebuildComplete(struct _store_rebuild_data *);
132 SQUIDCEXTERN void storeRebuildProgress(int sd_index, int total, int sofar);
133
134 /// loads entry from disk; fills supplied memory buffer on success
135 extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, struct _store_rebuild_data &counts);
136 /// parses entry buffer and validates entry metadata; fills e on success
137 extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, struct _store_rebuild_data &counts, uint64_t expectedSize);
138 /// checks whether the loaded entry should be kept; updates counters
139 extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, struct _store_rebuild_data &counts);
140
141 /*
142 * store_swapin.c
143 */
144 class store_client;
145 extern void storeSwapInStart(store_client *);
146
147 /*
148 * store_client.c
149 */
150 SQUIDCEXTERN store_client *storeClientListAdd(StoreEntry * e, void *data);
151 SQUIDCEXTERN int storeClientCopyPending(store_client *, StoreEntry * e, void *data);
152 SQUIDCEXTERN int storeUnregister(store_client * sc, StoreEntry * e, void *data)
153 ;
154 SQUIDCEXTERN int storePendingNClients(const StoreEntry * e);
155 SQUIDCEXTERN int storeClientIsThisAClient(store_client * sc, void *someClient);
156
157 SQUIDCEXTERN const char *getMyHostname(void);
158 SQUIDCEXTERN const char *uniqueHostname(void);
159 SQUIDCEXTERN void safeunlink(const char *path, int quiet);
160
161 #include "fatal.h"
162 extern void death(int sig);
163 extern void sigusr2_handle(int sig);
164 extern void sig_child(int sig);
165 extern void sig_shutdown(int sig); ///< handles shutdown notifications from kids
166 SQUIDCEXTERN void leave_suid(void);
167 SQUIDCEXTERN void enter_suid(void);
168 SQUIDCEXTERN void no_suid(void);
169 SQUIDCEXTERN void writePidFile(void);
170 SQUIDCEXTERN void setSocketShutdownLifetimes(int);
171 SQUIDCEXTERN void setMaxFD(void);
172 SQUIDCEXTERN void setSystemLimits(void);
173 extern void squid_signal(int sig, SIGHDLR *, int flags);
174 SQUIDCEXTERN pid_t readPidFile(void);
175 SQUIDCEXTERN void keepCapabilities(void);
176 SQUIDCEXTERN void BroadcastSignalIfAny(int& sig);
177 /// whether the current process is the parent of all other Squid processes
178 SQUIDCEXTERN bool IamMasterProcess();
179 /**
180 whether the current process is dedicated to doing things that only
181 a single process should do, such as PID file maintenance and WCCP
182 */
183 SQUIDCEXTERN bool IamPrimaryProcess();
184 /// whether the current process coordinates worker processes
185 SQUIDCEXTERN bool IamCoordinatorProcess();
186 /// whether the current process handles HTTP transactions and such
187 SQUIDCEXTERN bool IamWorkerProcess();
188 /// whether the current process is dedicated to managing a cache_dir
189 extern bool IamDiskProcess();
190 /// Whether we are running in daemon mode
191 SQUIDCEXTERN bool InDaemonMode(); // try using specific Iam*() checks above first
192 /// Whether there should be more than one worker process running
193 SQUIDCEXTERN bool UsingSmp(); // try using specific Iam*() checks above first
194 /// number of Kid processes as defined in src/ipc/Kid.h
195 SQUIDCEXTERN int NumberOfKids();
196 /// a string describing this process roles such as worker or coordinator
197 extern String ProcessRoles();
198 SQUIDCEXTERN int DebugSignal;
199
200 /* AYJ debugs function to show locations being reset with memset() */
201 SQUIDCEXTERN void *xmemset(void *dst, int, size_t);
202
203 SQUIDCEXTERN void debug_trap(const char *);
204 SQUIDCEXTERN void logsFlush(void);
205 SQUIDCEXTERN const char *checkNullString(const char *p);
206
207 SQUIDCEXTERN void squid_getrusage(struct rusage *r);
208
209 SQUIDCEXTERN double rusage_cputime(struct rusage *r);
210
211 SQUIDCEXTERN int rusage_maxrss(struct rusage *r);
212
213 SQUIDCEXTERN int rusage_pagefaults(struct rusage *r);
214 SQUIDCEXTERN void releaseServerSockets(void);
215 SQUIDCEXTERN void PrintRusage(void);
216 SQUIDCEXTERN void dumpMallocStats(void);
217
218 #if USE_UNLINKD
219 SQUIDCEXTERN bool unlinkdNeeded(void);
220 SQUIDCEXTERN void unlinkdInit(void);
221 SQUIDCEXTERN void unlinkdClose(void);
222 SQUIDCEXTERN void unlinkdUnlink(const char *);
223 #endif
224
225 SQUIDCEXTERN peer_t parseNeighborType(const char *s);
226
227 SQUIDCEXTERN int stringHasWhitespace(const char *); //String.cc
228 SQUIDCEXTERN int stringHasCntl(const char *); //String.cc
229 SQUIDCEXTERN void linklistPush(link_list **, void *); //list.cc
230 SQUIDCEXTERN void *linklistShift(link_list **); //list.cc
231 SQUIDCEXTERN int xrename(const char *from, const char *to); //disk.cc
232 extern int isPowTen(int); //int.cc
233
234 SQUIDCEXTERN char *strwordtok(char *buf, char **t); //String.cc
235
236 /*
237 * ipc.c
238 */
239 SQUIDCEXTERN pid_t ipcCreate(int type,
240 const char *prog,
241 const char *const args[],
242 const char *name,
243 Ip::Address &local_addr,
244 int *rfd,
245 int *wfd,
246 void **hIpc);
247
248 /*
249 * prototypes for system functions missing from system includes
250 */
251
252 #if _SQUID_SOLARIS_
253
254 SQUIDCEXTERN int getrusage(int, struct rusage *);
255 SQUIDCEXTERN int getpagesize(void);
256 #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
257 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
258 SQUIDCEXTERN int gethostname(char *, int);
259 #endif
260 #endif
261
262 /*
263 * hack to allow snmp access to the statistics counters
264 */
265 class StatCounters;
266 SQUIDCEXTERN StatCounters *snmpStatGet(int);
267
268 /* CygWin & Windows NT Port */
269 /* win32.c */
270 #if _SQUID_WINDOWS_
271 SQUIDCEXTERN int WIN32_Subsystem_Init(int *, char ***);
272 SQUIDCEXTERN void WIN32_sendSignal(int);
273 SQUIDCEXTERN void WIN32_Abort(int);
274 SQUIDCEXTERN void WIN32_Exit(void);
275 SQUIDCEXTERN void WIN32_SetServiceCommandLine(void);
276 SQUIDCEXTERN void WIN32_InstallService(void);
277 SQUIDCEXTERN void WIN32_RemoveService(void);
278 SQUIDCEXTERN int SquidMain(int, char **);
279 #endif /* _SQUID_WINDOWS_ */
280 #if _SQUID_MSWIN_
281
282 SQUIDCEXTERN int WIN32_pipe(int[2]);
283
284 SQUIDCEXTERN int WIN32_getrusage(int, struct rusage *);
285 SQUIDCEXTERN void WIN32_ExceptionHandlerInit(void);
286
287 SQUIDCEXTERN int Win32__WSAFDIsSet(int fd, fd_set* set);
288 SQUIDCEXTERN DWORD WIN32_IpAddrChangeMonitorInit();
289
290 #endif
291
292 extern char *strtokFile(void);
293
294 #if USE_AUTH
295
296 #if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI
297 /* upstream proxy authentication */
298 SQUIDCEXTERN char *peer_proxy_negotiate_auth(char *principal_name, char *proxy);
299 #endif
300
301 namespace Auth {
302 /* call to ensure the auth component schemes exist. */
303 extern void Init(void);
304 } // namespace Auth
305
306 #endif /* USE_AUTH */
307
308 #endif /* SQUID_PROTOS_H */