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