# options
# They are (with their GCC equivalent):
# squid_cv_cc_option_werror (-Werror)
+# squid_cv_cxx_option_werror (-Werror)
# squid_cv_cc_option_wall (-Wall)
# squid_cv_cc_option_optimize (-O3)
#
case "$squid_cv_compiler" in
gcc)
squid_cv_cc_option_werror="-Werror"
+ squid_cv_cxx_option_werror="-Werror"
squid_cv_cc_option_wall="-Wall"
squid_cv_cc_option_optimize="-O3"
squid_cv_cc_arg_pipe="-pipe"
;;
sunstudio)
- squid_cv_cc_option_werror="-errwarn=%all"
+ squid_cv_cc_option_werror="-errwarn=%all -errtags"
+ squid_cv_cxx_option_werror="-errwarn=%all,no%badargtype2w,no%wbadinit,no%wbadasg -errtags"
squid_cv_cc_option_wall="+w"
squid_cv_cc_option_optimize="-fast"
squid_cv_cc_arg_pipe=""
;;
*)
+ squid_cv_cxx_option_werror=""
squid_cv_cc_option_werror=""
squid_cv_cc_option_wall=""
squid_cv_cc_option_optimize="-O"
if test "x$enable_strict_error_checking" != "xno"; then
SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
- SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_option_werror"
+ SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
fi
AC_SUBST(SQUID_CFLAGS)
AC_TYPE_SSIZE_T
AC_TYPE_OFF_T
AC_TYPE_UID_T
+AC_CHECK_TYPE([bool])
#need the defines for PRId64
AC_CHECK_SIZEOF(int64_t)
AC_CHECK_SIZEOF(long)
#define SEND(X) debug("sending '%s' to squid\n",X); printf(X "\n");
#ifdef __GNUC__
#define SEND2(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y);
-#define SEND3(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y);
+#define SEND4(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y);
#else
/* no gcc, no debugging. varargs macros are a gcc extension */
#define SEND2(X,Y) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y);
-#define SEND3(X,Y,Z) debug("sending '" X "' to squid\n",Y,Z); printf(X "\n",Y,Z);
+#define SEND4(X,Y,Z,W) debug("sending '" X "' to squid\n",Y,Z); printf(X "\n",Y,Z);
#endif
const char *authenticate_ntlm_domain = "WORKGROUP";
if (strip_domain_enabled) {
SEND2("AF %s", user);
} else {
- SEND3("AF %s%s%s", domain, (*domain?"\\":""), user);
+ SEND4("AF %s%s%s", domain, (*domain?"\\":""), user);
}
} else {
lc(user);
lc(domain);
- SEND3("NA invalid credentials, user=%s%s%s", domain, (*domain?"\\":""), user);
+ SEND4("NA invalid credentials, user=%s%s%s", domain, (*domain?"\\":""), user);
}
} else {
SEND("BH wrong packet type! user=");
*/
#define SQUID_NO_ALLOC_PROTECT 1
#include "config.h"
+#include "compat/debug.h"
#include "libntlmauth/ntlmauth.h"
#include "libntlmauth/smb.h"
#include "libntlmauth/rfcnb.h"
my_program_name, my_program_name);
}
-int debug_enabled=0;
+/* int debug_enabled=0; defined in libcompat */
void
process_options(int argc, char *argv[])
static void squidaio_queue_request(squidaio_request_t *);
static void squidaio_cleanup_request(squidaio_request_t *);
-static void *squidaio_thread_loop(void *);
+SQUIDCEXTERN void *squidaio_thread_loop(void *);
static void squidaio_do_open(squidaio_request_t *);
static void squidaio_do_read(squidaio_request_t *);
static void squidaio_do_write(squidaio_request_t *);
squidaio_initialised = 0;
}
-static void *
+void *
squidaio_thread_loop(void *ptr)
{
squidaio_thread_t *threadp = (squidaio_thread_t *)ptr;
extern const HttpHeaderStat *dump_stat; /* argh! */
const HttpHeaderStat *dump_stat = NULL;
-static void
+void
httpHeaderFieldStatDumper(StoreEntry * sentry, int idx, double val, double size, int count)
{
const int id = (int) val;
(void) 0;
}
+/* hack needed on SunStudio to avoid linkage convention mismatch */
+static void cxx_xfree(void *ptr)
+{
+ xfree(ptr);
+}
+
/*
* opens a disk file specified by 'path'. This function always
* blocks! There is no callback.
wq->next = NULL;
- wq->free_func = xfree;
+ wq->free_func = cxx_xfree;
do {
q = fdd->write_q;
if (rep) {
if (rep->sline.status != HTTP_OK) {
rep = NULL;
- esiStream->include->fail (esiStream);
+ esiStream->include->includeFail (esiStream);
esiStream->finished = 1;
httpRequestFree (http);
return;
/* XXX when reviewing ESI this is the first place to look */
node->data = NULL;
esiStream->finished = 1;
- esiStream->include->fail (esiStream);
+ esiStream->include->includeFail (esiStream);
return;
};
case STREAM_FAILED:
debugs(86, 1, "ESI subrequest failed transfer");
- esiStream->include->fail (esiStream);
+ esiStream->include->includeFail (esiStream);
esiStream->finished = 1;
httpRequestFree (http);
return;
}
void
-ESIInclude::fail (ESIStreamContext::Pointer stream)
+ESIInclude::includeFail (ESIStreamContext::Pointer stream)
{
subRequestDone (stream, false);
}
ESISegment::Pointer altcontent;
ESIVarState *varState;
char *srcurl, *alturl;
- void fail(ESIStreamContext::Pointer);
+ void includeFail(ESIStreamContext::Pointer);
void finish();
private:
SQUIDCEXTERN void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
SQUIDCEXTERN void netdbPingSite(const char *hostname);
-SQUIDCEXTERN void netdbDump(StoreEntry *);
+void netdbDump(StoreEntry *);
SQUIDCEXTERN void netdbFreeMemory(void);
SQUIDCEXTERN int netdbHostHops(const char *host);
/// \ingroup IPCacheInternal
static dlink_list lru_list;
+// forward-decls
+static void stat_ipcache_get(StoreEntry *);
+
static FREE ipcacheFreeEntry;
#if USE_DNSSERVERS
static HLPCB ipcacheHandleReply;
memFree(p, MEM_64K_BUF);
}
+static void
+cxx_xfree(void * ptr)
+{
+ xfree(ptr);
+}
+
FREE *
memFreeBufFunc(size_t size)
{
default:
memMeterDec(HugeBufCountMeter);
memMeterDel(HugeBufVolumeMeter, size);
- return xfree;
+ return cxx_xfree;
}
}
SQUIDCEXTERN const char *fqdncache_gethostbyaddr(const Ip::Address &, int flags);
SQUIDCEXTERN void fqdncache_init(void);
-SQUIDCEXTERN void fqdnStats(StoreEntry *);
+void fqdnStats(StoreEntry *);
SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *);
SQUIDCEXTERN const char *fqdnFromAddr(const Ip::Address &);
SQUIDCEXTERN int fqdncacheQueueDrain(void);
SQUIDCEXTERN void fqdncacheFreeMemory(void);
SQUIDCEXTERN void fqdncache_restart(void);
-SQUIDCEXTERN void fqdncache_purgelru(void *);
+void fqdncache_purgelru(void *);
SQUIDCEXTERN void fqdncacheAddEntryFromHosts(char *addr, wordlist * hostnames);
class FwdState;
SQUIDCEXTERN void httpHdrCcSetMaxAge(HttpHdrCc * cc, int max_age);
SQUIDCEXTERN void httpHdrCcSetSMaxAge(HttpHdrCc * cc, int s_maxage);
SQUIDCEXTERN void httpHdrCcUpdateStats(const HttpHdrCc * cc, StatHist * hist);
-SQUIDCEXTERN void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count);
+void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count);
/* Http Header Tools */
class HttpHeaderFieldInfo;
SQUIDCEXTERN void httpHeaderCleanModule(void);
/* store report about current header usage and other stats */
-SQUIDCEXTERN void httpHeaderStoreReport(StoreEntry * e);
+void httpHeaderStoreReport(StoreEntry * e);
SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *, int req_or_rep);
SQUIDCEXTERN int httpReqHdrManglersConfigured();
extern void wccp2ConnectionClose(void);
#endif /* USE_WCCPv2 */
+void ipcache_purgelru(void *);
SQUIDCEXTERN void ipcache_nbgethostbyname(const char *name,
IPH * handler,
void *handlerData);
-SQUIDCEXTERN void ipcache_purgelru(void *);
SQUIDCEXTERN const ipcache_addrs *ipcache_gethostbyname(const char *, int flags);
SQUIDCEXTERN void ipcacheInvalidate(const char *);
SQUIDCEXTERN void ipcacheInvalidateNegative(const char *);
SQUIDCEXTERN void ipcache_init(void);
-SQUIDCEXTERN void stat_ipcache_get(StoreEntry *);
SQUIDCEXTERN void ipcacheCycleAddr(const char *name, ipcache_addrs *);
SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, const Ip::Address &);
SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, const Ip::Address &);
SQUIDCEXTERN const char *getMyHostname(void);
SQUIDCEXTERN const char *uniqueHostname(void);
SQUIDCEXTERN void safeunlink(const char *path, int quiet);
-SQUIDCEXTERN void death(int sig);
+void death(int sig);
SQUIDCEXTERN void fatal(const char *message);
SQUIDCEXTERN void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1;
SQUIDCEXTERN void fatal_dump(const char *message);
-SQUIDCEXTERN void sigusr2_handle(int sig);
-SQUIDCEXTERN void sig_child(int sig);
+void sigusr2_handle(int sig);
+void sig_child(int sig);
SQUIDCEXTERN void leave_suid(void);
SQUIDCEXTERN void enter_suid(void);
SQUIDCEXTERN void no_suid(void);
void
HttpReply::setHeaders(http_status status, const char *reason,
- const char *ctype, int64_t clen, time_t lmt, time_t expires)
+ const char *ctype, int64_t clen, time_t lmt, time_t expires_)
{
fatal ("Not implemented");
}
#ifndef _CONFFILE_HH
#define _CONFFILE_HH
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
+#ifndef HAVE_BOOL
+#define HAVE_BOOL
typedef int bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
#ifndef DEFAULT_SQUID_CONF
#ifndef _CONVERT_HH
#define _CONVERT_HH
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
-typedef int bool;
+#ifndef HAVE_BOOL
+#define HAVE_BOOL 1
+typedef char bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
#include <sys/types.h>
#include <sys/socket.h>
#ifndef _COPYOUT_HH
#define _COPYOUT_HH
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
+#ifndef HAVE_BOOL
+#define HAVE_BOOL
typedef int bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
int
assert_copydir( const char* copydir );
char* linebuffer = 0;
size_t buffersize = 16834;
static char* copydir = 0;
-static unsigned debug = 0;
+static unsigned debugFlag = 0;
static unsigned purgeMode = 0;
static bool iamalive = false;
static bool reminder = false;
// if we want to copy out the file, do that first of all.
if ( ::copydir && *copydir && size > 0 )
- copy_out( st.st_size, metasize, ::debug,
+ copy_out( st.st_size, metasize, ::debugFlag,
fn, url, ::copydir, ::envelope );
// do we need to PURGE the file, yes, if purgemode bit#0 was set.
static const size_t addon = sizeof(unsigned char) + sizeof(unsigned int);
bool flag = true;
- if ( debug & 0x01 ) fprintf( stderr, "# [3] %s\n", fn );
+ if ( debugFlag & 0x01 ) fprintf( stderr, "# [3] %s\n", fn );
int fd = open( fn, O_RDONLY );
if ( fd != -1 ) {
if ( read(fd,::linebuffer,::buffersize-1) > 60 ) {
// returns: true, if every subdir && action was successful.
{
struct dirent* entry;
- if ( debug & 0x01 )
+ if ( debugFlag & 0x01 )
fprintf( stderr, "# [2] %s\n", directory );
DIR* dir = opendir( directory );
// warning: this function is once-recursive, no deeper.
{
struct dirent* entry;
- if ( debug & 0x01 )
+ if ( debugFlag & 0x01 )
fprintf( stderr, "# [%d] %s\n", (level ? 1 : 0), dirname );
DIR* dir = opendir( dirname );
break;
case 'd':
- ::debug = strtoul( optarg, 0, 0 );
+ ::debugFlag = strtoul( optarg, 0, 0 );
break;
case 'E':
}
// adjust
- if ( ! isatty(fileno(stdout)) || (::debug & 0x01) ) ::iamalive = false;
+ if ( ! isatty(fileno(stdout)) || (::debugFlag & 0x01) ) ::iamalive = false;
if ( head == 0 ) {
fputs( "There was no regular expression defined. If you intend\n", stderr );
fputs( "to match all possible URLs, use \"-e .\" instead.\n", stderr );
printf( "#\n# Currently active values for %s:\n# %s\n",
::programname, ::RCS_ID );
printf( "# Debug level : " );
- if ( ::debug ) printf( "%#6.4hx", ::debug );
+ if ( ::debugFlag ) printf( "%#6.4hx", ::debugFlag );
else printf( "production level" ); // printf omits 0x prefix for 0!
printf( " + %s mode", ::no_fork ? "linear" : "parallel" );
puts( ::verbose ? " + extra verbosity" : "" );
// try to read squid.conf file to determine all cache_dir locations
CacheDirVector cdv(0);
- if ( readConfigFile( cdv, conffile, debug ? stderr : 0 ) > 0 ) {
+ if ( readConfigFile( cdv, conffile, debugFlag ? stderr : 0 ) > 0 ) {
// there are some valid cache_dir entries.
// unless forking was forbidden by cmdline option,
// for a process for each cache_dir entry to remove files.
return 0;
} else {
// parent mode
- if ( ::debug ) printf( "forked child %d\n", (int) child[i] );
+ if ( ::debugFlag ) printf( "forked child %d\n", (int) child[i] );
}
}
}
for ( size_t i=0; i < cdv.size(); ++i ) {
while ( (temp=waitpid( (pid_t)-1, &status, 0 )) == -1 )
if ( errno == EINTR ) continue;
- if ( ::debug ) printf( "collected child %d\n", (int) temp );
+ if ( ::debugFlag ) printf( "collected child %d\n", (int) temp );
}
delete[] child;
}
#include <signal.h>
#endif
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
+#ifndef HAVE_BOOL
+#define HAVE_BOOL
typedef int bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
#if 1 // so far, all systems I know use void
# define SIGRETTYPE void
#ifndef _SOCKET_HH
#define _SOCKET_HH
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
+#ifndef HAVE_BOOL
+#define HAVE_BOOL
typedef int bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
#include <sys/types.h>
#include <sys/socket.h> // SOMAXCONN
#ifndef _SQUID_TLV_HH
#define _SQUID_TLV_HH
+#if !defined(__cplusplus)
#if defined(__GNUC__) || defined(__GNUG__)
#pragma interface
#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
+#ifndef HAVE_BOOL
+#define HAVE_BOOL
typedef int bool;
#define false 0
#define true 1
#endif
#endif
+#endif /* __cplusplus */
#include <sys/types.h>
#include <netinet/in.h>
STORE_META_VALID,
STORE_META_VARY_HEADERS, // Stores Vary request headers
STORE_META_STD_LFS, // standard metadata in lfs format
- STORE_META_OBJSIZE, // object size, if its known
+ STORE_META_OBJSIZE // object size, if its known
};
// taken from Squid-2.x