--------------------- PatchSet 1800 Date: 2001/03/31 11:12:14 Author: rbcollins Branch: rbcollins_filters Tag: (none) Log: partial update to new configure code Members: src/cache_cf.c:1.1.1.3.4.1.4.7.4.13->1.1.1.3.4.1.4.7.4.14 src/structs.h:1.1.1.3.4.1.4.12.2.20->1.1.1.3.4.1.4.12.2.21 src/typedefs.h:1.1.1.3.8.7.4.20->1.1.1.3.8.7.4.21 src/modules/textreplace/textreplace.c:1.1.2.12->1.1.2.13 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.13 retrieving revision 1.1.1.3.4.1.4.7.4.14 diff -u -r1.1.1.3.4.1.4.7.4.13 -r1.1.1.3.4.1.4.7.4.14 --- squid/src/cache_cf.c 31 Mar 2001 09:09:41 -0000 1.1.1.3.4.1.4.7.4.13 +++ squid/src/cache_cf.c 31 Mar 2001 11:12:14 -0000 1.1.1.3.4.1.4.7.4.14 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.1.1.3.4.1.4.7.4.13 2001/03/31 09:09:41 rbcollins Exp $ + * $Id: cache_cf.c,v 1.1.1.3.4.1.4.7.4.14 2001/03/31 11:12:14 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2094,6 +2094,8 @@ #define free_onoff free_int #define dump_eol dump_string #define free_eol free_string +#define dump_eol_rfc1738 dump_string +#define free_eol_rfc27138 free_string static void dump_refreshpattern(StoreEntry * entry, const char *name, void const * const data) @@ -2276,6 +2278,13 @@ *var = xstrdup(token); } +void +parse_eol_rfc1738(parserNameNode *parserName, void * data) +{ + parse_eol(parserName, data); + rfc1738_unescape (*(char **) data); +} + static void dump_time_t(StoreEntry * entry, const char *name, void const * const data) { @@ -2559,6 +2568,7 @@ parserRegisterType("instance_node", parse_instance_node, free_instance_node, dump_instance_node); parserRegisterType("acl",aclParseAclLine,free_acl,dump_acl); + parserRegisterType("eol_rfc1738",parse_eol_1738,free_eol_rfc1738,dump_eol_rfc1738); } 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.20 retrieving revision 1.1.1.3.4.1.4.12.2.21 diff -u -r1.1.1.3.4.1.4.12.2.20 -r1.1.1.3.4.1.4.12.2.21 --- squid/src/structs.h 31 Mar 2001 09:09:42 -0000 1.1.1.3.4.1.4.12.2.20 +++ squid/src/structs.h 31 Mar 2001 11:12:14 -0000 1.1.1.3.4.1.4.12.2.21 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.1.1.3.4.1.4.12.2.20 2001/03/31 09:09:42 rbcollins Exp $ + * $Id: structs.h,v 1.1.1.3.4.1.4.12.2.21 2001/03/31 11:12:14 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -287,6 +287,32 @@ sockaddr_in_list *next; }; +struct _parserTypeNode { + dlink_node node; + const char *typestr; + PARSER_PARSE *parsefunc; + PARSER_FREE *freefunc; + PARSER_DUMP *dumpfunc; + struct { + unsigned int registered:1; + } flags; +}; + +struct _parserNameNode { + dlink_node node; + dlink_list children; + dlink_list *head; + const char *namestr; + parserTypeNode *type; + PARSER_DEFAULT_NONE *default_none; + PARSER_NAME_DOCUMENT *documentfunc; + PARSER_POST_PARSE *post_parse_func; + void *location; + struct { + unsigned int registered:1; + } flags; +}; + struct _modNode { dlink_node node; char *namestr; @@ -305,7 +331,10 @@ FILTER_module *module; ADDFILTER *Add; FILTERMKSTATE *MakeState; +#if 0 FILTERPARSE *Parse; +#endif + parserNameNode *ConfigParent; void *data; }; @@ -329,32 +358,6 @@ acl_access *apply; }; -struct _parserTypeNode { - dlink_node node; - const char *typestr; - PARSER_PARSE *parsefunc; - PARSER_FREE *freefunc; - PARSER_DUMP *dumpfunc; - struct { - unsigned int registered:1; - } flags; -}; - -struct _parserNameNode { - dlink_node node; - dlink_list children; - dlink_list *head; - const char *namestr; - parserTypeNode *type; - PARSER_DEFAULT_NONE *default_none; - PARSER_NAME_DOCUMENT *documentfunc; - PARSER_POST_PARSE *post_parse_func; - void *location; - struct { - unsigned int registered:1; - } flags; -}; - #if DELAY_POOLS struct _delaySpec { int restore_bps; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.1.1.3.8.7.4.20 retrieving revision 1.1.1.3.8.7.4.21 diff -u -r1.1.1.3.8.7.4.20 -r1.1.1.3.8.7.4.21 --- squid/src/typedefs.h 31 Mar 2001 09:11:45 -0000 1.1.1.3.8.7.4.20 +++ squid/src/typedefs.h 31 Mar 2001 11:12:14 -0000 1.1.1.3.8.7.4.21 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.1.1.3.8.7.4.20 2001/03/31 09:11:45 rbcollins Exp $ + * $Id: typedefs.h,v 1.1.1.3.8.7.4.21 2001/03/31 11:12:14 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -393,7 +393,9 @@ typedef void ADDFILTERINSTANCE(FILTER_instance *); /* free any instance data, and clear the fields in an instance entry */ typedef void REMFILTERINSTANCE(FILTER_instance *); +#if 0 /* config, namestr, param_str */ typedef void FILTERPARSE(void *,const char *, char *); +#endif #endif /* _TYPEDEFS_H_ */ Index: squid/src/modules/textreplace/textreplace.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/modules/textreplace/Attic/textreplace.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -r1.1.2.12 -r1.1.2.13 --- squid/src/modules/textreplace/textreplace.c 12 Feb 2001 13:31:25 -0000 1.1.2.12 +++ squid/src/modules/textreplace/textreplace.c 31 Mar 2001 11:12:14 -0000 1.1.2.13 @@ -1,6 +1,6 @@ /* - * $Id: textreplace.c,v 1.1.2.12 2001/02/12 13:31:25 rbcollins Exp $ + * $Id: textreplace.c,v 1.1.2.13 2001/03/31 11:12:14 rbcollins Exp $ * * DEBUG: section 83 Content Processing Filters * AUTHOR: Robert Collins @@ -55,7 +55,9 @@ static REMOVEFILTER clientFilterOnUnload_Remove; static ADDFILTER clientFilterOnUnload_Add; static FILTERMKSTATE clientFilterOnUnload_MakeState; +#if 0 static FILTERPARSE clientFilterOnUnload_Parse; +#endif static DATAFILTER clientFilterOnUnload; @@ -72,13 +74,30 @@ xfree (config); } + +static void +textDocumentReplace(void) +{ + printf("\n#\tReplace matched search strings with this string. You can encode special\n" +"#\tcharacters with rfc 1738 escaping.\n\n"); +} + +static void +textDocumentSearch(void) +{ + printf("\n#\tSearch for an exact string match. You can encode special\n" +"#\tcharacters with rfc 1738 escaping.\n\n"); +} + static void clientFilterOnUnload_AddInstance (FILTER_instance * instance) { OnUnloadConfig *config; instance->Add = clientFilterOnUnload_Add; instance->MakeState = clientFilterOnUnload_MakeState; +#if 0 instance->Parse = clientFilterOnUnload_Parse; +#endif instance->data = xmalloc (sizeof (OnUnloadConfig)); /* Set defaults, if sensible defaults exist */ config = instance->data; @@ -86,6 +105,9 @@ config->replace = NULL; /* lock the instance to it is availble to us later */ cbdataLock(instance); + /* Add per-instance configuration parameters */ + parserRegisterName(instance->ConfigParent, "replace", parserTypeByName("eol_rfc1738"), &config->replace, NULL, textDocumentReplace, NULL); + parserRegisterName(instance->ConfigParent, "search", parserTypeByName("eol_rfc1738"), &config->searchstring, NULL, textDocumentSearch, NULL); } static void @@ -135,6 +157,7 @@ xfree (state); } +#if 0 static void clientFilterOnUnload_Parse (void *data, const char *namestr, char *param_str) { @@ -155,6 +178,7 @@ namestr); } } +#endif /* register as a module */ void @@ -163,12 +187,14 @@ /* Register as a potential client_side reply filter */ filterRegisterModule (namestr, clientFilterOnUnload_AddInstance, clientFilterOnUnload_RemInstance); + /* Register global configuration parameters */ } /* deregister as a module */ void mod_uninstall_textreplace(const char *namestr) { filterDeregisterModule(namestr); + /* Deregister global configurationparameters */ } char *