#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.85 1997/08/10 04:42:32 wessels Exp $
+# $Id: Makefile.in,v 1.86 1997/08/25 03:51:46 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
$(XTRA_OBJS)
DEFAULTS = \
- -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" \
- -DDEFAULT_SWAP_DIR=\"$(DEFAULT_SWAP_DIR)\"
+ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\"
all: squid.conf $(PROGS) $(UTILS) $(SUID_UTILS) $(CGIPROGS)
/*
- * $Id: cache_cf.cc,v 1.218 1997/08/25 02:17:45 wessels Exp $
+ * $Id: cache_cf.cc,v 1.219 1997/08/25 03:51:47 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void parse_string _PARAMS((char **));
static void parse_wordlist _PARAMS((wordlist **));
static void default_all _PARAMS((void));
+static void defaults_if_none _PARAMS((void));
static int parse_line _PARAMS((char *));
static void parseBytesLine _PARAMS((size_t * bptr, const char *units));
static size_t parseBytesUnits _PARAMS((const char *unit));
}
}
fclose(fp);
+ defaults_if_none();
configDoConfigure();
return 0;
}
*****************************************************************************/
static void
-dump_acl(acl * acl)
+dump_acl(StoreEntry *entry, const char *name, acl * acl)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_acl_access(struct _acl_access *head)
+dump_acl_access(StoreEntry *entry, const char *name, struct _acl_access *head)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_address(struct in_addr addr)
+dump_address(StoreEntry *entry, const char *name, struct in_addr addr)
{
- printf("%s", inet_ntoa(addr));
+ storeAppendPrintf(entry, "%s %s\n", name, inet_ntoa(addr));
}
static void
}
static void
-dump_cachedir(struct _cacheSwap swap)
+dump_cachedir(StoreEntry * entry, const char *name, struct _cacheSwap swap)
{
- assert(0);
+ SwapDir *s;
+ int i;
+ for (i = 0; i<swap.n_configured; i++) {
+ s = swap.swapDirs+i;
+ storeAppendPrintf(entry, "%s %s %d %d %d\n",
+ name,
+ s->path,
+ s->max_size>>10,
+ s->l1,
+ s->l2);
+ }
+}
+
+static int
+check_null_cachedir(struct _cacheSwap swap)
+{
+ return swap.swapDirs == NULL;
}
static void
}
static void
-dump_peer(peer * p)
+dump_peer(StoreEntry *entry, const char *name, peer * p)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_cachemgrpasswd(cachemgr_passwd * list)
+dump_cachemgrpasswd(StoreEntry *entry, const char *name, cachemgr_passwd * list)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
static void
-dump_denyinfo(struct _acl_deny_info_list *var)
+dump_denyinfo(StoreEntry *entry, const char *name, struct _acl_deny_info_list *var)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_httpanonymizer(int var)
+dump_httpanonymizer(StoreEntry *entry, const char *name, int var)
{
switch (var) {
case ANONYMIZER_NONE:
static void
-dump_ushortlist(ushortlist * u)
+dump_ushortlist(StoreEntry *entry, const char *name, ushortlist * u)
{
while (u) {
- printf("%d ", (int) u->i);
+ storeAppendPrintf(entry, "%s %d\n", name, (int) u->i);
u = u->next;
}
}
+static int
+check_null_ushortlist(ushortlist * u)
+{
+ return u == NULL;
+}
+
static void
parse_ushortlist(ushortlist ** P)
{
}
static void
-dump_int(int var)
+dump_int(StoreEntry *entry, const char *name, int var)
{
- printf("%d", var);
+ storeAppendPrintf(entry, "%s %d\n", name, var);
}
static void
}
static void
-dump_onoff(int var)
+dump_onoff(StoreEntry *entry, const char *name, int var)
{
- printf(var ? "on" : "off");
+ storeAppendPrintf(entry, "%s %s\n", name, var ? "on" : "off");
}
static void
}
static void
-dump_refreshpattern(refresh_t * head)
+dump_refreshpattern(StoreEntry *entry, const char *name, refresh_t * head)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_regexlist(relist * var)
+dump_regexlist(StoreEntry *entry, const char *name, relist * var)
{
- assert(0);
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
static void
}
static void
-dump_string(char *var)
+dump_string(StoreEntry *entry, const char *name, char *var)
{
- printf("%s", var);
+ if (var != NULL)
+ storeAppendPrintf(entry, "%s %s\n", name, var);
}
static void
}
static void
-dump_time_t(time_t var)
+dump_time_t(StoreEntry *entry, const char *name, time_t var)
{
- printf("%d", (int) var);
+ storeAppendPrintf(entry, "%s %d seconds\n", name, (int) var);
}
static void
}
static void
-dump_size_t(size_t var)
+dump_size_t(StoreEntry *entry, const char *name, size_t var)
{
- printf("%d", (int) var);
+ storeAppendPrintf(entry, "%s %d\n", name, (int) var);
}
static void
-dump_b_size_t(size_t var)
+dump_b_size_t(StoreEntry *entry, const char *name, size_t var)
{
- printf("%d bytes", (int) var);
+ storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_BYTES_STR);
}
static void
-dump_kb_size_t(size_t var)
+dump_kb_size_t(StoreEntry *entry, const char *name, size_t var)
{
- printf("%d KB", (int) var);
+ storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_KBYTES_STR);
}
static void
#define free_gb_size_t free_size_t
static void
-dump_ushort(u_short var)
+dump_ushort(StoreEntry *entry, const char *name, u_short var)
{
- printf("%d", var);
+ storeAppendPrintf(entry, "%s %d\n", name, var);
}
static void
}
static void
-dump_wordlist(wordlist * list)
+dump_wordlist(StoreEntry *entry, const char *name, wordlist * list)
{
- printf("{");
while (list != NULL) {
- printf("%s ", list->key);
+ storeAppendPrintf(entry, "%s %s\n", name, list->key);
list = list->next;
}
- printf("}");
}
static void
NAME: http_port ascii_port
TYPE: ushortlist
-DEFAULT: 3128
+DEFAULT: none
+DEFAULT_IF_NONE: 3128
LOC: Config.Port.http
DOC_START
The port number where squid will listen for HTTP client
NAME: cache_dir
TYPE: cachedir
DEFAULT: none
+DEFAULT_IF_NONE: @DEFAULT_SWAP_DIR@ 100 256 16
LOC: Config.cacheSwap
DOC_START
Directory for on-disk cache storage. The cache will change into
/*
- * $Id: cf_gen.cc,v 1.7 1997/07/14 21:11:01 wessels Exp $
+ * $Id: cf_gen.cc,v 1.8 1997/08/25 03:51:48 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Max Okumoto
*
* The output files are as follows:
* cf_parser.c - this file contains, default_all() which
- * initializes
- * variables with the default values, parse_line() that
- * parses line from squid.conf, dump_all that dumps the
+ * initializes variables with the default
+ * values, parse_line() that parses line from
+ * squid.conf, dump_config that dumps the
* current the values of the variables.
* squid.conf - default configuration file given to the server
* administrator.
char *type;
char *loc;
char *default_value;
+ char *default_if_none;
char *comment;
Line *doc;
struct Entry *next;
static void gen_dump(Entry *, FILE *);
static void gen_free(Entry *, FILE *);
static void gen_conf(Entry *, FILE *);
+static void gen_default_if_none(Entry *, FILE *);
int
main(int argc, char *argv[])
while (isspace(*ptr))
ptr++;
curr->default_value = strdup(ptr);
+ } else if (!strncmp(buff, "DEFAULT_IF_NONE:", 16)) {
+ ptr = buff + 16;
+ while (isspace(*ptr))
+ ptr++;
+ curr->default_if_none = strdup(ptr);
} else if (!strncmp(buff, "LOC:", 4)) {
if ((ptr = strtok(buff + 4, WS)) == NULL) {
printf("Error on line %d\n", linenum);
/*-------------------------------------------------------------------*
* Generate default_all()
* Generate parse_line()
- * Generate dump_all()
+ * Generate dump_config()
* Generate free_all()
* Generate example squid.conf file
*-------------------------------------------------------------------*/
input_filename, argv[0]
);
rc = gen_default(entries, fp);
+ gen_default_if_none(entries, fp);
gen_parse(entries, fp);
gen_dump(entries, fp);
gen_free(entries, fp);
"\tparse_line(tmp_line);\n"
"}\n"
);
-
fprintf(fp,
"void\n"
"default_all(void)\n"
return rc;
}
+static void
+gen_default_if_none(Entry * head, FILE * fp)
+{
+ Entry *entry;
+ fprintf(fp,
+ "void\n"
+ "defaults_if_none(void)\n"
+ "{\n"
+ );
+ for (entry = head; entry != NULL; entry = entry->next) {
+ assert(entry->name);
+ assert(entry->loc);
+ if (entry->default_if_none == NULL)
+ continue;
+ fprintf(fp,
+ "\tif (check_null_%s(%s))\n"
+ "\t\tdefault_line(\"%s %s\");\n",
+ entry->type,
+ entry->loc,
+ entry->name,
+ entry->default_if_none);
+ }
+ fprintf(fp, "}\n\n");
+}
+
static void
gen_parse(Entry * head, FILE * fp)
{
Entry *entry;
fprintf(fp,
"void\n"
- "dump_all(void)\n"
+ "dump_config(StoreEntry *entry)\n"
"{\n"
);
for (entry = head; entry != NULL; entry = entry->next) {
assert(entry->loc);
if (strcmp(entry->loc, "none") == 0)
continue;
- fprintf(fp, "\tprintf(\"%s = \");\n", entry->loc);
- fprintf(fp, "\tdump_%s(%s);\n", entry->type, entry->loc);
- fprintf(fp, "\tprintf(\"\\n\");\n");
+ fprintf(fp, "\tdump_%s(entry, \"%s\", %s);\n",
+ entry->type,
+ entry->name,
+ entry->loc);
}
fprintf(fp, "}\n\n");
}
typedef enum {
MGR_NONE,
MGR_CLIENT_LIST,
- MGR_CONFIG,
- MGR_CONFIG_FILE,
+ MGR_CONFIGURATION,
MGR_DNSSERVERS,
MGR_FILEDESCRIPTORS,
MGR_FQDNCACHE,
extern char config_input_line[BUFSIZ];
extern const char *AclMatchedName; /* NULL */
extern const char *DefaultConfigFile; /* DEFAULT_CONFIG_FILE */
-extern const char *DefaultSwapDir; /* DEFAULT_SWAP_DIR */
extern const char *RequestMethodStr[];
extern const char *ProtocolStr[];
extern const char *cfg_filename; /* NULL */
/*
- * $Id: mime.cc,v 1.36 1997/07/21 07:20:59 wessels Exp $
+ * $Id: mime.cc,v 1.37 1997/08/25 03:51:50 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
mimeLoadIconFile(ICON_MENU);
mimeLoadIconFile(ICON_DIRUP);
mimeLoadIconFile(ICON_LINK);
+ debug(25, 1) ("Loaded Icons.\n");
}
static void
storeComplete(e);
storeTimestampsSet(e);
BIT_SET(e->flag, ENTRY_SPECIAL);
- debug(25, 1) ("Loaded icon %s\n", url);
+ debug(25, 3) ("Loaded icon %s\n", url);
storeUnlockObject(e);
put_free_4k_page(buf);
}
extern void intlistDestroy _PARAMS((intlist **));
extern void wordlistDestroy _PARAMS((wordlist **));
extern void configFreeMemory _PARAMS((void));
-extern void dump_all _PARAMS((void));
extern void cbdataInit _PARAMS((void));
extern void cbdataAdd _PARAMS((void *p));
extern OBJH log_enable;
extern OBJH info_get;
extern OBJH server_list;
-extern OBJH parameter_get;
+extern OBJH dump_config;
extern OBJH storeDirStats;
extern OBJH pconnHistDump;
/*
- * $Id: stat.cc,v 1.154 1997/08/10 06:34:32 wessels Exp $
+ * $Id: stat.cc,v 1.155 1997/08/25 03:51:53 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
storeAppendPrintf(sentry, close_bracket);
}
-void
-parameter_get(StoreEntry * sentry)
-{
- storeAppendPrintf(sentry, open_bracket);
- storeAppendPrintf(sentry,
- "{VM-Max %d \"# Maximum hot-vm cache (MB)\"}\n",
- Config.Mem.maxSize / (1 << 20));
- storeAppendPrintf(sentry,
- "{VM-High %d \"# High water mark hot-vm cache (%%)\"}\n",
- Config.Mem.highWaterMark);
- storeAppendPrintf(sentry,
- "{VM-Low %d \"# Low water mark hot-vm cache (%%)\"}\n",
- Config.Mem.lowWaterMark);
- storeAppendPrintf(sentry,
- "{Swap-Max %d \"# Maximum disk cache (MB)\"}\n",
- Config.Swap.maxSize / (1 << 10));
- storeAppendPrintf(sentry,
- "{Swap-High %d \"# High water mark disk cache (%%)\"}\n",
- Config.Swap.highWaterMark);
- storeAppendPrintf(sentry,
- "{Swap-Low %d \"# Low water mark disk cache (%%)\"}\n",
- Config.Swap.lowWaterMark);
- storeAppendPrintf(sentry,
- "{Neg-TTL %d \"# TTL for negative cache (s)\"}\n",
- Config.negativeTtl);
- storeAppendPrintf(sentry,
- "{ReadTimeout %d \"# Maximum idle connection (s)\"}\n",
- Config.Timeout.read);
- storeAppendPrintf(sentry, "{DeferTimeout %d\n", Config.Timeout.defer);
- storeAppendPrintf(sentry, "{ClientLifetime %d\n", Config.Timeout.lifetime);
- /* Cachemgr.cgi expects an integer in the second field of the string */
- storeAppendPrintf(sentry,
- "{HttpAccelMode %d \"# Is operating as an HTTP accelerator\"}\n",
- Config2.Accel.on);
- storeAppendPrintf(sentry, close_bracket);
-}
-
static void
proto_newobject(cacheinfo * obj, protocol_t proto_id, int size, int restart)
{