]> git.ipfire.org Git - thirdparty/squid.git/blame - src/protos.h
protos.h refactoring, part one.
[thirdparty/squid.git] / src / protos.h
CommitLineData
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 49class HttpRequestMethod;
9a0a18de 50#if USE_DELAY_POOLS
b4cd430a
CT
51class ClientInfo;
52#endif
75cb38cb 53
e6ccf245 54
b6b6f466 55class FwdState;
63be0a78 56
63be0a78 57
e1f7507e 58class HttpRequest;
696a257c 59class HttpReply;
e1f7507e 60
fc54b8d2 61/* TODO: move to StrList.h */
30abd221 62SQUIDCEXTERN void strListAdd(String * str, const char *item, char del);
63SQUIDCEXTERN int strListIsMember(const String * str, const char *item, char del);
64SQUIDCEXTERN int strListIsSubstr(const String * list, const char *s, char del);
65SQUIDCEXTERN int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos);
7faf2bdb 66
fc54b8d2
FC
67extern 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 72void httpHeaderStoreReport(StoreEntry * e);
8c01ada0 73SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *, int req_or_rep);
a8258824 74
59ad6d31 75#if SQUID_SNMP
e6ccf245 76SQUIDCEXTERN PF snmpHandleUdp;
77SQUIDCEXTERN void snmpInit(void);
65d448bc
AJ
78SQUIDCEXTERN void snmpOpenPorts(void);
79SQUIDCEXTERN void snmpClosePorts(void);
6a644e75 80SQUIDCEXTERN const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf);
62e76326 81
b7ac5457
AJ
82SQUIDCEXTERN void addr2oid(Ip::Address &addr, oid *Dest);
83SQUIDCEXTERN void oid2addr(oid *Dest, Ip::Address &addr, u_int code);
62e76326 84
b7ac5457 85SQUIDCEXTERN Ip::Address *client_entry(Ip::Address *current);
daacd51f
AJ
86extern variable_list *snmp_basicFn(variable_list *, snint *);
87extern variable_list *snmp_confFn(variable_list *, snint *);
88extern variable_list *snmp_sysFn(variable_list *, snint *);
89extern variable_list *snmp_prfSysFn(variable_list *, snint *);
90extern variable_list *snmp_prfProtoFn(variable_list *, snint *);
91extern variable_list *snmp_prfPeerFn(variable_list *, snint *);
92extern variable_list *snmp_netIpFn(variable_list *, snint *);
93extern variable_list *snmp_netFqdnFn(variable_list *, snint *);
daacd51f 94extern variable_list *snmp_netDnsFn(variable_list *, snint *);
daacd51f
AJ
95extern variable_list *snmp_meshPtblFn(variable_list *, snint *);
96extern variable_list *snmp_meshCtblFn(variable_list *, snint *);
678c6099 97#endif /* SQUID_SNMP */
2bbd722b 98
582c2af2
FC
99extern char *mime_get_header(const char *mime, const char *header);
100extern char *mime_get_header_field(const char *mime, const char *name, const char *prefix);
101extern size_t headersEnd(const char *, size_t);
e6ccf245 102
582c2af2
FC
103extern void mimeInit(char *filename);
104extern void mimeFreeMemory(void);
105extern char *mimeGetContentEncoding(const char *fn);
106extern char *mimeGetContentType(const char *fn);
107extern char const *mimeGetIcon(const char *fn);
108extern const char *mimeGetIconURL(const char *fn);
109extern char mimeGetTransferMode(const char *fn);
110extern int mimeGetDownloadOption(const char *fn);
111extern int mimeGetViewOption(const char *fn);
e6ccf245 112
714e68b7 113#include "ipcache.h"
582c2af2
FC
114extern int mcastSetTtl(int, int);
115extern IPH mcastJoinGroups;
a8258824 116
f9b72e0c
AJ
117#include "comm/forward.h"
118extern void getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn);
b7ac5457 119extern Ip::Address getOutgoingAddr(HttpRequest * request, struct peer *dst_peer);
a8258824 120
190154cf 121SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *);
e6ccf245 122
e6ccf245 123SQUIDCEXTERN void redirectInit(void);
124SQUIDCEXTERN void redirectShutdown(void);
125
9bea1d5b 126
9bea1d5b 127extern void shut_down(int);
b293c4d8 128extern void rotate_logs(int);
129extern void reconfigure(int);
9bea1d5b 130
fc54b8d2 131
9bea1d5b 132extern void start_announce(void *unused);
9bea1d5b 133extern void waisStart(FwdState *);
05832ae1 134
a8258824 135/* ----------------------------------------------------------------- */
136
22d38e05 137/* repl_modules.c */
582c2af2 138extern void storeReplSetup(void);
22d38e05 139
e3ef2b09 140/*
141 * store_log.c
142 */
582c2af2
FC
143extern void storeLog(int tag, const StoreEntry * e);
144extern void storeLogRotate(void);
145extern void storeLogClose(void);
146extern void storeLogOpen(void);
e3ef2b09 147
a8258824 148
f09f5b26 149/*
1ffc4484 150 * store_digest.c
f09f5b26 151 */
582c2af2
FC
152extern void storeDigestInit(void);
153extern void storeDigestNoteStoreReady(void);
154extern void storeDigestScheduleRebuild(void);
155extern void storeDigestDel(const StoreEntry * entry);
daacd51f 156extern void storeDigestReport(StoreEntry *);
8638fc66 157
f09f5b26 158/*
159 * store_rebuild.c
160 */
e6ccf245 161SQUIDCEXTERN void storeRebuildStart(void);
62e76326 162
e6ccf245 163SQUIDCEXTERN void storeRebuildComplete(struct _store_rebuild_data *);
164SQUIDCEXTERN void storeRebuildProgress(int sd_index, int total, int sofar);
f09f5b26 165
aa1a691e 166/// loads entry from disk; fills supplied memory buffer on success
582c2af2 167extern 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 169extern 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 171extern 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 177class store_client;
582c2af2 178extern void storeSwapInStart(store_client *);
f09f5b26 179
f09f5b26 180/*
181 * store_client.c
182 */
e6ccf245 183SQUIDCEXTERN store_client *storeClientListAdd(StoreEntry * e, void *data);
184SQUIDCEXTERN int storeClientCopyPending(store_client *, StoreEntry * e, void *data);
5f5e883f
FC
185SQUIDCEXTERN int storeUnregister(store_client * sc, StoreEntry * e, void *data)
186;
e6ccf245 187SQUIDCEXTERN int storePendingNClients(const StoreEntry * e);
188SQUIDCEXTERN int storeClientIsThisAClient(store_client * sc, void *someClient);
189
fc54b8d2 190
e6ccf245 191SQUIDCEXTERN const char *getMyHostname(void);
192SQUIDCEXTERN const char *uniqueHostname(void);
193SQUIDCEXTERN void safeunlink(const char *path, int quiet);
daacd51f
AJ
194
195#include "fatal.h"
582c2af2
FC
196extern void death(int sig);
197extern void sigusr2_handle(int sig);
198extern void sig_child(int sig);
199extern void sig_shutdown(int sig); ///< handles shutdown notifications from kids
e6ccf245 200SQUIDCEXTERN void leave_suid(void);
201SQUIDCEXTERN void enter_suid(void);
202SQUIDCEXTERN void no_suid(void);
203SQUIDCEXTERN void writePidFile(void);
204SQUIDCEXTERN void setSocketShutdownLifetimes(int);
205SQUIDCEXTERN void setMaxFD(void);
f3f0f563 206SQUIDCEXTERN void setSystemLimits(void);
daacd51f 207extern void squid_signal(int sig, SIGHDLR *, int flags);
e6ccf245 208SQUIDCEXTERN pid_t readPidFile(void);
fc68f6b1 209SQUIDCEXTERN void keepCapabilities(void);
a2c48c98 210SQUIDCEXTERN void BroadcastSignalIfAny(int& sig);
7de94c8c
AR
211/// whether the current process is the parent of all other Squid processes
212SQUIDCEXTERN 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*/
217SQUIDCEXTERN bool IamPrimaryProcess();
218/// whether the current process coordinates worker processes
219SQUIDCEXTERN bool IamCoordinatorProcess();
220/// whether the current process handles HTTP transactions and such
221SQUIDCEXTERN bool IamWorkerProcess();
095ec2b1 222/// whether the current process is dedicated to managing a cache_dir
582c2af2 223extern bool IamDiskProcess();
96c2bb61
AR
224/// Whether we are running in daemon mode
225SQUIDCEXTERN bool InDaemonMode(); // try using specific Iam*() checks above first
7de94c8c
AR
226/// Whether there should be more than one worker process running
227SQUIDCEXTERN bool UsingSmp(); // try using specific Iam*() checks above first
96c2bb61
AR
228/// number of Kid processes as defined in src/ipc/Kid.h
229SQUIDCEXTERN int NumberOfKids();
095ec2b1 230/// a string describing this process roles such as worker or coordinator
582c2af2 231extern String ProcessRoles();
a2c48c98
AR
232SQUIDCEXTERN int DebugSignal;
233
cc192b50 234/* AYJ debugs function to show locations being reset with memset() */
235SQUIDCEXTERN void *xmemset(void *dst, int, size_t);
236
e6ccf245 237SQUIDCEXTERN void debug_trap(const char *);
238SQUIDCEXTERN void logsFlush(void);
239SQUIDCEXTERN const char *checkNullString(const char *p);
62e76326 240
e6ccf245 241SQUIDCEXTERN void squid_getrusage(struct rusage *r);
62e76326 242
e6ccf245 243SQUIDCEXTERN double rusage_cputime(struct rusage *r);
62e76326 244
e6ccf245 245SQUIDCEXTERN int rusage_maxrss(struct rusage *r);
62e76326 246
e6ccf245 247SQUIDCEXTERN int rusage_pagefaults(struct rusage *r);
248SQUIDCEXTERN void releaseServerSockets(void);
249SQUIDCEXTERN void PrintRusage(void);
250SQUIDCEXTERN void dumpMallocStats(void);
ba2d3770 251
a3d0a19d 252#if USE_UNLINKD
c521ad17 253SQUIDCEXTERN bool unlinkdNeeded(void);
e6ccf245 254SQUIDCEXTERN void unlinkdInit(void);
255SQUIDCEXTERN void unlinkdClose(void);
256SQUIDCEXTERN void unlinkdUnlink(const char *);
a3d0a19d 257#endif
ba2d3770 258
e6ccf245 259
e6ccf245 260SQUIDCEXTERN peer_t parseNeighborType(const char *s);
261
fc54b8d2
FC
262SQUIDCEXTERN int stringHasWhitespace(const char *); //String.cc
263SQUIDCEXTERN int stringHasCntl(const char *); //String.cc
264SQUIDCEXTERN void linklistPush(link_list **, void *); //list.cc
265SQUIDCEXTERN void *linklistShift(link_list **); //list.cc
266SQUIDCEXTERN int xrename(const char *from, const char *to); //disk.cc
267extern int isPowTen(int); //int.cc
268
269SQUIDCEXTERN char *strwordtok(char *buf, char **t); //String.cc
270
d860a1aa 271
66c75c41 272/*
5a70d304 273 * ipc.c
66c75c41 274 */
b5d712b5 275SQUIDCEXTERN 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 291SQUIDCEXTERN int getrusage(int, struct rusage *);
292SQUIDCEXTERN int getpagesize(void);
b8ef2a76 293#if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
26ac0430 294(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
e6ccf245 295SQUIDCEXTERN 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 302class 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 330extern 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 */