src/adaptation/Makefile \
src/adaptation/icap/Makefile \
src/adaptation/ecap/Makefile \
+ src/esi/Makefile \
src/icmp/Makefile \
src/ip/Makefile \
contrib/Makefile \
# $Id$
#
-SUBDIRS = libTrie
+SUBDIRS =
if USE_LOADABLE_MODULES
SUBDIRS += libLtdl
endif
+if USE_ESI
+SUBDIRS += libTrie
+endif
+
CLEANFILES =
xusleep.c \
$(XPROF_STATS_SOURCE) \
$(WIN32SRC)
-libmiscutil_a_LIBADD = \
- libTrie/src/Trie.o \
- libTrie/src/TrieNode.o \
- @LIBOBJS@
+libmiscutil_a_LIBADD = @LIBOBJS@
+
# $(top_srcdir)/include/version.h should be a dependency
libntlmauth_a_SOURCES = \
ntlmauth.c
ADAPTATION_LIBS = @ADAPTATION_LIBS@
+if USE_ESI
+SUBDIRS += esi
+ESI_LIBS = \
+ esi/libesi.la \
+ $(top_builddir)/lib/libTrie/src/libTrie.a
+else
+ESI_LIBS =
+endif
+
DELAY_POOL_ALL_SOURCE = \
CommonPool.h \
CompositePoolNode.h \
DELAY_POOL_SOURCE =
endif
-ESI_ALL_SOURCE = \
- ElementList.h \
- ESI.cc \
- ESI.h \
- ESIAssign.cc \
- ESIAssign.h \
- ESIAttempt.h \
- ESIContext.cc \
- ESIContext.h \
- ESICustomParser.cc \
- ESICustomParser.h \
- ESIElement.h \
- ESIExcept.h \
- ESIExpatParser.cc \
- ESIExpatParser.h \
- ESIExpression.cc \
- ESIExpression.h \
- ESIInclude.cc \
- ESIInclude.h \
- ESILiteral.h \
- ESILibxml2Parser.cc \
- ESILibxml2Parser.h \
- ESIParser.cc \
- ESIParser.h \
- ESISegment.cc \
- ESISegment.h \
- ESISequence.cc \
- ESISequence.h \
- ESIVar.h \
- ESIVarState.cc \
- ESIVarState.h
-if USE_ESI
- ESI_SOURCE = $(ESI_ALL_SOURCE)
-else
- ESI_SOURCE =
-endif
-
if ENABLE_XPROF_STATS
XPROF_STATS_SOURCE = ProfStats.cc
else
-I$(top_srcdir)/src \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
- -I$(top_srcdir)/lib/libTrie/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
@SQUID_CPPUNIT_INC@
ipc.cc \
ipc_win32.cc \
$(IDENT_ALL_SOURCE) \
- $(ESI_ALL_SOURCE) \
ProfStats.cc \
LeakFinder.cc \
LeakFinder.h \
enums.h \
errorpage.cc \
errorpage.h \
- $(ESI_SOURCE) \
ETag.cc \
event.cc \
event.h \
@REGEXLIB@ \
@SNMPLIB@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@SSLLIB@ \
-lmiscutil \
@XTRA_LIBS@ \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@REGEXLIB@ \
@SNMPLIB@ \
-L../lib -lmiscutil \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@REGEXLIB@ \
@SNMPLIB@ \
-L../lib -lmiscutil \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@REGEXLIB@ \
@SNMPLIB@ \
-L../lib -lmiscutil \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
@REPL_OBJS@ \
@STORE_LIBS_TO_ADD@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@REGEXLIB@ \
@SNMPLIB@ \
-L../lib -lmiscutil \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@REGEXLIB@ \
@SNMPLIB@ \
-L../lib -lmiscutil \
dlink.cc \
$(DNSSOURCE) \
errorpage.cc \
- $(ESI_SOURCE) \
ETag.cc \
external_acl.cc \
ExternalACLEntry.cc \
@REGEXLIB@ \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
+ ${ESI_LIBS} \
@SNMPLIB@ \
-L../lib -lmiscutil \
@SQUID_CPPUNIT_LIBS@ \
#include "RemovalPolicy.h"
#if USE_SQUID_ESI
-#include "ESIElement.h"
+#include "esi/Element.h"
#endif
class AsyncCall;
#include "snmp.h"
#endif
#if USE_SQUID_ESI
-#include "ESIParser.h"
+#include "esi/Parser.h"
#endif
#if USE_ADAPTATION
#include "clientStream.h"
#include "auth/UserRequest.h"
#if USE_SQUID_ESI
-#include "ESI.h"
+#include "esi/Esi.h"
#endif
#include "MemObject.h"
#include "fde.h"
*/
#if (USE_SQUID_ESI == 1)
-#include "ESIAssign.h"
-#include "ESIContext.h"
-#include "ESISequence.h"
+#include "esi/Assign.h"
+#include "esi/Context.h"
+#include "esi/Sequence.h"
ESIAssign::~ESIAssign()
{
#define SQUID_ESIASSIGN_H
#include "squid.h"
-#include "ESIElement.h"
+#include "esi/Element.h"
#include "SquidString.h"
-#include "ESIVarState.h"
+#include "esi/VarState.h"
/* ESIVariableExpression */
/* This is a variable that is itself and expression */
#define SQUID_ESIATTEMPT_H
#include "squid.h"
-#include "ESIElement.h"
-#include "ESISequence.h"
+#include "esi/Element.h"
+#include "esi/Sequence.h"
/* esiAttempt */
*/
#if (USE_SQUID_ESI == 1)
-#include "ESIContext.h"
+#include "esi/Context.h"
#include "Store.h"
#include "client_side_request.h"
#ifndef SQUID_ESICONTEXT_H
#define SQUID_ESICONTEXT_H
-#include "ESIElement.h"
+#include "esi/Element.h"
#include "clientStream.h"
class ESIVarState;
class ClientHttpRequest;
-#include "ESIParser.h"
+#include "esi/Parser.h"
/* ESIContext */
*/
#include "squid.h"
-#include "ESICustomParser.h"
+#include "esi/CustomParser.h"
#include "Trie.h"
#include "TrieCharTransform.h"
#include "Array.h"
Trie *ESICustomParser::SearchTrie=NULL;
-RegisterESIParser("custom", ESICustomParser);
+EsiParserDefinition(ESICustomParser);
Trie *
ESICustomParser::GetTrie()
class Trie;
/* inherits from */
-#include "ESIParser.h"
+#include "esi/Parser.h"
/* for String variables */
#include "SquidString.h"
long int lineNumber() const;
char const * errorString() const;
+ EsiParserDeclaration;
+
private:
- ESI_PARSER_TYPE;
static Trie *SearchTrie;
static Trie *GetTrie();
enum ESITAG_t {
#define SQUID_ESIELEMENT_H
#include "RefCount.h"
-#include "ESISegment.h"
+#include "esi/Segment.h"
typedef enum {
ESI_PROCESS_COMPLETE = 0,
#define SQUID_ELEMENTLIST_H
#include "squid.h"
-#include "ESIElement.h"
+#include "esi/Element.h"
class ElementList
{
*/
#if (USE_SQUID_ESI == 1)
-#include "ESI.h"
+#include "esi/Esi.h"
#include "clientStream.h"
#include "client_side_request.h"
#include "errorpage.h"
-#include "ESISegment.h"
-#include "ESIElement.h"
-#include "ESIContext.h"
+#include "esi/Segment.h"
+#include "esi/Element.h"
+#include "esi/Context.h"
#include "HttpHdrSc.h"
#include "HttpHdrScTarget.h"
#include "HttpReply.h"
-#include "ESIAttempt.h"
-#include "ESIExcept.h"
+#include "esi/Attempt.h"
+#include "esi/Except.h"
#include "client_side.h"
-#include "ESIVarState.h"
-#include "ESIAssign.h"
-#include "ESIExpression.h"
+#include "esi/VarState.h"
+#include "esi/Assign.h"
+#include "esi/Expression.h"
#include "HttpRequest.h"
#include "MemBuf.h"
#include "ip/IpAddress.h"
MEMPROXY_CLASS_INLINE(esiComment) /**DOCS_NOSEMI*/
-#include "ESILiteral.h"
+#include "esi/Literal.h"
-#include "ESISequence.h"
+#include "esi/Sequence.h"
-#include "ESIInclude.h"
+#include "esi/Include.h"
/* esiRemove */
MEMPROXY_CLASS_INLINE(esiTry) /**DOCS_NOSEMI*/
-#include "ESIVar.h"
+#include "esi/Var.h"
/* esiChoose */
#define SQUID_ESIEXCEPT_H
#include "squid.h"
-#include "ESIElement.h"
-#include "ESISequence.h"
+#include "esi/Element.h"
+#include "esi/Sequence.h"
/* esiExcept */
#if USE_SQUID_ESI
-#include "ESIExpatParser.h"
+#include "esi/ExpatParser.h"
-RegisterESIParser("expat", ESIExpatParser);
+EsiParserDefinition(ESIExpatParser);
ESIExpatParser::ESIExpatParser(ESIParserClient *aClient) : theClient (aClient)
{
#if USE_SQUID_ESI
-#include "ESIParser.h"
-#include "expat.h"
+#include "esi/Parser.h"
+#include <expat.h>
class ESIExpatParser : public ESIParser
{
long int lineNumber() const;
char const * errorString() const;
+ EsiParserDeclaration;
+
private:
- ESI_PARSER_TYPE;
/** our parser */
mutable XML_Parser p;
static void Start(void *data, const XML_Char *el, const char **attr);
*/
#include "squid.h"
-#include "ESIExpression.h"
+#include "esi/Expression.h"
/* stack precedence rules:
* before pushing an operator onto the stack, the
*/
#if (USE_SQUID_ESI == 1)
-#include "ESIInclude.h"
-#include "ESIVarState.h"
+#include "esi/Include.h"
+#include "esi/VarState.h"
#include "client_side_request.h"
#include "HttpReply.h"
#define SQUID_ESIINCLUDE_H
#include "squid.h"
-#include "ESISegment.h"
-#include "ESIElement.h"
-#include "ESIContext.h"
+#include "esi/Segment.h"
+#include "esi/Element.h"
+#include "esi/Context.h"
class ESIInclude;
typedef RefCount<ESIInclude> ESIIncludePtr;
#if USE_SQUID_ESI
-#include "ESILibxml2Parser.h"
+#include "esi/Libxml2Parser.h"
// the global document that will store the resolved entity
// definitions
static htmlDocPtr entity_doc = NULL;
-RegisterESIParser("libxml2", ESILibxml2Parser);
+EsiParserDefinition(ESILibxml2Parser);
// the SAX callback functions
void esi_startElementSAXFunc(void * ctx, const xmlChar * name, const xmlChar ** atts)
#if USE_SQUID_ESI
-#include "ESIParser.h"
+#include "esi/Parser.h"
// workaround for definition of "free" that prevents include of
// parser.h from libxml2 without errors
#ifdef free
ESIParserClient *getClient() { return theClient; }
+ EsiParserDeclaration;
+
private:
- ESI_PARSER_TYPE;
mutable xmlParserCtxtPtr parser; /* our parser */
ESIParserClient *theClient;
#define SQUID_ESILITERAL_H
#include "squid.h"
-#include "ESIElement.h"
+#include "esi/Element.h"
class ESIContext;
/* esiLiteral */
--- /dev/null
+include $(top_srcdir)/src/Common.am
+include $(top_srcdir)/src/TestHeaders.am
+
+noinst_LTLIBRARIES = libesi.la
+
+libesi_la_SOURCES = \
+ Assign.cc \
+ Assign.h \
+ Attempt.h \
+ Context.cc \
+ Context.h \
+ CustomParser.cc \
+ CustomParser.h \
+ Element.h \
+ ElementList.h \
+ Esi.cc \
+ Esi.h \
+ Except.h \
+ ExpatParser.cc \
+ ExpatParser.h \
+ Expression.cc \
+ Expression.h \
+ Include.cc \
+ Include.h \
+ Literal.h \
+ Libxml2Parser.cc \
+ Libxml2Parser.h \
+ Module.cc \
+ Module.h \
+ Parser.cc \
+ Parser.h \
+ Segment.cc \
+ Segment.h \
+ Sequence.cc \
+ Sequence.h \
+ Var.h \
+ VarState.cc \
+ VarState.h
+
+INCLUDES += \
+ -I$(top_srcdir)/lib/libTrie/include \
+ -I$(top_builddir)/lib/libTrie/include
+
--- /dev/null
+#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;
+}
--- /dev/null
+#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 */
*/
#include "squid.h"
-#include "ESIParser.h"
+#include "esi/Parser.h"
char *ESIParser::Type = NULL;
ESIParser::Register *ESIParser::Parsers = NULL;
return (Parser->newParser)(aClient);
}
+
+ESIParser::Register::Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient)) : name(_name), newParser(_newParser) {
+ this->next = ESIParser::Parsers;
+ ESIParser::Parsers = this;
+}
+
+ESIParser::Register::~Register() {
+ // TODO: support random-order deregistration
+ assert(ESIParser::Parsers == this);
+ ESIParser::Parsers = next;
+}
class ESIParser : public RefCountable
{
public:
+ class Register;
typedef RefCount<ESIParser> Pointer;
static void registerParser(const char *name, Pointer (*new_func)(ESIParserClient *aClient));
protected:
ESIParser() {};
- class Register;
-
private:
static Register *Parser;
static Register *Parsers;
{
public:
- Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient)) : name(_name), newParser(_newParser) {
- this->next = ESIParser::Parsers;
- ESIParser::Parsers = this;
- }
+ Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient));
+ ~Register();
const char *name;
ESIParser::Pointer (*newParser)(ESIParserClient *aClient);
Register * next;
};
-#define RegisterESIParser(name, ThisClass) \
- ESIParser::Register ThisClass::thisParser(name, &NewParser); \
+#define EsiParserDefinition(ThisClass) \
ESIParser::Pointer ThisClass::NewParser(ESIParserClient *aClient) \
{ \
return new ThisClass (aClient); \
}
-#define ESI_PARSER_TYPE \
- static ESIParser::Pointer NewParser(ESIParserClient *aClient); \
- static ESIParser::Register thisParser
-
+#define EsiParserDeclaration \
+ static ESIParser::Pointer NewParser(ESIParserClient *aClient)
#endif /* SQUID_ESIPARSER_H */
*/
#include "squid.h"
-#include "ESISegment.h"
+#include "esi/Segment.h"
#include "SquidString.h"
CBDATA_TYPE(ESISegment);
*/
#if (USE_SQUID_ESI == 1)
-#include "ESISequence.h"
-#include "ESILiteral.h"
-#include "ESIAttempt.h"
-#include "ESIExcept.h"
+#include "esi/Sequence.h"
+#include "esi/Literal.h"
+#include "esi/Attempt.h"
+#include "esi/Except.h"
class esiExcept;
#define SQUID_ESISEQUENCE_H
#include "squid.h"
-#include "ESIElement.h"
-#include "ElementList.h"
+#include "esi/Element.h"
+#include "esi/ElementList.h"
/* esiSequence */
#define SQUID_ESIVAR_H
#include "squid.h"
-#include "ESIElement.h"
-#include "ESISequence.h"
+#include "esi/Element.h"
+#include "esi/Sequence.h"
/* esiVar */
*/
#include "squid.h"
-#include "ESIVarState.h"
+#include "esi/VarState.h"
#include "HttpReply.h"
CBDATA_TYPE (ESIVarState);
#ifndef SQUID_ESIVARSTATE_H
#define SQUID_ESIVARSTATE_H
-#include "ESISegment.h"
+#include "esi/Segment.h"
#include "Trie.h"
#include "Array.h"
#include "HttpHeader.h"
#include "adaptation/Config.h"
#endif
+#if USE_SQUID_ESI
+#include "esi/Module.h"
+#endif
+
#if USE_WIN32_SERVICE
#include "squid_windows.h"
Adaptation::Config::Finalize(enableAdaptation);
#endif
+#if USE_SQUID_ESI
+ Esi::Init();
+#endif
debugs(1, 1, "Ready to serve requests.");
releaseServerSockets();
commCloseAllSockets();
+
+#if USE_SQUID_ESI
+ Esi::Clean();
+#endif
+
#if DELAY_POOLS
DelayPools::FreePools();
*/
#include "squid.h"
-#include "ESIExpression.h"
+#include "esi/Expression.h"
int
main ()
DEBUG_SOURCE = test_tools.cc
debug_SOURCES = debug.cc $(DEBUG_SOURCE)
ESIExpressions_SOURCES = ESIExpressions.cc $(DEBUG_SOURCE)
-ESIExpressions_LDADD = $(top_builddir)/src/ESIExpression.o \
+ESIExpressions_LDADD = $(top_builddir)/src/esi/Expression.o \
$(LDADD)
mem_node_test_SOURCES = mem_node_test.cc
mem_node_test_LDADD = $(top_builddir)/src/mem_node.o $(LDADD)