2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
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.
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.
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.
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.
29 #ifndef SQUID_PROTOS_H
30 #define SQUID_PROTOS_H
32 /* included for routines that have not moved out to their proper homes
36 /* for routines still in this file that take CacheManager parameters */
37 #include "ip/Address.h"
38 /* for parameters that still need these */
40 /* some parameters stil need this */
42 #include "anyp/ProtocolType.h"
44 #include "HttpHeader.h"
45 #include "HttpStatusCode.h"
48 class HttpRequestMethod
;
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
);
66 SQUIDCEXTERN
void addr2oid(Ip::Address
&addr
, oid
*Dest
);
67 SQUIDCEXTERN
void oid2addr(oid
*Dest
, Ip::Address
&addr
, u_int code
);
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 */
85 extern int mcastSetTtl(int, int);
86 extern IPH mcastJoinGroups
;
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
);
92 SQUIDCEXTERN
void urnStart(HttpRequest
*, StoreEntry
*);
94 SQUIDCEXTERN
void redirectInit(void);
95 SQUIDCEXTERN
void redirectShutdown(void);
97 extern void shut_down(int);
98 extern void rotate_logs(int);
99 extern void reconfigure(int);
101 extern void start_announce(void *unused
);
102 extern void waisStart(FwdState
*);
104 /* ----------------------------------------------------------------- */
107 extern void storeReplSetup(void);
112 extern void storeLog(int tag
, const StoreEntry
* e
);
113 extern void storeLogRotate(void);
114 extern void storeLogClose(void);
115 extern void storeLogOpen(void);
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
*);
129 SQUIDCEXTERN
void storeRebuildStart(void);
131 SQUIDCEXTERN
void storeRebuildComplete(struct _store_rebuild_data
*);
132 SQUIDCEXTERN
void storeRebuildProgress(int sd_index
, int total
, int sofar
);
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
);
145 extern void storeSwapInStart(store_client
*);
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
)
154 SQUIDCEXTERN
int storePendingNClients(const StoreEntry
* e
);
155 SQUIDCEXTERN
int storeClientIsThisAClient(store_client
* sc
, void *someClient
);
157 SQUIDCEXTERN
const char *getMyHostname(void);
158 SQUIDCEXTERN
const char *uniqueHostname(void);
159 SQUIDCEXTERN
void safeunlink(const char *path
, int quiet
);
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();
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
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
;
200 /* AYJ debugs function to show locations being reset with memset() */
201 SQUIDCEXTERN
void *xmemset(void *dst
, int, size_t);
203 SQUIDCEXTERN
void debug_trap(const char *);
204 SQUIDCEXTERN
void logsFlush(void);
205 SQUIDCEXTERN
const char *checkNullString(const char *p
);
207 SQUIDCEXTERN
void squid_getrusage(struct rusage
*r
);
209 SQUIDCEXTERN
double rusage_cputime(struct rusage
*r
);
211 SQUIDCEXTERN
int rusage_maxrss(struct rusage
*r
);
213 SQUIDCEXTERN
int rusage_pagefaults(struct rusage
*r
);
214 SQUIDCEXTERN
void releaseServerSockets(void);
215 SQUIDCEXTERN
void PrintRusage(void);
216 SQUIDCEXTERN
void dumpMallocStats(void);
219 SQUIDCEXTERN
bool unlinkdNeeded(void);
220 SQUIDCEXTERN
void unlinkdInit(void);
221 SQUIDCEXTERN
void unlinkdClose(void);
222 SQUIDCEXTERN
void unlinkdUnlink(const char *);
225 SQUIDCEXTERN peer_t
parseNeighborType(const char *s
);
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
234 SQUIDCEXTERN
char *strwordtok(char *buf
, char **t
); //String.cc
239 SQUIDCEXTERN pid_t
ipcCreate(int type
,
241 const char *const args
[],
243 Ip::Address
&local_addr
,
249 * prototypes for system functions missing from system includes
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);
263 * hack to allow snmp access to the statistics counters
266 SQUIDCEXTERN StatCounters
*snmpStatGet(int);
268 /* CygWin & Windows NT Port */
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_ */
282 SQUIDCEXTERN
int WIN32_pipe(int[2]);
284 SQUIDCEXTERN
int WIN32_getrusage(int, struct rusage
*);
285 SQUIDCEXTERN
void WIN32_ExceptionHandlerInit(void);
287 SQUIDCEXTERN
int Win32__WSAFDIsSet(int fd
, fd_set
* set
);
288 SQUIDCEXTERN DWORD
WIN32_IpAddrChangeMonitorInit();
292 extern char *strtokFile(void);
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
);
302 /* call to ensure the auth component schemes exist. */
303 extern void Init(void);
306 #endif /* USE_AUTH */
308 #endif /* SQUID_PROTOS_H */