]>
Commit | Line | Data |
---|---|---|
1b26be8f | 1 | /* |
262a0e14 | 2 | * $Id$ |
1b26be8f | 3 | */ |
4 | ||
5 | #include "squid.h" | |
6 | #include "ACLSslErrorData.h" | |
7 | #include "ACLChecklist.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_error_t toFind) | |
26 | { | |
27 | return values->findAndTune (toFind); | |
28 | } | |
29 | ||
30 | /* explicit instantiation required for some systems */ | |
31 | ||
2236466c | 32 | template cbdata_type CbDataList<ssl_error_t>::CBDATA_CbDataList; |
1b26be8f | 33 | |
34 | wordlist * | |
35 | ACLSslErrorData::dump() | |
36 | { | |
37 | wordlist *W = NULL; | |
2236466c | 38 | CbDataList<ssl_error_t> *data = values; |
1b26be8f | 39 | |
40 | while (data != NULL) { | |
41 | wordlistAdd(&W, sslFindErrorString(data->element)); | |
42 | data = data->next; | |
43 | } | |
44 | ||
45 | return W; | |
46 | } | |
47 | ||
48 | void | |
49 | ACLSslErrorData::parse() | |
50 | { | |
2236466c | 51 | CbDataList<ssl_error_t> **Tail; |
1b26be8f | 52 | char *t = NULL; |
53 | ||
3d0ac046 | 54 | for (Tail = &values; *Tail; Tail = &((*Tail)->next)); |
1b26be8f | 55 | while ((t = strtokFile())) { |
2236466c | 56 | CbDataList<ssl_error_t> *q = new CbDataList<ssl_error_t>(sslParseErrorString(t)); |
1b26be8f | 57 | *(Tail) = q; |
58 | Tail = &q->next; | |
59 | } | |
60 | } | |
61 | ||
62 | bool | |
63 | ACLSslErrorData::empty() const | |
64 | { | |
65 | return values == NULL; | |
66 | } | |
67 | ||
68 | ACLData<ssl_error_t> * | |
69 | ACLSslErrorData::clone() const | |
70 | { | |
71 | /* Splay trees don't clone yet. */ | |
72 | assert (!values); | |
73 | return new ACLSslErrorData(*this); | |
74 | } |