]>
Commit | Line | Data |
---|---|---|
1b26be8f | 1 | /* |
262a0e14 | 2 | * $Id$ |
1b26be8f | 3 | */ |
4 | ||
f7f3304a | 5 | #include "squid-old.h" |
3ad63615 AR |
6 | #include "acl/SslErrorData.h" |
7 | #include "acl/Checklist.h" | |
1b26be8f | 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 | |
4fb72cb9 | 25 | ACLSslErrorData::match(const Ssl::Errors *toFind) |
1b26be8f | 26 | { |
7a957a93 AR |
27 | for (const Ssl::Errors *err = toFind; err; err = err->next ) { |
28 | if (values->findAndTune(err->element)) | |
fb2178bb CT |
29 | return true; |
30 | } | |
31 | return false; | |
1b26be8f | 32 | } |
33 | ||
34 | /* explicit instantiation required for some systems */ | |
d85b8894 | 35 | /** \cond AUTODOCS-IGNORE */ |
fb848822 | 36 | // AYJ: 2009-05-20 : Removing. clashes with template <int> instantiation for other ACLs. |
4fb72cb9 | 37 | // template cbdata_type Ssl::Errors::CBDATA_CbDataList; |
d85b8894 | 38 | /** \endcond */ |
1b26be8f | 39 | |
40 | wordlist * | |
41 | ACLSslErrorData::dump() | |
42 | { | |
43 | wordlist *W = NULL; | |
4fb72cb9 | 44 | Ssl::Errors *data = values; |
1b26be8f | 45 | |
46 | while (data != NULL) { | |
5e430bf3 | 47 | wordlistAdd(&W, Ssl::GetErrorName(data->element)); |
1b26be8f | 48 | data = data->next; |
49 | } | |
50 | ||
51 | return W; | |
52 | } | |
53 | ||
54 | void | |
55 | ACLSslErrorData::parse() | |
56 | { | |
4fb72cb9 | 57 | Ssl::Errors **Tail; |
1b26be8f | 58 | char *t = NULL; |
59 | ||
3d0ac046 | 60 | for (Tail = &values; *Tail; Tail = &((*Tail)->next)); |
1b26be8f | 61 | while ((t = strtokFile())) { |
cf1c09f6 | 62 | Ssl::Errors *q = Ssl::ParseErrorString(t); |
1b26be8f | 63 | *(Tail) = q; |
cf1c09f6 | 64 | Tail = &q->tail()->next; |
1b26be8f | 65 | } |
66 | } | |
67 | ||
68 | bool | |
69 | ACLSslErrorData::empty() const | |
70 | { | |
71 | return values == NULL; | |
72 | } | |
73 | ||
fb2178bb | 74 | ACLSslErrorData * |
1b26be8f | 75 | ACLSslErrorData::clone() const |
76 | { | |
77 | /* Splay trees don't clone yet. */ | |
78 | assert (!values); | |
79 | return new ACLSslErrorData(*this); | |
80 | } |