/*
* Darren Hardy, hardy@cs.colorado.edu, April 1994
*
- * $Id: util.h,v 1.3 1996/03/19 01:28:48 wessels Exp $
+ * $Id: util.h,v 1.4 1996/03/27 01:46:40 wessels Exp $
*
* ----------------------------------------------------------------------
* Copyright (c) 1994, 1995. All rights reserved.
char *mkhttpdlogtime _PARAMS((time_t *));
extern char *mkrfc850 _PARAMS((time_t *));
+extern time_t parse_rfc850 _PARAMS((char *str));
extern void init_log3 _PARAMS((char *pn, FILE *a, FILE *b));
extern void debug_init();
extern void log_errno2 _PARAMS((char *, int, char *));
-/* $Id: cache_cf.cc,v 1.4 1996/03/26 21:58:41 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <sys/param.h>
-#include <malloc.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "debug.h"
-#include "comm.h"
-#include "cache_cf.h"
-#include "proto.h"
-#include "store.h"
-#include "ttl.h"
-#include "util.h"
+/* $Id: cache_cf.cc,v 1.5 1996/03/27 01:45:54 wessels Exp $ */
+
+#include "squid.h"
+
static struct {
struct {
-/* $Id: cachemgr.cc,v 1.3 1996/02/29 07:23:06 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <time.h>
-#include <netdb.h>
-
-#include "util.h"
+/* $Id: cachemgr.cc,v 1.4 1996/03/27 01:45:56 wessels Exp $ */
+
+#include "squid.h"
static int client_comm_connect();
-/* $Id: client.cc,v 1.3 1996/03/22 17:48:14 wessels Exp $ */
+/* $Id: client.cc,v 1.4 1996/03/27 01:45:56 wessels Exp $ */
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
+#include "squid.h"
#ifndef BUFSIZ
#define BUFSIZ 8192
-/* $Id: comm.cc,v 1.7 1996/03/26 05:16:20 wessels Exp $ */
-
-#include "config.h"
-
-#include <signal.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
+/* $Id: comm.cc,v 1.8 1996/03/27 01:45:57 wessels Exp $ */
-#if HAVE_BSTRING_H
-#include <bstring.h>
-#endif
+#include "squid.h"
-#include "debug.h"
-#include "comm.h"
-#include "ipcache.h"
-#include "cache_cf.h"
-#include "fdstat.h"
-#include "util.h"
/* Block processing new client requests (accepts on ascii port) when we start
* running shy of free file descriptors. For example, under SunOS, we'll keep
extern int theAsciiConnection;
extern int theUdpConnection;
extern int getConnectTimeout();
-extern int fdstat_are_n_free_fd _PARAMS((int));
-extern void fatal_dump _PARAMS((char *));
+
extern int fd_of_first_client _PARAMS((StoreEntry *));
-char *fd_note();
void comm_handler()
{
app_handler();
}
-char *comm_hostname()
-{
- static char host[SQUIDHOSTNAMELEN + 1];
- static int present = 0;
- struct hostent *h = NULL;
-
- /* Get the host name and store it in host to return */
- if (!present) {
- host[0] = '\0';
- if (gethostname(host, SQUIDHOSTNAMELEN) == -1) {
- debug(1, "comm_hostname: gethostname failed: %s\n",
- xstrerror());
- return NULL;
- } else {
- if ((h = ipcache_gethostbyname(host)) != NULL) {
- /* DNS lookup successful */
- /* use the official name from DNS lookup */
- strcpy(host, h->h_name);
- }
- present = 1;
- }
- }
- return host;
-}
-
-char *comm_hostname_direct()
-{
- static char temp_host[SQUIDHOSTNAMELEN + 1];
-
- temp_host[0] = '\0';
- if (gethostname(temp_host, SQUIDHOSTNAMELEN) == -1) {
- debug(1, "comm_hostname_direct: gethostname failed: %s\n",
- xstrerror());
- return NULL;
- } else {
- return temp_host;
- }
-}
-
/* Return the local port associated with fd. */
int comm_port(fd)
int fd;
-/* $Id: debug.cc,v 1.2 1996/02/29 07:23:08 wessels Exp $ */
+/* $Id: debug.cc,v 1.3 1996/03/27 01:45:58 wessels Exp $ */
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#if defined(__STRICT_ANSI__)
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <syslog.h>
-#include <sys/param.h> /* For MAXPATHLEN. */
+#include "squid.h"
-#include "debug.h"
-#include "util.h"
-#include "cache_cf.h"
+extern int getLogfileRotateNumber _PARAMS((void));
static char *_db_modules = 0; /* colon separated list of modules to debug. */
int _db_level = 0;
char *_db_file = __FILE__;
int _db_line = 0;
-extern time_t cached_curtime;
extern char *mkrfc850();
extern int unbuffered_logs; /* main.c */
-/* $Id: disk.cc,v 1.3 1996/03/23 00:01:51 wessels Exp $ */
-
-#include "config.h"
-
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "disk.h"
-#include "fdstat.h"
-#include "cache_cf.h"
-#include "util.h"
-#include "debug.h"
+/* $Id: disk.cc,v 1.4 1996/03/27 01:45:59 wessels Exp $ */
+
+#include "squid.h"
#define DISK_LINE_LEN 1024
#define MAX_FILE_NAME_LEN 256
-/* $Id: dnsserver.cc,v 1.3 1996/02/29 07:23:09 wessels Exp $ */
-
-#include "config.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <signal.h>
-
-#include "util.h"
+/* $Id: dnsserver.cc,v 1.4 1996/03/27 01:46:00 wessels Exp $ */
+
+#include "squid.h"
extern int h_errno;
-/* $Id: errorpage.cc,v 1.2 1996/03/26 21:58:42 wessels Exp $ */
+/* $Id: errorpage.cc,v 1.3 1996/03/27 01:45:55 wessels Exp $ */
-#include "config.h"
-#include <strings.h>
+#include "squid.h"
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "cached_error.h"
-
#define CACHED_ERROR_MSG_P1 "\
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>\n\
""}
};
-static char tmp_error_buf[BUFSIZ];
+/* GLOBAL */
+char tmp_error_buf[BUFSIZ];
+
+/* LOCAL */
static char tbuf[BUFSIZ];
int log_errors = 1;
sprintf(tbuf, CACHED_ERROR_MSG_P3,
ErrorData[type].lng,
SQUID_VERSION,
- comm_hostname());
+ getMyHostname());
strcat(tmp_error_buf, tbuf);
storeAbort(entry, tmp_error_buf);
if (!log_errors)
sprintf(tbuf, CACHED_ERROR_MSG_P3,
ErrorData[type].lng,
SQUID_VERSION,
- comm_hostname());
+ getMyHostname());
if (!log_errors)
return tmp_error_buf;
CacheInfo->log_append(CacheInfo,
-/* $Id: filemap.cc,v 1.4 1996/03/22 17:48:16 wessels Exp $ */
+/* $Id: filemap.cc,v 1.5 1996/03/27 01:46:03 wessels Exp $ */
-#include "config.h"
-#include <stdlib.h>
-
-#include "ansihelp.h"
-#include "filemap.h"
-#include "util.h"
-#include "debug.h"
+#include "squid.h"
/* Number of bits in a long */
#if SIZEOF_LONG == 8
-/* $Id: ftp.cc,v 1.11 1996/03/26 05:17:20 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h> /* for WNOHANG */
-#include <unistd.h>
-#include <errno.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "url.h"
-#include "mime.h"
-#include "fdstat.h"
-#include "cache_cf.h"
-#include "ttl.h"
-#include "util.h"
-#include "icp.h"
-#include "cached_error.h"
+/* $Id: ftp.cc,v 1.12 1996/03/27 01:46:04 wessels Exp $ */
+
+#include "squid.h"
#define FTP_DELETE_GAP (64*1024)
#define READBUFSIZ 4096
int got_marker; /* denotes end of successful request */
} FtpData;
-extern char *tmp_error_buf;
-extern time_t cached_curtime;
-
/* XXX: this does not support FTP on a different port! */
int ftp_url_parser(url, data)
char *url;
strcat(buf, data->password);
strcat(buf, space);
debug(5, "ftpSendRequest: FD %d: buf '%s'\n", fd, buf);
- data->icp_rwd_ptr = icpWrite(fd, buf, strlen(buf), 30, ftpSendComplete, data);
+ data->icp_rwd_ptr = icpWrite(fd, buf, strlen(buf), 30, ftpSendComplete, (caddr_t) data);
}
void ftpConnInProgress(fd, data)
-/* $Id: gopher.cc,v 1.7 1996/03/26 05:17:21 wessels Exp $ */
-
-#include "config.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "url.h"
-#include "mime.h"
-#include "cache_cf.h"
-#include "ttl.h"
-#include "util.h"
-#include "stmem.h"
-#include "ipcache.h"
-#include "icp.h"
-#include "cached_error.h"
+/* $Id: gopher.cc,v 1.8 1996/03/27 01:46:06 wessels Exp $ */
+
+#include "squid.h"
extern char *dns_error_message;
-extern time_t cached_curtime;
-extern char *tmp_error_buf;
/* gopher type code from rfc. Anawat. */
#define GOPHER_FILE '0'
/* This will be called when request write is complete. Schedule read of
* reply. */
-int gopherSendComplete(fd, buf, size, errflag, data)
+void gopherSendComplete(fd, buf, size, errflag, data)
int fd;
char *buf;
int size;
freeGopherData(data);
if (buf)
put_free_4k_page(buf); /* Allocated by gopherSendRequest. */
- return 0;
+ return;
}
/*
* OK. We successfully reach remote site. Start MIME typing
put_free_4k_page(buf); /* Allocated by gopherSendRequest. */
data->icp_page_ptr = NULL;
data->icp_rwd_ptr = NULL;
- return 0;
}
/* This will be called when connect completes. Write request. */
}
debug(5, "gopherSendRequest - fd: %d\n", fd);
- data->icp_rwd_ptr = icpWrite(fd, buf, len, 30, gopherSendComplete, data);
+ data->icp_rwd_ptr = icpWrite(fd,
+ buf,
+ len,
+ 30,
+ gopherSendComplete,
+ (caddr_t) data);
return 0;
}
-/* $Id: http.cc,v 1.9 1996/03/26 05:17:21 wessels Exp $ */
-
-#include "config.h"
-#include <sys/errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "url.h"
-#include "ipcache.h"
-#include "cache_cf.h"
-#include "ttl.h"
-#include "icp.h"
-#include "util.h"
-#include "cached_error.h"
+/* $Id: http.cc,v 1.10 1996/03/27 01:46:08 wessels Exp $ */
+
+#include "squid.h"
#define HTTP_PORT 80
#define HTTP_DELETE_GAP (64*1024)
extern int errno;
extern char *dns_error_message;
-extern time_t cached_curtime;
typedef struct _httpdata {
StoreEntry *entry;
* icpReadWriteData */
} HttpData;
-extern char *tmp_error_buf;
-
char *HTTP_OPS[] =
{"GET", "POST", "HEAD", ""};
xfree(post_buf);
}
debug(6, "httpSendRequest: FD %d: buf '%s'\n", fd, buf);
- data->icp_rwd_ptr = icpWrite(fd, buf, len, 30, httpSendComplete, data);
+ data->icp_rwd_ptr = icpWrite(fd, buf, len, 30, httpSendComplete, (caddr_t) data);
}
void httpConnInProgress(fd, data)
-/* $Id: ipcache.cc,v 1.7 1996/03/22 20:58:11 wessels Exp $ */
-
-#include "config.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <netdb.h>
-#include <memory.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <time.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-
-#include "ansihelp.h" /* goes first */
-#include "debug.h"
-#include "comm.h"
-#include "fdstat.h"
-#include "icp.h"
-#include "cache_cf.h"
-#include "ipcache.h"
-#include "autoconf.h"
-#include "stat.h"
-#include "hash.h"
-#include "disk.h"
-#include "util.h"
-
-struct hostent *gethostbyname();
-int urlcmp _PARAMS((char *s1, char *s2));
+/* $Id: ipcache.cc,v 1.8 1996/03/27 01:46:11 wessels Exp $ */
+
+#include "squid.h"
+
#define MAX_LINELEN (4096)
char ipcache_status_char _PARAMS((ipcache_entry *));
HashID ip_table = 0;
extern int do_dns_test;
-extern time_t cached_curtime;
extern int getMaxFD();
extern int getDnsChildren();
extern void fatal_dump _PARAMS((char *));
-/* $Id: main.cc,v 1.6 1996/03/22 21:13:16 wessels Exp $ */
-
-#include "config.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/param.h>
-#include <sys/resource.h>
-#include <signal.h>
-#include <string.h>
-#include <memory.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "ansihelp.h"
-#include "cache_cf.h"
-#include "debug.h"
-#include "comm.h"
-#include "icp.h"
-#include "stat.h"
-#include "stack.h"
-#include "fdstat.h"
-#include "ipcache.h"
-#include "util.h"
+/* $Id: main.cc,v 1.7 1996/03/27 01:46:12 wessels Exp $ */
+
+#include "squid.h"
+
/* WRITE_PID_FILE - tries to write a cached.pid file on startup */
#ifndef WRITE_PID_FILE
#define WRITE_PID_FILE
#endif
-time_t cached_starttime = (time_t) 0;
-time_t next_cleaning = (time_t) 0;
+time_t cached_starttime = 0;
+time_t next_cleaning = 0;
int theAsciiConnection = -1;
int theBinaryConnection = -1;
int theUdpConnection = -1;
int debug_level = 0;
int catch_signals = 1;
int do_dns_test = 1;
-char *tmp_error_buf = NULL;
char *config_file = NULL;
int vhost_mode = 0;
int unbuffered_logs = 0; /* debug and hierarhcy buffered by default */
-extern time_t cached_curtime;
extern void (*failure_notify) (); /* for error reporting from xmalloc */
-extern int do_mallinfo;
extern void hash_init _PARAMS((int));
extern int disk_init();
extern void stmemInit();
mallopt(M_NLBLKS, 100);
#endif
- /* allocate storage for error messages */
- tmp_error_buf = (char *) xcalloc(1, 8192);
-/*init comm module */
+ /*init comm module */
comm_init();
#ifdef DAEMON
-/* $Id: mime.cc,v 1.3 1996/03/22 17:48:18 wessels Exp $ */
+/* $Id: mime.cc,v 1.4 1996/03/27 01:46:13 wessels Exp $ */
-#include "config.h"
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-
-#include "ansihelp.h" /* goes first */
-#include "debug.h"
-#include "mime.h"
+#include "squid.h"
#include "mime_table.h"
-extern time_t cached_curtime;
-
int mime_refresh_request(mime)
char *mime;
{
-/* $Id: neighbors.cc,v 1.3 1996/02/29 07:23:17 wessels Exp $ */
-
-#include "config.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netdb.h>
-#include <fcntl.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "icp.h"
-#include "proto.h"
-#include "neighbors.h"
-#include "ipcache.h"
-#include "cache_cf.h"
-#include "util.h"
-#include "disk.h"
+/* $Id: neighbors.cc,v 1.4 1996/03/27 01:46:14 wessels Exp $ */
-static neighbors *friends = NULL;
+#include "squid.h"
-extern time_t cached_curtime;
-extern int unbuffered_logs; /* main.c */
-extern char *tmp_error_buf; /* main.c */
-extern int icpUdpSend _PARAMS((int, char *, icp_common_t *, struct sockaddr_in *, icp_opcode));
-extern int getFromOrgSource _PARAMS((int fd, StoreEntry * entry));
-extern int getFromCache _PARAMS((int fd, StoreEntry * entry, edge * e));
-extern int getFromDefaultSource _PARAMS((int fd, StoreEntry * entry));
-extern void fatal_dump _PARAMS((char *));
-extern void fatal _PARAMS((char *));
+static neighbors *friends = NULL;
static struct neighbor_cf *Neighbor_cf = NULL;
for (t = Neighbor_cf; t; t = next) {
next = t->next;
- if (strncmp(t->host, comm_hostname(), SQUIDHOSTNAMELEN) ||
+ if (strncmp(t->host, getMyHostname(), SQUIDHOSTNAMELEN) ||
t->ascii_port != getAsciiPortNum()) {
neighbors_install(t->host, t->type,
t->ascii_port, t->udp_port, t->proxy_only,
-/* $Id: send-announce.cc,v 1.3 1996/02/29 07:23:20 wessels Exp $ */
+/* $Id: send-announce.cc,v 1.4 1996/03/27 01:46:18 wessels Exp $ */
#include "config.h"
#include "util.h"
+
char *databuf = NULL;
int quiet = 0;
int debug = 0;
--- /dev/null
+
+/* $Id: squid.h,v 1.1 1996/03/27 01:46:18 wessels Exp $ */
+
+#include "config.h"
+#include "autoconf.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <bstring.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <malloc.h>
+#include <memory.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <signal.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/errno.h>
+#include <sys/param.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <syslog.h>
+#include <time.h>
+
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#if HAVE_BSTRING_H
+#include <bstring.h>
+#endif
+
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
+
+#if defined(__STRICT_ANSI__)
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128)
+#define SQUIDHOSTNAMELEN 128
+#else
+#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN
+#endif
+
+typedef struct sentry StoreEntry;
+typedef struct mem_hdr *mem_ptr;
+typedef struct _edge edge;
+typedef struct icp_common_s icp_common_t;
+typedef struct _cacheinfo cacheinfo;
+
+/* 32 bit integer compatability hack */
+#if SIZEOF_LONG == 4
+typedef long num32;
+typedef unsigned long u_num32;
+#elif SIZEOF_INT == 4
+typedef int num32;
+typedef unsigned int u_num32;
+#else
+typedef long num32; /* assume that long's are 32bit */
+typedef unsigned long u_num32;
+#endif
+#define NUM32LEN sizeof(num32) /* this should always be 4 */
+
+#include "GNUregex.h"
+#include "ansihelp.h"
+#include "blocklist.h"
+#include "cache_cf.h"
+#include "cached_error.h"
+#include "comm.h"
+#include "debug.h"
+#include "disk.h"
+#include "dynamic_array.h"
+#include "fdstat.h"
+#include "filemap.h"
+#include "hash.h"
+#include "proto.h"
+#include "icp.h"
+#include "icp_lib.h"
+#include "ipcache.h"
+#include "mime.h"
+#include "neighbors.h"
+#include "stack.h"
+#include "stat.h"
+#include "stmem.h"
+#include "store.h"
+#include "tools.h"
+#include "ttl.h"
+#include "url.h"
+#include "storetoString.h"
+#include "util.h"
+
+extern time_t cached_starttime; /* main.c */
+extern time_t next_cleaning; /* main.c */
+extern int debug_level; /* main.c */
+extern int catch_signals; /* main.c */
-/* $Id: stat.cc,v 1.6 1996/02/29 08:08:05 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h> /* for lseek. should be removed later. */
-#include <fcntl.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-#include <malloc.h>
+/* $Id: stat.cc,v 1.7 1996/03/27 01:46:20 wessels Exp $ */
+
+#include "squid.h"
#ifdef _SQUID_HPUX_
#include <sys/syscall.h>
#define getpagesize( ) sysconf(_SC_PAGE_SIZE)
#endif /* _SQUID_HPUX_ */
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "disk.h"
-#include "ipcache.h"
-#include "cache_cf.h"
-#include "hash.h"
-#include "util.h"
-#include "neighbors.h"
-#include "fdstat.h"
-
extern int emulate_httpd_log;
#define MIN_BUFSIZE (4096)
Meta_data meta_data;
unsigned long nconn = 0;
-extern int getMaxFD(), fdstat_biggest_fd();
-extern int RESERVED_FD;
-extern char *mkrfc850();
-extern time_t cached_curtime;
-extern time_t cached_starttime;
-extern time_t next_cleaning;
-extern int httpd_accel_mode;
-extern int debug_level;
-extern int hash_links_allocated;
-extern void stat_ipcache_get _PARAMS((StoreEntry * e, cacheinfo * obj));
-extern int fdstat_are_n_free_fd _PARAMS((int));
-extern int comm_get_fd_timeout _PARAMS((int));
-extern int file_write_lock _PARAMS((int));
-extern void fatal _PARAMS((char *));
-extern void fatal_dump _PARAMS((char *));
-
char *stat_describe();
char *mem_describe();
char *ttl_describe();
-/* $Id: stmem.cc,v 1.2 1996/02/29 07:23:22 wessels Exp $ */
+/* $Id: stmem.cc,v 1.3 1996/03/27 01:46:22 wessels Exp $ */
-#include "config.h"
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
+#include "squid.h"
-#include "stmem.h"
-#include "util.h"
#define min(x,y) ((x)<(y)? (x) : (y))
#define USE_MEMALIGN 0
#endif
-extern int getCacheMemMax();
-extern int empty_stack _PARAMS((Stack * stack));
-extern int full_stack _PARAMS((Stack * stack));
-extern void push _PARAMS((Stack * stack, generic_ptr data));
-extern void init_stack _PARAMS((Stack * stack, int size));
-extern void fatal_dump _PARAMS((char *));
-
void memFree(mem)
mem_ptr mem;
{
push(&sm_stats.free_page_stack, page);
}
-char *
- get_free_8k_page()
+char *get_free_8k_page()
{
char *page = NULL;
-/* $Id: store.cc,v 1.9 1996/03/26 05:19:10 wessels Exp $ */
+/* $Id: store.cc,v 1.10 1996/03/27 01:46:23 wessels Exp $ */
/*
* Here is a summary of the routines which change mem_status and swap_status:
*
*/
-#include "config.h" /* goes first */
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <syslog.h>
-
-#include "ansihelp.h" /* goes secound */
-#include "comm.h"
-#include "proto.h"
-#include "url.h"
-#include "stat.h"
-#include "disk.h"
-#include "store.h"
-#include "cache_cf.h"
-#include "hash.h"
-#include "debug.h"
-#include "dynamic_array.h"
-#include "util.h"
-#include "filemap.h"
-#include "stmem.h"
-#include "mime.h"
-#include "cached_error.h"
-
-extern time_t cached_curtime;
-extern char *storeToString _PARAMS((StoreEntry * e));
-extern int proto_url_to_id _PARAMS((char *url));
-extern int file_write_lock _PARAMS((int));
-extern void fatal_dump _PARAMS((char *));
-extern void fatal _PARAMS((char *));
-extern void death();
-char *tmp_error_buf;
+#include "squid.h" /* goes first */
#define REBUILD_TIMESTAMP_DELTA_MAX 2
#define MAX_SWAP_FILE (1<<21)
#define STORE_BUCKETS (7921)
#define STORE_IN_MEM_BUCKETS (143)
-int urlcmp _PARAMS((char *s1, char *s2));
-int safeunlink _PARAMS((char *, int));
-int swapInError _PARAMS((int fd_unused, StoreEntry * entry));
-int storeSwapInStart _PARAMS((StoreEntry * e));
-int storeCopy _PARAMS((StoreEntry * e, int stateoffset, int maxSize, char *buf, int *size));
-
/* Now, this table is inaccessible to outsider. They have to use a method
* to access a value in internal storage data structure. */
HashID table = 0;
return rm_obj;
}
-int safeunlink(s, quiet)
- char *s;
- int quiet;
-{
- int err;
-
- if ((err = unlink(s)) < 0)
- if (!quiet)
- debug(1, "safeunlink: Couldn't delete %s. %s\n", s, xstrerror());
- return (err);
-}
-
/*
* storeWriteCleanLog
-/* $Id: tools.cc,v 1.5 1996/03/25 21:25:18 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h> /* for sysconf() stuff */
-#include <malloc.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <sys/param.h> /* has NOFILE */
-#include <sys/types.h>
-
-#include "debug.h"
-#include "cache_cf.h"
-#include "autoconf.h"
-
-void death(), deathb(), neighbors_rotate_log(), stat_rotate_log();
-void mail_warranty(), print_warranty(), _db_rotate_log();
+
+/* $Id: tools.cc,v 1.6 1996/03/27 01:46:26 wessels Exp $ */
+
+#include "squid.h"
+
int do_mallinfo = 0; /* don't do mallinfo() unless this gets set */
-int PrintRusage _PARAMS((void (*)(), FILE *));
-
-extern int catch_signals; /* main.c */
-extern int storeWriteCleanLog _PARAMS((void));
-
-/*-------------------------------------------------------------------------
---
--- death, deathb
---
--- Function: These functions catch and report fatal system violations.
---
--- Inputs: None.
---
--- Output: None.
---
--- Comments: None.
---
---------------------------------------------------------------------------*/
-void death()
-{
- fprintf(stderr, "FATAL: Received Segment Violation...dying.\n");
- signal(SIGSEGV, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- storeWriteCleanLog();
- PrintRusage(NULL, stderr);
- print_warranty();
- abort();
-}
+static int PrintRusage _PARAMS((void (*)(), FILE *));
-void deathb()
-{
- fprintf(stderr, "FATAL: Received bus error...dying.\n");
- signal(SIGSEGV, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- storeWriteCleanLog();
- PrintRusage(NULL, stderr);
- print_warranty();
- abort();
-}
+extern int gethostname _PARAMS((char *name, int namelen));
#define DEAD_MSG "\
The Harvest Cache (version %s) died.\n\
puts(dead_msg());
}
+void death()
+{
+ fprintf(stderr, "FATAL: Received Segment Violation...dying.\n");
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ storeWriteCleanLog();
+ PrintRusage(NULL, stderr);
+ print_warranty();
+ abort();
+}
+
+
+void deathb()
+{
+ fprintf(stderr, "FATAL: Received bus error...dying.\n");
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ storeWriteCleanLog();
+ PrintRusage(NULL, stderr);
+ print_warranty();
+ abort();
+}
+
void rotate_logs(sig)
int sig;
{
}
return (i);
}
+
+char *getMyHostname()
+{
+ static char host[SQUIDHOSTNAMELEN + 1];
+ static int present = 0;
+ struct hostent *h = NULL;
+
+ /* Get the host name and store it in host to return */
+ if (!present) {
+ host[0] = '\0';
+ if (gethostname(host, SQUIDHOSTNAMELEN) == -1) {
+ debug(1, "comm_hostname: gethostname failed: %s\n",
+ xstrerror());
+ return NULL;
+ } else {
+ if ((h = ipcache_gethostbyname(host)) != NULL) {
+ /* DNS lookup successful */
+ /* use the official name from DNS lookup */
+ strcpy(host, h->h_name);
+ }
+ present = 1;
+ }
+ }
+ return host;
+}
+
+int safeunlink(s, quiet)
+ char *s;
+ int quiet;
+{
+ int err;
+ if ((err = unlink(s)) < 0)
+ if (!quiet)
+ debug(1, "safeunlink: Couldn't delete %s. %s\n", s, xstrerror());
+ return (err);
+}
-/* $Id: url.cc,v 1.2 1996/02/29 07:23:25 wessels Exp $ */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "debug.h"
-#include "comm.h"
-#include "proto.h"
-#include "store.h" /* for the_url() */
-#include "url.h"
-#include "util.h"
+/* $Id: url.cc,v 1.3 1996/03/27 01:46:28 wessels Exp $ */
+
+#include "squid.h"
int url_acceptable[256];
-/* $Id: wais.cc,v 1.8 1996/03/26 05:17:22 wessels Exp $ */
+/* $Id: wais.cc,v 1.9 1996/03/27 01:46:29 wessels Exp $ */
+
+#include "squid.h"
-#include "config.h"
#if USE_WAIS_RELAY
-#include <sys/errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ansihelp.h"
-#include "comm.h"
-#include "store.h"
-#include "stat.h"
-#include "neighbors.h"
-#include "url.h"
-#include "ipcache.h"
-#include "cache_cf.h"
-#include "util.h"
-#include "cached_error.h"
#define WAIS_DELETE_GAP (64*1024)
char request[MAX_URL];
} WAISData;
-extern char *tmp_error_buf;
extern char *dns_error_message;
-extern time_t cached_curtime;
int wais_url_parser(url, host, port, request)
char *url;
(PF) waisSendRequest, (caddr_t) data);
return COMM_OK;
}
+#else
+int waisStart(unusedfd, url, type, mime_hdr, entry)
+ int unusedfd;
+ char *url;
+ char *type;
+ char *mime_hdr;
+ StoreEntry *entry;
+{
+ return 1;
+}
#endif