]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added ESI module management code to register and de-register ESI parsers.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 17 Mar 2009 15:27:56 +0000 (09:27 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 17 Mar 2009 15:27:56 +0000 (09:27 -0600)
src/esi/Makefile.am
src/esi/Module.cc [new file with mode: 0644]
src/esi/Module.h [new file with mode: 0644]

index 298fa2497705a10620814900613274cd2c2bd5a5..bbd58b7ed6c87ae6e5a4bd0ab8c5c183d6027850 100644 (file)
@@ -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 (file)
index 0000000..cbc91c7
--- /dev/null
@@ -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 (file)
index 0000000..98483a9
--- /dev/null
@@ -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 */