]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed all the get*() turds, now use Config structure directly.
authorwessels <>
Thu, 25 Jul 1996 13:10:27 +0000 (13:10 +0000)
committerwessels <>
Thu, 25 Jul 1996 13:10:27 +0000 (13:10 +0000)
26 files changed:
src/cache_cf.cc
src/cachemgr.cc
src/client_side.cc
src/comm.cc
src/debug.cc
src/dns.cc
src/dnsserver.cc
src/errorpage.cc
src/fqdncache.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/ident.cc
src/ipcache.cc
src/main.cc
src/neighbors.cc
src/redirect.cc
src/send-announce.cc
src/squid.h
src/ssl.cc
src/stat.cc
src/stmem.cc
src/store.cc
src/tools.cc
src/tunnel.cc
src/wais.cc

index b7697eb948dce31598ca4ce9c40c00fa51a82d4d..19bdd04b1cff37e1d79dbfab4f8ffea1d519a9ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.63 1996/07/25 05:45:12 wessels Exp $
+ * $Id: cache_cf.cc,v 1.64 1996/07/25 07:10:27 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
 
 #include "squid.h"
 
-static struct {
-    struct {
-       int maxSize;
-       int highWaterMark;
-       int lowWaterMark;
-    } Mem , Swap;
-    struct {
-       int maxObjSize;
-       int defaultTtl;
-    } Gopher, Http, Ftp;
-    struct {
-       int maxObjSize;
-       int defaultTtl;
-       char *relayHost;
-       u_short relayPort;
-    } Wais;
-    int negativeTtl;
-    int negativeDnsTtl;
-    int positiveDnsTtl;
-    int readTimeout;
-    int lifetimeDefault;
-    int lifetimeShutdown;
-    int connectTimeout;
-    int ageMaxDefault;
-    int cleanRate;
-    int maxRequestSize;
-    double hotVmFactor;
-    struct {
-       u_short http;
-       u_short icp;
-    } Port;
-    struct {
-       char *log;
-       char *access;
-       char *hierarchy;
-       char *store;
-       int rotateNumber;
-       int log_fqdn;
-    } Log;
-    char *adminEmail;
-    char *effectiveUser;
-    char *effectiveGroup;
-    struct {
-       char *ftpget;
-       char *ftpget_opts;
-       char *dnsserver;
-       char *redirect;
-    } Program;
-    int dnsChildren;
-    int redirectChildren;
-    int sourcePing;
-    int quickAbort;
-    int commonLogFormat;
-    int identLookup;
-    int neighborTimeout;
-    int stallDelay;
-    int singleParentBypass;
-    struct {
-       char *host;
-       char *prefix;
-       u_short port;
-       int withProxy;
-    } Accel;
-    char *appendDomain;
-    char *debugOptions;
-    char *pidFilename;
-    char *visibleHostname;
-    char *ftpUser;
-    struct {
-       char *host;
-       u_short port;
-       char *file;
-       int rate;
-    } Announce;
-    struct {
-       struct in_addr tcp_incoming;
-       struct in_addr tcp_outgoing;
-       struct in_addr udp_incoming;
-       struct in_addr udp_outgoing;
-       struct in_addr client_netmask;
-    } Addrs;
-    int tcpRcvBufsz;
-    wordlist *cache_dirs;
-    wordlist *http_stoplist;
-    wordlist *gopher_stoplist;
-    wordlist *ftp_stoplist;
-    wordlist *hierarchy_stoplist;
-    wordlist *local_domain_list;
-    wordlist *inside_firewall_list;
-    wordlist *dns_testname_list;
-} Config;
+struct SquidConfig Config;
 
 #define DefaultMemMaxSize      (16 << 20)      /* 16 MB */
 #define DefaultMemHighWaterMark 90     /* 90% */
@@ -272,16 +182,7 @@ static struct {
 #define DefaultUdpOutgoingAddr INADDR_NONE
 #define DefaultClientNetmask   0xFFFFFFFF;
 
-ip_acl *local_ip_list = NULL;
-ip_acl *firewall_ip_list = NULL;
-
-int zap_disk_store = 0;                /* off, try to rebuild from disk */
 int httpd_accel_mode = 0;      /* for fast access */
-int emulate_httpd_log = DefaultCommonLogFormat;                /* for fast access */
-int identLookup = DefaultIdentLookup;  /* for fast access */
-time_t neighbor_timeout = DefaultNeighborTimeout;      /* for fast access */
-int single_parent_bypass = 0;
-int DnsPositiveTtl = DefaultPositiveDnsTtl;
 char *DefaultSwapDir = DEFAULT_SWAP_DIR;
 char *DefaultConfigFile = DEFAULT_CONFIG_FILE;
 char *ConfigFile = NULL;       /* the whole thing */
@@ -1088,7 +989,7 @@ static void parseAnnounceToLine()
 }
 
 static void parseIntegerValue(iptr)
-       int *iptr;
+     int *iptr;
 {
     char *token;
     int i;
@@ -1333,10 +1234,10 @@ int parseConfigFile(file_name)
            parseWAISRelayLine();
 
        else if (!strcmp(token, "local_ip"))
-           parseIPLine(&local_ip_list);
+           parseIPLine(&Config.local_ip_list);
 
        else if (!strcmp(token, "firewall_ip"))
-           parseIPLine(&firewall_ip_list);
+           parseIPLine(&Config.firewall_ip_list);
 
        /* Parse a local_domain line */
        else if (!strcmp(token, "local_domain"))
@@ -1413,48 +1314,48 @@ int parseConfigFile(file_name)
     }
 
     /* Sanity checks */
-    if (getClientLifetime() < getReadTimeout()) {
+    if (Config.lifetimeDefault < Config.readTimeout) {
        printf("WARNING: client_lifetime (%d seconds) is less than read_timeout (%d seconds).\n",
-           getClientLifetime(), getReadTimeout());
+           Config.lifetimeDefault, Config.readTimeout);
        printf("         This may cause serious problems with your cache!!!\n");
        printf("         Change your configuration file.\n");
        fflush(stdout);         /* print message */
     }
-    if (getCacheSwapMax() < (getCacheMemMax() >> 10)) {
-       printf("WARNING: cache_swap (%d kbytes) is less than cache_mem (%d bytes).\n", getCacheSwapMax(), getCacheMemMax());
+    if (Config.Swap.maxSize < (Config.Mem.maxSize >> 10)) {
+       printf("WARNING: cache_swap (%d kbytes) is less than cache_mem (%d bytes).\n", Config.Swap.maxSize, Config.Mem.maxSize);
        printf("         This will cause serious problems with your cache!!!\n");
        printf("         Change your configuration file.\n");
-       Config.Swap.maxSize = getCacheMemMax() >> 10;
-       printf("         For this run, however, %s will use %d kbytes for cache_swap.\n", appname, getCacheSwapMax());
+       Config.Swap.maxSize = Config.Mem.maxSize >> 10;
+       printf("         For this run, however, %s will use %d kbytes for cache_swap.\n", appname, Config.Swap.maxSize);
        fflush(stdout);         /* print message */
     }
-    if (getCleanRate() > -1 && getCleanRate() < 60) {
+    if (Config.cleanRate > -1 && Config.cleanRate < 60) {
        Config.cleanRate = (30 * 60);
        printf("WARNING: clean_rate is less than one minute.\n");
        printf("         This will cause serious problems with your cache!!!\n");
        printf("         Change your configuration file.\n");
-       printf("         For this run, however, %s will use %d minutes for clean_rate.\n", appname, (int) (getCleanRate() / 60));
+       printf("         For this run, however, %s will use %d minutes for clean_rate.\n", appname, (int) (Config.cleanRate / 60));
        fflush(stdout);         /* print message */
     }
-    if (getDnsChildren() < 1) {
+    if (Config.dnsChildren < 1) {
        printf("WARNING: dns_children was set to a bad value: %d\n",
-           getDnsChildren());
+           Config.dnsChildren);
        Config.dnsChildren = DefaultDnsChildren;
        printf("Setting it to the default (%d).\n", DefaultDnsChildren);
-    } else if (getDnsChildren() > DefaultDnsChildrenMax) {
+    } else if (Config.dnsChildren > DefaultDnsChildrenMax) {
        printf("WARNING: dns_children was set to a bad value: %d\n",
-           getDnsChildren());
+           Config.dnsChildren);
        printf("Setting it to the maximum (%d).\n", DefaultDnsChildrenMax);
        Config.dnsChildren = DefaultDnsChildrenMax;
     }
-    if (getRedirectChildren() < 1) {
+    if (Config.redirectChildren < 1) {
        printf("WARNING: redirect_children was set to a bad value: %d\n",
-           getRedirectChildren());
+           Config.redirectChildren);
        Config.redirectChildren = DefaultRedirectChildren;
        printf("Setting it to the default (%d).\n", DefaultRedirectChildren);
-    } else if (getRedirectChildren() > DefaultRedirectChildrenMax) {
+    } else if (Config.redirectChildren > DefaultRedirectChildrenMax) {
        printf("WARNING: redirect_children was set to a bad value: %d\n",
-           getRedirectChildren());
+           Config.redirectChildren);
        printf("Setting it to the maximum (%d).\n", DefaultRedirectChildrenMax);
        Config.redirectChildren = DefaultRedirectChildrenMax;
     }
@@ -1464,291 +1365,12 @@ int parseConfigFile(file_name)
     return 0;
 }
 
-
-
-int getHttpMax()
-{
-    return Config.Http.maxObjSize;
-}
-int getHttpTTL()
-{
-    return Config.Http.defaultTtl;
-}
-int getGopherMax()
-{
-    return Config.Gopher.maxObjSize;
-}
-int getGopherTTL()
-{
-    return Config.Gopher.defaultTtl;
-}
-int getWAISMax()
-{
-    return Config.Wais.maxObjSize;
-}
-char *getWaisRelayHost()
-{
-    return Config.Wais.relayHost;
-}
-u_short getWaisRelayPort()
-{
-    return Config.Wais.relayPort;
-}
-int getFtpMax()
-{
-    return Config.Ftp.maxObjSize;
-}
-int getFtpTTL()
-{
-    return Config.Ftp.defaultTtl;
-}
-int getNegativeTTL()
-{
-    return Config.negativeTtl;
-}
-int getNegativeDNSTTL()
-{
-    return Config.negativeDnsTtl;
-}
-int getCacheMemMax()
-{
-    return Config.Mem.maxSize;
-}
-int getCacheMemHighWaterMark()
-{
-    return Config.Mem.highWaterMark;
-}
-int getCacheMemLowWaterMark()
-{
-    return Config.Mem.lowWaterMark;
-}
-double getCacheHotVmFactor()
-{
-    return Config.hotVmFactor;
-}
-int getCacheSwapHighWaterMark()
-{
-    return Config.Swap.highWaterMark;
-}
-int getCacheSwapLowWaterMark()
-{
-    return Config.Swap.lowWaterMark;
-}
-int getCacheSwapMax()
-{
-    return Config.Swap.maxSize;
-}
 int setCacheSwapMax(size)
      int size;
 {
     Config.Swap.maxSize = size;
     return Config.Swap.maxSize;
 }
-int getReadTimeout()
-{
-    return Config.readTimeout;
-}
-int getClientLifetime()
-{
-    return Config.lifetimeDefault;
-}
-int getShutdownLifetime()
-{
-    return Config.lifetimeShutdown;
-}
-int getMaxRequestSize()
-{
-    return Config.maxRequestSize;
-}
-int getConnectTimeout()
-{
-    return Config.connectTimeout;
-}
-int getCleanRate()
-{
-    return Config.cleanRate;
-}
-int getSourcePing()
-{
-    return Config.sourcePing;
-}
-int getDnsChildren()
-{
-    return Config.dnsChildren;
-}
-int getRedirectChildren()
-{
-    return Config.redirectChildren;
-}
-int getQuickAbort()
-{
-    return Config.quickAbort;
-}
-char *getAccelPrefix()
-{
-    return Config.Accel.prefix;
-}
-u_short getAccelPort()
-{
-    return Config.Accel.port;
-}
-int getAccelWithProxy()
-{
-    return Config.Accel.withProxy;
-}
-char *getAccessLogFile()
-{
-    return Config.Log.access;
-}
-char *getHierarchyLogFile()
-{
-    return Config.Log.hierarchy;
-}
-char *getStoreLogFile()
-{
-    return Config.Log.store;
-}
-int getLogfileRotateNumber()
-{
-    return Config.Log.rotateNumber;
-}
-char *getCacheLogFile()
-{
-    return Config.Log.log;
-}
-u_short getHttpPortNum()
-{
-    return Config.Port.http;
-}
-u_short getIcpPortNum()
-{
-    return Config.Port.icp;
-}
-char *getDnsProgram()
-{
-    return Config.Program.dnsserver;
-}
-char *getRedirectProgram()
-{
-    return Config.Program.redirect;
-}
-char *getFtpProgram()
-{
-    return Config.Program.ftpget;
-}
-char *getFtpOptions()
-{
-    return Config.Program.ftpget_opts;
-}
-char *getAdminEmail()
-{
-    return Config.adminEmail;
-}
-char *getDebugOptions()
-{
-    return Config.debugOptions;
-}
-int getStallDelay()
-{
-    return Config.stallDelay;
-}
-char *getAppendDomain()
-{
-    return Config.appendDomain;
-}
-char *getEffectiveUser()
-{
-    return Config.effectiveUser;
-}
-char *getEffectiveGroup()
-{
-    return Config.effectiveGroup;
-}
-char *getPidFilename()
-{
-    return Config.pidFilename;
-}
-char *getVisibleHostname()
-{
-    return Config.visibleHostname;
-}
-char *getFtpUser()
-{
-    return Config.ftpUser;
-}
-char *getAnnounceHost()
-{
-    return Config.Announce.host;
-}
-u_short getAnnouncePort()
-{
-    return Config.Announce.port;
-}
-char *getAnnounceFile()
-{
-    return Config.Announce.file;
-}
-int getAnnounceRate()
-{
-    return Config.Announce.rate;
-}
-wordlist *getHttpStoplist()
-{
-    return Config.http_stoplist;
-}
-wordlist *getFtpStoplist()
-{
-    return Config.ftp_stoplist;
-}
-wordlist *getHierarchyStoplist()
-{
-    return Config.hierarchy_stoplist;
-}
-wordlist *getGopherStoplist()
-{
-    return Config.gopher_stoplist;
-}
-wordlist *getLocalDomainList()
-{
-    return Config.local_domain_list;
-}
-wordlist *getCacheDirs()
-{
-    return Config.cache_dirs;
-}
-wordlist *getInsideFirewallList()
-{
-    return Config.inside_firewall_list;
-}
-wordlist *getDnsTestnameList()
-{
-    return Config.dns_testname_list;
-}
-int getTcpRcvBufsz()
-{
-       return Config.tcpRcvBufsz;
-}
-struct in_addr getTcpIncomingAddr()
-{
-    return Config.Addrs.tcp_incoming;
-}
-struct in_addr getTcpOutgoingAddr()
-{
-    return Config.Addrs.tcp_outgoing;
-}
-struct in_addr getUdpIncomingAddr()
-{
-    return Config.Addrs.udp_incoming;
-}
-struct in_addr getUdpOutgoingAddr()
-{
-    return Config.Addrs.udp_outgoing;
-}
-struct in_addr getClientNetmask()
-{
-    return Config.Addrs.client_netmask;
-}
-
 u_short setHttpPortNum(port)
      u_short port;
 {
@@ -1879,15 +1501,8 @@ static void configSetFactoryDefaults()
 static void configDoConfigure()
 {
     httpd_accel_mode = Config.Accel.prefix ? 1 : 0;
-    emulate_httpd_log = Config.commonLogFormat;
-    neighbor_timeout = (time_t) Config.neighborTimeout;
-    single_parent_bypass = Config.singleParentBypass;
-    DnsPositiveTtl = Config.positiveDnsTtl;
     sprintf(ForwardedBy, "Forwarded: by http://%s:%d/",
-       getMyHostname(), getHttpPortNum());
-    do_redirect = getRedirectProgram()? 1 : 0;
-    opt_log_fqdn = Config.Log.log_fqdn;
-
+       getMyHostname(), Config.Port.http);
 
 #if !ALLOW_HOT_CACHE
     if (!httpd_accel_mode || Config.Accel.withProxy) {
index c3986145882a8c731381ede57cf5cb581b96e8b1..1f9f2769f86a7b1bb651e5b9de52b3467905e2e5 100644 (file)
@@ -1,5 +1,6 @@
+
 /*
- * $Id: cachemgr.cc,v 1.12 1996/07/22 17:20:15 wessels Exp $
+ * $Id: cachemgr.cc,v 1.13 1996/07/25 07:10:29 wessels Exp $
  *
  * DEBUG: Section 0     CGI Cache Manager
  * AUTHOR: Harvest Derived
index 46895ec65413a6af6d53b9566f2676f11e601b31..4ae1e034260f2a489c15fb818899b76317f6eab4 100644 (file)
@@ -59,7 +59,7 @@ void clientAccessCheck(icpState, handler)
     }
     ch = icpState->aclChecklist;
     icpState->aclHandler = handler;
-    if (httpd_accel_mode && !getAccelWithProxy() && r->protocol != PROTO_CACHEOBJ) {
+    if (httpd_accel_mode && !Config.Accel.withProxy && r->protocol != PROTO_CACHEOBJ) {
        /* this cache is an httpd accelerator ONLY */
        if (!BIT_TEST(icpState->flags, REQ_ACCEL))
            answer = 0;
index 6b0a32cf5493b3c5bddfbbedef07175de5e975c3..7ded7e0b2ad611e18f0d0bfd3088a13e6d93fa1a 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: comm.cc,v 1.46 1996/07/25 05:45:46 wessels Exp $
+ * $Id: comm.cc,v 1.47 1996/07/25 07:10:30 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -235,7 +235,7 @@ int comm_open(io_type, addr, port, note)
     int new_socket;
     FD_ENTRY *conn = NULL;
     int sock_type = io_type & COMM_DGRAM ? SOCK_DGRAM : SOCK_STREAM;
-    int tcp_rcv_bufsz = getTcpRcvBufsz();
+    int tcp_rcv_bufsz = Config.tcpRcvBufsz;
 
     /* Create socket for accepting new connections. */
     if ((new_socket = socket(AF_INET, sock_type, 0)) < 0) {
@@ -413,11 +413,11 @@ int comm_connect_addr(sock, address)
     conn->remote_port = ntohs(address->sin_port);
     /* set the lifetime for this client */
     if (status == COMM_OK) {
-       lft = comm_set_fd_lifetime(sock, getClientLifetime());
+       lft = comm_set_fd_lifetime(sock, Config.lifetimeDefault);
        debug(5, 10, "comm_connect_addr: FD %d connected to %s:%d, lifetime %d.\n",
            sock, conn->ipaddr, conn->remote_port, lft);
     } else if (status == EINPROGRESS) {
-       lft = comm_set_fd_lifetime(sock, getConnectTimeout());
+       lft = comm_set_fd_lifetime(sock, Config.connectTimeout);
        debug(5, 10, "comm_connect_addr: FD %d connection pending, lifetime %d\n",
            sock, lft);
     }
@@ -968,7 +968,7 @@ static void commSetTcpRcvbuf(fd, size)
 {
     if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size)) < 0)
        debug(5, 1, "commSetTcpRcvbuf: FD %d, SIZE %d: %s\n",
-       fd, size, xstrerror());
+           fd, size, xstrerror());
 }
 
 
index 7dca120f9b4ca2cf9283224c3104d61ce9943769..dd5b7cee4c1a6619d758231f3cb21c482b8525f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: debug.cc,v 1.19 1996/07/18 20:27:00 wessels Exp $
+ * $Id: debug.cc,v 1.20 1996/07/25 07:10:30 wessels Exp $
  *
  * DEBUG: section 0     Debug Routines
  * AUTHOR: Harvest Derived
@@ -262,19 +262,19 @@ void _db_rotate_log()
        return;
 
     /* Rotate numbers 0 through N up one */
-    for (i = getLogfileRotateNumber(); i > 1;) {
+    for (i = Config.Log.rotateNumber; i > 1;) {
        i--;
        sprintf(from, "%s.%d", debug_log_file, i - 1);
        sprintf(to, "%s.%d", debug_log_file, i);
        rename(from, to);
     }
     /* Rotate the current log to .0 */
-    if (getLogfileRotateNumber() > 0) {
+    if (Config.Log.rotateNumber > 0) {
        sprintf(to, "%s.%d", debug_log_file, 0);
        rename(debug_log_file, to);
     }
     /* Close and reopen the log.  It may have been renamed "manually"
      * before HUP'ing us. */
     if (debug_log != stderr)
-       debugOpenLog(getCacheLogFile());
+       debugOpenLog(Config.Log.log);
 }
index 9f7d2caa45bfa6192ea14eacb0e33a0bdae28c44..265d42118957fe1dd5652cd478f98b9c5225ecf6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dns.cc,v 1.1 1996/07/22 16:40:22 wessels Exp $
+ * $Id: dns.cc,v 1.2 1996/07/25 07:10:31 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -192,8 +192,8 @@ dnsserver_t *dnsGetFirstAvailable()
 
 void dnsOpenServers()
 {
-    int N = getDnsChildren();
-    char *prg = getDnsProgram();
+    int N = Config.dnsChildren;
+    char *prg = Config.Program.dnsserver;
     int k;
     int dnssocket;
     LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
index 34f8194237b11b30d62ff6d063abda09a83f91aa..50345bc49fdeb5ce909cb4fcca9d14826f5aa808 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dnsserver.cc,v 1.10 1996/07/25 05:49:14 wessels Exp $
+ * $Id: dnsserver.cc,v 1.11 1996/07/25 07:10:32 wessels Exp $
  *
  * DEBUG: section 0     DNS Resolver
  * AUTHOR: Harvest Derived
@@ -144,7 +144,7 @@ int do_debug = 0;
  * Squid creates UNIX domain sockets named dns.PID.NN, e.g. dns.19215.11
  * 
  * In ipcache_init():
- *       . dnssocket = ipcache_opensocket(getDnsProgram())
+ *       . dnssocket = ipcache_opensocket(Config.Program.dnsserver)
  *       . dns_child_table[i]->inpipe = dnssocket
  *       . dns_child_table[i]->outpipe = dnssocket
  * 
@@ -268,7 +268,7 @@ int main(argc, argv)
 #endif
            addrbuf = inet_addr(request);
            for (;;) {
-               result = gethostbyaddr((char *)&addrbuf, 4, AF_INET);
+               result = gethostbyaddr((char *) &addrbuf, 4, AF_INET);
                if (result || h_errno != TRY_AGAIN)
                    break;
                if (++retry_count == 2)
index 08b9775e580aae54892066604c54c44b5c92051e..c16f7f0a427af5b0ed761b4224e597ab37ccb3ba 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.27 1996/07/19 17:34:08 wessels Exp $
+ * $Id: errorpage.cc,v 1.28 1996/07/25 07:10:32 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -256,7 +256,7 @@ Generated by %s/%s@%s\n\
 \n",
        code,
        url,
-       getAdminEmail(),
+       Config.adminEmail,
        appname,
        version_string,
        getMyHostname());
@@ -281,13 +281,13 @@ Generated by %s/%s@%s\n\
        request->login,
        request->host,
        request->urlpath,
-       getAdminEmail(),
+       Config.adminEmail,
        appname,
        version_string,
        getMyHostname());
 
     mk_mime_hdr(tbuf,
-       (time_t) getNegativeTTL(),
+       (time_t) Config.negativeTtl,
        strlen(auth_msg),
        0,
        "text/html");
index 1ab7d721adf149f9be109a218ce8339abfa1b507..7eb992283d10721f0e5eab42ed275c23fff9adc0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.3 1996/07/25 05:49:15 wessels Exp $
+ * $Id: fqdncache.cc,v 1.4 1996/07/25 07:10:33 wessels Exp $
  *
  * DEBUG: section 34    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -407,11 +407,11 @@ static void fqdncache_add(name, f, hp, cached)
        }
        f->lastref = f->timestamp = squid_curtime;
        f->status = FQDN_CACHED;
-       f->ttl = DnsPositiveTtl;
+       f->ttl = Config.positiveDnsTtl;
     } else {
        f->lastref = f->timestamp = squid_curtime;
        f->status = FQDN_NEGATIVE_CACHED;
-       f->ttl = getNegativeDNSTTL();
+       f->ttl = Config.negativeDnsTtl;
     }
     fqdncache_add_to_hash(f);
 }
@@ -541,7 +541,7 @@ static int fqdncache_parsebuffer(buf, offset, dnsData)
                line_cur = line_head->next;
                f = dnsData->data;
                f->lastref = f->timestamp = squid_curtime;
-               f->ttl = getNegativeDNSTTL();
+               f->ttl = Config.negativeDnsTtl;
                f->status = FQDN_NEGATIVE_CACHED;
                if (line_cur && !strncmp(line_cur->line, "$message", 8))
                    f->error_message = xstrdup(line_cur->line + 8);
@@ -561,7 +561,7 @@ static int fqdncache_parsebuffer(buf, offset, dnsData)
                    debug(34, 0, "fqdncache_parsebuffer: DNS record already resolved.\n");
                } else {
                    f->lastref = f->timestamp = squid_curtime;
-                   f->ttl = DnsPositiveTtl;
+                   f->ttl = Config.positiveDnsTtl;
                    f->status = FQDN_CACHED;
 
                    line_cur = line_head->next;
index 416e1a8575e044e9a8ec8e25d716eab2bed404c2..437d63bbf5ef5e7e8c156fe69d66bde2e90e17c4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.47 1996/07/20 04:22:24 wessels Exp $
+ * $Id: ftp.cc,v 1.48 1996/07/25 07:10:34 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -179,7 +179,7 @@ static void ftp_login_parser(login, data)
 
     if (!*user && !*password) {
        strcpy(user, "anonymous");
-       strcpy(password, getFtpUser());
+       strcpy(password, Config.ftpUser);
     }
 }
 
@@ -189,7 +189,7 @@ int ftpCachable(url)
     wordlist *p = NULL;
 
     /* scan stop list */
-    for (p = getFtpStoplist(); p; p = p->next) {
+    for (p = Config.ftp_stoplist; p; p = p->next) {
        if (strstr(url, p->key))
            return 0;
     }
@@ -283,7 +283,7 @@ static void ftpProcessReplyHeader(data, buf, size)
            break;
        default:
            /* These can be negative cached, make key public */
-           entry->expires = squid_curtime + getNegativeTTL();
+           entry->expires = squid_curtime + Config.negativeTtl;
            if (BIT_TEST(entry->flag, CACHABLE))
                storeSetPublicKey(entry);
            break;
@@ -332,7 +332,7 @@ int ftpReadReply(fd, data)
            (void *) data);
        /* NOTE there is no read timeout handler to disable */
        /* dont try reading again for a while */
-       comm_set_stall(fd, getStallDelay());
+       comm_set_stall(fd, Config.stallDelay);
        return 0;
     }
     errno = 0;
@@ -371,7 +371,7 @@ int ftpReadReply(fd, data)
             * failed and arrange so the object gets ejected and
             * never gets to disk. */
            debug(9, 1, "ftpReadReply: Purging '%s'\n", entry->url);
-           entry->expires = squid_curtime + getNegativeTTL();
+           entry->expires = squid_curtime + Config.negativeTtl;
            BIT_RESET(entry->flag, CACHABLE);
            storeReleaseRequest(entry);
        } else if (!(entry->flag & DELETE_BEHIND)) {
@@ -380,7 +380,7 @@ int ftpReadReply(fd, data)
        /* update fdstat and fdtable */
        storeComplete(entry);
        comm_close(fd);
-    } else if (((entry->mem_obj->e_current_len + len) > getFtpMax()) &&
+    } else if (((entry->mem_obj->e_current_len + len) > Config.Ftp.maxObjSize) &&
        !(entry->flag & DELETE_BEHIND)) {
        /*  accept data, but start to delete behind it */
        storeStartDeleteBehind(entry);
@@ -414,7 +414,7 @@ int ftpReadReply(fd, data)
            COMM_SELECT_TIMEOUT,
            (PF) ftpLifetimeExpire,
            (void *) data,
-           getReadTimeout());
+           Config.readTimeout);
     }
     return 0;
 }
@@ -449,7 +449,7 @@ void ftpSendComplete(fd, buf, size, errflag, data)
        comm_set_select_handler_plus_timeout(ftpState->ftp_fd,
            COMM_SELECT_TIMEOUT,
            (PF) ftpLifetimeExpire,
-           (void *) ftpState, getReadTimeout());
+           (void *) ftpState, Config.readTimeout);
     }
 }
 
@@ -498,10 +498,10 @@ void ftpSendRequest(fd, data)
     mode = ftpTransferMode(path);
 
     /* Start building the buffer ... */
-    strcat(buf, getFtpProgram());
+    strcat(buf, Config.Program.ftpget);
     strcat(buf, space);
 
-    strncpy(opts, getFtpOptions(), BUFSIZ);
+    strncpy(opts, Config.Program.ftpget_opts, BUFSIZ);
     for (s = strtok(opts, w_space); s; s = strtok(NULL, w_space)) {
        strcat(buf, s);
        strcat(buf, space);
@@ -511,18 +511,18 @@ void ftpSendRequest(fd, data)
            got_negttl = 1;
     }
     if (!got_timeout) {
-       sprintf(tbuf, "-t %d ", getReadTimeout());
+       sprintf(tbuf, "-t %d ", Config.readTimeout);
        strcat(buf, tbuf);
     }
     if (!got_negttl) {
-       sprintf(tbuf, "-n %d ", getNegativeTTL());
+       sprintf(tbuf, "-n %d ", Config.negativeTtl);
        strcat(buf, tbuf);
     }
     if (data->request->port) {
        sprintf(tbuf, "-P %d ", data->request->port);
        strcat(buf, tbuf);
     }
-    if ((s = getVisibleHostname())) {
+    if ((s = Config.visibleHostname)) {
        sprintf(tbuf, "-H %s ", s);
        strcat(buf, tbuf);
     }
@@ -680,7 +680,7 @@ int ftpStart(unusedfd, url, request, entry)
        (PF) ftpSendRequest,
        (void *) data);
     comm_set_fd_lifetime(data->ftp_fd,
-       getClientLifetime());
+       Config.lifetimeDefault);
     comm_set_select_handler(data->ftp_fd,
        COMM_SELECT_LIFETIME,
        (PF) ftpLifetimeExpire,
@@ -730,7 +730,7 @@ int ftpInitialize()
     int squid_to_ftpget[2];
     int ftpget_to_squid[2];
     LOCAL_ARRAY(char, pbuf, 128);
-    char *ftpget = getFtpProgram();
+    char *ftpget = Config.Program.ftpget;
     struct sockaddr_in S;
     int len;
 
index cb2b56c59dff8ac7176f42916a365a32940978be..8c04c1d6292beb44ac4368b2498cbe40595de893 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: gopher.cc,v 1.36 1996/07/25 05:47:33 wessels Exp $
+ * $Id: gopher.cc,v 1.37 1996/07/25 07:10:34 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -326,7 +326,7 @@ int gopherCachable(url)
     int cachable = 1;
 
     /* scan stop list */
-    for (p = getGopherStoplist(); p; p = p->next)
+    for (p = Config.gopher_stoplist; p; p = p->next)
        if (strstr(url, p->key))
            return 0;
 
@@ -726,7 +726,7 @@ int gopherReadReply(fd, data)
                    (PF) NULL,
                    (void *) NULL,
                    (time_t) 0);
-               comm_set_stall(fd, getStallDelay());    /* dont try reading again for a while */
+               comm_set_stall(fd, Config.stallDelay);  /* dont try reading again for a while */
                return 0;
            }
        } else {
@@ -749,7 +749,7 @@ int gopherReadReply(fd, data)
            comm_set_select_handler(fd, COMM_SELECT_READ,
                (PF) gopherReadReply, (void *) data);
            comm_set_select_handler_plus_timeout(fd, COMM_SELECT_TIMEOUT,
-               (PF) gopherReadReplyTimeout, (void *) data, getReadTimeout());
+               (PF) gopherReadReplyTimeout, (void *) data, Config.readTimeout);
        } else {
            BIT_RESET(entry->flag, CACHABLE);
            storeReleaseRequest(entry);
@@ -771,7 +771,7 @@ int gopherReadReply(fd, data)
        BIT_RESET(entry->flag, DELAY_SENDING);
        storeComplete(entry);
        comm_close(fd);
-    } else if (((entry->mem_obj->e_current_len + len) > getGopherMax()) &&
+    } else if (((entry->mem_obj->e_current_len + len) > Config.Gopher.maxObjSize) &&
        !(entry->flag & DELETE_BEHIND)) {
        /*  accept data, but start to delete behind it */
        storeStartDeleteBehind(entry);
@@ -789,7 +789,7 @@ int gopherReadReply(fd, data)
            COMM_SELECT_TIMEOUT,
            (PF) gopherReadReplyTimeout,
            (void *) data,
-           getReadTimeout());
+           Config.readTimeout);
     } else if (entry->flag & CLIENT_ABORT_REQUEST) {
        /* append the last bit of info we got */
        if (data->conversion != NORMAL) {
@@ -816,7 +816,7 @@ int gopherReadReply(fd, data)
            COMM_SELECT_TIMEOUT,
            (PF) gopherReadReplyTimeout,
            (void *) data,
-           getReadTimeout());
+           Config.readTimeout);
     }
     put_free_4k_page(buf);
     return 0;
@@ -889,7 +889,7 @@ void gopherSendComplete(fd, buf, size, errflag, data)
        COMM_SELECT_TIMEOUT,
        (PF) gopherReadReplyTimeout,
        (void *) gopherState,
-       getReadTimeout());
+       Config.readTimeout);
     comm_set_fd_lifetime(fd, 86400);   /* extend lifetime */
 
     if (buf)
@@ -954,7 +954,7 @@ int gopherStart(unusedfd, url, entry)
        return COMM_ERROR;
     }
     /* Create socket. */
-    sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (sock == COMM_ERROR) {
        debug(10, 4, "gopherStart: Failed because we're out of sockets.\n");
        squid_error_entry(entry, ERR_NO_FDS, xstrerror());
index 1985f70f6194abae9e3d93d6a0a4a28311845a45..8d96e164cbcee6d5f584c1b25188e5508d05d336 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: http.cc,v 1.65 1996/07/20 04:22:25 wessels Exp $
+ * $Id: http.cc,v 1.66 1996/07/25 07:10:35 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -155,7 +155,7 @@ int httpCachable(url, method)
        return 0;
 
     /* scan stop list */
-    for (p = getHttpStoplist(); p; p = p->next) {
+    for (p = Config.http_stoplist; p; p = p->next) {
        if (strstr(url, p->key))
            return 0;
     }
@@ -216,7 +216,7 @@ static void httpMakePrivate(entry)
 static void httpCacheNegatively(entry)
      StoreEntry *entry;
 {
-    entry->expires = squid_curtime + getNegativeTTL();
+    entry->expires = squid_curtime + Config.negativeTtl;
     if (BIT_TEST(entry->flag, CACHABLE))
        storeSetPublicKey(entry);
     /* XXX: mark object "not to store on disk"? */
@@ -435,7 +435,7 @@ static void httpReadReply(fd, httpState)
            (time_t) 0);
        comm_set_fd_lifetime(fd, 3600);         /* limit during deferring */
        /* dont try reading again for a while */
-       comm_set_stall(fd, getStallDelay());
+       comm_set_stall(fd, Config.stallDelay);
        return;
     }
     errno = 0;
@@ -457,7 +457,7 @@ static void httpReadReply(fd, httpState)
            comm_set_select_handler(fd, COMM_SELECT_READ,
                (PF) httpReadReply, (void *) httpState);
            comm_set_select_handler_plus_timeout(fd, COMM_SELECT_TIMEOUT,
-               (PF) httpReadReplyTimeout, (void *) httpState, getReadTimeout());
+               (PF) httpReadReplyTimeout, (void *) httpState, Config.readTimeout);
        } else {
            BIT_RESET(entry->flag, CACHABLE);
            storeReleaseRequest(entry);
@@ -473,7 +473,7 @@ static void httpReadReply(fd, httpState)
        /* Connection closed; retrieval done. */
        storeComplete(entry);
        comm_close(fd);
-    } else if ((entry->mem_obj->e_current_len + len) > getHttpMax() &&
+    } else if ((entry->mem_obj->e_current_len + len) > Config.Http.maxObjSize &&
        !(entry->flag & DELETE_BEHIND)) {
        /*  accept data, but start to delete behind it */
        storeStartDeleteBehind(entry);
@@ -485,7 +485,7 @@ static void httpReadReply(fd, httpState)
        comm_set_select_handler_plus_timeout(fd,
            COMM_SELECT_TIMEOUT,
            (PF) httpReadReplyTimeout,
-           (void *) httpState, getReadTimeout());
+           (void *) httpState, Config.readTimeout);
     } else if (entry->flag & CLIENT_ABORT_REQUEST) {
        /* append the last bit of info we get */
        storeAppend(entry, buf, len);
@@ -503,7 +503,7 @@ static void httpReadReply(fd, httpState)
            COMM_SELECT_TIMEOUT,
            (PF) httpReadReplyTimeout,
            (void *) httpState,
-           getReadTimeout());
+           Config.readTimeout);
     }
 }
 
@@ -537,7 +537,7 @@ static void httpSendComplete(fd, buf, size, errflag, data)
            COMM_SELECT_TIMEOUT,
            (PF) httpReadReplyTimeout,
            (void *) httpState,
-           getReadTimeout());
+           Config.readTimeout);
        comm_set_fd_lifetime(fd, 86400);        /* extend lifetime */
     }
 }
@@ -687,7 +687,7 @@ int proxyhttpStart(e, url, entry)
        storeStartDeleteBehind(entry);
 
     /* Create socket. */
-    sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (sock == COMM_ERROR) {
        debug(11, 4, "proxyhttpStart: Failed because we're out of sockets.\n");
        squid_error_entry(entry, ERR_NO_FDS, xstrerror());
@@ -779,7 +779,7 @@ int httpStart(unusedfd, url, request, req_hdr, entry)
     debug(11, 10, "httpStart: req_hdr '%s'\n", req_hdr);
 
     /* Create socket. */
-    sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (sock == COMM_ERROR) {
        debug(11, 4, "httpStart: Failed because we're out of sockets.\n");
        squid_error_entry(entry, ERR_NO_FDS, xstrerror());
index 14330c0ffae7c4208f3ccc86450bff4e48c66526..99efb364725a6a8a4a58100bf1b72db0a34d2381 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ident.cc,v 1.6 1996/07/20 03:16:52 wessels Exp $
+ * $Id: ident.cc,v 1.7 1996/07/25 07:10:36 wessels Exp $
  *
  * DEBUG: section 31    Ident (RFC 931)
  * AUTHOR: Duane Wessels
@@ -56,7 +56,7 @@ void identStart(sock, icpState)
     port = ntohs(icpState->peer.sin_port);
 
     if (sock < 0) {
-       sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, "ident");
+       sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, "ident");
        if (sock == COMM_ERROR)
            return;
     }
index 3566615c392c96e98aba9e7d43026c9013d0aa55..a79455413c31a633cb36210b11cd4f93c4fe3953 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ipcache.cc,v 1.37 1996/07/25 05:49:16 wessels Exp $
+ * $Id: ipcache.cc,v 1.38 1996/07/25 07:10:37 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -208,7 +208,7 @@ static int ipcache_testname()
 {
     wordlist *w = NULL;
     debug(14, 1, "Performing DNS Tests...\n");
-    if ((w = getDnsTestnameList()) == NULL)
+    if ((w = Config.dns_testname_list) == NULL)
        return 1;
     for (; w; w = w->next) {
        IpcacheStats.ghbn_calls++;
@@ -456,11 +456,11 @@ static void ipcache_add(name, i, hp, cached)
        i->entry.h_name = xstrdup(hp->h_name);
        i->lastref = i->timestamp = squid_curtime;
        i->status = IP_CACHED;
-       i->ttl = DnsPositiveTtl;
+       i->ttl = Config.positiveDnsTtl;
     } else {
        i->lastref = i->timestamp = squid_curtime;
        i->status = IP_NEGATIVE_CACHED;
-       i->ttl = getNegativeDNSTTL();
+       i->ttl = Config.negativeDnsTtl;
     }
     ipcache_add_to_hash(i);
 }
@@ -590,7 +590,7 @@ static int ipcache_parsebuffer(buf, offset, dnsData)
                line_cur = line_head->next;
                i = dnsData->data;
                i->lastref = i->timestamp = squid_curtime;
-               i->ttl = getNegativeDNSTTL();
+               i->ttl = Config.negativeDnsTtl;
                i->status = IP_NEGATIVE_CACHED;
                if (line_cur && !strncmp(line_cur->line, "$message", 8))
                    i->error_message = xstrdup(line_cur->line + 8);
@@ -610,7 +610,7 @@ static int ipcache_parsebuffer(buf, offset, dnsData)
                    debug(14, 0, "ipcache_parsebuffer: DNS record already resolved.\n");
                } else {
                    i->lastref = i->timestamp = squid_curtime;
-                   i->ttl = DnsPositiveTtl;
+                   i->ttl = Config.positiveDnsTtl;
                    i->status = IP_CACHED;
 
                    line_cur = line_head->next;
index c01efd0338a9289c612fa1beda7b3af745863b08..870682ac24376e6a55a368ea571f84f91fa6ce64 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.54 1996/07/22 17:19:51 wessels Exp $
+ * $Id: main.cc,v 1.55 1996/07/25 07:10:38 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -116,6 +116,7 @@ int opt_reload_hit_only = 0;        /* only UDP_HIT during store relaod */
 int catch_signals = 1;
 int opt_dns_tests = 1;
 int opt_foreground_rebuild = 0;
+int opt_zap_disk_store = 0;
 int vhost_mode = 0;
 int unbuffered_logs = 1;       /* debug and hierarhcy unbuffered by default */
 int shutdown_pending = 0;      /* set by SIGTERM handler (shut_down()) */
@@ -124,7 +125,6 @@ char version_string[] = SQUID_VERSION;
 char appname[] = "squid";
 char localhost[] = "127.0.0.1";
 struct in_addr local_addr;
-int opt_log_fqdn = 1;
 
 /* for error reporting from xmalloc and friends */
 extern void (*failure_notify) _PARAMS((char *));
@@ -225,7 +225,7 @@ static void mainParseOptions(argc, argv)
            exit(0);
            /* NOTREACHED */
        case 'z':
-           zap_disk_store = 1;
+           opt_zap_disk_store = 1;
            break;
        case '?':
        default:
@@ -250,7 +250,7 @@ void reconfigure(sig)
 {
     debug(21, 1, "reconfigure: SIGHUP received\n");
     debug(21, 1, "Waiting %d seconds for active connections to finish\n",
-       getShutdownLifetime());
+       Config.lifetimeShutdown);
     reread_pending = 1;
 #if !HAVE_SIGACTION
     signal(sig, reconfigure);
@@ -263,7 +263,7 @@ void shut_down(sig)
     debug(21, 1, "Preparing for shutdown after %d connections\n",
        ntcpconn + nudpconn);
     debug(21, 1, "Waiting %d seconds for active connections to finish\n",
-       getShutdownLifetime());
+       Config.lifetimeShutdown);
     shutdown_pending = 1;
 }
 
@@ -276,8 +276,8 @@ void serverConnectionsOpen()
     /* Open server ports */
     enter_suid();
     theHttpConnection = comm_open(COMM_NONBLOCKING,
-       getTcpIncomingAddr(),
-       getHttpPortNum(),
+       Config.Addrs.tcp_incoming,
+       Config.Port.http,
        "HTTP Port");
     leave_suid();
     if (theHttpConnection < 0) {
@@ -292,10 +292,10 @@ void serverConnectionsOpen()
     debug(1, 1, "Accepting HTTP connections on FD %d.\n",
        theHttpConnection);
 
-    if (!httpd_accel_mode || getAccelWithProxy()) {
-       if ((port = getIcpPortNum()) > 0) {
+    if (!httpd_accel_mode || Config.Accel.withProxy) {
+       if ((port = Config.Port.icp) > 0) {
            theInIcpConnection = comm_open(COMM_NONBLOCKING | COMM_DGRAM,
-               getUdpIncomingAddr(),
+               Config.Addrs.udp_incoming,
                port,
                "ICP Port");
            if (theInIcpConnection < 0)
@@ -308,7 +308,7 @@ void serverConnectionsOpen()
            debug(1, 1, "Accepting ICP connections on FD %d.\n",
                theInIcpConnection);
 
-           if ((addr = getUdpOutgoingAddr()).s_addr != INADDR_NONE) {
+           if ((addr = Config.Addrs.udp_outgoing).s_addr != INADDR_NONE) {
                theOutIcpConnection = comm_open(COMM_NONBLOCKING | COMM_DGRAM,
                    addr,
                    port,
@@ -371,13 +371,13 @@ static void mainReinitialize()
     neighborsDestroy();
 
     parseConfigFile(ConfigFile);
-    _db_init(getCacheLogFile(), getDebugOptions());
+    _db_init(Config.Log.log, Config.debugOptions);
     neighbors_init();
     dnsOpenServers();
     redirectOpenServers();
     serverConnectionsOpen();
     (void) ftpInitialize();
-    if (theOutIcpConnection >= 0 && (!httpd_accel_mode || getAccelWithProxy()))
+    if (theOutIcpConnection >= 0 && (!httpd_accel_mode || Config.Accel.withProxy))
        neighbors_open(theOutIcpConnection);
     debug(1, 0, "Ready to serve requests.\n");
 }
@@ -411,9 +411,9 @@ static void mainInitialize()
     if (icpPortNumOverride != 1)
        setIcpPortNum((u_short) icpPortNumOverride);
 
-    _db_init(getCacheLogFile(), getDebugOptions());
+    _db_init(Config.Log.log, Config.debugOptions);
     fdstat_open(fileno(debug_log), FD_LOG);
-    fd_note(fileno(debug_log), getCacheLogFile());
+    fd_note(fileno(debug_log), Config.Log.log);
 
     debug(1, 0, "Starting Squid Cache version %s for %s...\n",
        version_string,
@@ -440,10 +440,10 @@ static void mainInitialize()
        first_time = 0;
        /* module initialization */
        urlInitialize();
-       stat_init(&CacheInfo, getAccessLogFile());
+       stat_init(&CacheInfo, Config.Log.access);
        storeInit();
 
-       if (getEffectiveUser()) {
+       if (Config.effectiveUser) {
            /* we were probably started as root, so cd to a swap
             * directory in case we dump core */
            if (chdir(swappath(0)) < 0) {
@@ -455,7 +455,7 @@ static void mainInitialize()
        do_mallinfo = 1;
     }
     serverConnectionsOpen();
-    if (theOutIcpConnection >= 0 && (!httpd_accel_mode || getAccelWithProxy()))
+    if (theOutIcpConnection >= 0 && (!httpd_accel_mode || Config.Accel.withProxy))
        neighbors_open(theOutIcpConnection);
 
     squid_signal(SIGUSR1, rotate_logs, SA_RESTART);
@@ -531,8 +531,8 @@ int main(argc, argv)
     mainInitialize();
 
     /* main loop */
-    if (getCleanRate() > 0)
-       next_cleaning = time(NULL) + getCleanRate();
+    if (Config.cleanRate > 0)
+       next_cleaning = time(NULL) + Config.cleanRate;
     for (;;) {
        loop_delay = (time_t) 10;
        /* maintain cache storage */
@@ -564,13 +564,13 @@ int main(argc, argv)
                fatal_dump("Select Loop failed!");
            break;
        case COMM_TIMEOUT:
-           if (getCleanRate() > 0 && squid_curtime >= next_cleaning) {
+           if (Config.cleanRate > 0 && squid_curtime >= next_cleaning) {
                debug(1, 1, "Performing a garbage collection...\n");
                n = storePurgeOld();
                debug(1, 1, "Garbage collection done, %d objects removed\n", n);
-               next_cleaning = squid_curtime + getCleanRate();
+               next_cleaning = squid_curtime + Config.cleanRate;
            }
-           if ((n = getAnnounceRate()) > 0) {
+           if ((n = Config.Announce.rate) > 0) {
                if (squid_curtime > last_announce + n)
                    send_announce();
                last_announce = squid_curtime;
index 6cb5c139863a8b727bb013ecd86d7245ed6aaca5..f4428c25ae51544e6c4553c51964832e49d7cb95 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.35 1996/07/25 05:46:38 wessels Exp $
+ * $Id: neighbors.cc,v 1.36 1996/07/25 07:10:38 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -182,7 +182,7 @@ void hierarchy_log_append(entry, code, timeout, cache_host)
     if (mem && cache_host)
        mem->hierarchy_host = xstrdup(cache_host);
 
-    if (emulate_httpd_log) {
+    if (Config.commonLogFormat) {
        if (squid_curtime != last_time) {
            s = mkhttpdlogtime(&squid_curtime);
            strcpy(time_str, s);
@@ -684,7 +684,7 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz)
            storeAppend(entry, data, data_sz);
            storeComplete(entry);
            hierarchy_log_append(entry,
-               e->type==EDGE_PARENT ? HIER_PARENT_UDP_HIT_OBJ : HIER_SIBLING_UDP_HIT_OBJ,
+               e->type == EDGE_PARENT ? HIER_PARENT_UDP_HIT_OBJ : HIER_SIBLING_UDP_HIT_OBJ,
                0,
                e->host);
            if (httpState->reply_hdr)
@@ -866,12 +866,12 @@ void neighbors_init()
     if (friends == NULL)
        friends = xcalloc(1, sizeof(neighbors));
 
-    if ((fname = getHierarchyLogFile()))
+    if ((fname = Config.Log.hierarchy))
        neighborsOpenLog(fname);
 
     for (t = Neighbor_cf; t; t = next) {
        next = t->next;
-       if (!strcmp(t->host, me) && t->http_port == getHttpPortNum()) {
+       if (!strcmp(t->host, me) && t->http_port == Config.Port.http) {
            debug(15, 0, "neighbors_init: skipping cache_host %s %s %d %d\n",
                t->type, t->host, t->http_port, t->icp_port);
            continue;
@@ -918,20 +918,20 @@ void neighbors_rotate_log()
     LOCAL_ARRAY(char, from, MAXPATHLEN);
     LOCAL_ARRAY(char, to, MAXPATHLEN);
 
-    if ((fname = getHierarchyLogFile()) == NULL)
+    if ((fname = Config.Log.hierarchy) == NULL)
        return;
 
     debug(15, 1, "neighbors_rotate_log: Rotating.\n");
 
     /* Rotate numbers 0 through N up one */
-    for (i = getLogfileRotateNumber(); i > 1;) {
+    for (i = Config.Log.rotateNumber; i > 1;) {
        i--;
        sprintf(from, "%s.%d", fname, i - 1);
        sprintf(to, "%s.%d", fname, i);
        rename(from, to);
     }
     /* Rotate the current log to .0 */
-    if (getLogfileRotateNumber() > 0) {
+    if (Config.Log.rotateNumber > 0) {
        sprintf(to, "%s.%d", fname, 0);
        rename(fname, to);
     }
index 675df71b2f7266ad766941962f40b2de9ceeaca1..dbbf07be4d22517eb623fde6201377d61bc4742c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: redirect.cc,v 1.6 1996/07/20 03:16:54 wessels Exp $
+ * $Id: redirect.cc,v 1.7 1996/07/25 07:10:40 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -67,9 +67,6 @@ struct redirectQueueData {
     redirectStateData *redirectState;
 };
 
-/* GLOBALS */
-int do_redirect = 0;
-
 static redirector_t *GetFirstAvailable _PARAMS((void));
 static int redirectCreateRedirector _PARAMS((char *command));
 static int redirectHandleRead _PARAMS((int, redirector_t *));
@@ -291,7 +288,7 @@ void redirectStart(url, fd, handler, data)
     redirector_t *redirector = NULL;
     if (!handler)
        fatal_dump("redirectStart: NULL handler");
-    if (!do_redirect) {
+    if (Config.Program.redirect == NULL) {
        (*handler) (data, NULL);
        return;
     }
@@ -308,13 +305,13 @@ void redirectStart(url, fd, handler, data)
 
 void redirectOpenServers()
 {
-    char *prg = getRedirectProgram();
+    char *prg = Config.Program.redirect;
     int k;
     int redirectsocket;
     LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
     static int first_time = 0;
 
-    if (!do_redirect)
+    if (Config.Program.redirect == NULL)
        return;
     /* free old structures if present */
     if (redirect_child_table) {
@@ -322,7 +319,7 @@ void redirectOpenServers()
            safe_free(redirect_child_table[k]);
        safe_free(redirect_child_table);
     }
-    NRedirectors = NRedirectorsOpen = getRedirectChildren();
+    NRedirectors = NRedirectorsOpen = Config.redirectChildren;
     redirect_child_table = xcalloc(NRedirectors, sizeof(redirector_t *));
     debug(29, 1, "redirectOpenServers: Starting %d '%s' processes\n",
        NRedirectors, prg);
@@ -362,7 +359,7 @@ void redirectShutdownServers()
 {
     redirector_t *redirect = NULL;
     int k;
-    if (!do_redirect)
+    if (Config.Program.redirect == NULL)
        return;
     for (k = 0; k < NRedirectors; k++) {
        redirect = *(redirect_child_table + k);
@@ -389,7 +386,7 @@ int redirectUnregister(url, fd)
     struct redirectQueueData *rq = NULL;
     int k;
     int n = 0;
-    if (!do_redirect)
+    if (Config.Program.redirect == NULL)
        return 0;
     debug(29, 3, "redirectUnregister: FD %d '%s'\n", fd, url);
     for (k = 0; k < NRedirectors; k++) {
index 1ed664200b90bc2dfa47b30c179248b6e9394ed5..4e12c6ff7a79894d6705394dc10288f729c91208 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: send-announce.cc,v 1.15 1996/07/18 20:27:08 wessels Exp $
+ * $Id: send-announce.cc,v 1.16 1996/07/25 07:10:40 wessels Exp $
  *
  * DEBUG: section 27    Cache Announcer
  * AUTHOR: Duane Wessels
@@ -44,8 +44,8 @@ void send_announce()
     int l;
     int n;
 
-    host = getAnnounceHost();
-    port = getAnnouncePort();
+    host = Config.Announce.host;
+    port = Config.Announce.port;
 
     if ((hp = ipcache_gethostbyname(host, IP_BLOCKING_LOOKUP)) == NULL) {
        debug(27, 1, "send_announce: Unknown host '%s'\n", host);
@@ -56,11 +56,11 @@ void send_announce()
     strcat(sndbuf, tbuf);
     sprintf(tbuf, "Running on %s %d %d\n",
        getMyHostname(),
-       getHttpPortNum(),
-       getIcpPortNum());
+       Config.Port.http,
+       Config.Port.icp);
     strcat(sndbuf, tbuf);
-    if (getAdminEmail()) {
-       sprintf(tbuf, "cache_admin: %s\n", getAdminEmail());
+    if (Config.adminEmail) {
+       sprintf(tbuf, "cache_admin: %s\n", Config.adminEmail);
        strcat(sndbuf, tbuf);
     }
     sprintf(tbuf, "generated %d [%s]\n",
@@ -69,7 +69,7 @@ void send_announce()
     strcat(sndbuf, tbuf);
     l = strlen(sndbuf);
 
-    if ((file = getAnnounceFile())) {
+    if ((file = Config.Announce.file)) {
        fd = file_open(file, NULL, O_RDONLY);
        if (fd > -1 && (n = read(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) {
            l += n;
index c814d5fd55737951c37146bb1f1e1884678862b7..b13e4524952b7185a0900f8de35b386e7f1c8b66 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.33 1996/07/23 04:11:05 wessels Exp $
+ * $Id: squid.h,v 1.34 1996/07/25 07:10:41 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -267,7 +267,7 @@ extern int opt_unlink_on_reload;    /* main.c */
 extern int opt_reload_hit_only;        /* main.c */
 extern int opt_dns_tests;      /* main.c */
 extern int opt_foreground_rebuild;     /* main.c */
-extern int opt_log_fqdn;       /* main.c */
+extern int opt_zap_disk_store; /* main.c */
 extern int vhost_mode;         /* main.c */
 extern char version_string[];  /* main.c */
 extern char appname[];         /* main.c */
@@ -275,8 +275,6 @@ extern struct in_addr local_addr;   /* main.c */
 extern char localhost[];
 extern struct in_addr any_addr;        /* comm.c */
 extern struct in_addr no_addr; /* comm.c */
-extern int do_redirect;                /* redirect.c */
-
 
 /* Prototypes and definitions which don't really deserve a seaprate
  * include file */
index 9ec7dc9639a86a6ff1e598e1c22ea3a9df564d77..8c717ea4b0e1d6a07fb7a520038815543bbcedc3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ssl.cc,v 1.8 1996/07/20 04:22:27 wessels Exp $
+ * $Id: ssl.cc,v 1.9 1996/07/25 07:10:41 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -437,7 +437,7 @@ int sslStart(fd, url, request, mime_hdr, size_ptr)
        RequestMethodStr[request->method], url);
 
     /* Create socket. */
-    sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (sock == COMM_ERROR) {
        debug(26, 4, "sslStart: Failed because we're out of sockets.\n");
        buf = squid_error_url(url,
@@ -459,7 +459,7 @@ int sslStart(fd, url, request, mime_hdr, size_ptr)
     sslState->url = xstrdup(url);
     sslState->request = requestLink(request);
     sslState->mime_hdr = mime_hdr;
-    sslState->timeout = getReadTimeout();
+    sslState->timeout = Config.readTimeout;
     sslState->size_ptr = size_ptr;
     sslState->client.fd = fd;
     sslState->server.fd = sock;
index 247313cf746b83e0c8a0750cc6be042e1b41d782..3d2eeccc531c7c929968fc1769e6c04d0afda0f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stat.cc,v 1.47 1996/07/25 05:48:40 wessels Exp $
+ * $Id: stat.cc,v 1.48 1996/07/25 07:10:42 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
 
 #include "squid.h"
 
-extern int emulate_httpd_log;
-
 #define MAX_LINELEN (4096)
 #define max(a,b)  ((a)>(b)? (a): (b))
 
@@ -732,21 +730,21 @@ void info_get(obj, sentry)
        RESERVED_FD);
 
     storeAppendPrintf(sentry, "{Stop List:}\n");
-    if ((p = getHttpStoplist())) {
+    if ((p = Config.http_stoplist)) {
        storeAppendPrintf(sentry, "{\tHTTP:}\n");
        while (p) {
            storeAppendPrintf(sentry, "{\t\t%s}\n", p->key);
            p = p->next;
        }
     }
-    if ((p = getGopherStoplist())) {
+    if ((p = Config.gopher_stoplist)) {
        storeAppendPrintf(sentry, "{\tGOPHER:}\n");
        while (p) {
            storeAppendPrintf(sentry, "{\t\t%s}\n", p->key);
            p = p->next;
        }
     }
-    if ((p = getFtpStoplist())) {
+    if ((p = Config.ftp_stoplist)) {
        storeAppendPrintf(sentry, "{\tFTP:}\n");
        while (p) {
            storeAppendPrintf(sentry, "{\t\t%s}\n", p->key);
@@ -839,52 +837,52 @@ void parameter_get(obj, sentry)
     storeAppendPrintf(sentry, open_bracket);
     storeAppendPrintf(sentry,
        "{VM-Max %d \"# Maximum hot-vm cache (MB)\"}\n",
-       getCacheMemMax() / (1 << 20));
+       Config.Mem.maxSize / (1 << 20));
     storeAppendPrintf(sentry,
        "{VM-High %d \"# High water mark hot-vm cache (%%)\"}\n",
-       getCacheMemHighWaterMark());
+       Config.Mem.highWaterMark);
     storeAppendPrintf(sentry,
        "{VM-Low %d \"# Low water-mark hot-vm cache (%%)\"}\n",
-       getCacheMemLowWaterMark());
+       Config.Mem.lowWaterMark);
     storeAppendPrintf(sentry,
        "{Swap-Max %d \"# Maximum disk cache (MB)\"}\n",
-       getCacheSwapMax() / (1 << 10));
+       Config.Swap.maxSize / (1 << 10));
     storeAppendPrintf(sentry,
        "{Swap-High %d \"# High Water mark disk cache (%%)\"}\n",
-       getCacheSwapHighWaterMark());
+       Config.Swap.highWaterMark);
     storeAppendPrintf(sentry,
        "{Swap-Low %d \"# Low water mark disk cache (%%)\"}\n",
-       getCacheSwapLowWaterMark());
+       Config.Swap.lowWaterMark);
     storeAppendPrintf(sentry,
        "{HTTP-Max %d\"# Maximum size HTTP objects (KB)\"}\n",
-       getHttpMax() / (1 << 10));
+       Config.Http.maxObjSize / (1 << 10));
     storeAppendPrintf(sentry,
        "{HTTP-TTL %d \"# Http object default TTL (hrs)\"}\n",
-       getHttpTTL() / 3600);
+       Config.Http.defaultTtl / 3600);
     storeAppendPrintf(sentry,
        "{Gopher-Max %d \"# Maximum size gopher objects (KB)\"}\n",
-       getGopherMax() / (1 << 10));
+       Config.Gopher.maxObjSize / (1 << 10));
     storeAppendPrintf(sentry,
        "{Gopher-TTL %d \"# TTL for gopher objects (hrs)\"}\n",
-       getGopherTTL() / 3600);
+       Config.Gopher.defaultTtl / 3600);
     storeAppendPrintf(sentry,
        "{FTP-Max %d \"# Maximum size FTP objects (KB)\"}\n",
-       getFtpMax() / (1 << 10));
+       Config.Ftp.maxObjSize / (1 << 10));
     storeAppendPrintf(sentry,
        "{FTP-TTL %d \"# TTL for FTP objects (hrs)\"}\n",
-       getFtpTTL() / 3600);
+       Config.Ftp.defaultTtl / 3600);
     storeAppendPrintf(sentry,
        "{Neg-TTL %d \"# TTL for negative cache (s)\"}\n",
-       getNegativeTTL());
+       Config.negativeTtl);
     storeAppendPrintf(sentry,
        "{ReadTimeout %d \"# Maximum idle connection (s)\"}\n",
-       getReadTimeout());
+       Config.readTimeout);
     storeAppendPrintf(sentry,
        "{ClientLifetime %d \"# Lifetime for incoming HTTP requests\"}\n",
-       getClientLifetime());
+       Config.lifetimeDefault);
     storeAppendPrintf(sentry,
        "{CleanRate %d \"# Rate for periodic object expiring\"}\n",
-       getCleanRate());
+       Config.cleanRate);
     /* Cachemgr.cgi expects an integer in the second field of the string */
     storeAppendPrintf(sentry,
        "{HttpAccelMode %d \"# Is operating as an HTTP accelerator\"}\n",
@@ -911,7 +909,7 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
     static char *dash = "-";
     char *client = NULL;
 
-    if (opt_log_fqdn)
+    if (Config.Log.log_fqdn)
        client = fqdncache_gethostbyaddr(caddr, 0);
     if (client == NULL)
        client = inet_ntoa(caddr);
@@ -928,7 +926,7 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
        neighbor = dash;
 
     if (obj->logfile_status == LOG_ENABLE) {
-       if (emulate_httpd_log)
+       if (Config.commonLogFormat)
            sprintf(tmp, "%s %s - [%s] \"%s %s\" %s %d\n",
                client,
                ident,
@@ -1324,14 +1322,14 @@ void stat_rotate_log()
     debug(18, 1, "stat_rotate_log: Rotating\n");
 
     /* Rotate numbers 0 through N up one */
-    for (i = getLogfileRotateNumber(); i > 1;) {
+    for (i = Config.Log.rotateNumber; i > 1;) {
        i--;
        sprintf(from, "%s.%d", fname, i - 1);
        sprintf(to, "%s.%d", fname, i);
        rename(from, to);
     }
     /* Rotate the current log to .0 */
-    if (getLogfileRotateNumber() > 0) {
+    if (Config.Log.rotateNumber > 0) {
        sprintf(to, "%s.%d", fname, 0);
        rename(fname, to);
     }
index 3c8402353a2fee5467f6a5e8ef5cd33798ca9c52..6a00cc75d648ecac2599aa33e9547d40db63d926 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stmem.cc,v 1.15 1996/07/25 05:49:17 wessels Exp $
+ * $Id: stmem.cc,v 1.16 1996/07/25 07:10:43 wessels Exp $
  *
  * DEBUG: section 19    Memory Primitives
  * AUTHOR: Harvest Derived
@@ -462,7 +462,7 @@ void stmemInit()
     sm_stats.total_pages_allocated = 0;
     sm_stats.n_pages_free = 0;
     sm_stats.n_pages_in_use = 0;
-    sm_stats.max_pages = (getCacheMemMax() / SM_PAGE_SIZE) >> 1;
+    sm_stats.max_pages = (Config.Mem.maxSize / SM_PAGE_SIZE) >> 1;
 
     disk_stats.page_size = DISK_PAGE_SIZE;
     disk_stats.total_pages_allocated = 0;
index 6a21b45effaf3eb67cab2e371e2a1f5a551fd80e..753f3da2e53ea56468bd2754d49c8d02106132b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: store.cc,v 1.74 1996/07/25 05:49:18 wessels Exp $
+ * $Id: store.cc,v 1.75 1996/07/25 07:10:43 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -349,7 +349,7 @@ static int storeHashInsert(e)
  */
 
 static int storeHashDelete(e)
-    StoreEntry *e;
+     StoreEntry *e;
 {
     hash_link *hptr = NULL;
     if (e->mem_status == IN_MEMORY && e->key) {
@@ -1248,10 +1248,10 @@ void storeSwapOutHandle(fd, flag, e)
        if (flag == DISK_NO_SPACE_LEFT) {
            /* reduce the swap_size limit to the current size. */
            setCacheSwapMax(store_swap_size);
-           store_swap_high = (long) (((float) getCacheSwapMax() *
-                   (float) getCacheSwapHighWaterMark()) / (float) 100);
-           store_swap_low = (long) (((float) getCacheSwapMax() *
-                   (float) getCacheSwapLowWaterMark()) / (float) 100);
+           store_swap_high = (long) (((float) Config.Swap.maxSize *
+                   (float) Config.Swap.highWaterMark) / (float) 100);
+           store_swap_low = (long) (((float) Config.Swap.maxSize *
+                   (float) Config.Swap.lowWaterMark) / (float) 100);
        }
        return;
     }
@@ -1681,7 +1681,7 @@ int storeAbort(e, msg)
     LOCAL_ARRAY(char, abort_msg, 2000);
 
     debug(20, 6, "storeAbort: '%s'\n", e->key);
-    e->expires = squid_curtime + getNegativeTTL();
+    e->expires = squid_curtime + Config.negativeTtl;
     e->store_status = STORE_ABORTED;
     storeSetMemStatus(e, IN_MEMORY);
     /* No DISK swap for negative cached object */
@@ -1700,7 +1700,7 @@ int storeAbort(e, msg)
        e->mem_obj->request->protocol,
        e->mem_obj->e_current_len);
     mk_mime_hdr(mime_hdr,
-       (time_t) getNegativeTTL(),
+       (time_t) Config.negativeTtl,
        6 + strlen(msg),
        squid_curtime,
        "text/html");
@@ -1972,7 +1972,7 @@ int storeGetMemSpace(size, check_vm_number)
        debug(20, 2, "storeGetMemSpace: Done.\n");
        return 0;
     }
-    if ((store_mem_size + size) < getCacheMemMax()) {
+    if ((store_mem_size + size) < Config.Mem.maxSize) {
        /* We're over high water mark here, but still under absolute max */
        if (!over_highwater) {
            /* print only once when the condition occur until it clears. */
@@ -2627,18 +2627,18 @@ int storeInit()
     wordlist *w = NULL;
     char *fname = NULL;
 
-    if (strcmp((fname = getStoreLogFile()), "none") == 0)
+    if (strcmp((fname = Config.Log.store), "none") == 0)
        storelog_fd = -1;
     else
        storelog_fd = file_open(fname, NULL, O_WRONLY | O_CREAT);
     if (storelog_fd < 0)
        debug(20, 1, "Store logging disabled\n");
 
-    for (w = getCacheDirs(); w; w = w->next)
+    for (w = Config.cache_dirs; w; w = w->next)
        storeAddSwapDisk(w->key);
     storeSanityCheck();
     file_map_create(MAX_SWAP_FILE);
-    dir_created = storeVerifySwapDirs(zap_disk_store);
+    dir_created = storeVerifySwapDirs(opt_zap_disk_store);
     storeCreateHashTable(urlcmp);
 
     sprintf(swaplog_file, "%s/log", swappath(0));
@@ -2651,32 +2651,32 @@ int storeInit()
     }
     swaplog_lock = file_write_lock(swaplog_fd);
 
-    if (!zap_disk_store)
+    if (!opt_zap_disk_store)
        storeStartRebuildFromDisk();
     else
        store_rebuilding = STORE_NOT_REBUILDING;
 
-    if (dir_created || zap_disk_store)
+    if (dir_created || opt_zap_disk_store)
        storeCreateSwapSubDirs();
 
-    store_mem_high = (long) (getCacheMemMax() / 100) *
-       getCacheMemHighWaterMark();
-    store_mem_low = (long) (getCacheMemMax() / 100) *
-       getCacheMemLowWaterMark();
+    store_mem_high = (long) (Config.Mem.maxSize / 100) *
+       Config.Mem.highWaterMark;
+    store_mem_low = (long) (Config.Mem.maxSize / 100) *
+       Config.Mem.lowWaterMark;
 
-    store_hotobj_high = (int) (getCacheHotVmFactor() *
+    store_hotobj_high = (int) (Config.hotVmFactor *
        store_mem_high / (1 << 20));
-    store_hotobj_low = (int) (getCacheHotVmFactor() *
+    store_hotobj_low = (int) (Config.hotVmFactor *
        store_mem_low / (1 << 20));
 
     /* check for validity */
     if (store_hotobj_low > store_hotobj_high)
        store_hotobj_low = store_hotobj_high;
 
-    store_swap_high = (long) (getCacheSwapMax() / 100) *
-       getCacheSwapHighWaterMark();
-    store_swap_low = (long) (getCacheSwapMax() / 100) *
-       getCacheSwapLowWaterMark();
+    store_swap_high = (long) (Config.Swap.maxSize / 100) *
+       Config.Swap.highWaterMark;
+    store_swap_low = (long) (Config.Swap.maxSize / 100) *
+       Config.Swap.lowWaterMark;
 
     return 0;
 }
@@ -2707,7 +2707,7 @@ void storeSanityCheck()
                name);
            debug(20, 0, "Forcing a *full restart* (e.g., %s -z)...\n",
                appname);
-           zap_disk_store = 1;
+           opt_zap_disk_store = 1;
            return;
        }
     }
@@ -2895,7 +2895,7 @@ void storeRotateLog()
        file_close(storelog_fd);
        storelog_fd = -1;
     }
-    if ((fname = getStoreLogFile()) == NULL)
+    if ((fname = Config.Log.store) == NULL)
        return;
 
     if (strcmp(fname, "none") == 0)
@@ -2904,14 +2904,14 @@ void storeRotateLog()
     debug(20, 1, "storeRotateLog: Rotating.\n");
 
     /* Rotate numbers 0 through N up one */
-    for (i = getLogfileRotateNumber(); i > 1;) {
+    for (i = Config.Log.rotateNumber; i > 1;) {
        i--;
        sprintf(from, "%s.%d", fname, i - 1);
        sprintf(to, "%s.%d", fname, i);
        rename(from, to);
     }
     /* Rotate the current log to .0 */
-    if (getLogfileRotateNumber() > 0) {
+    if (Config.Log.rotateNumber > 0) {
        sprintf(to, "%s.%d", fname, 0);
        rename(fname, to);
     }
index b55cdc0422db891d69b7b3509934bb3d6f426430..4773e811f1b5deeba226198edc425a1b82b720e4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.45 1996/07/18 20:27:12 wessels Exp $
+ * $Id: tools.cc,v 1.46 1996/07/25 07:10:44 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -137,10 +137,10 @@ void mail_warranty()
     fp = fopen(filename, "w");
     if (fp != NULL) {
        fprintf(fp, "From: %s\n", appname);
-       fprintf(fp, "To: %s\n", getAdminEmail());
+       fprintf(fp, "To: %s\n", Config.adminEmail);
        fprintf(fp, "Subject: %s\n", dead_msg());
        fclose(fp);
-       sprintf(command, "mail %s < %s", getAdminEmail(), filename);
+       sprintf(command, "mail %s < %s", Config.adminEmail, filename);
        system(command);        /* XXX should avoid system(3) */
        unlink(filename);
     }
@@ -148,7 +148,7 @@ void mail_warranty()
 
 void print_warranty()
 {
-    if (getAdminEmail())
+    if (Config.adminEmail)
        mail_warranty();
     else
        puts(dead_msg());
@@ -254,10 +254,10 @@ void sigusr2_handle(sig)
     static int state = 0;
     debug(21, 1, "sigusr2_handle: SIGUSR2 received.\n");
     if (state == 0) {
-       _db_init(getCacheLogFile(), "ALL,10");
+       _db_init(Config.Log.log, "ALL,10");
        state = 1;
     } else {
-       _db_init(getCacheLogFile(), getDebugOptions());
+       _db_init(Config.Log.log, Config.debugOptions);
        state = 0;
     }
 #if !HAVE_SIGACTION
@@ -268,7 +268,7 @@ void sigusr2_handle(sig)
 void setSocketShutdownLifetimes()
 {
     FD_ENTRY *f = NULL;
-    int lft = getShutdownLifetime();
+    int lft = Config.lifetimeShutdown;
     int cur;
     int i;
     for (i = fdstat_biggest_fd(); i >= 0; i--) {
@@ -287,9 +287,9 @@ void setSocketShutdownLifetimes()
 void normal_shutdown()
 {
     debug(21, 1, "Shutting down...\n");
-    if (getPidFilename()) {
+    if (Config.pidFilename) {
        enter_suid();
-       safeunlink(getPidFilename(), 0);
+       safeunlink(Config.pidFilename, 0);
        leave_suid();
     }
     storeWriteCleanLog();
@@ -364,7 +364,7 @@ char *getMyHostname()
     struct hostent *h = NULL;
     char *t = NULL;
 
-    if ((t = getVisibleHostname()))
+    if ((t = Config.visibleHostname))
        return t;
 
     /* Get the host name and store it in host to return */
@@ -410,11 +410,11 @@ void leave_suid()
     if (geteuid() != 0)
        return;
     /* Started as a root, check suid option */
-    if (getEffectiveUser() == NULL)
+    if (Config.effectiveUser == NULL)
        return;
-    if ((pwd = getpwnam(getEffectiveUser())) == NULL)
+    if ((pwd = getpwnam(Config.effectiveUser)) == NULL)
        return;
-    if (getEffectiveGroup() && (grp = getgrnam(getEffectiveGroup()))) {
+    if (Config.effectiveGroup && (grp = getgrnam(Config.effectiveGroup))) {
        setgid(grp->gr_gid);
     } else {
        setgid(pwd->pw_gid);
@@ -463,7 +463,7 @@ void writePidFile()
     FILE *pid_fp = NULL;
     char *f = NULL;
 
-    if ((f = getPidFilename()) == NULL)
+    if ((f = Config.pidFilename) == NULL)
        return;
     enter_suid();
     pid_fp = fopen(f, "w");
index ea01bc2ba250c2124ade018783d1747ca244a9b4..d3d09a10397908b21e273a9ad87b4ba5a47cc8fe 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.8 1996/07/20 04:22:27 wessels Exp $
+ * $Id: tunnel.cc,v 1.9 1996/07/25 07:10:41 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -437,7 +437,7 @@ int sslStart(fd, url, request, mime_hdr, size_ptr)
        RequestMethodStr[request->method], url);
 
     /* Create socket. */
-    sock = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    sock = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (sock == COMM_ERROR) {
        debug(26, 4, "sslStart: Failed because we're out of sockets.\n");
        buf = squid_error_url(url,
@@ -459,7 +459,7 @@ int sslStart(fd, url, request, mime_hdr, size_ptr)
     sslState->url = xstrdup(url);
     sslState->request = requestLink(request);
     sslState->mime_hdr = mime_hdr;
-    sslState->timeout = getReadTimeout();
+    sslState->timeout = Config.readTimeout;
     sslState->size_ptr = size_ptr;
     sslState->client.fd = fd;
     sslState->server.fd = sock;
index a83e71b60d8d1e6b3877fc8d079b49ba2cc9d2cb..7f9de55c4df85b62fe49b3235644221d7c9efeee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: wais.cc,v 1.34 1996/07/20 03:16:58 wessels Exp $
+ * $Id: wais.cc,v 1.35 1996/07/25 07:10:45 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -202,7 +202,7 @@ static void waisReadReply(fd, waisState)
                    (void *) NULL,
                    (time_t) 0);
                /* dont try reading again for a while */
-               comm_set_stall(fd, getStallDelay());
+               comm_set_stall(fd, Config.stallDelay);
                return;
            }
        } else {
@@ -223,7 +223,7 @@ static void waisReadReply(fd, waisState)
            comm_set_select_handler(fd, COMM_SELECT_READ,
                (PF) waisReadReply, (void *) waisState);
            comm_set_select_handler_plus_timeout(fd, COMM_SELECT_TIMEOUT,
-               (PF) waisReadReplyTimeout, (void *) waisState, getReadTimeout());
+               (PF) waisReadReplyTimeout, (void *) waisState, Config.readTimeout);
        } else {
            BIT_RESET(entry->flag, CACHABLE);
            storeReleaseRequest(entry);
@@ -240,7 +240,7 @@ static void waisReadReply(fd, waisState)
        entry->expires = squid_curtime;
        storeComplete(entry);
        comm_close(fd);
-    } else if (((entry->mem_obj->e_current_len + len) > getWAISMax()) &&
+    } else if (((entry->mem_obj->e_current_len + len) > Config.Wais.maxObjSize) &&
        !(entry->flag & DELETE_BEHIND)) {
        /*  accept data, but start to delete behind it */
        storeStartDeleteBehind(entry);
@@ -253,7 +253,7 @@ static void waisReadReply(fd, waisState)
            COMM_SELECT_TIMEOUT,
            (PF) waisReadReplyTimeout,
            (void *) waisState,
-           getReadTimeout());
+           Config.readTimeout);
     } else {
        storeAppend(entry, buf, len);
        comm_set_select_handler(fd,
@@ -264,7 +264,7 @@ static void waisReadReply(fd, waisState)
            COMM_SELECT_TIMEOUT,
            (PF) waisReadReplyTimeout,
            (void *) waisState,
-           getReadTimeout());
+           Config.readTimeout);
     }
 }
 
@@ -295,7 +295,7 @@ static void waisSendComplete(fd, buf, size, errflag, data)
            COMM_SELECT_TIMEOUT,
            (PF) waisReadReplyTimeout,
            (void *) waisState,
-           getReadTimeout());
+           Config.readTimeout);
     }
 }
 
@@ -376,12 +376,12 @@ int waisStart(unusedfd, url, method, mime_hdr, entry)
 
     debug(24, 3, "waisStart: \"%s %s\"\n", RequestMethodStr[method], url);
     debug(24, 4, "            header: %s\n", mime_hdr);
-    if (!getWaisRelayHost()) {
+    if (!Config.Wais.relayHost) {
        debug(24, 0, "waisStart: Failed because no relay host defined!\n");
        squid_error_entry(entry, ERR_NO_RELAY, NULL);
        return COMM_ERROR;
     }
-    fd = comm_open(COMM_NONBLOCKING, getTcpOutgoingAddr(), 0, url);
+    fd = comm_open(COMM_NONBLOCKING, Config.Addrs.tcp_outgoing, 0, url);
     if (fd == COMM_ERROR) {
        debug(24, 4, "waisStart: Failed because we're out of sockets.\n");
        squid_error_entry(entry, ERR_NO_FDS, xstrerror());
@@ -390,8 +390,8 @@ int waisStart(unusedfd, url, method, mime_hdr, entry)
     waisState = xcalloc(1, sizeof(WaisStateData));
     storeLockObject(waisState->entry = entry, NULL, NULL);
     waisState->method = method;
-    waisState->relayhost = getWaisRelayHost();
-    waisState->relayport = getWaisRelayPort();
+    waisState->relayhost = Config.Wais.relayHost;
+    waisState->relayport = Config.Wais.relayPort;
     waisState->mime_hdr = mime_hdr;
     waisState->fd = fd;
     strncpy(waisState->request, url, MAX_URL);