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