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