]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/AtStepData.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / acl / AtStepData.cc
1 /*
2 * Copyright (C) 1996-2017 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
11 #if USE_OPENSSL
12
13 #include "acl/AtStepData.h"
14 #include "acl/Checklist.h"
15 #include "cache_cf.h"
16 #include "ConfigParser.h"
17 #include "Debug.h"
18 #include "wordlist.h"
19
20 ACLAtStepData::ACLAtStepData()
21 {}
22
23 ACLAtStepData::ACLAtStepData(ACLAtStepData const &old)
24 {
25 values.assign(old.values.begin(), old.values.end());
26 }
27
28 ACLAtStepData::~ACLAtStepData()
29 {
30 }
31
32 bool
33 ACLAtStepData::match(Ssl::BumpStep toFind)
34 {
35 for (std::list<Ssl::BumpStep>::const_iterator it = values.begin(); it != values.end(); ++it) {
36 if (*it == toFind)
37 return true;
38 }
39 return false;
40 }
41
42 SBufList
43 ACLAtStepData::dump() const
44 {
45 SBufList sl;
46 for (std::list<Ssl::BumpStep>::const_iterator it = values.begin(); it != values.end(); ++it) {
47 sl.push_back(SBuf(*it == Ssl::bumpStep1 ? "SslBump1" :
48 *it == Ssl::bumpStep2 ? "SslBump2" :
49 *it == Ssl::bumpStep3 ? "SslBump3" : "???"));
50 }
51 return sl;
52 }
53
54 void
55 ACLAtStepData::parse()
56 {
57 while (const char *t = ConfigParser::strtokFile()) {
58 if (strcasecmp(t, "SslBump1") == 0) {
59 values.push_back(Ssl::bumpStep1);
60 } else if (strcasecmp(t, "SslBump2") == 0) {
61 values.push_back(Ssl::bumpStep2);
62 } else if (strcasecmp(t, "SslBump3") == 0) {
63 values.push_back(Ssl::bumpStep3);
64 } else {
65 debugs(28, DBG_CRITICAL, "FATAL: invalid AtStep step: " << t);
66 self_destruct();
67 }
68 }
69 }
70
71 bool
72 ACLAtStepData::empty() const
73 {
74 return values.empty();
75 }
76
77 ACLAtStepData *
78 ACLAtStepData::clone() const
79 {
80 return new ACLAtStepData(*this);
81 }
82
83 #endif /* USE_OPENSSL */
84