rbcollins_filters update

From: Robert Collins <robert.collins@dont-contact.us>
Date: Sun, 1 Apr 2001 00:27:09 +1000

This is just a heads up to anyone whos working from the
rbcollins_filters branch.

I still haven't migrated it across to the content _processing branch -
the code that goes in there will have the oft discussed protocol
intermediary.

However in tracking down a unexpected bug (in code that should be ok) I
merged down the code from HEAD... via generic_modules, so
rbcollins_filters now has my alpha declarative parsing code in it.

What does this mean if you've written a content filter?

The FILTERPARSE typedef, is gone. So is the instance->Parse variable.

Instead your _Add function should call
parserRegisterName(instance->ConfigParent, <option literal>,
parserTypeByName(<option type>), <storage location>, <default if none
function>, <document function>, <post parse function>);
once for each configuration option you have.
Where
<option literal> is the string to match for your option.
<option type> is the parser type to lookup - ie "eol" or "acl_access"
<storage location> is a pointer to the memory area the option is to be
parsed into. For content processing modules this will always be a
pointer to a variable in your instance struct. (below config ==
instance->data)
<default if none function>, is the function to call if no entries are
found at all. (only applicable to list style types)
<document function>, is the function for squid to call to provide user
tips on configuration.
<post parse function>, is a sanity checking function that can be called
after all configuration options are read in. Typically you will only
have one per module, on any of the options. This is called after the
entire config file is processed, and is useful if you need to cross
reference config options (ie, verify that an externally referenced file
exists)

If you need a custom type parsing routine, you need to register that
during your mod_register function.
For more information give me a shout (doco is spare right now ).

The following sample code is for the textreplace filter.

  /* 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);

Rob
Received on Sat Mar 31 2001 - 07:28:42 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:42 MST