#include "DelayConfig.h"
#include "helper/ChildConfig.h"
#include "HttpHeaderTools.h"
-#include "icmp/IcmpConfig.h"
#include "ip/Address.h"
#include "Notes.h"
#include "YesNoNone.h"
} Wccp2;
#endif
-#if USE_ICMP
- IcmpConfig pinger;
-#endif
-
char *as_whois_server;
struct {
#include "ftp/Elements.h"
#include "globals.h"
#include "HttpHeaderTools.h"
+#include "icmp/IcmpConfig.h"
#include "ident/Config.h"
#include "ip/Intercept.h"
#include "ip/QosConfig.h"
icap_class_type icap_service
icap_service_type
icap_service_failure_limit
+icmp
ecap_service_type
int
kb_int64_t
DOC_END
NAME: pinger_program
-TYPE: string
-DEFAULT: @DEFAULT_PINGER@
-LOC: Config.pinger.program
IFDEF: USE_ICMP
+TYPE: icmp
+DEFAULT: @DEFAULT_PINGER@
+LOC: IcmpCfg
DOC_START
Specify the location of the executable for the pinger process.
DOC_END
NAME: pinger_enable
TYPE: onoff
DEFAULT: on
-LOC: Config.pinger.enable
+LOC: IcmpCfg.enable
IFDEF: USE_ICMP
DOC_START
Control whether the pinger is active at run-time.
--- /dev/null
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+/* DEBUG: section 03 Configuration Settings */
+
+#include "squid.h"
+
+#if USE_ICMP
+#include "ConfigParser.h"
+#include "IcmpConfig.h"
+
+IcmpConfig IcmpCfg;
+
+void
+IcmpConfig::parse()
+{
+ if (char *token = ConfigParser::NextQuotedOrToEol()) {
+ program.clear();
+ program.append(token);
+ } else
+ self_destruct();
+}
+
+#endif /* USE_ICMP */
+
#ifndef ICMPCONFIG_H
#define ICMPCONFIG_H
+#if USE_ICMP
+
+#include "cache_cf.h"
+#include "SBuf.h"
+
/**
* Squid pinger Configuration settings
- *
- \par
- * This structure is included as a child field of the global Config
- * such that if ICMP is built it can be accessed as Config.pinger.*
*/
class IcmpConfig
{
-
public:
+ IcmpConfig() : enable(0) {}
+ ~IcmpConfig() {}
- /** \todo These methods should really be defined in an ICMPConfig.cc file
- * alongside any custom parsing routines needed for this component.
- * First though, the whole global Config dependancy tree needs fixing */
- IcmpConfig() : program(NULL), enable(0) {};
- ~IcmpConfig() { if (program) delete program; program = NULL; };
-
- /* variables */
+ void clear() {enable=0; program.clear();}
+ void parse();
/** pinger helper application path */
- char *program;
+ SBuf program;
/** Whether the pinger helper is enabled for use or not */
- /** \todo make this much more memory efficient for a boolean */
int enable;
};
+extern IcmpConfig IcmpCfg;
+
+/* wrappers for the legacy squid.conf parser */
+#define dump_icmp(e,n,v) \
+ if (!(v).program.isEmpty()) { \
+ (e)->append((n), strlen((n))); \
+ (e)->append(" ", 1); \
+ (e)->append((v).program.rawContent(), (v).program.length()); \
+ (e)->append("\n", 1); \
+ } else {}
+#define parse_icmp(v) (v)->parse()
+#define free_icmp(x) (x)->clear()
+
+#endif /* USE_ICMP */
#endif /* ICMPCONFIG_H */
#include "comm/Loops.h"
#include "defines.h"
#include "fd.h"
+#include "icmp/IcmpConfig.h"
#include "icmp/IcmpSquid.h"
#include "icmp/net_db.h"
#include "ip/tools.h"
Ip::Address localhost;
/* User configured disabled. */
- if (!Config.pinger.enable) {
+ if (!IcmpCfg.enable) {
Close();
return -1;
}
* least on FreeBSD).
*/
pid = ipcCreate(IPC_UDP_SOCKET,
- Config.pinger.program,
+ IcmpCfg.program.c_str(),
args,
"Pinger Socket",
localhost,
# Squid Internal ICMP helper interface
libicmp_la_SOURCES = \
+ IcmpConfig.cc \
IcmpConfig.h \
IcmpSquid.h \
IcmpSquid.cc \