]> git.ipfire.org Git - thirdparty/squid.git/blame - src/esi/Parser.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / esi / Parser.cc
CommitLineData
43ae1d95 1/*
5b74111a 2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
43ae1d95 3 *
bbc27441
AJ
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
43ae1d95 7 */
8
bbc27441
AJ
9/* DEBUG: section 86 ESI processing */
10
582c2af2 11#include "squid.h"
f99c2cfe 12#include "esi/Parser.h"
582c2af2 13#include "fatal.h"
43ae1d95 14
15char *ESIParser::Type = NULL;
c2d4889f 16ESIParser::Register *ESIParser::Parsers = NULL;
dd2bdef3 17ESIParser::Register *ESIParser::Parser = NULL;
43ae1d95 18
19ESIParser::Pointer
20ESIParser::NewParser(ESIParserClient *aClient)
21{
c2d4889f 22 if (Parser == NULL) {
23 Parser = Parsers;
964b44c3 24
c2d4889f 25 while (Parser != NULL && strcasecmp(Parser->name, Type) != 0)
26 Parser = Parser->next;
43ae1d95 27
c2d4889f 28 if (Parser == NULL)
29 fatal ("Unknown ESI Parser type");
30 }
43ae1d95 31
c2d4889f 32 return (Parser->newParser)(aClient);
43ae1d95 33}
7901db21 34
af6a12ee
AJ
35ESIParser::Register::Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient)) : name(_name), newParser(_newParser)
36{
7901db21
AR
37 this->next = ESIParser::Parsers;
38 ESIParser::Parsers = this;
39}
40
af6a12ee
AJ
41ESIParser::Register::~Register()
42{
7901db21
AR
43 // TODO: support random-order deregistration
44 assert(ESIParser::Parsers == this);
45 ESIParser::Parsers = next;
46}
f53969cc 47