--------------------- PatchSet 1605 Date: 2001/02/18 08:13:44 Author: rbcollins Branch: rbcollins_filters Tag: (none) Log: merge module code from generic_modules Members: configure.in:1.1.1.3.8.11.2.4->1.1.1.3.8.11.2.5 src/Makefile.in:1.1.1.3.8.8.2.6->1.1.1.3.8.8.2.7 src/auth_modules.sh:1.2.6.1.4.1->1.2.6.1.4.2(DEAD) src/authenticate.c:1.1.1.3.8.4.4.2->1.1.1.3.8.4.4.3 src/cache_cf.c:1.1.1.3.4.1.4.7.4.10->1.1.1.3.4.1.4.7.4.11 src/cf.data.pre:1.1.1.3.4.1.4.11.4.7->1.1.1.3.4.1.4.11.4.8 src/conf_modules.sh:1.1.2.2->1.1.2.3(DEAD) src/internal_modules.sh:1.1->1.1.8.1 src/main.c:1.1.1.3.4.1.4.10.4.3->1.1.1.3.4.1.4.10.4.4 src/modules.c:1.1.2.2->1.1.2.3 src/protos.h:1.1.1.3.8.11.2.14->1.1.1.3.8.11.2.15 src/repl_modules.sh:1.1.18.1.4.1->1.1.18.1.4.2(DEAD) src/store.c:1.1.1.3.8.7.4.3->1.1.1.3.8.7.4.4 src/store_modules.sh:1.1.12.1.4.1->1.1.12.1.4.2(DEAD) src/structs.h:1.1.1.3.4.1.4.12.2.18->1.1.1.3.4.1.4.12.2.19 src/typedefs.h:1.1.1.3.8.7.4.16->1.1.1.3.8.7.4.17 src/auth/basic/auth_basic.c:1.3.2.2.4.2->1.3.2.2.4.3 src/auth/digest/auth_digest.c:1.2.4.1->1.2.4.2 src/auth/ntlm/auth_ntlm.c:1.4.2.2.4.1->1.4.2.2.4.2 src/fs/aufs/store_dir_aufs.c:1.1.12.6.4.2->1.1.12.6.4.3 src/fs/coss/store_dir_coss.c:1.1.10.7.4.2->1.1.10.7.4.3 src/fs/diskd/store_dir_diskd.c:1.1.12.8.4.2->1.1.12.8.4.3 src/fs/null/store_null.c:1.2.12.1->1.2.12.2 src/fs/ufs/store_dir_ufs.c:1.1.12.6.4.2->1.1.12.6.4.3 src/repl/heap/store_repl_heap.c:1.1.18.3.4.2->1.1.18.3.4.3 src/repl/lru/store_repl_lru.c:1.1.18.3.4.2->1.1.18.3.4.3 Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.1.1.3.8.11.2.4 retrieving revision 1.1.1.3.8.11.2.5 diff -u -r1.1.1.3.8.11.2.4 -r1.1.1.3.8.11.2.5 --- squid/configure.in 18 Feb 2001 05:13:47 -0000 1.1.1.3.8.11.2.4 +++ squid/configure.in 18 Feb 2001 08:13:44 -0000 1.1.1.3.8.11.2.5 @@ -3,13 +3,13 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.1.1.3.8.11.2.4 2001/02/18 05:13:47 rbcollins Exp $ +dnl $Id: configure.in,v 1.1.1.3.8.11.2.5 2001/02/18 08:13:44 rbcollins Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.1.1.3.8.11.2.4 $)dnl +AC_REVISION($Revision: 1.1.1.3.8.11.2.5 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -854,6 +854,37 @@ AC_SUBST(CONF_MODULE_LIBS) fi +dnl Select generic modules to build +dnl we may inherit preset CONF_MODULES from AUTH & FS & REPL above +AC_ARG_ENABLE(modules, +[ --enable-modules=\"list of modules\" + This option selects which generic modules to build. + Generic modules can plugin into several parts of squid + and autoregister their capabilities with squid. For a list + of available modules see the src/modules directory.], +[ case "$enableval" in + yes) + for module in $srcdir/src/modules/*; do + if test -f $module/Makefile.in; then + CONF_MODULES="$CONF_MODULES `basename $module`" + fi + done + ;; + no) + ;; + *) + CONF_MODULES="`echo $enableval|sed -e 's/,/ /g;s/ */ /g'`" + esac +]) +if test -n "$CONF_MODULES"; then + echo "Generic modules built: $CONF_MODULES" + AC_SUBST(CONF_MODULES) + CONF_MODULE_OBJS="modules/`echo $CONF_MODULES|sed -e's% %.a modules/%g'`.a" + AC_SUBST(CONF_MODULE_OBJS) + CONF_MODULE_LIBS="`echo $CONF_MODULE_OBJS|sed -e's%module/%%g'`" + AC_SUBST(CONF_MODULE_LIBS) +fi + dnl Disable "unlinkd" code AC_ARG_ENABLE(unlinkd, [ --disable-unlinkd Do not use unlinkd], @@ -1879,6 +1910,15 @@ done +MOD_MAKEFILES="" +for module in `find $srcdir/src/modules -type d -print`; do + if test -f $module/Makefile.in; then + dir=`echo $module | sed -e "s|^$srcdir/||"` + MOD_MAKEFILES="$MOD_MAKEFILES ./$dir/Makefile" + fi +done + + AC_OUTPUT(\ ./makefile \ ./lib/Makefile \ Index: squid/src/Makefile.in =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/Makefile.in,v retrieving revision 1.1.1.3.8.8.2.6 retrieving revision 1.1.1.3.8.8.2.7 diff -u -r1.1.1.3.8.8.2.6 -r1.1.1.3.8.8.2.7 --- squid/src/Makefile.in 18 Feb 2001 05:16:20 -0000 1.1.1.3.8.8.2.6 +++ squid/src/Makefile.in 18 Feb 2001 08:13:44 -0000 1.1.1.3.8.8.2.7 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.1.1.3.8.8.2.6 2001/02/18 05:16:20 rbcollins Exp $ +# $Id: Makefile.in,v 1.1.1.3.8.8.2.7 2001/02/18 08:13:44 rbcollins Exp $ # # Uncomment and customize the following to suit your needs: # @@ -94,7 +94,6 @@ access_log.o \ acl.o \ asn.o \ - auth_modules.o \ authenticate.o \ cache_cf.o \ CacheDigest.o \ @@ -105,7 +104,6 @@ client_side.o \ comm.o \ comm_select.o \ - conf_modules.o \ debug.o \ @DELAY_OBJS@ \ disk.o \ @@ -139,6 +137,7 @@ icp_v3.o \ ident.o \ internal.o \ + internal_modules.o \ ipc.o \ ipcache.o \ @LEAKFINDER_OBJS@ \ @@ -159,7 +158,6 @@ redirect.o \ referer.o \ refresh.o \ - repl_modules.o \ send-announce.o \ @SNMP_OBJS@ \ ssl.o \ @@ -174,7 +172,6 @@ store_dir.o \ store_key_md5.o \ store_log.o \ - store_modules.o \ store_rebuild.o \ store_swapin.o \ store_swapmeta.o \ @@ -216,8 +213,8 @@ $(SNMP_OBJS): ../snmplib/libsnmp.a $(top_srcdir)/include/cache_snmp.h -$(SQUID_EXE): $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(CONF_MODULE_OBJS) - $(CC) -o $@ $(LDFLAGS) $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(CONF_MODULE_OBJS) $(SQUID_LIBS) +$(SQUID_EXE): $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(INTERNAL_MODULE_OBJS) + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(INTERNAL_MODULE_OBJS) $(SQUID_LIBS) globals.o: globals.c Makefile $(CC) -c globals.c $(CFLAGS) -I$(srcdir) $(DEFAULTS) @@ -285,43 +282,25 @@ s%@DEFAULT_PREFIX@%$(DEFAULT_PREFIX)%g;"\ < $(srcdir)/cf.data.pre >$@ -store_modules.c: store_modules.sh Makefile - sh $(srcdir)/store_modules.sh $(STORE_MODULES) >store_modules.c - -store_modules.o: store_modules.c - $(CC) -c store_modules.c $(CFLAGS) -I$(srcdir) - $(STORE_OBJS): @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" -repl_modules.c: repl_modules.sh Makefile - sh $(srcdir)/repl_modules.sh $(REPL_POLICIES) >repl_modules.c - -repl_modules.o: repl_modules.c - $(CC) -c repl_modules.c $(CFLAGS) -I$(srcdir) - $(REPL_OBJS): @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" repl_modules repl/stamp: @sh -c "cd repl && $(MAKE) all" -auth_modules.c: auth_modules.sh Makefile - sh $(srcdir)/auth_modules.sh $(AUTH_MODULES) >auth_modules.c - -auth_modules.o: auth_modules.c - $(CC) -c auth_modules.c $(CFLAGS) -I$(srcdir) - $(AUTH_OBJS): @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" -conf_modules.c: conf_modules.sh Makefile - sh $(srcdir)/conf_modules.sh $(CONF_MODULES) >conf_modules.c +internal_modules.c: internal_modules.sh Makefile + sh $(srcdir)/internal_modules.sh $(INTERNAL_MODULES) $(AUTH_MODULES) $(REPL_POLICIES) $(STORE_MODULES) >internal_modules.c -conf_modules.o: conf_modules.c - $(CC) -c conf_modules.c $(CFLAGS) -I$(srcdir) +internal_modules.o: internal_modules.c + $(CC) -c internal_modules.c $(CFLAGS) -I$(srcdir) -$(CONF_MODULE_OBJS): +$(INTERNAL_MODULE_OBJS): @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" install-mkdirs: @@ -432,7 +411,7 @@ clean: -rm -rf *.o *pure_* core $(PROGS) $(UTILS) $(CGIPROGS) $(SUID_UTILS) -rm -f cf_gen cf_gen_defines.h cf_parser.c cf.data globals.c string_arrays.c - -rm -f store_modules.c repl_modules.c auth_modules.c conf_modules.c squid.conf + -rm -f internal_modules.c squid.conf @for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir..."; \ (cd $$dir ; $(MAKE) $(MFLAGS) prefix="$(prefix)" $@) || exit 1; \ Index: squid/src/authenticate.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/authenticate.c,v retrieving revision 1.1.1.3.8.4.4.2 retrieving revision 1.1.1.3.8.4.4.3 diff -u -r1.1.1.3.8.4.4.2 -r1.1.1.3.8.4.4.3 --- squid/src/authenticate.c 13 Feb 2001 15:19:21 -0000 1.1.1.3.8.4.4.2 +++ squid/src/authenticate.c 18 Feb 2001 08:13:44 -0000 1.1.1.3.8.4.4.3 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.1.1.3.8.4.4.2 2001/02/13 15:19:21 rbcollins Exp $ + * $Id: authenticate.c,v 1.1.1.3.8.4.4.3 2001/02/18 08:13:44 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -343,12 +343,6 @@ } void -authenticateSchemeInit(void) -{ - authSchemeSetup(); -} - -void authenticateInit(authConfig * config) { int i; @@ -633,7 +627,7 @@ * called to add another auth scheme module */ void -authSchemeAdd(char *type, AUTHSSETUP * setup) +authSchemeAdd(const char *type, AUTHSSETUP * setup) { int i; debug(29, 4) ("authSchemeAdd: adding %s", type); Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.1.1.3.4.1.4.7.4.10 retrieving revision 1.1.1.3.4.1.4.7.4.11 diff -u -r1.1.1.3.4.1.4.7.4.10 -r1.1.1.3.4.1.4.7.4.11 --- squid/src/cache_cf.c 13 Feb 2001 15:19:21 -0000 1.1.1.3.4.1.4.7.4.10 +++ squid/src/cache_cf.c 18 Feb 2001 08:13:44 -0000 1.1.1.3.4.1.4.7.4.11 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.1.1.3.4.1.4.7.4.10 2001/02/13 15:19:21 rbcollins Exp $ + * $Id: cache_cf.c,v 1.1.1.3.4.1.4.7.4.11 2001/02/18 08:13:44 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1266,6 +1266,128 @@ } + +CBDATA_TYPE(modNode); +/* Operation of modNode cbdata: + * config allocates the record, and free frees it. + * any configuration that depends on the record + * locks it and + * any matching free configuration + * unlocks it + */ + +const char * +mod_type_str(const mod_t type) +{ + switch (type) { + case MOD_INTERNAL: + return "internal"; + break; + case MOD_EXTERNAL: + return "external"; + break; + default: + return "unknown"; + break; + } +} + + +/* TODO: write a cbdataFree handler for modNode's. */ +static void +parse_mod_install(modConfig * cfg) +{ + char *type_str = NULL, *name_str = NULL; + mod_t type = MOD_NONE; + modNode *node = NULL; + dlink_node *linknode; + + int rv; + + linknode = cfg->modules.head; + if (!linknode) + /* first run */ + CBDATA_INIT_TYPE(modNode); + + if ((type_str = strtok(NULL, w_space)) == NULL) + self_destruct(); + + if ((name_str = strtok(NULL, w_space)) == NULL) + self_destruct(); + + /* find the module if it's currently configured */ + while (linknode && strcasecmp((*(modNode *) (linknode->data)).namestr, name_str)) { + linknode = linknode->next; + } + + if (linknode == NULL) { + /* ignore the type if it is already configured. */ + if (strcasecmp(type_str, "internal") == 0) { + /* internal module */ + type = MOD_INTERNAL; + } else if (strcasecmp(type_str, "external") == 0) { + /* external module */ + debug(3, 0) ("external modules not supported yet\n"); + } + if (type == MOD_NONE) + self_destruct(); + + node = CBDATA_ALLOC(modNode, NULL); + assert(node); + node->type = type; + node->namestr = xstrdup(name_str); + if (type == MOD_INTERNAL) + rv = mod_internal_install(node->namestr, node); +#if 0 + else if (type == MOD_EXTERNAL) + rv = mod_external_install(node->namestr, node); +#endif + else + rv = 0; + if (rv) + dlinkAddTail(node, &node->node, &cfg->modules); + else { + safe_free(node->namestr); + cbdataFree(node); + } + } else { + node = linknode->data; + } + /* call the modules configuration routine, if any */ + +} + +static void +free_mod_install(modConfig * cfg) +{ + dlink_node *node, *tmpnode; + modNode *module; + node = cfg->modules.head; + while (node) { + tmpnode = node; + module = node->data; + node = node->next; + if (module->uninstall(module->namestr)) { + dlinkDelete(tmpnode, &cfg->modules); + safe_free(module->namestr); + cbdataFree(module); + } + } +} + +static void +dump_mod_install(StoreEntry * entry, const char *name, modConfig cfg) +{ + dlink_node *node; + modNode *module; + node = cfg.modules.head; + while (node) { + module = node->data; + storeAppendPrintf(entry, "mod_install %s %s\n",mod_type_str(module->type),module->namestr); + node = node->next; + } +} + void allocate_new_swapdir(cacheSwap * swap) { Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.1.1.3.4.1.4.11.4.7 retrieving revision 1.1.1.3.4.1.4.11.4.8 diff -u -r1.1.1.3.4.1.4.11.4.7 -r1.1.1.3.4.1.4.11.4.8 --- squid/src/cf.data.pre 13 Feb 2001 15:19:21 -0000 1.1.1.3.4.1.4.11.4.7 +++ squid/src/cf.data.pre 18 Feb 2001 08:13:44 -0000 1.1.1.3.4.1.4.11.4.8 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.1.1.3.4.1.4.11.4.7 2001/02/13 15:19:21 rbcollins Exp $ +# $Id: cf.data.pre,v 1.1.1.3.4.1.4.11.4.8 2001/02/18 08:13:44 rbcollins Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -68,6 +68,46 @@ COMMENT_START + MODULE OPTIONS + ----------------------------------------------------------------------------- + Squid's module architecture allows dynamic addition and removal + of code from the code base. Modules _must_ be registered before they + are used or referenced (even from other config lines). +COMMENT_END + +NAME: mod_register +TYPE: mod_install +DEFAULT: none +LOC: Config.modules +DOC_START + usage: mod_register internal|external modulename + + External modules are not implemented yet. +NOCOMMENT_START +# Uncomment the following modules to match your compiled internal modules. +# The ones currently uncommented are for the default squid configure & build. + +# replacement policy modules +mod_register internal lru +#mod_register internal heap + +# object store modules +mod_register internal ufs +#mod_register internal aufs +#mod_register internal diskd +#mod_register internal null +#mod_register internal coss + +# authentication scheme modules +mod_register internal basic +#mod_register internal ntlm +#mod_register internal digest + +NOCOMMENT_END +DOC_END + + +COMMENT_START NETWORK OPTIONS ----------------------------------------------------------------------------- COMMENT_END --- squid/src/conf_modules.sh Wed Feb 14 00:50:36 2007 +++ /dev/null Wed Feb 14 00:50:05 2007 @@ -1,21 +0,0 @@ -#!/bin/sh -echo "/* automatically generated by $0 $*" -echo " * do not edit" -echo " */" -echo "#include \"squid.h\"" -echo "" -for module in "$@"; do - echo "extern MOD_INSTALL mod_install_${module};" - echo "extern MOD_UNINSTALL mod_uninstall_${module};" -done -echo "int mod_internal_install(const char *namestr, modNode *module)" -echo "{" -for module in "$@"; do - echo " if (strcasecmp(namestr,\"$module\")==0) {" - echo " mod_register(\"$module\", mod_install_${module}, mod_uninstall_${module}, module);" - echo " return -1;" - echo " } else" -done -echo " debug(3,0)(\"mod_internal_install: unrecognised module '%s'.\n\",namestr);" -echo " return 0;" -echo "}" --- /dev/null Wed Feb 14 00:50:05 2007 +++ squid/src/internal_modules.sh Wed Feb 14 00:50:36 2007 @@ -0,0 +1,21 @@ +#!/bin/sh +echo "/* automatically generated by $0 $*" +echo " * do not edit" +echo " */" +echo "#include \"squid.h\"" +echo "" +for module in "$@"; do + echo "extern MOD_INSTALL mod_install_${module};" + echo "extern MOD_UNINSTALL mod_uninstall_${module};" +done +echo "int mod_internal_install(const char *namestr, modNode *module)" +echo "{" +for module in "$@"; do + echo " if (strcasecmp(namestr,\"$module\")==0) {" + echo " mod_register(\"$module\", mod_install_${module}, mod_uninstall_${module}, module);" + echo " return -1;" + echo " } else" +done +echo " debug(3,0)(\"mod_internal_install: unrecognised module '%s'.\n\",namestr);" +echo " return 0;" +echo "}" Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.1.1.3.4.1.4.10.4.3 retrieving revision 1.1.1.3.4.1.4.10.4.4 diff -u -r1.1.1.3.4.1.4.10.4.3 -r1.1.1.3.4.1.4.10.4.4 --- squid/src/main.c 5 Feb 2001 13:37:12 -0000 1.1.1.3.4.1.4.10.4.3 +++ squid/src/main.c 18 Feb 2001 08:13:44 -0000 1.1.1.3.4.1.4.10.4.4 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.1.1.3.4.1.4.10.4.3 2001/02/05 13:37:12 rbcollins Exp $ + * $Id: main.c,v 1.1.1.3.4.1.4.10.4.4 2001/02/18 08:13:44 rbcollins Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -622,8 +622,6 @@ memInit(); cbdataInit(); eventInit(); /* eventInit() is required for config parsing */ - storeFsInit(); /* required for config parsing */ - authenticateSchemeInit(); /* required for config parsign */ parse_err = parseConfigFile(ConfigFile); if (opt_parse_cfg_only) Index: squid/src/modules.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/modules.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/modules.c 31 Jan 2001 12:41:52 -0000 1.1.2.2 +++ squid/src/modules.c 18 Feb 2001 08:13:45 -0000 1.1.2.3 @@ -33,6 +33,15 @@ * */ + +/* TEMPORARY HOME FOR DOCUMENTATION: + * + * the uninstall function returns true for 'I uninstalled succesfully' and + * not true for 'I didn't uninstall'. Some modules may not uninstall ever, + * and some may only uninstall if there are no references - it's + * up to the module. + */ + #include "squid.h" void Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.1.1.3.8.11.2.14 retrieving revision 1.1.1.3.8.11.2.15 diff -u -r1.1.1.3.8.11.2.14 -r1.1.1.3.8.11.2.15 --- squid/src/protos.h 13 Feb 2001 15:19:22 -0000 1.1.1.3.8.11.2.14 +++ squid/src/protos.h 18 Feb 2001 08:13:45 -0000 1.1.1.3.8.11.2.15 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.1.1.3.8.11.2.14 2001/02/13 15:19:22 rbcollins Exp $ + * $Id: protos.h,v 1.1.1.3.8.11.2.15 2001/02/18 08:13:45 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -720,15 +720,11 @@ extern void redirectInit(void); extern void redirectShutdown(void); -/* auth_modules.c */ -extern void authSchemeSetup(void); - /* authenticate.c */ extern void authenticateAuthUserMerge(auth_user_t *, auth_user_t *); extern auth_user_t *authenticateAuthUserNew(const char *); extern int authenticateAuthSchemeId(const char *typestr); extern void authenticateStart(auth_user_request_t *, RH *, void *); -extern void authenticateSchemeInit(void); extern void authenticateInit(authConfig *); extern void authenticateShutdown(void); extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, request_t *, int); @@ -757,7 +753,7 @@ extern char *authenticateUserRequestUsername(auth_user_request_t *); extern int authenticateValidateUser(auth_user_request_t *); extern void authenticateOnCloseConnection(ConnStateData * conn); -extern void authSchemeAdd(char *type, AUTHSSETUP * setup); +extern void authSchemeAdd(const char *type, AUTHSSETUP * setup); extern void refreshAddToList(const char *, int, time_t, int, time_t); extern int refreshIsCachable(const StoreEntry *); @@ -917,16 +913,9 @@ extern void storeEntryReset(StoreEntry *); extern void storeHeapPositionUpdate(StoreEntry *, SwapDir *); extern void storeSwapFileNumberSet(StoreEntry * e, sfileno filn); -extern void storeFsInit(void); extern void storeFsDone(void); -extern void storeFsAdd(char *, STSETUP *); -extern void storeReplAdd(char *, REMOVALPOLICYCREATE *); - -/* store_modules.c */ -extern void storeFsSetup(void); - -/* repl_modules.c */ -extern void storeReplSetup(void); +extern void storeFsAdd(const char *, STSETUP *); +extern void storeReplAdd(const char *, REMOVALPOLICYCREATE *); /* store_io.c */ extern storeIOState *storeCreate(StoreEntry *, STFNCB *, STIOCB *, void *); @@ -1300,6 +1289,12 @@ */ extern StatCounters *snmpStatGet(int); + +/* internal_modules.sh */ +extern int mod_internal_install(const char *, modNode *); +/* modules.c */ +extern void mod_register(const char * namestr, MOD_INSTALL *, MOD_UNINSTALL *, modNode *); + /* * transfer_encoding.c */ @@ -1312,12 +1307,6 @@ extern void te_build_decode_xlate_list(HttpHeader * hdr, dlink_list *); extern void te_build_encode_xlate_list(const HttpHeader *ohdr, HttpHeader *hdr, dlink_list *, http_version_t http_ver, request_flags *flags); - -/* conf_modules.sh */ -extern int mod_internal_install(const char *, modNode *); -/* modules.c */ -extern void mod_register(const char * namestr, MOD_INSTALL *, MOD_UNINSTALL *, modNode *); - /* filters.c */ extern FILTER_module *filterByName(const char *namestr); extern FILTER_instance *filterInstanceByName(const char *namestr, FILTER_instance **); Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.1.1.3.8.7.4.3 retrieving revision 1.1.1.3.8.7.4.4 diff -u -r1.1.1.3.8.7.4.3 -r1.1.1.3.8.7.4.4 --- squid/src/store.c 12 Feb 2001 13:31:24 -0000 1.1.1.3.8.7.4.3 +++ squid/src/store.c 18 Feb 2001 08:13:45 -0000 1.1.1.3.8.7.4.4 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.1.1.3.8.7.4.3 2001/02/12 13:31:24 rbcollins Exp $ + * $Id: store.c,v 1.1.1.3.8.7.4.4 2001/02/18 08:13:45 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -1236,21 +1236,6 @@ } /* - * storeFsInit - * - * This routine calls the SETUP routine for each fs type. - * I don't know where the best place for this is, and I'm not going to shuffle - * around large chunks of code right now (that can be done once its working.) - */ -void -storeFsInit(void) -{ - storeReplSetup(); - storeFsSetup(); -} - - -/* * similar to above, but is called when a graceful shutdown is to occur * of each fs module. */ @@ -1269,7 +1254,7 @@ * called to add another store fs module */ void -storeFsAdd(char *type, STSETUP * setup) +storeFsAdd(const char *type, STSETUP * setup) { int i; /* find the number of currently known storefs types */ @@ -1288,7 +1273,7 @@ * called to add another store removal policy module */ void -storeReplAdd(char *type, REMOVALPOLICYCREATE * create) +storeReplAdd(const char *type, REMOVALPOLICYCREATE * create) { int i; /* find the number of currently known repl types */ Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.1.1.3.4.1.4.12.2.18 retrieving revision 1.1.1.3.4.1.4.12.2.19 diff -u -r1.1.1.3.4.1.4.12.2.18 -r1.1.1.3.4.1.4.12.2.19 --- squid/src/structs.h 18 Feb 2001 01:14:10 -0000 1.1.1.3.4.1.4.12.2.18 +++ squid/src/structs.h 18 Feb 2001 08:13:45 -0000 1.1.1.3.4.1.4.12.2.19 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.1.1.3.4.1.4.12.2.18 2001/02/18 01:14:10 rbcollins Exp $ + * $Id: structs.h,v 1.1.1.3.4.1.4.12.2.19 2001/02/18 08:13:45 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -133,7 +133,7 @@ */ struct _authscheme_entry { - char *typestr; + const char *typestr; AUTHSACTIVE *Active; AUTHSADDHEADER *AddHeader; AUTHSADDTRAILER *AddTrailer; @@ -163,7 +163,7 @@ /* private data types */ struct _authScheme { /* pointer to the authscheme_list's string entry */ - char *typestr; + const char *typestr; /* the scheme id in the authscheme_list */ int Id; /* the scheme's configuration details. */ @@ -1536,7 +1536,7 @@ }; struct _SwapDir { - char *type; + const char *type; int cur_size; int low_size; int max_size; @@ -2140,7 +2140,7 @@ */ struct _storefs_entry { - char *typestr; + const char *typestr; STFSPARSE *parsefunc; STFSRECONFIGURE *reconfigurefunc; STFSSHUTDOWN *donefunc; @@ -2151,7 +2151,7 @@ */ struct _storerepl_entry { - char *typestr; + const char *typestr; REMOVALPOLICYCREATE *create; }; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.1.1.3.8.7.4.16 retrieving revision 1.1.1.3.8.7.4.17 diff -u -r1.1.1.3.8.7.4.16 -r1.1.1.3.8.7.4.17 --- squid/src/typedefs.h 18 Feb 2001 01:14:10 -0000 1.1.1.3.8.7.4.16 +++ squid/src/typedefs.h 18 Feb 2001 08:13:45 -0000 1.1.1.3.8.7.4.17 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.1.1.3.8.7.4.16 2001/02/18 01:14:10 rbcollins Exp $ + * $Id: typedefs.h,v 1.1.1.3.8.7.4.17 2001/02/18 08:13:45 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -388,4 +388,13 @@ +/* modules.c */ +typedef struct _modConfig modConfig; +typedef struct _modNode modNode; + +/* name to register under */ +typedef void MOD_INSTALL(const char *); +typedef unsigned int MOD_UNINSTALL(const char *); + + #endif /* _TYPEDEFS_H_ */ Index: squid/src/auth/basic/auth_basic.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/basic/auth_basic.c,v retrieving revision 1.3.2.2.4.2 retrieving revision 1.3.2.2.4.3 diff -u -r1.3.2.2.4.2 -r1.3.2.2.4.3 --- squid/src/auth/basic/auth_basic.c 13 Feb 2001 15:19:23 -0000 1.3.2.2.4.2 +++ squid/src/auth/basic/auth_basic.c 18 Feb 2001 08:13:45 -0000 1.3.2.2.4.3 @@ -81,9 +81,24 @@ * */ -AUTHSSETUP authSchemeSetup_basic; +static AUTHSSETUP authSchemeSetup_basic; +/* register as a module */ void +mod_install_basic (const char *namestr) +{ + authSchemeAdd(namestr, authSchemeSetup_basic); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_basic(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} + + +static void authSchemeSetup_basic(authscheme_entry_t * authscheme) { assert(!authbasic_initialised); Index: squid/src/auth/digest/auth_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/digest/auth_digest.c,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -u -r1.2.4.1 -r1.2.4.2 --- squid/src/auth/digest/auth_digest.c 5 Feb 2001 13:37:37 -0000 1.2.4.1 +++ squid/src/auth/digest/auth_digest.c 18 Feb 2001 08:13:45 -0000 1.2.4.2 @@ -48,6 +48,9 @@ cbdataFree(r); } +/* register with the authentication framework */ +static AUTHSSETUP authSchemeSetup_digest; + /* Digest Scheme */ static HLPCB authenticateDigestHandleReply; @@ -571,7 +574,21 @@ name, "digest", config->nonceGCInterval); } +/* register as a module */ void +mod_install_digest (const char *namestr) +{ + authSchemeAdd(namestr, authSchemeSetup_digest); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_digest(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} + +static void authSchemeSetup_digest(authscheme_entry_t * authscheme) { assert(!authdigest_initialised); Index: squid/src/auth/ntlm/auth_ntlm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/auth_ntlm.c,v retrieving revision 1.4.2.2.4.1 retrieving revision 1.4.2.2.4.2 diff -u -r1.4.2.2.4.1 -r1.4.2.2.4.2 --- squid/src/auth/ntlm/auth_ntlm.c 5 Feb 2001 13:37:40 -0000 1.4.2.2.4.1 +++ squid/src/auth/ntlm/auth_ntlm.c 18 Feb 2001 08:13:45 -0000 1.4.2.2.4.2 @@ -47,6 +47,9 @@ cbdataFree(r); } +/* register with the authentication framework */ +static AUTHSSETUP authSchemeSetup_ntlm; + /* NTLM Scheme */ static HLPSCB authenticateNTLMHandleReply; static HLPSCB authenticateNTLMHandleplaceholder; @@ -86,6 +89,25 @@ static hash_table *proxy_auth_cache = NULL; +/* + * Module support + */ + +/* register as a module */ +void +mod_install_ntlm (const char *namestr) +{ + authSchemeAdd(namestr, authSchemeSetup_ntlm); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_ntlm(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} + + /* * * Private Functions @@ -183,7 +205,7 @@ } -void +static void authSchemeSetup_ntlm(authscheme_entry_t * authscheme) { assert(!authntlm_initialised); Index: squid/src/fs/aufs/store_dir_aufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/store_dir_aufs.c,v retrieving revision 1.1.12.6.4.2 retrieving revision 1.1.12.6.4.3 diff -u -r1.1.12.6.4.2 -r1.1.12.6.4.3 --- squid/src/fs/aufs/store_dir_aufs.c 13 Feb 2001 15:19:23 -0000 1.1.12.6.4.2 +++ squid/src/fs/aufs/store_dir_aufs.c 18 Feb 2001 08:13:45 -0000 1.1.12.6.4.3 @@ -118,8 +118,22 @@ static void storeAufsDirInitBitmap(SwapDir *); static int storeAufsDirValidFileno(SwapDir *, sfileno, int); -/* The MAIN externally visible function */ -STSETUP storeFsSetup_aufs; +static STSETUP storeFsSetup_aufs; + +/* register as a module + */ +void +mod_install_aufs (const char *namestr) +{ + storeFsAdd(namestr, storeFsSetup_aufs); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_aufs(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} /* * These functions were ripped straight out of the heart of store_dir.c. @@ -1700,7 +1714,7 @@ asyncufs_initialised = 0; } -void +static void storeFsSetup_aufs(storefs_entry_t * storefs) { assert(!asyncufs_initialised); Index: squid/src/fs/coss/store_dir_coss.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/coss/store_dir_coss.c,v retrieving revision 1.1.10.7.4.2 retrieving revision 1.1.10.7.4.3 diff -u -r1.1.10.7.4.2 -r1.1.10.7.4.3 --- squid/src/fs/coss/store_dir_coss.c 13 Feb 2001 15:19:23 -0000 1.1.10.7.4.2 +++ squid/src/fs/coss/store_dir_coss.c 18 Feb 2001 08:13:45 -0000 1.1.10.7.4.3 @@ -87,8 +87,22 @@ static STFSRECONFIGURE storeCossDirReconfigure; static STDUMP storeCossDirDump; -/* The "only" externally visible function */ -STSETUP storeFsSetup_coss; +static STSETUP storeFsSetup_coss; + +/* register as a module + */ +void +mod_install_coss (const char *namestr) +{ + storeFsAdd(namestr, storeFsSetup_coss); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_coss(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} static char * storeCossDirSwapLogFile(SwapDir * sd, const char *ext) @@ -853,7 +867,7 @@ coss_initialised = 0; } -void +static void storeFsSetup_coss(storefs_entry_t * storefs) { assert(!coss_initialised); Index: squid/src/fs/diskd/store_dir_diskd.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/diskd/store_dir_diskd.c,v retrieving revision 1.1.12.8.4.2 retrieving revision 1.1.12.8.4.3 diff -u -r1.1.12.8.4.2 -r1.1.12.8.4.3 --- squid/src/fs/diskd/store_dir_diskd.c 13 Feb 2001 15:19:24 -0000 1.1.12.8.4.2 +++ squid/src/fs/diskd/store_dir_diskd.c 18 Feb 2001 08:13:45 -0000 1.1.12.8.4.3 @@ -128,8 +128,22 @@ static void storeDiskdStats(StoreEntry * sentry); static void storeDiskdDirSync(SwapDir *); -/* The only externally visible interface */ -STSETUP storeFsSetup_diskd; +static STSETUP storeFsSetup_diskd; + +/* register as a module + */ +void +mod_install_diskd (const char *namestr) +{ + storeFsAdd(namestr, storeFsSetup_diskd); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_diskd(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} /* * These functions were ripped straight out of the heart of store_dir.c. @@ -1946,7 +1960,7 @@ diskd_initialised = 0; } -void +static void storeFsSetup_diskd(storefs_entry_t * storefs) { assert(!diskd_initialised); Index: squid/src/fs/null/store_null.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/null/store_null.c,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -u -r1.2.12.1 -r1.2.12.2 --- squid/src/fs/null/store_null.c 13 Feb 2001 15:19:24 -0000 1.2.12.1 +++ squid/src/fs/null/store_null.c 18 Feb 2001 08:13:46 -0000 1.2.12.2 @@ -49,8 +49,22 @@ static STLOGCLEANDONE storeNullDirWriteCleanDone; static EVH storeNullDirRebuildComplete; -/* The only externally visible interface */ -STSETUP storeFsSetup_null; +static STSETUP storeFsSetup_null; + +/* register as a module + */ +void +mod_install_null (const char *namestr) +{ + storeFsAdd(namestr, storeFsSetup_null); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_null(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} static void storeNullDirReconfigure(SwapDir * sd, int index, char *path) @@ -118,7 +132,7 @@ /* Setup and register the store module */ -void +static void storeFsSetup_null(storefs_entry_t * storefs) { assert(!null_initialised); Index: squid/src/fs/ufs/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_dir_ufs.c,v retrieving revision 1.1.12.6.4.2 retrieving revision 1.1.12.6.4.3 diff -u -r1.1.12.6.4.2 -r1.1.12.6.4.3 --- squid/src/fs/ufs/store_dir_ufs.c 13 Feb 2001 15:19:25 -0000 1.1.12.6.4.2 +++ squid/src/fs/ufs/store_dir_ufs.c 18 Feb 2001 08:13:46 -0000 1.1.12.6.4.3 @@ -116,7 +116,22 @@ static void storeUfsDirInitBitmap(SwapDir *); static int storeUfsDirValidFileno(SwapDir *, sfileno, int); -STSETUP storeFsSetup_ufs; +static STSETUP storeFsSetup_ufs; + +/* register as a module + */ +void +mod_install_ufs (const char *namestr) +{ + storeFsAdd(namestr, storeFsSetup_ufs); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_ufs(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} /* * These functions were ripped straight out of the heart of store_dir.c. @@ -1689,7 +1704,7 @@ ufs_initialised = 0; } -void +static void storeFsSetup_ufs(storefs_entry_t * storefs) { assert(!ufs_initialised); Index: squid/src/repl/heap/store_repl_heap.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/heap/store_repl_heap.c,v retrieving revision 1.1.18.3.4.2 retrieving revision 1.1.18.3.4.3 diff -u -r1.1.18.3.4.2 -r1.1.18.3.4.3 --- squid/src/repl/heap/store_repl_heap.c 13 Feb 2001 15:19:25 -0000 1.1.18.3.4.2 +++ squid/src/repl/heap/store_repl_heap.c 18 Feb 2001 08:13:46 -0000 1.1.18.3.4.3 @@ -37,7 +37,26 @@ #include "heap.h" #include "store_heap_replacement.h" -REMOVALPOLICYCREATE createRemovalPolicy_heap; +static REMOVALPOLICYCREATE createRemovalPolicy_heap; + +/* Module Support + */ + +/* register as a module + */ +void +mod_install_heap (const char *namestr) +{ + storeReplAdd(namestr, createRemovalPolicy_heap); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_heap(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} + static int nr_heap_policies = 0; @@ -255,7 +274,7 @@ cbdataFree(policy); } -RemovalPolicy * +static RemovalPolicy * createRemovalPolicy_heap(wordlist * args) { RemovalPolicy *policy; Index: squid/src/repl/lru/store_repl_lru.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/lru/store_repl_lru.c,v retrieving revision 1.1.18.3.4.2 retrieving revision 1.1.18.3.4.3 diff -u -r1.1.18.3.4.2 -r1.1.18.3.4.3 --- squid/src/repl/lru/store_repl_lru.c 13 Feb 2001 15:19:25 -0000 1.1.18.3.4.2 +++ squid/src/repl/lru/store_repl_lru.c 18 Feb 2001 08:13:46 -0000 1.1.18.3.4.3 @@ -35,7 +35,7 @@ #include "squid.h" -REMOVALPOLICYCREATE createRemovalPolicy_lru; +static REMOVALPOLICYCREATE createRemovalPolicy_lru; typedef struct _LruPolicyData LruPolicyData; struct _LruPolicyData { @@ -48,6 +48,26 @@ } type; }; + +/* Module Support + */ + +/* register as a module + */ +void +mod_install_lru (const char *namestr) +{ + storeReplAdd(namestr, createRemovalPolicy_lru); +} + +/* deregister as a module */ +unsigned int +mod_uninstall_lru(const char *namestr) { + /* deregistration not supported for this module */ + return 0; +} + + /* Hack to avoid having to remember the RemovalPolicyNode location. * Needed by the purge walker to clear the policy information */ @@ -256,7 +276,7 @@ cbdataFree(policy); } -RemovalPolicy * +static RemovalPolicy * createRemovalPolicy_lru(wordlist * args) { RemovalPolicy *policy;