/*
- * $Id: cache_cf.cc,v 1.236 1997/12/02 00:17:30 wessels Exp $
+ * $Id: cache_cf.cc,v 1.237 1997/12/02 03:30:21 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
*/
#include "squid.h"
+
+#if SQUID_SNMP
#include "snmp.h"
#include "snmp_config.h"
+#endif
static const char *const T_SECOND_STR = "second";
static const char *const T_MINUTE_STR = "minute";
static void wordlistAdd(wordlist **, const char *);
static void configDoConfigure(void);
+#if SQUID_SNMP
static void parse_snmp_conf(snmpconf **);
+#endif
static void parse_refreshpattern(refresh_t **);
static int parseTimeUnits(const char *unit);
static void parseTimeLine(time_t * tptr, const char *units);
storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
}
+#if SQUID_SNMP
static void
parse_snmp_conf(snmpconf ** s)
{
p = strtok(NULL, null_string);
strcpy(buff, p);
tokenize(buff, tokens, 10);
-
if (!strcmp("view", tokens[0])) {
if (create_view(tokens) < 0)
debug(49, 5) ("snmp: parse_snmpconf(): error\n");
debug(49, 5) ("snmp: unknown directive %s\n", tokens[0]);
}
+static void
+dump_snmp_conf(StoreEntry * entry, const char *name, snmpconf * head)
+{
+ storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
+}
+
+static void
+free_snmp_conf(snmpconf ** head)
+{
+ snmpconf *t;
+ while ((t = *head) != NULL) {
+ *head = t->next;
+ safe_free(t->line);
+ safe_free(t);
+ }
+}
+#endif
+
static void
parse_acl(acl ** acl)
{
#define dump_eol dump_string
#define free_eol free_string
-static void
-dump_snmp_conf(StoreEntry * entry, const char *name, snmpconf * head)
-{
- storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
-}
-
static void
dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
{
safe_free(pattern);
}
-static void
-free_snmp_conf(snmpconf ** head)
-{
- snmpconf *t;
- while ((t = *head) != NULL) {
- *head = t->next;
- safe_free(t->line);
- safe_free(t);
- }
-}
-
static void
free_refreshpattern(refresh_t ** head)
{
TYPE: ushort
LOC: Config.Port.snmp
DEFAULT: 3401
+IFDEF: SQUID_SNMP
DOC_START
Port for snmp. <=0 to disable.
DOC_END
TYPE: string
LOC: Config.Snmp.configFile
DEFAULT: @DEFAULT_SNMP_CONF@
+IFDEF: SQUID_SNMP
DOC_START
External snmp configuration file, CMU-snmpd style.
DOC_END
TYPE: onoff
LOC: Config.Snmp.do_queueing
DEFAULT: on
+IFDEF: SQUID_SNMP
DOC_START
If disabled, snmp packets will not be queued but delivered
immediately. This could be performant when you want to monitor
TYPE: ushort
LOC: Config.Snmp.localPort
DEFAULT: 0
+IFDEF: SQUID_SNMP
DOC_START
This configures whether we should be forwarding SNMP requests
to another snmpd. The reason for putting this piece of functionality
TYPE: string
LOC: Config.Snmp.mibPath
DEFAULT: @DEFAULT_MIB_PATH@
+IFDEF: SQUID_SNMP
DOC_START
The location of squid's mib.
DOC_END
TYPE: ushort
LOC: Config.Port.snmp
DEFAULT: 3401
+IFDEF: SQUID_SNMP
DOC_START
Port for snmp. <=0 to disable.
DOC_END
TYPE: string
LOC: Config.Snmp.configFile
DEFAULT: @DEFAULT_SNMP_CONF@
+IFDEF: SQUID_SNMP
DOC_START
External snmp configuration file, CMU-snmpd style.
DOC_END
TYPE: onoff
LOC: Config.Snmp.do_queueing
DEFAULT: on
+IFDEF: SQUID_SNMP
DOC_START
If disabled, snmp packets will not be queued but delivered
immediately. This could be performant when you want to monitor a
cache in trouble, but this could also bring squid to block.
DOC_END
+
NAME: forward_snmpd_port
TYPE: ushort
LOC: Config.Snmp.localPort
DEFAULT: 0
+IFDEF: SQUID_SNMP
DOC_START
This configures whether we should be forwarding SNMP requests to
another snmpd. The reason for putting this piece of
TYPE: string
LOC: Config.Snmp.trap_sink
DEFAULT: 127.0.0.1
+IFDEF: SQUID_SNMP
DOC_START
Hostname or ip address of trap sink for snmp
DOC_END
TYPE: string
LOC: Config.Snmp.trap_community
DEFAULT: public
+IFDEF: SQUID_SNMP
DOC_START
Community name for traps
DOC_END
TYPE: onoff
LOC: Config.Snmp.conf_authtraps
DEFAULT: off
+IFDEF: SQUID_SNMP
DOC_START
Enable SNMP authenticated traps
DOC_END
TYPE: snmp_conf
LOC: Config.Snmp.snmpconf
DEFAULT: none
+IFDEF: SQUID_SNMP
DOC_START
Define snmp views, users and communities
Example:
/*
- * $Id: cf_gen.cc,v 1.16 1997/12/01 22:45:50 wessels Exp $
+ * $Id: cf_gen.cc,v 1.17 1997/12/02 03:30:22 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Max Okumoto
char *default_value;
char *default_if_none;
char *comment;
+ char *ifdef;
Line *doc;
struct Entry *next;
} Entry;
exit(1);
}
curr->type = strdup(ptr);
+ } else if (!strncmp(buff, "IFDEF:", 6)) {
+ if ((ptr = strtok(buff + 6, WS)) == NULL) {
+ printf("Error on line %d\n", linenum);
+ exit(1);
+ }
+ curr->ifdef = strdup(ptr);
} else if (!strcmp(buff, "DOC_START")) {
state = sDOC;
} else if (!strcmp(buff, "DOC_NONE")) {
continue;
}
assert(entry->default_value);
+ if (entry->ifdef)
+ fprintf(fp, "#ifdef %s\n", entry->ifdef);
if (strcmp(entry->default_value, "none") == 0) {
fprintf(fp, "\t/* No default for %s */\n", entry->name);
} else {
entry->name,
entry->default_value);
}
+ if (entry->ifdef)
+ fprintf(fp, "#endif\n");
}
fprintf(fp, "\tcfg_filename = NULL;\n");
fprintf(fp, "}\n\n");
assert(entry->loc);
if (entry->default_if_none == NULL)
continue;
+ if (entry->ifdef)
+ fprintf(fp, "#ifdef %s\n", entry->ifdef);
fprintf(fp,
"\tif (check_null_%s(%s))\n"
"\t\tdefault_line(\"%s %s\");\n",
entry->loc,
entry->name,
entry->default_if_none);
+ if (entry->ifdef)
+ fprintf(fp, "#endif\n");
}
fprintf(fp, "}\n\n");
}
entry->name
);
assert(entry->loc);
+ if (entry->ifdef)
+ fprintf(fp, "#ifdef %s\n", entry->ifdef);
if (strcmp(entry->loc, "none") == 0) {
fprintf(fp,
"\t\tparse_%s();\n",
entry->type, entry->loc
);
}
+ if (entry->ifdef)
+ fprintf(fp, "#endif\n");
}
fprintf(fp,
continue;
if (strcmp(entry->name, "comment") == 0)
continue;
+ if (entry->ifdef)
+ fprintf(fp, "#ifdef %s\n", entry->ifdef);
fprintf(fp, "\tdump_%s(entry, \"%s\", %s);\n",
entry->type,
entry->name,
entry->loc);
+ if (entry->ifdef)
+ fprintf(fp, "#endif\n");
}
fprintf(fp, "}\n\n");
}
continue;
if (strcmp(entry->name, "comment") == 0)
continue;
+ if (entry->ifdef)
+ fprintf(fp, "#ifdef %s\n", entry->ifdef);
fprintf(fp, "\tfree_%s(&%s);\n", entry->type, entry->loc);
+ if (entry->ifdef)
+ fprintf(fp, "#endif\n");
}
fprintf(fp, "}\n\n");
}
struct _acl_deny_info_list *next;
};
+#if SQUID_SNMP
struct _snmpconf {
char *line;
int type;
struct _snmpconf *next;
};
+#endif
struct _acl {
char name[ACL_NAME_SZ];
struct {
ushortlist *http;
u_short icp;
+#if SQUID_SNMP
u_short snmp;
+#endif
} Port;
+#if SQUID_SNMP
struct {
char *configFile;
char *agentInfo;
usecEntry *users;
communityEntry *communities;
} Snmp;
+#endif
struct {
char *log;
char *access;
unsigned long *file_map;
};
-struct _fqdncache_entry {
- /* first two items must be equivalent to hash_link in hash.h */
- char *name;
- struct _fqdncache_entry *next;
- time_t lastref;
- time_t expires;
- unsigned char name_count;
- char *names[FQDN_MAX_NAMES + 1];
- struct _fqdn_pending *pending_head;
- char *error_message;
- unsigned char locks;
- fqdncache_status_t status:3;
-};
-
struct _hash_link {
char *key;
struct _hash_link *next;
ipcache_status_t status:3;
};
+struct _fqdncache_entry {
+ /* first two items must be equivalent to hash_link in hash.h */
+ char *name;
+ struct _fqdncache_entry *next;
+ time_t lastref;
+ time_t expires;
+ unsigned char name_count;
+ char *names[FQDN_MAX_NAMES + 1];
+ struct _fqdn_pending *pending_head;
+ char *error_message;
+ dlink_node lru;
+ unsigned char locks;
+ fqdncache_status_t status:3;
+};
+
struct _domain_ping {
char *domain;
int do_ping; /* boolean */