// // $Id: squid-tlv.hh,v 1.1 1999/06/15 21:10:16 voeckler Exp $ // // Author: Jens-S. Vöckler // // File: squid-tlv.hh // Tue Jun 15 1999 // // (c) 1999 Lehrgebiet Rechnernetze und Verteilte Systeme // Universität Hannover, Germany // // Permission to use, copy, modify, distribute, and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that (i) the above copyright notices and this permission // notice appear in all copies of the software and related documentation, // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte // Systeme and the University of Hannover may not be used in any // advertising or publicity relating to the software without the // specific, prior written permission of Lehrgebiet Rechnernetze und // Verteilte Systeme and the University of Hannover. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS // SOFTWARE. // // $Log: squid-tlv.hh,v $ // Revision 1.1 1999/06/15 21:10:16 voeckler // Initial revision // #ifndef _SQUID_TLV_HH #define _SQUID_TLV_HH #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else #ifndef HAS_BOOL #define HAS_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif #include #include #include #include // taken from Squid-2.x // NOTE! We must preserve the order of this list! enum SquidMetaType { STORE_META_VOID, // should not come up STORE_META_KEY_URL, // key w/ keytype STORE_META_KEY_SHA, STORE_META_KEY_MD5, STORE_META_URL, // the url , if not in the header STORE_META_STD, // standard metadata STORE_META_HITMETERING, // reserved for hit metering STORE_META_VALID, STORE_META_END }; // taken from Squid-2.x struct StoreMetaStd { time_t timestamp; time_t lastref; time_t expires; time_t lastmod; size_t swap_file_sz; u_short refcount; u_short flags; }; struct SquidTLV { // create a shallow reference pointing into the "buffer" variable // do not copy --> saves times, saves memory. SquidTLV( SquidMetaType _type, size_t _size = 0, void* _data = 0 ); ~SquidTLV() {} SquidTLV* next; size_t size; SquidMetaType type; char* data; }; class SquidMetaList { public: SquidMetaList(); ~SquidMetaList(); void append( SquidMetaType type, size_t size, void* data ); const SquidTLV* search( SquidMetaType type ) const; private: SquidTLV* head; SquidTLV* tail; }; #endif // _SQUID_TLV_HH