From: wessels <> Date: Sat, 26 Jul 1997 10:48:21 +0000 (+0000) Subject: move bunch of options to Config.onoff X-Git-Tag: SQUID_3_0_PRE1~4850 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17a0a4eeb2454c000c2ce37988d83534dacd02c5;p=thirdparty%2Fsquid.git move bunch of options to Config.onoff --- diff --git a/src/access_log.cc b/src/access_log.cc index 41ab5b732d..36c5bae16e 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.3 1997/07/19 06:12:49 wessels Exp $ + * $Id: access_log.cc,v 1.4 1997/07/26 04:48:21 wessels Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -114,7 +114,7 @@ static int accessLogSquid(AccessLogEntry * al) { const char *client = dash_str; - if (Config.Log.log_fqdn) + if (Config.onoff.log_fqdn) client = fqdncache_gethostbyaddr(al->cache.caddr, 0); if (client == NULL) client = inet_ntoa(al->cache.caddr); @@ -140,7 +140,7 @@ static int accessLogCommon(AccessLogEntry * al) { const char *client = dash_str; - if (Config.Log.log_fqdn) + if (Config.onoff.log_fqdn) client = fqdncache_gethostbyaddr(al->cache.caddr, 0); if (client == NULL) client = inet_ntoa(al->cache.caddr); @@ -176,11 +176,11 @@ accessLogLog(AccessLogEntry * al) al->private.method_str = RequestMethodStr[al->http.method]; if (al->hier.host[0] == '\0') xstrncpy(al->hier.host, dash_str, SQUIDHOSTNAMELEN); - if (Config.commonLogFormat) + if (Config.onoff.common_log) l = accessLogCommon(al); else l = accessLogSquid(al); - if (Config.logMimeHdrs) { + if (Config.onoff.log_mime_hdrs) { char *ereq = log_quote(al->headers.request); char *erep = log_quote(al->headers.reply); if (LOG_BUF_SZ - l > 0) diff --git a/src/acl.cc b/src/acl.cc index 1209a37e9f..7235058c69 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $Id: acl.cc,v 1.104 1997/07/15 23:23:14 wessels Exp $ + * $Id: acl.cc,v 1.105 1997/07/26 04:48:22 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -216,7 +216,7 @@ aclParseMethodList(void *curlist) q = xcalloc(1, sizeof(intlist)); q->i = (int) urlParseMethod(t); if (q->i == METHOD_PURGE) - Config.Options.enable_purge = 1; + Config.onoff.enable_purge = 1; *(Tail) = q; Tail = &q->next; } @@ -635,7 +635,7 @@ aclParseAclLine(acl ** head) aclParseIntlist(&A->data); break; case ACL_USER: - Config.identLookup = 1; + Config.onoff.ident_lookup = 1; aclParseWordList(&A->data); break; case ACL_PROTO: diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 11578cde4f..190597fdac 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.216 1997/07/19 07:20:00 wessels Exp $ + * $Id: cache_cf.cc,v 1.217 1997/07/26 04:48:23 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -179,7 +179,7 @@ parseConfigFile(const char *file_name) } if (Config.Announce.period < 1) { Config.Announce.period = 86400 * 365; /* one year */ - Config.Announce.on = 0; + Config.onoff.announce = 0; } if (Config.dnsChildren < 0) Config.dnsChildren = 0; diff --git a/src/cf.data.pre b/src/cf.data.pre index a95003baac..c4946c25da 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -238,7 +238,7 @@ NAME: single_parent_bypass COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.singleParentBypass +LOC: Config.onoff.single_parent_bypass DOC_START This tag specifies that it is okay to bypass the hierarchy "Pinging" when there is only a single parent for a given URL. @@ -272,7 +272,7 @@ NAME: source_ping COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.sourcePing +LOC: Config.onoff.source_ping DOC_START If source_ping is enabled, then squid will include the source provider site in its selection algorithm. This is accomplished @@ -552,7 +552,7 @@ NAME: emulate_httpd_log COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.commonLogFormat +LOC: Config.onoff.common_log DOC_START The Cache can emulate the log file format which many 'httpd' programs use. To disable/enable this emulation, set @@ -579,7 +579,7 @@ DOC_END NAME: log_mime_hdrs COMMENT: on|off TYPE: onoff -LOC: Config.logMimeHdrs +LOC: Config.onoff.log_mime_hdrs DEFAULT: off DOC_START The Cache can record both the request and the response @@ -640,7 +640,7 @@ NAME: ident_lookup COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.identLookup +LOC: Config.onoff.ident_lookup DOC_START If you wish to make an RFC931/ident lookup of the client username for each connection, enable this. It is off by default. @@ -653,7 +653,7 @@ NAME: log_fqdn COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Log.log_fqdn +LOC: Config.onoff.log_fqdn DOC_START Turn this on if you wish to log fully qualified domain names in the access.log. @@ -756,7 +756,7 @@ NAME: dns_defnames COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Options.res_defnames +LOC: Config.onoff.res_defnames DOC_START Normally the 'dnsserver' disables the RES_DEFNAMES resolver option (see res_init(3)). This prevents caches in a hierarchy @@ -1385,7 +1385,7 @@ NAME: httpd_accel_with_proxy COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Accel.withProxy +LOC: Config.onoff.accel_with_proxy DOC_START If you want to use squid as both a local httpd accelerator and as a proxy, change this to 'on'. @@ -1594,7 +1594,7 @@ NAME: log_icp_queries COMMENT: on|off TYPE: onoff DEFAULT: on -LOC: Config.Options.log_udp +LOC: Config.onoff.log_udp DOC_START If set, ICP queries are logged to access.log. ICP logging is enabled by default, so uncomment and change the line @@ -1607,7 +1607,7 @@ NAME: icp_hit_stale COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Options.icp_hit_stale +LOC: Config.onoff.icp_hit_stale DOC_START If you want to return ICP_HIT for stale cache objects, set this option to 'on'. If you have sibling relationships with caches @@ -1719,7 +1719,7 @@ DOC_END NAME: http_anonymizer TYPE: httpanonymizer -LOC: Config.Options.anonymizer +LOC: Config.onoff.anonymizer DEFAULT: off DOC_START If you want to filter out certain HTTP request headers for @@ -1739,7 +1739,7 @@ NAME: client_db COMMENT: on|off TYPE: onoff DEFAULT: on -LOC: Config.Options.client_db +LOC: Config.onoff.client_db DOC_START If you want to disable collecting per-client statistics, then turn off client_db here. @@ -1786,7 +1786,7 @@ NAME: query_icmp COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Options.query_icmp +LOC: Config.onoff.query_icmp DOC_START If you want to ask your peers to include ICMP data in their ICP replies, enable this option. @@ -1807,7 +1807,7 @@ NAME: buffered_logs COMMENT: on|off TYPE: onoff DEFAULT: off -LOC: Config.Options.buffered_logs +LOC: Config.onoff.buffered_logs DOC_START Some log files (cache.log, useragent.log) are written with stdio functions, and as such they can be buffered or diff --git a/src/client_db.cc b/src/client_db.cc index e177496e9b..1104ae92ee 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.14 1997/07/17 05:22:31 wessels Exp $ + * $Id: client_db.cc,v 1.15 1997/07/26 04:48:24 wessels Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -72,7 +72,7 @@ clientdbUpdate(struct in_addr addr, log_type log_type, protocol_t p) { char *key; ClientInfo *c; - if (!Config.Options.client_db) + if (!Config.onoff.client_db) return; key = inet_ntoa(addr); c = (ClientInfo *) hash_lookup(client_table, key); @@ -95,7 +95,7 @@ clientdbDeniedPercent(struct in_addr addr) char *key; int n = 100; ClientInfo *c; - if (!Config.Options.client_db) + if (!Config.onoff.client_db) return 0; key = inet_ntoa(addr); c = (ClientInfo *) hash_lookup(client_table, key); diff --git a/src/client_side.cc b/src/client_side.cc index 0da37e3414..fcd0f2490e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.118 1997/07/16 20:32:00 wessels Exp $ + * $Id: client_side.cc,v 1.119 1997/07/26 04:48:25 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -75,7 +75,7 @@ checkAccelOnly(clientHttpRequest * http) * we are in httpd-accel only mode */ if (!Config2.Accel.on) return 0; - if (Config.Accel.withProxy) + if (Config.onoff.accel_with_proxy) return 0; if (http->request->protocol == PROTO_CACHEOBJ) return 0; @@ -90,7 +90,7 @@ clientAccessCheck(void *data) clientHttpRequest *http = data; ConnStateData *conn = http->conn; char *browser; - if (Config.identLookup && conn->ident.state == IDENT_NONE) { + if (Config.onoff.ident_lookup && conn->ident.state == IDENT_NONE) { identStart(-1, conn, clientAccessCheck); return; } @@ -547,8 +547,8 @@ clientPurgeRequest(clientHttpRequest * http) LOCAL_ARRAY(char, msg, 8192); LOCAL_ARRAY(char, line, 256); StoreEntry *entry; - debug(0, 0) ("Config.Options.enable_purge = %d\n", Config.Options.enable_purge); - if (!Config.Options.enable_purge) { + debug(0, 0) ("Config.onoff.enable_purge = %d\n", Config.onoff.enable_purge); + if (!Config.onoff.enable_purge) { buf = access_denied_msg(http->http_code = 401, http->request->method, http->url, diff --git a/src/comm.cc b/src/comm.cc index b986212b37..07938aa802 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,5 +1,5 @@ /* - * $Id: comm.cc,v 1.182 1997/07/16 22:58:24 wessels Exp $ + * $Id: comm.cc,v 1.183 1997/07/26 04:48:26 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -407,7 +407,7 @@ commConnectHandle(int fd, void *data) cs->S.sin_family = AF_INET; cs->S.sin_addr = cs->in_addr; cs->S.sin_port = htons(cs->port); - if (Config.Log.log_fqdn) + if (Config.onoff.log_fqdn) fqdncache_gethostbyaddr(cs->S.sin_addr, FQDN_LOOKUP_IF_MISS); } switch (comm_connect_addr(fd, &cs->S)) { diff --git a/src/debug.cc b/src/debug.cc index a25c4b85aa..e75ff6e4b0 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.50 1997/07/21 07:20:56 wessels Exp $ + * $Id: debug.cc,v 1.51 1997/07/26 04:48:27 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -149,7 +149,7 @@ _db_print(va_alist) #endif /* HAVE_SYSLOG */ /* write to log file */ vfprintf(debug_log, f, args); - if (!Config.Options.buffered_logs) + if (!Config.onoff.buffered_logs) fflush(debug_log); if (opt_debug_stderr && debug_log != stderr) vfprintf(stderr, f, args); diff --git a/src/dns.cc b/src/dns.cc index d51cb57641..1018ec287c 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -1,6 +1,6 @@ /* - * $Id: dns.cc,v 1.38 1997/07/16 20:32:03 wessels Exp $ + * $Id: dns.cc,v 1.39 1997/07/26 04:48:28 wessels Exp $ * * DEBUG: section 34 Dnsserver interface * AUTHOR: Harvest Derived @@ -198,7 +198,7 @@ dnsOpenServer(const char *command) fclose(debug_log); close(fd); close(cfd); - if (Config.Options.res_defnames) + if (Config.onoff.res_defnames) execlp(command, "(dnsserver)", "-D", NULL); else execlp(command, "(dnsserver)", NULL); diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 0a3e8698ed..0794c7ca83 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.57 1997/06/26 22:35:46 wessels Exp $ + * $Id: fqdncache.cc,v 1.58 1997/07/26 04:48:28 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -912,7 +912,7 @@ fqdnFromAddr(struct in_addr addr) { const char *n; static char buf[32]; - if (Config.Log.log_fqdn && (n = fqdncache_gethostbyaddr(addr, 0))) + if (Config.onoff.log_fqdn && (n = fqdncache_gethostbyaddr(addr, 0))) return n; xstrncpy(buf, inet_ntoa(addr), 32); return buf; diff --git a/src/http.cc b/src/http.cc index 995a2b09a8..8a2cccae4c 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.178 1997/07/16 20:32:07 wessels Exp $ + * $Id: http.cc,v 1.179 1997/07/26 04:48:29 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -672,10 +672,10 @@ httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, size_t max, in if (n >= max) return; if (check) { - if (Config.Options.anonymizer == ANONYMIZER_PARANOID) { + if (Config.onoff.anonymizer == ANONYMIZER_PARANOID) { if (!httpAnonAllowed(line)) return; - } else if (Config.Options.anonymizer == ANONYMIZER_STANDARD) { + } else if (Config.onoff.anonymizer == ANONYMIZER_STANDARD) { if (httpAnonDenied(line)) return; } diff --git a/src/main.cc b/src/main.cc index c12ff7157e..9082c0a460 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.168 1997/07/21 07:20:58 wessels Exp $ + * $Id: main.cc,v 1.169 1997/07/26 04:48:32 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -332,7 +332,7 @@ serverConnectionsOpen(void) } if (NHttpSockets < 1) fatal("Cannot open HTTP Port"); - if (!Config2.Accel.on || Config.Accel.withProxy) { + if (!Config2.Accel.on || Config.onoff.accel_with_proxy) { if ((port = Config.Port.icp) > (u_short) 0) { enter_suid(); theInIcpConnection = comm_open(SOCK_DGRAM, @@ -439,7 +439,7 @@ mainReconfigure(void) dnsOpenServers(); redirectOpenServers(); serverConnectionsOpen(); - if (theOutIcpConnection >= 0 && (!Config2.Accel.on || Config.Accel.withProxy)) + if (theOutIcpConnection >= 0 && (!Config2.Accel.on || Config.onoff.accel_with_proxy)) neighbors_open(theOutIcpConnection); debug(1, 0) ("Ready to serve requests.\n"); } @@ -518,7 +518,7 @@ mainInitialize(void) mimeInit(Config.mimeTablePathname); } serverConnectionsOpen(); - if (theOutIcpConnection >= 0 && (!Config2.Accel.on || Config.Accel.withProxy)) + if (theOutIcpConnection >= 0 && (!Config2.Accel.on || Config.onoff.accel_with_proxy)) neighbors_open(theOutIcpConnection); if (!configured_once) @@ -536,7 +536,7 @@ mainInitialize(void) if (!configured_once) { eventAdd("storeMaintain", storeMaintainSwapSpace, NULL, 1); eventAdd("storeDirClean", storeDirClean, NULL, 15); - if (Config.Announce.on) + if (Config.onoff.announce) eventAdd("start_announce", start_announce, NULL, 3600); eventAdd("ipcache_purgelru", ipcache_purgelru, NULL, 10); } diff --git a/src/neighbors.cc b/src/neighbors.cc index 364b0d0809..0db7f54582 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.153 1997/07/16 20:32:12 wessels Exp $ + * $Id: neighbors.cc,v 1.154 1997/07/26 04:48:33 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -480,7 +480,7 @@ neighborsUdpPing(request_t * request, if (!BIT_TEST(request->flags, REQ_NOCACHE)) if (p->icp_version == ICP_VERSION_2) flags |= ICP_FLAG_HIT_OBJ; - if (Config.Options.query_icmp) + if (Config.onoff.query_icmp) if (p->icp_version == ICP_VERSION_2) flags |= ICP_FLAG_SRC_RTT; query = icpCreateMessage(ICP_OP_QUERY, flags, url, reqnum, 0); @@ -517,7 +517,7 @@ neighborsUdpPing(request_t * request, /* only do source_ping if we have neighbors */ if (Config.npeers) { - if (!Config.sourcePing) { + if (!Config.onoff.source_ping) { debug(15, 6) ("neighborsUdpPing: Source Ping is disabled.\n"); } else if ((ia = ipcache_gethostbyname(host, 0))) { debug(15, 6) ("neighborsUdpPing: Source Ping: to %s for '%s'\n", @@ -686,7 +686,7 @@ neighborsUdpAck(int fd, const char *url, icp_common_t * header, const struct soc if (p) { debug(15, 1) ("Ignoring SECHO from neighbor %s\n", p->host); neighborCountIgnored(p, opcode); - } else if (!Config.sourcePing) { + } else if (!Config.onoff.source_ping) { debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr)); } else { mem->icp_reply_callback(NULL, ntype, opcode, mem->ircb_data); diff --git a/src/peer_select.cc b/src/peer_select.cc index 4ab113309e..33251ce581 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.23 1997/07/19 07:20:04 wessels Exp $ + * $Id: peer_select.cc,v 1.24 1997/07/26 04:48:34 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -96,7 +96,7 @@ peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry) fatal_dump("direct == DIRECT_YES"); if (!BIT_TEST(entry->flag, HIERARCHICAL) && direct != DIRECT_NO) return 0; - if (Config.singleParentBypass && !Config.sourcePing) + if (Config.onoff.single_parent_bypass && !Config.onoff.source_ping) if (getSingleParent(request)) return 0; if (BIT_TEST(entry->flag, KEY_PRIVATE) && !neighbors_do_private_keys) diff --git a/src/send-announce.cc b/src/send-announce.cc index 7e78173aab..e088c3611d 100644 --- a/src/send-announce.cc +++ b/src/send-announce.cc @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.41 1997/07/07 05:29:52 wessels Exp $ + * $Id: send-announce.cc,v 1.42 1997/07/26 04:48:34 wessels Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -36,7 +36,7 @@ static IPH send_announce; void start_announce(void *unused) { - if (!Config.Announce.on) + if (!Config.onoff.announce) return; ipcache_nbgethostbyname(Config.Announce.host, send_announce, NULL); eventAdd("send_announce", start_announce, NULL, Config.Announce.period); diff --git a/src/structs.h b/src/structs.h index 07d976d25d..b6b64ed5b3 100644 --- a/src/structs.h +++ b/src/structs.h @@ -126,7 +126,6 @@ struct _SquidConfig { char *swap; char *useragent; int rotateNumber; - int log_fqdn; } Log; struct { char *File; @@ -143,15 +142,9 @@ struct _SquidConfig { } Program; int dnsChildren; int redirectChildren; - int sourcePing; - int commonLogFormat; - int logMimeHdrs; - int identLookup; - int singleParentBypass; struct { char *host; u_short port; - int withProxy; } Accel; char *appendDomain; size_t appendDomainLen; @@ -164,7 +157,6 @@ struct _SquidConfig { char *host; char *file; time_t period; - int on; u_short port; } Announce; struct { @@ -209,7 +201,15 @@ struct _SquidConfig { int query_icmp; int icp_hit_stale; int buffered_logs; - } Options; + int source_ping; + int common_log; + int log_mime_hdrs; + int ident_lookup; + int single_parent_bypass; + int log_fqdn; + int announce; + int accel_with_proxy; + } onoff; struct _acl *aclList; struct { struct _acl_access *http; diff --git a/src/useragent.cc b/src/useragent.cc index b02a002daa..c875aa3a38 100644 --- a/src/useragent.cc +++ b/src/useragent.cc @@ -1,6 +1,6 @@ /* - * $Id: useragent.cc,v 1.9 1997/07/21 07:21:02 wessels Exp $ + * $Id: useragent.cc,v 1.10 1997/07/26 04:48:35 wessels Exp $ * * DEBUG: section 40 User-Agent logging * AUTHOR: Joe Ramey @@ -112,7 +112,7 @@ logUserAgent(const char *client, const char *agent) client, time_str, agent); - if (!Config.Options.buffered_logs) + if (!Config.onoff.buffered_logs) fflush(cache_useragent_log); #endif }