--------------------- PatchSet 6248 Date: 2007/12/05 07:50:14 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Add ICMPConfig class to break out ICMP/pinger component configuratin options. This enables the pinger to be optional at runtime per configure Members: src/ICMP.h:1.1.2.11->1.1.2.12 src/ICMPConfig.h:1.1->1.1.2.1 src/ICMPSquid.cc:1.1.2.8->1.1.2.9 src/Makefile.am:1.58.2.29->1.58.2.30 src/cf.data.pre:1.68.2.49->1.68.2.50 src/structs.h:1.66.2.37->1.66.2.38 Index: squid3/src/ICMP.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICMP.h,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -r1.1.2.11 -r1.1.2.12 --- squid3/src/ICMP.h 1 Dec 2007 02:11:37 -0000 1.1.2.11 +++ squid3/src/ICMP.h 5 Dec 2007 07:50:14 -0000 1.1.2.12 @@ -1,5 +1,5 @@ /* - * $Id: ICMP.h,v 1.1.2.11 2007/12/01 02:11:37 amosjeffries Exp $ + * $Id: ICMP.h,v 1.1.2.12 2007/12/05 07:50:14 amosjeffries Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels, Amos Jeffries @@ -82,6 +82,7 @@ /** * Implements the squid interface to access ICMP operations * + \par * Child implementations define specific parts of these operations * using these methods as a naming and parameter template. * --- /dev/null Thu Dec 6 01:20:41 2007 +++ squid3/src/ICMPConfig.h Thu Dec 6 01:20:41 2007 @@ -0,0 +1,73 @@ +/* + * $Id: ICMPConfig.h,v 1.1.2.1 2007/12/05 07:50:15 amosjeffries Exp $ + * + * DEBUG: section 3 Configuration Settings + * AUTHOR: Amos Jeffries + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from the + * Internet community. Development is led by Duane Wessels of the + * National Laboratory for Applied Network Research and funded by the + * National Science Foundation. Squid is Copyrighted (C) 1998 by + * the Regents of the University of California. Please see the + * COPYRIGHT file for full details. Squid incorporates software + * developed and/or copyrighted by other sources. Please see the + * CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + * This code is copyright (C) 2007 by Treehouse Networks Ltd + * of New Zealand. It is published and Lisenced as an extension of + * squid under the same conditions as the main squid application. + */ +#ifndef ICMPCONFIG_H +#define ICMPCONFIG_H + +#include "config.h" + +#if HAVE_STDLIB_H +#include +#endif + +/** + * 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: + + /** \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 */ + + /** pinger helper application path */ + char *program; + + /** Whether the pinger helper is enabled for use or not */ + /** \todo make this much more memory efficient for a boolean */ + int enable; +}; + +#endif /* ICMPCONFIG_H */ Index: squid3/src/ICMPSquid.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICMPSquid.cc,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- squid3/src/ICMPSquid.cc 1 Dec 2007 02:11:37 -0000 1.1.2.8 +++ squid3/src/ICMPSquid.cc 5 Dec 2007 07:50:15 -0000 1.1.2.9 @@ -1,5 +1,5 @@ /* - * $Id: ICMPSquid.cc,v 1.1.2.8 2007/12/01 02:11:37 amosjeffries Exp $ + * $Id: ICMPSquid.cc,v 1.1.2.9 2007/12/05 07:50:15 amosjeffries Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels, Amos Jeffries @@ -212,6 +212,12 @@ int wfd; IPAddress localhost; + /* User configured disabled. */ + if(!Config.pinger.enable) { + Close(); + return -1; + } + args[0] = "(pinger)"; args[1] = NULL; localhost.SetLocalhost(); @@ -222,7 +228,7 @@ * least on FreeBSD). */ pid = ipcCreate(IPC_UDP_SOCKET, - Config.Program.pinger, + Config.pinger.program, args, "Pinger Socket", localhost, Index: squid3/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Makefile.am,v retrieving revision 1.58.2.29 retrieving revision 1.58.2.30 diff -u -r1.58.2.29 -r1.58.2.30 --- squid3/src/Makefile.am 1 Dec 2007 02:11:38 -0000 1.58.2.29 +++ squid3/src/Makefile.am 5 Dec 2007 07:50:15 -0000 1.58.2.30 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.58.2.29 2007/12/01 02:11:38 amosjeffries Exp $ +# $Id: Makefile.am,v 1.58.2.30 2007/12/05 07:50:15 amosjeffries Exp $ # # Uncomment and customize the following to suit your needs: # @@ -131,6 +131,7 @@ ICMPSOURCE = \ ICMP.h \ icmp.cc \ + ICMPConfig.h \ ICMPSquid.h \ ICMPSquid.cc Index: squid3/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cf.data.pre,v retrieving revision 1.68.2.49 retrieving revision 1.68.2.50 diff -u -r1.68.2.49 -r1.68.2.50 --- squid3/src/cf.data.pre 27 Nov 2007 07:59:08 -0000 1.68.2.49 +++ squid3/src/cf.data.pre 5 Dec 2007 07:50:15 -0000 1.68.2.50 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.68.2.49 2007/11/27 07:59:08 amosjeffries Exp $ +# $Id: cf.data.pre,v 1.68.2.50 2007/12/05 07:50:15 amosjeffries Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -2370,12 +2370,23 @@ NAME: pinger_program TYPE: string DEFAULT: @DEFAULT_PINGER@ -LOC: Config.Program.pinger +LOC: Config.pinger.program IFDEF: USE_ICMP 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 +IFDEF: USE_ICMP +DOC_START + Control whether the pinger is active at run-time. + Enables turning ICMP pinger on and off with a simple squid -k reconfigure. +DOC_END + + COMMENT_START OPTIONS FOR URL REWRITING ----------------------------------------------------------------------------- Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.66.2.37 retrieving revision 1.66.2.38 diff -u -r1.66.2.37 -r1.66.2.38 --- squid3/src/structs.h 3 Dec 2007 09:29:13 -0000 1.66.2.37 +++ squid3/src/structs.h 5 Dec 2007 07:50:15 -0000 1.66.2.38 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.66.2.37 2007/12/03 09:29:13 rmartinez Exp $ + * $Id: structs.h,v 1.66.2.38 2007/12/05 07:50:15 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -176,6 +176,10 @@ #include "DelayConfig.h" #endif +#if USE_ICMP +#include "ICMPConfig.h" +#endif + /* forward decl for SquidConfig, see RemovalPolicy.h */ class RemovalPolicySettings; @@ -319,6 +323,10 @@ Wccp2; #endif +#if USE_ICMP + ICMPConfig pinger; +#endif + char *as_whois_server; struct @@ -361,10 +369,6 @@ #endif wordlist *redirect; -#if USE_ICMP - - char *pinger; -#endif #if USE_UNLINKD char *unlinkd; @@ -432,7 +436,7 @@ IPAddress snmp_outgoing; #endif - /* INET6 : this should really be a CIDR value */ + /* FIXME INET6 : this should really be a CIDR value */ IPAddress client_netmask; }