]> git.ipfire.org Git - thirdparty/squid.git/blob - src/XactionInitiator.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / XactionInitiator.cc
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #include "squid.h"
10 #include "cache_cf.h"
11 #include "Debug.h"
12 #include "XactionInitiator.h"
13
14 #include <map>
15 #include <string>
16
17 XactionInitiator::Initiators
18 XactionInitiator::ParseInitiators(const char *name)
19 {
20 typedef std::map<std::string, XactionInitiator::Initiators> InitiatorsMap;
21 static InitiatorsMap SupportedInitiators = {
22 {"client", initClient},
23 {"peer-pool", initPeerPool},
24 {"certificate-fetching", initCertFetcher},
25 {"esi", initEsi},
26 {"cache-digest", initCacheDigest},
27 {"server", initServer},
28 {"htcp", initHtcp},
29 {"icp", initIcp},
30 {"icmp", initIcmp},
31 {"asn", initAsn},
32 {"ipc", initIpc},
33 {"adaptation", initAdaptation},
34 {"icon", initIcon},
35 {"peer-mcast", initPeerMcast},
36 {"internal", InternalInitiators()},
37 {"all", AllInitiators()}
38 };
39 const auto it = SupportedInitiators.find(name);
40 if (it != SupportedInitiators.cend())
41 return it->second;
42
43 debugs(28, DBG_CRITICAL, "FATAL: Invalid transaction_initiator value near " << name);
44 self_destruct();
45 return 0;
46 }
47