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 */
83 #include "comm/forward.h"
85 extern void shut_down(int);
86 extern void rotate_logs(int);
87 extern void reconfigure(int);
92 SQUIDCEXTERN
void storeRebuildStart(void);
94 SQUIDCEXTERN
void storeRebuildComplete(struct _store_rebuild_data
*);
95 SQUIDCEXTERN
void storeRebuildProgress(int sd_index
, int total
, int sofar
);
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
);
108 extern void storeSwapInStart(store_client
*);
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
)
117 SQUIDCEXTERN
int storePendingNClients(const StoreEntry
* e
);
118 SQUIDCEXTERN
int storeClientIsThisAClient(store_client
* sc
, void *someClient
);
120 SQUIDCEXTERN
const char *getMyHostname(void);
121 SQUIDCEXTERN
const char *uniqueHostname(void);
122 SQUIDCEXTERN
void safeunlink(const char *path
, int quiet
);
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();
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
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
;
163 /* AYJ debugs function to show locations being reset with memset() */
164 SQUIDCEXTERN
void *xmemset(void *dst
, int, size_t);
166 SQUIDCEXTERN
void debug_trap(const char *);
167 SQUIDCEXTERN
void logsFlush(void);
168 SQUIDCEXTERN
const char *checkNullString(const char *p
);
170 SQUIDCEXTERN
void squid_getrusage(struct rusage
*r
);
172 SQUIDCEXTERN
double rusage_cputime(struct rusage
*r
);
174 SQUIDCEXTERN
int rusage_maxrss(struct rusage
*r
);
176 SQUIDCEXTERN
int rusage_pagefaults(struct rusage
*r
);
177 SQUIDCEXTERN
void releaseServerSockets(void);
178 SQUIDCEXTERN
void PrintRusage(void);
179 SQUIDCEXTERN
void dumpMallocStats(void);
182 SQUIDCEXTERN
bool unlinkdNeeded(void);
183 SQUIDCEXTERN
void unlinkdInit(void);
184 SQUIDCEXTERN
void unlinkdClose(void);
185 SQUIDCEXTERN
void unlinkdUnlink(const char *);
188 SQUIDCEXTERN peer_t
parseNeighborType(const char *s
);
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
197 SQUIDCEXTERN
char *strwordtok(char *buf
, char **t
); //String.cc
202 SQUIDCEXTERN pid_t
ipcCreate(int type
,
204 const char *const args
[],
206 Ip::Address
&local_addr
,
212 * prototypes for system functions missing from system includes
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);
226 * hack to allow snmp access to the statistics counters
229 SQUIDCEXTERN StatCounters
*snmpStatGet(int);
231 /* CygWin & Windows NT Port */
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_ */
245 SQUIDCEXTERN
int WIN32_pipe(int[2]);
247 SQUIDCEXTERN
int WIN32_getrusage(int, struct rusage
*);
248 SQUIDCEXTERN
void WIN32_ExceptionHandlerInit(void);
250 SQUIDCEXTERN
int Win32__WSAFDIsSet(int fd
, fd_set
* set
);
251 SQUIDCEXTERN DWORD
WIN32_IpAddrChangeMonitorInit();
255 extern char *strtokFile(void);
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
);
265 /* call to ensure the auth component schemes exist. */
266 extern void Init(void);
269 #endif /* USE_AUTH */
271 #endif /* SQUID_PROTOS_H */