]> git.ipfire.org Git - thirdparty/squid.git/blame - src/RemovalPolicy.h
Various audit updates
[thirdparty/squid.git] / src / RemovalPolicy.h
CommitLineData
aa839030 1
2/*
aa839030 3 *
4 * SQUID Web Proxy Cache http://www.squid-cache.org/
5 * ----------------------------------------------------------
6 *
7 * Squid is the result of efforts by numerous individuals from
8 * the Internet community; see the CONTRIBUTORS file for full
9 * details. Many organizations have provided support for Squid's
10 * development; see the SPONSORS file for full details. Squid is
11 * Copyrighted (C) 2001 by the Regents of the University of
12 * California; see the COPYRIGHT file for full details. Squid
13 * incorporates software developed and/or copyrighted by other
14 * sources; see the CREDITS file for full details.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
26ac0430 20 *
aa839030 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26ac0430 25 *
aa839030 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
29 *
30 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
31 */
32
33#ifndef SQUID_REMOVALPOLICY_H
34#define SQUID_REMOVALPOLICY_H
35
aa839030 36#include "cbdata.h"
37
38class RemovalPolicyWalker;
39class RemovalPurgeWalker;
40
41class RemovalPolicySettings
42{
43
44public:
45 RemovalPolicySettings() : type(NULL), args(NULL) {};
46
47 char *type;
48 wordlist *args;
49};
50
51class RemovalPolicyNode
52{
53
54public:
55 RemovalPolicyNode() : data(NULL) {}
56
57 void *data;
58};
59
60class RemovalPolicy
61{
26ac0430 62public:
aa839030 63 const char *_type;
64 void *_data;
65 void (*Free) (RemovalPolicy * policy);
66 void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
67 void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
68 void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
69 void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
70 RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
71 RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
72 void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
26ac0430 73private:
aa839030 74 CBDATA_CLASS2(RemovalPolicy);
75};
76
77class RemovalPolicyWalker
78{
26ac0430 79public:
aa839030 80 RemovalPolicy *_policy;
81 void *_data;
82 const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
83 void (*Done) (RemovalPolicyWalker * walker);
26ac0430 84private:
aa839030 85 CBDATA_CLASS2(RemovalPolicyWalker);
86};
87
88class RemovalPurgeWalker
89{
26ac0430 90public:
aa839030 91 RemovalPolicy *_policy;
92 void *_data;
93 int scanned, max_scan, locked;
94 StoreEntry *(*Next) (RemovalPurgeWalker * walker);
95 void (*Done) (RemovalPurgeWalker * walker);
26ac0430 96private:
aa839030 97 CBDATA_CLASS2(RemovalPurgeWalker);
98};
99
8a648e8d 100RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
aa839030 101
102typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
103
aa839030 104#endif /* SQUID_REMOVALPOLICY_H */