]> git.ipfire.org Git - thirdparty/squid.git/blame - tools/purge/squid-tlv.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / tools / purge / squid-tlv.cc
CommitLineData
5f623035 1/*
f70aedc4 2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
5f623035
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
0b96a9b3 9// Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de>
eb1f6bfa
AJ
10//
11// File: squid-tlv.cc
12// Tue Jun 15 1999
13//
14// (c) 1999 Lehrgebiet Rechnernetze und Verteilte Systeme
0b96a9b3 15// Universit?t Hannover, Germany
eb1f6bfa
AJ
16//
17// Permission to use, copy, modify, distribute, and sell this software
18// and its documentation for any purpose is hereby granted without fee,
19// provided that (i) the above copyright notices and this permission
20// notice appear in all copies of the software and related documentation,
21// and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte
22// Systeme and the University of Hannover may not be used in any
23// advertising or publicity relating to the software without the
24// specific, prior written permission of Lehrgebiet Rechnernetze und
25// Verteilte Systeme and the University of Hannover.
26//
27// THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
28// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
29// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
30//
31// IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR
32// THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
33// INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
34// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
35// ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
36// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
37// SOFTWARE.
38//
eb1f6bfa
AJ
39// Revision 1.1 1999/06/15 21:10:16 voeckler
40// Initial revision
41//
5f623035 42
f7f3304a 43#include "squid.h"
eb1f6bfa
AJ
44#include "squid-tlv.hh"
45
eb1f6bfa 46SquidTLV::SquidTLV( SquidMetaType _type, size_t _size, void* _data )
f53969cc 47 :next(0),size(_size)
eb1f6bfa 48{
feec68a0
A
49 type = _type;
50 data = (char*) _data;
eb1f6bfa
AJ
51}
52
53SquidMetaList::SquidMetaList()
54{
feec68a0 55 head = tail = 0;
eb1f6bfa
AJ
56}
57
58SquidMetaList::~SquidMetaList()
59{
feec68a0
A
60 for ( SquidTLV* temp = head; temp; temp = head ) {
61 head = temp->next;
62 delete temp;
63 }
eb1f6bfa
AJ
64}
65
66void
67SquidMetaList::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
77const SquidTLV*
78SquidMetaList::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}
f53969cc 84