urn.cc \
urn.h \
wccp.cc \
- wccp.h \
wccp2.cc \
wccp2.h \
wordlist.cc \
#include "time/Engine.h"
#include "tools.h"
#include "unlinkd.h"
-#include "wccp.h"
-#include "wccp2.h"
#include "windows_service.h"
#if USE_ADAPTATION
static void
serverConnectionsOpen(void)
{
- if (IamPrimaryProcess()) {
-#if USE_WCCP
- wccpConnectionOpen();
-#endif
-
-#if USE_WCCPv2
-
- wccp2ConnectionOpen();
-#endif
- }
// start various proxying services if we are responsible for them
if (IamWorkerProcess()) {
clientOpenListenSockets();
{
assert(shutting_down || reconfiguring);
- if (IamPrimaryProcess()) {
-#if USE_WCCP
-
- wccpConnectionClose();
-#endif
-#if USE_WCCPv2
-
- wccp2ConnectionClose();
-#endif
- }
if (IamWorkerProcess()) {
clientConnectionsClose();
icpConnectionShutdown();
#endif
externalAclInit();
- if (IamPrimaryProcess()) {
-#if USE_WCCP
-
- wccpInit();
-#endif
-#if USE_WCCPv2
-
- wccp2Init();
-#endif
- }
-
serverConnectionsOpen();
neighbors_init();
// PconnModule::GetInstance()->registerWithCacheManager();
// moved to PconnModule::PconnModule()
- if (IamPrimaryProcess()) {
-#if USE_WCCP
- wccpInit();
-
-#endif
-#if USE_WCCPv2
-
- wccp2Init();
-
-#endif
- }
-
serverConnectionsOpen();
neighbors_init();
#if HAVE_FS_ROCK
CallRunnerRegistratorIn(Rock, SwapDirRr);
#endif
+
+#if USE_WCCP
+ CallRunnerRegistrator(WccpRr);
+#endif
+#if USE_WCCPv2
+ CallRunnerRegistrator(Wccp2Rr);
+#endif
}
int
#if SQUID_SNMP
snmpClosePorts();
#endif
-#if USE_WCCP
-
- wccpConnectionClose();
-#endif
-#if USE_WCCPv2
-
- wccp2ConnectionClose();
-#endif
-
releaseServerSockets();
commCloseAllSockets();
*/
#include "squid.h"
-#include "wccp2.h"
#if USE_WCCPv2
#define STUB_API "wccp2.cc"
#include "tests/STUB.h"
+#include "wccp2.h"
class StoreEntry;
-
-void wccp2Init(void) STUB
-void wccp2ConnectionOpen(void) STUB
-void wccp2ConnectionClose(void) STUB
void dump_wccp2_method(StoreEntry *, const char *, int) STUB
void free_wccp2_method(int *) STUB
void parse_wccp2_amethod(int *) STUB
#include "squid.h"
#if USE_WCCP
+#include "base/RunnersRegistry.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "event.h"
#include "fatal.h"
#include "SquidConfig.h"
-#include "wccp.h"
+#include "tools.h"
#define WCCP_PORT 2048
#define WCCP_REVISION 0
static EVH wccpHereIam;
static void wccpAssignBuckets(void);
-/*
- * The functions used during startup:
- * wccpInit
- * wccpConnectionOpen
- * wccpConnectionShutdown
- * wccpConnectionClose
- */
-
-void
+static void
wccpInit(void)
{
+ if (!IamPrimaryProcess())
+ return;
+
debugs(80, 5, "wccpInit: Called");
memset(&wccp_here_i_am, '\0', sizeof(wccp_here_i_am));
wccp_here_i_am.type = htonl(WCCP_HERE_I_AM);
eventAdd("wccpHereIam", wccpHereIam, nullptr, 5.0, 1);
}
-void
+static void
wccpConnectionOpen(void)
{
+ if (!IamPrimaryProcess())
+ return;
+
debugs(80, 5, "wccpConnectionOpen: Called");
if (Config.Wccp.router.isAnyAddr()) {
local_ip = local;
}
-void
+static void
wccpConnectionClose(void)
{
+ if (!IamPrimaryProcess())
+ return;
+
if (theWccpConnection > -1) {
debugs(80, DBG_IMPORTANT, "FD " << theWccpConnection << " Closing WCCPv1 socket");
comm_close(theWccpConnection);
}
}
+class WccpRr : public RegisteredRunner
+{
+public:
+ void useConfig() override { wccpInit(); wccpConnectionOpen(); }
+ void startReconfigure() override { wccpConnectionClose(); }
+ void syncConfig() override { wccpConnectionOpen(); }
+ void startShutdown() override { wccpConnectionClose(); }
+};
+DefineRunnerRegistrator(WccpRr);
+
/*
* Functions for handling the requests.
*/
+++ /dev/null
-/*
- * Copyright (C) 1996-2025 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 80 WCCP Support */
-
-#ifndef SQUID_SRC_WCCP_H
-#define SQUID_SRC_WCCP_H
-
-#if USE_WCCP
-void wccpInit(void);
-void wccpConnectionOpen(void);
-void wccpConnectionClose(void);
-#endif /* USE_WCCP */
-
-#endif /* SQUID_SRC_WCCP_H */
-
#include "squid.h"
#if USE_WCCPv2
-
+#include "base/RunnersRegistry.h"
#include "cache_cf.h"
#include "comm.h"
#include "comm/Connection.h"
#include "Parsing.h"
#include "SquidConfig.h"
#include "Store.h"
+#include "tools.h"
#include "wccp2.h"
#if HAVE_NETDB_H
return (memcmp(md5Digest, md5_challenge, SQUID_MD5_DIGEST_LENGTH) == 0);
}
-void
+static void
wccp2Init(void)
{
+ if (!IamPrimaryProcess())
+ return;
+
Ip::Address_list *s;
char *ptr;
uint32_t service_flags;
}
}
-void
+static void
wccp2ConnectionOpen(void)
{
+ if (!IamPrimaryProcess())
+ return;
+
struct sockaddr_in router, local, null;
socklen_t local_len, router_len;
wccp2_connected = 1;
}
-void
+static void
wccp2ConnectionClose(void)
{
+ if (!IamPrimaryProcess())
+ return;
struct wccp2_service_list_t *service_list_ptr;
wccp2_connected = 0;
}
+class Wccp2Rr : public RegisteredRunner
+{
+public:
+ void useConfig() override { wccp2Init(); wccp2ConnectionOpen(); }
+ void startReconfigure() override { wccp2ConnectionClose(); }
+ void syncConfig() override { wccp2ConnectionOpen(); }
+ void startShutdown() override { wccp2ConnectionClose(); }
+};
+DefineRunnerRegistrator(Wccp2Rr);
+
/*
* Functions for handling the requests.
*/
class StoreEntry;
-void wccp2Init(void);
-void wccp2ConnectionOpen(void);
-void wccp2ConnectionClose(void);
void parse_wccp2_method(int *v);
void free_wccp2_method(int *v);
void dump_wccp2_method(StoreEntry * e, const char *label, int v);