~yolanda.robla/+junk/squid3_fresh_branch

« back to all changes in this revision

Viewing changes to src/acl/SslErrorData.cc

  • Committer: yolanda.robla at canonical
  • Date: 2013-05-27 10:52:43 UTC
  • Revision ID: yolanda.robla@canonical.com-20130527105243-mcd0nscika17sl4w
first branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id$
 
3
 */
 
4
 
 
5
#include "squid.h"
 
6
#include "acl/SslErrorData.h"
 
7
#include "acl/Checklist.h"
 
8
#include "wordlist.h"
 
9
 
 
10
ACLSslErrorData::ACLSslErrorData() : values (NULL)
 
11
{}
 
12
 
 
13
ACLSslErrorData::ACLSslErrorData(ACLSslErrorData const &old) : values (NULL)
 
14
{
 
15
    assert (!old.values);
 
16
}
 
17
 
 
18
ACLSslErrorData::~ACLSslErrorData()
 
19
{
 
20
    if (values)
 
21
        delete values;
 
22
}
 
23
 
 
24
bool
 
25
ACLSslErrorData::match(Ssl::ssl_error_t toFind)
 
26
{
 
27
    return values->findAndTune (toFind);
 
28
}
 
29
 
 
30
/* explicit instantiation required for some systems */
 
31
/** \cond AUTODOCS-IGNORE */
 
32
// AYJ: 2009-05-20 : Removing. clashes with template <int> instantiation for other ACLs.
 
33
// template cbdata_type CbDataList<Ssl::ssl_error_t>::CBDATA_CbDataList;
 
34
/** \endcond */
 
35
 
 
36
wordlist *
 
37
ACLSslErrorData::dump()
 
38
{
 
39
    wordlist *W = NULL;
 
40
    CbDataList<Ssl::ssl_error_t> *data = values;
 
41
 
 
42
    while (data != NULL) {
 
43
        wordlistAdd(&W, Ssl::getErrorName(data->element));
 
44
        data = data->next;
 
45
    }
 
46
 
 
47
    return W;
 
48
}
 
49
 
 
50
void
 
51
ACLSslErrorData::parse()
 
52
{
 
53
    CbDataList<Ssl::ssl_error_t> **Tail;
 
54
    char *t = NULL;
 
55
 
 
56
    for (Tail = &values; *Tail; Tail = &((*Tail)->next));
 
57
    while ((t = strtokFile())) {
 
58
        CbDataList<Ssl::ssl_error_t> *q = new CbDataList<Ssl::ssl_error_t>(Ssl::parseErrorString(t));
 
59
        *(Tail) = q;
 
60
        Tail = &q->next;
 
61
    }
 
62
}
 
63
 
 
64
bool
 
65
ACLSslErrorData::empty() const
 
66
{
 
67
    return values == NULL;
 
68
}
 
69
 
 
70
ACLData<Ssl::ssl_error_t> *
 
71
ACLSslErrorData::clone() const
 
72
{
 
73
    /* Splay trees don't clone yet. */
 
74
    assert (!values);
 
75
    return new ACLSslErrorData(*this);
 
76
}