]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
MAJOR #include REWRITE; ack!
authorwessels <>
Wed, 27 Mar 1996 08:45:54 +0000 (08:45 +0000)
committerwessels <>
Wed, 27 Mar 1996 08:45:54 +0000 (08:45 +0000)
25 files changed:
include/util.h
src/cache_cf.cc
src/cachemgr.cc
src/client.cc
src/comm.cc
src/debug.cc
src/disk.cc
src/dnsserver.cc
src/errorpage.cc
src/filemap.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/ipcache.cc
src/main.cc
src/mime.cc
src/neighbors.cc
src/send-announce.cc
src/squid.h [new file with mode: 0644]
src/stat.cc
src/stmem.cc
src/store.cc
src/tools.cc
src/url.cc
src/wais.cc

index c8d0802dce3342ff2bdb6572aac385aa625644e4..12368c54a247aaaa8a2e6d6b66cbe43fbb77ccbe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  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.
@@ -180,6 +180,7 @@ void  dump_host_cache _PARAMS((int, int));
 
 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 *));
index 0624fff92844b56c9f5ae1bc3a3017a9a39b78b3..e736ff257a99c73d9ecaa495d7dc9103834a8124 100644 (file)
@@ -1,25 +1,7 @@
-/* $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 {
index ce823af0ea558276f6a4b59da9b47a13afd59ba8..78c3140d7a80f5be0095ce94523e331488b517e6 100644 (file)
@@ -1,19 +1,6 @@
-/* $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();
 
index 92a3285efae3b5fb7a76df530d7a8d141707c021..7b81eecd822b1690717a9e9f876b9fb55204990f 100644 (file)
@@ -1,17 +1,7 @@
 
-/* $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
index dcc378272a0e8e055e3f4f1a7e7e5a45656eb15c..e7c0e94b54401a7265eb82b52dd174177841fbff 100644 (file)
@@ -1,32 +1,8 @@
 
-/* $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
@@ -61,10 +37,8 @@ extern int getMaxFD();
 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()
 {
@@ -73,45 +47,6 @@ 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;
index 69f17570d5c85bd55f366b30f85eb45f08fd0f63..504c2a44e2db4328fdaffa7a642ca5ccaf159e63 100644 (file)
@@ -1,28 +1,14 @@
-/* $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 */
 
index c917ff7c157413376d2a824419b601b8207e27f1..720ab5bb60687d49bcee6c9957e4c378f8fd5408 100644 (file)
@@ -1,25 +1,6 @@
-/* $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
index 881800a368285769379c10c0401e2e4def5d14dd..9a46346183d07580364606c393aa8527522a9c55 100644 (file)
@@ -1,22 +1,6 @@
-/* $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;
 
index 8c023ff59090890973c7a80298116658bc80613d..d70a7d074acaf64932368f3251f1a476f0e8442c 100644 (file)
@@ -1,15 +1,8 @@
-/* $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\
@@ -99,7 +92,10 @@ error_data ErrorData[] =
        ""}
 };
 
-static char tmp_error_buf[BUFSIZ];
+/* GLOBAL */
+char tmp_error_buf[BUFSIZ];
+
+/* LOCAL */
 static char tbuf[BUFSIZ];
 
 int log_errors = 1;
@@ -124,7 +120,7 @@ void cached_error_entry(entry, type, msg)
     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)
@@ -160,7 +156,7 @@ char *cached_error_url(url, type, msg)
     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,
index 012d1cd081392c54cf829ec69a4efc619eeaf4fd..8321a24da3ef4d77a6a5ab62b877531e5cbfd2f1 100644 (file)
@@ -1,12 +1,6 @@
-/* $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
index 97937238ceb37e37237de86897c651f9b3dc630d..84edf0e765051462cb60de4fcfb5f118e327d98d 100644 (file)
@@ -1,28 +1,6 @@
-/* $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
@@ -51,9 +29,6 @@ typedef struct _Ftpdata {
     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;
@@ -370,7 +345,7 @@ void ftpSendRequest(fd, data)
     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)
index 3e59ea065e938efb6b86993d1ab57ed7d4142aee..3b6d4c00188391cf457ee61c42118f3ff1dd4a69 100644 (file)
@@ -1,29 +1,8 @@
-/* $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'
@@ -736,7 +715,7 @@ int gopherReadReply(fd, data)
 
 /* 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;
@@ -753,7 +732,7 @@ int gopherSendComplete(fd, buf, size, errflag, data)
        freeGopherData(data);
        if (buf)
            put_free_4k_page(buf);      /* Allocated by gopherSendRequest. */
-       return 0;
+       return;
     }
     /* 
      * OK. We successfully reach remote site.  Start MIME typing
@@ -808,7 +787,6 @@ int gopherSendComplete(fd, buf, size, errflag, data)
        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. */
@@ -841,7 +819,12 @@ int gopherSendRequest(fd, data)
     }
 
     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;
 }
 
index 2c95740ff05210458a06324c5898add74554245d..25ad126cd247b908b833a0120e92051a6aa2d24a 100644 (file)
@@ -1,22 +1,6 @@
-/* $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)
@@ -24,7 +8,6 @@
 
 extern int errno;
 extern char *dns_error_message;
-extern time_t cached_curtime;
 
 typedef struct _httpdata {
     StoreEntry *entry;
@@ -42,8 +25,6 @@ typedef struct _httpdata {
                                 * icpReadWriteData */
 } HttpData;
 
-extern char *tmp_error_buf;
-
 char *HTTP_OPS[] =
 {"GET", "POST", "HEAD", ""};
 
@@ -366,7 +347,7 @@ void httpSendRequest(fd, data)
        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)
index e1d58951f98c438a8222577f63841d2de756699d..3a1e1440daf8e8d1dd2fb5e1a2d660073bd09cf2 100644 (file)
@@ -1,37 +1,7 @@
-/* $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 *));
@@ -104,7 +74,6 @@ char *dns_error_message = NULL;      /* possible error message */
 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 *));
index 7129ac853b6e6555cfccc749f67131cfde757d8f..fa3b364791ce5013304bffcabe96589a78a560cf 100644 (file)
@@ -1,38 +1,15 @@
-/* $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;
@@ -40,14 +17,11 @@ int do_reuse = 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();
@@ -130,9 +104,7 @@ int main(argc, argv)
     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
index 084a1beb54af424e38edcd43fc26208ec2e287c0..8641cb4d3d0eb7a981264f6e9d0235e5beb77338 100644 (file)
@@ -1,18 +1,9 @@
 
-/* $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;
 {
index 04eefec71185b681b98b553c01112013cdebfdcf..5ab3b75ce0e279527e75b6890195c4650d5e104c 100644 (file)
@@ -1,37 +1,8 @@
-/* $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;
 
@@ -709,7 +680,7 @@ void neighbors_init()
 
     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,
index 9f40deffd0a5c8afdcd8469cac3f88f499334e76..fce028b2b0def3362dbfe4d937dc16e34d53d8d0 100644 (file)
@@ -1,4 +1,4 @@
-/* $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"
 
@@ -14,6 +14,7 @@
 
 #include "util.h"
 
+
 char *databuf = NULL;
 int quiet = 0;
 int debug = 0;
diff --git a/src/squid.h b/src/squid.h
new file mode 100644 (file)
index 0000000..036c4e5
--- /dev/null
@@ -0,0 +1,112 @@
+
+/* $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 */
index c7c57fd844b9bdbf7b7608d362fb96ac3706ed6d..f8bb8747938734fe8a644a5aa046d95ce29ae5b8 100644 (file)
@@ -1,16 +1,6 @@
-/* $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>
@@ -18,17 +8,6 @@
 #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)
@@ -48,22 +27,6 @@ typedef struct _cached_read_data_t {
 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();
index 010be15c60c9b4f4f8d0c5fdf33acd0db7701215..fe8e09ace45af945cc3abf0ac61412aef86698fd 100644 (file)
@@ -1,12 +1,7 @@
-/* $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))
 
@@ -14,13 +9,6 @@
 #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;
 {
@@ -328,8 +316,7 @@ void put_free_4k_page(page)
     push(&sm_stats.free_page_stack, page);
 }
 
-char *
-     get_free_8k_page()
+char *get_free_8k_page()
 {
     char *page = NULL;
 
index 36d53a148efddb167fd248985d4d28f86e038f5e..19dd19184cd7b1a319f0b9b673ee29dc941918b2 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $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)
@@ -80,12 +43,6 @@ char *tmp_error_buf;
 #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;
@@ -2453,18 +2410,6 @@ int storeMaintainSwapSpace()
     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
index 6c225dc13eb1aa8b780044aba25e12fa886f7eef..336c404c198269e307e82de7c841d2317e3817ae 100644 (file)
@@ -1,67 +1,13 @@
-/* $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\
@@ -109,6 +55,30 @@ void print_warranty()
        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;
 {
@@ -299,3 +269,39 @@ int getMaxFD()
     }
     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);
+}
index a583b02480265e296dfb51b7d6b8b0d2b8ba75ff..9c833c26ce343c1b478cd6106ea5e3c77218b38d 100644 (file)
@@ -1,16 +1,6 @@
-/* $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];
index 5bbb8078b2e4ebdbbcd7085c640d4f45414e0c93..9f80465ee97617ed7417c3645f4c240be83a545f 100644 (file)
@@ -1,21 +1,8 @@
-/* $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)
 
@@ -29,9 +16,7 @@ typedef struct _waisdata {
     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;
@@ -290,4 +275,14 @@ int waisStart(unusedfd, url, type, mime_hdr, entry)
        (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