]>
Commit | Line | Data |
---|---|---|
eb1f6bfa | 1 | // |
7962bc6a | 2 | // $Id$ |
eb1f6bfa | 3 | // |
0b96a9b3 | 4 | // Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de> |
eb1f6bfa AJ |
5 | // |
6 | // File: squid-tlv.cc | |
7 | // Tue Jun 15 1999 | |
8 | // | |
9 | // (c) 1999 Lehrgebiet Rechnernetze und Verteilte Systeme | |
0b96a9b3 | 10 | // Universit?t Hannover, Germany |
eb1f6bfa AJ |
11 | // |
12 | // Permission to use, copy, modify, distribute, and sell this software | |
13 | // and its documentation for any purpose is hereby granted without fee, | |
14 | // provided that (i) the above copyright notices and this permission | |
15 | // notice appear in all copies of the software and related documentation, | |
16 | // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte | |
17 | // Systeme and the University of Hannover may not be used in any | |
18 | // advertising or publicity relating to the software without the | |
19 | // specific, prior written permission of Lehrgebiet Rechnernetze und | |
20 | // Verteilte Systeme and the University of Hannover. | |
21 | // | |
22 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, | |
23 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY | |
24 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | |
25 | // | |
26 | // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR | |
27 | // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, | |
28 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES | |
29 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT | |
30 | // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, | |
31 | // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
32 | // SOFTWARE. | |
33 | // | |
eb1f6bfa AJ |
34 | // Revision 1.1 1999/06/15 21:10:16 voeckler |
35 | // Initial revision | |
36 | // | |
37 | // | |
d8b258a9 | 38 | #if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) |
eb1f6bfa AJ |
39 | #pragma implementation |
40 | #endif | |
41 | ||
2ccf2eb2 AJ |
42 | #include "config.h" |
43 | //#include <assert.h> | |
eb1f6bfa AJ |
44 | #include "squid-tlv.hh" |
45 | ||
eb1f6bfa | 46 | SquidTLV::SquidTLV( SquidMetaType _type, size_t _size, void* _data ) |
feec68a0 | 47 | :next(0),size(_size) |
eb1f6bfa | 48 | { |
feec68a0 A |
49 | type = _type; |
50 | data = (char*) _data; | |
eb1f6bfa AJ |
51 | } |
52 | ||
53 | SquidMetaList::SquidMetaList() | |
54 | { | |
feec68a0 | 55 | head = tail = 0; |
eb1f6bfa AJ |
56 | } |
57 | ||
58 | SquidMetaList::~SquidMetaList() | |
59 | { | |
feec68a0 A |
60 | for ( SquidTLV* temp = head; temp; temp = head ) { |
61 | head = temp->next; | |
62 | delete temp; | |
63 | } | |
eb1f6bfa AJ |
64 | } |
65 | ||
66 | void | |
67 | SquidMetaList::append( SquidMetaType type, size_t size, void* data ) | |
68 | { | |
feec68a0 A |
69 | SquidTLV* temp = new SquidTLV( type, size, data ); |
70 | if ( head == 0 ) head = tail = temp; | |
71 | else { | |
72 | tail->next = temp; | |
73 | tail = temp; | |
74 | } | |
eb1f6bfa AJ |
75 | } |
76 | ||
77 | const SquidTLV* | |
78 | SquidMetaList::search( SquidMetaType type ) const | |
79 | { | |
feec68a0 A |
80 | const SquidTLV* temp = head; |
81 | while ( temp && temp->type != type ) temp = temp->next; | |
82 | return temp; | |
eb1f6bfa | 83 | } |