]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/AtStepData.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / acl / AtStepData.cc
CommitLineData
bbc27441 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
bbc27441
AJ
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
5d65362c 9#include "squid.h"
8693472e
CT
10
11#if USE_OPENSSL
12
8693472e 13#include "acl/AtStepData.h"
40f1e76d 14#include "acl/Checklist.h"
5d65362c
CT
15#include "cache_cf.h"
16#include "Debug.h"
17#include "wordlist.h"
18
19ACLAtStepData::ACLAtStepData()
20{}
21
22ACLAtStepData::ACLAtStepData(ACLAtStepData const &old)
23{
24 values.assign(old.values.begin(), old.values.end());
25}
26
27ACLAtStepData::~ACLAtStepData()
28{
29}
30
31bool
32ACLAtStepData::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
41SBufList
42ACLAtStepData::dump() const
43{
44 SBufList sl;
45 for (std::list<Ssl::BumpStep>::const_iterator it = values.begin(); it != values.end(); ++it) {
e1f72a8b
CT
46 sl.push_back(SBuf(*it == Ssl::bumpStep1 ? "SslBump1" :
47 *it == Ssl::bumpStep2 ? "SslBump2" :
1993295b 48 *it == Ssl::bumpStep3 ? "SslBump3" : "???"));
5d65362c
CT
49 }
50 return sl;
51}
52
53void
54ACLAtStepData::parse()
55{
56 while (const char *t = strtokFile()) {
1993295b 57 if (strcasecmp(t, "SslBump1") == 0) {
5d65362c 58 values.push_back(Ssl::bumpStep1);
1993295b 59 } else if (strcasecmp(t, "SslBump2") == 0) {
5d65362c 60 values.push_back(Ssl::bumpStep2);
1993295b 61 } else if (strcasecmp(t, "SslBump3") == 0) {
5d65362c
CT
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
70bool
71ACLAtStepData::empty() const
72{
73 return values.empty();
74}
75
76ACLAtStepData *
77ACLAtStepData::clone() const
78{
79 return new ACLAtStepData(*this);
80}
8693472e
CT
81
82#endif /* USE_OPENSSL */
f53969cc 83