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