]> git.ipfire.org Git - thirdparty/squid.git/blob - src/protos.h
Moved store_digest-related prototypes to newly-created store_digest.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 #include "comm/forward.h"
84
85 extern void shut_down(int);
86 extern void rotate_logs(int);
87 extern void reconfigure(int);
88
89 /*
90 * store_rebuild.c
91 */
92 SQUIDCEXTERN void storeRebuildStart(void);
93
94 SQUIDCEXTERN void storeRebuildComplete(struct _store_rebuild_data *);
95 SQUIDCEXTERN void storeRebuildProgress(int sd_index, int total, int sofar);
96
97 /// loads entry from disk; fills supplied memory buffer on success
98 extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, struct _store_rebuild_data &counts);
99 /// parses entry buffer and validates entry metadata; fills e on success
100 extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, struct _store_rebuild_data &counts, uint64_t expectedSize);
101 /// checks whether the loaded entry should be kept; updates counters
102 extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, struct _store_rebuild_data &counts);
103
104 /*
105 * store_swapin.c
106 */
107 class store_client;
108 extern void storeSwapInStart(store_client *);
109
110 /*
111 * store_client.c
112 */
113 SQUIDCEXTERN store_client *storeClientListAdd(StoreEntry * e, void *data);
114 SQUIDCEXTERN int storeClientCopyPending(store_client *, StoreEntry * e, void *data);
115 SQUIDCEXTERN int storeUnregister(store_client * sc, StoreEntry * e, void *data)
116 ;
117 SQUIDCEXTERN int storePendingNClients(const StoreEntry * e);
118 SQUIDCEXTERN int storeClientIsThisAClient(store_client * sc, void *someClient);
119
120 SQUIDCEXTERN const char *getMyHostname(void);
121 SQUIDCEXTERN const char *uniqueHostname(void);
122 SQUIDCEXTERN void safeunlink(const char *path, int quiet);
123
124 #include "fatal.h"
125 extern void death(int sig);
126 extern void sigusr2_handle(int sig);
127 extern void sig_child(int sig);
128 extern void sig_shutdown(int sig); ///< handles shutdown notifications from kids
129 SQUIDCEXTERN void leave_suid(void);
130 SQUIDCEXTERN void enter_suid(void);
131 SQUIDCEXTERN void no_suid(void);
132 SQUIDCEXTERN void writePidFile(void);
133 SQUIDCEXTERN void setSocketShutdownLifetimes(int);
134 SQUIDCEXTERN void setMaxFD(void);
135 SQUIDCEXTERN void setSystemLimits(void);
136 extern void squid_signal(int sig, SIGHDLR *, int flags);
137 SQUIDCEXTERN pid_t readPidFile(void);
138 SQUIDCEXTERN void keepCapabilities(void);
139 SQUIDCEXTERN void BroadcastSignalIfAny(int& sig);
140 /// whether the current process is the parent of all other Squid processes
141 SQUIDCEXTERN bool IamMasterProcess();
142 /**
143 whether the current process is dedicated to doing things that only
144 a single process should do, such as PID file maintenance and WCCP
145 */
146 SQUIDCEXTERN bool IamPrimaryProcess();
147 /// whether the current process coordinates worker processes
148 SQUIDCEXTERN bool IamCoordinatorProcess();
149 /// whether the current process handles HTTP transactions and such
150 SQUIDCEXTERN bool IamWorkerProcess();
151 /// whether the current process is dedicated to managing a cache_dir
152 extern bool IamDiskProcess();
153 /// Whether we are running in daemon mode
154 SQUIDCEXTERN bool InDaemonMode(); // try using specific Iam*() checks above first
155 /// Whether there should be more than one worker process running
156 SQUIDCEXTERN bool UsingSmp(); // try using specific Iam*() checks above first
157 /// number of Kid processes as defined in src/ipc/Kid.h
158 SQUIDCEXTERN int NumberOfKids();
159 /// a string describing this process roles such as worker or coordinator
160 extern String ProcessRoles();
161 SQUIDCEXTERN int DebugSignal;
162
163 /* AYJ debugs function to show locations being reset with memset() */
164 SQUIDCEXTERN void *xmemset(void *dst, int, size_t);
165
166 SQUIDCEXTERN void debug_trap(const char *);
167 SQUIDCEXTERN void logsFlush(void);
168 SQUIDCEXTERN const char *checkNullString(const char *p);
169
170 SQUIDCEXTERN void squid_getrusage(struct rusage *r);
171
172 SQUIDCEXTERN double rusage_cputime(struct rusage *r);
173
174 SQUIDCEXTERN int rusage_maxrss(struct rusage *r);
175
176 SQUIDCEXTERN int rusage_pagefaults(struct rusage *r);
177 SQUIDCEXTERN void releaseServerSockets(void);
178 SQUIDCEXTERN void PrintRusage(void);
179 SQUIDCEXTERN void dumpMallocStats(void);
180
181 #if USE_UNLINKD
182 SQUIDCEXTERN bool unlinkdNeeded(void);
183 SQUIDCEXTERN void unlinkdInit(void);
184 SQUIDCEXTERN void unlinkdClose(void);
185 SQUIDCEXTERN void unlinkdUnlink(const char *);
186 #endif
187
188 SQUIDCEXTERN peer_t parseNeighborType(const char *s);
189
190 SQUIDCEXTERN int stringHasWhitespace(const char *); //String.cc
191 SQUIDCEXTERN int stringHasCntl(const char *); //String.cc
192 SQUIDCEXTERN void linklistPush(link_list **, void *); //list.cc
193 SQUIDCEXTERN void *linklistShift(link_list **); //list.cc
194 SQUIDCEXTERN int xrename(const char *from, const char *to); //disk.cc
195 extern int isPowTen(int); //int.cc
196
197 SQUIDCEXTERN char *strwordtok(char *buf, char **t); //String.cc
198
199 /*
200 * ipc.c
201 */
202 SQUIDCEXTERN pid_t ipcCreate(int type,
203 const char *prog,
204 const char *const args[],
205 const char *name,
206 Ip::Address &local_addr,
207 int *rfd,
208 int *wfd,
209 void **hIpc);
210
211 /*
212 * prototypes for system functions missing from system includes
213 */
214
215 #if _SQUID_SOLARIS_
216
217 SQUIDCEXTERN int getrusage(int, struct rusage *);
218 SQUIDCEXTERN int getpagesize(void);
219 #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
220 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
221 SQUIDCEXTERN int gethostname(char *, int);
222 #endif
223 #endif
224
225 /*
226 * hack to allow snmp access to the statistics counters
227 */
228 class StatCounters;
229 SQUIDCEXTERN StatCounters *snmpStatGet(int);
230
231 /* CygWin & Windows NT Port */
232 /* win32.c */
233 #if _SQUID_WINDOWS_
234 SQUIDCEXTERN int WIN32_Subsystem_Init(int *, char ***);
235 SQUIDCEXTERN void WIN32_sendSignal(int);
236 SQUIDCEXTERN void WIN32_Abort(int);
237 SQUIDCEXTERN void WIN32_Exit(void);
238 SQUIDCEXTERN void WIN32_SetServiceCommandLine(void);
239 SQUIDCEXTERN void WIN32_InstallService(void);
240 SQUIDCEXTERN void WIN32_RemoveService(void);
241 SQUIDCEXTERN int SquidMain(int, char **);
242 #endif /* _SQUID_WINDOWS_ */
243 #if _SQUID_MSWIN_
244
245 SQUIDCEXTERN int WIN32_pipe(int[2]);
246
247 SQUIDCEXTERN int WIN32_getrusage(int, struct rusage *);
248 SQUIDCEXTERN void WIN32_ExceptionHandlerInit(void);
249
250 SQUIDCEXTERN int Win32__WSAFDIsSet(int fd, fd_set* set);
251 SQUIDCEXTERN DWORD WIN32_IpAddrChangeMonitorInit();
252
253 #endif
254
255 extern char *strtokFile(void);
256
257 #if USE_AUTH
258
259 #if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI
260 /* upstream proxy authentication */
261 SQUIDCEXTERN char *peer_proxy_negotiate_auth(char *principal_name, char *proxy);
262 #endif
263
264 namespace Auth {
265 /* call to ensure the auth component schemes exist. */
266 extern void Init(void);
267 } // namespace Auth
268
269 #endif /* USE_AUTH */
270
271 #endif /* SQUID_PROTOS_H */