From: Alex Rousskov Date: Tue, 17 Mar 2009 15:27:56 +0000 (-0600) Subject: Added ESI module management code to register and de-register ESI parsers. X-Git-Tag: SQUID_3_2_0_1~1111^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cee61d8c2222870f571c224d75397febbaa3174;p=thirdparty%2Fsquid.git Added ESI module management code to register and de-register ESI parsers. --- diff --git a/src/esi/Makefile.am b/src/esi/Makefile.am index 298fa24977..bbd58b7ed6 100644 --- a/src/esi/Makefile.am +++ b/src/esi/Makefile.am @@ -25,6 +25,8 @@ libesi_la_SOURCES = \ Literal.h \ Libxml2Parser.cc \ Libxml2Parser.h \ + Module.cc \ + Module.h \ Parser.cc \ Parser.h \ Segment.cc \ diff --git a/src/esi/Module.cc b/src/esi/Module.cc new file mode 100644 index 0000000000..cbc91c74f3 --- /dev/null +++ b/src/esi/Module.cc @@ -0,0 +1,28 @@ +#include "squid.h" +#include "esi/Module.h" +#include "esi/CustomParser.h" +#include "esi/Libxml2Parser.h" +#include "esi/ExpatParser.h" /* must follow esi/Libxml2Parser.h */ + +static ESIParser::Register *prCustom = 0; +static ESIParser::Register *prLibxml = 0; +static ESIParser::Register *prExpat = 0; + +void Esi::Init() { + assert(!prCustom); // we should be called once + prCustom = new ESIParser::Register("custom", &ESICustomParser::NewParser); + prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser); + prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser); +} + +void Esi::Clean() { + assert(prCustom); // we should be called once, and only after Init() + + delete prExpat; + delete prLibxml; + delete prCustom; + + prExpat = NULL; + prLibxml = NULL; + prCustom = NULL; +} diff --git a/src/esi/Module.h b/src/esi/Module.h new file mode 100644 index 0000000000..98483a9fb7 --- /dev/null +++ b/src/esi/Module.h @@ -0,0 +1,11 @@ +#ifndef SQUID_ESI_MODULE_H +#define SQUID_ESI_MODULE_H + +namespace Esi { + + extern void Init(); + extern void Clean(); + +}; // namespace Esi + +#endif /* SQUID_ESI_MODULE_H */